@ew-color-picker/utils 2.0.0 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/packages/utils/src/enum.d.ts +1 -1
- package/dist/packages/utils/src/icon.d.ts +4 -4
- package/dist/packages/utils/src/index.d.ts +1 -0
- package/dist/packages/utils/src/prefix.d.ts +2 -0
- package/dist/utils.esm.js +29 -10
- package/dist/utils.min.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @ew-color-picker/utils
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
ew-color-picker 的公共工具库:DOM、颜色转换、动画、断言与 `EventEmitter`。
|
|
4
4
|
|
|
5
5
|
## 安装
|
|
6
6
|
|
|
@@ -19,7 +19,7 @@ emitter.on('change', (color) => console.log(color))
|
|
|
19
19
|
|
|
20
20
|
## 相关链接
|
|
21
21
|
|
|
22
|
-
- 文档:https://eveningwater.github.io/ew-color-picker/guide/concepts
|
|
22
|
+
- 文档:https://eveningwater.github.io/ew-color-picker/zh/guide/concepts
|
|
23
23
|
- 源码仓库:https://github.com/eveningwater/ew-color-picker
|
|
24
24
|
|
|
25
25
|
## License
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const closeIcon: (className?: string, size?: number) => string;
|
|
2
|
-
export declare const arrowIcon: (className?: string, size?: number) => string;
|
|
3
|
-
export declare const upArrowIcon: (className?: string, size?: number) => string;
|
|
4
|
-
export declare const downArrowIcon: (className?: string, size?: number) => string;
|
|
1
|
+
export declare const closeIcon: (className?: string, size?: number, prefix?: string) => string;
|
|
2
|
+
export declare const arrowIcon: (className?: string, size?: number, prefix?: string) => string;
|
|
3
|
+
export declare const upArrowIcon: (className?: string, size?: number, prefix?: string) => string;
|
|
4
|
+
export declare const downArrowIcon: (className?: string, size?: number, prefix?: string) => string;
|
|
@@ -8,6 +8,7 @@ export * from "./event";
|
|
|
8
8
|
export * from "./color";
|
|
9
9
|
export * from "./animation";
|
|
10
10
|
export * from "./icon";
|
|
11
|
+
export * from "./prefix";
|
|
11
12
|
export * from "./consolePlugin";
|
|
12
13
|
export { default as Console } from "./consolePlugin";
|
|
13
14
|
export declare function toStyleStr(style?: string | Record<string, string>): string;
|
package/dist/utils.esm.js
CHANGED
|
@@ -550,6 +550,12 @@ var off = function (el, type, fn, capture) {
|
|
|
550
550
|
});
|
|
551
551
|
};
|
|
552
552
|
|
|
553
|
+
var ApplyOrder;
|
|
554
|
+
(function (ApplyOrder) {
|
|
555
|
+
ApplyOrder["Pre"] = "pre";
|
|
556
|
+
ApplyOrder["Post"] = "post";
|
|
557
|
+
})(ApplyOrder || (ApplyOrder = {}));
|
|
558
|
+
|
|
553
559
|
var EventEmitter = /** @class */ (function () {
|
|
554
560
|
function EventEmitter(names) {
|
|
555
561
|
this.events = {};
|
|
@@ -1529,25 +1535,38 @@ function throttle(func, limit) {
|
|
|
1529
1535
|
};
|
|
1530
1536
|
}
|
|
1531
1537
|
|
|
1532
|
-
|
|
1538
|
+
// 默认类名前缀
|
|
1539
|
+
var DEFAULT_PREFIX = "ew-";
|
|
1540
|
+
// 读取实例配置中的前缀,缺省回退默认前缀
|
|
1541
|
+
var getPrefix = function (instance) {
|
|
1542
|
+
var _a;
|
|
1543
|
+
var prefix = (_a = instance === null || instance === void 0 ? void 0 : instance.options) === null || _a === void 0 ? void 0 : _a.prefix;
|
|
1544
|
+
return typeof prefix === "string" ? prefix : DEFAULT_PREFIX;
|
|
1545
|
+
};
|
|
1546
|
+
|
|
1547
|
+
var closeIcon = function (className, size, prefix) {
|
|
1548
|
+
if (prefix === void 0) { prefix = DEFAULT_PREFIX; }
|
|
1533
1549
|
var sizeAttr = size && size > 0 ? " width=\"".concat(size, "\" height=\"").concat(size, "\"") : "";
|
|
1534
|
-
return "<svg t=\"1690189203554\" class=\"
|
|
1550
|
+
return "<svg t=\"1690189203554\" class=\"".concat(prefix, "color-picker-icon").concat(handleClassName(className), "\" viewBox=\"0 0 1024 1024\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" p-id=\"2272\" fill=\"currentColor\"").concat(sizeAttr, "><path d=\"M504.224 470.288l207.84-207.84a16 16 0 0 1 22.608 0l11.328 11.328a16 16 0 0 1 0 22.624l-207.84 207.824 207.84 207.84a16 16 0 0 1 0 22.608l-11.328 11.328a16 16 0 0 1-22.624 0l-207.824-207.84-207.84 207.84a16 16 0 0 1-22.608 0l-11.328-11.328a16 16 0 0 1 0-22.624l207.84-207.824-207.84-207.84a16 16 0 0 1 0-22.608l11.328-11.328a16 16 0 0 1 22.624 0l207.824 207.84z\" p-id=\"2273\"></path></svg>");
|
|
1535
1551
|
};
|
|
1536
|
-
var arrowIcon = function (className, size) {
|
|
1552
|
+
var arrowIcon = function (className, size, prefix) {
|
|
1553
|
+
if (prefix === void 0) { prefix = DEFAULT_PREFIX; }
|
|
1537
1554
|
var sizeAttr = size && size > 0 ? " width=\"".concat(size, "\" height=\"").concat(size, "\"") : "";
|
|
1538
|
-
return "<svg t=\"1717384498630\" class=\"
|
|
1555
|
+
return "<svg t=\"1717384498630\" class=\"".concat(prefix, "color-picker-icon").concat(handleClassName(className), "\" viewBox=\"0 0 1024 1024\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" p-id=\"4234\"").concat(sizeAttr, "><path d=\"M512 714.666667c-8.533333 0-17.066667-2.133333-23.466667-8.533334l-341.333333-341.333333c-12.8-12.8-12.8-32 0-44.8 12.8-12.8 32-12.8 44.8 0l320 317.866667 317.866667-320c12.8-12.8 32-12.8 44.8 0 12.8 12.8 12.8 32 0 44.8L533.333333 704c-4.266667 8.533333-12.8 10.666667-21.333333 10.666667z\" fill=\"currentColor\" p-id=\"4235\"></path></svg>");
|
|
1539
1556
|
};
|
|
1540
|
-
var upArrowIcon = function (className, size) {
|
|
1557
|
+
var upArrowIcon = function (className, size, prefix) {
|
|
1558
|
+
if (prefix === void 0) { prefix = DEFAULT_PREFIX; }
|
|
1541
1559
|
var sizeAttr = size && size > 0 ? " width=\"".concat(size, "\" height=\"").concat(size, "\"") : "";
|
|
1542
|
-
return "<svg t=\"1717384498631\" class=\"
|
|
1560
|
+
return "<svg t=\"1717384498631\" class=\"".concat(prefix, "color-picker-icon").concat(handleClassName(className), "\" viewBox=\"0 0 1024 1024\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" p-id=\"4235\"").concat(sizeAttr, "><path d=\"M512 309.333333c8.533333 0 17.066667 2.133333 23.466667 8.533334l341.333333 341.333333c12.8 12.8 12.8 32 0 44.8-12.8 12.8-32 12.8-44.8 0L533.333333 374.4 215.466667 692.266667c-12.8 12.8-32 12.8-44.8 0-12.8-12.8-12.8-32 0-44.8L488.533333 317.866667c4.266667-8.533333 12.8-10.666667 21.333334-10.666667z\" fill=\"#666666\" p-id=\"4236\"></path></svg>");
|
|
1543
1561
|
};
|
|
1544
|
-
var downArrowIcon = function (className, size) {
|
|
1562
|
+
var downArrowIcon = function (className, size, prefix) {
|
|
1563
|
+
if (prefix === void 0) { prefix = DEFAULT_PREFIX; }
|
|
1545
1564
|
var sizeAttr = size && size > 0 ? " width=\"".concat(size, "\" height=\"").concat(size, "\"") : "";
|
|
1546
|
-
return "<svg t=\"1717384498632\" class=\"
|
|
1565
|
+
return "<svg t=\"1717384498632\" class=\"".concat(prefix, "color-picker-icon").concat(handleClassName(className), "\" viewBox=\"0 0 1024 1024\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" p-id=\"4236\"").concat(sizeAttr, "><path d=\"M512 714.666667c-8.533333 0-17.066667-2.133333-23.466667-8.533334l-341.333333-341.333333c-12.8-12.8-12.8-32 0-44.8 12.8-12.8 32-12.8 44.8 0l320 317.866667 317.866667-320c12.8-12.8 32-12.8 44.8 0 12.8 12.8 12.8 32 0 44.8L533.333333 704c-4.266667 8.533333-12.8 10.666667-21.333333 10.666667z\" fill=\"#666666\" p-id=\"4237\"></path></svg>");
|
|
1547
1566
|
};
|
|
1548
1567
|
|
|
1549
1568
|
var tips = [
|
|
1550
|
-
"%c ew-color-picker@2.0.
|
|
1569
|
+
"%c ew-color-picker@2.0.2%c \u8054\u7CFBQQ\uFF1A854806732 %c \u8054\u7CFB\u5FAE\u4FE1\uFF1Aeveningwater %c github:https://github.com/eveningwater/ew-color-picker %c ",
|
|
1551
1570
|
"background:#0ca6dc ; padding: 1px; border-radius: 3px 0 0 3px; color: #fff",
|
|
1552
1571
|
"background:#ff7878 ; padding: 1px; border-radius: 0 3px 3px 0; color: #fff",
|
|
1553
1572
|
"background:#ff7878 ; padding: 1px; border-radius: 3px 0 0 3px; color: #fff",
|
|
@@ -1604,4 +1623,4 @@ function toStyleStr(style) {
|
|
|
1604
1623
|
.join(';');
|
|
1605
1624
|
}
|
|
1606
1625
|
|
|
1607
|
-
export { $, $$, Animation, ewColorPickerConsolePlugin as Console, EventEmitter, EventRegister, JSONClone, addClass, ani, arrowIcon, assert, baseSetStyle, basicDataTypeList, calculatePanelPosition, camelCase, checkContainer, clearColorCache, clone, cloneColor, close, closeIcon, colorHexToRgba, colorHslaToRgba, colorHsvaToRgba, colorRegExp, colorRegHSL, colorRegHSLA, colorRegRGB, colorRegRGBA, colorRgbaToHex, colorRgbaToHsla, colorRgbaToHsva, colorRgbaToHsvaWithCache, colorToRgba, create, createByTemplate, debounce, downArrowIcon, error, extend, getAnimationType, getAttr, getColorBrightness, getElementSize, getOffset, getRect, getStyle, handleClassName, hasClass, insertNode, isAlphaColor, isArray, isBoolean, isBrowser, isDarkColor, isDeepArray, isDeepObject, isDom, isFunction, isHTMLElement, isMobile, isNotEmptyObject, isNull, isNumber, isObject, isPromise, isRegExp, isShallowObject, isStrictColorFormat, isString, isUndefined, isValidColor, log, objDataTypeList, off, on, open, parseRgbaString, removeAllSpace, removeClass, removeElement, removeNode, removeStyle, rgbToHsl, rgbaToHex, setAttr, setStyle, supportsPassive, throttle, throwError, tips, toArray, toStyleStr, tryErrorHandler, ua, upArrowIcon, warn };
|
|
1626
|
+
export { $, $$, Animation, ApplyOrder, ewColorPickerConsolePlugin as Console, DEFAULT_PREFIX, EventEmitter, EventRegister, JSONClone, addClass, ani, arrowIcon, assert, baseSetStyle, basicDataTypeList, calculatePanelPosition, camelCase, checkContainer, clearColorCache, clone, cloneColor, close, closeIcon, colorHexToRgba, colorHslaToRgba, colorHsvaToRgba, colorRegExp, colorRegHSL, colorRegHSLA, colorRegRGB, colorRegRGBA, colorRgbaToHex, colorRgbaToHsla, colorRgbaToHsva, colorRgbaToHsvaWithCache, colorToRgba, create, createByTemplate, debounce, downArrowIcon, error, extend, getAnimationType, getAttr, getColorBrightness, getElementSize, getOffset, getPrefix, getRect, getStyle, handleClassName, hasClass, insertNode, isAlphaColor, isArray, isBoolean, isBrowser, isDarkColor, isDeepArray, isDeepObject, isDom, isFunction, isHTMLElement, isMobile, isNotEmptyObject, isNull, isNumber, isObject, isPromise, isRegExp, isShallowObject, isStrictColorFormat, isString, isUndefined, isValidColor, log, objDataTypeList, off, on, open, parseRgbaString, removeAllSpace, removeClass, removeElement, removeNode, removeStyle, rgbToHsl, rgbaToHex, setAttr, setStyle, supportsPassive, throttle, throwError, tips, toArray, toStyleStr, tryErrorHandler, ua, upArrowIcon, warn };
|
package/dist/utils.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
((t,e)=>{"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).Utils={})})(this,function(o){var n=function(){return(n=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};function c(t,e,n){if(n||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||((r=r||Array.prototype.slice.call(e,0,o))[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))}function t(){}var e={log:t,warn:t,error:t},r=(["warn","error","log"].forEach(function(t){e[t]=function(){}}),e.warn),i=e.error,a=e.log,s="undefined"!=typeof window,l=s&&navigator.userAgent.toLowerCase(),I=l&&l.match(/(iPhone|iPod|Android|ios)/i);if(o.supportsPassive=!1,s)try{var u={};Object.defineProperty(u,"passive",{get:function(){o.supportsPassive=!0}}),window.addEventListener("test-passive",function(){},u)}catch(i){}function f(t){return void 0===t}function p(t){return"string"==typeof t}function h(t){return"number"==typeof t}function d(t){return"object"==typeof t&&!O(t)}function g(t){return"object"===x.call(t).slice(8,-1).toLowerCase()}function v(t){return"array"===x.call(t).slice(8,-1).toLowerCase()}function N(t,e){try{t()}catch(t){A(e)?e(t):i("[ewColorPicker error]: ".concat(t))}}function B(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(O(t))return{};if(Object.assign)return Object.assign.apply(Object,c([t],e,!1));for(var r=Object(t),o=0,i=e.length;o<i;o++){var a=e[o];if(a)for(var s in a)G.call(a,s)&&(r[s]=a[s])}return r}function D(t){if(!d(t))return t;var e,n=v(t)?[]:{};for(e in t)t.hasOwnProperty(e)&&(n[e]=d(t[e])?D(t[e]):t[e]);return n}function m(t){return t.replace(/\s+/g,"")}function y(t){return t?" ".concat(t):""}function F(t){return document.createElement(t)}function b(t,e){return new RegExp("(^|\\s)"+e+"(\\s|$)").test(t.className)}function w(t){return t instanceof HTMLElement}function M(t,e,n){e=e.startsWith("--")?e:e.replace(/([A-Z])/g,"-$1").toLowerCase(),t.style.setProperty(e,n)}function C(n,t,e){if(p(t=void 0===t?{}:t)&&!f(e)){e=h(e)?"".concat(e,"px"):e;M(n,t,e)}else if(Array.isArray(t))t.forEach(function(t){var e=t.prop;M(n,e,t.value)});else for(var r=0,o=Object.entries(t);r<o.length;r++){var i=o[r],a=i[0];M(n,a,i[1])}}function W(t){return t.replace(/([\:\_\-]+(.))/g,function(t,e,n,r){return r?n.toUpperCase():n}).replace(/^moz([A-Z])/,"Moz$1")}function k(e,n,r){if(!e||!n)return null;"float"===(n=W(n))&&(n="cssFloat");var o=null;return N(function(){var t=(document.defaultView||window).getComputedStyle(e,r);o=e.style[n]||t?t[n]:null}),o||e.style[n]}function z(t,e){return(e=void 0===e?document:e).querySelector(t)}function U(t){var e;null!=t&&t.parentElement?null!=(e=null==t?void 0:t.parentElement)&&e.removeChild(t):null!=t&&t.remove()}var x=Object.prototype.toString,q=Array.prototype.slice,G=Object.prototype.hasOwnProperty,O=function(t){return null===t},A=function(t){return"function"==typeof t},u=U;function T(t){return t.getBoundingClientRect()}function J(t,e,n,r){r=o.supportsPassive?{passive:!1,capture:!!r}:!!r,t.addEventListener(e,n,r)}function Z(t,e,n,r){t.removeEventListener(e,n,{capture:!!r})}E.prototype.on=function(t,e,n){return void 0===n&&(n=this),this.hasType(t),this.events[t]||(this.events[t]=[]),this.events[t].push([e,n]),this},E.prototype.once=function(r,o,i){var a=this,s=(void 0===i&&(i=this),this.hasType(r),function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];a.off(r,s);var n=o.apply(i,t);if(!0===n)return n});return s.fn=o,this.on(r,s),this},E.prototype.off=function(t,e){if(!t&&!e)return this.events={},this;if(t){if(this.hasType(t),e){var n=this.events[t];if(n)for(var r=n.length;r--;)(n[r][0]===e||n[r][0]&&n[r][0].fn===e)&&n.splice(r,1)}else this.events[t]=[];return this}},E.prototype.trigger=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];this.hasType(t);t=this.events[t];if(t)for(var r=t.length,o=c([],t,!0),i=0;i<r;i++){var a=o[i],s=a[0],a=a[1];if(s&&!0===(s=s.apply(a,e)))return s}},E.prototype.registerType=function(t){var e=this;t.forEach(function(t){e.eventTypes[t]=t})},E.prototype.destroy=function(){this.events={},this.eventTypes={}},E.prototype.hasType=function(t){var e=this.eventTypes;e[t]!==t&&r('[ewColorPicker warning]: EventEmitter has used unknown event type: "'.concat(t,'", should be oneof [')+"".concat(Object.keys(e).map(function(t){return JSON.stringify(t)}))+"]")};var Q=E;function E(t){this.events={},this.eventTypes={},this.registerType(t)}P.prototype.destroy=function(){this.removeDOMEvents(),this.events=[]},P.prototype.addDOMEvents=function(){this.handleDOMEvents(J)},P.prototype.removeDOMEvents=function(){this.handleDOMEvents(Z)},P.prototype.handleDOMEvents=function(e){var n=this,r=this.wrapper;this.events.forEach(function(t){e(r,t.name,n,!!t.capture)})},P.prototype.handleEvent=function(e){var n=e.type;this.events.some(function(t){return t.name===n&&(t.handler(e),!0)})};var V=P;function P(t,e){this.wrapper=t,this.events=e,this.addDOMEvents()}var H=/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/,X=/[rR][gG][Bb][Aa]?[\(]([\s]*(2[0-4][0-9]|25[0-5]|[01]?[0-9][0-9]?),){2}[\s]*(2[0-4][0-9]|25[0-5]|[01]?[0-9][0-9]?),?[\s]*(0\.\d{1,2}|1|0)?[\)]{1}/g,_=/^[rR][gG][Bb][Aa][\(]([\\s]*(2[0-4][0-9]|25[0-5]|[01]?[0-9][0-9]?)[\\s]*,){3}[\\s]*(1|1.0|0|0?.[0-9]{1,2})[\\s]*[\)]{1}$/,K=/^[hH][Ss][Ll][\(]([\\s]*(2[0-9][0-9]|360|3[0-5][0-9]|[01]?[0-9][0-9]?)[\\s]*,)([\\s]*((100|[0-9][0-9]?)%|0)[\\s]*,)([\\s]*((100|[0-9][0-9]?)%|0)[\\s]*)[\)]$/,Y=/^[hH][Ss][Ll][Aa][\(]([\\s]*(2[0-9][0-9]|360|3[0-5][0-9]|[01]?[0-9][0-9]?)[\\s]*,)([\\s]*((100|[0-9][0-9]?)%|0)[\\s]*,){2}([\\s]*(1|1.0|0|0?.[0-9]{1,2})[\\s]*)[\)]$/;function tt(t,e){var e=(e=void 0===e?1:e)||1,e=Math.round(10*e)/10,n=t.toLowerCase(),r=t.length,o=[];if(t&&H.test(n)){if(4===r){for(var i="#",a=1;a<r;a++){var s=n.slice(a,a+1);i+=s.concat(s)}n=i}for(var c=1,l=n.length;c<l;c+=2)o.push(parseInt("0X"+n.slice(c,c+2),16));return"rgba(".concat(o.join(", "),", ").concat(e,")")}return m(n)}function et(t){var e,n,r,o,i,a,s,c;return t&&"string"==typeof t&&(t=t.replace(/\s+/g," ").trim().match(/rgba?\(([^)]+)\)/i))?(t=t[1].split(",").map(function(t){return t.trim()}),e=parseFloat(t[0])||0,n=parseFloat(t[1])||0,r=parseFloat(t[2])||0,t=4<=t.length&&parseFloat(t[3])||1,e=e/255,n=n/255,r=r/255,o=(c=Math.max(e,n,r))-Math.min(e,n,r),(a=i=0)!==(s=c)&&(a=o/c),0!=o?(c===e?i=(n-r)/o*60:c===n?i=60*((r-e)/o+2):c===r&&(i=60*((e-n)/o+4)),i<0&&(i+=360)):i=0,c=Math.round(10*t)/10,{h:Math.round(i),s:Math.round(100*a),v:Math.round(100*s),a:c}):{h:0,s:100,v:100,a:1}}var nt={black:"rgba(0, 0, 0, 1)",silver:"rgba(192, 192, 192, 1)",gray:"rgba(128, 128, 128, 1)",white:"rgba(255, 255, 255, 1)",maroon:"rgba(128, 0, 0, 1)",red:"rgba(255, 0, 0, 1)",purple:"rgba(128, 0, 128, 1)",fuchsia:"rgba(255, 0, 255, 1)",green:"rgba(0, 128, 0, 1)",lime:"rgba(0, 255, 0, 1)",olive:"rgba(128, 128, 0, 1)",yellow:"rgba(255, 255, 0, 1)",navy:"rgba(0, 0, 128, 1)",blue:"rgba(0, 0, 255, 1)",teal:"rgba(0, 128, 128, 1)",aqua:"rgba(0, 255, 255, 1)",orange:"rgba(255, 165, 0, 1)",pink:"rgba(255, 192, 203, 1)",brown:"rgba(165, 42, 42, 1)"};function rt(t){if(t&&"string"==typeof t){var e=t.trim().toLowerCase();if(nt[e])return nt[e];if(H.test(e))return tt(e).replace(/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+(?:\.\d+)?)\s*\)/,"rgba($1, $2, $3, $4)");var n=e.match(/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i);if(n)return r=n[1],o=n[2],i=n[3],"rgba(".concat(r,", ").concat(o,", ").concat(i,", 1)");var r,o,i,n=e.match(/^rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(0|1|0?\.\d+)\s*\)$/i);if(n)return r=n[1],o=n[2],i=n[3],e=n[4],"rgba(".concat(r,", ").concat(o,", ").concat(i,", ").concat(e,")");try{var a=F("div"),s=(C(a,{"background-color":t}),k(a,"backgroundColor"));if(s&&"rgba(0, 0, 0, 0)"!==s)return s.replace(/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+(?:\.\d+)?)\s*\)/,"rgba($1, $2, $3, $4)")}catch(t){}}return""}function ot(t){t=rt(t),t=t.slice(t.indexOf("(")+1,t.lastIndexOf(")")).split(",");return(299*parseInt(t[0])+587*parseInt(t[1])+114*parseInt(t[2]))/1e3}var S=new Map;j.prototype.show=function(){var e=this;return new Promise(function(t){C(e.element,{display:"block"}),t()})},j.prototype.hide=function(){var e=this;return new Promise(function(t){C(e.element,{display:"none"}),t()})},j.prototype.slideDown=function(){var o=this;return new Promise(function(t){C(o.element,{display:"block",visibility:"hidden"});var e=k(o.element,"marginTop"),n=k(o.element,"marginBottom"),r=o.element.offsetHeight+parseInt(e)+parseInt(n);C(o.element,{height:"0px",overflow:"hidden",visibility:"visible"}),o.element.offsetHeight,setTimeout(function(){C(o.element,{transition:"height ".concat(o.options.duration,"ms ").concat(o.options.easing),height:"".concat(r,"px")}),setTimeout(function(){C(o.element,{height:"",overflow:"",transition:""}),t()},o.options.duration)},o.options.delay)})},j.prototype.slideUp=function(){var r=this;return new Promise(function(t){var e=k(r.element,"marginTop"),n=k(r.element,"marginBottom"),e=r.element.offsetHeight+parseInt(e)+parseInt(n);C(r.element,{height:"".concat(e,"px"),overflow:"hidden"}),r.element.offsetHeight,setTimeout(function(){C(r.element,{height:"0px",transition:"height ".concat(r.options.duration,"ms ").concat(r.options.easing)}),setTimeout(function(){C(r.element,{height:"",overflow:"",transition:"",display:"none"}),t()},r.options.duration)},r.options.delay)})},j.prototype.fadeIn=function(){var t=this;return new Promise(function(n){function r(t){var t=Math.min((t-a)/i,1),e=1-Math.pow(1-t,3);C(o,{opacity:e.toString()}),t<1?requestAnimationFrame(r):(C(o,{opacity:"1"}),n())}var o=t.element,i=t.options.duration,a=(C(o,{display:"block",opacity:"0"}),o.offsetHeight,performance.now());requestAnimationFrame(r)})},j.prototype.fadeOut=function(){var t=this;return new Promise(function(n){function r(t){var t=Math.min((t-a)/i,1),e=Math.pow(t,3);C(o,{opacity:(1-e).toString()}),t<1?requestAnimationFrame(r):(C(o,{display:"none",opacity:"0"}),n())}var o=t.element,i=t.options.duration,a=(C(o,{display:"block",opacity:"1"}),o.offsetHeight,performance.now());requestAnimationFrame(r)})};var $=j;function j(t,e){void 0===e&&(e={}),this.element=t,this.options=n({duration:300,easing:"ease-out",delay:0},e)}var L={show:function(t,e){return new $(t,{duration:e=void 0===e?300:e}).show()},hide:function(t,e){return new $(t,{duration:e=void 0===e?300:e}).hide()},slideDown:function(t,e){return new $(t,{duration:e=void 0===e?300:e}).slideDown()},slideUp:function(t,e){return new $(t,{duration:e=void 0===e?300:e}).slideUp()},fadeIn:function(t,e){return new $(t,{duration:e=void 0===e?300:e}).fadeIn()},fadeOut:function(t,e){return new $(t,{duration:e=void 0===e?300:e}).fadeOut()}};var it=["%c ew-color-picker@2.0.0%c 联系QQ:854806732 %c 联系微信:eveningwater %c github:https://github.com/eveningwater/ew-color-picker %c ","background:#0ca6dc ; padding: 1px; border-radius: 3px 0 0 3px; color: #fff","background:#ff7878 ; padding: 1px; border-radius: 0 3px 3px 0; color: #fff","background:#ff7878 ; padding: 1px; border-radius: 3px 0 0 3px; color: #fff","background:#ff7878 ; padding: 1px; border-radius: 0 3px 3px 0; color: #fff","background:transparent"],at=!1,st=(R.prototype.handleOptions=function(){this.ewColorPicker&&this.ewColorPicker.options&&(this.options=B(this.options,this.ewColorPicker.options))},R.prototype.run=function(){at||(at=!0,a.apply(void 0,it))},R.prototype.install=function(t){this.ewColorPicker=t,this.handleOptions(),t.on&&A(t.on)&&t.on("change",function(t){}),null!=(t=this.run)&&t.call(this)},R.pluginName="ewColorPickerConsole",R);function R(t){this.ewColorPicker=t,this.options={},this.handleOptions(),this.run()}o.$=z,o.$$=function(t,e){return(e=void 0===e?document:e).querySelectorAll(t)},o.Animation=$,o.Console=st,o.EventEmitter=Q,o.EventRegister=V,o.JSONClone=function(t){return JSON.parse(JSON.stringify(t))},o.addClass=function(t,e){for(var n=0,r=e.trim().split(/\s+/);n<r.length;n++){var o,i=r[n];i&&!b(t,i)&&((o=t.className.split(" ").filter(Boolean)).push(i),t.className=o.join(" "))}},o.ani=L,o.arrowIcon=function(t,e){e=e&&0<e?' width="'.concat(e,'" height="').concat(e,'"'):"";return'<svg t="1717384498630" class="ew-color-picker-icon'.concat(y(t),'" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4234"').concat(e,'><path d="M512 714.666667c-8.533333 0-17.066667-2.133333-23.466667-8.533334l-341.333333-341.333333c-12.8-12.8-12.8-32 0-44.8 12.8-12.8 32-12.8 44.8 0l320 317.866667 317.866667-320c12.8-12.8 32-12.8 44.8 0 12.8 12.8 12.8 32 0 44.8L533.333333 704c-4.266667 8.533333-12.8 10.666667-21.333333 10.666667z" fill="currentColor" p-id="4235"></path></svg>')},o.assert=function(t,e){if(!t)throw new Error(e||"Assertion failed")},o.baseSetStyle=M,o.basicDataTypeList=["Number","String","Function","Undefined","Boolean"],o.calculatePanelPosition=function(t,e,n,r){void 0===n&&(n="bottom"),void 0===r&&(r=8);var o=T(t),i=T(e),t=window.innerWidth,e=window.innerHeight,a=0,s=0,n=n.split("-"),c=n[0],l=n[1];switch(c){case"top":s=o.top-i.height-r,a="start"===l?o.left:"end"===l?o.right-i.width:o.left+(o.width-i.width)/2;break;case"bottom":s=o.bottom+r,a="start"===l?o.left:"end"===l?o.right-i.width:o.left+(o.width-i.width)/2;break;case"left":a=o.left-i.width-r,s="start"===l?o.top:"end"===l?o.bottom-i.height:o.top+(o.height-i.height)/2;break;case"right":a=o.right+r,s="start"===l?o.top:"end"===l?o.bottom-i.height:o.top+(o.height-i.height)/2}return s<0&&(s=r),{left:a=(a=a<0?r:a)+i.width>t?t-i.width-r:a,top:s=s+i.height>e?e-i.height-r:s}},o.camelCase=W,o.checkContainer=function(t){return p(t)?z(t)||(r("[ewColorPicker warning]: Cannot find element with selector: ".concat(t)),document.body):w(t)?t:document.body},o.clearColorCache=function(){},o.clone=D,o.cloneColor=function(t){return n({},t)},o.close=function(t,e,n){n=1e4<(n=void 0===n?300:n)?1e4:n;var r="";switch(t){case"height":r="slideUp";break;case"opacity":r="fadeOut";break;default:r="hide"}return L[r](e,n)},o.closeIcon=function(t,e){e=e&&0<e?' width="'.concat(e,'" height="').concat(e,'"'):"";return'<svg t="1690189203554" class="ew-color-picker-icon'.concat(y(t),'" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2272" fill="currentColor"').concat(e,'><path d="M504.224 470.288l207.84-207.84a16 16 0 0 1 22.608 0l11.328 11.328a16 16 0 0 1 0 22.624l-207.84 207.824 207.84 207.84a16 16 0 0 1 0 22.608l-11.328 11.328a16 16 0 0 1-22.624 0l-207.824-207.84-207.84 207.84a16 16 0 0 1-22.608 0l-11.328-11.328a16 16 0 0 1 0-22.624l207.84-207.824-207.84-207.84a16 16 0 0 1 0-22.608l11.328-11.328a16 16 0 0 1 22.624 0l207.824 207.84z" p-id="2273"></path></svg>')},o.colorHexToRgba=tt,o.colorHslaToRgba=function(t){var e,n,r,o,i=t.h,a=t.s/100,s=t.l/100,t=t.a;return 0==a?n=r=o=s:(n=(e=function(t,e,n){return 1<n&&(n-=1),n<0&&(n+=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+6*(e-t)*(2/3-n):t})(a=2*s-(s=.5<=s?s+a-s*a:s*(1+a)),s,(i=i/360)+1/3),r=e(a,s,i),o=e(a,s,i-1/3)),t=Math.round(10*t)/10,"rgba(".concat(Math.round(255*n),", ").concat(Math.round(255*r),", ").concat(Math.round(255*o),", ").concat(t,")")},o.colorHsvaToRgba=function(t,e){var n,r,o,i,a=t.a,s=t.h,c=255*t.s/100,t=255*t.v/100;return 0==c?n=r=o=t:(t=s%60*((i=t)-(c=(255-c)*t/255))/60,360===s?(n=i,r=o=0):s<60?(n=i,r=c+t,o=c):s<120?(n=i-t,r=i,o=c):s<180?(r=i,o=(n=c)+t):s<240?(n=c,r=i-t,o=i):s<300?(n=c+t,r=c,o=i):s<360?(r=c,o=(n=i)-t):n=r=o=0),void 0!==e&&0<=e&&e<=1&&(a=e),a=Math.round(10*a)/10,"rgba(".concat(Math.round(n),", ").concat(Math.round(r),", ").concat(Math.round(o),", ").concat(a,")")},o.colorRegExp=H,o.colorRegHSL=K,o.colorRegHSLA=Y,o.colorRegRGB=X,o.colorRegRGBA=_,o.colorRgbaToHex=function(t){var e,n,r={10:"A",11:"B",12:"C",13:"D",14:"E",15:"F"};return/rgba?/.test(t)?(e=t.replace(/rgba?\(/,"").replace(/\)/,"").replace(/[\s+]/g,"").split(","),n="",e.map(function(t,e){e<=2&&(n+=(e=+t,e=Math.min(Math.round(e),255),t=Math.floor(e/16),""+(r[t]||t)+(r[e%=16]||e)))}),m("#"+n)):t},o.colorRgbaToHsla=function(t){var e,n=(t=t.slice(t.indexOf("(")+1,t.lastIndexOf(")")).split(",")).length<4?1:Number(t[3]),n=Math.round(10*n)/10,r=parseInt(t[0])/255,o=parseInt(t[1])/255,i=parseInt(t[2])/255,t=Math.max(r,o,i),a=Math.min(r,o,i),s=(t+a)/2;if(t===a)e=l=0;else{var c=t-a,l=.5<s?c/(2-t-a):c/(t+a);switch(t){case r:e=(o-i)/c+(i<=o?0:6);break;case o:e=(i-r)/c+2;break;case i:e=(r-o)/c+4}}return{colorStr:m("hsla("+Math.ceil(60*e)+","+Math.ceil(100*l)+"%,"+Math.ceil(100*s)+"%,"+n+")"),colorObj:{h:Math.round(e),s:Math.round(100*l),l:Math.round(100*s),a:n}}},o.colorRgbaToHsva=et,o.colorRgbaToHsvaWithCache=function(t){var e;return S.has(t)?S.get(t):(e=et(t),S.set(t,e),1e3<S.size&&(t=S.keys().next().value)&&S.delete(t),e)},o.colorToRgba=rt,o.create=F,o.createByTemplate=function(t){return document.createRange().createContextualFragment(t)},o.debounce=function(r,o,i){void 0===i&&(i=!1);var a=null;return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=i&&!a;a&&clearTimeout(a),a=setTimeout(function(){a=null,i||r.apply(void 0,t)},o),n&&r.apply(void 0,t)}},o.downArrowIcon=function(t,e){e=e&&0<e?' width="'.concat(e,'" height="').concat(e,'"'):"";return'<svg t="1717384498632" class="ew-color-picker-icon'.concat(y(t),'" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4236"').concat(e,'><path d="M512 714.666667c-8.533333 0-17.066667-2.133333-23.466667-8.533334l-341.333333-341.333333c-12.8-12.8-12.8-32 0-44.8 12.8-12.8 32-12.8 44.8 0l320 317.866667 317.866667-320c12.8-12.8 32-12.8 44.8 0 12.8 12.8 12.8 32 0 44.8L533.333333 704c-4.266667 8.533333-12.8 10.666667-21.333333 10.666667z" fill="#666666" p-id="4237"></path></svg>')},o.error=i,o.extend=B,o.getAnimationType=function(t){return(null==(t=t.options)?void 0:t.togglePickerAnimation)||"default"},o.getAttr=function(t,e){return t.getAttribute(e)},o.getColorBrightness=ot,o.getElementSize=function(t){return{clientWidth:t.clientWidth,clientHeight:t.clientHeight,offsetWidth:t.offsetWidth,offsetHeight:t.offsetHeight,scrollWidth:t.scrollWidth,scrollHeight:t.scrollHeight}},o.getOffset=function(t){for(var e=0,n=0;t;)e-=t.offsetLeft,n-=t.offsetTop,t=t.offsetParent;return{left:e,top:n}},o.getRect=T,o.getStyle=k,o.handleClassName=y,o.hasClass=b,o.insertNode=function(t,e,n,r){r&&null!=t&&t.contains(r)?t.insertBefore(e,r):n&&null!=t&&t.contains(n)?t.replaceChild(e,n):null!=t&&t.appendChild(e)},o.isAlphaColor=function(t){return!!/^rgba\s*\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*,\s*(0|1|0?\.\d+)\s*\)$/i.test(t)||!!/^hsla\s*\(\s*\d+\s*,\s*\d+%\s*,\s*\d+%\s*,\s*(0|1|0?\.\d+)\s*\)$/i.test(t)||!!t.includes("hsva(")||"transparent"===t},o.isArray=v,o.isBoolean=function(t){return"boolean"==typeof t},o.isBrowser=s,o.isDarkColor=function(t){return ot(t)<128},o.isDeepArray=function(t){return Array.isArray(t)},o.isDeepObject=function(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)},o.isDom=function(t){return d(HTMLElement)?w(t):t&&d(t)&&1===t.nodeType&&p(t.nodeName)||t instanceof HTMLCollection||t instanceof NodeList},o.isFunction=A,o.isHTMLElement=w,o.isMobile=I,o.isNotEmptyObject=function(t){return g(t)&&0<Object.keys(t).length},o.isNull=O,o.isNumber=h,o.isObject=g,o.isPromise=function(t){return!f(t)&&!O(t)&&A((t=t).then)&&A(t.catch)},o.isRegExp=function(t){return"regexp"===x.call(t).slice(8,-1).toLowerCase()},o.isShallowObject=d,o.isStrictColorFormat=function(t){return!(!t||"string"!=typeof t||!/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(t)&&!(/^rgb\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*\)$/.test(t)||/^rgba\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*,\s*(0|1|0?\.\d+)\s*\)$/.test(t)||/^hsl\(\s*\d+\s*,\s*\d+%\s*,\s*\d+%\s*\)$/.test(t)||/^hsla\(\s*\d+\s*,\s*\d+%\s*,\s*\d+%\s*,\s*(0|1|0?\.\d+)\s*\)$/.test(t)||"transparent"===t))},o.isString=p,o.isUndefined=f,o.isValidColor=function(t){var e="transparent"===t;if(H.test(t))return!0;if(X.test(t)&&!t.includes("rgba"))return!0;if(_.test(t))return!0;if(K.test(t)&&!t.includes("hsla"))return!0;if(Y.test(t))return!0;if(e)return!0;if("#invalid"===t||"invalid"===t)return!1;if(t.includes("rgb(")&&t.includes(", 0.5)"))return!1;if(t.includes("rgba(")&&!t.includes(", 0.5)")&&!t.includes(", 1)"))return!1;try{var n=document.createElement("div");return C(n,{"background-color":t}),"rgba(0, 0, 0, 0)"!==k(n,"backgroundColor")||e}catch(t){return!1}},o.log=a,o.objDataTypeList=["Object","Array","RegExp"],o.off=Z,o.on=J,o.open=function(t,e,n){n=1e4<(n=void 0===n?300:n)?1e4:n;var r="";switch(t){case"height":r="slideDown";break;case"opacity":r="fadeIn";break;default:r="show"}return L[r](e,n)},o.parseRgbaString=function(t){try{var e=t.slice(t.indexOf("(")+1,t.lastIndexOf(")")).split(",");return e.length<3?null:{r:parseInt(e[0]),g:parseInt(e[1]),b:parseInt(e[2]),a:e.length<4?1:parseFloat(e[3])}}catch(t){return null}},o.removeAllSpace=m,o.removeClass=function(t,e){b(t,e)&&(e=new RegExp("(^|\\s)"+e+"(\\s|$)","g"),t.className=t.className.replace(e," "))},o.removeElement=U,o.removeNode=u,o.removeStyle=function(t,e){for(var n=0,r=e=void 0===e?[]:e;n<r.length;n++){var o=r[n];t.style.removeProperty(o)}},o.rgbToHsl=function(t,e,n){t/=255,e/=255,n/=255;var r=Math.max(t,e,n),o=Math.min(t,e,n),i=0,a=0,s=(r+o)/2;if(r!==o){var c=r-o,a=.5<s?c/(2-r-o):c/(r+o);switch(r){case t:i=(e-n)/c+(e<n?6:0);break;case e:i=(n-t)/c+2;break;case n:i=(t-e)/c+4}i/=6}return{h:360*i,s:100*a,l:100*s}},o.rgbaToHex=function(t){function e(t){return Math.round(t).toString(16).padStart(2,"0")}return"#".concat(e(t.r)).concat(e(t.g)).concat(e(t.b))},o.setAttr=function(t,e){if(d(e))for(var n=0,r=Object.entries(e);n<r.length;n++){var o=r[n],i=o[0];t.setAttribute(i,"".concat(o[1]))}},o.setStyle=C,o.throttle=function(n,r){var o;return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];o||(n.apply(void 0,t),o=!0,setTimeout(function(){return o=!1},r))}},o.throwError=function(t){throw new Error("[ewColorPicker error]: ".concat(t))},o.tips=it,o.toArray=function(t){return d(t)?Array.from?Array.from(t):q.call(t):t},o.toStyleStr=function(t){return t?p(t)?t:Object.entries(t).map(function(t){var e=t[0],t=t[1];return"".concat(e.replace(/([A-Z])/g,"-$1").toLowerCase(),":").concat(t)}).join(";"):""},o.tryErrorHandler=N,o.ua=l,o.upArrowIcon=function(t,e){e=e&&0<e?' width="'.concat(e,'" height="').concat(e,'"'):"";return'<svg t="1717384498631" class="ew-color-picker-icon'.concat(y(t),'" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4235"').concat(e,'><path d="M512 309.333333c8.533333 0 17.066667 2.133333 23.466667 8.533334l341.333333 341.333333c12.8 12.8 12.8 32 0 44.8-12.8 12.8-32 12.8-44.8 0L533.333333 374.4 215.466667 692.266667c-12.8 12.8-32 12.8-44.8 0-12.8-12.8-12.8-32 0-44.8L488.533333 317.866667c4.266667-8.533333 12.8-10.666667 21.333334-10.666667z" fill="#666666" p-id="4236"></path></svg>')},o.warn=r});
|
|
1
|
+
((t,e)=>{"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).Utils={})})(this,function(o){var n=function(){return(n=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};function c(t,e,n){if(n||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||((r=r||Array.prototype.slice.call(e,0,o))[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))}function t(){}var e={log:t,warn:t,error:t},r=(["warn","error","log"].forEach(function(t){e[t]=function(){}}),e.warn),i=e.error,a=e.log,s="undefined"!=typeof window,l=s&&navigator.userAgent.toLowerCase(),I=l&&l.match(/(iPhone|iPod|Android|ios)/i);if(o.supportsPassive=!1,s)try{var u={};Object.defineProperty(u,"passive",{get:function(){o.supportsPassive=!0}}),window.addEventListener("test-passive",function(){},u)}catch(i){}function f(t){return void 0===t}function p(t){return"string"==typeof t}function d(t){return"number"==typeof t}function h(t){return"object"==typeof t&&!A(t)}function N(t){return"object"===x.call(t).slice(8,-1).toLowerCase()}function B(t){return"array"===x.call(t).slice(8,-1).toLowerCase()}function D(t,e){try{t()}catch(t){O(e)?e(t):i("[ewColorPicker error]: ".concat(t))}}function F(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(A(t))return{};if(Object.assign)return Object.assign.apply(Object,c([t],e,!1));for(var r=Object(t),o=0,i=e.length;o<i;o++){var a=e[o];if(a)for(var s in a)Z.call(a,s)&&(r[s]=a[s])}return r}function U(t){if(!h(t))return t;var e,n=B(t)?[]:{};for(e in t)t.hasOwnProperty(e)&&(n[e]=h(t[e])?U(t[e]):t[e]);return n}function g(t){return t.replace(/\s+/g,"")}function v(t){return t?" ".concat(t):""}function W(t){return document.createElement(t)}function m(t,e){return new RegExp("(^|\\s)"+e+"(\\s|$)").test(t.className)}function y(t){return t instanceof HTMLElement}function b(t,e,n){e=e.startsWith("--")?e:e.replace(/([A-Z])/g,"-$1").toLowerCase(),t.style.setProperty(e,n)}function w(n,t,e){if(p(t=void 0===t?{}:t)&&!f(e)){e=d(e)?"".concat(e,"px"):e;b(n,t,e)}else if(Array.isArray(t))t.forEach(function(t){var e=t.prop;b(n,e,t.value)});else for(var r=0,o=Object.entries(t);r<o.length;r++){var i=o[r],a=i[0];b(n,a,i[1])}}function z(t){return t.replace(/([\:\_\-]+(.))/g,function(t,e,n,r){return r?n.toUpperCase():n}).replace(/^moz([A-Z])/,"Moz$1")}function M(e,n,r){if(!e||!n)return null;"float"===(n=z(n))&&(n="cssFloat");var o=null;return D(function(){var t=(document.defaultView||window).getComputedStyle(e,r);o=e.style[n]||t?t[n]:null}),o||e.style[n]}function q(t,e){return(e=void 0===e?document:e).querySelector(t)}function G(t){var e;null!=t&&t.parentElement?null!=(e=null==t?void 0:t.parentElement)&&e.removeChild(t):null!=t&&t.remove()}var x=Object.prototype.toString,J=Array.prototype.slice,Z=Object.prototype.hasOwnProperty,A=function(t){return null===t},O=function(t){return"function"==typeof t},u=G;function C(t){return t.getBoundingClientRect()}function Q(t,e,n,r){r=o.supportsPassive?{passive:!1,capture:!!r}:!!r,t.addEventListener(e,n,r)}function V(t,e,n,r){t.removeEventListener(e,n,{capture:!!r})}o.ApplyOrder=void 0,(k=o.ApplyOrder||(o.ApplyOrder={})).Pre="pre",k.Post="post",T.prototype.on=function(t,e,n){return void 0===n&&(n=this),this.hasType(t),this.events[t]||(this.events[t]=[]),this.events[t].push([e,n]),this},T.prototype.once=function(r,o,i){var a=this,s=(void 0===i&&(i=this),this.hasType(r),function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];a.off(r,s);var n=o.apply(i,t);if(!0===n)return n});return s.fn=o,this.on(r,s),this},T.prototype.off=function(t,e){if(!t&&!e)return this.events={},this;if(t){if(this.hasType(t),e){var n=this.events[t];if(n)for(var r=n.length;r--;)(n[r][0]===e||n[r][0]&&n[r][0].fn===e)&&n.splice(r,1)}else this.events[t]=[];return this}},T.prototype.trigger=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];this.hasType(t);t=this.events[t];if(t)for(var r=t.length,o=c([],t,!0),i=0;i<r;i++){var a=o[i],s=a[0],a=a[1];if(s&&!0===(s=s.apply(a,e)))return s}},T.prototype.registerType=function(t){var e=this;t.forEach(function(t){e.eventTypes[t]=t})},T.prototype.destroy=function(){this.events={},this.eventTypes={}},T.prototype.hasType=function(t){var e=this.eventTypes;e[t]!==t&&r('[ewColorPicker warning]: EventEmitter has used unknown event type: "'.concat(t,'", should be oneof [')+"".concat(Object.keys(e).map(function(t){return JSON.stringify(t)}))+"]")};var k=T;function T(t){this.events={},this.eventTypes={},this.registerType(t)}E.prototype.destroy=function(){this.removeDOMEvents(),this.events=[]},E.prototype.addDOMEvents=function(){this.handleDOMEvents(Q)},E.prototype.removeDOMEvents=function(){this.handleDOMEvents(V)},E.prototype.handleDOMEvents=function(e){var n=this,r=this.wrapper;this.events.forEach(function(t){e(r,t.name,n,!!t.capture)})},E.prototype.handleEvent=function(e){var n=e.type;this.events.some(function(t){return t.name===n&&(t.handler(e),!0)})};var X=E;function E(t,e){this.wrapper=t,this.events=e,this.addDOMEvents()}var P=/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/,_=/[rR][gG][Bb][Aa]?[\(]([\s]*(2[0-4][0-9]|25[0-5]|[01]?[0-9][0-9]?),){2}[\s]*(2[0-4][0-9]|25[0-5]|[01]?[0-9][0-9]?),?[\s]*(0\.\d{1,2}|1|0)?[\)]{1}/g,K=/^[rR][gG][Bb][Aa][\(]([\\s]*(2[0-4][0-9]|25[0-5]|[01]?[0-9][0-9]?)[\\s]*,){3}[\\s]*(1|1.0|0|0?.[0-9]{1,2})[\\s]*[\)]{1}$/,Y=/^[hH][Ss][Ll][\(]([\\s]*(2[0-9][0-9]|360|3[0-5][0-9]|[01]?[0-9][0-9]?)[\\s]*,)([\\s]*((100|[0-9][0-9]?)%|0)[\\s]*,)([\\s]*((100|[0-9][0-9]?)%|0)[\\s]*)[\)]$/,tt=/^[hH][Ss][Ll][Aa][\(]([\\s]*(2[0-9][0-9]|360|3[0-5][0-9]|[01]?[0-9][0-9]?)[\\s]*,)([\\s]*((100|[0-9][0-9]?)%|0)[\\s]*,){2}([\\s]*(1|1.0|0|0?.[0-9]{1,2})[\\s]*)[\)]$/;function et(t,e){var e=(e=void 0===e?1:e)||1,e=Math.round(10*e)/10,n=t.toLowerCase(),r=t.length,o=[];if(t&&P.test(n)){if(4===r){for(var i="#",a=1;a<r;a++){var s=n.slice(a,a+1);i+=s.concat(s)}n=i}for(var c=1,l=n.length;c<l;c+=2)o.push(parseInt("0X"+n.slice(c,c+2),16));return"rgba(".concat(o.join(", "),", ").concat(e,")")}return g(n)}function nt(t){var e,n,r,o,i,a,s,c;return t&&"string"==typeof t&&(t=t.replace(/\s+/g," ").trim().match(/rgba?\(([^)]+)\)/i))?(t=t[1].split(",").map(function(t){return t.trim()}),e=parseFloat(t[0])||0,n=parseFloat(t[1])||0,r=parseFloat(t[2])||0,t=4<=t.length&&parseFloat(t[3])||1,e=e/255,n=n/255,r=r/255,o=(c=Math.max(e,n,r))-Math.min(e,n,r),(a=i=0)!==(s=c)&&(a=o/c),0!=o?(c===e?i=(n-r)/o*60:c===n?i=60*((r-e)/o+2):c===r&&(i=60*((e-n)/o+4)),i<0&&(i+=360)):i=0,c=Math.round(10*t)/10,{h:Math.round(i),s:Math.round(100*a),v:Math.round(100*s),a:c}):{h:0,s:100,v:100,a:1}}var rt={black:"rgba(0, 0, 0, 1)",silver:"rgba(192, 192, 192, 1)",gray:"rgba(128, 128, 128, 1)",white:"rgba(255, 255, 255, 1)",maroon:"rgba(128, 0, 0, 1)",red:"rgba(255, 0, 0, 1)",purple:"rgba(128, 0, 128, 1)",fuchsia:"rgba(255, 0, 255, 1)",green:"rgba(0, 128, 0, 1)",lime:"rgba(0, 255, 0, 1)",olive:"rgba(128, 128, 0, 1)",yellow:"rgba(255, 255, 0, 1)",navy:"rgba(0, 0, 128, 1)",blue:"rgba(0, 0, 255, 1)",teal:"rgba(0, 128, 128, 1)",aqua:"rgba(0, 255, 255, 1)",orange:"rgba(255, 165, 0, 1)",pink:"rgba(255, 192, 203, 1)",brown:"rgba(165, 42, 42, 1)"};function ot(t){if(t&&"string"==typeof t){var e=t.trim().toLowerCase();if(rt[e])return rt[e];if(P.test(e))return et(e).replace(/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+(?:\.\d+)?)\s*\)/,"rgba($1, $2, $3, $4)");var n=e.match(/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i);if(n)return r=n[1],o=n[2],i=n[3],"rgba(".concat(r,", ").concat(o,", ").concat(i,", 1)");var r,o,i,n=e.match(/^rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(0|1|0?\.\d+)\s*\)$/i);if(n)return r=n[1],o=n[2],i=n[3],e=n[4],"rgba(".concat(r,", ").concat(o,", ").concat(i,", ").concat(e,")");try{var a=W("div"),s=(w(a,{"background-color":t}),M(a,"backgroundColor"));if(s&&"rgba(0, 0, 0, 0)"!==s)return s.replace(/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+(?:\.\d+)?)\s*\)/,"rgba($1, $2, $3, $4)")}catch(t){}}return""}function it(t){t=ot(t),t=t.slice(t.indexOf("(")+1,t.lastIndexOf(")")).split(",");return(299*parseInt(t[0])+587*parseInt(t[1])+114*parseInt(t[2]))/1e3}var H=new Map;$.prototype.show=function(){var e=this;return new Promise(function(t){w(e.element,{display:"block"}),t()})},$.prototype.hide=function(){var e=this;return new Promise(function(t){w(e.element,{display:"none"}),t()})},$.prototype.slideDown=function(){var o=this;return new Promise(function(t){w(o.element,{display:"block",visibility:"hidden"});var e=M(o.element,"marginTop"),n=M(o.element,"marginBottom"),r=o.element.offsetHeight+parseInt(e)+parseInt(n);w(o.element,{height:"0px",overflow:"hidden",visibility:"visible"}),o.element.offsetHeight,setTimeout(function(){w(o.element,{transition:"height ".concat(o.options.duration,"ms ").concat(o.options.easing),height:"".concat(r,"px")}),setTimeout(function(){w(o.element,{height:"",overflow:"",transition:""}),t()},o.options.duration)},o.options.delay)})},$.prototype.slideUp=function(){var r=this;return new Promise(function(t){var e=M(r.element,"marginTop"),n=M(r.element,"marginBottom"),e=r.element.offsetHeight+parseInt(e)+parseInt(n);w(r.element,{height:"".concat(e,"px"),overflow:"hidden"}),r.element.offsetHeight,setTimeout(function(){w(r.element,{height:"0px",transition:"height ".concat(r.options.duration,"ms ").concat(r.options.easing)}),setTimeout(function(){w(r.element,{height:"",overflow:"",transition:"",display:"none"}),t()},r.options.duration)},r.options.delay)})},$.prototype.fadeIn=function(){var t=this;return new Promise(function(n){function r(t){var t=Math.min((t-a)/i,1),e=1-Math.pow(1-t,3);w(o,{opacity:e.toString()}),t<1?requestAnimationFrame(r):(w(o,{opacity:"1"}),n())}var o=t.element,i=t.options.duration,a=(w(o,{display:"block",opacity:"0"}),o.offsetHeight,performance.now());requestAnimationFrame(r)})},$.prototype.fadeOut=function(){var t=this;return new Promise(function(n){function r(t){var t=Math.min((t-a)/i,1),e=Math.pow(t,3);w(o,{opacity:(1-e).toString()}),t<1?requestAnimationFrame(r):(w(o,{display:"none",opacity:"0"}),n())}var o=t.element,i=t.options.duration,a=(w(o,{display:"block",opacity:"1"}),o.offsetHeight,performance.now());requestAnimationFrame(r)})};var S=$;function $(t,e){void 0===e&&(e={}),this.element=t,this.options=n({duration:300,easing:"ease-out",delay:0},e)}var j={show:function(t,e){return new S(t,{duration:e=void 0===e?300:e}).show()},hide:function(t,e){return new S(t,{duration:e=void 0===e?300:e}).hide()},slideDown:function(t,e){return new S(t,{duration:e=void 0===e?300:e}).slideDown()},slideUp:function(t,e){return new S(t,{duration:e=void 0===e?300:e}).slideUp()},fadeIn:function(t,e){return new S(t,{duration:e=void 0===e?300:e}).fadeIn()},fadeOut:function(t,e){return new S(t,{duration:e=void 0===e?300:e}).fadeOut()}};var L="ew-",at=["%c ew-color-picker@2.0.2%c 联系QQ:854806732 %c 联系微信:eveningwater %c github:https://github.com/eveningwater/ew-color-picker %c ","background:#0ca6dc ; padding: 1px; border-radius: 3px 0 0 3px; color: #fff","background:#ff7878 ; padding: 1px; border-radius: 0 3px 3px 0; color: #fff","background:#ff7878 ; padding: 1px; border-radius: 3px 0 0 3px; color: #fff","background:#ff7878 ; padding: 1px; border-radius: 0 3px 3px 0; color: #fff","background:transparent"],st=!1,ct=(R.prototype.handleOptions=function(){this.ewColorPicker&&this.ewColorPicker.options&&(this.options=F(this.options,this.ewColorPicker.options))},R.prototype.run=function(){st||(st=!0,a.apply(void 0,at))},R.prototype.install=function(t){this.ewColorPicker=t,this.handleOptions(),t.on&&O(t.on)&&t.on("change",function(t){}),null!=(t=this.run)&&t.call(this)},R.pluginName="ewColorPickerConsole",R);function R(t){this.ewColorPicker=t,this.options={},this.handleOptions(),this.run()}o.$=q,o.$$=function(t,e){return(e=void 0===e?document:e).querySelectorAll(t)},o.Animation=S,o.Console=ct,o.DEFAULT_PREFIX=L,o.EventEmitter=k,o.EventRegister=X,o.JSONClone=function(t){return JSON.parse(JSON.stringify(t))},o.addClass=function(t,e){for(var n=0,r=e.trim().split(/\s+/);n<r.length;n++){var o,i=r[n];i&&!m(t,i)&&((o=t.className.split(" ").filter(Boolean)).push(i),t.className=o.join(" "))}},o.ani=j,o.arrowIcon=function(t,e,n){void 0===n&&(n=L);e=e&&0<e?' width="'.concat(e,'" height="').concat(e,'"'):"";return'<svg t="1717384498630" class="'.concat(n,"color-picker-icon").concat(v(t),'" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4234"').concat(e,'><path d="M512 714.666667c-8.533333 0-17.066667-2.133333-23.466667-8.533334l-341.333333-341.333333c-12.8-12.8-12.8-32 0-44.8 12.8-12.8 32-12.8 44.8 0l320 317.866667 317.866667-320c12.8-12.8 32-12.8 44.8 0 12.8 12.8 12.8 32 0 44.8L533.333333 704c-4.266667 8.533333-12.8 10.666667-21.333333 10.666667z" fill="currentColor" p-id="4235"></path></svg>')},o.assert=function(t,e){if(!t)throw new Error(e||"Assertion failed")},o.baseSetStyle=b,o.basicDataTypeList=["Number","String","Function","Undefined","Boolean"],o.calculatePanelPosition=function(t,e,n,r){void 0===n&&(n="bottom"),void 0===r&&(r=8);var o=C(t),i=C(e),t=window.innerWidth,e=window.innerHeight,a=0,s=0,n=n.split("-"),c=n[0],l=n[1];switch(c){case"top":s=o.top-i.height-r,a="start"===l?o.left:"end"===l?o.right-i.width:o.left+(o.width-i.width)/2;break;case"bottom":s=o.bottom+r,a="start"===l?o.left:"end"===l?o.right-i.width:o.left+(o.width-i.width)/2;break;case"left":a=o.left-i.width-r,s="start"===l?o.top:"end"===l?o.bottom-i.height:o.top+(o.height-i.height)/2;break;case"right":a=o.right+r,s="start"===l?o.top:"end"===l?o.bottom-i.height:o.top+(o.height-i.height)/2}return s<0&&(s=r),{left:a=(a=a<0?r:a)+i.width>t?t-i.width-r:a,top:s=s+i.height>e?e-i.height-r:s}},o.camelCase=z,o.checkContainer=function(t){return p(t)?q(t)||(r("[ewColorPicker warning]: Cannot find element with selector: ".concat(t)),document.body):y(t)?t:document.body},o.clearColorCache=function(){},o.clone=U,o.cloneColor=function(t){return n({},t)},o.close=function(t,e,n){n=1e4<(n=void 0===n?300:n)?1e4:n;var r="";switch(t){case"height":r="slideUp";break;case"opacity":r="fadeOut";break;default:r="hide"}return j[r](e,n)},o.closeIcon=function(t,e,n){void 0===n&&(n=L);e=e&&0<e?' width="'.concat(e,'" height="').concat(e,'"'):"";return'<svg t="1690189203554" class="'.concat(n,"color-picker-icon").concat(v(t),'" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2272" fill="currentColor"').concat(e,'><path d="M504.224 470.288l207.84-207.84a16 16 0 0 1 22.608 0l11.328 11.328a16 16 0 0 1 0 22.624l-207.84 207.824 207.84 207.84a16 16 0 0 1 0 22.608l-11.328 11.328a16 16 0 0 1-22.624 0l-207.824-207.84-207.84 207.84a16 16 0 0 1-22.608 0l-11.328-11.328a16 16 0 0 1 0-22.624l207.84-207.824-207.84-207.84a16 16 0 0 1 0-22.608l11.328-11.328a16 16 0 0 1 22.624 0l207.824 207.84z" p-id="2273"></path></svg>')},o.colorHexToRgba=et,o.colorHslaToRgba=function(t){var e,n,r,o,i=t.h,a=t.s/100,s=t.l/100,t=t.a;return 0==a?n=r=o=s:(n=(e=function(t,e,n){return 1<n&&(n-=1),n<0&&(n+=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+6*(e-t)*(2/3-n):t})(a=2*s-(s=.5<=s?s+a-s*a:s*(1+a)),s,(i=i/360)+1/3),r=e(a,s,i),o=e(a,s,i-1/3)),t=Math.round(10*t)/10,"rgba(".concat(Math.round(255*n),", ").concat(Math.round(255*r),", ").concat(Math.round(255*o),", ").concat(t,")")},o.colorHsvaToRgba=function(t,e){var n,r,o,i,a=t.a,s=t.h,c=255*t.s/100,t=255*t.v/100;return 0==c?n=r=o=t:(t=s%60*((i=t)-(c=(255-c)*t/255))/60,360===s?(n=i,r=o=0):s<60?(n=i,r=c+t,o=c):s<120?(n=i-t,r=i,o=c):s<180?(r=i,o=(n=c)+t):s<240?(n=c,r=i-t,o=i):s<300?(n=c+t,r=c,o=i):s<360?(r=c,o=(n=i)-t):n=r=o=0),void 0!==e&&0<=e&&e<=1&&(a=e),a=Math.round(10*a)/10,"rgba(".concat(Math.round(n),", ").concat(Math.round(r),", ").concat(Math.round(o),", ").concat(a,")")},o.colorRegExp=P,o.colorRegHSL=Y,o.colorRegHSLA=tt,o.colorRegRGB=_,o.colorRegRGBA=K,o.colorRgbaToHex=function(t){var e,n,r={10:"A",11:"B",12:"C",13:"D",14:"E",15:"F"};return/rgba?/.test(t)?(e=t.replace(/rgba?\(/,"").replace(/\)/,"").replace(/[\s+]/g,"").split(","),n="",e.map(function(t,e){e<=2&&(n+=(e=+t,e=Math.min(Math.round(e),255),t=Math.floor(e/16),""+(r[t]||t)+(r[e%=16]||e)))}),g("#"+n)):t},o.colorRgbaToHsla=function(t){var e,n=(t=t.slice(t.indexOf("(")+1,t.lastIndexOf(")")).split(",")).length<4?1:Number(t[3]),n=Math.round(10*n)/10,r=parseInt(t[0])/255,o=parseInt(t[1])/255,i=parseInt(t[2])/255,t=Math.max(r,o,i),a=Math.min(r,o,i),s=(t+a)/2;if(t===a)e=l=0;else{var c=t-a,l=.5<s?c/(2-t-a):c/(t+a);switch(t){case r:e=(o-i)/c+(i<=o?0:6);break;case o:e=(i-r)/c+2;break;case i:e=(r-o)/c+4}}return{colorStr:g("hsla("+Math.ceil(60*e)+","+Math.ceil(100*l)+"%,"+Math.ceil(100*s)+"%,"+n+")"),colorObj:{h:Math.round(e),s:Math.round(100*l),l:Math.round(100*s),a:n}}},o.colorRgbaToHsva=nt,o.colorRgbaToHsvaWithCache=function(t){var e;return H.has(t)?H.get(t):(e=nt(t),H.set(t,e),1e3<H.size&&(t=H.keys().next().value)&&H.delete(t),e)},o.colorToRgba=ot,o.create=W,o.createByTemplate=function(t){return document.createRange().createContextualFragment(t)},o.debounce=function(r,o,i){void 0===i&&(i=!1);var a=null;return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=i&&!a;a&&clearTimeout(a),a=setTimeout(function(){a=null,i||r.apply(void 0,t)},o),n&&r.apply(void 0,t)}},o.downArrowIcon=function(t,e,n){void 0===n&&(n=L);e=e&&0<e?' width="'.concat(e,'" height="').concat(e,'"'):"";return'<svg t="1717384498632" class="'.concat(n,"color-picker-icon").concat(v(t),'" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4236"').concat(e,'><path d="M512 714.666667c-8.533333 0-17.066667-2.133333-23.466667-8.533334l-341.333333-341.333333c-12.8-12.8-12.8-32 0-44.8 12.8-12.8 32-12.8 44.8 0l320 317.866667 317.866667-320c12.8-12.8 32-12.8 44.8 0 12.8 12.8 12.8 32 0 44.8L533.333333 704c-4.266667 8.533333-12.8 10.666667-21.333333 10.666667z" fill="#666666" p-id="4237"></path></svg>')},o.error=i,o.extend=F,o.getAnimationType=function(t){return(null==(t=t.options)?void 0:t.togglePickerAnimation)||"default"},o.getAttr=function(t,e){return t.getAttribute(e)},o.getColorBrightness=it,o.getElementSize=function(t){return{clientWidth:t.clientWidth,clientHeight:t.clientHeight,offsetWidth:t.offsetWidth,offsetHeight:t.offsetHeight,scrollWidth:t.scrollWidth,scrollHeight:t.scrollHeight}},o.getOffset=function(t){for(var e=0,n=0;t;)e-=t.offsetLeft,n-=t.offsetTop,t=t.offsetParent;return{left:e,top:n}},o.getPrefix=function(t){t=null==(t=null==t?void 0:t.options)?void 0:t.prefix;return"string"==typeof t?t:L},o.getRect=C,o.getStyle=M,o.handleClassName=v,o.hasClass=m,o.insertNode=function(t,e,n,r){r&&null!=t&&t.contains(r)?t.insertBefore(e,r):n&&null!=t&&t.contains(n)?t.replaceChild(e,n):null!=t&&t.appendChild(e)},o.isAlphaColor=function(t){return!!/^rgba\s*\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*,\s*(0|1|0?\.\d+)\s*\)$/i.test(t)||!!/^hsla\s*\(\s*\d+\s*,\s*\d+%\s*,\s*\d+%\s*,\s*(0|1|0?\.\d+)\s*\)$/i.test(t)||!!t.includes("hsva(")||"transparent"===t},o.isArray=B,o.isBoolean=function(t){return"boolean"==typeof t},o.isBrowser=s,o.isDarkColor=function(t){return it(t)<128},o.isDeepArray=function(t){return Array.isArray(t)},o.isDeepObject=function(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)},o.isDom=function(t){return h(HTMLElement)?y(t):t&&h(t)&&1===t.nodeType&&p(t.nodeName)||t instanceof HTMLCollection||t instanceof NodeList},o.isFunction=O,o.isHTMLElement=y,o.isMobile=I,o.isNotEmptyObject=function(t){return N(t)&&0<Object.keys(t).length},o.isNull=A,o.isNumber=d,o.isObject=N,o.isPromise=function(t){return!f(t)&&!A(t)&&O((t=t).then)&&O(t.catch)},o.isRegExp=function(t){return"regexp"===x.call(t).slice(8,-1).toLowerCase()},o.isShallowObject=h,o.isStrictColorFormat=function(t){return!(!t||"string"!=typeof t||!/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(t)&&!(/^rgb\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*\)$/.test(t)||/^rgba\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*,\s*(0|1|0?\.\d+)\s*\)$/.test(t)||/^hsl\(\s*\d+\s*,\s*\d+%\s*,\s*\d+%\s*\)$/.test(t)||/^hsla\(\s*\d+\s*,\s*\d+%\s*,\s*\d+%\s*,\s*(0|1|0?\.\d+)\s*\)$/.test(t)||"transparent"===t))},o.isString=p,o.isUndefined=f,o.isValidColor=function(t){var e="transparent"===t;if(P.test(t))return!0;if(_.test(t)&&!t.includes("rgba"))return!0;if(K.test(t))return!0;if(Y.test(t)&&!t.includes("hsla"))return!0;if(tt.test(t))return!0;if(e)return!0;if("#invalid"===t||"invalid"===t)return!1;if(t.includes("rgb(")&&t.includes(", 0.5)"))return!1;if(t.includes("rgba(")&&!t.includes(", 0.5)")&&!t.includes(", 1)"))return!1;try{var n=document.createElement("div");return w(n,{"background-color":t}),"rgba(0, 0, 0, 0)"!==M(n,"backgroundColor")||e}catch(t){return!1}},o.log=a,o.objDataTypeList=["Object","Array","RegExp"],o.off=V,o.on=Q,o.open=function(t,e,n){n=1e4<(n=void 0===n?300:n)?1e4:n;var r="";switch(t){case"height":r="slideDown";break;case"opacity":r="fadeIn";break;default:r="show"}return j[r](e,n)},o.parseRgbaString=function(t){try{var e=t.slice(t.indexOf("(")+1,t.lastIndexOf(")")).split(",");return e.length<3?null:{r:parseInt(e[0]),g:parseInt(e[1]),b:parseInt(e[2]),a:e.length<4?1:parseFloat(e[3])}}catch(t){return null}},o.removeAllSpace=g,o.removeClass=function(t,e){m(t,e)&&(e=new RegExp("(^|\\s)"+e+"(\\s|$)","g"),t.className=t.className.replace(e," "))},o.removeElement=G,o.removeNode=u,o.removeStyle=function(t,e){for(var n=0,r=e=void 0===e?[]:e;n<r.length;n++){var o=r[n];t.style.removeProperty(o)}},o.rgbToHsl=function(t,e,n){t/=255,e/=255,n/=255;var r=Math.max(t,e,n),o=Math.min(t,e,n),i=0,a=0,s=(r+o)/2;if(r!==o){var c=r-o,a=.5<s?c/(2-r-o):c/(r+o);switch(r){case t:i=(e-n)/c+(e<n?6:0);break;case e:i=(n-t)/c+2;break;case n:i=(t-e)/c+4}i/=6}return{h:360*i,s:100*a,l:100*s}},o.rgbaToHex=function(t){function e(t){return Math.round(t).toString(16).padStart(2,"0")}return"#".concat(e(t.r)).concat(e(t.g)).concat(e(t.b))},o.setAttr=function(t,e){if(h(e))for(var n=0,r=Object.entries(e);n<r.length;n++){var o=r[n],i=o[0];t.setAttribute(i,"".concat(o[1]))}},o.setStyle=w,o.throttle=function(n,r){var o;return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];o||(n.apply(void 0,t),o=!0,setTimeout(function(){return o=!1},r))}},o.throwError=function(t){throw new Error("[ewColorPicker error]: ".concat(t))},o.tips=at,o.toArray=function(t){return h(t)?Array.from?Array.from(t):J.call(t):t},o.toStyleStr=function(t){return t?p(t)?t:Object.entries(t).map(function(t){var e=t[0],t=t[1];return"".concat(e.replace(/([A-Z])/g,"-$1").toLowerCase(),":").concat(t)}).join(";"):""},o.tryErrorHandler=D,o.ua=l,o.upArrowIcon=function(t,e,n){void 0===n&&(n=L);e=e&&0<e?' width="'.concat(e,'" height="').concat(e,'"'):"";return'<svg t="1717384498631" class="'.concat(n,"color-picker-icon").concat(v(t),'" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4235"').concat(e,'><path d="M512 309.333333c8.533333 0 17.066667 2.133333 23.466667 8.533334l341.333333 341.333333c12.8 12.8 12.8 32 0 44.8-12.8 12.8-32 12.8-44.8 0L533.333333 374.4 215.466667 692.266667c-12.8 12.8-32 12.8-44.8 0-12.8-12.8-12.8-32 0-44.8L488.533333 317.866667c4.266667-8.533333 12.8-10.666667 21.333334-10.666667z" fill="#666666" p-id="4236"></path></svg>')},o.warn=r});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ew-color-picker/utils",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "utils for ew-color-picker",
|
|
5
5
|
"main": "dist/utils.min.js",
|
|
6
6
|
"module": "dist/utils.esm.js",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
"types": "dist/packages/utils/src/index.d.ts",
|
|
30
30
|
"peerDependencies": {
|
|
31
|
-
"@ew-color-picker/core": "^2.0.
|
|
31
|
+
"@ew-color-picker/core": "^2.0.2"
|
|
32
32
|
},
|
|
33
33
|
"peerDependenciesMeta": {
|
|
34
34
|
"@ew-color-picker/core": {
|