@thednp/color-picker 2.0.0-alpha1 → 2.0.0-alpha3
Sign up to get free protection for your applications and to get access to all the features.
- package/.eslintrc.cjs +1 -1
- package/README.md +7 -6
- package/dist/css/color-picker.css +3 -3
- package/dist/css/color-picker.min.css +2 -2
- package/dist/css/color-picker.rtl.css +3 -3
- package/dist/css/color-picker.rtl.min.css +2 -2
- package/dist/js/color-picker.cjs +3 -3
- package/dist/js/color-picker.cjs.map +1 -1
- package/dist/js/color-picker.d.ts +21 -19
- package/dist/js/color-picker.js +3 -3
- package/dist/js/color-picker.js.map +1 -1
- package/dist/js/color-picker.mjs +395 -393
- package/dist/js/color-picker.mjs.map +1 -1
- package/package.json +19 -19
- package/src/scss/color-picker.scss +7 -3
- package/src/ts/index.ts +30 -44
- package/cypress/downloads/downloads.htm +0 -0
package/dist/js/color-picker.mjs
CHANGED
@@ -1,40 +1,40 @@
|
|
1
|
-
const J = {},
|
1
|
+
const J = {}, ge = (o) => {
|
2
2
|
const { type: t, currentTarget: e } = o;
|
3
|
-
[...J[t]].forEach(([s,
|
4
|
-
e === s && [...
|
5
|
-
|
3
|
+
[...J[t]].forEach(([s, r]) => {
|
4
|
+
e === s && [...r].forEach(([n, i]) => {
|
5
|
+
n.apply(s, [o]), typeof i == "object" && i.once && jt(s, t, n, i);
|
6
6
|
});
|
7
7
|
});
|
8
|
-
},
|
8
|
+
}, ue = (o, t, e, s) => {
|
9
9
|
J[t] || (J[t] = /* @__PURE__ */ new Map());
|
10
|
-
const
|
11
|
-
|
12
|
-
const
|
13
|
-
|
14
|
-
},
|
15
|
-
const
|
16
|
-
|
17
|
-
},
|
18
|
-
|
19
|
-
const
|
20
|
-
|
10
|
+
const r = J[t];
|
11
|
+
r.has(o) || r.set(o, /* @__PURE__ */ new Map());
|
12
|
+
const n = r.get(o), { size: i } = n;
|
13
|
+
n.set(e, s), i || o.addEventListener(t, ge, s);
|
14
|
+
}, jt = (o, t, e, s) => {
|
15
|
+
const r = J[t], n = r && r.get(o), i = n && n.get(e), a = i !== void 0 ? i : s;
|
16
|
+
n && n.has(e) && n.delete(e), r && (!n || !n.size) && r.delete(o), (!r || !r.size) && delete J[t], (!n || !n.size) && o.removeEventListener(t, ge, a);
|
17
|
+
}, Ut = "aria-description", Et = "aria-expanded", Me = "aria-hidden", St = "aria-selected", et = "aria-valuenow", ot = "aria-valuetext", Te = "change", Re = "DOMContentLoaded", Oe = "focusin", De = "focusout", _t = "keydown", Fe = "keyup", Mt = "click", Ie = "pointerdown", be = "pointermove", Ke = "pointerup", Ve = "resize", Be = "scroll", je = "touchmove", j = "ArrowDown", st = "ArrowUp", ht = "ArrowLeft", G = "ArrowRight", qe = "Enter", ze = "Escape", Wt = "Space", Ge = "transitionDuration", Ue = "transitionProperty", Y = "tabindex", _e = navigator.userAgentData, vt = _e, { userAgent: We } = navigator, wt = We, Xt = /iPhone|iPad|iPod|Android/i;
|
18
|
+
vt ? vt.brands.some((o) => Xt.test(o.brand)) : Xt.test(wt);
|
19
|
+
const Jt = /(iPhone|iPod|iPad)/;
|
20
|
+
vt ? vt.brands.some((o) => Jt.test(o.brand)) : (
|
21
21
|
/* istanbul ignore next */
|
22
|
-
|
22
|
+
Jt.test(wt)
|
23
23
|
);
|
24
|
-
|
25
|
-
const { head:
|
26
|
-
["webkitPerspective", "perspective"].some((o) => o in
|
24
|
+
wt && wt.includes("Firefox");
|
25
|
+
const { head: yt } = document;
|
26
|
+
["webkitPerspective", "perspective"].some((o) => o in yt.style);
|
27
27
|
const Xe = (o, t, e, s) => {
|
28
|
-
const
|
29
|
-
o.addEventListener(t, e,
|
28
|
+
const r = s || !1;
|
29
|
+
o.addEventListener(t, e, r);
|
30
30
|
}, Je = (o, t, e, s) => {
|
31
|
-
const
|
32
|
-
o.removeEventListener(t, e,
|
31
|
+
const r = s || !1;
|
32
|
+
o.removeEventListener(t, e, r);
|
33
33
|
}, Ye = (o, t, e, s) => {
|
34
|
-
const
|
35
|
-
(
|
34
|
+
const r = (n) => {
|
35
|
+
(n.target === o || n.currentTarget === o) && (e.apply(o, [n]), Je(o, t, r, s));
|
36
36
|
};
|
37
|
-
Xe(o, t,
|
37
|
+
Xe(o, t, r, s);
|
38
38
|
}, Ze = () => {
|
39
39
|
};
|
40
40
|
(() => {
|
@@ -48,14 +48,14 @@ const Xe = (o, t, e, s) => {
|
|
48
48
|
}
|
49
49
|
return o;
|
50
50
|
})();
|
51
|
-
["webkitTransform", "transform"].some((o) => o in
|
52
|
-
["webkitAnimation", "animation"].some((o) => o in
|
53
|
-
["webkitTransition", "transition"].some((o) => o in
|
54
|
-
const
|
51
|
+
["webkitTransform", "transform"].some((o) => o in yt.style);
|
52
|
+
["webkitAnimation", "animation"].some((o) => o in yt.style);
|
53
|
+
["webkitTransition", "transition"].some((o) => o in yt.style);
|
54
|
+
const xt = (o, t) => o.getAttribute(t), m = (o, t, e) => o.setAttribute(t, e), Ct = (o, t) => o.removeAttribute(t), q = (o, ...t) => {
|
55
55
|
o.classList.add(...t);
|
56
|
-
},
|
56
|
+
}, O = (o, ...t) => {
|
57
57
|
o.classList.remove(...t);
|
58
|
-
}, T = (o, t) => o.classList.contains(t),
|
58
|
+
}, T = (o, t) => o.classList.contains(t), qt = (o) => o != null && typeof o == "object" || !1, Q = (o) => qt(o) && typeof o.nodeType == "number" && [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11].some((t) => o.nodeType === t) || !1, at = (o) => Q(o) && o.nodeType === 1 || !1, W = /* @__PURE__ */ new Map(), ct = {
|
59
59
|
data: W,
|
60
60
|
/**
|
61
61
|
* Sets web components data.
|
@@ -97,7 +97,7 @@ const yt = (o, t) => o.getAttribute(t), m = (o, t, e) => o.setAttribute(t, e), S
|
|
97
97
|
const e = ct.getAllFor(t);
|
98
98
|
!e || !at(o) || (e.delete(o), e.size === 0 && W.delete(t));
|
99
99
|
}
|
100
|
-
}, Qe = (o, t) => ct.get(o, t), V = (o) => typeof o == "string" || !1, to = (o) =>
|
100
|
+
}, Qe = (o, t) => ct.get(o, t), V = (o) => typeof o == "string" || !1, to = (o) => qt(o) && o.constructor.name === "Window" || !1, pe = (o) => Q(o) && o.nodeType === 9 || !1, K = (o) => to(o) ? o.document : pe(o) ? o : Q(o) ? o.ownerDocument : window.document, B = (o, ...t) => Object.assign(o, ...t), x = (o) => {
|
101
101
|
if (!o)
|
102
102
|
return;
|
103
103
|
if (V(o))
|
@@ -107,52 +107,52 @@ const yt = (o, t) => o.getAttribute(t), m = (o, t, e) => o.setAttribute(t, e), S
|
|
107
107
|
return;
|
108
108
|
const s = { ...o };
|
109
109
|
return delete s.tagName, B(e, s);
|
110
|
-
},
|
110
|
+
}, Tt = (o, t) => {
|
111
111
|
if (!o || !t)
|
112
112
|
return;
|
113
113
|
if (V(t))
|
114
114
|
return K().createElementNS(o, t);
|
115
|
-
const { tagName: e } = t, s =
|
115
|
+
const { tagName: e } = t, s = Tt(o, e);
|
116
116
|
if (!s)
|
117
117
|
return;
|
118
|
-
const
|
119
|
-
return delete
|
120
|
-
}, eo = (o, t) => o.dispatchEvent(t),
|
118
|
+
const r = { ...t };
|
119
|
+
return delete r.tagName, B(s, r);
|
120
|
+
}, eo = (o, t) => o.dispatchEvent(t), Rt = (o, t) => {
|
121
121
|
const e = getComputedStyle(o), s = t.replace("webkit", "Webkit").replace(/([A-Z])/g, "-$1").toLowerCase();
|
122
122
|
return e.getPropertyValue(s);
|
123
123
|
}, oo = (o) => {
|
124
|
-
const t =
|
124
|
+
const t = Rt(o, Ue), e = Rt(o, Ge), s = e.includes("ms") ? (
|
125
125
|
/* istanbul ignore next */
|
126
126
|
1
|
127
|
-
) : 1e3,
|
127
|
+
) : 1e3, r = t && t !== "none" ? parseFloat(e) * s : (
|
128
128
|
/* istanbul ignore next */
|
129
129
|
0
|
130
130
|
);
|
131
|
-
return Number.isNaN(
|
131
|
+
return Number.isNaN(r) ? (
|
132
132
|
/* istanbul ignore next */
|
133
133
|
0
|
134
|
-
) :
|
135
|
-
}, U = (o, t) => o.focus(t),
|
136
|
-
const
|
137
|
-
return pt(
|
134
|
+
) : r;
|
135
|
+
}, U = (o, t) => o.focus(t), Yt = (o) => ["true", !0].includes(o) ? !0 : ["false", !1].includes(o) ? !1 : ["null", "", null, void 0].includes(o) ? null : o !== "" && !Number.isNaN(+o) ? +o : o, pt = (o) => Object.entries(o), so = (o) => o.toLowerCase(), ro = (o, t, e, s) => {
|
136
|
+
const r = { ...e }, n = { ...o.dataset }, i = { ...t }, a = {}, l = "title";
|
137
|
+
return pt(n).forEach(([c, h]) => {
|
138
138
|
const b = s && typeof c == "string" && c.includes(s) ? c.replace(s, "").replace(/[A-Z]/g, (u) => so(u)) : c;
|
139
|
-
a[b] =
|
140
|
-
}), pt(
|
141
|
-
|
139
|
+
a[b] = Yt(h);
|
140
|
+
}), pt(r).forEach(([c, h]) => {
|
141
|
+
r[c] = Yt(h);
|
142
142
|
}), pt(t).forEach(([c, h]) => {
|
143
|
-
c in
|
143
|
+
c in r ? i[c] = r[c] : c in a ? i[c] = a[c] : i[c] = c === l ? xt(o, l) : h;
|
144
144
|
}), i;
|
145
|
-
},
|
145
|
+
}, no = (o) => o.offsetHeight, D = (o, t) => {
|
146
146
|
pt(t).forEach(([e, s]) => {
|
147
147
|
if (s && V(e) && e.includes("--"))
|
148
148
|
o.style.setProperty(e, s);
|
149
149
|
else {
|
150
|
-
const
|
151
|
-
|
150
|
+
const r = {};
|
151
|
+
r[e] = s, B(o.style, r);
|
152
152
|
}
|
153
153
|
});
|
154
|
-
}, io = (o) =>
|
155
|
-
const { width: e, height: s, top:
|
154
|
+
}, io = (o) => qt(o) && o.constructor.name === "Map" || !1, de = (o) => o.toUpperCase(), gt = (o, t) => {
|
155
|
+
const { width: e, height: s, top: r, right: n, bottom: i, left: a } = o.getBoundingClientRect();
|
156
156
|
let l = 1, c = 1;
|
157
157
|
if (t && at(o)) {
|
158
158
|
const { offsetWidth: h, offsetHeight: b } = o;
|
@@ -167,35 +167,35 @@ const yt = (o, t) => o.getAttribute(t), m = (o, t, e) => o.setAttribute(t, e), S
|
|
167
167
|
return {
|
168
168
|
width: e / l,
|
169
169
|
height: s / c,
|
170
|
-
top:
|
171
|
-
right:
|
170
|
+
top: r / c,
|
171
|
+
right: n / l,
|
172
172
|
bottom: i / c,
|
173
173
|
left: a / l,
|
174
174
|
x: a / l,
|
175
|
-
y:
|
175
|
+
y: r / c
|
176
176
|
};
|
177
|
-
},
|
178
|
-
let
|
179
|
-
const X = /* @__PURE__ */ new Map(),
|
180
|
-
let e = t ?
|
177
|
+
}, Lt = (o) => K(o).documentElement;
|
178
|
+
let Zt = 0, Qt = 0;
|
179
|
+
const X = /* @__PURE__ */ new Map(), fe = (o, t) => {
|
180
|
+
let e = t ? Zt : Qt;
|
181
181
|
if (t) {
|
182
|
-
const s =
|
183
|
-
X.has(s) || X.set(s,
|
182
|
+
const s = fe(o), r = X.get(s) || /* @__PURE__ */ new Map();
|
183
|
+
X.has(s) || X.set(s, r), io(r) && !r.has(t) ? (r.set(t, e), Zt += 1) : e = r.get(t);
|
184
184
|
} else {
|
185
185
|
const s = o.id || o;
|
186
|
-
X.has(s) ? e = X.get(s) : (X.set(s, e),
|
186
|
+
X.has(s) ? e = X.get(s) : (X.set(s, e), Qt += 1);
|
187
187
|
}
|
188
188
|
return e;
|
189
189
|
}, ao = (o) => {
|
190
190
|
var t;
|
191
|
-
return o ?
|
192
|
-
},
|
193
|
-
|
191
|
+
return o ? pe(o) ? o.defaultView : Q(o) ? (t = o?.ownerDocument) == null ? void 0 : t.defaultView : o : window;
|
192
|
+
}, At = (o) => Array.isArray(o) || !1, me = (o, t) => o ? o.closest(t) || // break out of `ShadowRoot`
|
193
|
+
me(o.getRootNode().host, t) : null, _ = (o, t) => at(o) ? o : (Q(t) ? t : K()).querySelector(o), rt = (o, t) => (t && Q(t) ? t : K()).getElementsByClassName(
|
194
194
|
o
|
195
|
-
),
|
195
|
+
), zt = ["transparent", "currentColor", "inherit", "revert", "initial"], v = (o) => {
|
196
196
|
const t = Math.floor(o);
|
197
197
|
return o - t < 0.5 ? t : Math.round(o);
|
198
|
-
},
|
198
|
+
}, $t = [
|
199
199
|
[
|
200
200
|
"aliceblue",
|
201
201
|
{
|
@@ -1380,110 +1380,110 @@ fe(o.getRootNode().host, t) : null, _ = (o, t) => at(o) ? o : (Q(t) ? t : K()).q
|
|
1380
1380
|
b: 50
|
1381
1381
|
}
|
1382
1382
|
]
|
1383
|
-
],
|
1384
|
-
CSS_UNIT: new RegExp(
|
1385
|
-
ANGLES:
|
1386
|
-
CSS_ANGLE:
|
1387
|
-
CSS_INTEGER:
|
1388
|
-
CSS_NUMBER:
|
1389
|
-
CSS_UNIT2:
|
1390
|
-
PERMISSIVE_MATCH:
|
1391
|
-
hwb: new RegExp(`hwb${
|
1392
|
-
rgb: new RegExp(`rgb(?:a)?${
|
1393
|
-
hsl: new RegExp(`hsl(?:a)?${
|
1394
|
-
hsv: new RegExp(`hsv(?:a)?${
|
1383
|
+
], ve = "deg|rad|grad|turn", we = "[-\\+]?\\d+%?", $e = "[-\\+]?\\d*\\.\\d+%?", ke = `[-\\+]?\\d*\\.?\\d+(?:${ve})?`, dt = `(?:${$e})|(?:${we})`, Ot = `(?:${dt})|(?:${ke}?)`, lo = "(?:[\\s|\\(\\s|\\s\\(\\s]+)?", co = "(?:[\\s|\\)\\s]+)?", te = "(?:[,|\\s]+)", ho = "(?:[,|\\/\\s]*)?", nt = `${lo}(${Ot})${te}(${dt})${te}(${dt})${ho}(${dt})?${co}`, I = {
|
1384
|
+
CSS_UNIT: new RegExp(Ot),
|
1385
|
+
ANGLES: ve,
|
1386
|
+
CSS_ANGLE: ke,
|
1387
|
+
CSS_INTEGER: we,
|
1388
|
+
CSS_NUMBER: $e,
|
1389
|
+
CSS_UNIT2: Ot,
|
1390
|
+
PERMISSIVE_MATCH: nt,
|
1391
|
+
hwb: new RegExp(`hwb${nt}`),
|
1392
|
+
rgb: new RegExp(`rgb(?:a)?${nt}`),
|
1393
|
+
hsl: new RegExp(`hsl(?:a)?${nt}`),
|
1394
|
+
hsv: new RegExp(`hsv(?:a)?${nt}`),
|
1395
1395
|
hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
|
1396
1396
|
hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
|
1397
1397
|
hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
|
1398
1398
|
hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
|
1399
|
-
},
|
1399
|
+
}, ye = (o) => zt.includes(o), it = (o, t) => o !== null && typeof o == "object" && Object.keys(t).every((e) => e in o), xe = (o) => `${o}`.includes(".") && parseFloat(o) === 1, kt = (o) => typeof o == "string" && o.includes("%"), N = (o) => !!I.CSS_UNIT.exec(`${o}`), Pe = ["rgb", "hex", "hsl", "hsv", "hwb"], Se = (o) => zt.includes(o) || ["#", ...Pe].some((t) => o.includes(t)) ? !1 : $t.some(([t]) => o === t), R = (o, t) => {
|
1400
1400
|
let e = o;
|
1401
1401
|
if (typeof o == "number" && Math.min(o, 0) === 0 && // round values to 6 decimals Math.round(N * (10 ** 6)) / 10 ** 6
|
1402
1402
|
Math.max(o, 1) === 1)
|
1403
1403
|
return o;
|
1404
|
-
|
1405
|
-
const s =
|
1404
|
+
xe(o) && (e = "100%");
|
1405
|
+
const s = kt(e);
|
1406
1406
|
return e = t === 360 ? parseFloat(e) : Math.min(t, Math.max(0, parseFloat(e))), s && (e = e * t / 100), Math.abs(e - t) < 1e-6 ? 1 : (t === 360 ? e = (e < 0 ? e % t + t : e % t) / t : e = e % t / t, e);
|
1407
1407
|
}, Dt = (o) => {
|
1408
1408
|
let t = parseFloat(o);
|
1409
1409
|
return (Number.isNaN(t) || t < 0 || t > 1) && (t = 1), t;
|
1410
|
-
}, ut = (o) => Math.min(1, Math.max(0, o)), z = (o) => o.length === 1 ? `0${o}` : String(o),
|
1411
|
-
const [[, t]] =
|
1410
|
+
}, ut = (o) => Math.min(1, Math.max(0, o)), z = (o) => o.length === 1 ? `0${o}` : String(o), Ce = (o) => {
|
1411
|
+
const [[, t]] = $t.filter(([e]) => e === o.toLowerCase());
|
1412
1412
|
return t;
|
1413
|
-
},
|
1414
|
-
const s = Math.max(o, t, e),
|
1415
|
-
let
|
1416
|
-
const a = (s +
|
1417
|
-
if (s ===
|
1418
|
-
i = 0,
|
1413
|
+
}, H = (o) => parseInt(o, 16), Ft = (o) => H(o) / 255, Le = (o) => v(o * 255).toString(16), ee = (o, t, e) => {
|
1414
|
+
const s = Math.max(o, t, e), r = Math.min(o, t, e);
|
1415
|
+
let n = 0, i = 0;
|
1416
|
+
const a = (s + r) / 2;
|
1417
|
+
if (s === r)
|
1418
|
+
i = 0, n = 0;
|
1419
1419
|
else {
|
1420
|
-
const l = s -
|
1421
|
-
i = a > 0.5 ? l / (2 - s -
|
1420
|
+
const l = s - r;
|
1421
|
+
i = a > 0.5 ? l / (2 - s - r) : l / (s + r), s === o && (n = (t - e) / l + (t < e ? 6 : 0)), s === t && (n = (e - o) / l + 2), s === e && (n = (o - t) / l + 4), n /= 6;
|
1422
1422
|
}
|
1423
|
-
return { h:
|
1423
|
+
return { h: n, s: i, l: a };
|
1424
1424
|
}, ft = (o, t, e) => {
|
1425
1425
|
let s = e;
|
1426
1426
|
return s < 0 && (s += 1), s > 1 && (s -= 1), s < 1 / 6 ? o + (t - o) * (6 * s) : s < 1 / 2 ? t : s < 2 / 3 ? o + (t - o) * (2 / 3 - s) * 6 : o;
|
1427
1427
|
}, lt = (o, t, e) => {
|
1428
|
-
let s = 0,
|
1428
|
+
let s = 0, r = 0, n = 0;
|
1429
1429
|
if (t === 0)
|
1430
|
-
|
1430
|
+
r = e, n = e, s = e;
|
1431
1431
|
else if (e) {
|
1432
1432
|
const i = e < 0.5 ? e * (1 + t) : e + t - e * t, a = 2 * e - i;
|
1433
|
-
s = ft(a, i, o + 1 / 3),
|
1433
|
+
s = ft(a, i, o + 1 / 3), r = ft(a, i, o), n = ft(a, i, o - 1 / 3);
|
1434
1434
|
}
|
1435
|
-
return { r: s, g:
|
1436
|
-
},
|
1437
|
-
let s = 0,
|
1438
|
-
const
|
1439
|
-
if (i ===
|
1440
|
-
return { h: 0, w:
|
1441
|
-
o ===
|
1442
|
-
const l = (
|
1435
|
+
return { r: s, g: r, b: n };
|
1436
|
+
}, oe = (o, t, e) => {
|
1437
|
+
let s = 0, r = 0;
|
1438
|
+
const n = Math.min(o, t, e), i = Math.max(o, t, e), a = 1 - i;
|
1439
|
+
if (i === n)
|
1440
|
+
return { h: 0, w: n, b: a };
|
1441
|
+
o === n ? (s = t - e, r = 3) : (s = t === n ? e - o : o - t, r = t === n ? 5 : 1);
|
1442
|
+
const l = (r - s / (i - n)) / 6;
|
1443
1443
|
return {
|
1444
1444
|
h: l === 1 ? 0 : l,
|
1445
|
-
w:
|
1445
|
+
w: n,
|
1446
1446
|
b: a
|
1447
1447
|
};
|
1448
|
-
},
|
1448
|
+
}, Ae = (o, t, e) => {
|
1449
1449
|
if (t + e >= 1) {
|
1450
1450
|
const i = t / (t + e);
|
1451
1451
|
return { r: i, g: i, b: i };
|
1452
1452
|
}
|
1453
|
-
let { r: s, g:
|
1454
|
-
return [s,
|
1455
|
-
},
|
1456
|
-
const s = Math.max(o, t, e),
|
1457
|
-
let
|
1458
|
-
const i = s, a = s -
|
1459
|
-
return s ===
|
1460
|
-
},
|
1461
|
-
const s = o * 6,
|
1453
|
+
let { r: s, g: r, b: n } = lt(o, 1, 0.5);
|
1454
|
+
return [s, r, n] = [s, r, n].map((i) => i * (1 - t - e) + t), { r: s, g: r, b: n };
|
1455
|
+
}, se = (o, t, e) => {
|
1456
|
+
const s = Math.max(o, t, e), r = Math.min(o, t, e);
|
1457
|
+
let n = 0;
|
1458
|
+
const i = s, a = s - r, l = s === 0 ? 0 : a / s;
|
1459
|
+
return s === r ? n = 0 : (o === s && (n = (t - e) / a + (t < e ? 6 : 0)), t === s && (n = (e - o) / a + 2), e === s && (n = (o - t) / a + 4), n /= 6), { h: n, s: l, v: i };
|
1460
|
+
}, It = (o, t, e) => {
|
1461
|
+
const s = o * 6, r = t, n = e, i = Math.floor(s), a = s - i, l = n * (1 - r), c = n * (1 - a * r), h = n * (1 - (1 - a) * r), b = i % 6, u = [n, c, l, l, h, n][b], d = [h, n, n, c, l, l][b], g = [l, l, h, n, n, c][b];
|
1462
1462
|
return { r: u, g: d, b: g };
|
1463
|
-
},
|
1464
|
-
const
|
1463
|
+
}, re = (o, t, e, s) => {
|
1464
|
+
const r = [
|
1465
1465
|
z(v(o).toString(16)),
|
1466
1466
|
z(v(t).toString(16)),
|
1467
1467
|
z(v(e).toString(16))
|
1468
1468
|
];
|
1469
|
-
return s &&
|
1470
|
-
},
|
1471
|
-
const
|
1469
|
+
return s && r[0].charAt(0) === r[0].charAt(1) && r[1].charAt(0) === r[1].charAt(1) && r[2].charAt(0) === r[2].charAt(1) ? r[0].charAt(0) + r[1].charAt(0) + r[2].charAt(0) : r.join("");
|
1470
|
+
}, Nt = (o, t, e, s, r) => {
|
1471
|
+
const n = [
|
1472
1472
|
z(v(o).toString(16)),
|
1473
1473
|
z(v(t).toString(16)),
|
1474
1474
|
z(v(e).toString(16)),
|
1475
|
-
z(
|
1475
|
+
z(Le(s))
|
1476
1476
|
];
|
1477
|
-
return
|
1478
|
-
},
|
1477
|
+
return r && n[0].charAt(0) === n[0].charAt(1) && n[1].charAt(0) === n[1].charAt(1) && n[2].charAt(0) === n[2].charAt(1) && n[3].charAt(0) === n[3].charAt(1) ? n[0].charAt(0) + n[1].charAt(0) + n[2].charAt(0) + n[3].charAt(0) : n.join("");
|
1478
|
+
}, Ne = (o) => {
|
1479
1479
|
const t = String(o).trim().toLowerCase();
|
1480
|
-
if (
|
1481
|
-
return Object.assign(
|
1480
|
+
if (Se(t))
|
1481
|
+
return Object.assign(Ce(t), {
|
1482
1482
|
a: 1,
|
1483
1483
|
format: "rgb",
|
1484
1484
|
ok: !0
|
1485
1485
|
});
|
1486
|
-
if (
|
1486
|
+
if (ye(t))
|
1487
1487
|
return {
|
1488
1488
|
r: 0,
|
1489
1489
|
g: 0,
|
@@ -1492,60 +1492,60 @@ fe(o.getRootNode().host, t) : null, _ = (o, t) => at(o) ? o : (Q(t) ? t : K()).q
|
|
1492
1492
|
format: "rgb",
|
1493
1493
|
ok: !0
|
1494
1494
|
};
|
1495
|
-
let [, e, s,
|
1496
|
-
return e && s &&
|
1495
|
+
let [, e, s, r, n] = I.rgb.exec(t) || [];
|
1496
|
+
return e && s && r ? {
|
1497
1497
|
r: e,
|
1498
1498
|
g: s,
|
1499
|
-
b:
|
1500
|
-
a:
|
1499
|
+
b: r,
|
1500
|
+
a: n !== void 0 ? n : 1,
|
1501
1501
|
format: "rgb",
|
1502
1502
|
ok: !0
|
1503
|
-
} : ([, e, s,
|
1503
|
+
} : ([, e, s, r, n] = I.hsl.exec(t) || [], e && s && r ? {
|
1504
1504
|
h: e,
|
1505
1505
|
s,
|
1506
|
-
l:
|
1507
|
-
a:
|
1506
|
+
l: r,
|
1507
|
+
a: n !== void 0 ? n : 1,
|
1508
1508
|
format: "hsl",
|
1509
1509
|
ok: !0
|
1510
|
-
} : ([, e, s,
|
1510
|
+
} : ([, e, s, r, n] = I.hsv.exec(t) || [], e && s && r ? {
|
1511
1511
|
h: e,
|
1512
1512
|
s,
|
1513
|
-
v:
|
1514
|
-
a:
|
1513
|
+
v: r,
|
1514
|
+
a: n !== void 0 ? n : 1,
|
1515
1515
|
format: "hsv",
|
1516
1516
|
ok: !0
|
1517
|
-
} : ([, e, s,
|
1517
|
+
} : ([, e, s, r, n] = I.hwb.exec(t) || [], e && s && r ? {
|
1518
1518
|
h: e,
|
1519
1519
|
w: s,
|
1520
|
-
b:
|
1521
|
-
a:
|
1520
|
+
b: r,
|
1521
|
+
a: n !== void 0 ? n : 1,
|
1522
1522
|
format: "hwb",
|
1523
1523
|
ok: !0
|
1524
|
-
} : ([, e, s,
|
1525
|
-
r:
|
1526
|
-
g:
|
1527
|
-
b:
|
1528
|
-
a:
|
1524
|
+
} : ([, e, s, r, n] = I.hex8.exec(t) || [], e && s && r && n ? {
|
1525
|
+
r: H(e),
|
1526
|
+
g: H(s),
|
1527
|
+
b: H(r),
|
1528
|
+
a: Ft(n),
|
1529
1529
|
format: "hex",
|
1530
1530
|
ok: !0
|
1531
|
-
} : ([, e, s,
|
1532
|
-
r:
|
1533
|
-
g:
|
1534
|
-
b:
|
1531
|
+
} : ([, e, s, r] = I.hex6.exec(t) || [], e && s && r ? {
|
1532
|
+
r: H(e),
|
1533
|
+
g: H(s),
|
1534
|
+
b: H(r),
|
1535
1535
|
a: 1,
|
1536
1536
|
format: "hex",
|
1537
1537
|
ok: !0
|
1538
|
-
} : ([, e, s,
|
1539
|
-
r:
|
1540
|
-
g:
|
1541
|
-
b:
|
1542
|
-
a:
|
1538
|
+
} : ([, e, s, r, n] = I.hex4.exec(t) || [], e && s && r && n ? {
|
1539
|
+
r: H(e + e),
|
1540
|
+
g: H(s + s),
|
1541
|
+
b: H(r + r),
|
1542
|
+
a: Ft(n + n),
|
1543
1543
|
format: "hex",
|
1544
1544
|
ok: !0
|
1545
|
-
} : ([, e, s,
|
1546
|
-
r:
|
1547
|
-
g:
|
1548
|
-
b:
|
1545
|
+
} : ([, e, s, r] = I.hex3.exec(t) || [], e && s && r ? {
|
1546
|
+
r: H(e + e),
|
1547
|
+
g: H(s + s),
|
1548
|
+
b: H(r + r),
|
1549
1549
|
a: 1,
|
1550
1550
|
format: "hex",
|
1551
1551
|
ok: !0
|
@@ -1558,8 +1558,8 @@ fe(o.getRootNode().host, t) : null, _ = (o, t) => at(o) ? o : (Q(t) ? t : K()).q
|
|
1558
1558
|
ok: !o
|
1559
1559
|
})))))));
|
1560
1560
|
}, ne = (o) => {
|
1561
|
-
let t = { r: 0, g: 0, b: 0 }, e = o, s = 1,
|
1562
|
-
return (!e || typeof e == "string") && (e =
|
1561
|
+
let t = { r: 0, g: 0, b: 0 }, e = o, s = 1, r, n, i, a, l, c, h, b, u = "rgb", d = !1;
|
1562
|
+
return (!e || typeof e == "string") && (e = Ne(e), d = e.ok), it(e, t) && N(e.r) && N(e.g) && N(e.b) && ({ r: h, g: b, b: l } = e, [h, b, l] = [h, b, l].map((g) => R(g, kt(g) ? 100 : 255)), t = { r: h, g: b, b: l }, u = "format" in e ? e.format : "rgb"), it(e, { h: 0, s: 0, v: 0 }) && N(e.h) && N(e.s) && N(e.v) && ({ h: c, s: r, v: n } = e, c = R(c, 360), r = R(r, 100), n = R(n, 100), t = It(c, r, n), u = "hsv"), it(e, { h: 0, s: 0, l: 0 }) && N(e.h) && N(e.s) && N(e.l) && ({ h: c, s: r, l: i } = e, c = R(c, 360), r = R(r, 100), i = R(i, 100), t = lt(c, r, i), u = "hsl"), it(e, { h: 0, w: 0, b: 0 }) && N(e.h) && N(e.w) && N(e.b) && ({ h: c, w: a, b: l } = e, c = R(c, 360), a = R(a, 100), l = R(l, 100), t = Ae(c, a, l), u = "hwb"), N(e.a) && (s = e.a, s = kt(s) || parseFloat(`${s}`) > 1 ? R(s, 100) : s), {
|
1563
1563
|
r: t.r,
|
1564
1564
|
g: t.g,
|
1565
1565
|
b: t.b,
|
@@ -1567,38 +1567,38 @@ fe(o.getRootNode().host, t) : null, _ = (o, t) => at(o) ? o : (Q(t) ? t : K()).q
|
|
1567
1567
|
format: u,
|
1568
1568
|
ok: d
|
1569
1569
|
};
|
1570
|
-
}, go = "1.0.
|
1570
|
+
}, go = "1.0.7";
|
1571
1571
|
class y {
|
1572
1572
|
// bring main utilities to front
|
1573
1573
|
static matchers = I;
|
1574
|
-
static isOnePointZero =
|
1575
|
-
static isPercentage =
|
1576
|
-
static isValidCSSUnit =
|
1577
|
-
static isNonColor =
|
1578
|
-
static isColorName =
|
1574
|
+
static isOnePointZero = xe;
|
1575
|
+
static isPercentage = kt;
|
1576
|
+
static isValidCSSUnit = N;
|
1577
|
+
static isNonColor = ye;
|
1578
|
+
static isColorName = Se;
|
1579
1579
|
static isColorType = it;
|
1580
1580
|
static pad2 = z;
|
1581
1581
|
static clamp01 = ut;
|
1582
1582
|
static bound01 = R;
|
1583
1583
|
static boundAlpha = Dt;
|
1584
|
-
static getRGBFromName =
|
1585
|
-
static convertHexToDecimal =
|
1586
|
-
static convertDecimalToHex =
|
1587
|
-
static rgbToHsl =
|
1588
|
-
static rgbToHex =
|
1589
|
-
static rgbToHsv =
|
1590
|
-
static rgbToHwb =
|
1591
|
-
static rgbaToHex =
|
1592
|
-
static hslToRgb =
|
1593
|
-
static hsvToRgb =
|
1584
|
+
static getRGBFromName = Ce;
|
1585
|
+
static convertHexToDecimal = Ft;
|
1586
|
+
static convertDecimalToHex = Le;
|
1587
|
+
static rgbToHsl = ee;
|
1588
|
+
static rgbToHex = re;
|
1589
|
+
static rgbToHsv = se;
|
1590
|
+
static rgbToHwb = oe;
|
1591
|
+
static rgbaToHex = Nt;
|
1592
|
+
static hslToRgb = It;
|
1593
|
+
static hsvToRgb = It;
|
1594
1594
|
static hueToRgb = ft;
|
1595
|
-
static hwbToRgb =
|
1596
|
-
static parseIntFromHex =
|
1597
|
-
static stringInputToObject =
|
1595
|
+
static hwbToRgb = Ae;
|
1596
|
+
static parseIntFromHex = H;
|
1597
|
+
static stringInputToObject = Ne;
|
1598
1598
|
static inputToRGB = ne;
|
1599
1599
|
static roundPart = v;
|
1600
|
-
static webColors =
|
1601
|
-
static nonColors =
|
1600
|
+
static webColors = $t;
|
1601
|
+
static nonColors = zt;
|
1602
1602
|
static version = go;
|
1603
1603
|
// main public properties
|
1604
1604
|
r;
|
@@ -1610,8 +1610,8 @@ class y {
|
|
1610
1610
|
originalInput;
|
1611
1611
|
// main public methods
|
1612
1612
|
constructor(t, e) {
|
1613
|
-
const s = e &&
|
1614
|
-
this.originalInput = t, this.r =
|
1613
|
+
const s = e && Pe.includes(e) ? e : "", { r, g: n, b: i, a, ok: l, format: c } = ne(t);
|
1614
|
+
this.originalInput = t, this.r = r, this.g = n, this.b = i, this.a = a, this.ok = l, this.format = s || c;
|
1615
1615
|
}
|
1616
1616
|
/**
|
1617
1617
|
* Checks if the current input value is a valid colour.
|
@@ -1632,8 +1632,8 @@ class y {
|
|
1632
1632
|
*/
|
1633
1633
|
get luminance() {
|
1634
1634
|
const { r: t, g: e, b: s } = this;
|
1635
|
-
let
|
1636
|
-
return t <= 0.03928 ?
|
1635
|
+
let r = 0, n = 0, i = 0;
|
1636
|
+
return t <= 0.03928 ? r = t / 12.92 : r = ((t + 0.055) / 1.055) ** 2.4, e <= 0.03928 ? n = e / 12.92 : n = ((e + 0.055) / 1.055) ** 2.4, s <= 0.03928 ? i = s / 12.92 : i = ((s + 0.055) / 1.055) ** 2.4, 0.2126 * r + 0.7152 * n + 0.0722 * i;
|
1637
1637
|
}
|
1638
1638
|
/**
|
1639
1639
|
* Returns the perceived brightness of the colour.
|
@@ -1646,25 +1646,25 @@ class y {
|
|
1646
1646
|
* Returns the web colour name closest to the current colour.
|
1647
1647
|
*/
|
1648
1648
|
get name() {
|
1649
|
-
const { r: t, g: e, b: s } = this.toRgb(), [
|
1649
|
+
const { r: t, g: e, b: s } = this.toRgb(), [r] = $t.map(([n, i]) => {
|
1650
1650
|
const a = (
|
1651
1651
|
// ((rgb.r - r) ** 2 + (rgb.g - g) ** 2 + (rgb.b - b) ** 2) ** 0.5; // standard
|
1652
1652
|
(((i.r - t) * 0.3) ** 2 + ((i.g - e) * 0.6) ** 2 + ((i.b - s) * 0.1) ** 2) ** 0.5
|
1653
1653
|
);
|
1654
|
-
return [
|
1655
|
-
}).find(([,
|
1656
|
-
return
|
1654
|
+
return [n, a];
|
1655
|
+
}).find(([, n], i, a) => n === Math.min(...a.map(([, l]) => l)));
|
1656
|
+
return r;
|
1657
1657
|
}
|
1658
1658
|
/**
|
1659
1659
|
* Returns the colour as an RGBA object.
|
1660
1660
|
*/
|
1661
1661
|
toRgb() {
|
1662
|
-
let { r: t, g: e, b: s, a:
|
1663
|
-
return [t, e, s] = [t, e, s].map((
|
1662
|
+
let { r: t, g: e, b: s, a: r } = this;
|
1663
|
+
return [t, e, s] = [t, e, s].map((n) => v(n * 255 * 100) / 100), r = v(r * 100) / 100, {
|
1664
1664
|
r: t,
|
1665
1665
|
g: e,
|
1666
1666
|
b: s,
|
1667
|
-
a:
|
1667
|
+
a: r
|
1668
1668
|
};
|
1669
1669
|
}
|
1670
1670
|
/**
|
@@ -1673,8 +1673,8 @@ class y {
|
|
1673
1673
|
* * rgba(255,255,255,0.5)
|
1674
1674
|
*/
|
1675
1675
|
toRgbString() {
|
1676
|
-
const { r: t, g: e, b: s, a:
|
1677
|
-
return
|
1676
|
+
const { r: t, g: e, b: s, a: r } = this.toRgb(), [n, i, a] = [t, e, s].map(v);
|
1677
|
+
return r === 1 ? `rgb(${n}, ${i}, ${a})` : `rgba(${n}, ${i}, ${a}, ${r})`;
|
1678
1678
|
}
|
1679
1679
|
/**
|
1680
1680
|
* Returns the RGBA values concatenated into a CSS4 Module string format.
|
@@ -1682,16 +1682,16 @@ class y {
|
|
1682
1682
|
* * rgb(255 255 255 / 50%)
|
1683
1683
|
*/
|
1684
1684
|
toRgbCSS4String() {
|
1685
|
-
const { r: t, g: e, b: s, a:
|
1686
|
-
return `rgb(${
|
1685
|
+
const { r: t, g: e, b: s, a: r } = this.toRgb(), [n, i, a] = [t, e, s].map(v), l = r === 1 ? "" : ` / ${v(r * 100)}%`;
|
1686
|
+
return `rgb(${n} ${i} ${a}${l})`;
|
1687
1687
|
}
|
1688
1688
|
/**
|
1689
1689
|
* Returns the hexadecimal value of the colour. When the parameter is *true*
|
1690
1690
|
* it will find a 3 characters shorthand of the decimal value.
|
1691
1691
|
*/
|
1692
1692
|
toHex(t) {
|
1693
|
-
const { r: e, g: s, b:
|
1694
|
-
return
|
1693
|
+
const { r: e, g: s, b: r, a: n } = this.toRgb();
|
1694
|
+
return n === 1 ? re(e, s, r, t) : Nt(e, s, r, n, t);
|
1695
1695
|
}
|
1696
1696
|
/**
|
1697
1697
|
* Returns the CSS valid hexadecimal vaue of the colour. When the parameter is *true*
|
@@ -1704,8 +1704,8 @@ class y {
|
|
1704
1704
|
* Returns the HEX8 value of the colour.
|
1705
1705
|
*/
|
1706
1706
|
toHex8(t) {
|
1707
|
-
const { r: e, g: s, b:
|
1708
|
-
return
|
1707
|
+
const { r: e, g: s, b: r, a: n } = this.toRgb();
|
1708
|
+
return Nt(e, s, r, n, t);
|
1709
1709
|
}
|
1710
1710
|
/**
|
1711
1711
|
* Returns the HEX8 value of the colour.
|
@@ -1717,24 +1717,24 @@ class y {
|
|
1717
1717
|
* Returns the colour as a HSVA object.
|
1718
1718
|
*/
|
1719
1719
|
toHsv() {
|
1720
|
-
const { r: t, g: e, b: s, a:
|
1720
|
+
const { r: t, g: e, b: s, a: r } = this, { h: n, s: i, v: a } = se(t, e, s);
|
1721
1721
|
return {
|
1722
|
-
h:
|
1722
|
+
h: n,
|
1723
1723
|
s: i,
|
1724
1724
|
v: a,
|
1725
|
-
a:
|
1725
|
+
a: r
|
1726
1726
|
};
|
1727
1727
|
}
|
1728
1728
|
/**
|
1729
1729
|
* Returns the colour as an HSLA object.
|
1730
1730
|
*/
|
1731
1731
|
toHsl() {
|
1732
|
-
const { r: t, g: e, b: s, a:
|
1732
|
+
const { r: t, g: e, b: s, a: r } = this, { h: n, s: i, l: a } = ee(t, e, s);
|
1733
1733
|
return {
|
1734
|
-
h:
|
1734
|
+
h: n,
|
1735
1735
|
s: i,
|
1736
1736
|
l: a,
|
1737
|
-
a:
|
1737
|
+
a: r
|
1738
1738
|
};
|
1739
1739
|
}
|
1740
1740
|
/**
|
@@ -1743,8 +1743,8 @@ class y {
|
|
1743
1743
|
* * `hsla(150, 100%, 50%, 0.5)`
|
1744
1744
|
*/
|
1745
1745
|
toHslString() {
|
1746
|
-
let { h: t, s: e, l: s, a:
|
1747
|
-
return t = v(t * 360), e = v(e * 100), s = v(s * 100),
|
1746
|
+
let { h: t, s: e, l: s, a: r } = this.toHsl();
|
1747
|
+
return t = v(t * 360), e = v(e * 100), s = v(s * 100), r = v(r * 100) / 100, r === 1 ? `hsl(${t}, ${e}%, ${s}%)` : `hsla(${t}, ${e}%, ${s}%, ${r})`;
|
1748
1748
|
}
|
1749
1749
|
/**
|
1750
1750
|
* Returns the HSLA values concatenated into a CSS4 Module format string.
|
@@ -1752,31 +1752,31 @@ class y {
|
|
1752
1752
|
* * `hsl(150deg 100% 50% / 50%)`
|
1753
1753
|
*/
|
1754
1754
|
toHslCSS4String() {
|
1755
|
-
let { h: t, s: e, l: s, a:
|
1756
|
-
t = v(t * 360), e = v(e * 100), s = v(s * 100),
|
1757
|
-
const
|
1758
|
-
return `hsl(${t}deg ${e}% ${s}%${
|
1755
|
+
let { h: t, s: e, l: s, a: r } = this.toHsl();
|
1756
|
+
t = v(t * 360), e = v(e * 100), s = v(s * 100), r = v(r * 100);
|
1757
|
+
const n = r < 100 ? ` / ${v(r)}%` : "";
|
1758
|
+
return `hsl(${t}deg ${e}% ${s}%${n})`;
|
1759
1759
|
}
|
1760
1760
|
/**
|
1761
1761
|
* Returns the colour as an HWBA object.
|
1762
1762
|
*/
|
1763
1763
|
toHwb() {
|
1764
|
-
const { r: t, g: e, b: s, a:
|
1764
|
+
const { r: t, g: e, b: s, a: r } = this, { h: n, w: i, b: a } = oe(t, e, s);
|
1765
1765
|
return {
|
1766
|
-
h:
|
1766
|
+
h: n,
|
1767
1767
|
w: i,
|
1768
1768
|
b: a,
|
1769
|
-
a:
|
1769
|
+
a: r
|
1770
1770
|
};
|
1771
1771
|
}
|
1772
1772
|
/**
|
1773
1773
|
* Returns the HWBA values concatenated into a string.
|
1774
1774
|
*/
|
1775
1775
|
toHwbString() {
|
1776
|
-
let { h: t, w: e, b: s, a:
|
1777
|
-
t = v(t * 360), e = v(e * 100), s = v(s * 100),
|
1778
|
-
const
|
1779
|
-
return `hwb(${t}deg ${e}% ${s}%${
|
1776
|
+
let { h: t, w: e, b: s, a: r } = this.toHwb();
|
1777
|
+
t = v(t * 360), e = v(e * 100), s = v(s * 100), r = v(r * 100);
|
1778
|
+
const n = r < 100 ? ` / ${v(r)}%` : "";
|
1779
|
+
return `hwb(${t}deg ${e}% ${s}%${n})`;
|
1780
1780
|
}
|
1781
1781
|
/**
|
1782
1782
|
* Sets the alpha value of the current colour.
|
@@ -1790,8 +1790,8 @@ class y {
|
|
1790
1790
|
saturate(t) {
|
1791
1791
|
if (typeof t != "number")
|
1792
1792
|
return this;
|
1793
|
-
const { h: e, s, l:
|
1794
|
-
return Object.assign(this, { r, g: i, b: a }), this;
|
1793
|
+
const { h: e, s, l: r } = this.toHsl(), { r: n, g: i, b: a } = lt(e, ut(s + t / 100), r);
|
1794
|
+
return Object.assign(this, { r: n, g: i, b: a }), this;
|
1795
1795
|
}
|
1796
1796
|
/**
|
1797
1797
|
* Desaturate the colour with a given amount.
|
@@ -1812,8 +1812,8 @@ class y {
|
|
1812
1812
|
lighten(t) {
|
1813
1813
|
if (typeof t != "number")
|
1814
1814
|
return this;
|
1815
|
-
const { h: e, s, l:
|
1816
|
-
return Object.assign(this, { r, g: i, b: a }), this;
|
1815
|
+
const { h: e, s, l: r } = this.toHsl(), { r: n, g: i, b: a } = lt(e, s, ut(r + t / 100));
|
1816
|
+
return Object.assign(this, { r: n, g: i, b: a }), this;
|
1817
1817
|
}
|
1818
1818
|
/**
|
1819
1819
|
* Decrease the colour lightness with a given amount.
|
@@ -1828,8 +1828,8 @@ class y {
|
|
1828
1828
|
spin(t) {
|
1829
1829
|
if (typeof t != "number")
|
1830
1830
|
return this;
|
1831
|
-
const { h: e, s, l:
|
1832
|
-
return Object.assign(this, { r, g: i, b: a }), this;
|
1831
|
+
const { h: e, s, l: r } = this.toHsl(), { r: n, g: i, b: a } = lt(ut((e * 360 + t) % 360 / 360), s, r);
|
1832
|
+
return Object.assign(this, { r: n, g: i, b: a }), this;
|
1833
1833
|
}
|
1834
1834
|
/** Returns a clone of the current `Color` instance. */
|
1835
1835
|
clone() {
|
@@ -1843,7 +1843,7 @@ class y {
|
|
1843
1843
|
return e === "hex" ? this.toHexString(t) : e === "hsl" ? this.toHslString() : e === "hwb" ? this.toHwbString() : this.toRgbString();
|
1844
1844
|
}
|
1845
1845
|
}
|
1846
|
-
class
|
1846
|
+
class Kt {
|
1847
1847
|
static Color = y;
|
1848
1848
|
hue;
|
1849
1849
|
hueSteps;
|
@@ -1858,36 +1858,36 @@ class It {
|
|
1858
1858
|
* * `args.saturation` Saturation [0, 100]
|
1859
1859
|
*/
|
1860
1860
|
constructor(...t) {
|
1861
|
-
let e = 0, s = 12,
|
1861
|
+
let e = 0, s = 12, r = 10, n = [0.5], i = 100;
|
1862
1862
|
if (t.length === 4)
|
1863
|
-
[e, s,
|
1863
|
+
[e, s, r, i] = t;
|
1864
1864
|
else if (t.length === 3)
|
1865
|
-
[e, s,
|
1866
|
-
else if (t.length === 2 && ([s,
|
1865
|
+
[e, s, r] = t;
|
1866
|
+
else if (t.length === 2 && ([s, r] = t, [s, r].some((g) => g < 1)))
|
1867
1867
|
throw TypeError("ColorPalette: the two minimum arguments must be numbers higher than 0.");
|
1868
|
-
const a = [], l = 360 / s, c = y.roundPart((
|
1868
|
+
const a = [], l = 360 / s, c = y.roundPart((r - (r % 2 ? 1 : 0)) / 2), h = [0.25, 0.2, 0.15, 0.11, 0.09, 0.075], b = [
|
1869
1869
|
[1, 2, 3],
|
1870
1870
|
[4, 5],
|
1871
1871
|
[6, 7],
|
1872
1872
|
[8, 9],
|
1873
1873
|
[10, 11],
|
1874
1874
|
[12, 13]
|
1875
|
-
], u = b.find((g) => g.includes(
|
1875
|
+
], u = b.find((g) => g.includes(r)), d = u ? h[b.indexOf(u)] : 100 / (r + (r % 2 ? 0 : 1)) / 100;
|
1876
1876
|
for (let g = 1; g < c + 1; g += 1)
|
1877
|
-
|
1878
|
-
for (let g = 1; g <
|
1879
|
-
|
1877
|
+
n = [...n, 0.5 + d * g];
|
1878
|
+
for (let g = 1; g < r - c; g += 1)
|
1879
|
+
n = [0.5 - d * g, ...n];
|
1880
1880
|
for (let g = 0; g < s; g += 1) {
|
1881
1881
|
const p = (e + g * l) % 360 / 360;
|
1882
|
-
|
1882
|
+
n.forEach((f) => {
|
1883
1883
|
const w = new y({ h: p, s: 1, l: f });
|
1884
1884
|
a.push(i < 100 ? w.saturate(i - 100) : w);
|
1885
1885
|
});
|
1886
1886
|
}
|
1887
|
-
this.hue = e, this.hueSteps = s, this.lightSteps =
|
1887
|
+
this.hue = e, this.hueSteps = s, this.lightSteps = r, this.saturation = i, this.colors = a;
|
1888
1888
|
}
|
1889
1889
|
}
|
1890
|
-
const
|
1890
|
+
const Vt = {
|
1891
1891
|
pickerLabel: "Colour Picker",
|
1892
1892
|
appearanceLabel: "Colour Appearance",
|
1893
1893
|
valueLabel: "Colour Value",
|
@@ -1905,7 +1905,7 @@ const He = {
|
|
1905
1905
|
redLabel: "Red",
|
1906
1906
|
greenLabel: "Green",
|
1907
1907
|
blueLabel: "Blue"
|
1908
|
-
},
|
1908
|
+
}, mt = [
|
1909
1909
|
"white",
|
1910
1910
|
"black",
|
1911
1911
|
"grey",
|
@@ -1923,7 +1923,7 @@ const He = {
|
|
1923
1923
|
"violet",
|
1924
1924
|
"magenta",
|
1925
1925
|
"pink"
|
1926
|
-
],
|
1926
|
+
], ie = (o) => {
|
1927
1927
|
if (!V(o))
|
1928
1928
|
return !1;
|
1929
1929
|
try {
|
@@ -1932,14 +1932,14 @@ const He = {
|
|
1932
1932
|
return !1;
|
1933
1933
|
}
|
1934
1934
|
return !0;
|
1935
|
-
},
|
1936
|
-
const { format: t, id: e, componentLabels: s } = o,
|
1935
|
+
}, Bt = "v-hidden", uo = (o) => {
|
1936
|
+
const { format: t, id: e, componentLabels: s } = o, r = x({
|
1937
1937
|
tagName: "div",
|
1938
1938
|
className: `color-form ${t}`
|
1939
1939
|
});
|
1940
|
-
let
|
1941
|
-
return t === "rgb" ?
|
1942
|
-
const [a] = t === "hex" ? ["#"] :
|
1940
|
+
let n = ["hex"];
|
1941
|
+
return t === "rgb" ? n = ["red", "green", "blue", "alpha"] : t === "hsl" ? n = ["hue", "saturation", "lightness", "alpha"] : t === "hwb" && (n = ["hue", "whiteness", "blackness", "alpha"]), n.forEach((i) => {
|
1942
|
+
const [a] = t === "hex" ? ["#"] : de(i).split(""), l = `color_${t}_${i}_${e}`, c = s[`${i}Label`], h = x({ tagName: "label" });
|
1943
1943
|
m(h, "for", l), h.append(
|
1944
1944
|
x({
|
1945
1945
|
tagName: "span",
|
@@ -1948,7 +1948,7 @@ const He = {
|
|
1948
1948
|
}),
|
1949
1949
|
x({
|
1950
1950
|
tagName: "span",
|
1951
|
-
className:
|
1951
|
+
className: Bt,
|
1952
1952
|
innerText: c
|
1953
1953
|
})
|
1954
1954
|
);
|
@@ -1967,11 +1967,11 @@ const He = {
|
|
1967
1967
|
min: "0",
|
1968
1968
|
max: u,
|
1969
1969
|
step: d
|
1970
|
-
}),
|
1971
|
-
}),
|
1970
|
+
}), r.append(h, b);
|
1971
|
+
}), r;
|
1972
1972
|
}, bo = (o) => {
|
1973
|
-
const { format: t, componentLabels: e } = o, { hueLabel: s, alphaLabel:
|
1974
|
-
let u = t === "hsl" ? `${s} & ${
|
1973
|
+
const { format: t, componentLabels: e } = o, { hueLabel: s, alphaLabel: r, lightnessLabel: n, saturationLabel: i, whitenessLabel: a, blacknessLabel: l } = e, c = t === "hsl" ? 360 : 100, h = t === "hsl" ? 100 : 360, b = 100;
|
1974
|
+
let u = t === "hsl" ? `${s} & ${n}` : `${n} & ${i}`;
|
1975
1975
|
u = t === "hwb" ? `${a} & ${l}` : u;
|
1976
1976
|
const d = t === "hsl" ? `${i}` : `${s}`, g = x({
|
1977
1977
|
tagName: "div",
|
@@ -1995,7 +1995,7 @@ const He = {
|
|
1995
1995
|
{
|
1996
1996
|
i: 3,
|
1997
1997
|
c: f,
|
1998
|
-
l:
|
1998
|
+
l: r,
|
1999
1999
|
min: 0,
|
2000
2000
|
max: b
|
2001
2001
|
}
|
@@ -2023,8 +2023,8 @@ const He = {
|
|
2023
2023
|
});
|
2024
2024
|
E.append(A), g.append(E);
|
2025
2025
|
}), g;
|
2026
|
-
},
|
2027
|
-
const { input: s, format:
|
2026
|
+
}, ae = (o, t, e) => {
|
2027
|
+
const { input: s, format: r, componentLabels: n } = o, { defaultsLabel: i, presetsLabel: a } = n, l = e === "color-options", c = t instanceof Kt, h = l ? a : i, b = c ? t.colors : t, u = b.length, { lightSteps: d } = c ? t : { lightSteps: null }, g = d || [9, 10].find((A) => u >= A * 2 && !(u % A)) || 5, p = l && u > g;
|
2028
2028
|
let f = 2;
|
2029
2029
|
f = p && u > g * 2 ? 3 : f, f = p && u > g * 3 ? 4 : f, f = p && u > g * 4 ? 5 : f;
|
2030
2030
|
const w = f - (u <= g * 3 ? 1 : 2), $ = p && u > w * g;
|
@@ -2039,7 +2039,7 @@ const He = {
|
|
2039
2039
|
role: "listbox",
|
2040
2040
|
ariaLabel: h
|
2041
2041
|
});
|
2042
|
-
return $ &&
|
2042
|
+
return $ && D(E, {
|
2043
2043
|
"--grid-item-size": `${S}rem`,
|
2044
2044
|
"--grid-fit": `${g}`,
|
2045
2045
|
"--grid-gap": L,
|
@@ -2048,21 +2048,21 @@ const He = {
|
|
2048
2048
|
}), b.forEach((A) => {
|
2049
2049
|
let [F, tt] = typeof A == "string" ? A.trim().split(":") : [];
|
2050
2050
|
A instanceof y && (F = A.toHexString(), tt = F);
|
2051
|
-
const
|
2051
|
+
const Gt = new y(A instanceof y ? A : F, r).toString() === xt(s, "value"), Pt = x({
|
2052
2052
|
tagName: "li",
|
2053
|
-
className: `color-option${
|
2053
|
+
className: `color-option${Gt ? " active" : ""}`,
|
2054
2054
|
innerText: `${tt || F}`,
|
2055
2055
|
tabIndex: 0,
|
2056
2056
|
role: "option",
|
2057
|
-
ariaSelected:
|
2057
|
+
ariaSelected: Gt ? "true" : "false"
|
2058
2058
|
});
|
2059
|
-
m(
|
2059
|
+
m(Pt, "data-value", `${F}`), l && D(Pt, { backgroundColor: F }), E.append(Pt);
|
2060
2060
|
}), E;
|
2061
2061
|
}, po = (o) => {
|
2062
|
-
const { input: t, parent: e, format: s, id:
|
2062
|
+
const { input: t, parent: e, format: s, id: r, componentLabels: n, colorKeywords: i, colorPresets: a } = o, l = xt(t, "value") || "#fff", { nonColors: c } = y, { toggleLabel: h, pickerLabel: b, formatLabel: u, hexLabel: d } = n, g = c.includes(l) ? "#fff" : l;
|
2063
2063
|
o.color = new y(g, s);
|
2064
|
-
const p = s === "hex" ? d :
|
2065
|
-
id: `picker-btn-${
|
2064
|
+
const p = s === "hex" ? d : de(s), f = x({
|
2065
|
+
id: `picker-btn-${r}`,
|
2066
2066
|
tagName: "button",
|
2067
2067
|
className: "picker-toggle btn-appearance",
|
2068
2068
|
ariaExpanded: "false",
|
@@ -2071,7 +2071,7 @@ const He = {
|
|
2071
2071
|
f.append(
|
2072
2072
|
x({
|
2073
2073
|
tagName: "span",
|
2074
|
-
className:
|
2074
|
+
className: Bt,
|
2075
2075
|
innerText: `${b}. ${u}: ${p}`
|
2076
2076
|
})
|
2077
2077
|
);
|
@@ -2079,70 +2079,72 @@ const He = {
|
|
2079
2079
|
tagName: "div",
|
2080
2080
|
className: "color-dropdown picker",
|
2081
2081
|
role: "group",
|
2082
|
-
ariaLabelledBy: `picker-btn-${
|
2082
|
+
ariaLabelledBy: `picker-btn-${r}`
|
2083
2083
|
}), $ = bo(o), P = uo(o);
|
2084
2084
|
if (w.append($, P), t.before(f), e.append(w), i || a) {
|
2085
2085
|
const L = x({
|
2086
2086
|
tagName: "div",
|
2087
2087
|
className: "color-dropdown scrollable menu"
|
2088
2088
|
});
|
2089
|
-
a && L.append(
|
2089
|
+
a && L.append(ae(o, a, "color-options")), i && i.length && L.append(ae(o, i, "color-defaults"));
|
2090
2090
|
const S = x({
|
2091
2091
|
tagName: "button",
|
2092
2092
|
className: "menu-toggle btn-appearance",
|
2093
2093
|
tabIndex: -1,
|
2094
2094
|
ariaExpanded: "false",
|
2095
2095
|
ariaHasPopup: "true"
|
2096
|
-
}), C = encodeURI("http://www.w3.org/2000/svg"), M =
|
2096
|
+
}), C = encodeURI("http://www.w3.org/2000/svg"), M = Tt(C, {
|
2097
2097
|
tagName: "svg"
|
2098
2098
|
});
|
2099
2099
|
m(M, "xmlns", C), m(M, "viewBox", "0 0 512 512"), m(M, Me, "true");
|
2100
|
-
const E =
|
2100
|
+
const E = Tt(C, {
|
2101
2101
|
tagName: "path"
|
2102
2102
|
});
|
2103
2103
|
m(E, "d", "M98,158l157,156L411,158l27,27L255,368L71,185L98,158z"), m(E, "fill", "#fff"), M.append(E), S.append(
|
2104
2104
|
x({
|
2105
2105
|
tagName: "span",
|
2106
|
-
className:
|
2106
|
+
className: Bt,
|
2107
2107
|
innerText: `${h}`
|
2108
2108
|
}),
|
2109
2109
|
M
|
2110
2110
|
), e.append(S, L);
|
2111
2111
|
}
|
2112
2112
|
i && c.includes(l) && (o.value = l), m(t, Y, "-1");
|
2113
|
-
}, fo = "2.0.0-
|
2114
|
-
componentLabels:
|
2115
|
-
colorLabels:
|
2113
|
+
}, fo = "2.0.0-alpha3", Z = "color-picker", mo = `[data-function="${Z}"]`, le = `.${Z}`, vo = {
|
2114
|
+
componentLabels: Vt,
|
2115
|
+
colorLabels: mt,
|
2116
2116
|
format: "rgb",
|
2117
2117
|
colorPresets: !1,
|
2118
2118
|
colorKeywords: !1
|
2119
|
-
}, { roundPart: k, nonColors: bt } = y, wo = (o) => Qe(o, Z), $o = (o) => new ko(o),
|
2120
|
-
const e = t ?
|
2121
|
-
e(s,
|
2122
|
-
},
|
2123
|
-
const e = t ?
|
2124
|
-
e(o.controls, Ie, o.pointerDown), o.controlKnobs.forEach((l) => e(l,
|
2125
|
-
},
|
2119
|
+
}, { roundPart: k, nonColors: bt } = y, wo = (o) => Qe(o, Z), $o = (o) => new ko(o), ce = (o, t) => {
|
2120
|
+
const e = t ? ue : jt, { input: s, pickerToggle: r, menuToggle: n } = o;
|
2121
|
+
e(s, Oe, o.showPicker), e(r, Mt, o.togglePicker), n && e(n, Mt, o.toggleMenu);
|
2122
|
+
}, He = (o, t) => {
|
2123
|
+
const e = t ? ue : jt, { input: s, colorMenu: r, parent: n } = o, i = K(s), a = ao(i);
|
2124
|
+
e(o.controls, Ie, o.pointerDown), o.controlKnobs.forEach((l) => e(l, _t, o.handleKnobs)), e(a, Be, o.handleScroll), e(a, Ve, o.update), [s, ...o.inputs].forEach((l) => e(l, Te, o.changeHandler)), r && (e(r, Mt, o.menuClickHandler), e(r, _t, o.menuKeyHandler)), e(i, be, o.pointerMove), e(i, Ke, o.pointerUp), e(n, De, o.handleFocusOut), e(i, Fe, o.handleDismiss);
|
2125
|
+
}, he = (o) => {
|
2126
2126
|
eo(o.input, new CustomEvent("colorpicker.change"));
|
2127
2127
|
}, Ee = (o) => {
|
2128
|
-
o && ["bottom", "top"].forEach((t) =>
|
2128
|
+
o && ["bottom", "top"].forEach((t) => O(o, t));
|
2129
2129
|
}, Ht = (o, t) => {
|
2130
|
-
const { colorPicker: e, colorMenu: s, menuToggle:
|
2131
|
-
T(i, "open") || q(i, "open"), l && (
|
2130
|
+
const { colorPicker: e, colorMenu: s, menuToggle: r, pickerToggle: n, parent: i } = o, a = t === e, l = a ? s : e, c = a ? r : n, h = a ? n : r;
|
2131
|
+
T(i, "open") || q(i, "open"), l && (O(l, "show"), Ee(l)), q(t, "bottom"), no(t), q(t, "show"), a && o.update(), o.isOpen || (He(o, !0), o.updateDropdownPosition(), o.isOpen = !0, m(o.input, Y, "0"), r && m(r, Y, "0")), m(h, Et, "true"), c && m(c, Et, "false");
|
2132
2132
|
};
|
2133
2133
|
class ko {
|
2134
2134
|
// bring utils to staic
|
2135
2135
|
static Color = y;
|
2136
|
-
static ColorPalette =
|
2136
|
+
static ColorPalette = Kt;
|
2137
2137
|
static getInstance = wo;
|
2138
2138
|
static init = $o;
|
2139
2139
|
static selector = mo;
|
2140
2140
|
// utils important for render
|
2141
2141
|
static roundPart = k;
|
2142
|
-
static setElementStyle =
|
2142
|
+
static setElementStyle = D;
|
2143
2143
|
static setAttribute = m;
|
2144
2144
|
static getBoundingClientRect = gt;
|
2145
2145
|
static version = fo;
|
2146
|
+
static colorNames = mt;
|
2147
|
+
static colorPickerLabels = Vt;
|
2146
2148
|
id;
|
2147
2149
|
input;
|
2148
2150
|
color;
|
@@ -2177,37 +2179,37 @@ class ko {
|
|
2177
2179
|
if (V(t) && !s)
|
2178
2180
|
throw new TypeError(`ColorPicker target "${t}" cannot be found.`);
|
2179
2181
|
this.input = s;
|
2180
|
-
const
|
2181
|
-
if (!
|
2182
|
+
const r = me(s, le);
|
2183
|
+
if (!r)
|
2182
2184
|
throw new TypeError("ColorPicker requires a specific markup to work.");
|
2183
|
-
this.parent =
|
2185
|
+
this.parent = r, this.id = fe(s, Z), this.dragElement = void 0, this.isOpen = !1, this.controlPositions = {
|
2184
2186
|
c1x: 0,
|
2185
2187
|
c1y: 0,
|
2186
2188
|
c2y: 0,
|
2187
2189
|
c3y: 0
|
2188
2190
|
}, this.colorLabels = {}, this.colorKeywords = !1, this.colorPresets = !1;
|
2189
|
-
const { format:
|
2191
|
+
const { format: n, componentLabels: i, colorLabels: a, colorKeywords: l, colorPresets: c } = ro(
|
2190
2192
|
s,
|
2191
2193
|
vo,
|
2192
2194
|
e || {}
|
2193
2195
|
);
|
2194
|
-
let h =
|
2195
|
-
|
2196
|
+
let h = mt;
|
2197
|
+
At(a) && a.length === 17 ? h = a : V(a) && a.split(",").length === 17 && (h = a.split(",")), mt.forEach((p, f) => {
|
2196
2198
|
this.colorLabels[p] = h[f].trim();
|
2197
2199
|
});
|
2198
|
-
const b = V(i) &&
|
2199
|
-
if (this.componentLabels = B({ ...
|
2200
|
+
const b = V(i) && ie(i) ? JSON.parse(i) : i;
|
2201
|
+
if (this.componentLabels = B({ ...Vt }, b), this.color = new y(s.value || "#fff", n), this.format = n, At(l) && l.length ? this.colorKeywords = l : V(l) && l.length && (this.colorKeywords = l.split(",").map((p) => p.trim())), At(c) && c.length)
|
2200
2202
|
this.colorPresets = c;
|
2201
|
-
else if (c &&
|
2203
|
+
else if (c && ie(c)) {
|
2202
2204
|
const { hue: p, hueSteps: f, lightSteps: w, saturation: $ } = JSON.parse(c);
|
2203
|
-
this.colorPresets = new
|
2205
|
+
this.colorPresets = new Kt(p, f, w, $);
|
2204
2206
|
} else
|
2205
2207
|
V(c) && (this.colorPresets = c.split(",").map((p) => p.trim()));
|
2206
|
-
|
2207
|
-
const [u, d] =
|
2208
|
-
this.pickerToggle = _(".picker-toggle",
|
2209
|
-
const [g] =
|
2210
|
-
this.controls = g, this.controlKnobs = [...
|
2208
|
+
po(this);
|
2209
|
+
const [u, d] = rt("color-dropdown", r);
|
2210
|
+
this.pickerToggle = _(".picker-toggle", r), this.menuToggle = _(".menu-toggle", r), this.colorPicker = u, this.colorMenu = d, this.inputs = [...rt("color-input", r)];
|
2211
|
+
const [g] = rt("color-controls", r);
|
2212
|
+
this.controls = g, this.controlKnobs = [...rt("knob", g)], this.visuals = [...rt("visual-control", g)], this.update(), ce(this, !0), ct.set(s, Z, this);
|
2211
2213
|
}
|
2212
2214
|
/** Returns the current colour value */
|
2213
2215
|
get value() {
|
@@ -2265,7 +2267,7 @@ class ko {
|
|
2265
2267
|
}
|
2266
2268
|
/** Returns the colour appearance, usually the closest colour name for the current value. */
|
2267
2269
|
get appearance() {
|
2268
|
-
const { colorLabels: t, hsl: e, hsv: s, format:
|
2270
|
+
const { colorLabels: t, hsl: e, hsv: s, format: r } = this, n = k(e.h * 360), i = r === "hsl" ? e.s : s.s, a = k(i * 100), l = k(e.l * 100), c = s.v * 100;
|
2269
2271
|
let h = "black";
|
2270
2272
|
if (l === 100 && a === 0)
|
2271
2273
|
h = t.white;
|
@@ -2273,20 +2275,20 @@ class ko {
|
|
2273
2275
|
h = t.black;
|
2274
2276
|
else if (a === 0)
|
2275
2277
|
h = t.grey;
|
2276
|
-
else if (
|
2278
|
+
else if (n < 15 || n >= 345)
|
2277
2279
|
h = t.red;
|
2278
|
-
else if (
|
2280
|
+
else if (n >= 15 && n < 45)
|
2279
2281
|
h = c > 80 && a > 80 ? t.orange : t.brown;
|
2280
|
-
else if (
|
2281
|
-
const b =
|
2282
|
+
else if (n >= 45 && n < 75) {
|
2283
|
+
const b = n > 46 && n < 54 && c < 80 && a > 90, u = n >= 54 && n < 75 && c < 80;
|
2282
2284
|
h = b ? t.gold : t.yellow, h = u ? t.olive : h;
|
2283
2285
|
} else
|
2284
|
-
|
2286
|
+
n >= 75 && n < 155 ? h = c < 68 ? t.green : t.lime : n >= 155 && n < 175 ? h = t.teal : n >= 175 && n < 195 ? h = t.cyan : n >= 195 && n < 255 ? h = t.blue : n >= 255 && n < 270 ? h = t.violet : n >= 270 && n < 295 ? h = t.magenta : n >= 295 && n < 345 && (h = t.pink);
|
2285
2287
|
return h;
|
2286
2288
|
}
|
2287
2289
|
/** Updates `ColorPicker` visuals. */
|
2288
2290
|
updateVisuals() {
|
2289
|
-
const { controlPositions: t, visuals: e } = this, [s,
|
2291
|
+
const { controlPositions: t, visuals: e } = this, [s, r, n] = e, { offsetHeight: i } = s, a = t.c2y / i, { r: l, g: c, b: h } = new y({ h: a, s: 1, l: 0.5 }).toRgb(), b = "linear-gradient(rgb(255,255,255) 0%, rgb(255,255,255) 100%)", u = 1 - t.c3y / i, d = k(u * 100) / 100, g = new y({
|
2290
2292
|
h: a,
|
2291
2293
|
s: 1,
|
2292
2294
|
l: 0.5,
|
@@ -2296,11 +2298,11 @@ class ko {
|
|
2296
2298
|
rgb(0,255,0) 33.33%, rgb(0,255,255) 50%,
|
2297
2299
|
rgb(0,0,255) 66.67%, rgb(255,0,255) 83.33%,
|
2298
2300
|
rgb(255,0,0) 100%)`;
|
2299
|
-
|
2301
|
+
D(s, {
|
2300
2302
|
background: `linear-gradient(rgba(0,0,0,0) 0%, rgba(0,0,0,${d}) 100%),
|
2301
2303
|
linear-gradient(to right, rgba(255,255,255,${d}) 0%, ${g} 100%),
|
2302
2304
|
${b}`
|
2303
|
-
}),
|
2305
|
+
}), D(r, { background: p }), D(n, {
|
2304
2306
|
background: `linear-gradient(rgba(${l},${c},${h},1) 0%,rgba(${l},${c},${h},0) 100%)`
|
2305
2307
|
});
|
2306
2308
|
}
|
@@ -2310,49 +2312,49 @@ class ko {
|
|
2310
2312
|
* @param e
|
2311
2313
|
* @this {ColorPicker}
|
2312
2314
|
*/
|
2313
|
-
handleFocusOut({ relatedTarget: t }) {
|
2315
|
+
handleFocusOut = ({ relatedTarget: t }) => {
|
2314
2316
|
t && !this.parent.contains(t) && this.hide(!0);
|
2315
|
-
}
|
2317
|
+
};
|
2316
2318
|
/**
|
2317
2319
|
* The `ColorPicker` *keyup* event listener when open.
|
2318
2320
|
*
|
2319
2321
|
* @param e
|
2320
2322
|
* @this {ColorPicker}
|
2321
2323
|
*/
|
2322
|
-
handleDismiss({ code: t }) {
|
2324
|
+
handleDismiss = ({ code: t }) => {
|
2323
2325
|
this.isOpen && t === ze && this.hide();
|
2324
|
-
}
|
2326
|
+
};
|
2325
2327
|
/**
|
2326
2328
|
* The `ColorPicker` *scroll* event listener when open.
|
2327
2329
|
*
|
2328
2330
|
* @param e
|
2329
2331
|
* @this {ColorPicker}
|
2330
2332
|
*/
|
2331
|
-
handleScroll(t) {
|
2333
|
+
handleScroll = (t) => {
|
2332
2334
|
const { activeElement: e } = K(this.input);
|
2333
|
-
this.updateDropdownPosition(), ([
|
2334
|
-
}
|
2335
|
+
this.updateDropdownPosition(), ([be, je].includes(t.type) && this.dragElement || e && this.controlKnobs.includes(e)) && (t.stopPropagation(), t.preventDefault());
|
2336
|
+
};
|
2335
2337
|
/**
|
2336
2338
|
* The `ColorPicker` keyboard event listener for menu navigation.
|
2337
2339
|
*
|
2338
2340
|
* @param e
|
2339
2341
|
*/
|
2340
|
-
menuKeyHandler(t) {
|
2341
|
-
const { target: e, code: s } = t, { previousElementSibling:
|
2342
|
-
[j, st,
|
2343
|
-
}
|
2342
|
+
menuKeyHandler = (t) => {
|
2343
|
+
const { target: e, code: s } = t, { previousElementSibling: r, nextElementSibling: n, parentElement: i } = e, a = i && T(i, "color-options"), l = i ? [...i.children] : [], c = a && Rt(i, "grid-template-columns").split(" ").length, h = l.indexOf(e), b = h > -1 && c && l[h - c], u = h > -1 && c && l[h + c];
|
2344
|
+
[j, st, Wt].includes(s) && t.preventDefault(), a ? b && s === st ? U(b) : u && s === j ? U(u) : r && s === ht ? U(r) : n && s === G && U(n) : r && [ht, st].includes(s) ? U(r) : n && [G, j].includes(s) && U(n), [qe, Wt].includes(s) && this.menuClickHandler(t);
|
2345
|
+
};
|
2344
2346
|
/**
|
2345
2347
|
* The `ColorPicker` click event listener for the colour menu presets / defaults.
|
2346
2348
|
*
|
2347
2349
|
* @param e
|
2348
2350
|
* @this {ColorPicker}
|
2349
2351
|
*/
|
2350
|
-
menuClickHandler(t) {
|
2351
|
-
const { target: e } = t, { colorMenu: s } = this,
|
2352
|
-
if (!
|
2352
|
+
menuClickHandler = (t) => {
|
2353
|
+
const { target: e } = t, { colorMenu: s } = this, r = (xt(e, "data-value") || "").trim();
|
2354
|
+
if (!r.length)
|
2353
2355
|
return;
|
2354
|
-
const
|
2355
|
-
let i =
|
2356
|
+
const n = _("li.active", s);
|
2357
|
+
let i = r;
|
2356
2358
|
i = bt.includes(i) ? "white" : i, i = i === "transparent" ? "rgba(0,0,0,0)" : i;
|
2357
2359
|
const { r: a, g: l, b: c, a: h } = new y(i);
|
2358
2360
|
B(this.color, {
|
@@ -2360,54 +2362,54 @@ class ko {
|
|
2360
2362
|
g: l,
|
2361
2363
|
b: c,
|
2362
2364
|
a: h
|
2363
|
-
}), this.update(),
|
2364
|
-
}
|
2365
|
+
}), this.update(), n !== e && (n && (O(n, "active"), Ct(n, St)), q(e, "active"), m(e, St, "true"), bt.includes(r) && (this.value = r), he(this));
|
2366
|
+
};
|
2365
2367
|
/**
|
2366
2368
|
* The `ColorPicker` *touchstart* / *mousedown* events listener for control knobs.
|
2367
2369
|
*
|
2368
2370
|
* @param e
|
2369
2371
|
*/
|
2370
|
-
pointerDown(t) {
|
2371
|
-
const { target: e, pageX: s, pageY:
|
2372
|
-
if (e === l || e === b ? (this.dragElement = g, this.changeControl1(w, $)) : e === c || e === u ? (this.dragElement = g, this.changeControl2($)) : (e === h || e === d) && (this.dragElement = g, this.changeAlpha($)),
|
2373
|
-
const P = _("li.active",
|
2374
|
-
P && (
|
2372
|
+
pointerDown = (t) => {
|
2373
|
+
const { target: e, pageX: s, pageY: r } = t, { colorMenu: n, visuals: i, controlKnobs: a } = this, [l, c, h] = i, [b, u, d] = a, g = a.includes(e) ? e.previousElementSibling : e, p = gt(g), f = Lt(l), w = s - f.scrollLeft - p.left, $ = r - f.scrollTop - p.top;
|
2374
|
+
if (e === l || e === b ? (this.dragElement = g, this.changeControl1(w, $)) : e === c || e === u ? (this.dragElement = g, this.changeControl2($)) : (e === h || e === d) && (this.dragElement = g, this.changeAlpha($)), n) {
|
2375
|
+
const P = _("li.active", n);
|
2376
|
+
P && (O(P, "active"), Ct(P, St));
|
2375
2377
|
}
|
2376
2378
|
t.preventDefault();
|
2377
|
-
}
|
2379
|
+
};
|
2378
2380
|
/**
|
2379
2381
|
* The `ColorPicker` *touchend* / *mouseup* events listener for control knobs.
|
2380
2382
|
*
|
2381
2383
|
* @param e
|
2382
2384
|
* @this
|
2383
2385
|
*/
|
2384
|
-
pointerUp({ target: t }) {
|
2385
|
-
const { parent: e } = this, s = K(e),
|
2386
|
-
!this.dragElement && (!
|
2387
|
-
}
|
2386
|
+
pointerUp = ({ target: t }) => {
|
2387
|
+
const { parent: e } = this, s = K(e), r = _(`${le}.open`, s) !== null, n = s.getSelection();
|
2388
|
+
!this.dragElement && (!n || !n.toString().length) && !e.contains(t) && this.hide(r), this.dragElement = void 0;
|
2389
|
+
};
|
2388
2390
|
/**
|
2389
2391
|
* The `ColorPicker` *touchmove* / *mousemove* events listener for control knobs.
|
2390
2392
|
*
|
2391
2393
|
* @param {PointerEvent} e
|
2392
2394
|
*/
|
2393
|
-
pointerMove(t) {
|
2394
|
-
const { dragElement: e, visuals: s } = this, [
|
2395
|
+
pointerMove = (t) => {
|
2396
|
+
const { dragElement: e, visuals: s } = this, [r, n, i] = s, { pageX: a, pageY: l } = t;
|
2395
2397
|
if (!e)
|
2396
2398
|
return;
|
2397
|
-
const c = gt(e), h =
|
2398
|
-
e ===
|
2399
|
-
}
|
2399
|
+
const c = gt(e), h = Lt(r), b = a - h.scrollLeft - c.left, u = l - h.scrollTop - c.top;
|
2400
|
+
e === r && this.changeControl1(b, u), e === n && this.changeControl2(u), e === i && this.changeAlpha(u);
|
2401
|
+
};
|
2400
2402
|
/**
|
2401
2403
|
* The `ColorPicker` *keydown* event listener for control knobs.
|
2402
2404
|
*
|
2403
2405
|
* @param e
|
2404
2406
|
*/
|
2405
|
-
handleKnobs(t) {
|
2407
|
+
handleKnobs = (t) => {
|
2406
2408
|
const { target: e, code: s } = t;
|
2407
2409
|
if (![st, j, ht, G].includes(s))
|
2408
2410
|
return;
|
2409
2411
|
t.preventDefault();
|
2410
|
-
const { controlKnobs:
|
2412
|
+
const { controlKnobs: r, visuals: n } = this, { offsetWidth: i, offsetHeight: a } = n[0], [l, c, h] = r, { activeElement: b } = K(l), u = r.find((g) => g === b), d = a / 360;
|
2411
2413
|
if (u) {
|
2412
2414
|
let g = 0, p = 0;
|
2413
2415
|
if (e === l) {
|
@@ -2417,13 +2419,13 @@ class ko {
|
|
2417
2419
|
e === c ? (this.controlPositions.c2y += [j, G].includes(s) ? d : -d, p = this.controlPositions.c2y, this.changeControl2(p)) : e === h && (this.controlPositions.c3y += [j, G].includes(s) ? d : -d, p = this.controlPositions.c3y, this.changeAlpha(p));
|
2418
2420
|
this.handleScroll(t);
|
2419
2421
|
}
|
2420
|
-
}
|
2422
|
+
};
|
2421
2423
|
/** The event listener of the colour form inputs. */
|
2422
|
-
changeHandler() {
|
2424
|
+
changeHandler = () => {
|
2423
2425
|
let t;
|
2424
|
-
const { inputs: e, format: s, value:
|
2425
|
-
if (l ===
|
2426
|
-
l ===
|
2426
|
+
const { inputs: e, format: s, value: r, input: n, controlPositions: i, visuals: a } = this, { activeElement: l } = K(n), { offsetHeight: c } = a[0], [h, , , b] = e, [u, d, g, p] = s === "rgb" ? e.map(($) => parseFloat($.value) / ($ === b ? 100 : 1)) : e.map(($) => parseFloat($.value) / ($ !== h ? 100 : 360)), f = this.hasNonColor && bt.includes(r), w = b ? p : 1 - i.c3y / c;
|
2427
|
+
if (l === n || l && e.includes(l)) {
|
2428
|
+
l === n ? f ? t = r === "transparent" ? "rgba(0,0,0,0)" : "rgb(0,0,0)" : t = r : s === "hex" ? t = h.value : s === "hsl" ? t = {
|
2427
2429
|
h: u,
|
2428
2430
|
s: d,
|
2429
2431
|
l: g,
|
@@ -2445,9 +2447,9 @@ class ko {
|
|
2445
2447
|
g: P,
|
2446
2448
|
b: L,
|
2447
2449
|
a: S
|
2448
|
-
}), this.setControlPositions(), this.updateAppearance(), this.updateInputs(), this.updateControls(), this.updateVisuals(), l ===
|
2450
|
+
}), this.setControlPositions(), this.updateAppearance(), this.updateInputs(), this.updateControls(), this.updateVisuals(), l === n && f && (this.value = r);
|
2449
2451
|
}
|
2450
|
-
}
|
2452
|
+
};
|
2451
2453
|
/**
|
2452
2454
|
* Updates `ColorPicker` first control:
|
2453
2455
|
* * `lightness` and `saturation` for HEX/RGB;
|
@@ -2457,10 +2459,10 @@ class ko {
|
|
2457
2459
|
* @param Y the Y component of the offset
|
2458
2460
|
*/
|
2459
2461
|
changeControl1(t, e) {
|
2460
|
-
let [s,
|
2461
|
-
const { controlPositions:
|
2462
|
-
t > l ? s = l : t >= 0 && (s = t), e > a ?
|
2463
|
-
const c =
|
2462
|
+
let [s, r] = [0, 0];
|
2463
|
+
const { controlPositions: n, visuals: i } = this, { offsetHeight: a, offsetWidth: l } = i[0];
|
2464
|
+
t > l ? s = l : t >= 0 && (s = t), e > a ? r = a : e >= 0 && (r = e);
|
2465
|
+
const c = n.c2y / a, h = s / l, b = 1 - r / a, u = 1 - n.c3y / a, { r: d, g, b: p, a: f } = new y({
|
2464
2466
|
h: c,
|
2465
2467
|
s: h,
|
2466
2468
|
v: b,
|
@@ -2471,7 +2473,7 @@ class ko {
|
|
2471
2473
|
g,
|
2472
2474
|
b: p,
|
2473
2475
|
a: f
|
2474
|
-
}), this.controlPositions.c1x = s, this.controlPositions.c1y =
|
2476
|
+
}), this.controlPositions.c1x = s, this.controlPositions.c1y = r, this.updateAppearance(), this.updateInputs(), this.updateControls(), this.updateVisuals();
|
2475
2477
|
}
|
2476
2478
|
/**
|
2477
2479
|
* Updates `ColorPicker` second control:
|
@@ -2481,10 +2483,10 @@ class ko {
|
|
2481
2483
|
* @param Y the Y offset
|
2482
2484
|
*/
|
2483
2485
|
changeControl2(t) {
|
2484
|
-
const { controlPositions: e, visuals: s } = this, { offsetHeight:
|
2486
|
+
const { controlPositions: e, visuals: s } = this, { offsetHeight: r, offsetWidth: n } = s[0];
|
2485
2487
|
let i = 0;
|
2486
|
-
t >
|
2487
|
-
const a = i /
|
2488
|
+
t > r ? i = r : t >= 0 && (i = t);
|
2489
|
+
const a = i / r, l = e.c1x / n, c = 1 - e.c1y / r, h = 1 - e.c3y / r, { r: b, g: u, b: d, a: g } = new y({
|
2488
2490
|
h: a,
|
2489
2491
|
s: l,
|
2490
2492
|
v: c,
|
@@ -2505,56 +2507,56 @@ class ko {
|
|
2505
2507
|
*/
|
2506
2508
|
changeAlpha(t) {
|
2507
2509
|
const { visuals: e } = this, { offsetHeight: s } = e[0];
|
2508
|
-
let
|
2509
|
-
t > s ?
|
2510
|
-
const
|
2511
|
-
this.color.setAlpha(
|
2510
|
+
let r = 0;
|
2511
|
+
t > s ? r = s : t >= 0 && (r = t);
|
2512
|
+
const n = 1 - r / s;
|
2513
|
+
this.color.setAlpha(n), this.controlPositions.c3y = r, this.updateAppearance(), this.updateInputs(), this.updateControls(), this.updateVisuals();
|
2512
2514
|
}
|
2513
2515
|
/**
|
2514
2516
|
* Updates `ColorPicker` control positions on:
|
2515
2517
|
* * initialization
|
2516
2518
|
* * window resize
|
2517
2519
|
*/
|
2518
|
-
update() {
|
2520
|
+
update = () => {
|
2519
2521
|
this.updateDropdownPosition(), this.updateAppearance(), this.setControlPositions(), this.updateInputs(!0), this.updateControls(), this.updateVisuals();
|
2520
|
-
}
|
2522
|
+
};
|
2521
2523
|
/** Updates the open dropdown position on *scroll* event. */
|
2522
2524
|
updateDropdownPosition() {
|
2523
|
-
const { input: t, colorPicker: e, colorMenu: s } = this,
|
2525
|
+
const { input: t, colorPicker: e, colorMenu: s } = this, r = gt(t), { top: n, bottom: i } = r, { offsetHeight: a } = t, l = Lt(t).clientHeight, h = T(e, "show") ? e : s;
|
2524
2526
|
if (!h)
|
2525
2527
|
return;
|
2526
|
-
const { offsetHeight: b } = h, u = l - i, d =
|
2527
|
-
(T(h, "bottom") || !p) && u < d && g ? (
|
2528
|
+
const { offsetHeight: b } = h, u = l - i, d = n, g = n + b + a > l, p = n - b < 0;
|
2529
|
+
(T(h, "bottom") || !p) && u < d && g ? (O(h, "bottom"), q(h, "top")) : (O(h, "top"), q(h, "bottom"));
|
2528
2530
|
}
|
2529
2531
|
/** Updates control knobs' positions. */
|
2530
2532
|
setControlPositions() {
|
2531
|
-
const { visuals: t, color: e, hsv: s } = this, { offsetHeight:
|
2532
|
-
this.controlPositions.c1x = l *
|
2533
|
+
const { visuals: t, color: e, hsv: s } = this, { offsetHeight: r, offsetWidth: n } = t[0], i = e.a, a = s.h, l = s.s, c = s.v;
|
2534
|
+
this.controlPositions.c1x = l * n, this.controlPositions.c1y = (1 - c) * r, this.controlPositions.c2y = a * r, this.controlPositions.c3y = (1 - i) * r;
|
2533
2535
|
}
|
2534
2536
|
/** Update the visual appearance label and control knob labels. */
|
2535
2537
|
updateAppearance() {
|
2536
|
-
const { componentLabels: t, color: e, parent: s, hsv:
|
2538
|
+
const { componentLabels: t, color: e, parent: s, hsv: r, hex: n, format: i, controlKnobs: a } = this, { appearanceLabel: l, hexLabel: c, valueLabel: h } = t;
|
2537
2539
|
let { r: b, g: u, b: d } = e.toRgb();
|
2538
|
-
const [g, p, f] = a, w = k(
|
2539
|
-
let C = `${c} ${
|
2540
|
+
const [g, p, f] = a, w = k(r.h * 360), $ = e.a, P = k(r.s * 100), L = k(r.v * 100), S = this.appearance;
|
2541
|
+
let C = `${c} ${n.split("").join(" ")}`;
|
2540
2542
|
if (i === "hwb") {
|
2541
2543
|
const { hwb: A } = this, F = k(A.w * 100), tt = k(A.b * 100);
|
2542
|
-
C = `HWB: ${w}°, ${F}%, ${tt}%`, m(g, ot, `${F}% & ${tt}%`), m(g, et, `${F}`), m(p,
|
2544
|
+
C = `HWB: ${w}°, ${F}%, ${tt}%`, m(g, ot, `${F}% & ${tt}%`), m(g, et, `${F}`), m(p, Ut, `${h}: ${C}. ${l}: ${S}.`), m(p, ot, `${w}%`), m(p, et, `${w}`);
|
2543
2545
|
} else
|
2544
|
-
[b, u, d] = [b, u, d].map(k), C = i === "hsl" ? `HSL: ${w}°, ${P}%, ${L}%` : C, C = i === "rgb" ? `RGB: ${b}, ${u}, ${d}` : C, m(g, ot, `${L}% & ${P}%`), m(g, et, `${L}`), m(p,
|
2546
|
+
[b, u, d] = [b, u, d].map(k), C = i === "hsl" ? `HSL: ${w}°, ${P}%, ${L}%` : C, C = i === "rgb" ? `RGB: ${b}, ${u}, ${d}` : C, m(g, ot, `${L}% & ${P}%`), m(g, et, `${L}`), m(p, Ut, `${h}: ${C}. ${l}: ${S}.`), m(p, ot, `${w}°`), m(p, et, `${w}`);
|
2545
2547
|
const M = k($ * 100);
|
2546
2548
|
m(f, ot, `${M}%`), m(f, et, `${M}`);
|
2547
2549
|
const E = e.toString();
|
2548
|
-
|
2550
|
+
D(this.input, { backgroundColor: E }), this.isDark ? (T(s, "txt-light") && O(s, "txt-light"), T(s, "txt-dark") || q(s, "txt-dark")) : (T(s, "txt-dark") && O(s, "txt-dark"), T(s, "txt-light") || q(s, "txt-light"));
|
2549
2551
|
}
|
2550
2552
|
/** Updates the control knobs actual positions. */
|
2551
2553
|
updateControls() {
|
2552
2554
|
const { controlKnobs: t, controlPositions: e } = this;
|
2553
|
-
let { c1x: s, c1y:
|
2555
|
+
let { c1x: s, c1y: r, c2y: n, c3y: i } = e;
|
2554
2556
|
const [a, l, c] = t;
|
2555
|
-
[s,
|
2556
|
-
transform: `translate3d(${s - 4}px,${
|
2557
|
-
}),
|
2557
|
+
[s, r, n, i] = [s, r, n, i].map(k), D(a, {
|
2558
|
+
transform: `translate3d(${s - 4}px,${r - 4}px,0)`
|
2559
|
+
}), D(l, { transform: `translate3d(0,${n - 4}px,0)` }), D(c, { transform: `translate3d(0,${i - 4}px,0)` });
|
2558
2560
|
}
|
2559
2561
|
/**
|
2560
2562
|
* Updates all color form inputs.
|
@@ -2562,8 +2564,8 @@ class ko {
|
|
2562
2564
|
* @param isPrevented when `true`, the component original event is prevented
|
2563
2565
|
*/
|
2564
2566
|
updateInputs(t) {
|
2565
|
-
const { value: e, format: s, inputs:
|
2566
|
-
let d =
|
2567
|
+
const { value: e, format: s, inputs: r, color: n, hsl: i } = this, [a, l, c, h] = r, b = k(n.a * 100), u = k(i.h * 360);
|
2568
|
+
let d = n.toString();
|
2567
2569
|
if (s === "hex")
|
2568
2570
|
d = this.color.toHexString(!0), a.value = this.hex;
|
2569
2571
|
else if (s === "hsl") {
|
@@ -2576,34 +2578,34 @@ class ko {
|
|
2576
2578
|
let { r: g, g: p, b: f } = this.rgb;
|
2577
2579
|
[g, p, f] = [g, p, f].map(k), d = this.color.toRgbString(), a.value = `${g}`, l.value = `${p}`, c.value = `${f}`, h.value = `${b}`;
|
2578
2580
|
}
|
2579
|
-
this.value = d, !t && d !== e &&
|
2581
|
+
this.value = d, !t && d !== e && he(this);
|
2580
2582
|
}
|
2581
2583
|
/**
|
2582
2584
|
* Toggle the `ColorPicker` dropdown visibility.
|
2583
2585
|
*
|
2584
2586
|
* @param e
|
2585
2587
|
*/
|
2586
|
-
togglePicker(t) {
|
2588
|
+
togglePicker = (t) => {
|
2587
2589
|
t && t.preventDefault();
|
2588
2590
|
const { colorPicker: e } = this;
|
2589
2591
|
this.isOpen && T(e, "show") ? this.hide(!0) : Ht(this, e);
|
2590
|
-
}
|
2592
|
+
};
|
2591
2593
|
/** Shows the `ColorPicker` dropdown. */
|
2592
|
-
showPicker() {
|
2594
|
+
showPicker = () => {
|
2593
2595
|
const { colorPicker: t } = this;
|
2594
2596
|
["top", "bottom"].some((e) => T(t, e)) || Ht(this, t);
|
2595
|
-
}
|
2597
|
+
};
|
2596
2598
|
/**
|
2597
2599
|
* Toggles the visibility of the `ColorPicker` presets menu.
|
2598
2600
|
*
|
2599
2601
|
* @param e
|
2600
2602
|
* @this {ColorPicker}
|
2601
2603
|
*/
|
2602
|
-
toggleMenu(t) {
|
2604
|
+
toggleMenu = (t) => {
|
2603
2605
|
t && t.preventDefault();
|
2604
2606
|
const { colorMenu: e } = this;
|
2605
2607
|
this.isOpen && T(e, "show") ? this.hide(!0) : Ht(this, e);
|
2606
|
-
}
|
2608
|
+
};
|
2607
2609
|
/**
|
2608
2610
|
* Hides the currently open `ColorPicker` dropdown.
|
2609
2611
|
*
|
@@ -2611,18 +2613,18 @@ class ko {
|
|
2611
2613
|
*/
|
2612
2614
|
hide(t) {
|
2613
2615
|
if (this.isOpen) {
|
2614
|
-
const { pickerToggle: e, menuToggle: s, colorPicker:
|
2615
|
-
this.value = this.color.toString(!0), c && (
|
2616
|
-
Ee(c), _(".show", i) || (
|
2616
|
+
const { pickerToggle: e, menuToggle: s, colorPicker: r, colorMenu: n, parent: i, input: a } = this, l = T(r, "show"), c = l ? r : n, h = l ? e : s, b = c && oo(c);
|
2617
|
+
this.value = this.color.toString(!0), c && (O(c, "show"), m(h, Et, "false"), setTimeout(() => {
|
2618
|
+
Ee(c), _(".show", i) || (O(i, "open"), He(this), this.isOpen = !1);
|
2617
2619
|
}, b)), t || U(e), m(a, Y, "-1"), h === s && m(s, Y, "-1");
|
2618
2620
|
}
|
2619
2621
|
}
|
2620
2622
|
/** Removes `ColorPicker` from target `<input>`. */
|
2621
2623
|
dispose() {
|
2622
2624
|
const { input: t, parent: e } = this;
|
2623
|
-
this.hide(!0),
|
2625
|
+
this.hide(!0), ce(this), [...e.children].forEach((s) => {
|
2624
2626
|
s !== t && s.remove();
|
2625
|
-
}),
|
2627
|
+
}), Ct(t, Y), D(t, { backgroundColor: "" }), ["txt-light", "txt-dark"].forEach((s) => O(e, s)), ct.remove(t, Z);
|
2626
2628
|
}
|
2627
2629
|
}
|
2628
2630
|
export {
|