From 3870d4e714d6ea73fffd2bdb09764c3733d0123a Mon Sep 17 00:00:00 2001 From: easylogic Date: Mon, 18 Nov 2019 14:13:09 +0900 Subject: [PATCH] implement onLastUpdate --- addon/codemirror-colorpicker.js | 208 +++++++------------------ dist/codemirror-colorpicker.js | 75 ++++++--- dist/codemirror-colorpicker.min.js | 2 +- index.html | 5 +- package.json | 2 +- src/colorpicker/BaseBox.js | 8 +- src/colorpicker/BaseColorPicker.js | 28 +++- src/colorpicker/ui/ColorInformation.js | 22 ++- src/colorpicker/ui/ColorPalette.js | 20 ++- src/colorpicker/ui/ColorWheel.js | 10 +- src/colorpicker/ui/CurrentColorSets.js | 1 + 11 files changed, 188 insertions(+), 193 deletions(-) diff --git a/addon/codemirror-colorpicker.js b/addon/codemirror-colorpicker.js index 50edcf9..f8783a9 100644 --- a/addon/codemirror-colorpicker.js +++ b/addon/codemirror-colorpicker.js @@ -158,18 +158,6 @@ var math = { caculateAngle: caculateAngle }; -/** - * @method RGBtoHSV - * - * convert rgb to hsv - * - * color.RGBtoHSV(0, 0, 255) === { h : 240, s : 1, v : 1 } === '#FFFF00' - * - * @param {Number} R red color value - * @param {Number} G green color value - * @param {Number} B blue color value - * @return {Object} hsv color code - */ function RGBtoHSV(r, g, b) { if (arguments.length == 1) { @@ -481,18 +469,6 @@ var fromLAB = { LABtoXYZ: LABtoXYZ }; -/** - * @method HSVtoRGB - * - * convert hsv to rgb - * - * color.HSVtoRGB(0,0,1) === #FFFFF === { r : 255, g : 0, b : 0 } - * - * @param {Number} H hue color number (min : 0, max : 360) - * @param {Number} S Saturation number (min : 0, max : 1) - * @param {Number} V Value number (min : 0, max : 1 ) - * @returns {Object} - */ function HSVtoRGB(h, s, v) { if (arguments.length == 1) { @@ -1110,15 +1086,6 @@ var parser = { color_split: color_split }; -/** - * @deprecated - * - * instead of this, use blend function - * - * @param {*} startColor - * @param {*} endColor - * @param {*} t - */ function interpolateRGB(startColor, endColor) { var t = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0.5; var exportFormat = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'hex'; @@ -1939,7 +1906,6 @@ function crop() { }; } -// Image manupulate function resize(dstWidth, dstHeight) { return function (bitmap, done) { var c = Canvas.drawPixels(bitmap); @@ -2165,9 +2131,6 @@ function bitonal(darkColor, lightColor) { }); } -/* - * @param {Number} amount -100..100 , value < 0 is darken, value > 0 is brighten - */ function brightness$1() { var amount = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1; @@ -2195,10 +2158,6 @@ function brownie() { }); } -/** - * - * @param {Number} amount from 0 to 100 - */ function clip() { var amount = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; @@ -2213,10 +2172,6 @@ function clip() { }, { $C: $C }); } -/** - * - * @param {*} amount min = -128, max = 128 - */ function contrast$1() { var amount = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; @@ -2241,10 +2196,6 @@ function gamma() { }, { $C: $C }); } -/** - * F.gradient('red', 'blue', 'yellow', 'white', 10) - * F.gradient('red, blue, yellow, white, 10') - */ function gradient$1() { // 전체 매개변수 기준으로 파싱 // 색이 아닌 것 기준으로 scale 변수로 인식 @@ -2316,9 +2267,6 @@ function grayscale(amount) { }); } -/* - * @param {Number} amount 0..360 - */ function hue() { var amount = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 360; @@ -2402,10 +2350,6 @@ function matrix() { }); } -/** - * - * @param {Number} amount 1..100 - */ function noise() { var amount = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1; @@ -2449,9 +2393,6 @@ function polaroid() { }); } -/* - * @param {Number} amount -100..100 - */ function saturation() { var amount = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 100; @@ -2471,9 +2412,6 @@ function saturation() { }); } -/* - * @param {Number} amount 0..1 - */ function sepia() { var amount = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1; @@ -2526,12 +2464,6 @@ function shift() { }); } -/** - * change the relative darkness of (a part of an image) by overexposure to light. - * @param {*} r - * @param {*} g - * @param {*} b - */ function solarize(redValue, greenValue, blueValue) { var $redValue = parseParamNumber(redValue); var $greenValue = parseParamNumber(greenValue); @@ -2591,9 +2523,6 @@ function thresholdColor() { }); } -/* - * @param {Number} amount 0..100 - */ function threshold() { var scale = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 200; var amount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 100; @@ -2655,11 +2584,6 @@ function blur () { return convolution(createBlurMatrix(amount)); } -/* - * carve, mold, or stamp a design on (a surface) so that it stands out in relief. - * - * @param {Number} amount 0.0 .. 4.0 - */ function emboss() { var amount = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 4; @@ -4233,11 +4157,6 @@ function normal () { return convolution$1([0, 0, 0, 0, 1, 0, 0, 0, 0]); } -/* - * carve, mold, or stamp a design on (a surface) so that it stands out in relief. - * - * @param {Number} amount 0.0 .. 4.0 - */ function emboss$1() { var amount = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 4; @@ -4245,10 +4164,6 @@ function emboss$1() { return convolution$1([amount * -2.0, -amount, 0.0, -amount, 1.0, amount, 0.0, amount, amount * 2.0]); } -/** - * - * @param {Number} amount 0..1 - */ function gaussianBlur$1() { var amount = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1; @@ -4365,9 +4280,6 @@ function bitonal$1(darkColor, lightColor) { return shader('\n if ((pixelColor.r + pixelColor.g + pixelColor.b) > ' + checkVlue + ') {\n outColor = vec4(' + lightColorString + '.rgb, pixelColor.a);\n } else {\n outColor = vec4(' + darkColorString + '.rgb, pixelColor.a);\n }\n '); } -/* - * @param {Number} amount -1..1 , value < 0 is darken, value > 0 is brighten - */ function brightness$2() { var amount = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1; @@ -4405,9 +4317,6 @@ function brownie$1() { return matrix$3(0.5997023498159715, 0.34553243048391263, -0.2708298674538042, 0, -0.037703249837783157, 0.8609577587992641, 0.15059552388459913, 0, 0.24113635128153335, -0.07441037908422492, 0.44972182064877153, 0, 0, 0, 0, 1); } -/* - * @param {Number} amount 0..1 - */ function clip$1() { var amount = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; @@ -4424,9 +4333,6 @@ function chaos() { return shader('\n vec2 st = pixelColor.st;\n st *= ' + C + ';\n \n vec2 ipos = floor(st); // get the integer coords\n\n vec3 color = vec3(random( ipos ));\n\n outColor = vec4(color, pixelColor.a);\n '); } -/* - * @param {Number} amount 0..1 - */ function contrast$2() { var amount = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1; @@ -4435,9 +4341,6 @@ function contrast$2() { return shader('\n outColor = pixelColor * ' + C + ';\n '); } -/* - * @param {Number} amount -1..1 , value < 0 is darken, value > 0 is brighten - */ function gamma$1() { var amount = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1; @@ -4446,10 +4349,6 @@ function gamma$1() { return shader('\n outColor = vec4(pow(pixelColor.r, ' + C + '), pow(pixelColor.g, ' + C + '), pow(pixelColor.b, ' + C + '), pixelColor.a );\n '); } -/** - * F.gradient('red', 'blue', 'yellow', 'white', 10) - * F.gradient('red, blue, yellow, white, 10') - */ function gradient$2() { // 전체 매개변수 기준으로 파싱 // 색이 아닌 것 기준으로 scale 변수로 인식 @@ -4497,10 +4396,6 @@ function gradient$2() { return shader('\n float rate = (pixelColor.r * 0.2126 + pixelColor.g * 0.7152 + pixelColor.b * 0.0722); \n\n ' + temp.join('\n') + ' \n '); } -/** - * - * @param {Number} amount 0..1 - */ function grayscale$1() { var amount = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1; @@ -4512,9 +4407,6 @@ function grayscale$1() { } //http://lolengine.net/blog/2013/07/27/rgb-to-hsv-in-glsl -/* - * @param {Number} amount 0..1 , (real value 0..360) - */ function hue$1() { var amount = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1; @@ -4536,10 +4428,6 @@ function kodachrome$1() { return matrix$3(1.1285582396593525, -0.3967382283601348, -0.03992559172921793, 0, -0.16404339962244616, 1.0835251566291304, -0.05498805115633132, 0, -0.16786010706155763, -0.5603416277695248, 1.6014850761964943, 0, 0, 0, 0, 1); } -/** - * - * @param {Number} amount 0..1 - */ function noise$1() { var amount = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1; @@ -4550,10 +4438,6 @@ function noise$1() { return shader('\n float rnd = ' + min + ' + random( pixelColor.st ) * (' + max + ' - ' + min + ');\n\n outColor = vec4(pixelColor.rgb + rnd, 1.0);\n '); } -/** - * - * @param {Number} amount 0..1 - */ function opacity$1() { var amount = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1; @@ -4567,9 +4451,6 @@ function polaroid$1() { return matrix$3(1.438, -0.062, -0.062, 0, -0.122, 1.378, -0.122, 0, -0.016, -0.016, 1.483, 0, 0, 0, 0, 1); } -/* - * @param {Number} amount 0..1 - */ function saturation$1() { var amount = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; @@ -4578,9 +4459,6 @@ function saturation$1() { return matrix$3(L, 0, 0, 0, 0, L, 0, 0, 0, 0, L, 0, 0, 0, 0, L); } -/* - * @param {Number} amount 0..100 - */ function sepia$1() { var amount = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1; @@ -4628,9 +4506,6 @@ function thresholdColor$1() { return shader('\n float c = ( (pixelColor.r * 0.2126 + pixelColor.g * 0.7152 + pixelColor.b * 0.0722) ) >= ' + scale + ' ? 1.0 : 0.0;\n\n outColor = vec4(c, c, c, pixelColor.a);\n '); } -/* - * @param {Number} amount 0..100 - */ function threshold$1() { var scale = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 200; var amount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 100; @@ -4638,12 +4513,6 @@ function threshold$1() { return thresholdColor$1(scale, amount, false); } -/** - * - * @param {*} redTint 0..1 - * @param {*} greenTint 0..1 - * @param {*} blueTint 0..1 - */ function tint$1 () { var redTint = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; var greenTint = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; @@ -6993,8 +6862,13 @@ var BaseColorPicker = function (_UIElement) { _this2.callbackColorValue(); }; + this.callbackLastUpdate = function () { + _this2.callbackLastUpdateColorValue(); + }; + this.colorpickerShowCallback = function () {}; this.colorpickerHideCallback = function () {}; + this.colorpickerLastUpdateCallback = function () {}; this.$body = new Dom(this.getContainer()); this.$root = new Dom('div', 'codemirror-colorpicker'); @@ -7055,7 +6929,7 @@ var BaseColorPicker = function (_UIElement) { }, { key: 'show', - value: function show(opt, color, showCallback, hideCallback) { + value: function show(opt, color, showCallback, hideCallback, lastUpdateCallback) { // 매번 이벤트를 지우고 다시 생성할 필요가 없어서 초기화 코드는 지움. // this.destroy(); @@ -7063,6 +6937,7 @@ var BaseColorPicker = function (_UIElement) { // define colorpicker callback this.colorpickerShowCallback = showCallback; this.colorpickerHideCallback = hideCallback; + this.colorpickerLastUpdateCallback = lastUpdateCallback; this.$root.css(this.getInitalizePosition()).show(); this.isColorPickerShow = true; @@ -7319,6 +7194,19 @@ var BaseColorPicker = function (_UIElement) { this.colorpickerShowCallback(color); } } + }, { + key: 'callbackLastUpdateColorValue', + value: function callbackLastUpdateColorValue(color) { + color = color || this.getCurrentColor(); + + if (typeof this.opt.onLastUpdate == 'function') { + this.opt.onLastUpdate.call(this, color); + } + + if (typeof this.colorpickerLastUpdateCallback == 'function') { + this.colorpickerLastUpdateCallback(color); + } + } }, { key: 'callbackHideColorValue', value: function callbackHideColorValue(color) { @@ -7359,6 +7247,7 @@ var BaseColorPicker = function (_UIElement) { get(BaseColorPicker.prototype.__proto__ || Object.getPrototypeOf(BaseColorPicker.prototype), 'initializeStoreEvent', this).call(this); this.$store.on('changeColor', this.callbackChange); + this.$store.on('lastUpdateColor', this.callbackLastUpdate); this.$store.on('changeFormat', this.callbackChange); } }, { @@ -7367,9 +7256,11 @@ var BaseColorPicker = function (_UIElement) { get(BaseColorPicker.prototype.__proto__ || Object.getPrototypeOf(BaseColorPicker.prototype), 'destroy', this).call(this); this.$store.off('changeColor', this.callbackChange); + this.$store.off('lastUpdateColor', this.callbackLastUpdate); this.$store.off('changeFormat', this.callbackChange); this.callbackChange = undefined; + this.callbackLastUpdate = undefined; // remove color picker callback this.colorpickerShowCallback = undefined; @@ -7388,6 +7279,7 @@ var BaseBox = function (_UIElement) { var _this = possibleConstructorReturn(this, (BaseBox.__proto__ || Object.getPrototypeOf(BaseBox)).call(this, opt)); _this.source = 'base-box'; + // this.isDown = false; return _this; } @@ -7472,7 +7364,10 @@ var BaseBox = function (_UIElement) { }, { key: 'onDragEnd', value: function onDragEnd(e) { - this.isDown = false; + if (this.isDown) { + this.$store.emit('lastUpdateColor'); + this.isDown = false; + } } }, { key: '@changeColor', @@ -8013,7 +7908,10 @@ var ColorWheel = function (_UIElement) { }, { key: 'mouseup document', value: function mouseupDocument(e) { - this.isDown = false; + if (this.isDown) { + this.isDown = false; + this.$store.emit('lastUpdateColor'); + } } }, { key: 'mousemove document', @@ -8037,7 +7935,10 @@ var ColorWheel = function (_UIElement) { }, { key: 'touchend document', value: function touchendDocument(e) { - this.isDown = false; + if (this.isDown) { + this.isDown = false; + this.$store.emit('lastUpdateColor'); + } } }, { key: 'touchmove document', @@ -8118,6 +8019,7 @@ var ColorInformation = function (_UIElement) { this.format = next_format; this.$store.dispatch('/changeFormat', this.format); + this.$store.emit('lastUpdateColor'); } }, { key: 'getFormat', @@ -8127,12 +8029,19 @@ var ColorInformation = function (_UIElement) { }, { key: 'checkNumberKey', value: function checkNumberKey(e) { - return Event.checkNumberKey(e); + var code = e.which, + isExcept = false; + + if (code == 37 || code == 39 || code == 8 || code == 46 || code == 9) isExcept = true; + + if (!isExcept && (code < 48 || code > 57)) return false; + + return true; } }, { key: 'checkNotNumberKey', value: function checkNotNumberKey(e) { - return !Event.checkNumberKey(e); + return !this.checkNumberKey(e); } }, { key: 'changeRgbColor', @@ -8145,6 +8054,7 @@ var ColorInformation = function (_UIElement) { a: this.refs.$rgb_a.float(), source: source$2 }); + this.$store.emit('lastUpdateColor'); } }, { key: 'changeHslColor', @@ -8157,6 +8067,7 @@ var ColorInformation = function (_UIElement) { a: this.refs.$hsl_a.float(), source: source$2 }); + this.$store.emit('lastUpdateColor'); } }, { key: '@changeColor', @@ -8224,6 +8135,7 @@ var ColorInformation = function (_UIElement) { if (code.charAt(0) == '#' && code.length == 7) { this.$store.dispatch('/changeColor', code, source$2); + this.$store.emit('lastUpdateColor'); } } }, { @@ -8431,6 +8343,7 @@ var CurrentColorSets = function (_UIElement) { key: 'click $colorSetsColorList .color-item', value: function click$colorSetsColorListColorItem(e) { this.$store.dispatch('/changeColor', e.$delegateTarget.attr('data-color')); + this.$store.emit('lastUpdateColor'); } }]); return CurrentColorSets; @@ -8724,7 +8637,10 @@ var ColorPalette = function (_UIElement) { }, { key: 'mouseup document', value: function mouseupDocument(e) { - this.isDown = false; + if (this.isDown) { + this.isDown = false; + this.$store.emit('lastUpdateColor'); + } } }, { key: 'mousemove document', @@ -8739,15 +8655,13 @@ var ColorPalette = function (_UIElement) { this.isDown = true; this.setMainColor(e); } - }, { - key: 'mouseup', - value: function mouseup(e) { - this.isDown = false; - } }, { key: 'touchend document', value: function touchendDocument(e) { - this.isDown = false; + if (this.isDown) { + this.isDown = false; + this.$store.emit('lastUpdateColor'); + } } }, { key: 'touchmove document', @@ -8763,11 +8677,6 @@ var ColorPalette = function (_UIElement) { this.isDown = true; this.setMainColor(e); } - }, { - key: 'touchend', - value: function touchend(e) { - this.isDown = false; - } }]); return ColorPalette; }(UIElement); @@ -9251,7 +9160,6 @@ var ColorRing = function (_ColorWheel) { return ColorRing; }(ColorWheel); -// import ColorWheel from '../ui/ColorWheel' var RingColorPicker = function (_BaseColorPicker) { inherits(RingColorPicker, _BaseColorPicker); diff --git a/dist/codemirror-colorpicker.js b/dist/codemirror-colorpicker.js index 108bad8..c3f7a5a 100644 --- a/dist/codemirror-colorpicker.js +++ b/dist/codemirror-colorpicker.js @@ -6995,8 +6995,13 @@ var BaseColorPicker = function (_UIElement) { _this2.callbackColorValue(); }; + this.callbackLastUpdate = function () { + _this2.callbackLastUpdateColorValue(); + }; + this.colorpickerShowCallback = function () {}; this.colorpickerHideCallback = function () {}; + this.colorpickerLastUpdateCallback = function () {}; this.$body = new Dom(this.getContainer()); this.$root = new Dom('div', 'codemirror-colorpicker'); @@ -7057,7 +7062,7 @@ var BaseColorPicker = function (_UIElement) { }, { key: 'show', - value: function show(opt, color, showCallback, hideCallback) { + value: function show(opt, color, showCallback, hideCallback, lastUpdateCallback) { // 매번 이벤트를 지우고 다시 생성할 필요가 없어서 초기화 코드는 지움. // this.destroy(); @@ -7065,6 +7070,7 @@ var BaseColorPicker = function (_UIElement) { // define colorpicker callback this.colorpickerShowCallback = showCallback; this.colorpickerHideCallback = hideCallback; + this.colorpickerLastUpdateCallback = lastUpdateCallback; this.$root.css(this.getInitalizePosition()).show(); this.isColorPickerShow = true; @@ -7321,6 +7327,19 @@ var BaseColorPicker = function (_UIElement) { this.colorpickerShowCallback(color); } } + }, { + key: 'callbackLastUpdateColorValue', + value: function callbackLastUpdateColorValue(color) { + color = color || this.getCurrentColor(); + + if (typeof this.opt.onLastUpdate == 'function') { + this.opt.onLastUpdate.call(this, color); + } + + if (typeof this.colorpickerLastUpdateCallback == 'function') { + this.colorpickerLastUpdateCallback(color); + } + } }, { key: 'callbackHideColorValue', value: function callbackHideColorValue(color) { @@ -7361,6 +7380,7 @@ var BaseColorPicker = function (_UIElement) { get(BaseColorPicker.prototype.__proto__ || Object.getPrototypeOf(BaseColorPicker.prototype), 'initializeStoreEvent', this).call(this); this.$store.on('changeColor', this.callbackChange); + this.$store.on('lastUpdateColor', this.callbackLastUpdate); this.$store.on('changeFormat', this.callbackChange); } }, { @@ -7369,9 +7389,11 @@ var BaseColorPicker = function (_UIElement) { get(BaseColorPicker.prototype.__proto__ || Object.getPrototypeOf(BaseColorPicker.prototype), 'destroy', this).call(this); this.$store.off('changeColor', this.callbackChange); + this.$store.off('lastUpdateColor', this.callbackLastUpdate); this.$store.off('changeFormat', this.callbackChange); this.callbackChange = undefined; + this.callbackLastUpdate = undefined; // remove color picker callback this.colorpickerShowCallback = undefined; @@ -7474,7 +7496,10 @@ var BaseBox = function (_UIElement) { }, { key: 'onDragEnd', value: function onDragEnd(e) { - this.isDown = false; + if (this.isDown) { + this.$store.emit('lastUpdateColor'); + this.isDown = false; + } } }, { key: '@changeColor', @@ -8015,7 +8040,10 @@ var ColorWheel = function (_UIElement) { }, { key: 'mouseup document', value: function mouseupDocument(e) { - this.isDown = false; + if (this.isDown) { + this.isDown = false; + this.$store.emit('lastUpdateColor'); + } } }, { key: 'mousemove document', @@ -8039,7 +8067,10 @@ var ColorWheel = function (_UIElement) { }, { key: 'touchend document', value: function touchendDocument(e) { - this.isDown = false; + if (this.isDown) { + this.isDown = false; + this.$store.emit('lastUpdateColor'); + } } }, { key: 'touchmove document', @@ -8120,6 +8151,7 @@ var ColorInformation = function (_UIElement) { this.format = next_format; this.$store.dispatch('/changeFormat', this.format); + this.$store.emit('lastUpdateColor'); } }, { key: 'getFormat', @@ -8129,12 +8161,19 @@ var ColorInformation = function (_UIElement) { }, { key: 'checkNumberKey', value: function checkNumberKey(e) { - return Event.checkNumberKey(e); + var code = e.which, + isExcept = false; + + if (code == 37 || code == 39 || code == 8 || code == 46 || code == 9) isExcept = true; + + if (!isExcept && (code < 48 || code > 57)) return false; + + return true; } }, { key: 'checkNotNumberKey', value: function checkNotNumberKey(e) { - return !Event.checkNumberKey(e); + return !this.checkNumberKey(e); } }, { key: 'changeRgbColor', @@ -8147,6 +8186,7 @@ var ColorInformation = function (_UIElement) { a: this.refs.$rgb_a.float(), source: source$2 }); + this.$store.emit('lastUpdateColor'); } }, { key: 'changeHslColor', @@ -8159,6 +8199,7 @@ var ColorInformation = function (_UIElement) { a: this.refs.$hsl_a.float(), source: source$2 }); + this.$store.emit('lastUpdateColor'); } }, { key: '@changeColor', @@ -8226,6 +8267,7 @@ var ColorInformation = function (_UIElement) { if (code.charAt(0) == '#' && code.length == 7) { this.$store.dispatch('/changeColor', code, source$2); + this.$store.emit('lastUpdateColor'); } } }, { @@ -8433,6 +8475,7 @@ var CurrentColorSets = function (_UIElement) { key: 'click $colorSetsColorList .color-item', value: function click$colorSetsColorListColorItem(e) { this.$store.dispatch('/changeColor', e.$delegateTarget.attr('data-color')); + this.$store.emit('lastUpdateColor'); } }]); return CurrentColorSets; @@ -8726,7 +8769,10 @@ var ColorPalette = function (_UIElement) { }, { key: 'mouseup document', value: function mouseupDocument(e) { - this.isDown = false; + if (this.isDown) { + this.isDown = false; + this.$store.emit('lastUpdateColor'); + } } }, { key: 'mousemove document', @@ -8741,15 +8787,13 @@ var ColorPalette = function (_UIElement) { this.isDown = true; this.setMainColor(e); } - }, { - key: 'mouseup', - value: function mouseup(e) { - this.isDown = false; - } }, { key: 'touchend document', value: function touchendDocument(e) { - this.isDown = false; + if (this.isDown) { + this.isDown = false; + this.$store.emit('lastUpdateColor'); + } } }, { key: 'touchmove document', @@ -8765,11 +8809,6 @@ var ColorPalette = function (_UIElement) { this.isDown = true; this.setMainColor(e); } - }, { - key: 'touchend', - value: function touchend(e) { - this.isDown = false; - } }]); return ColorPalette; }(UIElement); diff --git a/dist/codemirror-colorpicker.min.js b/dist/codemirror-colorpicker.min.js index da038bd..b44347f 100644 --- a/dist/codemirror-colorpicker.min.js +++ b/dist/codemirror-colorpicker.min.js @@ -1 +1 @@ -var CodeMirrorColorPicker=function(){"use strict";function h(t,e){var r=2>16,g:(65280&t)>>8,b:(255&t)>>0,a:1};return n=Object.assign(n,u(n))}if(0<=t&&t<=4294967295){n={type:"hex",r:(4278190080&t)>>24,g:(16711680&t)>>16,b:(65280&t)>>8,a:(255&t)/255};return n=Object.assign(n,u(n))}}return t}function Z(r){"string"==typeof r&&(r=Y(r));var t=(r=r.map(function(t){if("string"==typeof t){var e=X(t),r=q(e.str).split(" ");return r[1]?r[1].includes("%")?r[1]=parseFloat(r[1].replace(/%/,""))/100:r[1]=parseFloat(r[1]):r[1]="*",r[0]=W(r[0],e.matches),r}if(Array.isArray(t))return t[1]?"string"==typeof t[1]&&(t[1].includes("%")?t[1]=parseFloat(t[1].replace(/%/,""))/100:t[1]=+t[1]):t[1]="*",[].concat(N(t))})).filter(function(t){return"*"===t[1]}).length;if(0=r?255:0;if(i)0==t&&($r=0,$g=0,$b=0);else{var e=Math.round(t);$r=e,$g=e,$b=e}},{$C:n,$scale:r,$hasColor:i})}function kt(){var t=0>F,_[u+1]=f*j>>F,_[u+2]=v*j>>F,h-=g,f-=d,v-=p,g-=B.r,d-=B.g,p-=B.b,l=c+((l=i+n+1)>F,_[l+1]=f*j>>F,_[l+2]=v*j>>F,h-=g,f-=d,v-=p,g-=B.r,d-=B.g,p-=B.b,l=i+((l=o+T)255-e?255:0,$g=$g>255-e?255:0,$b=$b>255-e?255:0},{$C:e})},contrast:function(){var t=0>1),s=n[l];return n[l]=n[0],n[0]=s,n},createBitmap:Xt,createBlurMatrix:re,pack:function(n){return function(r,t){Gt(r.pixels.length,function(t,e){n(r.pixels,t,e,r.pixels[t],r.pixels[t+1],r.pixels[t+2],r.pixels[t+3])},function(){t(r)})}},packXY:ee,pixel:Jt,getBitmap:Yt,putBitmap:Wt,radian:function(t){return mt.CONSTANT.radian(t)},convolution:oe,parseParamNumber:qt,filter:ue,clamp:se,fillColor:ne,fillPixelColor:ie},"multi",he),j(Rt,"merge",fe),j(Rt,"matches",ae),j(Rt,"parseFilter",le),j(Rt,"partial",ve),Rt),Ut=Ht;function Lt(t){var e=1= mx) return {currentRunIndex: cri, i: null}; c(cri); i++;"}).join("\n");return new Function("ri","i","s","mx","c","\n let cri = ri;\n \n "+e+"\n \n return {currentRunIndex: cri, i: i} \n ")}(v),e=g,r={},n=0;n>2)},function(){r()},n.functionDumpCount,n.frameTimer,n.loopCount)}function zt(t,r,n,e){var i=4>2;n(t,e%r,Math.floor(e/r))},function(){e()},i.functionDumpCount,i.frameTimer,i.loopCount)}function Xt(t,e,r){return{pixels:new Uint8ClampedArray(t),width:e,height:r}}function Yt(t,e){return vt.getBitmap(t,e)}function Wt(t,e,r){return vt.putBitmap(t,e,r)}function qt(t){return"string"==typeof t&&(t=(t=t.replace(/deg/,"")).replace(/px/,"")),+t}var Kt=/(([\w_\-]+)(\(([^\)]*)\))?)+/gi;function Zt(t,e,r){return function(t){var r={},e=t.map(function(n){var i=[];Object.keys(n.context).forEach(function(t,e){i[t]="n$"+Ft+++t+"$"}),Object.keys(n.rootContext).forEach(function(t,e){i[t]="r$"+Ft+++t+"$",r[i[t]]=n.rootContext[t]});var t=Object.keys(n.context).filter(function(t){return"number"!=typeof n.context[t]&&"string"!=typeof n.context[t]&&(!Array.isArray(n.context[t])||"number"!=typeof n.context[t][0]&&"string"!=typeof n.context[t][0])}).map(function(t,e){return[i[t],JSON.stringify(n.context[t])].join(" = ")}),o=n.callback.toString().split("{");return o.shift(),(o=(o=o.join("{")).split("}")).pop(),o=o.join("}"),Object.keys(i).forEach(function(r){var t=i[r];"number"==typeof n.context[r]||"string"==typeof n.context[r]?o=o.replace(new RegExp("\\"+r,"g"),n.context[r]):Array.isArray(n.context[r])&&("number"==typeof n.context[r][0]||"string"==typeof n.context[r][0])?n.context[r].forEach(function(t,e){o=o.replace(new RegExp("\\"+r+"\\["+e+"\\]","g"),t)}):o=o.replace(new RegExp("\\"+r,"g"),t)}),{preCallbackString:o,preContext:t}}),n=e.map(function(t,e){return t.preContext.length?"const "+t.preContext+";":""}).join("\n\n"),i=e.map(function(t){return t.preCallbackString}).join("\n\n"),o=new Function("$pixels","$pixelIndex","$clamp","$Color"," \n let $r = $pixels[$pixelIndex], $g = $pixels[$pixelIndex+1], $b = $pixels[$pixelIndex+2], $a = $pixels[$pixelIndex+3];\n\n "+n+"\n\n "+i+"\n \n $pixels[$pixelIndex] = $r\n $pixels[$pixelIndex+1] = $g \n $pixels[$pixelIndex+2] = $b \n $pixels[$pixelIndex+3] = $a \n ");return o.$preCallbackString=i,o.$preContext=n,o.rootContextObject=r,o}([{callback:t,context:1t.width||a>t.height||(u=s*e.width+l<<2,c=a*t.width+o<<2,t.pixels[c]=e.pixels[u],t.pixels[c+1]=e.pixels[u+1],t.pixels[c+2]=e.pixels[u+2],t.pixels[c+3]=e.pixels[u+3])}(n,t,r,r);for(var i=Xt(n.pixels.length,n.width,n.height),o=Xt(t.pixels.length,t.width,t.height),a=function(t,o,i,e,r){var a=Math.round(Math.sqrt(t.length)),l=Math.floor(a/2),n=r?1:0,s="let r = 0, g = 0, b = 0, a = 0, scy = 0, scx =0, si = 0; ",u=[],c=[],h=[],f=[];t.forEach(function(t,e){var r=Math.floor(e/a)-l,n=e%a-l;0!=t&&(u.push("$t["+e+"][$sp[(($sy + ("+r+")) * "+i+" + ($sx + ("+n+"))) * 4]]"),c.push("$t["+e+"][$sp[(($sy + ("+r+")) * "+i+" + ($sx + ("+n+"))) * 4 + 1]]"),h.push("$t["+e+"][$sp[(($sy + ("+r+")) * "+i+" + ($sx + ("+n+"))) * 4 + 2]]"),f.push("$t["+e+"][$sp[(($sy + ("+r+")) * "+i+" + ($sx + ("+n+"))) * 4 + 3]]"))}),s+="r = "+u.join(" + ")+"; g = "+c.join(" + ")+"; b = "+h.join(" + ")+"; a = "+f.join(" + ")+";",s+="$dp[$di] = r; $dp[$di+1] = g;$dp[$di+2] = b;$dp[$di+3] = a + ("+n+")*(255-a); ";var v=new Function("$dp","$sp","$di","$sx","$sy","$t",s);return function(t,e,r,n,i){v(t,e,r,n,i,o)}}(f,g,n.width,n.height,v),l=t.pixels.length/4,s=0;s>2,o=0,a=0,l=0,s=0,u=0,c=0,h=0;ht.width||a>t.height||(u=a*t.width+o<<2,c=s*e.width+l<<2,e.pixels[c]=t.pixels[u],e.pixels[c+1]=t.pixels[u+1],e.pixels[c+2]=t.pixels[u+2],e.pixels[c+3]=t.pixels[u+3])}}(i,o,r,r),e(o)}}function ae(r){var e=Ge.convertMatches(r),t=e.str.match(Kt),n=[];if(!t)return n;n=t.map(function(t){return{filter:t,origin:Ge.reverseMatches(t,e.matches)}});var i={next:0};return n=n.map(function(t){var e=r.indexOf(t.origin,i.next);return t.startIndex=e,t.endIndex=e+t.origin.length,t.arr=le(t.origin),i.next=t.endIndex,t}).filter(function(t){return!!t.arr.length})}function le(t){var e=Ge.convertMatches(t),r=e.str.match(Kt);if(!r[0])return[];var n=r[0].split("("),i=n.shift(),o=[];return n.length&&(o=n.shift().split(")")[0].split(",").map(function(t){return Ge.reverseMatches(t,e.matches)})),[i].concat(N(o)).map(Ge.trim)}function se(t){return Math.min(255,t)}function ue(t){return fe(ae(t).map(function(t){return t.arr}))}function ce(t){for(var e=0= "+(t=$e(ge(t)))+" ? 1.0 : 0.0;\n\n outColor = vec4(c, c, c, pixelColor.a);\n ")}var Re=L({},{blur:function(){return ye([1,1,1,1,1,1,1,1,1])},normal:function(){return ye([0,0,0,0,1,0,0,0,0])},emboss:function(){var t=0 "+r+") {\n outColor = vec4("+Ce(Ge.parse(e))+".rgb, pixelColor.a);\n } else {\n outColor = vec4("+n+".rgb, pixelColor.a);\n }\n ")},brightness:function(){return be("\n outColor = pixelColor + ("+$e(ge(0 1.0 - "+t+") ? 1.0 : 0.0,\n (pixelColor.g > 1.0 - "+t+") ? 1.0 : 0.0,\n (pixelColor.b > 1.0 - "+t+") ? 1.0 : 0.0,\n pixelColor.a \n );\n ")},chaos:function(){return be("\n vec2 st = pixelColor.st;\n st *= "+$e(ge(0e&&(t=ft(t,e)),t.map(function(t){return h(t,r)})},ImageToCanvas:function(t,e,r){var n=3=t){e=ze[n-1],r=ze[n];break}return e&&r?Ge.interpolateRGB(e,r,(t-e.start)/(r.start-e.start)):ze[0].rgb}},Ye=L({},jt,Ht),We={Color:Ge,HueColor:Xe,ColorNames:D,ImageFilter:Ye,GL:Ve,Canvas:vt,ImageLoader:gt},qe=(Ge.color,0),Ke=[],Ze=(B(Je,[{key:"attr",value:function(t,e){return 1==arguments.length?this.el.getAttribute(t):(this.el.setAttribute(t,e),this)}},{key:"closest",value:function(t){for(var e=this,r=!1;!(r=e.hasClass(t));){if(!e.el.parentNode)return null;e=new Je(e.el.parentNode)}return r?e:null}},{key:"removeClass",value:function(t){return this.el.className=(" "+this.el.className+" ").replace(" "+t+" "," ").trim(),this}},{key:"hasClass",value:function(t){return!!this.el.className&&-1<(" "+this.el.className+" ").indexOf(" "+t+" ")}},{key:"addClass",value:function(t){return this.hasClass(t)||(this.el.className=this.el.className+" "+t),this}},{key:"toggleClass",value:function(t){this.hasClass(t)?this.removeClass(t):this.addClass(t)}},{key:"html",value:function(t){return"string"==typeof t?this.el.innerHTML=t:this.empty().append(t),this}},{key:"find",value:function(t){return this.el.querySelector(t)}},{key:"findAll",value:function(t){return this.el.querySelectorAll(t)}},{key:"empty",value:function(){return this.html("")}},{key:"append",value:function(t){return"string"==typeof t?this.el.appendChild(document.createTextNode(t)):this.el.appendChild(t.el||t),this}},{key:"appendTo",value:function(t){return(t.el?t.el:t).appendChild(this.el),this}},{key:"remove",value:function(){return this.el.parentNode&&this.el.parentNode.removeChild(this.el),this}},{key:"text",value:function(){return this.el.textContent}},{key:"css",value:function(t,e){var r=this;if(2==arguments.length)this.el.style[t]=e;else if(1==arguments.length){if("string"==typeof t)return getComputedStyle(this.el)[t];var n=t||{};Object.keys(n).forEach(function(t){r.el.style[t]=n[t]})}return this}},{key:"cssFloat",value:function(t){return parseFloat(this.css(t))}},{key:"cssInt",value:function(t){return parseInt(this.css(t))}},{key:"offset",value:function(){var t=this.el.getBoundingClientRect();return{top:t.top+Je.getScrollTop(),left:t.left+Je.getScrollLeft()}}},{key:"position",value:function(){return this.el.style.top?{top:parseFloat(this.css("top")),left:parseFloat(this.css("left"))}:this.el.getBoundingClientRect()}},{key:"size",value:function(){return[this.width(),this.height()]}},{key:"width",value:function(){return this.el.offsetWidth||this.el.getBoundingClientRect().width}},{key:"contentWidth",value:function(){return this.width()-this.cssFloat("padding-left")-this.cssFloat("padding-right")}},{key:"height",value:function(){return this.el.offsetHeight||this.el.getBoundingClientRect().height}},{key:"contentHeight",value:function(){return this.height()-this.cssFloat("padding-top")-this.cssFloat("padding-bottom")}},{key:"dataKey",value:function(t){return this.uniqId+"."+t}},{key:"data",value:function(t,e){if(2==arguments.length)return Ke[this.dataKey(t)]=e,this;if(1==arguments.length)return Ke[this.dataKey(t)];var r=Object.keys(Ke),n=this.uniqId+".";return r.filter(function(t){return 0==t.indexOf(n)}).map(function(t){return Ke[t]})}},{key:"val",value:function(t){return 0==arguments.length?this.el.value:(1==arguments.length&&(this.el.value=t),this)}},{key:"int",value:function(){return parseInt(this.val(),10)}},{key:"float",value:function(){return parseFloat(this.val())}},{key:"show",value:function(){return this.css("display","block")}},{key:"hide",value:function(){return this.css("display","none")}},{key:"toggle",value:function(){return"none"==this.css("display")?this.show():this.hide()}},{key:"scrollTop",value:function(){return this.el===document.body?Je.getScrollTop():this.el.scrollTop}},{key:"scrollLeft",value:function(){return this.el===document.body?Je.getScrollLeft():this.el.scrollLeft}},{key:"on",value:function(t,e,r,n){return this.el.addEventListener(t,e,r,n),this}},{key:"off",value:function(t,e){return this.el.removeEventListener(t,e),this}},{key:"getElement",value:function(){return this.el}},{key:"createChild",value:function(t,e,r,n){var i=3"}},{key:"initialize",value:function(){}},{key:"initializeEvent",value:function(){var e=this;this.initializeEventMachin(),Object.keys(this.childComponents).forEach(function(t){e[t]&&e[t].initializeEvent()})}},{key:"destroy",value:function(){var e=this;this.destroyEventMachin(),Object.keys(this.childComponents).forEach(function(t){e[t]&&e[t].destroy()})}},{key:"destroyEventMachin",value:function(){this.removeEventAll()}},{key:"initializeEventMachin",value:function(){this.filterProps(ar).forEach(this.parseEvent.bind(this))}},{key:"collectProps",value:function(){if(!this.collapsedProps){for(var t=this.__proto__,e=[];e.push.apply(e,N(Object.getOwnPropertyNames(t))),t=t.__proto__;);this.collapsedProps=e}return this.collapsedProps}},{key:"filterProps",value:function(e){return this.collectProps().filter(function(t){return t.match(e)})}},{key:"parseEvent",value:function(t){var e=t.split(" ");this.bindingEvent(e,this[t].bind(this))}},{key:"getDefaultDomElement",value:function(t){var e=void 0;return(e=t?this.refs[t]||this[t]||window[t]:this.el||this.$el||this.$root)instanceof Ze?e.getElement():e}},{key:"getDefaultEventObject",value:function(t){var e=this,r=t.split("."),n=r.shift(),i=r.includes("Control"),o=r.includes("Shift"),a=r.includes("Alt"),l=r.includes("Meta"),s=(r=r.filter(function(t){return!1===sr.includes(t)})).filter(function(t){return!!e[t]});return{eventName:n,isControl:i,isShift:o,isAlt:a,isMeta:l,codes:r=r.filter(function(t){return!1===s.includes(t)}).map(function(t){return t.toLowerCase()}),checkMethodList:s}}},{key:"bindingEvent",value:function(t,e){var r=function(t){return Array.isArray(t)?t:Array.from(t)}(t),n=r[0],i=r[1],o=r.slice(2);i=this.getDefaultDomElement(i);var a=this.getDefaultEventObject(n);a.dom=i,a.delegate=o.join(" "),this.addEvent(a,e)}},{key:"matchPath",value:function(t,e){return t?t.matches(e)?t:this.matchPath(t.parentElement,e):null}},{key:"getBindings",value:function(){return this._bindings||this.initBindings(),this._bindings}},{key:"addBinding",value:function(t){this.getBindings().push(t)}},{key:"initBindings",value:function(){this._bindings=[]}},{key:"checkEventType",value:function(e,t){var r=this,n=!e.ctrlKey||t.isControl,i=!e.shiftKey||t.isShift,o=!e.altKey||t.isAlt,a=!e.metaKey||t.isMeta,l=!0;t.codes.length&&(l=t.codes.includes(e.code.toLowerCase())||t.codes.includes(e.key.toLowerCase()));var s=!0;return t.checkMethodList.length&&(s=t.checkMethodList.every(function(t){return r[t].call(r,e)})),n&&o&&i&&a&&l&&s}},{key:"makeCallback",value:function(r,n){var i=this;return r.delegate?function(t){if(i.checkEventType(t,r)){var e=i.matchPath(t.target||t.srcElement,r.delegate);if(e)return t.delegateTarget=e,t.$delegateTarget=new Ze(e),n(t)}}:function(t){if(i.checkEventType(t,r))return n(t)}}},{key:"addEvent",value:function(t,e){t.callback=this.makeCallback(t,e),this.addBinding(t),nr.addEvent(t.dom,t.eventName,t.callback)}},{key:"removeEventAll",value:function(){var e=this;this.getBindings().forEach(function(t){e.removeEvent(t)}),this.initBindings()}},{key:"removeEvent",value:function(t){var e=t.eventName,r=t.dom,n=t.callback;nr.removeEvent(r,e,n)}}]),cr);function cr(){P(this,cr),this.state=new ir(this),this.refs={},this.childComponents=this.components()}var hr=/^@/,fr=(H(vr,ur),B(vr,[{key:"initializeStoreEvent",value:function(){var n=this;this.storeEvents={},this.filterProps(hr).forEach(function(t){var e=t.split("@");e.shift();var r=e.join("@");n.storeEvents[r]=n[t].bind(n),n.$store.on(r,n.storeEvents[r])})}},{key:"destoryStoreEvent",value:function(){var e=this;Object.keys(this.storeEvents).forEach(function(t){e.$store.off(t,e.storeEvents[t])})}}]),vr);function vr(t){P(this,vr);var e=U(this,(vr.__proto__||Object.getPrototypeOf(vr)).call(this,t));return e.opt=t||{},t&&t.$store&&(e.$store=t.$store),e.initialize(),e.initializeStoreEvent(),e}var gr=(H(dr,Qe),B(dr,[{key:"initialize",value:function(){F(dr.prototype.__proto__||Object.getPrototypeOf(dr.prototype),"initialize",this).call(this),this.$store.rgb={},this.$store.hsl={},this.$store.hsv={},this.$store.alpha=1,this.$store.format="hex"}},{key:"/changeFormat",value:function(t,e){t.format=e,t.emit("changeFormat")}},{key:"/initColor",value:function(t,e,r){t.dispatch("/changeColor",e,r,!0),t.emit("initColor")}},{key:"/changeColor",value:function(t,e,r,n){"string"==typeof(e=e||"#FF0000")&&(e=Ge.parse(e)),e.source=e.source||r,t.alpha=function(t){return void 0===t||null==t}(e.a)?t.alpha:e.a,t.format="hsv"!=e.type&&e.type||t.format,"hex"==t.format&&t.alpha<1&&(t.format="rgb"),"hsl"==e.type?(t.hsl=Object.assign(t.hsl,e),t.rgb=Ge.HSLtoRGB(t.hsl),t.hsv=Ge.HSLtoHSV(e)):"hex"==e.type?(t.rgb=Object.assign(t.rgb,e),t.hsl=Ge.RGBtoHSL(t.rgb),t.hsv=Ge.RGBtoHSV(e)):"rgb"==e.type?(t.rgb=Object.assign(t.rgb,e),t.hsl=Ge.RGBtoHSL(t.rgb),t.hsv=Ge.RGBtoHSV(e)):"hsv"==e.type&&(t.hsv=Object.assign(t.hsv,e),t.rgb=Ge.HSVtoRGB(t.hsv),t.hsl=Ge.HSVtoHSL(t.hsv)),n||t.emit("changeColor",e.source)}},{key:"/getHueColor",value:function(t){return Xe.checkHueColor(t.hsv.h/360)}},{key:"/toString",value:function(t,e){var r=t[e=e||t.format]||t.rgb;return Ge.format(Object.assign({},r,{a:t.alpha}),e)}},{key:"/toColor",value:function(t,e){return"rgb"==(e=e||t.format)?t.dispatch("/toRGB"):"hsl"==e?t.dispatch("/toHSL"):"hex"==e?t.dispatch("/toHEX"):t.dispatch("/toString",e)}},{key:"/toRGB",value:function(t){return t.dispatch("/toString","rgb")}},{key:"/toHSL",value:function(t){return t.dispatch("/toString","hsl")}},{key:"/toHEX",value:function(t){return t.dispatch("/toString","hex").toUpperCase()}}]),dr);function dr(){return P(this,dr),U(this,(dr.__proto__||Object.getPrototypeOf(dr)).apply(this,arguments))}var pr=(B(mr,[{key:"initialize",value:function(){this.initializeModule()}},{key:"initializeModule",value:function(){var e=this;this.modules.forEach(function(t){new t(e)})}},{key:"action",value:function(t,e){this.actions[t]={context:e,callback:e[t]}}},{key:"dispatch",value:function(t){var e=[].concat(Array.prototype.slice.call(arguments)),r=(t=e.shift(),this.actions[t]);if(r)return r.callback.apply(r.context,[this].concat(N(e)))}},{key:"module",value:function(t){}},{key:"on",value:function(t,e){this.callbacks.push({event:t,callback:e})}},{key:"off",value:function(e,r){0==arguments.length?this.callbacks=[]:1==arguments.length?this.callbacks=this.callbacks.filter(function(t){return t.event!=e}):2==arguments.length&&(this.callbacks=this.callbacks.filter(function(t){return t.event!=e&&t.callback!=r}))}},{key:"emit",value:function(){var e=[].concat(Array.prototype.slice.call(arguments)),r=e.shift();this.callbacks.filter(function(t){return t.event==r}).forEach(function(t){t&&"function"==typeof t.callback&&t.callback.apply(t,N(e))})}}]),mr);function mr(t){P(this,mr),this.callbacks=[],this.actions=[],this.modules=t.modules||[],this.initialize()}var yr=(H(br,fr),B(br,[{key:"initialize",value:function(){var t=this;this.$body=null,this.$root=null,this.$store=new pr({modules:[gr,er]}),this.callbackChange=function(){t.callbackColorValue()},this.colorpickerShowCallback=function(){},this.colorpickerHideCallback=function(){},this.$body=new Ze(this.getContainer()),this.$root=new Ze("div","codemirror-colorpicker"),"inline"==this.opt.position&&this.$body.append(this.$root),this.opt.type&&this.$root.addClass(this.opt.type),this.opt.hideInformation&&this.$root.addClass("hide-information"),this.opt.hideColorsets&&this.$root.addClass("hide-colorsets"),this.$arrow=new Ze("div","arrow"),this.$root.append(this.$arrow),this.$store.dispatch("/setUserPalette",this.opt.colorSets),this.render(),this.$root.append(this.$el),this.initColorWithoutChangeEvent(this.opt.color),this.initializeEvent()}},{key:"initColorWithoutChangeEvent",value:function(t){this.$store.dispatch("/initColor",t)}},{key:"show",value:function(t,e,r,n){this.colorpickerShowCallback=r,this.colorpickerHideCallback=n,this.$root.css(this.getInitalizePosition()).show(),this.isColorPickerShow=!0,this.isShortCut=t.isShortCut||!1,this.outputFormat=t.outputFormat,this.hideDelay=+(void 0===t.hideDelay?2e3:t.hideDelay),0window.innerWidth&&(n-=e+n-window.innerWidth),n<0&&(n=0);var i=t.top-this.$body.scrollTop();r+i>window.innerHeight&&(i-=r+i-window.innerHeight),i<0&&(i=0),this.$root.css({left:n+"px",top:i+"px"})}},{key:"getInitalizePosition",value:function(){return"inline"==this.opt.position?{position:"relative",left:"auto",top:"auto",display:"inline-block"}:{position:"fixed",left:"-10000px",top:"-10000px"}}},{key:"isAbsolute",value:function(){return"inline"!==this.opt.position}},{key:"mouseup.isAbsolute document",value:function(t){this.__isMouseDown=!1,this.checkInHtml(t.target)||(0==this.checkColorPickerClass(t.target)?this.hide():this.__isMouseIn||(clearTimeout(this.timerCloseColorPicker),this.timerCloseColorPicker=setTimeout(this.hide.bind(this),this.delayTime||this.hideDelay)))}},{key:"mouseover.isAbsolute $root",value:function(t){clearTimeout(this.timerCloseColorPicker)}},{key:"mousemove.isAbsolute $root",value:function(t){clearTimeout(this.timerCloseColorPicker)}},{key:"mouseenter.isAbsolute $root",value:function(t){clearTimeout(this.timerCloseColorPicker),this.__isMouseIn=!0}},{key:"mouseleave.isAbsolute $root",value:function(t){this.__isMouseIn=!1,this.__isMouseDown||(clearTimeout(this.timerCloseColorPicker),this.timerCloseColorPicker=setTimeout(this.hide.bind(this),this.delayTime||this.hideDelay))}},{key:"mousedown.isAbsolute $root",value:function(t){this.__isMouseDown=!0}},{key:"setHideDelay",value:function(t){this.delayTime=t||0}},{key:"runHideDelay",value:function(){this.isColorPickerShow&&this.setHideDelay()}},{key:"callbackColorValue",value:function(t){t=t||this.getCurrentColor(),"function"==typeof this.opt.onChange&&this.opt.onChange.call(this,t),"function"==typeof this.colorpickerShowCallback&&this.colorpickerShowCallback(t)}},{key:"callbackHideColorValue",value:function(t){t=t||this.getCurrentColor(),"function"==typeof this.opt.onHide&&this.opt.onHide.call(this,t),"function"==typeof this.colorpickerHideCallback&&this.colorpickerHideCallback(t)}},{key:"getCurrentColor",value:function(){return this.$store.dispatch("/toColor",this.outputFormat)}},{key:"checkColorPickerClass",value:function(t){var e=new Ze(t).closest("codemirror-colorview"),r=new Ze(t).closest("codemirror-colorpicker"),n=new Ze(t).closest("CodeMirror");return t.nodeName,!!(r||e||n)}},{key:"checkInHtml",value:function(t){return"HTML"==t.nodeName}},{key:"initializeStoreEvent",value:function(){F(br.prototype.__proto__||Object.getPrototypeOf(br.prototype),"initializeStoreEvent",this).call(this),this.$store.on("changeColor",this.callbackChange),this.$store.on("changeFormat",this.callbackChange)}},{key:"destroy",value:function(){F(br.prototype.__proto__||Object.getPrototypeOf(br.prototype),"destroy",this).call(this),this.$store.off("changeColor",this.callbackChange),this.$store.off("changeFormat",this.callbackChange),this.callbackChange=void 0,this.colorpickerShowCallback=void 0,this.colorpickerHideCallback=void 0}}]),br);function br(t){P(this,br);var e=U(this,(br.__proto__||Object.getPrototypeOf(br)).call(this,t));return e.isColorPickerShow=!1,e.isShortCut=!1,e.hideDelay=+(void 0===e.opt.hideDeplay?2e3:e.opt.hideDelay),e.timerCloseColorPicker,e.autoHide=e.opt.autoHide||!0,e.outputFormat=e.opt.outputFormat,e.$checkColorPickerClass=e.checkColorPickerClass.bind(e),e}var kr=(H(Cr,fr),B(Cr,[{key:"refresh",value:function(){}},{key:"refreshColorUI",value:function(t){}},{key:"changeColor",value:function(t){this.$store.dispatch("/changeColor",Object.assign({source:this.source},t||{}))}},{key:"mouseup document",value:function(t){this.onDragEnd(t)}},{key:"mousemove document",value:function(t){this.onDragMove(t)}},{key:"mousedown $bar",value:function(t){t.preventDefault(),this.isDown=!0}},{key:"mousedown $container",value:function(t){this.isDown=!0,this.onDragStart(t)}},{key:"touchend document",value:function(t){this.onDragEnd(t)}},{key:"touchmove document",value:function(t){this.onDragMove(t)}},{key:"touchstart $bar",value:function(t){t.preventDefault(),this.isDown=!0}},{key:"touchstart $container",value:function(t){this.onDragStart(t)}},{key:"onDragStart",value:function(t){this.isDown=!0,this.refreshColorUI(t)}},{key:"onDragMove",value:function(t){this.isDown&&this.refreshColorUI(t)}},{key:"onDragEnd",value:function(t){this.isDown=!1}},{key:"@changeColor",value:function(t){this.source!=t&&this.refresh()}},{key:"@initColor",value:function(){this.refresh()}}]),Cr);function Cr(t){P(this,Cr);var e=U(this,(Cr.__proto__||Object.getPrototypeOf(Cr)).call(this,t));return e.source="base-box",e}var xr=(H(_r,kr),B(_r,[{key:"getMinMaxPosition",value:function(){var t=this.getMinPosition(),e=this.getMaxDist();return{min:t,max:t+e,width:e}}},{key:"getCurrent",value:function(t){return min+this.getMaxDist()*t}},{key:"getMinPosition",value:function(){return this.refs.$container.offset().left}},{key:"getMaxDist",value:function(){return this.state.get("$container.width")}},{key:"getDist",value:function(t){var e=this.getMinMaxPosition(),r=e.min,n=e.max;return t=this.maxValue?this.refs.$bar.addClass("last").removeClass("first"):this.refs.$bar.removeClass("last").removeClass("first"),this.setMousePosition(this.getMaxDist()*((t||0)/this.maxValue))}}]),_r);function _r(t){P(this,_r);var e=U(this,(_r.__proto__||Object.getPrototypeOf(_r)).call(this,t));return e.minValue=0,e.maxValue=1,e.source="base-slider",e}var wr=(H(Mr,xr),B(Mr,[{key:"template",value:function(){return'\n
\n
\n
\n
\n
\n '}},{key:"setBackgroundColor",value:function(){this.refs.$container.css("background-color",this.$store.dispatch("/toRGB"))}},{key:"refresh",value:function(){F(Mr.prototype.__proto__||Object.getPrototypeOf(Mr.prototype),"refresh",this).call(this),this.setBackgroundColor()}},{key:"getDefaultValue",value:function(){return this.$store.hsv.v}},{key:"refreshColorUI",value:function(t){var e=this.getCaculatedDist(t);this.setColorUI(e/100*this.maxValue),this.changeColor({type:"hsv",v:e/100*this.maxValue})}}]),Mr);function Mr(t){P(this,Mr);var e=U(this,(Mr.__proto__||Object.getPrototypeOf(Mr)).call(this,t));return e.minValue=0,e.maxValue=1,e.source="value-control",e}var Or=(H(Sr,xr),B(Sr,[{key:"template",value:function(){return'\n
\n
\n
\n
\n
\n
\n '}},{key:"refresh",value:function(){F(Sr.prototype.__proto__||Object.getPrototypeOf(Sr.prototype),"refresh",this).call(this),this.setOpacityColorBar()}},{key:"setOpacityColorBar",value:function(){var t=Object.assign({},this.$store.rgb);t.a=0;var e=Ge.format(t,"rgb");t.a=1;var r=Ge.format(t,"rgb");this.setOpacityColorBarBackground(e,r)}},{key:"setOpacityColorBarBackground",value:function(t,e){this.refs.$colorbar.css("background","linear-gradient(to right, "+t+", "+e+")")}},{key:"getDefaultValue",value:function(){return this.$store.alpha}},{key:"refreshColorUI",value:function(t){var e=this.getCaculatedDist(t);this.setColorUI(e/100*this.maxValue),this.changeColor({a:Math.floor(e)/100*this.maxValue})}}]),Sr);function Sr(t){P(this,Sr);var e=U(this,(Sr.__proto__||Object.getPrototypeOf(Sr)).call(this,t));return e.minValue=0,e.maxValue=1,e.source="opacity-control",e}var Er=(H(Tr,fr),B(Tr,[{key:"components",value:function(){return{Value:wr,Opacity:Or}}},{key:"template",value:function(){return'\n
\n
\n
\n
\n
\n
\n '}},{key:"setBackgroundColor",value:function(){this.refs.$controlColor.css("background-color",this.$store.dispatch("/toRGB"))}},{key:"refresh",value:function(){this.setColorUI(),this.setBackgroundColor()}},{key:"setColorUI",value:function(){this.Value.setColorUI(),this.Opacity.setColorUI()}},{key:"@changeColor",value:function(t){"macos-control"!=t&&this.refresh()}},{key:"@initColor",value:function(){this.refresh()}}]),Tr);function Tr(){return P(this,Tr),U(this,(Tr.__proto__||Object.getPrototypeOf(Tr)).apply(this,arguments))}var Ar=(H(Ir,fr),B(Ir,[{key:"template",value:function(){return'\n
\n \n
\n
\n
\n '}},{key:"refresh",value:function(t){this.setColorUI(t)}},{key:"setColorUI",value:function(t){this.renderCanvas(),this.renderValue(),this.setHueColor(null,t)}},{key:"renderValue",value:function(){var t=1-this.$store.hsv.v;this.refs.$valuewheel.css({"background-color":"rgba(0, 0, 0, "+t+")"})}},{key:"renderWheel",value:function(t,e){this.width&&!t&&(t=this.width),this.height&&!e&&(e=this.height);var r=new Ze("canvas"),n=r.el.getContext("2d");r.el.width=t,r.el.height=e,r.css({width:t+"px",height:e+"px"});for(var i=n.getImageData(0,0,t,e),o=i.data,a=Math.floor(t/2),l=Math.floor(e/2),s=e\n
\n \n
\n
\n
\n \n
HEX
\n
\n
\n
\n
\n \n
R
\n
\n
\n \n
G
\n
\n
\n \n
B
\n
\n
\n \n
A
\n
\n
\n
\n
\n \n
H
\n
\n
\n \n
%
\n
S
\n
\n
\n \n
%
\n
L
\n
\n
\n \n
A
\n
\n
\n \n '}},{key:"setCurrentFormat",value:function(t){this.format=t,this.initFormat()}},{key:"initFormat",value:function(){var t=this.format||"hex";this.$el.removeClass("hex"),this.$el.removeClass("rgb"),this.$el.removeClass("hsl"),this.$el.addClass(t)}},{key:"nextFormat",value:function(){var t=this.format||"hex",e="hex";"hex"==t?e="rgb":"rgb"==t?e="hsl":"hsl"==t&&(e=1==this.$store.alpha?"hex":"rgb"),this.$el.removeClass(t),this.$el.addClass(e),this.format=e,this.$store.dispatch("/changeFormat",this.format)}},{key:"getFormat",value:function(){return this.format||"hex"}},{key:"checkNumberKey",value:function(t){return nr.checkNumberKey(t)}},{key:"checkNotNumberKey",value:function(t){return!nr.checkNumberKey(t)}},{key:"changeRgbColor",value:function(){this.$store.dispatch("/changeColor",{type:"rgb",r:this.refs.$rgb_r.int(),g:this.refs.$rgb_g.int(),b:this.refs.$rgb_b.int(),a:this.refs.$rgb_a.float(),source:Pr})}},{key:"changeHslColor",value:function(){this.$store.dispatch("/changeColor",{type:"hsl",h:this.refs.$hsl_h.int(),s:this.refs.$hsl_s.int(),l:this.refs.$hsl_l.int(),a:this.refs.$hsl_a.float(),source:Pr})}},{key:"@changeColor",value:function(t){Pr!=t&&this.refresh()}},{key:"@initColor",value:function(){this.refresh()}},{key:"input $rgb_r",value:function(t){this.changeRgbColor()}},{key:"input $rgb_g",value:function(t){this.changeRgbColor()}},{key:"input $rgb_b",value:function(t){this.changeRgbColor()}},{key:"input $rgb_a",value:function(t){this.changeRgbColor()}},{key:"input $hsl_h",value:function(t){this.changeHslColor()}},{key:"input $hsl_s",value:function(t){this.changeHslColor()}},{key:"input $hsl_l",value:function(t){this.changeHslColor()}},{key:"input $hsl_a",value:function(t){this.changeHslColor()}},{key:"keydown $hexCode",value:function(t){if(t.which<65||70\n
\n
\n

Color Palettes

\n ×\n
\n
\n
\n \n '}},{key:"refresh",value:function(){this.load()}},{key:"@changeCurrentColorSets",value:function(){this.refresh()}},{key:"@toggleColorChooser",value:function(){this.toggle()}},{key:"load $colorsetsList",value:function(){return"\n
\n "+this.$store.dispatch("/getColorSetsList").map(function(t,e){return'\n
\n

'+t.name+'

\n
\n
\n '+t.colors.filter(function(t,e){return e<5}).map(function(t){return'
\n
\n
'}).join("")+"\n
\n
\n
"}).join("")+"\n
\n "}},{key:"show",value:function(){this.$el.addClass("open")}},{key:"hide",value:function(){this.$el.removeClass("open")}},{key:"toggle",value:function(){this.$el.toggleClass("open")}},{key:"click $toggleButton",value:function(t){this.toggle()}},{key:"click $colorsetsList .colorsets-item",value:function(t){var e=t.$delegateTarget;if(e){var r=parseInt(e.attr("data-colorsets-index"));this.$store.dispatch("/setCurrentColorSets",r),this.hide()}}},{key:"destroy",value:function(){F(jr.prototype.__proto__||Object.getPrototypeOf(jr.prototype),"destroy",this).call(this),this.hide()}}]),jr);function jr(){return P(this,jr),U(this,(jr.__proto__||Object.getPrototypeOf(jr)).apply(this,arguments))}var Fr=(H(Hr,fr),B(Hr,[{key:"template",value:function(){return'\n
\n \n
\n
\n '}},{key:"load $colorSetsColorList",value:function(){var t=this.$store.dispatch("/getCurrentColorSets");return'\n
\n '+this.$store.dispatch("/getCurrentColors").map(function(t,e){return'
\n
\n
\n
'}).join("")+" \n "+(t.edit?'
+
':"")+" \n
\n "}},{key:"refresh",value:function(){this.load()}},{key:"addColor",value:function(t){this.$store.dispatch("/addCurrentColor",t)}},{key:"@changeCurrentColorSets",value:function(){this.refresh()}},{key:"click $colorSetsChooseButton",value:function(t){this.$store.emit("toggleColorChooser")}},{key:"contextmenu $colorSetsColorList",value:function(t){if(t.preventDefault(),this.$store.dispatch("/getCurrentColorSets").edit){var e=new Ze(t.target).closest("color-item");if(e){var r=parseInt(e.attr("data-index"));this.$store.emit("showContextMenu",t,r)}else this.$store.emit("showContextMenu",t)}}},{key:"click $colorSetsColorList .add-color-item",value:function(t){this.addColor(this.$store.dispatch("/toColor"))}},{key:"click $colorSetsColorList .color-item",value:function(t){this.$store.dispatch("/changeColor",t.$delegateTarget.attr("data-color"))}}]),Hr);function Hr(){return P(this,Hr),U(this,(Hr.__proto__||Object.getPrototypeOf(Hr)).apply(this,arguments))}var Ur=(H(Lr,fr),B(Lr,[{key:"template",value:function(){return'\n
    \n \n \n \n
\n '}},{key:"show",value:function(t,e){var r=nr.pos(t);this.$el.css({top:r.clientY-10+"px",left:r.clientX+"px"}),this.$el.addClass("show"),this.selectedColorIndex=e,void 0===this.selectedColorIndex?this.$el.addClass("small"):this.$el.removeClass("small")}},{key:"hide",value:function(){this.$el.removeClass("show")}},{key:"runCommand",value:function(t){switch(t){case"remove-color":this.$store.dispatch("/removeCurrentColor",this.selectedColorIndex);break;case"remove-all-to-the-right":this.$store.dispatch("/removeCurrentColorToTheRight",this.selectedColorIndex);break;case"clear-palette":this.$store.dispatch("/clearPalette")}}},{key:"@showContextMenu",value:function(t,e){this.show(t,e)}},{key:"click $el .menu-item",value:function(t){t.preventDefault(),this.runCommand(t.$delegateTarget.attr("data-type")),this.hide()}}]),Lr);function Lr(){return P(this,Lr),U(this,(Lr.__proto__||Object.getPrototypeOf(Lr)).apply(this,arguments))}var Vr=(H(Nr,yr),B(Nr,[{key:"template",value:function(){return'\n
\n
\n
\n
\n
\n
\n
\n
\n '}},{key:"components",value:function(){return{colorwheel:Ar,control:Er,information:Dr,currentColorSets:Fr,colorSetsChooser:Rr,contextMenu:Ur}}}]),Nr);function Nr(){return P(this,Nr),U(this,(Nr.__proto__||Object.getPrototypeOf(Nr)).apply(this,arguments))}var Gr=(H(zr,xr),B(zr,[{key:"template",value:function(){return'\n
\n
\n
\n
\n
\n '}},{key:"getDefaultValue",value:function(){return this.$store.hsv.h}},{key:"refreshColorUI",value:function(t){var e=this.getCaculatedDist(t);this.setColorUI(e/100*this.maxValue),this.changeColor({h:e/100*this.maxValue,type:"hsv"})}}]),zr);function zr(t){P(this,zr);var e=U(this,(zr.__proto__||Object.getPrototypeOf(zr)).call(this,t));return e.minValue=0,e.maxValue=360,e.source="hue-control",e}var Xr=(H(Yr,fr),B(Yr,[{key:"components",value:function(){return{Hue:Gr,Opacity:Or}}},{key:"template",value:function(){return'\n
\n
\n
\n
\n
\n
\n '}},{key:"setBackgroundColor",value:function(){this.refs.$controlColor.css("background-color",this.$store.dispatch("/toRGB"))}},{key:"refresh",value:function(){this.setColorUI(),this.setBackgroundColor()}},{key:"setColorUI",value:function(){this.Hue.setColorUI(),this.Opacity.setColorUI()}},{key:"@changeColor",value:function(t){"chromedevtool-control"!=t&&this.refresh()}},{key:"@initColor",value:function(){this.refresh()}}]),Yr);function Yr(){return P(this,Yr),U(this,(Yr.__proto__||Object.getPrototypeOf(Yr)).apply(this,arguments))}var Wr="chromedevtool-palette",qr=(H(Kr,fr),B(Kr,[{key:"template",value:function(){return'\n
\n
\n
\n
\n
\n
\n
\n '}},{key:"setBackgroundColor",value:function(t){this.$el.css("background-color",t)}},{key:"refresh",value:function(){this.setColorUI()}},{key:"caculateSV",value:function(){var t=this.drag_pointer_pos||{x:0,y:0},e=this.state.get("$el.width"),r=this.state.get("$el.height"),n=t.x/e,i=(r-t.y)/r;this.$store.dispatch("/changeColor",{type:"hsv",s:n,v:i,source:Wr})}},{key:"setColorUI",value:function(){var t=this.state.get("$el.width")*this.$store.hsv.s,e=this.state.get("$el.height")*(1-this.$store.hsv.v);this.refs.$drag_pointer.css({left:t+"px",top:e+"px"}),this.drag_pointer_pos={x:t,y:e},this.setBackgroundColor(this.$store.dispatch("/getHueColor"))}},{key:"setMainColor",value:function(t){var e=this.$el.offset(),r=this.state.get("$el.contentWidth"),n=this.state.get("$el.contentHeight"),i=nr.pos(t).pageX-e.left,o=nr.pos(t).pageY-e.top;i<0?i=0:r\n
\n
\n
\n
\n
\n
\n \n '}},{key:"components",value:function(){return{palette:qr,control:Xr,information:Dr,currentColorSets:Fr,colorSetsChooser:Rr,contextMenu:Ur}}}]),Jr);function Jr(){return P(this,Jr),U(this,(Jr.__proto__||Object.getPrototypeOf(Jr)).apply(this,arguments))}var Qr=(H(tn,fr),B(tn,[{key:"components",value:function(){return{Hue:Gr,Opacity:Or}}},{key:"template",value:function(){return'\n
\n
\n
\n
\n '}},{key:"refresh",value:function(){this.setColorUI()}},{key:"setColorUI",value:function(){this.Hue.setColorUI(),this.Opacity.setColorUI()}},{key:"@changeColor",value:function(t){"mini-control"!=t&&this.refresh()}},{key:"@initColor",value:function(){this.refresh()}}]),tn);function tn(){return P(this,tn),U(this,(tn.__proto__||Object.getPrototypeOf(tn)).apply(this,arguments))}var en=(H(rn,yr),B(rn,[{key:"template",value:function(){return'\n
\n
\n
\n
\n '}},{key:"components",value:function(){return{palette:qr,control:Qr}}}]),rn);function rn(){return P(this,rn),U(this,(rn.__proto__||Object.getPrototypeOf(rn)).apply(this,arguments))}var nn=(H(on,xr),B(on,[{key:"getMaxDist",value:function(){return this.state.get("$container.height")}},{key:"setMousePosition",value:function(t){this.refs.$bar.css({top:t+"px"})}},{key:"getMousePosition",value:function(t){return nr.pos(t).pageY}},{key:"getMinPosition",value:function(){return this.refs.$container.offset().top}},{key:"getCaculatedDist",value:function(t){var e=t?this.getMousePosition(t):this.getCurrent(this.getDefaultValue()/this.maxValue);return 100-this.getDist(e)}},{key:"setColorUI",value:function(t){(t=t||this.getDefaultValue())<=this.minValue?this.refs.$bar.addClass("first").removeClass("last"):t>=this.maxValue?this.refs.$bar.addClass("last").removeClass("first"):this.refs.$bar.removeClass("last").removeClass("first");var e=1-(t||0)/this.maxValue;this.setMousePosition(this.getMaxDist()*e)}}]),on);function on(t){P(this,on);var e=U(this,(on.__proto__||Object.getPrototypeOf(on)).call(this,t));return e.source="vertical-slider",e}var an=(H(ln,nn),B(ln,[{key:"template",value:function(){return'\n
\n
\n
\n
\n
\n '}},{key:"getDefaultValue",value:function(){return this.$store.hsv.h}},{key:"refreshColorUI",value:function(t){var e=this.getCaculatedDist(t);this.setColorUI(e/100*this.maxValue),this.changeColor({h:e/100*this.maxValue,type:"hsv"})}}]),ln);function ln(t){P(this,ln);var e=U(this,(ln.__proto__||Object.getPrototypeOf(ln)).call(this,t));return e.minValue=0,e.maxValue=360,e.source="vertical-hue-control",e}var sn=(H(un,nn),B(un,[{key:"template",value:function(){return'\n
\n
\n
\n
\n
\n
\n '}},{key:"refresh",value:function(){F(un.prototype.__proto__||Object.getPrototypeOf(un.prototype),"refresh",this).call(this),this.setOpacityColorBar()}},{key:"setOpacityColorBar",value:function(){var t=Object.assign({},this.$store.rgb);t.a=0;var e=Ge.format(t,"rgb");t.a=1;var r=Ge.format(t,"rgb");this.refs.$colorbar.css("background","linear-gradient(to top, "+e+", "+r+")")}},{key:"getDefaultValue",value:function(){return this.$store.alpha}},{key:"refreshColorUI",value:function(t){var e=this.getCaculatedDist(t);this.setColorUI(e/100*this.maxValue),this.changeColor({a:Math.floor(e)/100*this.maxValue})}}]),un);function un(t){P(this,un);var e=U(this,(un.__proto__||Object.getPrototypeOf(un)).call(this,t));return e.source="vertical-opacity-control",e}var cn=(H(hn,fr),B(hn,[{key:"components",value:function(){return{Hue:an,Opacity:sn}}},{key:"template",value:function(){return'
'}},{key:"refresh",value:function(){this.setColorUI()}},{key:"setColorUI",value:function(){this.Hue.setColorUI(),this.Opacity.setColorUI()}},{key:"@changeColor",value:function(t){"mini-control"!=t&&this.refresh()}},{key:"@initColor",value:function(){this.refresh()}}]),hn);function hn(){return P(this,hn),U(this,(hn.__proto__||Object.getPrototypeOf(hn)).apply(this,arguments))}var fn=(H(vn,yr),B(vn,[{key:"template",value:function(){return'\n
\n
\n
\n '}},{key:"components",value:function(){return{palette:qr,control:cn}}}]),vn);function vn(){return P(this,vn),U(this,(vn.__proto__||Object.getPrototypeOf(vn)).apply(this,arguments))}var gn=(H(dn,fr),B(dn,[{key:"components",value:function(){return{Value:wr,Opacity:Or}}},{key:"template",value:function(){return'\n
\n
\n
\n
\n
\n
\n '}},{key:"setBackgroundColor",value:function(){this.refs.$controlColor.css("background-color",this.$store.dispatch("/toRGB"))}},{key:"refresh",value:function(){this.setColorUI(),this.setBackgroundColor()}},{key:"setColorUI",value:function(){this.Value.setColorUI(),this.Opacity.setColorUI()}},{key:"@changeColor",value:function(t){"macos-control"!=t&&this.refresh()}},{key:"@initColor",value:function(){this.refresh()}}]),dn);function dn(){return P(this,dn),U(this,(dn.__proto__||Object.getPrototypeOf(dn)).apply(this,arguments))}var pn=(H(mn,Ar),B(mn,[{key:"template",value:function(){return'\n
\n \n
\n
\n '}},{key:"setColorUI",value:function(t){this.renderCanvas(),this.setHueColor(null,t)}},{key:"getDefaultValue",value:function(){return this.$store.hsv.h}},{key:"setHueColor",value:function(t,e){if(this.state.get("$el.width")){var r=this.getRectangle(),n=r.minX,i=r.minY,o=r.radius,a=r.centerX,l=r.centerY,s=this.getCurrentXY(t,this.getDefaultValue(),o,a,l),u=b((h=s.x)-a,(f=s.y)-l),c=this.getCurrentXY(null,u,o-this.half_thinkness,a,l),h=c.x,f=c.y;this.refs.$drag_pointer.css({left:h-n+"px",top:f-i+"px"}),e||this.changeColor({type:"hsv",h:u})}}}]),mn);function mn(t){P(this,mn);var e=U(this,(mn.__proto__||Object.getPrototypeOf(mn)).call(this,t));return e.width=214,e.height=214,e.thinkness=16,e.half_thinkness=e.thinkness/2,e.source="colorring",e}var yn=(H(bn,yr),B(bn,[{key:"template",value:function(){return'\n
\n
\n
\n
\n
\n
\n
\n
\n
\n '}},{key:"components",value:function(){return{colorring:pn,palette:qr,control:gn,information:Dr,currentColorSets:Fr,colorSetsChooser:Rr,contextMenu:Ur}}}]),bn);function bn(){return P(this,bn),U(this,(bn.__proto__||Object.getPrototypeOf(bn)).apply(this,arguments))}var kn=(H(Cn,fr),B(Cn,[{key:"components",value:function(){return{Hue:an,Opacity:sn}}},{key:"template",value:function(){return'\n
\n
\n
\n
\n '}},{key:"refresh",value:function(){this.setColorUI()}},{key:"setColorUI",value:function(){this.Hue.setColorUI(),this.Opacity.setColorUI()}},{key:"@changeColor",value:function(){this.refresh()}},{key:"@initColor",value:function(){this.refresh()}}]),Cn);function Cn(){return P(this,Cn),U(this,(Cn.__proto__||Object.getPrototypeOf(Cn)).apply(this,arguments))}var $n=(H(xn,yr),B(xn,[{key:"template",value:function(){return'\n
\n
\n
\n
\n
\n
\n
\n
\n '}},{key:"components",value:function(){return{palette:qr,control:kn,information:Dr,currentColorSets:Fr,colorSetsChooser:Rr,contextMenu:Ur}}}]),xn);function xn(){return P(this,xn),U(this,(xn.__proto__||Object.getPrototypeOf(xn)).apply(this,arguments))}var _n={create:function(t){switch(t.type){case"macos":return new Vr(t);case"xd":return new $n(t);case"ring":return new yn(t);case"mini":return new en(t);case"mini-vertical":return new fn(t);case"sketch":case"palette":default:return new Zr(t)}},ColorPicker:Zr,ChromeDevToolColorPicker:Zr,MacOSColorPicker:Vr,RingColorPicker:yn,MiniColorPicker:en,MiniVerticalColorPicker:fn},wn="codemirror-colorview",Mn="codemirror-colorview-background",On=["comment","builtin"];function Sn(t,e){"setValue"==e.origin?(t.state.colorpicker.close_color_picker(),t.state.colorpicker.init_color_update(),t.state.colorpicker.style_color_update()):t.state.colorpicker.style_color_update(t.getCursor().line)}function En(t,e){t.state.colorpicker.isUpdate||(t.state.colorpicker.isUpdate=!0,t.state.colorpicker.close_color_picker(),t.state.colorpicker.init_color_update(),t.state.colorpicker.style_color_update())}function Tn(t,e){Sn(t,{origin:"setValue"})}function An(t,e){t.state.colorpicker.keyup(e)}function In(t,e){t.state.colorpicker.is_edit_mode()&&t.state.colorpicker.check_mousedown(e)}function Pn(t,e){Sn(t,{origin:"setValue"})}function Dn(t){t.state.colorpicker.close_color_picker()}function Bn(t){t.state.colorpicker.hide_delay_color_picker(t.state.colorpicker.opt.hideDelay||1e3)}var Rn=(B(jn,[{key:"init_event",value:function(){var e,r;this.cm.on("mousedown",In),this.cm.on("keyup",An),this.cm.on("change",Sn),this.cm.on("update",En),this.cm.on("refresh",Tn),this.cm.on("blur",Bn),this.onPasteCallback=(e=this.cm,r=Pn,function(t){r.call(this,e,t)}),this.onScrollEvent=function(r,n){var i=void 0;return function(t,e){i&&clearTimeout(i),i=setTimeout(function(){r(t,e)},n||300)}}(Dn,50),this.cm.getWrapperElement().addEventListener("paste",this.onPasteCallback),this.is_edit_mode()&&this.cm.on("scroll",this.onScrollEvent)}},{key:"is_edit_mode",value:function(){return"edit"==this.opt.mode}},{key:"is_view_mode",value:function(){return"view"==this.opt.mode}},{key:"destroy",value:function(){this.cm.off("mousedown",In),this.cm.off("keyup",An),this.cm.off("change",Sn),this.cm.off("blur",Bn),this.cm.getWrapperElement().removeEventListener("paste",this.onPasteCallback),this.is_edit_mode()&&this.cm.off("scroll",this.onScrollEvent)}},{key:"hasClass",value:function(t,e){return!!t.className&&-1<(" "+t.className+" ").indexOf(" "+e+" ")}},{key:"check_mousedown",value:function(t){this.hasClass(t.target,Mn)?this.open_color_picker(t.target.parentNode):this.close_color_picker()}},{key:"popup_color_picker",value:function(t){var e=this.cm.getCursor(),r=this,n={lineNo:e.line,ch:e.ch,color:t||"#FFFFFF",isShortCut:!0};Object.keys(this.markers).forEach(function(t){if(-1<("#"+t).indexOf("#"+n.lineNo+":")){var e=r.markers[t];e.ch<=n.ch&&n.ch<=e.ch+e.color.length&&(n.ch=e.ch,n.color=e.color,n.nameColor=e.nameColor)}}),this.open_color_picker(n)}},{key:"open_color_picker",value:function(t){var e=this,r=t.lineNo,n=t.ch,i=t.nameColor,o=t.color;if(this.colorpicker){var a=o,l=this.cm.charCoords({line:r,ch:n});this.colorpicker.show({left:l.left,top:l.bottom,isShortCut:t.isShortCut||!1,hideDelay:this.opt.hideDelay||2e3},i||o,function(t){e.cm.replaceRange(t,{line:r,ch:n},{line:r,ch:n+a.length},"*colorpicker"),e.cm.focus(),a=t})}}},{key:"close_color_picker",value:function(){this.colorpicker&&this.colorpicker.hide()}},{key:"hide_delay_color_picker",value:function(){this.colorpicker&&this.colorpicker.runHideDelay()}},{key:"key",value:function(t,e){return[t,e].join(":")}},{key:"keyup",value:function(t){this.colorpicker&&("Escape"==t.key?this.colorpicker.hide():0==this.colorpicker.isShortCut&&this.colorpicker.hide())}},{key:"init_color_update",value:function(){this.markers={}}},{key:"style_color_update",value:function(t){if(t)this.match(t);else for(var e=this.cm.lineCount(),r=0;r>16,g:(65280&t)>>8,b:(255&t)>>0,a:1};return n=Object.assign(n,u(n))}if(0<=t&&t<=4294967295){n={type:"hex",r:(4278190080&t)>>24,g:(16711680&t)>>16,b:(65280&t)>>8,a:(255&t)/255};return n=Object.assign(n,u(n))}}return t}function Z(r){"string"==typeof r&&(r=Y(r));var t=(r=r.map(function(t){if("string"==typeof t){var e=X(t),r=q(e.str).split(" ");return r[1]?r[1].includes("%")?r[1]=parseFloat(r[1].replace(/%/,""))/100:r[1]=parseFloat(r[1]):r[1]="*",r[0]=W(r[0],e.matches),r}if(Array.isArray(t))return t[1]?"string"==typeof t[1]&&(t[1].includes("%")?t[1]=parseFloat(t[1].replace(/%/,""))/100:t[1]=+t[1]):t[1]="*",[].concat(N(t))})).filter(function(t){return"*"===t[1]}).length;if(0=r?255:0;if(i)0==t&&($r=0,$g=0,$b=0);else{var e=Math.round(t);$r=e,$g=e,$b=e}},{$C:n,$scale:r,$hasColor:i})}function kt(){var t=0>j,_[u+1]=f*U>>j,_[u+2]=v*U>>j,h-=g,f-=d,v-=p,g-=B.r,d-=B.g,p-=B.b,l=c+((l=i+n+1)>j,_[l+1]=f*U>>j,_[l+2]=v*U>>j,h-=g,f-=d,v-=p,g-=B.r,d-=B.g,p-=B.b,l=i+((l=o+T)255-e?255:0,$g=$g>255-e?255:0,$b=$b>255-e?255:0},{$C:e})},contrast:function(){var t=0>1),s=n[l];return n[l]=n[0],n[0]=s,n},createBitmap:Xt,createBlurMatrix:re,pack:function(n){return function(r,t){Gt(r.pixels.length,function(t,e){n(r.pixels,t,e,r.pixels[t],r.pixels[t+1],r.pixels[t+2],r.pixels[t+3])},function(){t(r)})}},packXY:ee,pixel:Jt,getBitmap:Yt,putBitmap:Wt,radian:function(t){return mt.CONSTANT.radian(t)},convolution:oe,parseParamNumber:qt,filter:ue,clamp:se,fillColor:ne,fillPixelColor:ie},"multi",he),U(Rt,"merge",fe),U(Rt,"matches",ae),U(Rt,"parseFilter",le),U(Rt,"partial",ve),Rt),Ht=Ft;function Lt(t){var e=1= mx) return {currentRunIndex: cri, i: null}; c(cri); i++;"}).join("\n");return new Function("ri","i","s","mx","c","\n let cri = ri;\n \n "+e+"\n \n return {currentRunIndex: cri, i: i} \n ")}(v),e=g,r={},n=0;n>2)},function(){r()},n.functionDumpCount,n.frameTimer,n.loopCount)}function zt(t,r,n,e){var i=4>2;n(t,e%r,Math.floor(e/r))},function(){e()},i.functionDumpCount,i.frameTimer,i.loopCount)}function Xt(t,e,r){return{pixels:new Uint8ClampedArray(t),width:e,height:r}}function Yt(t,e){return vt.getBitmap(t,e)}function Wt(t,e,r){return vt.putBitmap(t,e,r)}function qt(t){return"string"==typeof t&&(t=(t=t.replace(/deg/,"")).replace(/px/,"")),+t}var Kt=/(([\w_\-]+)(\(([^\)]*)\))?)+/gi;function Zt(t,e,r){return function(t){var r={},e=t.map(function(n){var i=[];Object.keys(n.context).forEach(function(t,e){i[t]="n$"+jt+++t+"$"}),Object.keys(n.rootContext).forEach(function(t,e){i[t]="r$"+jt+++t+"$",r[i[t]]=n.rootContext[t]});var t=Object.keys(n.context).filter(function(t){return"number"!=typeof n.context[t]&&"string"!=typeof n.context[t]&&(!Array.isArray(n.context[t])||"number"!=typeof n.context[t][0]&&"string"!=typeof n.context[t][0])}).map(function(t,e){return[i[t],JSON.stringify(n.context[t])].join(" = ")}),o=n.callback.toString().split("{");return o.shift(),(o=(o=o.join("{")).split("}")).pop(),o=o.join("}"),Object.keys(i).forEach(function(r){var t=i[r];"number"==typeof n.context[r]||"string"==typeof n.context[r]?o=o.replace(new RegExp("\\"+r,"g"),n.context[r]):Array.isArray(n.context[r])&&("number"==typeof n.context[r][0]||"string"==typeof n.context[r][0])?n.context[r].forEach(function(t,e){o=o.replace(new RegExp("\\"+r+"\\["+e+"\\]","g"),t)}):o=o.replace(new RegExp("\\"+r,"g"),t)}),{preCallbackString:o,preContext:t}}),n=e.map(function(t,e){return t.preContext.length?"const "+t.preContext+";":""}).join("\n\n"),i=e.map(function(t){return t.preCallbackString}).join("\n\n"),o=new Function("$pixels","$pixelIndex","$clamp","$Color"," \n let $r = $pixels[$pixelIndex], $g = $pixels[$pixelIndex+1], $b = $pixels[$pixelIndex+2], $a = $pixels[$pixelIndex+3];\n\n "+n+"\n\n "+i+"\n \n $pixels[$pixelIndex] = $r\n $pixels[$pixelIndex+1] = $g \n $pixels[$pixelIndex+2] = $b \n $pixels[$pixelIndex+3] = $a \n ");return o.$preCallbackString=i,o.$preContext=n,o.rootContextObject=r,o}([{callback:t,context:1t.width||a>t.height||(u=s*e.width+l<<2,c=a*t.width+o<<2,t.pixels[c]=e.pixels[u],t.pixels[c+1]=e.pixels[u+1],t.pixels[c+2]=e.pixels[u+2],t.pixels[c+3]=e.pixels[u+3])}(n,t,r,r);for(var i=Xt(n.pixels.length,n.width,n.height),o=Xt(t.pixels.length,t.width,t.height),a=function(t,o,i,e,r){var a=Math.round(Math.sqrt(t.length)),l=Math.floor(a/2),n=r?1:0,s="let r = 0, g = 0, b = 0, a = 0, scy = 0, scx =0, si = 0; ",u=[],c=[],h=[],f=[];t.forEach(function(t,e){var r=Math.floor(e/a)-l,n=e%a-l;0!=t&&(u.push("$t["+e+"][$sp[(($sy + ("+r+")) * "+i+" + ($sx + ("+n+"))) * 4]]"),c.push("$t["+e+"][$sp[(($sy + ("+r+")) * "+i+" + ($sx + ("+n+"))) * 4 + 1]]"),h.push("$t["+e+"][$sp[(($sy + ("+r+")) * "+i+" + ($sx + ("+n+"))) * 4 + 2]]"),f.push("$t["+e+"][$sp[(($sy + ("+r+")) * "+i+" + ($sx + ("+n+"))) * 4 + 3]]"))}),s+="r = "+u.join(" + ")+"; g = "+c.join(" + ")+"; b = "+h.join(" + ")+"; a = "+f.join(" + ")+";",s+="$dp[$di] = r; $dp[$di+1] = g;$dp[$di+2] = b;$dp[$di+3] = a + ("+n+")*(255-a); ";var v=new Function("$dp","$sp","$di","$sx","$sy","$t",s);return function(t,e,r,n,i){v(t,e,r,n,i,o)}}(f,g,n.width,n.height,v),l=t.pixels.length/4,s=0;s>2,o=0,a=0,l=0,s=0,u=0,c=0,h=0;ht.width||a>t.height||(u=a*t.width+o<<2,c=s*e.width+l<<2,e.pixels[c]=t.pixels[u],e.pixels[c+1]=t.pixels[u+1],e.pixels[c+2]=t.pixels[u+2],e.pixels[c+3]=t.pixels[u+3])}}(i,o,r,r),e(o)}}function ae(r){var e=Ge.convertMatches(r),t=e.str.match(Kt),n=[];if(!t)return n;n=t.map(function(t){return{filter:t,origin:Ge.reverseMatches(t,e.matches)}});var i={next:0};return n=n.map(function(t){var e=r.indexOf(t.origin,i.next);return t.startIndex=e,t.endIndex=e+t.origin.length,t.arr=le(t.origin),i.next=t.endIndex,t}).filter(function(t){return!!t.arr.length})}function le(t){var e=Ge.convertMatches(t),r=e.str.match(Kt);if(!r[0])return[];var n=r[0].split("("),i=n.shift(),o=[];return n.length&&(o=n.shift().split(")")[0].split(",").map(function(t){return Ge.reverseMatches(t,e.matches)})),[i].concat(N(o)).map(Ge.trim)}function se(t){return Math.min(255,t)}function ue(t){return fe(ae(t).map(function(t){return t.arr}))}function ce(t){for(var e=0= "+(t=$e(ge(t)))+" ? 1.0 : 0.0;\n\n outColor = vec4(c, c, c, pixelColor.a);\n ")}var Re=L({},{blur:function(){return ye([1,1,1,1,1,1,1,1,1])},normal:function(){return ye([0,0,0,0,1,0,0,0,0])},emboss:function(){var t=0 "+r+") {\n outColor = vec4("+Ce(Ge.parse(e))+".rgb, pixelColor.a);\n } else {\n outColor = vec4("+n+".rgb, pixelColor.a);\n }\n ")},brightness:function(){return be("\n outColor = pixelColor + ("+$e(ge(0 1.0 - "+t+") ? 1.0 : 0.0,\n (pixelColor.g > 1.0 - "+t+") ? 1.0 : 0.0,\n (pixelColor.b > 1.0 - "+t+") ? 1.0 : 0.0,\n pixelColor.a \n );\n ")},chaos:function(){return be("\n vec2 st = pixelColor.st;\n st *= "+$e(ge(0e&&(t=ft(t,e)),t.map(function(t){return h(t,r)})},ImageToCanvas:function(t,e,r){var n=3=t){e=ze[n-1],r=ze[n];break}return e&&r?Ge.interpolateRGB(e,r,(t-e.start)/(r.start-e.start)):ze[0].rgb}},Ye=L({},Ut,Ft),We={Color:Ge,HueColor:Xe,ColorNames:D,ImageFilter:Ye,GL:Ve,Canvas:vt,ImageLoader:gt},qe=(Ge.color,0),Ke=[],Ze=(B(Je,[{key:"attr",value:function(t,e){return 1==arguments.length?this.el.getAttribute(t):(this.el.setAttribute(t,e),this)}},{key:"closest",value:function(t){for(var e=this,r=!1;!(r=e.hasClass(t));){if(!e.el.parentNode)return null;e=new Je(e.el.parentNode)}return r?e:null}},{key:"removeClass",value:function(t){return this.el.className=(" "+this.el.className+" ").replace(" "+t+" "," ").trim(),this}},{key:"hasClass",value:function(t){return!!this.el.className&&-1<(" "+this.el.className+" ").indexOf(" "+t+" ")}},{key:"addClass",value:function(t){return this.hasClass(t)||(this.el.className=this.el.className+" "+t),this}},{key:"toggleClass",value:function(t){this.hasClass(t)?this.removeClass(t):this.addClass(t)}},{key:"html",value:function(t){return"string"==typeof t?this.el.innerHTML=t:this.empty().append(t),this}},{key:"find",value:function(t){return this.el.querySelector(t)}},{key:"findAll",value:function(t){return this.el.querySelectorAll(t)}},{key:"empty",value:function(){return this.html("")}},{key:"append",value:function(t){return"string"==typeof t?this.el.appendChild(document.createTextNode(t)):this.el.appendChild(t.el||t),this}},{key:"appendTo",value:function(t){return(t.el?t.el:t).appendChild(this.el),this}},{key:"remove",value:function(){return this.el.parentNode&&this.el.parentNode.removeChild(this.el),this}},{key:"text",value:function(){return this.el.textContent}},{key:"css",value:function(t,e){var r=this;if(2==arguments.length)this.el.style[t]=e;else if(1==arguments.length){if("string"==typeof t)return getComputedStyle(this.el)[t];var n=t||{};Object.keys(n).forEach(function(t){r.el.style[t]=n[t]})}return this}},{key:"cssFloat",value:function(t){return parseFloat(this.css(t))}},{key:"cssInt",value:function(t){return parseInt(this.css(t))}},{key:"offset",value:function(){var t=this.el.getBoundingClientRect();return{top:t.top+Je.getScrollTop(),left:t.left+Je.getScrollLeft()}}},{key:"position",value:function(){return this.el.style.top?{top:parseFloat(this.css("top")),left:parseFloat(this.css("left"))}:this.el.getBoundingClientRect()}},{key:"size",value:function(){return[this.width(),this.height()]}},{key:"width",value:function(){return this.el.offsetWidth||this.el.getBoundingClientRect().width}},{key:"contentWidth",value:function(){return this.width()-this.cssFloat("padding-left")-this.cssFloat("padding-right")}},{key:"height",value:function(){return this.el.offsetHeight||this.el.getBoundingClientRect().height}},{key:"contentHeight",value:function(){return this.height()-this.cssFloat("padding-top")-this.cssFloat("padding-bottom")}},{key:"dataKey",value:function(t){return this.uniqId+"."+t}},{key:"data",value:function(t,e){if(2==arguments.length)return Ke[this.dataKey(t)]=e,this;if(1==arguments.length)return Ke[this.dataKey(t)];var r=Object.keys(Ke),n=this.uniqId+".";return r.filter(function(t){return 0==t.indexOf(n)}).map(function(t){return Ke[t]})}},{key:"val",value:function(t){return 0==arguments.length?this.el.value:(1==arguments.length&&(this.el.value=t),this)}},{key:"int",value:function(){return parseInt(this.val(),10)}},{key:"float",value:function(){return parseFloat(this.val())}},{key:"show",value:function(){return this.css("display","block")}},{key:"hide",value:function(){return this.css("display","none")}},{key:"toggle",value:function(){return"none"==this.css("display")?this.show():this.hide()}},{key:"scrollTop",value:function(){return this.el===document.body?Je.getScrollTop():this.el.scrollTop}},{key:"scrollLeft",value:function(){return this.el===document.body?Je.getScrollLeft():this.el.scrollLeft}},{key:"on",value:function(t,e,r,n){return this.el.addEventListener(t,e,r,n),this}},{key:"off",value:function(t,e){return this.el.removeEventListener(t,e),this}},{key:"getElement",value:function(){return this.el}},{key:"createChild",value:function(t,e,r,n){var i=3"}},{key:"initialize",value:function(){}},{key:"initializeEvent",value:function(){var e=this;this.initializeEventMachin(),Object.keys(this.childComponents).forEach(function(t){e[t]&&e[t].initializeEvent()})}},{key:"destroy",value:function(){var e=this;this.destroyEventMachin(),Object.keys(this.childComponents).forEach(function(t){e[t]&&e[t].destroy()})}},{key:"destroyEventMachin",value:function(){this.removeEventAll()}},{key:"initializeEventMachin",value:function(){this.filterProps(ar).forEach(this.parseEvent.bind(this))}},{key:"collectProps",value:function(){if(!this.collapsedProps){for(var t=this.__proto__,e=[];e.push.apply(e,N(Object.getOwnPropertyNames(t))),t=t.__proto__;);this.collapsedProps=e}return this.collapsedProps}},{key:"filterProps",value:function(e){return this.collectProps().filter(function(t){return t.match(e)})}},{key:"parseEvent",value:function(t){var e=t.split(" ");this.bindingEvent(e,this[t].bind(this))}},{key:"getDefaultDomElement",value:function(t){var e=void 0;return(e=t?this.refs[t]||this[t]||window[t]:this.el||this.$el||this.$root)instanceof Ze?e.getElement():e}},{key:"getDefaultEventObject",value:function(t){var e=this,r=t.split("."),n=r.shift(),i=r.includes("Control"),o=r.includes("Shift"),a=r.includes("Alt"),l=r.includes("Meta"),s=(r=r.filter(function(t){return!1===sr.includes(t)})).filter(function(t){return!!e[t]});return{eventName:n,isControl:i,isShift:o,isAlt:a,isMeta:l,codes:r=r.filter(function(t){return!1===s.includes(t)}).map(function(t){return t.toLowerCase()}),checkMethodList:s}}},{key:"bindingEvent",value:function(t,e){var r=function(t){return Array.isArray(t)?t:Array.from(t)}(t),n=r[0],i=r[1],o=r.slice(2);i=this.getDefaultDomElement(i);var a=this.getDefaultEventObject(n);a.dom=i,a.delegate=o.join(" "),this.addEvent(a,e)}},{key:"matchPath",value:function(t,e){return t?t.matches(e)?t:this.matchPath(t.parentElement,e):null}},{key:"getBindings",value:function(){return this._bindings||this.initBindings(),this._bindings}},{key:"addBinding",value:function(t){this.getBindings().push(t)}},{key:"initBindings",value:function(){this._bindings=[]}},{key:"checkEventType",value:function(e,t){var r=this,n=!e.ctrlKey||t.isControl,i=!e.shiftKey||t.isShift,o=!e.altKey||t.isAlt,a=!e.metaKey||t.isMeta,l=!0;t.codes.length&&(l=t.codes.includes(e.code.toLowerCase())||t.codes.includes(e.key.toLowerCase()));var s=!0;return t.checkMethodList.length&&(s=t.checkMethodList.every(function(t){return r[t].call(r,e)})),n&&o&&i&&a&&l&&s}},{key:"makeCallback",value:function(r,n){var i=this;return r.delegate?function(t){if(i.checkEventType(t,r)){var e=i.matchPath(t.target||t.srcElement,r.delegate);if(e)return t.delegateTarget=e,t.$delegateTarget=new Ze(e),n(t)}}:function(t){if(i.checkEventType(t,r))return n(t)}}},{key:"addEvent",value:function(t,e){t.callback=this.makeCallback(t,e),this.addBinding(t),nr.addEvent(t.dom,t.eventName,t.callback)}},{key:"removeEventAll",value:function(){var e=this;this.getBindings().forEach(function(t){e.removeEvent(t)}),this.initBindings()}},{key:"removeEvent",value:function(t){var e=t.eventName,r=t.dom,n=t.callback;nr.removeEvent(r,e,n)}}]),cr);function cr(){P(this,cr),this.state=new ir(this),this.refs={},this.childComponents=this.components()}var hr=/^@/,fr=(F(vr,ur),B(vr,[{key:"initializeStoreEvent",value:function(){var n=this;this.storeEvents={},this.filterProps(hr).forEach(function(t){var e=t.split("@");e.shift();var r=e.join("@");n.storeEvents[r]=n[t].bind(n),n.$store.on(r,n.storeEvents[r])})}},{key:"destoryStoreEvent",value:function(){var e=this;Object.keys(this.storeEvents).forEach(function(t){e.$store.off(t,e.storeEvents[t])})}}]),vr);function vr(t){P(this,vr);var e=H(this,(vr.__proto__||Object.getPrototypeOf(vr)).call(this,t));return e.opt=t||{},t&&t.$store&&(e.$store=t.$store),e.initialize(),e.initializeStoreEvent(),e}var gr=(F(dr,Qe),B(dr,[{key:"initialize",value:function(){j(dr.prototype.__proto__||Object.getPrototypeOf(dr.prototype),"initialize",this).call(this),this.$store.rgb={},this.$store.hsl={},this.$store.hsv={},this.$store.alpha=1,this.$store.format="hex"}},{key:"/changeFormat",value:function(t,e){t.format=e,t.emit("changeFormat")}},{key:"/initColor",value:function(t,e,r){t.dispatch("/changeColor",e,r,!0),t.emit("initColor")}},{key:"/changeColor",value:function(t,e,r,n){"string"==typeof(e=e||"#FF0000")&&(e=Ge.parse(e)),e.source=e.source||r,t.alpha=function(t){return void 0===t||null==t}(e.a)?t.alpha:e.a,t.format="hsv"!=e.type&&e.type||t.format,"hex"==t.format&&t.alpha<1&&(t.format="rgb"),"hsl"==e.type?(t.hsl=Object.assign(t.hsl,e),t.rgb=Ge.HSLtoRGB(t.hsl),t.hsv=Ge.HSLtoHSV(e)):"hex"==e.type?(t.rgb=Object.assign(t.rgb,e),t.hsl=Ge.RGBtoHSL(t.rgb),t.hsv=Ge.RGBtoHSV(e)):"rgb"==e.type?(t.rgb=Object.assign(t.rgb,e),t.hsl=Ge.RGBtoHSL(t.rgb),t.hsv=Ge.RGBtoHSV(e)):"hsv"==e.type&&(t.hsv=Object.assign(t.hsv,e),t.rgb=Ge.HSVtoRGB(t.hsv),t.hsl=Ge.HSVtoHSL(t.hsv)),n||t.emit("changeColor",e.source)}},{key:"/getHueColor",value:function(t){return Xe.checkHueColor(t.hsv.h/360)}},{key:"/toString",value:function(t,e){var r=t[e=e||t.format]||t.rgb;return Ge.format(Object.assign({},r,{a:t.alpha}),e)}},{key:"/toColor",value:function(t,e){return"rgb"==(e=e||t.format)?t.dispatch("/toRGB"):"hsl"==e?t.dispatch("/toHSL"):"hex"==e?t.dispatch("/toHEX"):t.dispatch("/toString",e)}},{key:"/toRGB",value:function(t){return t.dispatch("/toString","rgb")}},{key:"/toHSL",value:function(t){return t.dispatch("/toString","hsl")}},{key:"/toHEX",value:function(t){return t.dispatch("/toString","hex").toUpperCase()}}]),dr);function dr(){return P(this,dr),H(this,(dr.__proto__||Object.getPrototypeOf(dr)).apply(this,arguments))}var pr=(B(mr,[{key:"initialize",value:function(){this.initializeModule()}},{key:"initializeModule",value:function(){var e=this;this.modules.forEach(function(t){new t(e)})}},{key:"action",value:function(t,e){this.actions[t]={context:e,callback:e[t]}}},{key:"dispatch",value:function(t){var e=[].concat(Array.prototype.slice.call(arguments)),r=(t=e.shift(),this.actions[t]);if(r)return r.callback.apply(r.context,[this].concat(N(e)))}},{key:"module",value:function(t){}},{key:"on",value:function(t,e){this.callbacks.push({event:t,callback:e})}},{key:"off",value:function(e,r){0==arguments.length?this.callbacks=[]:1==arguments.length?this.callbacks=this.callbacks.filter(function(t){return t.event!=e}):2==arguments.length&&(this.callbacks=this.callbacks.filter(function(t){return t.event!=e&&t.callback!=r}))}},{key:"emit",value:function(){var e=[].concat(Array.prototype.slice.call(arguments)),r=e.shift();this.callbacks.filter(function(t){return t.event==r}).forEach(function(t){t&&"function"==typeof t.callback&&t.callback.apply(t,N(e))})}}]),mr);function mr(t){P(this,mr),this.callbacks=[],this.actions=[],this.modules=t.modules||[],this.initialize()}var yr=(F(br,fr),B(br,[{key:"initialize",value:function(){var t=this;this.$body=null,this.$root=null,this.$store=new pr({modules:[gr,er]}),this.callbackChange=function(){t.callbackColorValue()},this.callbackLastUpdate=function(){t.callbackLastUpdateColorValue()},this.colorpickerShowCallback=function(){},this.colorpickerHideCallback=function(){},this.colorpickerLastUpdateCallback=function(){},this.$body=new Ze(this.getContainer()),this.$root=new Ze("div","codemirror-colorpicker"),"inline"==this.opt.position&&this.$body.append(this.$root),this.opt.type&&this.$root.addClass(this.opt.type),this.opt.hideInformation&&this.$root.addClass("hide-information"),this.opt.hideColorsets&&this.$root.addClass("hide-colorsets"),this.$arrow=new Ze("div","arrow"),this.$root.append(this.$arrow),this.$store.dispatch("/setUserPalette",this.opt.colorSets),this.render(),this.$root.append(this.$el),this.initColorWithoutChangeEvent(this.opt.color),this.initializeEvent()}},{key:"initColorWithoutChangeEvent",value:function(t){this.$store.dispatch("/initColor",t)}},{key:"show",value:function(t,e,r,n,i){this.colorpickerShowCallback=r,this.colorpickerHideCallback=n,this.colorpickerLastUpdateCallback=i,this.$root.css(this.getInitalizePosition()).show(),this.isColorPickerShow=!0,this.isShortCut=t.isShortCut||!1,this.outputFormat=t.outputFormat,this.hideDelay=+(void 0===t.hideDelay?2e3:t.hideDelay),0window.innerWidth&&(n-=e+n-window.innerWidth),n<0&&(n=0);var i=t.top-this.$body.scrollTop();r+i>window.innerHeight&&(i-=r+i-window.innerHeight),i<0&&(i=0),this.$root.css({left:n+"px",top:i+"px"})}},{key:"getInitalizePosition",value:function(){return"inline"==this.opt.position?{position:"relative",left:"auto",top:"auto",display:"inline-block"}:{position:"fixed",left:"-10000px",top:"-10000px"}}},{key:"isAbsolute",value:function(){return"inline"!==this.opt.position}},{key:"mouseup.isAbsolute document",value:function(t){this.__isMouseDown=!1,this.checkInHtml(t.target)||(0==this.checkColorPickerClass(t.target)?this.hide():this.__isMouseIn||(clearTimeout(this.timerCloseColorPicker),this.timerCloseColorPicker=setTimeout(this.hide.bind(this),this.delayTime||this.hideDelay)))}},{key:"mouseover.isAbsolute $root",value:function(t){clearTimeout(this.timerCloseColorPicker)}},{key:"mousemove.isAbsolute $root",value:function(t){clearTimeout(this.timerCloseColorPicker)}},{key:"mouseenter.isAbsolute $root",value:function(t){clearTimeout(this.timerCloseColorPicker),this.__isMouseIn=!0}},{key:"mouseleave.isAbsolute $root",value:function(t){this.__isMouseIn=!1,this.__isMouseDown||(clearTimeout(this.timerCloseColorPicker),this.timerCloseColorPicker=setTimeout(this.hide.bind(this),this.delayTime||this.hideDelay))}},{key:"mousedown.isAbsolute $root",value:function(t){this.__isMouseDown=!0}},{key:"setHideDelay",value:function(t){this.delayTime=t||0}},{key:"runHideDelay",value:function(){this.isColorPickerShow&&this.setHideDelay()}},{key:"callbackColorValue",value:function(t){t=t||this.getCurrentColor(),"function"==typeof this.opt.onChange&&this.opt.onChange.call(this,t),"function"==typeof this.colorpickerShowCallback&&this.colorpickerShowCallback(t)}},{key:"callbackLastUpdateColorValue",value:function(t){t=t||this.getCurrentColor(),"function"==typeof this.opt.onLastUpdate&&this.opt.onLastUpdate.call(this,t),"function"==typeof this.colorpickerLastUpdateCallback&&this.colorpickerLastUpdateCallback(t)}},{key:"callbackHideColorValue",value:function(t){t=t||this.getCurrentColor(),"function"==typeof this.opt.onHide&&this.opt.onHide.call(this,t),"function"==typeof this.colorpickerHideCallback&&this.colorpickerHideCallback(t)}},{key:"getCurrentColor",value:function(){return this.$store.dispatch("/toColor",this.outputFormat)}},{key:"checkColorPickerClass",value:function(t){var e=new Ze(t).closest("codemirror-colorview"),r=new Ze(t).closest("codemirror-colorpicker"),n=new Ze(t).closest("CodeMirror");return t.nodeName,!!(r||e||n)}},{key:"checkInHtml",value:function(t){return"HTML"==t.nodeName}},{key:"initializeStoreEvent",value:function(){j(br.prototype.__proto__||Object.getPrototypeOf(br.prototype),"initializeStoreEvent",this).call(this),this.$store.on("changeColor",this.callbackChange),this.$store.on("lastUpdateColor",this.callbackLastUpdate),this.$store.on("changeFormat",this.callbackChange)}},{key:"destroy",value:function(){j(br.prototype.__proto__||Object.getPrototypeOf(br.prototype),"destroy",this).call(this),this.$store.off("changeColor",this.callbackChange),this.$store.off("lastUpdateColor",this.callbackLastUpdate),this.$store.off("changeFormat",this.callbackChange),this.callbackChange=void 0,this.callbackLastUpdate=void 0,this.colorpickerShowCallback=void 0,this.colorpickerHideCallback=void 0}}]),br);function br(t){P(this,br);var e=H(this,(br.__proto__||Object.getPrototypeOf(br)).call(this,t));return e.isColorPickerShow=!1,e.isShortCut=!1,e.hideDelay=+(void 0===e.opt.hideDeplay?2e3:e.opt.hideDelay),e.timerCloseColorPicker,e.autoHide=e.opt.autoHide||!0,e.outputFormat=e.opt.outputFormat,e.$checkColorPickerClass=e.checkColorPickerClass.bind(e),e}var kr=(F(Cr,fr),B(Cr,[{key:"refresh",value:function(){}},{key:"refreshColorUI",value:function(t){}},{key:"changeColor",value:function(t){this.$store.dispatch("/changeColor",Object.assign({source:this.source},t||{}))}},{key:"mouseup document",value:function(t){this.onDragEnd(t)}},{key:"mousemove document",value:function(t){this.onDragMove(t)}},{key:"mousedown $bar",value:function(t){t.preventDefault(),this.isDown=!0}},{key:"mousedown $container",value:function(t){this.isDown=!0,this.onDragStart(t)}},{key:"touchend document",value:function(t){this.onDragEnd(t)}},{key:"touchmove document",value:function(t){this.onDragMove(t)}},{key:"touchstart $bar",value:function(t){t.preventDefault(),this.isDown=!0}},{key:"touchstart $container",value:function(t){this.onDragStart(t)}},{key:"onDragStart",value:function(t){this.isDown=!0,this.refreshColorUI(t)}},{key:"onDragMove",value:function(t){this.isDown&&this.refreshColorUI(t)}},{key:"onDragEnd",value:function(t){this.isDown&&(this.$store.emit("lastUpdateColor"),this.isDown=!1)}},{key:"@changeColor",value:function(t){this.source!=t&&this.refresh()}},{key:"@initColor",value:function(){this.refresh()}}]),Cr);function Cr(t){P(this,Cr);var e=H(this,(Cr.__proto__||Object.getPrototypeOf(Cr)).call(this,t));return e.source="base-box",e}var xr=(F(_r,kr),B(_r,[{key:"getMinMaxPosition",value:function(){var t=this.getMinPosition(),e=this.getMaxDist();return{min:t,max:t+e,width:e}}},{key:"getCurrent",value:function(t){return min+this.getMaxDist()*t}},{key:"getMinPosition",value:function(){return this.refs.$container.offset().left}},{key:"getMaxDist",value:function(){return this.state.get("$container.width")}},{key:"getDist",value:function(t){var e=this.getMinMaxPosition(),r=e.min,n=e.max;return t=this.maxValue?this.refs.$bar.addClass("last").removeClass("first"):this.refs.$bar.removeClass("last").removeClass("first"),this.setMousePosition(this.getMaxDist()*((t||0)/this.maxValue))}}]),_r);function _r(t){P(this,_r);var e=H(this,(_r.__proto__||Object.getPrototypeOf(_r)).call(this,t));return e.minValue=0,e.maxValue=1,e.source="base-slider",e}var wr=(F(Mr,xr),B(Mr,[{key:"template",value:function(){return'\n
\n
\n
\n
\n
\n '}},{key:"setBackgroundColor",value:function(){this.refs.$container.css("background-color",this.$store.dispatch("/toRGB"))}},{key:"refresh",value:function(){j(Mr.prototype.__proto__||Object.getPrototypeOf(Mr.prototype),"refresh",this).call(this),this.setBackgroundColor()}},{key:"getDefaultValue",value:function(){return this.$store.hsv.v}},{key:"refreshColorUI",value:function(t){var e=this.getCaculatedDist(t);this.setColorUI(e/100*this.maxValue),this.changeColor({type:"hsv",v:e/100*this.maxValue})}}]),Mr);function Mr(t){P(this,Mr);var e=H(this,(Mr.__proto__||Object.getPrototypeOf(Mr)).call(this,t));return e.minValue=0,e.maxValue=1,e.source="value-control",e}var Or=(F(Sr,xr),B(Sr,[{key:"template",value:function(){return'\n
\n
\n
\n
\n
\n
\n '}},{key:"refresh",value:function(){j(Sr.prototype.__proto__||Object.getPrototypeOf(Sr.prototype),"refresh",this).call(this),this.setOpacityColorBar()}},{key:"setOpacityColorBar",value:function(){var t=Object.assign({},this.$store.rgb);t.a=0;var e=Ge.format(t,"rgb");t.a=1;var r=Ge.format(t,"rgb");this.setOpacityColorBarBackground(e,r)}},{key:"setOpacityColorBarBackground",value:function(t,e){this.refs.$colorbar.css("background","linear-gradient(to right, "+t+", "+e+")")}},{key:"getDefaultValue",value:function(){return this.$store.alpha}},{key:"refreshColorUI",value:function(t){var e=this.getCaculatedDist(t);this.setColorUI(e/100*this.maxValue),this.changeColor({a:Math.floor(e)/100*this.maxValue})}}]),Sr);function Sr(t){P(this,Sr);var e=H(this,(Sr.__proto__||Object.getPrototypeOf(Sr)).call(this,t));return e.minValue=0,e.maxValue=1,e.source="opacity-control",e}var Er=(F(Tr,fr),B(Tr,[{key:"components",value:function(){return{Value:wr,Opacity:Or}}},{key:"template",value:function(){return'\n
\n
\n
\n
\n
\n
\n '}},{key:"setBackgroundColor",value:function(){this.refs.$controlColor.css("background-color",this.$store.dispatch("/toRGB"))}},{key:"refresh",value:function(){this.setColorUI(),this.setBackgroundColor()}},{key:"setColorUI",value:function(){this.Value.setColorUI(),this.Opacity.setColorUI()}},{key:"@changeColor",value:function(t){"macos-control"!=t&&this.refresh()}},{key:"@initColor",value:function(){this.refresh()}}]),Tr);function Tr(){return P(this,Tr),H(this,(Tr.__proto__||Object.getPrototypeOf(Tr)).apply(this,arguments))}var Ar=(F(Ir,fr),B(Ir,[{key:"template",value:function(){return'\n
\n \n
\n
\n
\n '}},{key:"refresh",value:function(t){this.setColorUI(t)}},{key:"setColorUI",value:function(t){this.renderCanvas(),this.renderValue(),this.setHueColor(null,t)}},{key:"renderValue",value:function(){var t=1-this.$store.hsv.v;this.refs.$valuewheel.css({"background-color":"rgba(0, 0, 0, "+t+")"})}},{key:"renderWheel",value:function(t,e){this.width&&!t&&(t=this.width),this.height&&!e&&(e=this.height);var r=new Ze("canvas"),n=r.el.getContext("2d");r.el.width=t,r.el.height=e,r.css({width:t+"px",height:e+"px"});for(var i=n.getImageData(0,0,t,e),o=i.data,a=Math.floor(t/2),l=Math.floor(e/2),s=e\n
\n \n
\n
\n
\n \n
HEX
\n
\n
\n
\n
\n \n
R
\n
\n
\n \n
G
\n
\n
\n \n
B
\n
\n
\n \n
A
\n
\n
\n
\n
\n \n
H
\n
\n
\n \n
%
\n
S
\n
\n
\n \n
%
\n
L
\n
\n
\n \n
A
\n
\n
\n \n '}},{key:"setCurrentFormat",value:function(t){this.format=t,this.initFormat()}},{key:"initFormat",value:function(){var t=this.format||"hex";this.$el.removeClass("hex"),this.$el.removeClass("rgb"),this.$el.removeClass("hsl"),this.$el.addClass(t)}},{key:"nextFormat",value:function(){var t=this.format||"hex",e="hex";"hex"==t?e="rgb":"rgb"==t?e="hsl":"hsl"==t&&(e=1==this.$store.alpha?"hex":"rgb"),this.$el.removeClass(t),this.$el.addClass(e),this.format=e,this.$store.dispatch("/changeFormat",this.format),this.$store.emit("lastUpdateColor")}},{key:"getFormat",value:function(){return this.format||"hex"}},{key:"checkNumberKey",value:function(t){var e=t.which,r=!1;return 37!=e&&39!=e&&8!=e&&46!=e&&9!=e||(r=!0),!(!r&&(e<48||57\n
\n
\n

Color Palettes

\n ×\n
\n
\n
\n \n '}},{key:"refresh",value:function(){this.load()}},{key:"@changeCurrentColorSets",value:function(){this.refresh()}},{key:"@toggleColorChooser",value:function(){this.toggle()}},{key:"load $colorsetsList",value:function(){return"\n
\n "+this.$store.dispatch("/getColorSetsList").map(function(t,e){return'\n
\n

'+t.name+'

\n
\n
\n '+t.colors.filter(function(t,e){return e<5}).map(function(t){return'
\n
\n
'}).join("")+"\n
\n
\n
"}).join("")+"\n
\n "}},{key:"show",value:function(){this.$el.addClass("open")}},{key:"hide",value:function(){this.$el.removeClass("open")}},{key:"toggle",value:function(){this.$el.toggleClass("open")}},{key:"click $toggleButton",value:function(t){this.toggle()}},{key:"click $colorsetsList .colorsets-item",value:function(t){var e=t.$delegateTarget;if(e){var r=parseInt(e.attr("data-colorsets-index"));this.$store.dispatch("/setCurrentColorSets",r),this.hide()}}},{key:"destroy",value:function(){j(Ur.prototype.__proto__||Object.getPrototypeOf(Ur.prototype),"destroy",this).call(this),this.hide()}}]),Ur);function Ur(){return P(this,Ur),H(this,(Ur.__proto__||Object.getPrototypeOf(Ur)).apply(this,arguments))}var jr=(F(Fr,fr),B(Fr,[{key:"template",value:function(){return'\n
\n \n
\n
\n '}},{key:"load $colorSetsColorList",value:function(){var t=this.$store.dispatch("/getCurrentColorSets");return'\n
\n '+this.$store.dispatch("/getCurrentColors").map(function(t,e){return'
\n
\n
\n
'}).join("")+" \n "+(t.edit?'
+
':"")+" \n
\n "}},{key:"refresh",value:function(){this.load()}},{key:"addColor",value:function(t){this.$store.dispatch("/addCurrentColor",t)}},{key:"@changeCurrentColorSets",value:function(){this.refresh()}},{key:"click $colorSetsChooseButton",value:function(t){this.$store.emit("toggleColorChooser")}},{key:"contextmenu $colorSetsColorList",value:function(t){if(t.preventDefault(),this.$store.dispatch("/getCurrentColorSets").edit){var e=new Ze(t.target).closest("color-item");if(e){var r=parseInt(e.attr("data-index"));this.$store.emit("showContextMenu",t,r)}else this.$store.emit("showContextMenu",t)}}},{key:"click $colorSetsColorList .add-color-item",value:function(t){this.addColor(this.$store.dispatch("/toColor"))}},{key:"click $colorSetsColorList .color-item",value:function(t){this.$store.dispatch("/changeColor",t.$delegateTarget.attr("data-color")),this.$store.emit("lastUpdateColor")}}]),Fr);function Fr(){return P(this,Fr),H(this,(Fr.__proto__||Object.getPrototypeOf(Fr)).apply(this,arguments))}var Hr=(F(Lr,fr),B(Lr,[{key:"template",value:function(){return'\n
    \n \n \n \n
\n '}},{key:"show",value:function(t,e){var r=nr.pos(t);this.$el.css({top:r.clientY-10+"px",left:r.clientX+"px"}),this.$el.addClass("show"),this.selectedColorIndex=e,void 0===this.selectedColorIndex?this.$el.addClass("small"):this.$el.removeClass("small")}},{key:"hide",value:function(){this.$el.removeClass("show")}},{key:"runCommand",value:function(t){switch(t){case"remove-color":this.$store.dispatch("/removeCurrentColor",this.selectedColorIndex);break;case"remove-all-to-the-right":this.$store.dispatch("/removeCurrentColorToTheRight",this.selectedColorIndex);break;case"clear-palette":this.$store.dispatch("/clearPalette")}}},{key:"@showContextMenu",value:function(t,e){this.show(t,e)}},{key:"click $el .menu-item",value:function(t){t.preventDefault(),this.runCommand(t.$delegateTarget.attr("data-type")),this.hide()}}]),Lr);function Lr(){return P(this,Lr),H(this,(Lr.__proto__||Object.getPrototypeOf(Lr)).apply(this,arguments))}var Vr=(F(Nr,yr),B(Nr,[{key:"template",value:function(){return'\n
\n
\n
\n
\n
\n
\n
\n
\n '}},{key:"components",value:function(){return{colorwheel:Ar,control:Er,information:Dr,currentColorSets:jr,colorSetsChooser:Rr,contextMenu:Hr}}}]),Nr);function Nr(){return P(this,Nr),H(this,(Nr.__proto__||Object.getPrototypeOf(Nr)).apply(this,arguments))}var Gr=(F(zr,xr),B(zr,[{key:"template",value:function(){return'\n
\n
\n
\n
\n
\n '}},{key:"getDefaultValue",value:function(){return this.$store.hsv.h}},{key:"refreshColorUI",value:function(t){var e=this.getCaculatedDist(t);this.setColorUI(e/100*this.maxValue),this.changeColor({h:e/100*this.maxValue,type:"hsv"})}}]),zr);function zr(t){P(this,zr);var e=H(this,(zr.__proto__||Object.getPrototypeOf(zr)).call(this,t));return e.minValue=0,e.maxValue=360,e.source="hue-control",e}var Xr=(F(Yr,fr),B(Yr,[{key:"components",value:function(){return{Hue:Gr,Opacity:Or}}},{key:"template",value:function(){return'\n
\n
\n
\n
\n
\n
\n '}},{key:"setBackgroundColor",value:function(){this.refs.$controlColor.css("background-color",this.$store.dispatch("/toRGB"))}},{key:"refresh",value:function(){this.setColorUI(),this.setBackgroundColor()}},{key:"setColorUI",value:function(){this.Hue.setColorUI(),this.Opacity.setColorUI()}},{key:"@changeColor",value:function(t){"chromedevtool-control"!=t&&this.refresh()}},{key:"@initColor",value:function(){this.refresh()}}]),Yr);function Yr(){return P(this,Yr),H(this,(Yr.__proto__||Object.getPrototypeOf(Yr)).apply(this,arguments))}var Wr="chromedevtool-palette",qr=(F(Kr,fr),B(Kr,[{key:"template",value:function(){return'\n
\n
\n
\n
\n
\n
\n
\n '}},{key:"setBackgroundColor",value:function(t){this.$el.css("background-color",t)}},{key:"refresh",value:function(){this.setColorUI()}},{key:"caculateSV",value:function(){var t=this.drag_pointer_pos||{x:0,y:0},e=this.state.get("$el.width"),r=this.state.get("$el.height"),n=t.x/e,i=(r-t.y)/r;this.$store.dispatch("/changeColor",{type:"hsv",s:n,v:i,source:Wr})}},{key:"setColorUI",value:function(){var t=this.state.get("$el.width")*this.$store.hsv.s,e=this.state.get("$el.height")*(1-this.$store.hsv.v);this.refs.$drag_pointer.css({left:t+"px",top:e+"px"}),this.drag_pointer_pos={x:t,y:e},this.setBackgroundColor(this.$store.dispatch("/getHueColor"))}},{key:"setMainColor",value:function(t){var e=this.$el.offset(),r=this.state.get("$el.contentWidth"),n=this.state.get("$el.contentHeight"),i=nr.pos(t).pageX-e.left,o=nr.pos(t).pageY-e.top;i<0?i=0:r\n
\n
\n
\n
\n
\n
\n \n '}},{key:"components",value:function(){return{palette:qr,control:Xr,information:Dr,currentColorSets:jr,colorSetsChooser:Rr,contextMenu:Hr}}}]),Jr);function Jr(){return P(this,Jr),H(this,(Jr.__proto__||Object.getPrototypeOf(Jr)).apply(this,arguments))}var Qr=(F(tn,fr),B(tn,[{key:"components",value:function(){return{Hue:Gr,Opacity:Or}}},{key:"template",value:function(){return'\n
\n
\n
\n
\n '}},{key:"refresh",value:function(){this.setColorUI()}},{key:"setColorUI",value:function(){this.Hue.setColorUI(),this.Opacity.setColorUI()}},{key:"@changeColor",value:function(t){"mini-control"!=t&&this.refresh()}},{key:"@initColor",value:function(){this.refresh()}}]),tn);function tn(){return P(this,tn),H(this,(tn.__proto__||Object.getPrototypeOf(tn)).apply(this,arguments))}var en=(F(rn,yr),B(rn,[{key:"template",value:function(){return'\n
\n
\n
\n
\n '}},{key:"components",value:function(){return{palette:qr,control:Qr}}}]),rn);function rn(){return P(this,rn),H(this,(rn.__proto__||Object.getPrototypeOf(rn)).apply(this,arguments))}var nn=(F(on,xr),B(on,[{key:"getMaxDist",value:function(){return this.state.get("$container.height")}},{key:"setMousePosition",value:function(t){this.refs.$bar.css({top:t+"px"})}},{key:"getMousePosition",value:function(t){return nr.pos(t).pageY}},{key:"getMinPosition",value:function(){return this.refs.$container.offset().top}},{key:"getCaculatedDist",value:function(t){var e=t?this.getMousePosition(t):this.getCurrent(this.getDefaultValue()/this.maxValue);return 100-this.getDist(e)}},{key:"setColorUI",value:function(t){(t=t||this.getDefaultValue())<=this.minValue?this.refs.$bar.addClass("first").removeClass("last"):t>=this.maxValue?this.refs.$bar.addClass("last").removeClass("first"):this.refs.$bar.removeClass("last").removeClass("first");var e=1-(t||0)/this.maxValue;this.setMousePosition(this.getMaxDist()*e)}}]),on);function on(t){P(this,on);var e=H(this,(on.__proto__||Object.getPrototypeOf(on)).call(this,t));return e.source="vertical-slider",e}var an=(F(ln,nn),B(ln,[{key:"template",value:function(){return'\n
\n
\n
\n
\n
\n '}},{key:"getDefaultValue",value:function(){return this.$store.hsv.h}},{key:"refreshColorUI",value:function(t){var e=this.getCaculatedDist(t);this.setColorUI(e/100*this.maxValue),this.changeColor({h:e/100*this.maxValue,type:"hsv"})}}]),ln);function ln(t){P(this,ln);var e=H(this,(ln.__proto__||Object.getPrototypeOf(ln)).call(this,t));return e.minValue=0,e.maxValue=360,e.source="vertical-hue-control",e}var sn=(F(un,nn),B(un,[{key:"template",value:function(){return'\n
\n
\n
\n
\n
\n
\n '}},{key:"refresh",value:function(){j(un.prototype.__proto__||Object.getPrototypeOf(un.prototype),"refresh",this).call(this),this.setOpacityColorBar()}},{key:"setOpacityColorBar",value:function(){var t=Object.assign({},this.$store.rgb);t.a=0;var e=Ge.format(t,"rgb");t.a=1;var r=Ge.format(t,"rgb");this.refs.$colorbar.css("background","linear-gradient(to top, "+e+", "+r+")")}},{key:"getDefaultValue",value:function(){return this.$store.alpha}},{key:"refreshColorUI",value:function(t){var e=this.getCaculatedDist(t);this.setColorUI(e/100*this.maxValue),this.changeColor({a:Math.floor(e)/100*this.maxValue})}}]),un);function un(t){P(this,un);var e=H(this,(un.__proto__||Object.getPrototypeOf(un)).call(this,t));return e.source="vertical-opacity-control",e}var cn=(F(hn,fr),B(hn,[{key:"components",value:function(){return{Hue:an,Opacity:sn}}},{key:"template",value:function(){return'
'}},{key:"refresh",value:function(){this.setColorUI()}},{key:"setColorUI",value:function(){this.Hue.setColorUI(),this.Opacity.setColorUI()}},{key:"@changeColor",value:function(t){"mini-control"!=t&&this.refresh()}},{key:"@initColor",value:function(){this.refresh()}}]),hn);function hn(){return P(this,hn),H(this,(hn.__proto__||Object.getPrototypeOf(hn)).apply(this,arguments))}var fn=(F(vn,yr),B(vn,[{key:"template",value:function(){return'\n
\n
\n
\n '}},{key:"components",value:function(){return{palette:qr,control:cn}}}]),vn);function vn(){return P(this,vn),H(this,(vn.__proto__||Object.getPrototypeOf(vn)).apply(this,arguments))}var gn=(F(dn,fr),B(dn,[{key:"components",value:function(){return{Value:wr,Opacity:Or}}},{key:"template",value:function(){return'\n
\n
\n
\n
\n
\n
\n '}},{key:"setBackgroundColor",value:function(){this.refs.$controlColor.css("background-color",this.$store.dispatch("/toRGB"))}},{key:"refresh",value:function(){this.setColorUI(),this.setBackgroundColor()}},{key:"setColorUI",value:function(){this.Value.setColorUI(),this.Opacity.setColorUI()}},{key:"@changeColor",value:function(t){"macos-control"!=t&&this.refresh()}},{key:"@initColor",value:function(){this.refresh()}}]),dn);function dn(){return P(this,dn),H(this,(dn.__proto__||Object.getPrototypeOf(dn)).apply(this,arguments))}var pn=(F(mn,Ar),B(mn,[{key:"template",value:function(){return'\n
\n \n
\n
\n '}},{key:"setColorUI",value:function(t){this.renderCanvas(),this.setHueColor(null,t)}},{key:"getDefaultValue",value:function(){return this.$store.hsv.h}},{key:"setHueColor",value:function(t,e){if(this.state.get("$el.width")){var r=this.getRectangle(),n=r.minX,i=r.minY,o=r.radius,a=r.centerX,l=r.centerY,s=this.getCurrentXY(t,this.getDefaultValue(),o,a,l),u=b((h=s.x)-a,(f=s.y)-l),c=this.getCurrentXY(null,u,o-this.half_thinkness,a,l),h=c.x,f=c.y;this.refs.$drag_pointer.css({left:h-n+"px",top:f-i+"px"}),e||this.changeColor({type:"hsv",h:u})}}}]),mn);function mn(t){P(this,mn);var e=H(this,(mn.__proto__||Object.getPrototypeOf(mn)).call(this,t));return e.width=214,e.height=214,e.thinkness=16,e.half_thinkness=e.thinkness/2,e.source="colorring",e}var yn=(F(bn,yr),B(bn,[{key:"template",value:function(){return'\n
\n
\n
\n
\n
\n
\n
\n
\n
\n '}},{key:"components",value:function(){return{colorring:pn,palette:qr,control:gn,information:Dr,currentColorSets:jr,colorSetsChooser:Rr,contextMenu:Hr}}}]),bn);function bn(){return P(this,bn),H(this,(bn.__proto__||Object.getPrototypeOf(bn)).apply(this,arguments))}var kn=(F(Cn,fr),B(Cn,[{key:"components",value:function(){return{Hue:an,Opacity:sn}}},{key:"template",value:function(){return'\n
\n
\n
\n
\n '}},{key:"refresh",value:function(){this.setColorUI()}},{key:"setColorUI",value:function(){this.Hue.setColorUI(),this.Opacity.setColorUI()}},{key:"@changeColor",value:function(){this.refresh()}},{key:"@initColor",value:function(){this.refresh()}}]),Cn);function Cn(){return P(this,Cn),H(this,(Cn.__proto__||Object.getPrototypeOf(Cn)).apply(this,arguments))}var $n=(F(xn,yr),B(xn,[{key:"template",value:function(){return'\n
\n
\n
\n
\n
\n
\n
\n
\n '}},{key:"components",value:function(){return{palette:qr,control:kn,information:Dr,currentColorSets:jr,colorSetsChooser:Rr,contextMenu:Hr}}}]),xn);function xn(){return P(this,xn),H(this,(xn.__proto__||Object.getPrototypeOf(xn)).apply(this,arguments))}var _n={create:function(t){switch(t.type){case"macos":return new Vr(t);case"xd":return new $n(t);case"ring":return new yn(t);case"mini":return new en(t);case"mini-vertical":return new fn(t);case"sketch":case"palette":default:return new Zr(t)}},ColorPicker:Zr,ChromeDevToolColorPicker:Zr,MacOSColorPicker:Vr,RingColorPicker:yn,MiniColorPicker:en,MiniVerticalColorPicker:fn},wn="codemirror-colorview",Mn="codemirror-colorview-background",On=["comment","builtin"];function Sn(t,e){"setValue"==e.origin?(t.state.colorpicker.close_color_picker(),t.state.colorpicker.init_color_update(),t.state.colorpicker.style_color_update()):t.state.colorpicker.style_color_update(t.getCursor().line)}function En(t,e){t.state.colorpicker.isUpdate||(t.state.colorpicker.isUpdate=!0,t.state.colorpicker.close_color_picker(),t.state.colorpicker.init_color_update(),t.state.colorpicker.style_color_update())}function Tn(t,e){Sn(t,{origin:"setValue"})}function An(t,e){t.state.colorpicker.keyup(e)}function In(t,e){t.state.colorpicker.is_edit_mode()&&t.state.colorpicker.check_mousedown(e)}function Pn(t,e){Sn(t,{origin:"setValue"})}function Dn(t){t.state.colorpicker.close_color_picker()}function Bn(t){t.state.colorpicker.hide_delay_color_picker(t.state.colorpicker.opt.hideDelay||1e3)}var Rn=(B(Un,[{key:"init_event",value:function(){var e,r;this.cm.on("mousedown",In),this.cm.on("keyup",An),this.cm.on("change",Sn),this.cm.on("update",En),this.cm.on("refresh",Tn),this.cm.on("blur",Bn),this.onPasteCallback=(e=this.cm,r=Pn,function(t){r.call(this,e,t)}),this.onScrollEvent=function(r,n){var i=void 0;return function(t,e){i&&clearTimeout(i),i=setTimeout(function(){r(t,e)},n||300)}}(Dn,50),this.cm.getWrapperElement().addEventListener("paste",this.onPasteCallback),this.is_edit_mode()&&this.cm.on("scroll",this.onScrollEvent)}},{key:"is_edit_mode",value:function(){return"edit"==this.opt.mode}},{key:"is_view_mode",value:function(){return"view"==this.opt.mode}},{key:"destroy",value:function(){this.cm.off("mousedown",In),this.cm.off("keyup",An),this.cm.off("change",Sn),this.cm.off("blur",Bn),this.cm.getWrapperElement().removeEventListener("paste",this.onPasteCallback),this.is_edit_mode()&&this.cm.off("scroll",this.onScrollEvent)}},{key:"hasClass",value:function(t,e){return!!t.className&&-1<(" "+t.className+" ").indexOf(" "+e+" ")}},{key:"check_mousedown",value:function(t){this.hasClass(t.target,Mn)?this.open_color_picker(t.target.parentNode):this.close_color_picker()}},{key:"popup_color_picker",value:function(t){var e=this.cm.getCursor(),r=this,n={lineNo:e.line,ch:e.ch,color:t||"#FFFFFF",isShortCut:!0};Object.keys(this.markers).forEach(function(t){if(-1<("#"+t).indexOf("#"+n.lineNo+":")){var e=r.markers[t];e.ch<=n.ch&&n.ch<=e.ch+e.color.length&&(n.ch=e.ch,n.color=e.color,n.nameColor=e.nameColor)}}),this.open_color_picker(n)}},{key:"open_color_picker",value:function(t){var e=this,r=t.lineNo,n=t.ch,i=t.nameColor,o=t.color;if(this.colorpicker){var a=o,l=this.cm.charCoords({line:r,ch:n});this.colorpicker.show({left:l.left,top:l.bottom,isShortCut:t.isShortCut||!1,hideDelay:this.opt.hideDelay||2e3},i||o,function(t){e.cm.replaceRange(t,{line:r,ch:n},{line:r,ch:n+a.length},"*colorpicker"),e.cm.focus(),a=t})}}},{key:"close_color_picker",value:function(){this.colorpicker&&this.colorpicker.hide()}},{key:"hide_delay_color_picker",value:function(){this.colorpicker&&this.colorpicker.runHideDelay()}},{key:"key",value:function(t,e){return[t,e].join(":")}},{key:"keyup",value:function(t){this.colorpicker&&("Escape"==t.key?this.colorpicker.hide():0==this.colorpicker.isShortCut&&this.colorpicker.hide())}},{key:"init_color_update",value:function(){this.markers={}}},{key:"style_color_update",value:function(t){if(t)this.match(t);else for(var e=this.cm.lineCount(),r=0;rDefault Html Sample outputFormat: 'hex', hideDelay: 0, onHide: function (c) { - console.log('hide', c) + // console.log('hide', c) }, onChange : function (c) { console.log('change', c); + }, + onLastUpdate : function (c) { + console.log('last update', c); } }); /* diff --git a/package.json b/package.json index ad727da..6a87cef 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "codemirror-colorpicker", - "version": "1.9.52", + "version": "1.9.53", "description": "simple colorpicker used anywhere", "main": "./dist/codemirror-colorpicker.js", "scripts": { diff --git a/src/colorpicker/BaseBox.js b/src/colorpicker/BaseBox.js index e6d2460..4886b44 100644 --- a/src/colorpicker/BaseBox.js +++ b/src/colorpicker/BaseBox.js @@ -68,7 +68,7 @@ export default class BaseBox extends UIElement { this.refreshColorUI(e); } - onDragMove (e) { + onDragMove (e) { if (this.isDown) { this.refreshColorUI(e); } @@ -76,7 +76,11 @@ export default class BaseBox extends UIElement { /* called when mouse is ended move */ onDragEnd (e) { - this.isDown = false + if (this.isDown) { + this.$store.emit('lastUpdateColor'); + this.isDown = false + } + } diff --git a/src/colorpicker/BaseColorPicker.js b/src/colorpicker/BaseColorPicker.js index 7f07bca..6d42307 100644 --- a/src/colorpicker/BaseColorPicker.js +++ b/src/colorpicker/BaseColorPicker.js @@ -34,8 +34,13 @@ export default class BaseColorPicker extends UIElement { this.callbackColorValue() } + this.callbackLastUpdate = () => { + this.callbackLastUpdateColorValue() + } + this.colorpickerShowCallback = function () { }; - this.colorpickerHideCallback = function () { }; + this.colorpickerHideCallback = function () { }; + this.colorpickerLastUpdateCallback = function () { }; this.$body = new Dom(this.getContainer()); @@ -93,14 +98,15 @@ export default class BaseColorPicker extends UIElement { * @param {Function} showCallback it is called when colorpicker is shown * @param {Function} hideCallback it is called once when colorpicker is hidden */ - show(opt, color, showCallback, hideCallback) { + show(opt, color, showCallback, hideCallback, lastUpdateCallback) { // 매번 이벤트를 지우고 다시 생성할 필요가 없어서 초기화 코드는 지움. // this.destroy(); // this.initializeEvent(); // define colorpicker callback this.colorpickerShowCallback = showCallback; - this.colorpickerHideCallback = hideCallback; + this.colorpickerHideCallback = hideCallback; + this.colorpickerLastUpdateCallback = lastUpdateCallback; this.$root.css(this.getInitalizePosition()).show(); @@ -321,6 +327,19 @@ export default class BaseColorPicker extends UIElement { } } + callbackLastUpdateColorValue(color) { + color = color || this.getCurrentColor(); + + if (typeof this.opt.onLastUpdate == 'function') { + this.opt.onLastUpdate.call(this, color); + } + + if (typeof this.colorpickerLastUpdateCallback == 'function') { + this.colorpickerLastUpdateCallback(color); + } + } + + callbackHideColorValue(color) { color = color || this.getCurrentColor(); if (typeof this.opt.onHide == 'function') { @@ -356,6 +375,7 @@ export default class BaseColorPicker extends UIElement { super.initializeStoreEvent() this.$store.on('changeColor', this.callbackChange) + this.$store.on('lastUpdateColor', this.callbackLastUpdate) this.$store.on('changeFormat', this.callbackChange) } @@ -363,9 +383,11 @@ export default class BaseColorPicker extends UIElement { super.destroy(); this.$store.off('changeColor', this.callbackChange); + this.$store.off('lastUpdateColor', this.callbackLastUpdate) this.$store.off('changeFormat', this.callbackChange); this.callbackChange = undefined; + this.callbackLastUpdate = undefined; // remove color picker callback this.colorpickerShowCallback = undefined; diff --git a/src/colorpicker/ui/ColorInformation.js b/src/colorpicker/ui/ColorInformation.js index 36fed28..1b69a2f 100644 --- a/src/colorpicker/ui/ColorInformation.js +++ b/src/colorpicker/ui/ColorInformation.js @@ -95,18 +95,29 @@ export default class ColorInformation extends UIElement { this.format = next_format; this.$store.dispatch('/changeFormat', this.format); + this.$store.emit('lastUpdateColor') } getFormat () { return this.format || 'hex'; } + checkNumberKey(e) { - return Event.checkNumberKey(e); - } + var code = e.which, + isExcept = false; + + if(code == 37 || code == 39 || code == 8 || code == 46 || code == 9) + isExcept = true; + + if(!isExcept && (code < 48 || code > 57)) + return false; + + return true; + } checkNotNumberKey(e) { - return !Event.checkNumberKey(e); + return !this.checkNumberKey(e); } changeRgbColor () { @@ -118,6 +129,7 @@ export default class ColorInformation extends UIElement { a : this.refs.$rgb_a.float(), source }) + this.$store.emit('lastUpdateColor') } changeHslColor () { @@ -128,7 +140,8 @@ export default class ColorInformation extends UIElement { l : this.refs.$hsl_l.int(), a : this.refs.$hsl_a.float(), source - }) + }) + this.$store.emit('lastUpdateColor') } '@changeColor' (sourceType) { @@ -160,6 +173,7 @@ export default class ColorInformation extends UIElement { if(code.charAt(0) == '#' && code.length == 7) { this.$store.dispatch('/changeColor', code, source) + this.$store.emit('lastUpdateColor') } } diff --git a/src/colorpicker/ui/ColorPalette.js b/src/colorpicker/ui/ColorPalette.js index 412fe88..ec4f62d 100644 --- a/src/colorpicker/ui/ColorPalette.js +++ b/src/colorpicker/ui/ColorPalette.js @@ -91,7 +91,10 @@ export default class ColorPalette extends UIElement { '@initColor' () { this.refresh() } 'mouseup document' (e) { - this.isDown = false; + if (this.isDown) { + this.isDown = false; + this.$store.emit('lastUpdateColor'); + } } 'mousemove document' (e) { @@ -104,14 +107,13 @@ export default class ColorPalette extends UIElement { this.isDown = true; this.setMainColor(e); } - - mouseup (e) { - this.isDown = false; - } 'touchend document' (e) { - this.isDown = false; + if (this.isDown) { + this.isDown = false; + this.$store.emit('lastUpdateColor'); + } } 'touchmove document' (e) { @@ -124,10 +126,6 @@ export default class ColorPalette extends UIElement { e.preventDefault() this.isDown = true; this.setMainColor(e); - } - - touchend (e) { - this.isDown = false; - } + } } diff --git a/src/colorpicker/ui/ColorWheel.js b/src/colorpicker/ui/ColorWheel.js index 554f934..751fc2b 100644 --- a/src/colorpicker/ui/ColorWheel.js +++ b/src/colorpicker/ui/ColorWheel.js @@ -208,7 +208,10 @@ export default class ColorWheel extends UIElement { // Event Bindings 'mouseup document' (e) { - this.isDown = false ; + if (this.isDown) { + this.isDown = false ; + this.$store.emit('lastUpdateColor'); + } } 'mousemove document' (e) { @@ -228,7 +231,10 @@ export default class ColorWheel extends UIElement { } 'touchend document' (e) { - this.isDown = false ; + if (this.isDown) { + this.isDown = false ; + this.$store.emit('lastUpdateColor'); + } } 'touchmove document' (e) { diff --git a/src/colorpicker/ui/CurrentColorSets.js b/src/colorpicker/ui/CurrentColorSets.js index 7fdf83b..c2663db 100644 --- a/src/colorpicker/ui/CurrentColorSets.js +++ b/src/colorpicker/ui/CurrentColorSets.js @@ -75,6 +75,7 @@ export default class CurrentColorSets extends UIElement { 'click $colorSetsColorList .color-item' (e) { this.$store.dispatch('/changeColor', e.$delegateTarget.attr('data-color')); + this.$store.emit('lastUpdateColor') } }