@@ -516,6 +516,7 @@ function _colorChange(data, oldHue) {
516
516
return {
517
517
hsl : hsl ,
518
518
hex : color . toHexString ( ) . toUpperCase ( ) ,
519
+ hex8 : color . toHex8String ( ) . toUpperCase ( ) ,
519
520
rgba : color . toRgb ( ) ,
520
521
hsv : hsv ,
521
522
oldHue : data . h || oldHue || hsl . h ,
@@ -927,7 +928,7 @@ var _color2 = _interopRequireDefault(_color);
927
928
function _interopRequireDefault ( obj ) { return obj && obj . __esModule ? obj : { default : obj } ; }
928
929
929
930
var VueColor = {
930
- version : '2.5 .0' ,
931
+ version : '2.6 .0' ,
931
932
Compact : _Compact2 . default ,
932
933
Grayscale : _Grayscale2 . default ,
933
934
Material : _Material2 . default ,
@@ -3071,7 +3072,7 @@ exports = module.exports = __webpack_require__(0)(false);
3071
3072
3072
3073
3073
3074
// module
3074
- exports . push ( [ module . i , "\n.vc-slider {\n position: relative;\n width: 410px;\n}\n.vc-slider-hue-warp {\n height: 12px;\n position: relative;\n}\n.vc-slider-hue-warp .vc-hue-picker {\n width: 14px;\n height: 14px;\n border-radius: 6px;\n transform: translate(-7px, -2px);\n background-color: rgb(248, 248, 248);\n box-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.37);\n}\n.vc-slider-swatches {\n display: flex;\n margin-top: 20px;\n}\n.vc-slider-swatch {\n margin-right: 1px;\n flex: 1;\n width: 20%;\n}\n.vc-slider-swatch:first-child {\n margin-right: 1px;\n}\n.vc-slider-swatch:first-child .vc-slider-swatch-picker {\n border-radius: 2px 0px 0px 2px;\n}\n.vc-slider-swatch:last-child {\n margin-right: 0;\n}\n.vc-slider-swatch:last-child .vc-slider-swatch-picker {\n border-radius: 0px 2px 2px 0px;\n}\n.vc-slider-swatch-picker {\n cursor: pointer;\n height: 12px;\n}\n.vc-slider-swatch-picker--active {\n transform: scaleY(1.8);\n border-radius: 3.6px/2px;\n}\n" , "" ] ) ;
3075
+ exports . push ( [ module . i , "\n.vc-slider {\n position: relative;\n width: 410px;\n}\n.vc-slider-hue-warp {\n height: 12px;\n position: relative;\n}\n.vc-slider-hue-warp .vc-hue-picker {\n width: 14px;\n height: 14px;\n border-radius: 6px;\n transform: translate(-7px, -2px);\n background-color: rgb(248, 248, 248);\n box-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.37);\n}\n.vc-slider-swatches {\n display: flex;\n margin-top: 20px;\n}\n.vc-slider-swatch {\n margin-right: 1px;\n flex: 1;\n width: 20%;\n}\n.vc-slider-swatch:first-child {\n margin-right: 1px;\n}\n.vc-slider-swatch:first-child .vc-slider-swatch-picker {\n border-radius: 2px 0px 0px 2px;\n}\n.vc-slider-swatch:last-child {\n margin-right: 0;\n}\n.vc-slider-swatch:last-child .vc-slider-swatch-picker {\n border-radius: 0px 2px 2px 0px;\n}\n.vc-slider-swatch-picker {\n cursor: pointer;\n height: 12px;\n}\n.vc-slider-swatch-picker--active {\n transform: scaleY(1.8);\n border-radius: 3.6px/2px;\n}\n.vc-slider-swatch-picker--white {\n box-shadow: inset 0 0 0 1px #ddd;\n}\n.vc-slider-swatch-picker--active.vc-slider-swatch-picker--white {\n box-shadow: inset 0 0 0 0.6px #ddd;\n}\n" , "" ] ) ;
3075
3076
3076
3077
// exports
3077
3078
@@ -3101,25 +3102,32 @@ exports.default = {
3101
3102
name : 'Slider' ,
3102
3103
mixins : [ _color2 . default ] ,
3103
3104
props : {
3104
- direction : String
3105
+ swatches : {
3106
+ type : Array ,
3107
+ default : function _default ( ) {
3108
+ return [ '.80' , '.65' , '.50' , '.35' , '.20' ] ;
3109
+ }
3110
+ }
3105
3111
} ,
3106
3112
components : {
3107
3113
hue : _Hue2 . default
3108
3114
} ,
3109
3115
computed : {
3110
3116
activeOffset : function activeOffset ( ) {
3111
- if ( Math . round ( this . colors . hsl . s * 100 ) / 100 === 0.50 ) {
3112
- return Math . round ( this . colors . hsl . l * 100 ) / 100 ;
3117
+ var hasBlack = this . swatches . includes ( '0' ) ;
3118
+ var hasWhite = this . swatches . includes ( '1' ) ;
3119
+ var hsl = this . colors . hsl ;
3120
+
3121
+ if ( Math . round ( hsl . s * 100 ) / 100 === 0.50 ) {
3122
+ return Math . round ( hsl . l * 100 ) / 100 ;
3123
+ } else if ( hasBlack && hsl . l === 0 ) {
3124
+ return 0 ;
3125
+ } else if ( hasWhite && hsl . l === 1 ) {
3126
+ return 1 ;
3113
3127
}
3114
- return 0 ;
3128
+ return - 1 ;
3115
3129
}
3116
3130
} ,
3117
- data : function data ( ) {
3118
- return {
3119
- swatches : [ '.80' , '.65' , '.50' , '.35' , '.20' ]
3120
- } ;
3121
- } ,
3122
-
3123
3131
methods : {
3124
3132
hueChange : function hueChange ( data ) {
3125
3133
this . colorChange ( data ) ;
@@ -3394,7 +3402,7 @@ var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._sel
3394
3402
} , [ _c ( 'div' , {
3395
3403
staticClass : "vc-slider-swatch-picker" ,
3396
3404
class : {
3397
- 'vc-slider-swatch-picker--active' : offset == _vm . activeOffset
3405
+ 'vc-slider-swatch-picker--active' : offset == _vm . activeOffset , 'vc-slider-swatch-picker--white' : offset === '1'
3398
3406
} ,
3399
3407
style : ( {
3400
3408
background : 'hsl(' + _vm . colors . hsl . h + ', 50%, ' + ( offset * 100 ) + '%)'
@@ -5218,7 +5226,7 @@ exports = module.exports = __webpack_require__(0)(false);
5218
5226
5219
5227
5220
5228
// module
5221
- exports . push ( [ module . i , "\n.vc-sketch {\n position: relative;\n width: 200px;\n padding: 10px 10px 0;\n box-sizing: initial;\n background: #fff;\n border-radius: 4px;\n box-shadow: 0 0 0 1px rgba(0, 0, 0, .15), 0 8px 16px rgba(0, 0, 0, .15);\n}\n.vc-sketch-saturation-wrap {\n width: 100%;\n padding-bottom: 75%;\n position: relative;\n overflow: hidden;\n}\n.vc-sketch-controls {\n display: flex;\n}\n.vc-sketch-sliders {\n padding: 4px 0;\n flex: 1;\n}\n.vc-sketch-sliders .vc-hue,\n.vc-sketch-sliders .vc-alpha-gradient {\n border-radius: 2px;\n}\n.vc-sketch-hue-wrap {\n position: relative;\n height: 10px;\n}\n.vc-sketch-alpha-wrap {\n position: relative;\n height: 10px;\n margin-top: 4px;\n overflow: hidden;\n}\n.vc-sketch-color-wrap {\n width: 24px;\n height: 24px;\n position: relative;\n margin-top: 4px;\n margin-left: 4px;\n border-radius: 3px;\n}\n.vc-sketch-active-color {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n border-radius: 2px;\n box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15), inset 0 0 4px rgba(0, 0, 0, .25);\n z-index: 2;\n}\n.vc-sketch-color-wrap .vc-checkerboard {\n background-size: auto;\n}\n.vc-sketch-field {\n display: flex;\n padding-top: 4px;\n}\n.vc-sketch-field .vc-input__input {\n width: 80%;\n padding: 4px 10% 3px;\n border: none;\n box-shadow: inset 0 0 0 1px #ccc;\n font-size: 11px;\n}\n.vc-sketch-field .vc-input__label {\n display: block;\n text-align: center;\n font-size: 11px;\n color: #222;\n padding-top: 3px;\n padding-bottom: 4px;\n text-transform: capitalize;\n}\n.vc-sketch-field--single {\n flex: 1;\n padding-left: 6px;\n}\n.vc-sketch-field--double {\n flex: 2;\n}\n.vc-sketch-presets {\n margin-right: -10px;\n margin-left: -10px;\n padding-left: 10px;\n padding-top: 10px;\n border-top: 1px solid #eee;\n}\n.vc-sketch-presets-color {\n border-radius: 3px;\n overflow: hidden;\n position: relative;\n display: inline-block;\n margin: 0 10px 10px 0;\n vertical-align: top;\n cursor: pointer;\n width: 16px;\n height: 16px;\n box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15);\n}\n.vc-sketch-presets-color .vc-checkerboard {\n box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15);\n border-radius: 3px;\n}\n.vc-sketch__disable-alpha .vc-sketch-color-wrap {\n height: 10px;\n}\n" , "" ] ) ;
5229
+ exports . push ( [ module . i , "\n.vc-sketch {\n position: relative;\n width: 200px;\n padding: 10px 10px 0;\n box-sizing: initial;\n background: #fff;\n border-radius: 4px;\n box-shadow: 0 0 0 1px rgba(0, 0, 0, .15), 0 8px 16px rgba(0, 0, 0, .15);\n}\n.vc-sketch-saturation-wrap {\n width: 100%;\n padding-bottom: 75%;\n position: relative;\n overflow: hidden;\n}\n.vc-sketch-controls {\n display: flex;\n}\n.vc-sketch-sliders {\n padding: 4px 0;\n flex: 1;\n}\n.vc-sketch-sliders .vc-hue,\n.vc-sketch-sliders .vc-alpha-gradient {\n border-radius: 2px;\n}\n.vc-sketch-hue-wrap {\n position: relative;\n height: 10px;\n}\n.vc-sketch-alpha-wrap {\n position: relative;\n height: 10px;\n margin-top: 4px;\n overflow: hidden;\n}\n.vc-sketch-color-wrap {\n width: 24px;\n height: 24px;\n position: relative;\n margin-top: 4px;\n margin-left: 4px;\n border-radius: 3px;\n}\n.vc-sketch-active-color {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n border-radius: 2px;\n box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15), inset 0 0 4px rgba(0, 0, 0, .25);\n z-index: 2;\n}\n.vc-sketch-color-wrap .vc-checkerboard {\n background-size: auto;\n}\n.vc-sketch-field {\n display: flex;\n padding-top: 4px;\n}\n.vc-sketch-field .vc-input__input {\n width: 90%;\n padding: 4px 0 3px 10%;\n border: none;\n box-shadow: inset 0 0 0 1px #ccc;\n font-size: 10px;\n}\n.vc-sketch-field .vc-input__label {\n display: block;\n text-align: center;\n font-size: 11px;\n color: #222;\n padding-top: 3px;\n padding-bottom: 4px;\n text-transform: capitalize;\n}\n.vc-sketch-field--single {\n flex: 1;\n padding-left: 6px;\n}\n.vc-sketch-field--double {\n flex: 2;\n}\n.vc-sketch-presets {\n margin-right: -10px;\n margin-left: -10px;\n padding-left: 10px;\n padding-top: 10px;\n border-top: 1px solid #eee;\n}\n.vc-sketch-presets-color {\n border-radius: 3px;\n overflow: hidden;\n position: relative;\n display: inline-block;\n margin: 0 10px 10px 0;\n vertical-align: top;\n cursor: pointer;\n width: 16px;\n height: 16px;\n box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15);\n}\n.vc-sketch-presets-color .vc-checkerboard {\n box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15);\n border-radius: 3px;\n}\n.vc-sketch__disable-alpha .vc-sketch-color-wrap {\n height: 10px;\n}\n" , "" ] ) ;
5222
5230
5223
5231
// exports
5224
5232
@@ -5290,7 +5298,13 @@ exports.default = {
5290
5298
} ,
5291
5299
computed : {
5292
5300
hex : function hex ( ) {
5293
- return this . colors . hex . replace ( '#' , '' ) ;
5301
+ var hex = void 0 ;
5302
+ if ( this . colors . a < 1 ) {
5303
+ hex = this . colors . hex8 ;
5304
+ } else {
5305
+ hex = this . colors . hex ;
5306
+ }
5307
+ return hex . replace ( '#' , '' ) ;
5294
5308
} ,
5295
5309
activeColor : function activeColor ( ) {
5296
5310
var rgba = this . colors . rgba ;
@@ -5667,24 +5681,12 @@ exports.default = {
5667
5681
activeColor : function activeColor ( ) {
5668
5682
var rgba = this . colors . rgba ;
5669
5683
return 'rgba(' + [ rgba . r , rgba . g , rgba . b , rgba . a ] . join ( ',' ) + ')' ;
5670
- }
5671
- } ,
5672
- watch : {
5673
- colors : function colors ( newVal ) {
5674
- var a = newVal . a ;
5675
-
5676
- if ( a < 1 && this . fieldsIndex === 0 ) {
5677
- this . fieldsIndex = 1 ;
5678
- }
5684
+ } ,
5685
+ hasAlpha : function hasAlpha ( ) {
5686
+ return this . colors . a < 1 ;
5679
5687
}
5680
5688
} ,
5681
5689
methods : {
5682
- handlePreset : function handlePreset ( c ) {
5683
- this . colorChange ( {
5684
- hex : c ,
5685
- source : 'hex'
5686
- } ) ;
5687
- } ,
5688
5690
childChange : function childChange ( data ) {
5689
5691
this . colorChange ( data ) ;
5690
5692
} ,
@@ -5719,7 +5721,7 @@ exports.default = {
5719
5721
} ,
5720
5722
toggleViews : function toggleViews ( ) {
5721
5723
if ( this . fieldsIndex >= 2 ) {
5722
- this . fieldsIndex = this . colors . a < 1 ? 1 : 0 ;
5724
+ this . fieldsIndex = 0 ;
5723
5725
return ;
5724
5726
}
5725
5727
this . fieldsIndex ++ ;
@@ -5808,15 +5810,23 @@ var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._sel
5808
5810
staticClass : "vc-chrome-fields"
5809
5811
} , [ _c ( 'div' , {
5810
5812
staticClass : "vc-chrome-field"
5811
- } , [ _c ( 'ed-in' , {
5813
+ } , [ ( ! _vm . hasAlpha ) ? _c ( 'ed-in' , {
5812
5814
attrs : {
5813
5815
"label" : "hex" ,
5814
5816
"value" : _vm . colors . hex
5815
5817
} ,
5816
5818
on : {
5817
5819
"change" : _vm . inputChange
5818
5820
}
5819
- } ) ] , 1 ) ] ) , _vm . _v ( " " ) , _c ( 'div' , {
5821
+ } ) : _vm . _e ( ) , _vm . _v ( " " ) , ( _vm . hasAlpha ) ? _c ( 'ed-in' , {
5822
+ attrs : {
5823
+ "label" : "hex" ,
5824
+ "value" : _vm . colors . hex8
5825
+ } ,
5826
+ on : {
5827
+ "change" : _vm . inputChange
5828
+ }
5829
+ } ) : _vm . _e ( ) ] , 1 ) ] ) , _vm . _v ( " " ) , _c ( 'div' , {
5820
5830
directives : [ {
5821
5831
name : "show" ,
5822
5832
rawName : "v-show" ,
0 commit comments