@@ -1341,7 +1341,7 @@ const config = {
1341
1341
defaultColor : "rgba(175, 51, 242, 1)" ,
1342
1342
defaultGradient : "linear-gradient(90deg, rgb(245, 66, 245) 0%, rgb(0, 0, 255) 100%)"
1343
1343
} ;
1344
- const fakePresets = [
1344
+ const presetColors = [
1345
1345
"rgba(0,0,0,1)" ,
1346
1346
"rgba(128,128,128, 1)" ,
1347
1347
"rgba(192,192,192, 1)" ,
@@ -2528,10 +2528,14 @@ function useColor() {
2528
2528
gradientType . value = GradientType . radial ;
2529
2529
} ;
2530
2530
const init = ( data , cb ) => {
2531
+ var _a ;
2531
2532
Object . assign ( colorState , data ) ;
2532
2533
colorState . width = data . width <= 320 ? 304 : data . width - 16 ;
2533
2534
colorState . height = data . width ;
2534
2535
onChange = cb ;
2536
+ if ( colorState . presetColors && ( ( _a = colorState . presetColors ) == null ? void 0 : _a . length ) > 18 ) {
2537
+ colorState . presetColors . length = 18 ;
2538
+ }
2535
2539
if ( colorState . value ) {
2536
2540
const isGradient2 = getIsGradient ( colorState . value ) ;
2537
2541
colorState . inputType = InputType . rgb ;
@@ -3044,7 +3048,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
3044
3048
onClick : _cache [ 0 ] || ( _cache [ 0 ] = //@ts -ignore
3045
3049
( ...args ) => unref ( handleUpdateValue ) && unref ( handleUpdateValue ) ( ...args ) )
3046
3050
} , [
3047
- ( openBlock ( true ) , createElementBlock ( Fragment , null , renderList ( unref ( fakePresets ) , ( color , idx ) => {
3051
+ ( openBlock ( true ) , createElementBlock ( Fragment , null , renderList ( unref ( colorState2 ) . presetColors , ( color , idx ) => {
3048
3052
return openBlock ( ) , createElementBlock ( "span" , {
3049
3053
key : color + idx ,
3050
3054
class : "cpg-preview-presetItem" ,
@@ -3769,6 +3773,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
3769
3773
type : String ,
3770
3774
default : "rgba(175, 51, 242, 1)"
3771
3775
} ,
3776
+ width : {
3777
+ type : Number ,
3778
+ default : 300
3779
+ } ,
3772
3780
hideInputs : {
3773
3781
type : Boolean ,
3774
3782
default : false
@@ -3777,27 +3785,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
3777
3785
type : Boolean ,
3778
3786
default : false
3779
3787
} ,
3780
- hidePresets : {
3781
- type : Boolean ,
3782
- default : false
3783
- } ,
3784
- hideColorGuide : {
3785
- type : Boolean ,
3786
- default : false
3787
- } ,
3788
3788
hideGradient : {
3789
3789
type : Boolean ,
3790
3790
default : false
3791
3791
} ,
3792
- width : {
3793
- type : Number ,
3794
- default : 300
3795
- } ,
3796
- disableDarkMode : {
3797
- type : Boolean ,
3798
- default : false
3792
+ presetColors : {
3793
+ type : Array ,
3794
+ default : ( ) => presetColors
3799
3795
} ,
3800
- disableLightMode : {
3796
+ hidePresets : {
3801
3797
type : Boolean ,
3802
3798
default : false
3803
3799
}
0 commit comments