@thednp/color-picker 2.0.2 → 2.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. package/README.md +25 -14
  2. package/dist/css/color-picker.css +3 -6
  3. package/dist/css/color-picker.css.map +1 -0
  4. package/dist/css/color-picker.min.css +1 -2
  5. package/dist/css/color-picker.min.css.map +1 -0
  6. package/dist/css/color-picker.rtl.css +3 -6
  7. package/dist/css/color-picker.rtl.css.map +1 -0
  8. package/dist/css/color-picker.rtl.min.css +1 -2
  9. package/dist/css/color-picker.rtl.min.css.map +1 -0
  10. package/dist/js/color-picker.cjs +2 -2
  11. package/dist/js/color-picker.cjs.map +1 -1
  12. package/dist/js/color-picker.d.ts +307 -300
  13. package/dist/js/color-picker.js +2 -2
  14. package/dist/js/color-picker.js.map +1 -1
  15. package/dist/js/color-picker.mjs +369 -332
  16. package/dist/js/color-picker.mjs.map +1 -1
  17. package/package.json +36 -44
  18. package/.eslintrc.cjs +0 -199
  19. package/.lgtm.yml +0 -9
  20. package/.prettierrc.json +0 -15
  21. package/.stylelintrc.json +0 -236
  22. package/compile.cjs +0 -51
  23. package/dts.config.ts +0 -15
  24. package/src/scss/_variables.scss +0 -6
  25. package/src/scss/color-picker.rtl.scss +0 -27
  26. package/src/scss/color-picker.scss +0 -536
  27. package/src/ts/colorPalette.ts +0 -89
  28. package/src/ts/index.ts +0 -1237
  29. package/src/ts/interface/ColorNames.ts +0 -20
  30. package/src/ts/interface/colorPickerLabels.ts +0 -20
  31. package/src/ts/interface/colorPickerOptions.ts +0 -11
  32. package/src/ts/interface/paletteOptions.ts +0 -6
  33. package/src/ts/util/colorNames.ts +0 -21
  34. package/src/ts/util/colorPickerLabels.ts +0 -24
  35. package/src/ts/util/getColorControls.ts +0 -90
  36. package/src/ts/util/getColorForm.ts +0 -75
  37. package/src/ts/util/getColorMenu.ts +0 -83
  38. package/src/ts/util/isValidJSON.ts +0 -19
  39. package/src/ts/util/setMarkup.ts +0 -130
  40. package/src/ts/util/vHidden.ts +0 -2
  41. package/test/color-palette.test.ts +0 -137
  42. package/test/color-picker.test.ts +0 -705
  43. package/test/fixtures/colorNamesFrench.js +0 -3
  44. package/test/fixtures/componentLabelsFrench.js +0 -21
  45. package/test/fixtures/format.js +0 -3
  46. package/test/fixtures/getMarkup.js +0 -36
  47. package/test/fixtures/getRandomInt.js +0 -6
  48. package/test/fixtures/sampleWebcolors.js +0 -18
  49. package/test/fixtures/swipe.ts +0 -33
  50. package/test/fixtures/testSample.js +0 -8
  51. package/test/fixtures/write.ts +0 -37
  52. package/tsconfig.json +0 -47
  53. package/vite.config.mts +0 -27
  54. package/vitest.config-ui.ts +0 -26
  55. package/vitest.config.ts +0 -26
@@ -1,149 +1,89 @@
1
- const _t = "aria-description", Nt = "aria-expanded", Te = "aria-hidden", xt = "aria-selected", tt = "aria-valuenow", et = "aria-valuetext", Me = "change", Re = "DOMContentLoaded", Oe = "focusin", De = "focusout", zt = "keydown", Fe = "keyup", Et = "click", Ie = "pointerdown", be = "pointermove", Ke = "pointerup", Ve = "resize", Be = "scroll", je = "touchmove", j = "ArrowDown", ot = "ArrowUp", ht = "ArrowLeft", U = "ArrowRight", qe = "Enter", Ge = "Escape", Jt = "Space", Ue = "transitionDuration", We = "transitionProperty", X = "tabindex", _e = navigator.userAgentData, mt = _e, { userAgent: ze } = navigator, vt = ze, Xt = /iPhone|iPad|iPod|Android/i;
2
- /* istanbul ignore else @preserve */
3
- mt ? mt.brands.some((o) => Xt.test(o.brand)) : Xt.test(vt);
4
- const Yt = /(iPhone|iPod|iPad)/;
5
- mt ? mt.brands.some((o) => Yt.test(o.brand)) : (
6
- /* istanbul ignore next @preserve */
7
- Yt.test(vt)
8
- );
9
- vt && vt.includes("Firefox");
10
- const { head: wt } = document;
11
- ["webkitPerspective", "perspective"].some((o) => o in wt.style);
12
- const Bt = (o, t, e, s) => {
1
+ const jt = "aria-description", Lt = "aria-expanded", Ae = "aria-hidden", wt = "aria-selected", tt = "aria-valuenow", et = "aria-valuetext", He = "change", Ne = "focusin", Ee = "focusout", qt = "keydown", Te = "keyup", At = "click", Me = "pointerdown", ie = "pointermove", Re = "pointerup", Oe = "resize", De = "scroll", Fe = "touchmove", B = "ArrowDown", ot = "ArrowUp", ht = "ArrowLeft", W = "ArrowRight", Ie = "Enter", Ve = "Escape", Gt = "Space", Ke = "transitionDuration", Be = "transitionProperty", Z = "tabindex", ae = (o, t, e, s) => {
13
2
  const r = s || !1;
14
- o.addEventListener(t, e, r);
15
- }, jt = (o, t, e, s) => {
3
+ o.addEventListener(
4
+ t,
5
+ e,
6
+ r
7
+ );
8
+ }, le = (o, t, e, s) => {
16
9
  const r = s || !1;
17
- o.removeEventListener(t, e, r);
18
- }, Je = (o, t, e, s) => {
19
- const r = (n) => {
20
- /* istanbul ignore else @preserve */
21
- (n.target === o || n.currentTarget === o) && (e.apply(o, [n]), jt(o, t, r, s));
22
- };
23
- Bt(o, t, r, s);
24
- }, Xe = () => {
25
- };
26
- (() => {
27
- let o = !1;
28
- try {
29
- const t = Object.defineProperty({}, "passive", {
30
- get: () => (o = !0, o)
31
- });
32
- Je(document, Re, Xe, t);
33
- } catch {
34
- }
35
- return o;
36
- })();
37
- ["webkitTransform", "transform"].some((o) => o in wt.style);
38
- ["webkitAnimation", "animation"].some((o) => o in wt.style);
39
- ["webkitTransition", "transition"].some((o) => o in wt.style);
40
- const kt = (o, t) => o.getAttribute(t), v = (o, t, e) => o.setAttribute(t, e), Pt = (o, t) => o.removeAttribute(t), q = (o, ...t) => {
10
+ o.removeEventListener(
11
+ t,
12
+ e,
13
+ r
14
+ );
15
+ }, vt = (o, t) => o.getAttribute(t), v = (o, t, e) => o.setAttribute(t, e), kt = (o, t) => o.removeAttribute(t), j = (o, ...t) => {
41
16
  o.classList.add(...t);
42
17
  }, O = (o, ...t) => {
43
18
  o.classList.remove(...t);
44
- }, R = (o, t) => o.classList.contains(t), qt = (o) => o != null && typeof o == "object" || !1, Z = (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) => Z(o) && o.nodeType === 1 || !1, z = /* @__PURE__ */ new Map(), ct = {
45
- data: z,
46
- /**
47
- * Sets web components data.
48
- *
49
- * @param element target element
50
- * @param component the component's name or a unique key
51
- * @param instance the component instance
52
- */
19
+ }, R = (o, t) => o.classList.contains(t), It = (o) => o != null && typeof o == "object" || !1, ct = (o) => It(o) && typeof o.nodeType == "number" && [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11].some(
20
+ (t) => o.nodeType === t
21
+ ) || !1, z = (o) => ct(o) && o.nodeType === 1 || !1, X = /* @__PURE__ */ new Map(), lt = {
22
+ data: X,
53
23
  set: (o, t, e) => {
54
- at(o) && (z.has(t) || z.set(t, /* @__PURE__ */ new Map()), z.get(t).set(o, e));
24
+ z(o) && (X.has(t) || X.set(t, /* @__PURE__ */ new Map()), X.get(t).set(o, e));
55
25
  },
56
- /**
57
- * Returns all instances for specified component.
58
- *
59
- * @param component the component's name or a unique key
60
- * @returns all the component instances
61
- */
62
- getAllFor: (o) => z.get(o) || null,
63
- /**
64
- * Returns the instance associated with the target.
65
- *
66
- * @param element target element
67
- * @param component the component's name or a unique key
68
- * @returns the instance
69
- */
26
+ getAllFor: (o) => X.get(o) || null,
70
27
  get: (o, t) => {
71
- if (!at(o) || !t) return null;
72
- const e = ct.getAllFor(t);
28
+ if (!z(o) || !t) return null;
29
+ const e = lt.getAllFor(t);
73
30
  return o && e && e.get(o) || null;
74
31
  },
75
- /**
76
- * Removes web components data.
77
- *
78
- * @param element target element
79
- * @param component the component's name or a unique key
80
- */
81
32
  remove: (o, t) => {
82
- const e = ct.getAllFor(t);
83
- !e || !at(o) || (e.delete(o), e.size === 0 && z.delete(t));
33
+ const e = lt.getAllFor(t);
34
+ !e || !z(o) || (e.delete(o), e.size === 0 && X.delete(t));
84
35
  }
85
- }, Ye = (o, t) => ct.get(o, t), B = (o) => typeof o == "string" || !1, Ze = (o) => qt(o) && o.constructor.name === "Window" || !1, pe = (o) => Z(o) && o.nodeType === 9 || !1, V = (o) => Ze(o) ? o.document : pe(o) ? o : Z(o) ? o.ownerDocument : window.document, K = (o, ...t) => Object.assign(o, ...t), x = (o) => {
36
+ }, je = (o, t) => lt.get(o, t), qe = (o) => o?.trim().replace(
37
+ /(?:^\w|[A-Z]|\b\w)/g,
38
+ (t, e) => e === 0 ? t.toLowerCase() : t.toUpperCase()
39
+ ).replace(/\s+/g, ""), q = (o) => typeof o == "string" || !1, Ge = (o) => It(o) && o.constructor.name === "Window" || !1, ce = (o) => ct(o) && o.nodeType === 9 || !1, K = (o) => ce(o) ? o : ct(o) ? o.ownerDocument : Ge(o) ? o.document : globalThis.document, V = (o, ...t) => Object.assign(o, ...t), x = (o) => {
86
40
  if (!o) return;
87
- if (B(o))
88
- return V().createElement(o);
41
+ if (q(o))
42
+ return K().createElement(o);
89
43
  const { tagName: t } = o, e = x(t);
90
44
  if (!e) return;
91
45
  const s = { ...o };
92
- return delete s.tagName, K(e, s);
93
- }, Tt = (o, t) => {
46
+ return delete s.tagName, V(e, s);
47
+ }, Ht = (o, t) => {
94
48
  if (!o || !t) return;
95
- if (B(t))
96
- return V().createElementNS(o, t);
97
- const { tagName: e } = t, s = Tt(o, e);
49
+ if (q(t))
50
+ return K().createElementNS(o, t);
51
+ const { tagName: e } = t, s = Ht(o, e);
98
52
  if (!s) return;
99
53
  const r = { ...t };
100
- return delete r.tagName, K(s, r);
101
- }, Qe = (o, t) => o.dispatchEvent(t), Mt = (o, t) => {
102
- const e = getComputedStyle(o), s = t.replace("webkit", "Webkit").replace(/([A-Z])/g, "-$1").toLowerCase();
103
- return e.getPropertyValue(s);
104
- }, to = (o) => {
105
- const t = Mt(o, We), e = Mt(o, Ue), s = e.includes("ms") ? (
106
- /* istanbul ignore next */
107
- 1
108
- ) : 1e3, r = t && t !== "none" ? parseFloat(e) * s : (
109
- /* istanbul ignore next */
110
- 0
111
- );
112
- return Number.isNaN(r) ? (
113
- /* istanbul ignore next */
114
- 0
115
- ) : r;
116
- }, W = (o, t) => o.focus(t), Zt = (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), eo = (o, t, e, s) => {
54
+ return delete r.tagName, V(s, r);
55
+ }, We = (o, t) => o.dispatchEvent(t), Nt = (o, t, e) => {
56
+ const s = getComputedStyle(o, e), r = t.replace("webkit", "Webkit").replace(/([A-Z])/g, "-$1").toLowerCase();
57
+ return s.getPropertyValue(r);
58
+ }, Ue = (o) => {
59
+ const t = Nt(o, Be), e = Nt(o, Ke), s = e.includes("ms") ? 1 : 1e3, r = t && t !== "none" ? parseFloat(e) * s : 0;
60
+ return Number.isNaN(r) ? 0 : r;
61
+ }, U = (o, t) => o.focus(t), Wt = (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), _e = (o, t, e, s) => {
62
+ if (!z(o)) return t;
117
63
  const r = { ...e }, n = { ...o.dataset }, i = { ...t }, a = {}, l = "title";
118
64
  return pt(n).forEach(([c, h]) => {
119
- const b = c;
120
- a[b] = Zt(h);
65
+ const b = qe(c);
66
+ a[b] = Wt(h);
121
67
  }), pt(r).forEach(([c, h]) => {
122
- r[c] = Zt(h);
68
+ r[c] = Wt(h);
123
69
  }), pt(t).forEach(([c, h]) => {
124
- c in r ? i[c] = r[c] : c in a ? i[c] = a[c] : i[c] = c === l ? kt(o, l) : h;
70
+ c in r ? i[c] = r[c] : c in a ? i[c] = a[c] : i[c] = c === l ? vt(o, l) : h;
125
71
  }), i;
126
- }, Qt = (o) => Object.fromEntries(o), oo = (o) => o.offsetHeight, D = (o, t) => {
72
+ }, Ut = (o) => Object.fromEntries(o), ze = (o) => o.offsetHeight, D = (o, t) => {
127
73
  pt(t).forEach(([e, s]) => {
128
- if (s && B(e) && e.includes("--"))
74
+ if (s && q(e) && e.includes("--"))
129
75
  o.style.setProperty(e, s);
130
76
  else {
131
77
  const r = {};
132
- r[e] = s, K(o.style, r);
78
+ r[e] = s, V(o.style, r);
133
79
  }
134
80
  });
135
- }, so = (o) => qt(o) && o.constructor.name === "Map" || !1, de = (o) => o.toUpperCase(), gt = (o, t) => {
81
+ }, Xe = (o) => It(o) && o.constructor.name === "Map" || !1, he = (o) => o.toUpperCase(), ge = (o) => z(o) && "offsetWidth" in o || !1, gt = (o, t) => {
136
82
  const { width: e, height: s, top: r, right: n, bottom: i, left: a } = o.getBoundingClientRect();
137
83
  let l = 1, c = 1;
138
- if (t && at(o)) {
84
+ if (t && ge(o)) {
139
85
  const { offsetWidth: h, offsetHeight: b } = o;
140
- l = h > 0 ? Math.round(e) / h : (
141
- /* istanbul ignore next */
142
- 1
143
- ), c = b > 0 ? Math.round(s) / b : (
144
- /* istanbul ignore next */
145
- 1
146
- );
86
+ l = h > 0 ? Math.round(e) / h : 1, c = b > 0 ? Math.round(s) / b : 1;
147
87
  }
148
88
  return {
149
89
  width: e / l,
@@ -155,28 +95,30 @@ const kt = (o, t) => o.getAttribute(t), v = (o, t, e) => o.setAttribute(t, e), P
155
95
  x: a / l,
156
96
  y: r / c
157
97
  };
158
- }, St = (o) => V(o).documentElement;
159
- let te = 0, ee = 0;
160
- const J = /* @__PURE__ */ new Map(), fe = (o, t) => {
161
- let e = t ? te : ee;
98
+ }, yt = (o) => K(o).documentElement, Je = (o) => o ? ce(o) ? o.defaultView : ct(o) ? o?.ownerDocument?.defaultView : o : window;
99
+ let _t = 0, zt = 0;
100
+ const J = /* @__PURE__ */ new Map(), ue = (o, t) => {
101
+ let e = t ? _t : zt;
162
102
  if (t) {
163
- const s = fe(o), r = J.get(s) || /* @__PURE__ */ new Map();
164
- J.has(s) || J.set(s, r), so(r) && !r.has(t) ? (r.set(t, e), te += 1) : e = r.get(t);
103
+ const s = ue(o), r = J.get(s) || /* @__PURE__ */ new Map();
104
+ J.has(s) || J.set(s, r), Xe(r) && !r.has(t) ? (r.set(t, e), _t += 1) : e = r.get(t);
165
105
  } else {
166
106
  const s = o.id || o;
167
- J.has(s) ? e = J.get(s) : (J.set(s, e), ee += 1);
107
+ J.has(s) ? e = J.get(s) : (J.set(s, e), zt += 1);
168
108
  }
169
109
  return e;
170
- }, ro = (o) => {
171
- var t;
172
- return o ? pe(o) ? o.defaultView : Z(o) ? (t = o?.ownerDocument) == null ? void 0 : t.defaultView : o : window;
173
- }, Ct = (o) => Array.isArray(o) || !1, me = (o, t) => o ? o.closest(t) || // break out of `ShadowRoot`
174
- me(o.getRootNode().host, t) : null, _ = (o, t) => at(o) ? o : (Z(t) ? t : V()).querySelector(o), st = (o, t) => (t && Z(t) ? t : V()).getElementsByClassName(
110
+ }, xt = (o) => Array.isArray(o) || !1, be = (o, t) => !o || !t ? null : o.closest(t) || be(o.getRootNode().host, t) || null, _ = (o, t) => z(o) ? o : (z(t) ? t : K()).querySelector(o), st = (o, t) => (t && ct(t) ? t : K()).getElementsByClassName(
175
111
  o
176
- ), Gt = ["transparent", "currentColor", "inherit", "revert", "initial"], m = (o) => {
112
+ ), Vt = [
113
+ "transparent",
114
+ "currentColor",
115
+ "inherit",
116
+ "revert",
117
+ "initial"
118
+ ], m = (o) => {
177
119
  const t = Math.floor(o);
178
120
  return o - t < 0.5 ? t : Math.round(o);
179
- }, $t = [
121
+ }, mt = [
180
122
  [
181
123
  "aliceblue",
182
124
  {
@@ -1361,13 +1303,13 @@ me(o.getRootNode().host, t) : null, _ = (o, t) => at(o) ? o : (Z(t) ? t : V()).q
1361
1303
  b: 50
1362
1304
  }
1363
1305
  ]
1364
- ], ve = "deg|rad|grad|turn", $e = "[-\\+]?\\d+%?", we = "[-\\+]?\\d*\\.\\d+%?", ke = `[-\\+]?\\d*\\.?\\d+(?:${ve})?`, dt = `(?:${we})|(?:${$e})`, Rt = `(?:${dt})|(?:${ke}?)`, no = "(?:[\\s|\\(\\s|\\s\\(\\s]+)?", io = "(?:[\\s|\\)\\s]+)?", oe = "(?:[,|\\s]+)", ao = "(?:[,|\\/\\s]*)?", rt = `${no}(${Rt})${oe}(${dt})${oe}(${dt})${ao}(${dt})?${io}`, I = {
1365
- CSS_UNIT: new RegExp(Rt),
1366
- ANGLES: ve,
1367
- CSS_ANGLE: ke,
1368
- CSS_INTEGER: $e,
1369
- CSS_NUMBER: we,
1370
- CSS_UNIT2: Rt,
1306
+ ], pe = "deg|rad|grad|turn", de = "[-\\+]?\\d+%?", fe = "[-\\+]?\\d*\\.\\d+%?", me = `[-\\+]?\\d*\\.?\\d+(?:${pe})?`, dt = `(?:${fe})|(?:${de})`, Et = `(?:${dt})|(?:${me}?)`, Ze = "(?:[\\s|\\(\\s|\\s\\(\\s]+)?", Qe = "(?:[\\s|\\)\\s]+)?", Xt = "(?:[,|\\s]+)", Ye = "(?:[,|\\/\\s]*)?", rt = `${Ze}(${Et})${Xt}(${dt})${Xt}(${dt})${Ye}(${dt})?${Qe}`, I = {
1307
+ CSS_UNIT: new RegExp(Et),
1308
+ ANGLES: pe,
1309
+ CSS_ANGLE: me,
1310
+ CSS_INTEGER: de,
1311
+ CSS_NUMBER: fe,
1312
+ CSS_UNIT2: Et,
1371
1313
  PERMISSIVE_MATCH: rt,
1372
1314
  hwb: new RegExp(`hwb${rt}`),
1373
1315
  rgb: new RegExp(`rgb(?:a)?${rt}`),
@@ -1377,16 +1319,16 @@ me(o.getRootNode().host, t) : null, _ = (o, t) => at(o) ? o : (Z(t) ? t : V()).q
1377
1319
  hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
1378
1320
  hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
1379
1321
  hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
1380
- }, ye = (o) => Gt.includes(o), nt = (o, t) => o !== null && typeof o == "object" && Object.keys(t).every((e) => e in o), xe = (o) => `${o}`.includes(".") && parseFloat(o) === 1, Ut = (o) => typeof o == "string" && o.includes("%"), H = (o) => !!I.CSS_UNIT.exec(`${o}`), Pe = ["rgb", "hex", "hsl", "hsv", "hwb"], Se = (o) => Gt.includes(o) || ["#", ...Pe].some((t) => o.includes(t)) ? !1 : $t.some(([t]) => o === t), se = 1e-6, lo = (o, t) => Math.abs(o * t - t) < se ? 1 : o < se ? 0 : o, E = (o, t) => {
1322
+ }, ve = (o) => Vt.includes(o), nt = (o, t) => o !== null && typeof o == "object" && Object.keys(t).every((e) => e in o), $e = (o) => `${o}`.includes(".") && parseFloat(o) === 1, Kt = (o) => typeof o == "string" && o.includes("%"), H = (o) => !!I.CSS_UNIT.exec(`${o}`), we = ["rgb", "hex", "hsl", "hsv", "hwb"], ke = (o) => Vt.includes(o) || ["#", ...we].some((t) => o.includes(t)) ? !1 : mt.some(([t]) => o === t), Jt = 1e-6, to = (o, t) => Math.abs(o * t - t) < Jt ? 1 : o < Jt ? 0 : o, E = (o, t) => {
1381
1323
  let e = o;
1382
- return xe(o) && (e = "100%"), Ut(e) ? Number.parseFloat(e) / 100 : (e = typeof e != "number" ? Number.parseFloat(e) : e, t === 360 ? e = (e < 0 ? e % t + t : e > 360 ? e % t : e) / t : (e = Math.min(t, Math.max(0, e)), e = e / t), lo(e, t));
1383
- }, Ot = (o) => {
1324
+ return $e(o) && (e = "100%"), Kt(e) ? Number.parseFloat(e) / 100 : (e = typeof e != "number" ? Number.parseFloat(e) : e, t === 360 ? e = (e < 0 ? e % t + t : e > 360 ? e % t : e) / t : (e = Math.min(t, Math.max(0, e)), e = e / t), to(e, t));
1325
+ }, Tt = (o) => {
1384
1326
  let t = parseFloat(o);
1385
1327
  return (Number.isNaN(t) || t < 0 || t > 1) && (t = 1), t;
1386
- }, ut = (o) => Math.min(1, Math.max(0, o)), G = (o) => o.length === 1 ? `0${o}` : String(o), Ce = (o) => {
1387
- const [[, t]] = $t.filter(([e]) => e === o.toLowerCase());
1328
+ }, ut = (o) => Math.min(1, Math.max(0, o)), G = (o) => o.length === 1 ? `0${o}` : String(o), ye = (o) => {
1329
+ const [[, t]] = mt.filter(([e]) => e === o.toLowerCase());
1388
1330
  return t;
1389
- }, N = (o) => parseInt(o, 16), Dt = (o) => N(o) / 255, Le = (o) => m(o * 255).toString(16), re = (o, t, e) => {
1331
+ }, N = (o) => parseInt(o, 16), Mt = (o) => N(o) / 255, xe = (o) => m(o * 255).toString(16), Zt = (o, t, e) => {
1390
1332
  const s = Math.max(o, t, e), r = Math.min(o, t, e);
1391
1333
  let n = 0, i = 0;
1392
1334
  const a = (s + r) / 2;
@@ -1400,7 +1342,7 @@ me(o.getRootNode().host, t) : null, _ = (o, t) => at(o) ? o : (Z(t) ? t : V()).q
1400
1342
  }, ft = (o, t, e) => {
1401
1343
  let s = e;
1402
1344
  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;
1403
- }, lt = (o, t, e) => {
1345
+ }, at = (o, t, e) => {
1404
1346
  let s = 0, r = 0, n = 0;
1405
1347
  if (t === 0)
1406
1348
  r = e, n = e, s = e;
@@ -1409,7 +1351,7 @@ me(o.getRootNode().host, t) : null, _ = (o, t) => at(o) ? o : (Z(t) ? t : V()).q
1409
1351
  s = ft(a, i, o + 1 / 3), r = ft(a, i, o), n = ft(a, i, o - 1 / 3);
1410
1352
  }
1411
1353
  return { r: s, g: r, b: n };
1412
- }, ne = (o, t, e) => {
1354
+ }, Qt = (o, t, e) => {
1413
1355
  let s = 0, r = 0;
1414
1356
  const n = Math.min(o, t, e), i = Math.max(o, t, e), a = 1 - i;
1415
1357
  if (i === n) return { h: 0, w: n, b: a };
@@ -1420,45 +1362,45 @@ me(o.getRootNode().host, t) : null, _ = (o, t) => at(o) ? o : (Z(t) ? t : V()).q
1420
1362
  w: n,
1421
1363
  b: a
1422
1364
  };
1423
- }, Ae = (o, t, e) => {
1365
+ }, Se = (o, t, e) => {
1424
1366
  if (t + e >= 1) {
1425
1367
  const i = t / (t + e);
1426
1368
  return { r: i, g: i, b: i };
1427
1369
  }
1428
- let { r: s, g: r, b: n } = lt(o, 1, 0.5);
1370
+ let { r: s, g: r, b: n } = at(o, 1, 0.5);
1429
1371
  return [s, r, n] = [s, r, n].map((i) => i * (1 - t - e) + t), { r: s, g: r, b: n };
1430
- }, ie = (o, t, e) => {
1372
+ }, Yt = (o, t, e) => {
1431
1373
  const s = Math.max(o, t, e), r = Math.min(o, t, e);
1432
1374
  let n = 0;
1433
1375
  const i = s, a = s - r, l = s === 0 ? 0 : a / s;
1434
1376
  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 };
1435
- }, Ft = (o, t, e) => {
1377
+ }, Rt = (o, t, e) => {
1436
1378
  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];
1437
1379
  return { r: u, g: d, b: g };
1438
- }, Lt = (o, t, e, s) => {
1380
+ }, St = (o, t, e, s) => {
1439
1381
  const r = [
1440
1382
  G(m(o).toString(16)),
1441
1383
  G(m(t).toString(16)),
1442
1384
  G(m(e).toString(16))
1443
1385
  ];
1444
1386
  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("");
1445
- }, At = (o, t, e, s, r) => {
1387
+ }, Ct = (o, t, e, s, r) => {
1446
1388
  const n = [
1447
1389
  G(m(o).toString(16)),
1448
1390
  G(m(t).toString(16)),
1449
1391
  G(m(e).toString(16)),
1450
- G(Le(s))
1392
+ G(xe(s))
1451
1393
  ];
1452
1394
  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("");
1453
- }, He = (o) => {
1395
+ }, Ce = (o) => {
1454
1396
  const t = String(o).trim().toLowerCase();
1455
- if (Se(t))
1456
- return Object.assign(Ce(t), {
1397
+ if (ke(t))
1398
+ return Object.assign(ye(t), {
1457
1399
  a: 1,
1458
1400
  format: "rgb",
1459
1401
  ok: !0
1460
1402
  });
1461
- if (ye(t))
1403
+ if (ve(t))
1462
1404
  return {
1463
1405
  r: 0,
1464
1406
  g: 0,
@@ -1500,7 +1442,7 @@ me(o.getRootNode().host, t) : null, _ = (o, t) => at(o) ? o : (Z(t) ? t : V()).q
1500
1442
  r: N(e),
1501
1443
  g: N(s),
1502
1444
  b: N(r),
1503
- a: Dt(n),
1445
+ a: Mt(n),
1504
1446
  format: "hex",
1505
1447
  ok: !0
1506
1448
  } : ([, e, s, r] = I.hex6.exec(t) || [], e && s && r ? {
@@ -1514,7 +1456,7 @@ me(o.getRootNode().host, t) : null, _ = (o, t) => at(o) ? o : (Z(t) ? t : V()).q
1514
1456
  r: N(e + e),
1515
1457
  g: N(s + s),
1516
1458
  b: N(r + r),
1517
- a: Dt(n + n),
1459
+ a: Mt(n + n),
1518
1460
  format: "hex",
1519
1461
  ok: !0
1520
1462
  } : ([, e, s, r] = I.hex3.exec(t) || [], e && s && r ? {
@@ -1532,56 +1474,56 @@ me(o.getRootNode().host, t) : null, _ = (o, t) => at(o) ? o : (Z(t) ? t : V()).q
1532
1474
  format: "rgb",
1533
1475
  ok: !o
1534
1476
  })))))));
1535
- }, co = (o, t, e) => ({
1477
+ }, eo = (o, t, e) => ({
1536
1478
  r: E(o, 255),
1537
1479
  g: E(t, 255),
1538
1480
  b: E(e, 255)
1539
- }), ae = (o) => {
1481
+ }), te = (o) => {
1540
1482
  let t = { r: 0, g: 0, b: 0 }, e = o, s = 1, r, n, i, a, l, c, h, b, u = "rgb", d = !1;
1541
- if ((!e || typeof e == "string") && (e = He(e), d = e.ok || d), nt(e, t) && H(e.r) && H(e.g) && H(e.b)) {
1483
+ if ((!e || typeof e == "string") && (e = Ce(e), d = e.ok || d), nt(e, t) && H(e.r) && H(e.g) && H(e.b)) {
1542
1484
  if (["format", "ok", "originalInput"].every((g) => g in e))
1543
1485
  return { ...e };
1544
- ({ r: h, g: b, b: l } = e), t = co(h, b, l), u = "format" in e ? e.format : "rgb";
1486
+ ({ r: h, g: b, b: l } = e), t = eo(h, b, l), u = "format" in e ? e.format : "rgb";
1545
1487
  }
1546
- return nt(e, { h: 0, s: 0, v: 0 }) && H(e.h) && H(e.s) && H(e.v) && ({ h: c, s: r, v: n } = e, c = E(c, 360), r = E(r, 100), n = E(n, 100), t = Ft(c, r, n), u = "hsv"), nt(e, { h: 0, s: 0, l: 0 }) && H(e.h) && H(e.s) && H(e.l) && ({ h: c, s: r, l: i } = e, c = E(c, 360), r = E(r, 100), i = E(i, 100), t = lt(c, r, i), u = "hsl"), nt(e, { h: 0, w: 0, b: 0 }) && H(e.h) && H(e.w) && H(e.b) && ({ h: c, w: a, b: l } = e, c = E(c, 360), a = E(a, 100), l = E(l, 100), t = Ae(c, a, l), u = "hwb"), H(e.a) && (s = e.a, s = Ut(s) || parseFloat(`${s}`) > 1 ? E(s, 100) : s), {
1488
+ return nt(e, { h: 0, s: 0, v: 0 }) && H(e.h) && H(e.s) && H(e.v) && ({ h: c, s: r, v: n } = e, c = E(c, 360), r = E(r, 100), n = E(n, 100), t = Rt(c, r, n), u = "hsv"), nt(e, { h: 0, s: 0, l: 0 }) && H(e.h) && H(e.s) && H(e.l) && ({ h: c, s: r, l: i } = e, c = E(c, 360), r = E(r, 100), i = E(i, 100), t = at(c, r, i), u = "hsl"), nt(e, { h: 0, w: 0, b: 0 }) && H(e.h) && H(e.w) && H(e.b) && ({ h: c, w: a, b: l } = e, c = E(c, 360), a = E(a, 100), l = E(l, 100), t = Se(c, a, l), u = "hwb"), H(e.a) && (s = e.a, s = Kt(s) || parseFloat(`${s}`) > 1 ? E(s, 100) : s), {
1547
1489
  ...t,
1548
- a: Ot(s),
1490
+ a: Tt(s),
1549
1491
  format: u,
1550
1492
  ok: d
1551
1493
  };
1552
- }, ho = "1.0.11";
1494
+ }, oo = "1.0.13";
1553
1495
  class y {
1554
1496
  // bring main utilities to front
1555
1497
  static matchers = I;
1556
- static isOnePointZero = xe;
1557
- static isPercentage = Ut;
1498
+ static isOnePointZero = $e;
1499
+ static isPercentage = Kt;
1558
1500
  static isValidCSSUnit = H;
1559
- static isNonColor = ye;
1560
- static isColorName = Se;
1501
+ static isNonColor = ve;
1502
+ static isColorName = ke;
1561
1503
  static isColorType = nt;
1562
1504
  static pad2 = G;
1563
1505
  static clamp01 = ut;
1564
1506
  static bound01 = E;
1565
- static boundAlpha = Ot;
1566
- static getRGBFromName = Ce;
1567
- static convertHexToDecimal = Dt;
1568
- static convertDecimalToHex = Le;
1569
- static rgbToHsl = re;
1570
- static rgbToHex = Lt;
1571
- static rgbToHsv = ie;
1572
- static rgbToHwb = ne;
1573
- static rgbaToHex = At;
1574
- static hslToRgb = Ft;
1575
- static hsvToRgb = Ft;
1507
+ static boundAlpha = Tt;
1508
+ static getRGBFromName = ye;
1509
+ static convertHexToDecimal = Mt;
1510
+ static convertDecimalToHex = xe;
1511
+ static rgbToHsl = Zt;
1512
+ static rgbToHex = St;
1513
+ static rgbToHsv = Yt;
1514
+ static rgbToHwb = Qt;
1515
+ static rgbaToHex = Ct;
1516
+ static hslToRgb = Rt;
1517
+ static hsvToRgb = Rt;
1576
1518
  static hueToRgb = ft;
1577
- static hwbToRgb = Ae;
1519
+ static hwbToRgb = Se;
1578
1520
  static parseIntFromHex = N;
1579
- static stringInputToObject = He;
1580
- static inputToRGB = ae;
1521
+ static stringInputToObject = Ce;
1522
+ static inputToRGB = te;
1581
1523
  static roundPart = m;
1582
- static webColors = $t;
1583
- static nonColors = Gt;
1584
- static version = ho;
1524
+ static webColors = mt;
1525
+ static nonColors = Vt;
1526
+ static version = oo;
1585
1527
  // main public properties
1586
1528
  r;
1587
1529
  g;
@@ -1592,7 +1534,7 @@ class y {
1592
1534
  originalInput;
1593
1535
  // main public methods
1594
1536
  constructor(t, e) {
1595
- const s = e && Pe.includes(e) ? e : "", { r, g: n, b: i, a, ok: l, format: c } = ae(t);
1537
+ const s = e && we.includes(e) ? e : "", { r, g: n, b: i, a, ok: l, format: c } = te(t);
1596
1538
  this.originalInput = t, this.r = r, this.g = n, this.b = i, this.a = a, this.ok = l, this.format = s || c;
1597
1539
  }
1598
1540
  /**
@@ -1628,7 +1570,7 @@ class y {
1628
1570
  * Returns the web colour name closest to the current colour.
1629
1571
  */
1630
1572
  get name() {
1631
- const { r: t, g: e, b: s } = this.toRgb(), [r] = $t.map(([n, i]) => {
1573
+ const { r: t, g: e, b: s } = this.toRgb(), [r] = mt.map(([n, i]) => {
1632
1574
  const a = (
1633
1575
  // ((rgb.r - r) ** 2 + (rgb.g - g) ** 2 + (rgb.b - b) ** 2) ** 0.5; // standard
1634
1576
  (((i.r - t) * 0.3) ** 2 + ((i.g - e) * 0.6) ** 2 + ((i.b - s) * 0.1) ** 2) ** 0.5
@@ -1673,7 +1615,7 @@ class y {
1673
1615
  */
1674
1616
  toHex(t) {
1675
1617
  let { r: e, g: s, b: r, a: n } = this;
1676
- return [e, s, r] = [e, s, r].map((i) => m(i * 255)), n = m(n * 100) / 100, n === 1 ? Lt(e, s, r, t) : At(e, s, r, n, t);
1618
+ return [e, s, r] = [e, s, r].map((i) => m(i * 255)), n = m(n * 100) / 100, n === 1 ? St(e, s, r, t) : Ct(e, s, r, n, t);
1677
1619
  }
1678
1620
  /**
1679
1621
  * Returns the CSS valid hexadecimal vaue of the colour. When the parameter is *true*
@@ -1687,7 +1629,7 @@ class y {
1687
1629
  */
1688
1630
  toHex8(t) {
1689
1631
  let { r: e, g: s, b: r, a: n } = this;
1690
- return [e, s, r] = [e, s, r].map((i) => m(i * 255)), n = m(n * 100) / 100, n === 1 ? Lt(e, s, r, t) : At(e, s, r, n, t);
1632
+ return [e, s, r] = [e, s, r].map((i) => m(i * 255)), n = m(n * 100) / 100, n === 1 ? St(e, s, r, t) : Ct(e, s, r, n, t);
1691
1633
  }
1692
1634
  /**
1693
1635
  * Returns the HEX8 value of the colour.
@@ -1699,7 +1641,7 @@ class y {
1699
1641
  * Returns the colour as a HSVA object.
1700
1642
  */
1701
1643
  toHsv() {
1702
- const { r: t, g: e, b: s, a: r } = this, { h: n, s: i, v: a } = ie(t, e, s);
1644
+ const { r: t, g: e, b: s, a: r } = this, { h: n, s: i, v: a } = Yt(t, e, s);
1703
1645
  return {
1704
1646
  h: n,
1705
1647
  s: i,
@@ -1711,7 +1653,7 @@ class y {
1711
1653
  * Returns the colour as an HSLA object.
1712
1654
  */
1713
1655
  toHsl() {
1714
- const { r: t, g: e, b: s, a: r } = this, { h: n, s: i, l: a } = re(t, e, s);
1656
+ const { r: t, g: e, b: s, a: r } = this, { h: n, s: i, l: a } = Zt(t, e, s);
1715
1657
  return {
1716
1658
  h: n,
1717
1659
  s: i,
@@ -1743,7 +1685,7 @@ class y {
1743
1685
  * Returns the colour as an HWBA object.
1744
1686
  */
1745
1687
  toHwb() {
1746
- const { r: t, g: e, b: s, a: r } = this, { h: n, w: i, b: a } = ne(t, e, s);
1688
+ const { r: t, g: e, b: s, a: r } = this, { h: n, w: i, b: a } = Qt(t, e, s);
1747
1689
  return {
1748
1690
  h: n,
1749
1691
  w: i,
@@ -1764,14 +1706,14 @@ class y {
1764
1706
  * Sets the alpha value of the current colour.
1765
1707
  */
1766
1708
  setAlpha(t) {
1767
- return typeof t != "number" ? this : (this.a = Ot(t), this);
1709
+ return typeof t != "number" ? this : (this.a = Tt(t), this);
1768
1710
  }
1769
1711
  /**
1770
1712
  * Saturate the colour with a given amount.
1771
1713
  */
1772
1714
  saturate(t) {
1773
1715
  if (typeof t != "number") return this;
1774
- const { h: e, s, l: r } = this.toHsl(), { r: n, g: i, b: a } = lt(e, ut(s + t / 100), r);
1716
+ const { h: e, s, l: r } = this.toHsl(), { r: n, g: i, b: a } = at(e, ut(s + t / 100), r);
1775
1717
  return Object.assign(this, { r: n, g: i, b: a }), this;
1776
1718
  }
1777
1719
  /**
@@ -1792,7 +1734,7 @@ class y {
1792
1734
  */
1793
1735
  lighten(t) {
1794
1736
  if (typeof t != "number") return this;
1795
- const { h: e, s, l: r } = this.toHsl(), { r: n, g: i, b: a } = lt(e, s, ut(r + t / 100));
1737
+ const { h: e, s, l: r } = this.toHsl(), { r: n, g: i, b: a } = at(e, s, ut(r + t / 100));
1796
1738
  return Object.assign(this, { r: n, g: i, b: a }), this;
1797
1739
  }
1798
1740
  /**
@@ -1807,7 +1749,11 @@ class y {
1807
1749
  */
1808
1750
  spin(t) {
1809
1751
  if (typeof t != "number") return this;
1810
- const { h: e, s, l: r } = this.toHsl(), { r: n, g: i, b: a } = lt(ut((e * 360 + t) % 360 / 360), s, r);
1752
+ const { h: e, s, l: r } = this.toHsl(), { r: n, g: i, b: a } = at(
1753
+ ut((e * 360 + t) % 360 / 360),
1754
+ s,
1755
+ r
1756
+ );
1811
1757
  return Object.assign(this, { r: n, g: i, b: a }), this;
1812
1758
  }
1813
1759
  /** Returns a clone of the current `Color` instance. */
@@ -1822,7 +1768,7 @@ class y {
1822
1768
  return e === "hex" ? this.toHexString(t) : e === "hsl" ? this.toHslString() : e === "hwb" ? this.toHwbString() : this.toRgbString();
1823
1769
  }
1824
1770
  }
1825
- class It {
1771
+ class Ot {
1826
1772
  static Color = y;
1827
1773
  hue;
1828
1774
  hueSteps;
@@ -1843,7 +1789,9 @@ class It {
1843
1789
  else if (t.length === 3)
1844
1790
  [e, s, r] = t;
1845
1791
  else if (t.length === 2 && ([s, r] = t, [s, r].some((g) => g < 1)))
1846
- throw TypeError("ColorPalette: the two minimum arguments must be numbers higher than 0.");
1792
+ throw TypeError(
1793
+ "ColorPalette: the two minimum arguments must be numbers higher than 0."
1794
+ );
1847
1795
  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 = [
1848
1796
  [1, 2, 3],
1849
1797
  [4, 5],
@@ -1860,13 +1808,15 @@ class It {
1860
1808
  const p = (e + g * l) % 360;
1861
1809
  n.forEach((f) => {
1862
1810
  const $ = new y({ h: p, s: 100, l: f * 100 });
1863
- a.push(i < 100 ? $.saturate(i - 100) : $);
1811
+ a.push(
1812
+ i < 100 ? $.saturate(i - 100) : $
1813
+ );
1864
1814
  });
1865
1815
  }
1866
1816
  this.hue = e, this.hueSteps = s, this.lightSteps = r, this.saturation = i, this.colors = a;
1867
1817
  }
1868
1818
  }
1869
- const Kt = {
1819
+ const Dt = {
1870
1820
  pickerLabel: "Colour Picker",
1871
1821
  appearanceLabel: "Colour Appearance",
1872
1822
  valueLabel: "Colour Value",
@@ -1902,22 +1852,22 @@ const Kt = {
1902
1852
  "violet",
1903
1853
  "magenta",
1904
1854
  "pink"
1905
- ], le = (o) => {
1906
- if (!B(o)) return !1;
1855
+ ], ee = (o) => {
1856
+ if (!q(o)) return !1;
1907
1857
  try {
1908
1858
  JSON.parse(o);
1909
1859
  } catch {
1910
1860
  return !1;
1911
1861
  }
1912
1862
  return !0;
1913
- }, Vt = "v-hidden", go = (o) => {
1863
+ }, Ft = "v-hidden", so = (o) => {
1914
1864
  const { format: t, id: e, componentLabels: s } = o, r = x({
1915
1865
  tagName: "div",
1916
1866
  className: `color-form ${t}`
1917
1867
  });
1918
1868
  let n = ["hex"];
1919
1869
  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) => {
1920
- const [a] = t === "hex" ? ["#"] : de(i).split(""), l = `color_${t}_${i}_${e}`, c = s[`${i}Label`], h = x({ tagName: "label" });
1870
+ const [a] = t === "hex" ? ["#"] : he(i).split(""), l = `color_${t}_${i}_${e}`, c = s[`${i}Label`], h = x({ tagName: "label" });
1921
1871
  v(h, "for", l), h.append(
1922
1872
  x({
1923
1873
  tagName: "span",
@@ -1926,7 +1876,7 @@ const Kt = {
1926
1876
  }),
1927
1877
  x({
1928
1878
  tagName: "span",
1929
- className: Vt,
1879
+ className: Ft,
1930
1880
  innerText: c
1931
1881
  })
1932
1882
  );
@@ -1941,14 +1891,21 @@ const Kt = {
1941
1891
  spellcheck: !1
1942
1892
  });
1943
1893
  let u = "100", d = "1";
1944
- i !== "alpha" && (t === "rgb" ? (u = "255", d = "1") : i === "hue" && (u = "360", d = "1")), K(b, {
1894
+ i !== "alpha" && (t === "rgb" ? (u = "255", d = "1") : i === "hue" && (u = "360", d = "1")), V(b, {
1945
1895
  min: "0",
1946
1896
  max: u,
1947
1897
  step: d
1948
1898
  }), r.append(h, b);
1949
1899
  }), r;
1950
- }, uo = (o) => {
1951
- 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;
1900
+ }, ro = (o) => {
1901
+ const { format: t, componentLabels: e } = o, {
1902
+ hueLabel: s,
1903
+ alphaLabel: r,
1904
+ lightnessLabel: n,
1905
+ saturationLabel: i,
1906
+ whitenessLabel: a,
1907
+ blacknessLabel: l
1908
+ } = e, c = t === "hsl" ? 360 : 100, h = t === "hsl" ? 100 : 360, b = 100;
1952
1909
  let u = t === "hsl" ? `${s} & ${n}` : `${n} & ${i}`;
1953
1910
  u = t === "hwb" ? `${a} & ${l}` : u;
1954
1911
  const d = t === "hsl" ? `${i}` : `${s}`, g = x({
@@ -1978,7 +1935,7 @@ const Kt = {
1978
1935
  max: b
1979
1936
  }
1980
1937
  ].forEach((w) => {
1981
- const { i: P, c: L, l: S, min: C, max: M } = w, T = x({
1938
+ const { i: S, c: L, l: C, min: P, max: M } = w, T = x({
1982
1939
  tagName: "div",
1983
1940
  className: "color-control",
1984
1941
  role: "presentation"
@@ -1986,60 +1943,68 @@ const Kt = {
1986
1943
  T.append(
1987
1944
  x({
1988
1945
  tagName: "div",
1989
- className: `visual-control visual-control${P}`
1946
+ className: `visual-control visual-control${S}`
1990
1947
  })
1991
1948
  );
1992
1949
  const A = x({
1993
1950
  tagName: "div",
1994
1951
  className: `${L} knob`,
1995
1952
  ariaLive: "polite",
1996
- ariaLabel: S,
1953
+ ariaLabel: C,
1997
1954
  role: "slider",
1998
1955
  tabIndex: 0,
1999
- ariaValueMin: `${C}`,
1956
+ ariaValueMin: `${P}`,
2000
1957
  ariaValueMax: `${M}`
2001
1958
  });
2002
1959
  T.append(A), g.append(T);
2003
1960
  }), g;
2004
- }, ce = (o, t, e) => {
2005
- const { input: s, format: r, componentLabels: n } = o, { defaultsLabel: i, presetsLabel: a } = n, l = e === "color-options", c = t instanceof It, 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;
1961
+ }, oe = (o, t, e) => {
1962
+ const { input: s, format: r, componentLabels: n } = o, { defaultsLabel: i, presetsLabel: a } = n, l = e === "color-options", c = t instanceof Ot, 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;
2006
1963
  let f = 2;
2007
1964
  f = p && u > g * 2 ? 3 : f, f = p && u > g * 3 ? 4 : f, f = p && u > g * 4 ? 5 : f;
2008
1965
  const $ = f - (u <= g * 3 ? 1 : 2), w = p && u > $ * g;
2009
- let P = e;
2010
- P += w ? " scrollable" : "", P += p ? " multiline" : "";
1966
+ let S = e;
1967
+ S += w ? " scrollable" : "", S += p ? " multiline" : "";
2011
1968
  const L = p ? "1px" : "0.25rem";
2012
- let S = p ? 1.75 : 2;
2013
- S = g > 5 && p ? 1.5 : S;
2014
- const C = `${$ * S}rem`, M = `calc(${f} * ${S}rem + ${f - 1} * ${L})`, T = x({
1969
+ let C = p ? 1.75 : 2;
1970
+ C = g > 5 && p ? 1.5 : C;
1971
+ const P = `${$ * C}rem`, M = `calc(${f} * ${C}rem + ${f - 1} * ${L})`, T = x({
2015
1972
  tagName: "ul",
2016
- className: P,
1973
+ className: S,
2017
1974
  role: "listbox",
2018
1975
  ariaLabel: h
2019
1976
  });
2020
1977
  return w && D(T, {
2021
- "--grid-item-size": `${S}rem`,
1978
+ "--grid-item-size": `${C}rem`,
2022
1979
  "--grid-fit": `${g}`,
2023
1980
  "--grid-gap": L,
2024
- "--grid-height": C,
1981
+ "--grid-height": P,
2025
1982
  "--grid-hover-height": M
2026
1983
  }), b.forEach((A) => {
2027
- let [F, Q] = typeof A == "string" ? A.trim().split(":") : [];
2028
- A instanceof y && (F = A.toHexString(), Q = F);
2029
- const Wt = new y(A instanceof y ? A : F, r).toString() === kt(s, "value"), yt = x({
1984
+ let [F, Y] = typeof A == "string" ? A.trim().split(":") : [];
1985
+ A instanceof y && (F = A.toHexString(), Y = F);
1986
+ const Bt = new y(A instanceof y ? A : F, r).toString() === vt(s, "value"), $t = x({
2030
1987
  tagName: "li",
2031
- className: `color-option${Wt ? " active" : ""}`,
2032
- innerText: `${Q || F}`,
1988
+ className: `color-option${Bt ? " active" : ""}`,
1989
+ innerText: `${Y || F}`,
2033
1990
  tabIndex: 0,
2034
1991
  role: "option",
2035
- ariaSelected: Wt ? "true" : "false"
1992
+ ariaSelected: Bt ? "true" : "false"
2036
1993
  });
2037
- v(yt, "data-value", `${F}`), l && D(yt, { backgroundColor: F }), T.append(yt);
1994
+ v($t, "data-value", `${F}`), l && D($t, { backgroundColor: F }), T.append($t);
2038
1995
  }), T;
2039
- }, bo = (o) => {
2040
- const { input: t, parent: e, format: s, id: r, componentLabels: n, colorKeywords: i, colorPresets: a } = o, l = kt(t, "value") || "#fff", { nonColors: c } = y, { toggleLabel: h, pickerLabel: b, formatLabel: u, hexLabel: d } = n, g = c.includes(l) ? "#fff" : l;
1996
+ }, no = (o) => {
1997
+ const {
1998
+ input: t,
1999
+ parent: e,
2000
+ format: s,
2001
+ id: r,
2002
+ componentLabels: n,
2003
+ colorKeywords: i,
2004
+ colorPresets: a
2005
+ } = o, l = vt(t, "value") || "#fff", { nonColors: c } = y, { toggleLabel: h, pickerLabel: b, formatLabel: u, hexLabel: d } = n, g = c.includes(l) ? "#fff" : l;
2041
2006
  o.color = new y(g, s);
2042
- const p = s === "hex" ? d : de(s), f = x({
2007
+ const p = s === "hex" ? d : he(s), f = x({
2043
2008
  id: `picker-btn-${r}`,
2044
2009
  tagName: "button",
2045
2010
  type: "button",
@@ -2050,81 +2015,91 @@ const Kt = {
2050
2015
  f.append(
2051
2016
  x({
2052
2017
  tagName: "span",
2053
- className: Vt,
2018
+ className: Ft,
2054
2019
  innerText: `${b}. ${u}: ${p}`
2055
2020
  })
2056
2021
  );
2057
- const $ = x({
2058
- tagName: "div",
2059
- className: "color-dropdown picker",
2060
- role: "group",
2061
- ariaLabelledBy: `picker-btn-${r}`
2062
- }), w = uo(o), P = go(o);
2063
- if ($.append(w, P), t.before(f), e.append($), i || a) {
2022
+ const $ = x(
2023
+ {
2024
+ tagName: "div",
2025
+ className: "color-dropdown picker",
2026
+ role: "group",
2027
+ ariaLabelledBy: `picker-btn-${r}`
2028
+ }
2029
+ ), w = ro(o), S = so(o);
2030
+ if ($.append(w, S), t.before(f), e.append($), i || a) {
2064
2031
  const L = x({
2065
2032
  tagName: "div",
2066
2033
  className: "color-dropdown scrollable menu"
2067
2034
  });
2068
- a && L.append(ce(o, a, "color-options")), i && i.length && L.append(ce(o, i, "color-defaults"));
2069
- const S = x({
2035
+ a && L.append(oe(o, a, "color-options")), i && i.length && L.append(
2036
+ oe(o, i, "color-defaults")
2037
+ );
2038
+ const C = x({
2070
2039
  tagName: "button",
2071
2040
  type: "button",
2072
2041
  className: "menu-toggle btn-appearance",
2073
2042
  tabIndex: -1,
2074
2043
  ariaExpanded: "false",
2075
2044
  ariaHasPopup: "true"
2076
- }), C = encodeURI("http://www.w3.org/2000/svg"), M = Tt(C, {
2045
+ }), P = encodeURI("http://www.w3.org/2000/svg"), M = Ht(P, {
2077
2046
  tagName: "svg"
2078
2047
  });
2079
- v(M, "xmlns", C), v(M, "viewBox", "0 0 512 512"), v(M, Te, "true");
2080
- const T = Tt(C, {
2048
+ v(M, "xmlns", P), v(M, "viewBox", "0 0 512 512"), v(M, Ae, "true");
2049
+ const T = Ht(P, {
2081
2050
  tagName: "path"
2082
2051
  });
2083
- v(T, "d", "M98,158l157,156L411,158l27,27L255,368L71,185L98,158z"), v(T, "fill", "#fff"), M.append(T), S.append(
2052
+ v(
2053
+ T,
2054
+ "d",
2055
+ "M98,158l157,156L411,158l27,27L255,368L71,185L98,158z"
2056
+ ), v(T, "fill", "#fff"), M.append(T), C.append(
2084
2057
  x({
2085
2058
  tagName: "span",
2086
- className: Vt,
2059
+ className: Ft,
2087
2060
  innerText: `${h}`
2088
2061
  }),
2089
2062
  M
2090
- ), e.append(S, L);
2063
+ ), e.append(C, L);
2091
2064
  }
2092
- i && c.includes(l) && (o.value = l), v(t, X, "-1");
2093
- }, po = "2.0.2", Y = "color-picker", fo = `[data-function="${Y}"]`, he = `.${Y}`, mo = {
2094
- componentLabels: Kt,
2065
+ i && c.includes(l) && (o.value = l), v(t, Z, "-1");
2066
+ }, io = "2.0.3", Q = "color-picker", ao = `[data-function="${Q}"]`, se = `.${Q}`, lo = {
2067
+ componentLabels: Dt,
2095
2068
  colorLabels: it,
2096
2069
  format: "rgb",
2097
2070
  colorPresets: !1,
2098
2071
  colorKeywords: !1
2099
- }, { roundPart: k, nonColors: bt } = y, vo = (o) => Ye(o, Y), $o = (o) => new wo(o), ge = (o, t) => {
2100
- const e = t ? Bt : jt, { input: s, pickerToggle: r, menuToggle: n } = o;
2101
- e(s, Oe, o.showPicker), e(r, Et, o.togglePicker), n && e(n, Et, o.toggleMenu);
2102
- }, Ne = (o, t) => {
2103
- const e = t ? Bt : jt, { input: s, colorMenu: r, parent: n } = o, i = V(s), a = ro(i);
2104
- e(o.controls, Ie, o.pointerDown), o.controlKnobs.forEach((l) => e(l, zt, o.handleKnobs)), e(a, Be, o.handleScroll), e(a, Ve, o.update), [s, ...o.inputs].forEach((l) => e(l, Me, o.changeHandler)), r && (e(r, Et, o.menuClickHandler), e(r, zt, o.menuKeyHandler)), e(i, be, o.pointerMove), e(i, Ke, o.pointerUp), e(n, De, o.handleFocusOut), e(i, Fe, o.handleDismiss);
2105
- }, ue = (o) => {
2106
- Qe(o.input, new CustomEvent("colorpicker.change"));
2107
- }, Ee = (o) => {
2072
+ }, { roundPart: k, nonColors: bt } = y, co = (o) => je(o, Q), ho = (o) => new go(o), re = (o, t) => {
2073
+ const e = t ? ae : le, { input: s, pickerToggle: r, menuToggle: n } = o;
2074
+ e(s, Ne, o.showPicker), e(r, At, o.togglePicker), n && e(n, At, o.toggleMenu);
2075
+ }, Pe = (o, t) => {
2076
+ const e = t ? ae : le, { input: s, colorMenu: r, parent: n } = o, i = K(s), a = Je(i);
2077
+ e(o.controls, Me, o.pointerDown), o.controlKnobs.forEach((l) => e(l, qt, o.handleKnobs)), e(a, De, o.handleScroll), e(a, Oe, o.update), [s, ...o.inputs].forEach(
2078
+ (l) => e(l, He, o.changeHandler)
2079
+ ), r && (e(r, At, o.menuClickHandler), e(r, qt, o.menuKeyHandler)), e(i, ie, o.pointerMove), e(i, Re, o.pointerUp), e(n, Ee, o.handleFocusOut), e(i, Te, o.handleDismiss);
2080
+ }, ne = (o) => {
2081
+ We(o.input, new CustomEvent("colorpicker.change"));
2082
+ }, Le = (o) => {
2108
2083
  o && ["bottom", "top"].forEach((t) => O(o, t));
2109
- }, Ht = (o, t) => {
2084
+ }, Pt = (o, t) => {
2110
2085
  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;
2111
- R(i, "open") || q(i, "open"), l && (O(l, "show"), Ee(l)), q(t, "bottom"), oo(t), q(t, "show"), a && o.update(), o.isOpen || (Ne(o, !0), o.updateDropdownPosition(), o.isOpen = !0, v(o.input, X, "0"), r && v(r, X, "0")), v(h, Nt, "true"), c && v(c, Nt, "false");
2086
+ R(i, "open") || j(i, "open"), l && (O(l, "show"), Le(l)), j(t, "bottom"), ze(t), j(t, "show"), a && o.update(), o.isOpen || (Pe(o, !0), o.updateDropdownPosition(), o.isOpen = !0, v(o.input, Z, "0"), r && v(r, Z, "0")), v(h, Lt, "true"), c && v(c, Lt, "false");
2112
2087
  };
2113
- class wo {
2088
+ class go {
2114
2089
  // bring utils to staic
2115
2090
  static Color = y;
2116
- static ColorPalette = It;
2117
- static getInstance = vo;
2118
- static init = $o;
2119
- static selector = fo;
2091
+ static ColorPalette = Ot;
2092
+ static getInstance = co;
2093
+ static init = ho;
2094
+ static selector = ao;
2120
2095
  // utils important for render
2121
2096
  static roundPart = k;
2122
2097
  static setElementStyle = D;
2123
2098
  static setAttribute = v;
2124
2099
  static getBoundingClientRect = gt;
2125
- static version = po;
2100
+ static version = io;
2126
2101
  static colorNames = it;
2127
- static colorPickerLabels = Kt;
2102
+ static colorPickerLabels = Dt;
2128
2103
  id;
2129
2104
  input;
2130
2105
  color;
@@ -2133,7 +2108,9 @@ class wo {
2133
2108
  dragElement;
2134
2109
  isOpen = !1;
2135
2110
  controlPositions;
2136
- colorLabels = Qt(it.map((t) => [t, t]));
2111
+ colorLabels = Ut(
2112
+ it.map((t) => [t, t])
2113
+ );
2137
2114
  colorKeywords;
2138
2115
  colorPresets;
2139
2116
  componentLabels;
@@ -2154,36 +2131,72 @@ class wo {
2154
2131
  */
2155
2132
  constructor(t, e) {
2156
2133
  const s = _(t);
2157
- if (typeof t > "u") throw new TypeError("ColorPicker target not specified.");
2158
- if (B(t) && !s) throw new TypeError(`ColorPicker target "${t}" cannot be found.`);
2134
+ if (typeof t > "u")
2135
+ throw new TypeError("ColorPicker target not specified.");
2136
+ if (!ge(s))
2137
+ throw new TypeError(`ColorPicker target "${t}" cannot be found.`);
2159
2138
  this.input = s;
2160
- const r = me(s, he);
2161
- if (!r) throw new TypeError("ColorPicker requires a specific markup to work.");
2162
- this.parent = r, this.id = fe(s, Y), this.dragElement = void 0, this.isOpen = !1, this.controlPositions = {
2139
+ const r = be(s, se);
2140
+ if (!r)
2141
+ throw new TypeError("ColorPicker requires a specific markup to work.");
2142
+ this.parent = r, this.id = ue(s, Q), this.dragElement = void 0, this.isOpen = !1, this.controlPositions = {
2163
2143
  c1x: 0,
2164
2144
  c1y: 0,
2165
2145
  c2y: 0,
2166
2146
  c3y: 0
2167
2147
  }, this.colorKeywords = !1, this.colorPresets = !1;
2168
- const { format: n, componentLabels: i, colorLabels: a, colorKeywords: l, colorPresets: c } = eo(
2148
+ const {
2149
+ format: n,
2150
+ componentLabels: i,
2151
+ colorLabels: a,
2152
+ colorKeywords: l,
2153
+ colorPresets: c
2154
+ } = _e(
2169
2155
  s,
2170
- mo,
2156
+ lo,
2171
2157
  e || {}
2172
2158
  );
2173
2159
  let h = it;
2174
- Ct(a) && a.length === 17 ? h = a : B(a) && a.split(",").length === 17 && (h = a.split(",")), K(this.colorLabels, Qt(h.map((p, f) => [it[f], p])));
2175
- const b = B(i) && le(i) ? JSON.parse(i) : i;
2176
- if (this.componentLabels = K({ ...Kt }, b), this.color = new y(s.value || "#fff", n), this.format = n, Ct(l) && l.length ? this.colorKeywords = l : B(l) && l.length && (this.colorKeywords = l.split(",").map((p) => p.trim())), Ct(c) && c.length)
2160
+ xt(a) && a.length === 17 ? h = a : q(a) && a.split(",").length === 17 && (h = a.split(",")), V(
2161
+ this.colorLabels,
2162
+ Ut(
2163
+ h.map((p, f) => [it[f], p])
2164
+ )
2165
+ );
2166
+ const b = q(i) && ee(i) ? JSON.parse(i) : i;
2167
+ if (this.componentLabels = V(
2168
+ { ...Dt },
2169
+ b
2170
+ ), this.color = new y(s.value || "#fff", n), this.format = n, xt(l) && l.length ? this.colorKeywords = l : q(l) && l.length && (this.colorKeywords = l.split(",").map((p) => p.trim())), xt(c) && c.length)
2177
2171
  this.colorPresets = c;
2178
- else if (c && le(c)) {
2179
- const { hue: p, hueSteps: f, lightSteps: $, saturation: w } = JSON.parse(c);
2180
- this.colorPresets = new It(p, f, $, w);
2181
- } else B(c) && (this.colorPresets = c.split(",").map((p) => p.trim()));
2182
- bo(this);
2183
- const [u, d] = st("color-dropdown", r);
2184
- this.pickerToggle = _(".picker-toggle", r), this.menuToggle = _(".menu-toggle", r), this.colorPicker = u, this.colorMenu = d, this.inputs = [...st("color-input", r)];
2185
- const [g] = st("color-controls", r);
2186
- this.controls = g, this.controlKnobs = [...st("knob", g)], this.visuals = [...st("visual-control", g)], this.update(), ge(this, !0), ct.set(s, Y, this);
2172
+ else if (c && ee(c)) {
2173
+ const { hue: p, hueSteps: f, lightSteps: $, saturation: w } = JSON.parse(
2174
+ c
2175
+ );
2176
+ this.colorPresets = new Ot(
2177
+ p,
2178
+ f,
2179
+ $,
2180
+ w
2181
+ );
2182
+ } else q(c) && (this.colorPresets = c.split(",").map((p) => p.trim()));
2183
+ no(this);
2184
+ const [u, d] = st(
2185
+ "color-dropdown",
2186
+ r
2187
+ );
2188
+ this.pickerToggle = _(".picker-toggle", r), this.menuToggle = _(".menu-toggle", r), this.colorPicker = u, this.colorMenu = d, this.inputs = [
2189
+ ...st("color-input", r)
2190
+ ];
2191
+ const [g] = st(
2192
+ "color-controls",
2193
+ r
2194
+ );
2195
+ this.controls = g, this.controlKnobs = [
2196
+ ...st("knob", g)
2197
+ ], this.visuals = [
2198
+ ...st("visual-control", g)
2199
+ ], this.update(), re(this, !0), lt.set(s, Q, this);
2187
2200
  }
2188
2201
  /** Returns the current colour value */
2189
2202
  get value() {
@@ -2295,7 +2308,7 @@ class wo {
2295
2308
  * @this {ColorPicker}
2296
2309
  */
2297
2310
  handleDismiss = ({ code: t }) => {
2298
- this.isOpen && t === Ge && this.hide();
2311
+ this.isOpen && t === Ve && this.hide();
2299
2312
  };
2300
2313
  /**
2301
2314
  * The `ColorPicker` *scroll* event listener when open.
@@ -2303,8 +2316,8 @@ class wo {
2303
2316
  * @param e
2304
2317
  */
2305
2318
  handleScroll = (t) => {
2306
- const { activeElement: e } = V(this.input);
2307
- this.updateDropdownPosition(), ([be, je].includes(t.type) && this.dragElement || e && this.controlKnobs.includes(e)) && (t.stopPropagation(), t.preventDefault());
2319
+ const { activeElement: e } = K(this.input);
2320
+ this.updateDropdownPosition(), ([ie, Fe].includes(t.type) && this.dragElement || e && this.controlKnobs.includes(e)) && (t.stopPropagation(), t.preventDefault());
2308
2321
  };
2309
2322
  /**
2310
2323
  * The `ColorPicker` keyboard event listener for menu navigation.
@@ -2312,8 +2325,8 @@ class wo {
2312
2325
  * @param e
2313
2326
  */
2314
2327
  menuKeyHandler = (t) => {
2315
- const { target: e, code: s } = t, { previousElementSibling: r, nextElementSibling: n, parentElement: i } = e, a = i && R(i, "color-options"), l = i ? [...i.children] : [], c = a && Number(Mt(i, "--grid-fit")), h = l.indexOf(e), b = h > -1 && c && l[h - c], u = h > -1 && c && l[h + c];
2316
- [j, ot, Jt].includes(s) && t.preventDefault(), a ? b && s === ot ? W(b) : u && s === j ? W(u) : r && s === ht ? W(r) : n && s === U && W(n) : r && [ht, ot].includes(s) ? W(r) : n && [U, j].includes(s) && W(n), [qe, Jt].includes(s) && this.menuClickHandler(t);
2328
+ const { target: e, code: s } = t, { previousElementSibling: r, nextElementSibling: n, parentElement: i } = e, a = i && R(i, "color-options"), l = i ? [...i.children] : [], c = a && Number(Nt(i, "--grid-fit")), h = l.indexOf(e), b = h > -1 && c && l[h - c], u = h > -1 && c && l[h + c];
2329
+ [B, ot, Gt].includes(s) && t.preventDefault(), a ? b && s === ot ? U(b) : u && s === B ? U(u) : r && s === ht ? U(r) : n && s === W && U(n) : r && [ht, ot].includes(s) ? U(r) : n && [W, B].includes(s) && U(n), [Ie, Gt].includes(s) && this.menuClickHandler(t);
2317
2330
  };
2318
2331
  /**
2319
2332
  * The `ColorPicker` click event listener for the colour menu presets / defaults.
@@ -2322,18 +2335,21 @@ class wo {
2322
2335
  * @this {ColorPicker}
2323
2336
  */
2324
2337
  menuClickHandler = (t) => {
2325
- const { target: e } = t, { colorMenu: s } = this, r = (kt(e, "data-value") || "").trim();
2338
+ const { target: e } = t, { colorMenu: s } = this, r = (vt(
2339
+ e,
2340
+ "data-value"
2341
+ ) || "").trim();
2326
2342
  if (!r.length) return;
2327
2343
  const n = _("li.active", s);
2328
2344
  let i = r;
2329
2345
  i = bt.includes(i) ? "white" : i, i = i === "transparent" ? "rgba(0,0,0,0)" : i;
2330
2346
  const { r: a, g: l, b: c, a: h } = new y(i);
2331
- K(this.color, {
2347
+ V(this.color, {
2332
2348
  r: a,
2333
2349
  g: l,
2334
2350
  b: c,
2335
2351
  a: h
2336
- }), this.update(), n !== e && (n && (O(n, "active"), Pt(n, xt)), q(e, "active"), v(e, xt, "true"), bt.includes(r) && (this.value = r), ue(this));
2352
+ }), this.update(), n !== e && (n && (O(n, "active"), kt(n, wt)), j(e, "active"), v(e, wt, "true"), bt.includes(r) && (this.value = r), ne(this));
2337
2353
  };
2338
2354
  /**
2339
2355
  * The `ColorPicker` *touchstart* / *mousedown* events listener for control knobs.
@@ -2342,10 +2358,10 @@ class wo {
2342
2358
  */
2343
2359
  pointerDown = (t) => {
2344
2360
  if (t.button !== 0) return;
2345
- 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 = St(l), $ = s - f.scrollLeft - p.left, w = r - f.scrollTop - p.top;
2361
+ 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 = yt(l), $ = s - f.scrollLeft - p.left, w = r - f.scrollTop - p.top;
2346
2362
  if (e === l || e === b ? (this.dragElement = g, this.changeControl1($, w)) : e === c || e === u ? (this.dragElement = g, this.changeControl2(w)) : (e === h || e === d) && (this.dragElement = g, this.changeAlpha(w)), n) {
2347
- const P = _("li.active", n);
2348
- P && (O(P, "active"), Pt(P, xt));
2363
+ const S = _("li.active", n);
2364
+ S && (O(S, "active"), kt(S, wt));
2349
2365
  }
2350
2366
  t.preventDefault();
2351
2367
  };
@@ -2356,7 +2372,7 @@ class wo {
2356
2372
  * @this
2357
2373
  */
2358
2374
  pointerUp = ({ target: t }) => {
2359
- const { parent: e } = this, s = V(e), r = _(`${he}.open`, s) !== null, n = s.getSelection();
2375
+ const { parent: e } = this, s = K(e), r = _(`${se}.open`, s) !== null, n = s.getSelection();
2360
2376
  !this.dragElement && (!n || !n.toString().length) && !e.contains(t) && this.hide(r), this.dragElement = void 0;
2361
2377
  };
2362
2378
  /**
@@ -2367,7 +2383,7 @@ class wo {
2367
2383
  pointerMove = (t) => {
2368
2384
  const { dragElement: e, visuals: s } = this, [r, n, i] = s, { pageX: a, pageY: l } = t;
2369
2385
  if (!e) return;
2370
- const c = gt(e), h = St(r), b = a - h.scrollLeft - c.left, u = l - h.scrollTop - c.top;
2386
+ const c = gt(e), h = yt(r), b = a - h.scrollLeft - c.left, u = l - h.scrollTop - c.top;
2371
2387
  e === r && this.changeControl1(b, u), e === n && this.changeControl2(u), e === i && this.changeAlpha(u);
2372
2388
  };
2373
2389
  /**
@@ -2377,22 +2393,29 @@ class wo {
2377
2393
  */
2378
2394
  handleKnobs = (t) => {
2379
2395
  const { target: e, code: s } = t;
2380
- if (![ot, j, ht, U].includes(s)) return;
2396
+ if (![ot, B, ht, W].includes(s)) return;
2381
2397
  t.preventDefault();
2382
- const { controlKnobs: r, visuals: n } = this, { offsetWidth: i, offsetHeight: a } = n[0], [l, c, h] = r, { activeElement: b } = V(l), u = r.find((g) => g === b), d = a / 360;
2398
+ 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;
2383
2399
  if (u) {
2384
2400
  let g = 0, p = 0;
2385
2401
  if (e === l) {
2386
2402
  const f = i / 100;
2387
- [ht, U].includes(s) ? this.controlPositions.c1x += s === U ? f : -f : [ot, j].includes(s) && (this.controlPositions.c1y += s === j ? d : -d), g = this.controlPositions.c1x, p = this.controlPositions.c1y, this.changeControl1(g, p);
2388
- } else e === c ? (this.controlPositions.c2y += [j, U].includes(s) ? d : -d, p = this.controlPositions.c2y, this.changeControl2(p)) : e === h && (this.controlPositions.c3y += [j, U].includes(s) ? d : -d, p = this.controlPositions.c3y, this.changeAlpha(p));
2403
+ [ht, W].includes(s) ? this.controlPositions.c1x += s === W ? f : -f : [ot, B].includes(s) && (this.controlPositions.c1y += s === B ? d : -d), g = this.controlPositions.c1x, p = this.controlPositions.c1y, this.changeControl1(g, p);
2404
+ } else e === c ? (this.controlPositions.c2y += [B, W].includes(s) ? d : -d, p = this.controlPositions.c2y, this.changeControl2(p)) : e === h && (this.controlPositions.c3y += [B, W].includes(s) ? d : -d, p = this.controlPositions.c3y, this.changeAlpha(p));
2389
2405
  this.handleScroll(t);
2390
2406
  }
2391
2407
  };
2392
2408
  /** The event listener of the colour form inputs. */
2393
2409
  changeHandler = () => {
2394
2410
  let t;
2395
- const { inputs: e, format: s, value: r, input: n, controlPositions: i, visuals: a } = this, { activeElement: l } = V(n), { offsetHeight: c } = a[0], [h, , , b] = e, [u, d, g, p] = s === "rgb" ? e.map((w) => parseFloat(w.value) / (w === b ? 100 : 1)) : e.map((w) => parseFloat(w.value) / (w !== h ? 100 : 360)), f = this.hasNonColor && bt.includes(r), $ = b ? p : 1 - i.c3y / c;
2411
+ const {
2412
+ inputs: e,
2413
+ format: s,
2414
+ value: r,
2415
+ input: n,
2416
+ controlPositions: i,
2417
+ visuals: a
2418
+ } = this, { activeElement: l } = K(n), { offsetHeight: c } = a[0], [h, , , b] = e, [u, d, g, p] = s === "rgb" ? e.map((w) => parseFloat(w.value) / (w === b ? 100 : 1)) : e.map((w) => parseFloat(w.value) / (w !== h ? 100 : 360)), f = this.hasNonColor && bt.includes(r), $ = b ? p : 1 - i.c3y / c;
2396
2419
  if (l === n || l && e.includes(l)) {
2397
2420
  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 = {
2398
2421
  h: u,
@@ -2410,12 +2433,12 @@ class wo {
2410
2433
  b: g,
2411
2434
  a: $
2412
2435
  };
2413
- const { r: w, g: P, b: L, a: S } = new y(t);
2414
- K(this.color, {
2436
+ const { r: w, g: S, b: L, a: C } = new y(t);
2437
+ V(this.color, {
2415
2438
  r: w,
2416
- g: P,
2439
+ g: S,
2417
2440
  b: L,
2418
- a: S
2441
+ a: C
2419
2442
  }), this.setControlPositions(), this.updateAppearance(), this.updateInputs(), this.updateControls(), this.updateVisuals(), l === n && f && (this.value = r);
2420
2443
  }
2421
2444
  };
@@ -2437,7 +2460,7 @@ class wo {
2437
2460
  v: b * 100,
2438
2461
  a: u
2439
2462
  });
2440
- K(this.color, {
2463
+ V(this.color, {
2441
2464
  r: d,
2442
2465
  g,
2443
2466
  b: p,
@@ -2461,7 +2484,7 @@ class wo {
2461
2484
  v: c * 100,
2462
2485
  a: h
2463
2486
  });
2464
- K(this.color, {
2487
+ V(this.color, {
2465
2488
  r: b,
2466
2489
  g: u,
2467
2490
  b: d,
@@ -2491,10 +2514,10 @@ class wo {
2491
2514
  };
2492
2515
  /** Updates the open dropdown position on *scroll* event. */
2493
2516
  updateDropdownPosition() {
2494
- const { input: t, colorPicker: e, colorMenu: s } = this, r = gt(t), { top: n, bottom: i } = r, { offsetHeight: a } = t, l = St(t).clientHeight, h = R(e, "show") ? e : s;
2517
+ const { input: t, colorPicker: e, colorMenu: s } = this, r = gt(t), { top: n, bottom: i } = r, { offsetHeight: a } = t, l = yt(t).clientHeight, h = R(e, "show") ? e : s;
2495
2518
  if (!h) return;
2496
2519
  const { offsetHeight: b } = h, u = l - i, d = n, g = n + b + a > l, p = n - b < 0;
2497
- (R(h, "bottom") || !p) && u < d && g ? (O(h, "bottom"), q(h, "top")) : (O(h, "top"), q(h, "bottom"));
2520
+ (R(h, "bottom") || !p) && u < d && g ? (O(h, "bottom"), j(h, "top")) : (O(h, "top"), j(h, "bottom"));
2498
2521
  }
2499
2522
  /** Updates control knobs' positions. */
2500
2523
  setControlPositions() {
@@ -2505,17 +2528,25 @@ class wo {
2505
2528
  updateAppearance() {
2506
2529
  const { componentLabels: t, color: e, parent: s, hsv: r, hex: n, format: i, controlKnobs: a } = this, { appearanceLabel: l, hexLabel: c, valueLabel: h } = t;
2507
2530
  let { r: b, g: u, b: d } = e.toRgb();
2508
- const [g, p, f] = a, $ = k(r.h * 360), w = e.a, P = k(r.s * 100), L = k(r.v * 100), S = this.appearance;
2509
- let C = `${c} ${n.split("").join(" ")}`;
2531
+ const [g, p, f] = a, $ = k(r.h * 360), w = e.a, S = k(r.s * 100), L = k(r.v * 100), C = this.appearance;
2532
+ let P = `${c} ${n.split("").join(" ")}`;
2510
2533
  if (i === "hwb") {
2511
- const { hwb: A } = this, F = k(A.w * 100), Q = k(A.b * 100);
2512
- C = `HWB: ${$}°, ${F}%, ${Q}%`, v(g, et, `${F}% & ${Q}%`), v(g, tt, `${F}`), v(p, _t, `${h}: ${C}. ${l}: ${S}.`), v(p, et, `${$}%`), v(p, tt, `${$}`);
2534
+ const { hwb: A } = this, F = k(A.w * 100), Y = k(A.b * 100);
2535
+ P = `HWB: ${$}°, ${F}%, ${Y}%`, v(g, et, `${F}% & ${Y}%`), v(g, tt, `${F}`), v(
2536
+ p,
2537
+ jt,
2538
+ `${h}: ${P}. ${l}: ${C}.`
2539
+ ), v(p, et, `${$}%`), v(p, tt, `${$}`);
2513
2540
  } else
2514
- [b, u, d] = [b, u, d].map(k), C = i === "hsl" ? `HSL: ${$}°, ${P}%, ${L}%` : C, C = i === "rgb" ? `RGB: ${b}, ${u}, ${d}` : C, v(g, et, `${L}% & ${P}%`), v(g, tt, `${L}`), v(p, _t, `${h}: ${C}. ${l}: ${S}.`), v(p, et, `${$}°`), v(p, tt, `${$}`);
2541
+ [b, u, d] = [b, u, d].map(k), P = i === "hsl" ? `HSL: ${$}°, ${S}%, ${L}%` : P, P = i === "rgb" ? `RGB: ${b}, ${u}, ${d}` : P, v(g, et, `${L}% & ${S}%`), v(g, tt, `${L}`), v(
2542
+ p,
2543
+ jt,
2544
+ `${h}: ${P}. ${l}: ${C}.`
2545
+ ), v(p, et, `${$}°`), v(p, tt, `${$}`);
2515
2546
  const M = k(w * 100);
2516
2547
  v(f, et, `${M}%`), v(f, tt, `${M}`);
2517
2548
  const T = e.toString();
2518
- D(this.input, { backgroundColor: T }), this.isDark ? (R(s, "txt-light") && O(s, "txt-light"), R(s, "txt-dark") || q(s, "txt-dark")) : (R(s, "txt-dark") && O(s, "txt-dark"), R(s, "txt-light") || q(s, "txt-light"));
2549
+ D(this.input, { backgroundColor: T }), this.isDark ? (R(s, "txt-light") && O(s, "txt-light"), R(s, "txt-dark") || j(s, "txt-dark")) : (R(s, "txt-dark") && O(s, "txt-dark"), R(s, "txt-light") || j(s, "txt-light"));
2519
2550
  }
2520
2551
  /** Updates the control knobs actual positions. */
2521
2552
  updateControls() {
@@ -2546,7 +2577,7 @@ class wo {
2546
2577
  let { r: g, g: p, b: f } = this.rgb;
2547
2578
  [g, p, f] = [g, p, f].map(k), d = this.color.toRgbString(), a.value = `${g}`, l.value = `${p}`, c.value = `${f}`, h.value = `${b}`;
2548
2579
  }
2549
- this.value = d, !t && d !== e && ue(this);
2580
+ this.value = d, !t && d !== e && ne(this);
2550
2581
  }
2551
2582
  /**
2552
2583
  * Toggle the `ColorPicker` dropdown visibility.
@@ -2556,12 +2587,12 @@ class wo {
2556
2587
  togglePicker = (t) => {
2557
2588
  t && t.preventDefault();
2558
2589
  const { colorPicker: e } = this;
2559
- this.isOpen && R(e, "show") ? this.hide(!0) : Ht(this, e);
2590
+ this.isOpen && R(e, "show") ? this.hide(!0) : Pt(this, e);
2560
2591
  };
2561
2592
  /** Shows the `ColorPicker` dropdown. */
2562
2593
  showPicker = () => {
2563
2594
  const { colorPicker: t } = this;
2564
- ["top", "bottom"].some((e) => R(t, e)) || Ht(this, t);
2595
+ ["top", "bottom"].some((e) => R(t, e)) || Pt(this, t);
2565
2596
  };
2566
2597
  /**
2567
2598
  * Toggles the visibility of the `ColorPicker` presets menu.
@@ -2572,7 +2603,7 @@ class wo {
2572
2603
  toggleMenu = (t) => {
2573
2604
  t && t.preventDefault();
2574
2605
  const { colorMenu: e } = this;
2575
- this.isOpen && R(e, "show") ? this.hide(!0) : Ht(this, e);
2606
+ this.isOpen && R(e, "show") ? this.hide(!0) : Pt(this, e);
2576
2607
  };
2577
2608
  /**
2578
2609
  * Hides the currently open `ColorPicker` dropdown.
@@ -2580,22 +2611,28 @@ class wo {
2580
2611
  * @param {boolean=} focusPrevented
2581
2612
  */
2582
2613
  hide(t) {
2583
- if (this.isOpen) {
2584
- const { pickerToggle: e, menuToggle: s, colorPicker: r, colorMenu: n, parent: i, input: a } = this, l = R(r, "show"), c = l ? r : n, h = l ? e : s, b = c && to(c);
2585
- this.value = this.color.toString(!0), c && (O(c, "show"), v(h, Nt, "false"), setTimeout(() => {
2586
- Ee(c), _(".show", i) || (O(i, "open"), Ne(this), this.isOpen = !1);
2587
- }, b)), t || W(e), v(a, X, "-1"), h === s && v(s, X, "-1");
2588
- }
2614
+ if (!this.isOpen) return;
2615
+ const {
2616
+ pickerToggle: e,
2617
+ menuToggle: s,
2618
+ colorPicker: r,
2619
+ colorMenu: n,
2620
+ parent: i,
2621
+ input: a
2622
+ } = this, l = R(r, "show"), c = l ? r : n, h = l ? e : s, b = c && Ue(c);
2623
+ this.value = this.color.toString(!0), c && (O(c, "show"), v(h, Lt, "false"), setTimeout(() => {
2624
+ Le(c), _(".show", i) || (O(i, "open"), Pe(this), this.isOpen = !1);
2625
+ }, b)), t || U(e), v(a, Z, "-1"), h === s && v(s, Z, "-1");
2589
2626
  }
2590
2627
  /** Removes `ColorPicker` from target `<input>`. */
2591
2628
  dispose() {
2592
2629
  const { input: t, parent: e } = this;
2593
- this.hide(!0), ge(this), [...e.children].forEach((s) => {
2630
+ this.hide(!0), re(this), [...e.children].forEach((s) => {
2594
2631
  s !== t && s.remove();
2595
- }), Pt(t, X), D(t, { backgroundColor: "" }), ["txt-light", "txt-dark"].forEach((s) => O(e, s)), ct.remove(t, Y);
2632
+ }), kt(t, Z), D(t, { backgroundColor: "" }), ["txt-light", "txt-dark"].forEach((s) => O(e, s)), lt.remove(t, Q);
2596
2633
  }
2597
2634
  }
2598
2635
  export {
2599
- wo as default
2636
+ go as default
2600
2637
  };
2601
2638
  //# sourceMappingURL=color-picker.mjs.map