@thednp/color-picker 2.0.0-alpha8 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/.eslintrc.cjs +0 -0
  2. package/.lgtm.yml +0 -0
  3. package/.prettierrc.json +0 -0
  4. package/.stylelintrc.json +0 -0
  5. package/LICENSE +0 -0
  6. package/README.md +5 -5
  7. package/compile.js +6 -3
  8. package/cypress/e2e/color-palette.cy.ts +0 -0
  9. package/cypress/e2e/color-picker.cy.ts +58 -69
  10. package/cypress/fixtures/colorNamesFrench.js +0 -0
  11. package/cypress/fixtures/componentLabelsFrench.js +0 -0
  12. package/cypress/fixtures/format.js +0 -0
  13. package/cypress/fixtures/getMarkup.js +8 -1
  14. package/cypress/fixtures/getRandomInt.js +0 -0
  15. package/cypress/fixtures/sampleWebcolors.js +0 -0
  16. package/cypress/fixtures/testSample.js +0 -0
  17. package/cypress/plugins/esbuild-istanbul.ts +0 -0
  18. package/cypress/plugins/tsCompile.ts +0 -0
  19. package/cypress/support/commands.ts +0 -0
  20. package/cypress/support/e2e.ts +0 -0
  21. package/cypress/test.html +0 -0
  22. package/cypress.config.ts +0 -0
  23. package/dist/css/color-picker.css +7 -15
  24. package/dist/css/color-picker.min.css +2 -2
  25. package/dist/css/color-picker.rtl.css +7 -15
  26. package/dist/css/color-picker.rtl.min.css +2 -2
  27. package/dist/js/color-picker.cjs +2 -2
  28. package/dist/js/color-picker.cjs.map +1 -1
  29. package/dist/js/color-picker.d.ts +34 -14
  30. package/dist/js/color-picker.js +2 -2
  31. package/dist/js/color-picker.js.map +1 -1
  32. package/dist/js/color-picker.mjs +278 -314
  33. package/dist/js/color-picker.mjs.map +1 -1
  34. package/dts.config.ts +0 -0
  35. package/package.json +117 -114
  36. package/src/scss/_variables.scss +0 -0
  37. package/src/scss/color-picker.rtl.scss +0 -0
  38. package/src/scss/color-picker.scss +10 -12
  39. package/src/ts/colorPalette.ts +0 -0
  40. package/src/ts/index.ts +15 -15
  41. package/src/ts/interface/ColorNames.ts +20 -0
  42. package/src/ts/interface/colorPickerLabels.ts +0 -0
  43. package/src/ts/interface/colorPickerOptions.ts +0 -0
  44. package/src/ts/interface/paletteOptions.ts +0 -0
  45. package/src/ts/util/colorNames.ts +0 -0
  46. package/src/ts/util/colorPickerLabels.ts +0 -0
  47. package/src/ts/util/getColorControls.ts +0 -0
  48. package/src/ts/util/getColorForm.ts +0 -0
  49. package/src/ts/util/getColorMenu.ts +0 -0
  50. package/src/ts/util/isValidJSON.ts +0 -0
  51. package/src/ts/util/setMarkup.ts +6 -4
  52. package/src/ts/util/vHidden.ts +0 -0
  53. package/tsconfig.json +1 -1
  54. package/vite.config.ts +0 -0
  55. package/cypress/fixtures/getCEMarkup.js +0 -29
@@ -1,41 +1,25 @@
1
- const J = {}, ge = (o) => {
2
- const { type: t, currentTarget: e } = o;
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
- });
7
- });
8
- }, ue = (o, t, e, s) => {
9
- J[t] || (J[t] = /* @__PURE__ */ new Map());
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)) : (
1
+ const _t = "aria-description", Nt = "aria-expanded", Ee = "aria-hidden", St = "aria-selected", tt = "aria-valuenow", et = "aria-valuetext", Me = "change", Te = "DOMContentLoaded", Re = "focusin", Oe = "focusout", zt = "keydown", De = "keyup", Et = "click", Fe = "pointerdown", ue = "pointermove", Ie = "pointerup", Ke = "resize", Ve = "scroll", Be = "touchmove", j = "ArrowDown", ot = "ArrowUp", ht = "ArrowLeft", U = "ArrowRight", je = "Enter", qe = "Escape", Wt = "Space", Ge = "transitionDuration", Ue = "transitionProperty", X = "tabindex", _e = navigator.userAgentData, mt = _e, { userAgent: ze } = navigator, vt = ze, Jt = /iPhone|iPad|iPod|Android/i;
2
+ mt ? mt.brands.some((o) => Jt.test(o.brand)) : Jt.test(vt);
3
+ const Xt = /(iPhone|iPod|iPad)/;
4
+ mt ? mt.brands.some((o) => Xt.test(o.brand)) : (
21
5
  /* istanbul ignore next */
22
- Jt.test(wt)
6
+ Xt.test(vt)
23
7
  );
24
- wt && wt.includes("Firefox");
25
- const { head: yt } = document;
26
- ["webkitPerspective", "perspective"].some((o) => o in yt.style);
27
- const Xe = (o, t, e, s) => {
8
+ vt && vt.includes("Firefox");
9
+ const { head: kt } = document;
10
+ ["webkitPerspective", "perspective"].some((o) => o in kt.style);
11
+ const Bt = (o, t, e, s) => {
28
12
  const r = s || !1;
29
13
  o.addEventListener(t, e, r);
30
- }, Je = (o, t, e, s) => {
14
+ }, jt = (o, t, e, s) => {
31
15
  const r = s || !1;
32
16
  o.removeEventListener(t, e, r);
33
- }, Ye = (o, t, e, s) => {
17
+ }, We = (o, t, e, s) => {
34
18
  const r = (n) => {
35
- (n.target === o || n.currentTarget === o) && (e.apply(o, [n]), Je(o, t, r, s));
19
+ (n.target === o || n.currentTarget === o) && (e.apply(o, [n]), jt(o, t, r, s));
36
20
  };
37
- Xe(o, t, r, s);
38
- }, Ze = () => {
21
+ Bt(o, t, r, s);
22
+ }, Je = () => {
39
23
  };
40
24
  (() => {
41
25
  let o = !1;
@@ -43,19 +27,19 @@ const Xe = (o, t, e, s) => {
43
27
  const t = Object.defineProperty({}, "passive", {
44
28
  get: () => (o = !0, o)
45
29
  });
46
- Ye(document, Re, Ze, t);
30
+ We(document, Te, Je, t);
47
31
  } catch {
48
32
  }
49
33
  return o;
50
34
  })();
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) => {
35
+ ["webkitTransform", "transform"].some((o) => o in kt.style);
36
+ ["webkitAnimation", "animation"].some((o) => o in kt.style);
37
+ ["webkitTransition", "transition"].some((o) => o in kt.style);
38
+ const yt = (o, t) => o.getAttribute(t), m = (o, t, e) => o.setAttribute(t, e), Pt = (o, t) => o.removeAttribute(t), q = (o, ...t) => {
55
39
  o.classList.add(...t);
56
40
  }, O = (o, ...t) => {
57
41
  o.classList.remove(...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 = {
42
+ }, T = (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, W = /* @__PURE__ */ new Map(), ct = {
59
43
  data: W,
60
44
  /**
61
45
  * Sets web components data.
@@ -82,8 +66,7 @@ const xt = (o, t) => o.getAttribute(t), m = (o, t, e) => o.setAttribute(t, e), C
82
66
  * @returns the instance
83
67
  */
84
68
  get: (o, t) => {
85
- if (!at(o) || !t)
86
- return null;
69
+ if (!at(o) || !t) return null;
87
70
  const e = ct.getAllFor(t);
88
71
  return o && e && e.get(o) || null;
89
72
  },
@@ -97,31 +80,27 @@ const xt = (o, t) => o.getAttribute(t), m = (o, t, e) => o.setAttribute(t, e), C
97
80
  const e = ct.getAllFor(t);
98
81
  !e || !at(o) || (e.delete(o), e.size === 0 && W.delete(t));
99
82
  }
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
- if (!o)
102
- return;
103
- if (V(o))
104
- return K().createElement(o);
83
+ }, Xe = (o, t) => ct.get(o, t), B = (o) => typeof o == "string" || !1, Ye = (o) => qt(o) && o.constructor.name === "Window" || !1, be = (o) => Z(o) && o.nodeType === 9 || !1, V = (o) => Ye(o) ? o.document : be(o) ? o : Z(o) ? o.ownerDocument : window.document, K = (o, ...t) => Object.assign(o, ...t), x = (o) => {
84
+ if (!o) return;
85
+ if (B(o))
86
+ return V().createElement(o);
105
87
  const { tagName: t } = o, e = x(t);
106
- if (!e)
107
- return;
88
+ if (!e) return;
108
89
  const s = { ...o };
109
- return delete s.tagName, B(e, s);
110
- }, Tt = (o, t) => {
111
- if (!o || !t)
112
- return;
113
- if (V(t))
114
- return K().createElementNS(o, t);
115
- const { tagName: e } = t, s = Tt(o, e);
116
- if (!s)
117
- return;
90
+ return delete s.tagName, K(e, s);
91
+ }, Mt = (o, t) => {
92
+ if (!o || !t) return;
93
+ if (B(t))
94
+ return V().createElementNS(o, t);
95
+ const { tagName: e } = t, s = Mt(o, e);
96
+ if (!s) return;
118
97
  const r = { ...t };
119
- return delete r.tagName, B(s, r);
120
- }, eo = (o, t) => o.dispatchEvent(t), Rt = (o, t) => {
98
+ return delete r.tagName, K(s, r);
99
+ }, Ze = (o, t) => o.dispatchEvent(t), Tt = (o, t) => {
121
100
  const e = getComputedStyle(o), s = t.replace("webkit", "Webkit").replace(/([A-Z])/g, "-$1").toLowerCase();
122
101
  return e.getPropertyValue(s);
123
- }, oo = (o) => {
124
- const t = Rt(o, Ue), e = Rt(o, Ge), s = e.includes("ms") ? (
102
+ }, Qe = (o) => {
103
+ const t = Tt(o, Ue), e = Tt(o, Ge), s = e.includes("ms") ? (
125
104
  /* istanbul ignore next */
126
105
  1
127
106
  ) : 1e3, r = t && t !== "none" ? parseFloat(e) * s : (
@@ -132,26 +111,26 @@ const xt = (o, t) => o.getAttribute(t), m = (o, t, e) => o.setAttribute(t, e), C
132
111
  /* istanbul ignore next */
133
112
  0
134
113
  ) : 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) => {
114
+ }, _ = (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), to = (o, t, e, s) => {
136
115
  const r = { ...e }, n = { ...o.dataset }, i = { ...t }, a = {}, l = "title";
137
116
  return pt(n).forEach(([c, h]) => {
138
- const b = s && typeof c == "string" && c.includes(s) ? c.replace(s, "").replace(/[A-Z]/g, (u) => so(u)) : c;
117
+ const b = c;
139
118
  a[b] = Yt(h);
140
119
  }), pt(r).forEach(([c, h]) => {
141
120
  r[c] = Yt(h);
142
121
  }), pt(t).forEach(([c, h]) => {
143
- c in r ? i[c] = r[c] : c in a ? i[c] = a[c] : i[c] = c === l ? xt(o, l) : h;
122
+ c in r ? i[c] = r[c] : c in a ? i[c] = a[c] : i[c] = c === l ? yt(o, l) : h;
144
123
  }), i;
145
- }, no = (o) => o.offsetHeight, D = (o, t) => {
124
+ }, Zt = (o) => Object.fromEntries(o), eo = (o) => o.offsetHeight, D = (o, t) => {
146
125
  pt(t).forEach(([e, s]) => {
147
- if (s && V(e) && e.includes("--"))
126
+ if (s && B(e) && e.includes("--"))
148
127
  o.style.setProperty(e, s);
149
128
  else {
150
129
  const r = {};
151
- r[e] = s, B(o.style, r);
130
+ r[e] = s, K(o.style, r);
152
131
  }
153
132
  });
154
- }, io = (o) => qt(o) && o.constructor.name === "Map" || !1, de = (o) => o.toUpperCase(), gt = (o, t) => {
133
+ }, oo = (o) => qt(o) && o.constructor.name === "Map" || !1, pe = (o) => o.toUpperCase(), gt = (o, t) => {
155
134
  const { width: e, height: s, top: r, right: n, bottom: i, left: a } = o.getBoundingClientRect();
156
135
  let l = 1, c = 1;
157
136
  if (t && at(o)) {
@@ -174,28 +153,28 @@ const xt = (o, t) => o.getAttribute(t), m = (o, t, e) => o.setAttribute(t, e), C
174
153
  x: a / l,
175
154
  y: r / c
176
155
  };
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;
156
+ }, Ct = (o) => V(o).documentElement;
157
+ let Qt = 0, te = 0;
158
+ const J = /* @__PURE__ */ new Map(), de = (o, t) => {
159
+ let e = t ? Qt : te;
181
160
  if (t) {
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);
161
+ const s = de(o), r = J.get(s) || /* @__PURE__ */ new Map();
162
+ J.has(s) || J.set(s, r), oo(r) && !r.has(t) ? (r.set(t, e), Qt += 1) : e = r.get(t);
184
163
  } else {
185
164
  const s = o.id || o;
186
- X.has(s) ? e = X.get(s) : (X.set(s, e), Qt += 1);
165
+ J.has(s) ? e = J.get(s) : (J.set(s, e), te += 1);
187
166
  }
188
167
  return e;
189
- }, ao = (o) => {
168
+ }, so = (o) => {
190
169
  var t;
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(
170
+ return o ? be(o) ? o.defaultView : Z(o) ? (t = o?.ownerDocument) == null ? void 0 : t.defaultView : o : window;
171
+ }, Lt = (o) => Array.isArray(o) || !1, fe = (o, t) => o ? o.closest(t) || // break out of `ShadowRoot`
172
+ fe(o.getRootNode().host, t) : null, z = (o, t) => at(o) ? o : (Z(t) ? t : V()).querySelector(o), st = (o, t) => (t && Z(t) ? t : V()).getElementsByClassName(
194
173
  o
195
- ), zt = ["transparent", "currentColor", "inherit", "revert", "initial"], v = (o) => {
174
+ ), Gt = ["transparent", "currentColor", "inherit", "revert", "initial"], v = (o) => {
196
175
  const t = Math.floor(o);
197
176
  return o - t < 0.5 ? t : Math.round(o);
198
- }, $t = [
177
+ }, wt = [
199
178
  [
200
179
  "aliceblue",
201
180
  {
@@ -1380,37 +1359,37 @@ me(o.getRootNode().host, t) : null, _ = (o, t) => at(o) ? o : (Q(t) ? t : K()).q
1380
1359
  b: 50
1381
1360
  }
1382
1361
  ]
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}`),
1362
+ ], me = "deg|rad|grad|turn", ve = "[-\\+]?\\d+%?", we = "[-\\+]?\\d*\\.\\d+%?", $e = `[-\\+]?\\d*\\.?\\d+(?:${me})?`, dt = `(?:${we})|(?:${ve})`, Rt = `(?:${dt})|(?:${$e}?)`, ro = "(?:[\\s|\\(\\s|\\s\\(\\s]+)?", no = "(?:[\\s|\\)\\s]+)?", ee = "(?:[,|\\s]+)", io = "(?:[,|\\/\\s]*)?", rt = `${ro}(${Rt})${ee}(${dt})${ee}(${dt})${io}(${dt})?${no}`, I = {
1363
+ CSS_UNIT: new RegExp(Rt),
1364
+ ANGLES: me,
1365
+ CSS_ANGLE: $e,
1366
+ CSS_INTEGER: ve,
1367
+ CSS_NUMBER: we,
1368
+ CSS_UNIT2: Rt,
1369
+ PERMISSIVE_MATCH: rt,
1370
+ hwb: new RegExp(`hwb${rt}`),
1371
+ rgb: new RegExp(`rgb(?:a)?${rt}`),
1372
+ hsl: new RegExp(`hsl(?:a)?${rt}`),
1373
+ hsv: new RegExp(`hsv(?:a)?${rt}`),
1395
1374
  hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
1396
1375
  hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
1397
1376
  hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
1398
1377
  hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
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) => {
1378
+ }, ke = (o) => Gt.includes(o), nt = (o, t) => o !== null && typeof o == "object" && Object.keys(t).every((e) => e in o), ye = (o) => `${o}`.includes(".") && parseFloat(o) === 1, $t = (o) => typeof o == "string" && o.includes("%"), H = (o) => !!I.CSS_UNIT.exec(`${o}`), xe = ["rgb", "hex", "hsl", "hsv", "hwb"], Se = (o) => Gt.includes(o) || ["#", ...xe].some((t) => o.includes(t)) ? !1 : wt.some(([t]) => o === t), R = (o, t) => {
1400
1379
  let e = o;
1401
1380
  if (typeof o == "number" && Math.min(o, 0) === 0 && // round values to 6 decimals Math.round(N * (10 ** 6)) / 10 ** 6
1402
1381
  Math.max(o, 1) === 1)
1403
1382
  return o;
1404
- xe(o) && (e = "100%");
1405
- const s = kt(e);
1383
+ ye(o) && (e = "100%");
1384
+ const s = $t(e);
1406
1385
  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
- }, Dt = (o) => {
1386
+ }, Ot = (o) => {
1408
1387
  let t = parseFloat(o);
1409
1388
  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), Ce = (o) => {
1411
- const [[, t]] = $t.filter(([e]) => e === o.toLowerCase());
1389
+ }, ut = (o) => Math.min(1, Math.max(0, o)), G = (o) => o.length === 1 ? `0${o}` : String(o), Pe = (o) => {
1390
+ const [[, t]] = wt.filter(([e]) => e === o.toLowerCase());
1412
1391
  return t;
1413
- }, H = (o) => parseInt(o, 16), Ft = (o) => H(o) / 255, Le = (o) => v(o * 255).toString(16), ee = (o, t, e) => {
1392
+ }, N = (o) => parseInt(o, 16), Dt = (o) => N(o) / 255, Ce = (o) => v(o * 255).toString(16), oe = (o, t, e) => {
1414
1393
  const s = Math.max(o, t, e), r = Math.min(o, t, e);
1415
1394
  let n = 0, i = 0;
1416
1395
  const a = (s + r) / 2;
@@ -1433,11 +1412,10 @@ me(o.getRootNode().host, t) : null, _ = (o, t) => at(o) ? o : (Q(t) ? t : K()).q
1433
1412
  s = ft(a, i, o + 1 / 3), r = ft(a, i, o), n = ft(a, i, o - 1 / 3);
1434
1413
  }
1435
1414
  return { r: s, g: r, b: n };
1436
- }, oe = (o, t, e) => {
1415
+ }, se = (o, t, e) => {
1437
1416
  let s = 0, r = 0;
1438
1417
  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 };
1418
+ if (i === n) return { h: 0, w: n, b: a };
1441
1419
  o === n ? (s = t - e, r = 3) : (s = t === n ? e - o : o - t, r = t === n ? 5 : 1);
1442
1420
  const l = (r - s / (i - n)) / 6;
1443
1421
  return {
@@ -1445,45 +1423,45 @@ me(o.getRootNode().host, t) : null, _ = (o, t) => at(o) ? o : (Q(t) ? t : K()).q
1445
1423
  w: n,
1446
1424
  b: a
1447
1425
  };
1448
- }, Ae = (o, t, e) => {
1426
+ }, Le = (o, t, e) => {
1449
1427
  if (t + e >= 1) {
1450
1428
  const i = t / (t + e);
1451
1429
  return { r: i, g: i, b: i };
1452
1430
  }
1453
1431
  let { r: s, g: r, b: n } = lt(o, 1, 0.5);
1454
1432
  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) => {
1433
+ }, re = (o, t, e) => {
1456
1434
  const s = Math.max(o, t, e), r = Math.min(o, t, e);
1457
1435
  let n = 0;
1458
1436
  const i = s, a = s - r, l = s === 0 ? 0 : a / s;
1459
1437
  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) => {
1438
+ }, Ft = (o, t, e) => {
1461
1439
  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
1440
  return { r: u, g: d, b: g };
1463
- }, re = (o, t, e, s) => {
1441
+ }, ne = (o, t, e, s) => {
1464
1442
  const r = [
1465
- z(v(o).toString(16)),
1466
- z(v(t).toString(16)),
1467
- z(v(e).toString(16))
1443
+ G(v(o).toString(16)),
1444
+ G(v(t).toString(16)),
1445
+ G(v(e).toString(16))
1468
1446
  ];
1469
1447
  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) => {
1448
+ }, At = (o, t, e, s, r) => {
1471
1449
  const n = [
1472
- z(v(o).toString(16)),
1473
- z(v(t).toString(16)),
1474
- z(v(e).toString(16)),
1475
- z(Le(s))
1450
+ G(v(o).toString(16)),
1451
+ G(v(t).toString(16)),
1452
+ G(v(e).toString(16)),
1453
+ G(Ce(s))
1476
1454
  ];
1477
1455
  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) => {
1456
+ }, Ae = (o) => {
1479
1457
  const t = String(o).trim().toLowerCase();
1480
1458
  if (Se(t))
1481
- return Object.assign(Ce(t), {
1459
+ return Object.assign(Pe(t), {
1482
1460
  a: 1,
1483
1461
  format: "rgb",
1484
1462
  ok: !0
1485
1463
  });
1486
- if (ye(t))
1464
+ if (ke(t))
1487
1465
  return {
1488
1466
  r: 0,
1489
1467
  g: 0,
@@ -1522,30 +1500,30 @@ me(o.getRootNode().host, t) : null, _ = (o, t) => at(o) ? o : (Q(t) ? t : K()).q
1522
1500
  format: "hwb",
1523
1501
  ok: !0
1524
1502
  } : ([, 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),
1503
+ r: N(e),
1504
+ g: N(s),
1505
+ b: N(r),
1506
+ a: Dt(n),
1529
1507
  format: "hex",
1530
1508
  ok: !0
1531
1509
  } : ([, e, s, r] = I.hex6.exec(t) || [], e && s && r ? {
1532
- r: H(e),
1533
- g: H(s),
1534
- b: H(r),
1510
+ r: N(e),
1511
+ g: N(s),
1512
+ b: N(r),
1535
1513
  a: 1,
1536
1514
  format: "hex",
1537
1515
  ok: !0
1538
1516
  } : ([, 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),
1517
+ r: N(e + e),
1518
+ g: N(s + s),
1519
+ b: N(r + r),
1520
+ a: Dt(n + n),
1543
1521
  format: "hex",
1544
1522
  ok: !0
1545
1523
  } : ([, 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),
1524
+ r: N(e + e),
1525
+ g: N(s + s),
1526
+ b: N(r + r),
1549
1527
  a: 1,
1550
1528
  format: "hex",
1551
1529
  ok: !0
@@ -1557,49 +1535,49 @@ me(o.getRootNode().host, t) : null, _ = (o, t) => at(o) ? o : (Q(t) ? t : K()).q
1557
1535
  format: "rgb",
1558
1536
  ok: !o
1559
1537
  })))))));
1560
- }, ne = (o) => {
1538
+ }, ie = (o) => {
1561
1539
  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), {
1540
+ return (!e || typeof e == "string") && (e = Ae(e), d = e.ok), nt(e, t) && H(e.r) && H(e.g) && H(e.b) && ({ r: h, g: b, b: l } = e, [h, b, l] = [h, b, l].map((g) => R(g, $t(g) ? 100 : 255)), t = { r: h, g: b, b: l }, u = "format" in e ? e.format : "rgb"), 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 = R(c, 360), r = R(r, 100), n = R(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 = R(c, 360), r = R(r, 100), i = R(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 = R(c, 360), a = R(a, 100), l = R(l, 100), t = Le(c, a, l), u = "hwb"), H(e.a) && (s = e.a, s = $t(s) || parseFloat(`${s}`) > 1 ? R(s, 100) : s), {
1563
1541
  r: t.r,
1564
1542
  g: t.g,
1565
1543
  b: t.b,
1566
- a: Dt(s),
1544
+ a: Ot(s),
1567
1545
  format: u,
1568
1546
  ok: d
1569
1547
  };
1570
- }, go = "1.0.8";
1548
+ }, ao = "1.0.9";
1571
1549
  class y {
1572
1550
  // bring main utilities to front
1573
1551
  static matchers = I;
1574
- static isOnePointZero = xe;
1575
- static isPercentage = kt;
1576
- static isValidCSSUnit = N;
1577
- static isNonColor = ye;
1552
+ static isOnePointZero = ye;
1553
+ static isPercentage = $t;
1554
+ static isValidCSSUnit = H;
1555
+ static isNonColor = ke;
1578
1556
  static isColorName = Se;
1579
- static isColorType = it;
1580
- static pad2 = z;
1557
+ static isColorType = nt;
1558
+ static pad2 = G;
1581
1559
  static clamp01 = ut;
1582
1560
  static bound01 = R;
1583
- static boundAlpha = Dt;
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;
1561
+ static boundAlpha = Ot;
1562
+ static getRGBFromName = Pe;
1563
+ static convertHexToDecimal = Dt;
1564
+ static convertDecimalToHex = Ce;
1565
+ static rgbToHsl = oe;
1566
+ static rgbToHex = ne;
1567
+ static rgbToHsv = re;
1568
+ static rgbToHwb = se;
1569
+ static rgbaToHex = At;
1570
+ static hslToRgb = Ft;
1571
+ static hsvToRgb = Ft;
1594
1572
  static hueToRgb = ft;
1595
- static hwbToRgb = Ae;
1596
- static parseIntFromHex = H;
1597
- static stringInputToObject = Ne;
1598
- static inputToRGB = ne;
1573
+ static hwbToRgb = Le;
1574
+ static parseIntFromHex = N;
1575
+ static stringInputToObject = Ae;
1576
+ static inputToRGB = ie;
1599
1577
  static roundPart = v;
1600
- static webColors = $t;
1601
- static nonColors = zt;
1602
- static version = go;
1578
+ static webColors = wt;
1579
+ static nonColors = Gt;
1580
+ static version = ao;
1603
1581
  // main public properties
1604
1582
  r;
1605
1583
  g;
@@ -1610,7 +1588,7 @@ class y {
1610
1588
  originalInput;
1611
1589
  // main public methods
1612
1590
  constructor(t, e) {
1613
- const s = e && Pe.includes(e) ? e : "", { r, g: n, b: i, a, ok: l, format: c } = ne(t);
1591
+ const s = e && xe.includes(e) ? e : "", { r, g: n, b: i, a, ok: l, format: c } = ie(t);
1614
1592
  this.originalInput = t, this.r = r, this.g = n, this.b = i, this.a = a, this.ok = l, this.format = s || c;
1615
1593
  }
1616
1594
  /**
@@ -1646,7 +1624,7 @@ class y {
1646
1624
  * Returns the web colour name closest to the current colour.
1647
1625
  */
1648
1626
  get name() {
1649
- const { r: t, g: e, b: s } = this.toRgb(), [r] = $t.map(([n, i]) => {
1627
+ const { r: t, g: e, b: s } = this.toRgb(), [r] = wt.map(([n, i]) => {
1650
1628
  const a = (
1651
1629
  // ((rgb.r - r) ** 2 + (rgb.g - g) ** 2 + (rgb.b - b) ** 2) ** 0.5; // standard
1652
1630
  (((i.r - t) * 0.3) ** 2 + ((i.g - e) * 0.6) ** 2 + ((i.b - s) * 0.1) ** 2) ** 0.5
@@ -1691,7 +1669,7 @@ class y {
1691
1669
  */
1692
1670
  toHex(t) {
1693
1671
  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);
1672
+ return n === 1 ? ne(e, s, r, t) : At(e, s, r, n, t);
1695
1673
  }
1696
1674
  /**
1697
1675
  * Returns the CSS valid hexadecimal vaue of the colour. When the parameter is *true*
@@ -1705,7 +1683,7 @@ class y {
1705
1683
  */
1706
1684
  toHex8(t) {
1707
1685
  const { r: e, g: s, b: r, a: n } = this.toRgb();
1708
- return Nt(e, s, r, n, t);
1686
+ return At(e, s, r, n, t);
1709
1687
  }
1710
1688
  /**
1711
1689
  * Returns the HEX8 value of the colour.
@@ -1717,7 +1695,7 @@ class y {
1717
1695
  * Returns the colour as a HSVA object.
1718
1696
  */
1719
1697
  toHsv() {
1720
- const { r: t, g: e, b: s, a: r } = this, { h: n, s: i, v: a } = se(t, e, s);
1698
+ const { r: t, g: e, b: s, a: r } = this, { h: n, s: i, v: a } = re(t, e, s);
1721
1699
  return {
1722
1700
  h: n,
1723
1701
  s: i,
@@ -1729,7 +1707,7 @@ class y {
1729
1707
  * Returns the colour as an HSLA object.
1730
1708
  */
1731
1709
  toHsl() {
1732
- const { r: t, g: e, b: s, a: r } = this, { h: n, s: i, l: a } = ee(t, e, s);
1710
+ const { r: t, g: e, b: s, a: r } = this, { h: n, s: i, l: a } = oe(t, e, s);
1733
1711
  return {
1734
1712
  h: n,
1735
1713
  s: i,
@@ -1761,7 +1739,7 @@ class y {
1761
1739
  * Returns the colour as an HWBA object.
1762
1740
  */
1763
1741
  toHwb() {
1764
- const { r: t, g: e, b: s, a: r } = this, { h: n, w: i, b: a } = oe(t, e, s);
1742
+ const { r: t, g: e, b: s, a: r } = this, { h: n, w: i, b: a } = se(t, e, s);
1765
1743
  return {
1766
1744
  h: n,
1767
1745
  w: i,
@@ -1782,14 +1760,13 @@ class y {
1782
1760
  * Sets the alpha value of the current colour.
1783
1761
  */
1784
1762
  setAlpha(t) {
1785
- return typeof t != "number" ? this : (this.a = Dt(t), this);
1763
+ return typeof t != "number" ? this : (this.a = Ot(t), this);
1786
1764
  }
1787
1765
  /**
1788
1766
  * Saturate the colour with a given amount.
1789
1767
  */
1790
1768
  saturate(t) {
1791
- if (typeof t != "number")
1792
- return this;
1769
+ if (typeof t != "number") return this;
1793
1770
  const { h: e, s, l: r } = this.toHsl(), { r: n, g: i, b: a } = lt(e, ut(s + t / 100), r);
1794
1771
  return Object.assign(this, { r: n, g: i, b: a }), this;
1795
1772
  }
@@ -1810,8 +1787,7 @@ class y {
1810
1787
  * Increase the colour lightness with a given amount.
1811
1788
  */
1812
1789
  lighten(t) {
1813
- if (typeof t != "number")
1814
- return this;
1790
+ if (typeof t != "number") return this;
1815
1791
  const { h: e, s, l: r } = this.toHsl(), { r: n, g: i, b: a } = lt(e, s, ut(r + t / 100));
1816
1792
  return Object.assign(this, { r: n, g: i, b: a }), this;
1817
1793
  }
@@ -1826,8 +1802,7 @@ class y {
1826
1802
  * Values outside of this range will be wrapped into this range.
1827
1803
  */
1828
1804
  spin(t) {
1829
- if (typeof t != "number")
1830
- return this;
1805
+ if (typeof t != "number") return this;
1831
1806
  const { h: e, s, l: r } = this.toHsl(), { r: n, g: i, b: a } = lt(ut((e * 360 + t) % 360 / 360), s, r);
1832
1807
  return Object.assign(this, { r: n, g: i, b: a }), this;
1833
1808
  }
@@ -1843,7 +1818,7 @@ class y {
1843
1818
  return e === "hex" ? this.toHexString(t) : e === "hsl" ? this.toHslString() : e === "hwb" ? this.toHwbString() : this.toRgbString();
1844
1819
  }
1845
1820
  }
1846
- class Kt {
1821
+ class It {
1847
1822
  static Color = y;
1848
1823
  hue;
1849
1824
  hueSteps;
@@ -1887,7 +1862,7 @@ class Kt {
1887
1862
  this.hue = e, this.hueSteps = s, this.lightSteps = r, this.saturation = i, this.colors = a;
1888
1863
  }
1889
1864
  }
1890
- const Vt = {
1865
+ const Kt = {
1891
1866
  pickerLabel: "Colour Picker",
1892
1867
  appearanceLabel: "Colour Appearance",
1893
1868
  valueLabel: "Colour Value",
@@ -1905,7 +1880,7 @@ const Vt = {
1905
1880
  redLabel: "Red",
1906
1881
  greenLabel: "Green",
1907
1882
  blueLabel: "Blue"
1908
- }, mt = [
1883
+ }, it = [
1909
1884
  "white",
1910
1885
  "black",
1911
1886
  "grey",
@@ -1923,23 +1898,22 @@ const Vt = {
1923
1898
  "violet",
1924
1899
  "magenta",
1925
1900
  "pink"
1926
- ], ie = (o) => {
1927
- if (!V(o))
1928
- return !1;
1901
+ ], ae = (o) => {
1902
+ if (!B(o)) return !1;
1929
1903
  try {
1930
1904
  JSON.parse(o);
1931
1905
  } catch {
1932
1906
  return !1;
1933
1907
  }
1934
1908
  return !0;
1935
- }, Bt = "v-hidden", uo = (o) => {
1909
+ }, Vt = "v-hidden", lo = (o) => {
1936
1910
  const { format: t, id: e, componentLabels: s } = o, r = x({
1937
1911
  tagName: "div",
1938
1912
  className: `color-form ${t}`
1939
1913
  });
1940
1914
  let n = ["hex"];
1941
1915
  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" });
1916
+ const [a] = t === "hex" ? ["#"] : pe(i).split(""), l = `color_${t}_${i}_${e}`, c = s[`${i}Label`], h = x({ tagName: "label" });
1943
1917
  m(h, "for", l), h.append(
1944
1918
  x({
1945
1919
  tagName: "span",
@@ -1948,7 +1922,7 @@ const Vt = {
1948
1922
  }),
1949
1923
  x({
1950
1924
  tagName: "span",
1951
- className: Bt,
1925
+ className: Vt,
1952
1926
  innerText: c
1953
1927
  })
1954
1928
  );
@@ -1963,13 +1937,13 @@ const Vt = {
1963
1937
  spellcheck: !1
1964
1938
  });
1965
1939
  let u = "100", d = "1";
1966
- i !== "alpha" && (t === "rgb" ? (u = "255", d = "1") : i === "hue" && (u = "360", d = "1")), B(b, {
1940
+ i !== "alpha" && (t === "rgb" ? (u = "255", d = "1") : i === "hue" && (u = "360", d = "1")), K(b, {
1967
1941
  min: "0",
1968
1942
  max: u,
1969
1943
  step: d
1970
1944
  }), r.append(h, b);
1971
1945
  }), r;
1972
- }, bo = (o) => {
1946
+ }, co = (o) => {
1973
1947
  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
1948
  let u = t === "hsl" ? `${s} & ${n}` : `${n} & ${i}`;
1975
1949
  u = t === "hwb" ? `${a} & ${l}` : u;
@@ -2000,7 +1974,7 @@ const Vt = {
2000
1974
  max: b
2001
1975
  }
2002
1976
  ].forEach(($) => {
2003
- const { i: P, c: L, l: S, min: C, max: M } = $, E = x({
1977
+ const { i: S, c: L, l: P, min: C, max: M } = $, E = x({
2004
1978
  tagName: "div",
2005
1979
  className: "color-control",
2006
1980
  role: "presentation"
@@ -2008,14 +1982,14 @@ const Vt = {
2008
1982
  E.append(
2009
1983
  x({
2010
1984
  tagName: "div",
2011
- className: `visual-control visual-control${P}`
1985
+ className: `visual-control visual-control${S}`
2012
1986
  })
2013
1987
  );
2014
1988
  const A = x({
2015
1989
  tagName: "div",
2016
1990
  className: `${L} knob`,
2017
1991
  ariaLive: "polite",
2018
- ariaLabel: S,
1992
+ ariaLabel: P,
2019
1993
  role: "slider",
2020
1994
  tabIndex: 0,
2021
1995
  ariaValueMin: `${C}`,
@@ -2023,47 +1997,48 @@ const Vt = {
2023
1997
  });
2024
1998
  E.append(A), g.append(E);
2025
1999
  }), g;
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;
2000
+ }, le = (o, t, e) => {
2001
+ 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;
2028
2002
  let f = 2;
2029
2003
  f = p && u > g * 2 ? 3 : f, f = p && u > g * 3 ? 4 : f, f = p && u > g * 4 ? 5 : f;
2030
2004
  const w = f - (u <= g * 3 ? 1 : 2), $ = p && u > w * g;
2031
- let P = e;
2032
- P += $ ? " scrollable" : "", P += p ? " multiline" : "";
2005
+ let S = e;
2006
+ S += $ ? " scrollable" : "", S += p ? " multiline" : "";
2033
2007
  const L = p ? "1px" : "0.25rem";
2034
- let S = p ? 1.75 : 2;
2035
- S = g > 5 && p ? 1.5 : S;
2036
- const C = `${w * S}rem`, M = `calc(${f} * ${S}rem + ${f - 1} * ${L})`, E = x({
2008
+ let P = p ? 1.75 : 2;
2009
+ P = g > 5 && p ? 1.5 : P;
2010
+ const C = `${w * P}rem`, M = `calc(${f} * ${P}rem + ${f - 1} * ${L})`, E = x({
2037
2011
  tagName: "ul",
2038
- className: P,
2012
+ className: S,
2039
2013
  role: "listbox",
2040
2014
  ariaLabel: h
2041
2015
  });
2042
2016
  return $ && D(E, {
2043
- "--grid-item-size": `${S}rem`,
2017
+ "--grid-item-size": `${P}rem`,
2044
2018
  "--grid-fit": `${g}`,
2045
2019
  "--grid-gap": L,
2046
2020
  "--grid-height": C,
2047
2021
  "--grid-hover-height": M
2048
2022
  }), b.forEach((A) => {
2049
- let [F, tt] = typeof A == "string" ? A.trim().split(":") : [];
2050
- A instanceof y && (F = A.toHexString(), tt = F);
2051
- const Gt = new y(A instanceof y ? A : F, r).toString() === xt(s, "value"), Pt = x({
2023
+ let [F, Q] = typeof A == "string" ? A.trim().split(":") : [];
2024
+ A instanceof y && (F = A.toHexString(), Q = F);
2025
+ const Ut = new y(A instanceof y ? A : F, r).toString() === yt(s, "value"), xt = x({
2052
2026
  tagName: "li",
2053
- className: `color-option${Gt ? " active" : ""}`,
2054
- innerText: `${tt || F}`,
2027
+ className: `color-option${Ut ? " active" : ""}`,
2028
+ innerText: `${Q || F}`,
2055
2029
  tabIndex: 0,
2056
2030
  role: "option",
2057
- ariaSelected: Gt ? "true" : "false"
2031
+ ariaSelected: Ut ? "true" : "false"
2058
2032
  });
2059
- m(Pt, "data-value", `${F}`), l && D(Pt, { backgroundColor: F }), E.append(Pt);
2033
+ m(xt, "data-value", `${F}`), l && D(xt, { backgroundColor: F }), E.append(xt);
2060
2034
  }), E;
2061
- }, po = (o) => {
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;
2035
+ }, ho = (o) => {
2036
+ const { input: t, parent: e, format: s, id: r, componentLabels: n, colorKeywords: i, colorPresets: a } = o, l = yt(t, "value") || "#fff", { nonColors: c } = y, { toggleLabel: h, pickerLabel: b, formatLabel: u, hexLabel: d } = n, g = c.includes(l) ? "#fff" : l;
2063
2037
  o.color = new y(g, s);
2064
- const p = s === "hex" ? d : de(s), f = x({
2038
+ const p = s === "hex" ? d : pe(s), f = x({
2065
2039
  id: `picker-btn-${r}`,
2066
2040
  tagName: "button",
2041
+ type: "button",
2067
2042
  className: "picker-toggle btn-appearance",
2068
2043
  ariaExpanded: "false",
2069
2044
  ariaHasPopup: "true"
@@ -2071,7 +2046,7 @@ const Vt = {
2071
2046
  f.append(
2072
2047
  x({
2073
2048
  tagName: "span",
2074
- className: Bt,
2049
+ className: Vt,
2075
2050
  innerText: `${b}. ${u}: ${p}`
2076
2051
  })
2077
2052
  );
@@ -2080,71 +2055,72 @@ const Vt = {
2080
2055
  className: "color-dropdown picker",
2081
2056
  role: "group",
2082
2057
  ariaLabelledBy: `picker-btn-${r}`
2083
- }), $ = bo(o), P = uo(o);
2084
- if (w.append($, P), t.before(f), e.append(w), i || a) {
2058
+ }), $ = co(o), S = lo(o);
2059
+ if (w.append($, S), t.before(f), e.append(w), i || a) {
2085
2060
  const L = x({
2086
2061
  tagName: "div",
2087
2062
  className: "color-dropdown scrollable menu"
2088
2063
  });
2089
- a && L.append(ae(o, a, "color-options")), i && i.length && L.append(ae(o, i, "color-defaults"));
2090
- const S = x({
2064
+ a && L.append(le(o, a, "color-options")), i && i.length && L.append(le(o, i, "color-defaults"));
2065
+ const P = x({
2091
2066
  tagName: "button",
2067
+ type: "button",
2092
2068
  className: "menu-toggle btn-appearance",
2093
2069
  tabIndex: -1,
2094
2070
  ariaExpanded: "false",
2095
2071
  ariaHasPopup: "true"
2096
- }), C = encodeURI("http://www.w3.org/2000/svg"), M = Tt(C, {
2072
+ }), C = encodeURI("http://www.w3.org/2000/svg"), M = Mt(C, {
2097
2073
  tagName: "svg"
2098
2074
  });
2099
- m(M, "xmlns", C), m(M, "viewBox", "0 0 512 512"), m(M, Me, "true");
2100
- const E = Tt(C, {
2075
+ m(M, "xmlns", C), m(M, "viewBox", "0 0 512 512"), m(M, Ee, "true");
2076
+ const E = Mt(C, {
2101
2077
  tagName: "path"
2102
2078
  });
2103
- m(E, "d", "M98,158l157,156L411,158l27,27L255,368L71,185L98,158z"), m(E, "fill", "#fff"), M.append(E), S.append(
2079
+ m(E, "d", "M98,158l157,156L411,158l27,27L255,368L71,185L98,158z"), m(E, "fill", "#fff"), M.append(E), P.append(
2104
2080
  x({
2105
2081
  tagName: "span",
2106
- className: Bt,
2082
+ className: Vt,
2107
2083
  innerText: `${h}`
2108
2084
  }),
2109
2085
  M
2110
- ), e.append(S, L);
2086
+ ), e.append(P, L);
2111
2087
  }
2112
- i && c.includes(l) && (o.value = l), m(t, Y, "-1");
2113
- }, fo = "2.0.0-alpha7", Z = "color-picker", mo = `[data-function="${Z}"]`, le = `.${Z}`, vo = {
2114
- componentLabels: Vt,
2115
- colorLabels: mt,
2088
+ i && c.includes(l) && (o.value = l), m(t, X, "-1");
2089
+ }, go = "2.0.0", Y = "color-picker", uo = `[data-function="${Y}"]`, ce = `.${Y}`, bo = {
2090
+ componentLabels: Kt,
2091
+ colorLabels: it,
2116
2092
  format: "rgb",
2117
2093
  colorPresets: !1,
2118
2094
  colorKeywords: !1
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);
2095
+ }, { roundPart: k, nonColors: bt } = y, po = (o) => Xe(o, Y), fo = (o) => new mo(o), he = (o, t) => {
2096
+ const e = t ? Bt : jt, { input: s, pickerToggle: r, menuToggle: n } = o;
2097
+ e(s, Re, o.showPicker), e(r, Et, o.togglePicker), n && e(n, Et, o.toggleMenu);
2122
2098
  }, 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
- eo(o.input, new CustomEvent("colorpicker.change"));
2127
- }, Ee = (o) => {
2099
+ const e = t ? Bt : jt, { input: s, colorMenu: r, parent: n } = o, i = V(s), a = so(i);
2100
+ e(o.controls, Fe, o.pointerDown), o.controlKnobs.forEach((l) => e(l, zt, o.handleKnobs)), e(a, Ve, o.handleScroll), e(a, Ke, 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, ue, o.pointerMove), e(i, Ie, o.pointerUp), e(n, Oe, o.handleFocusOut), e(i, De, o.handleDismiss);
2101
+ }, ge = (o) => {
2102
+ Ze(o.input, new CustomEvent("colorpicker.change"));
2103
+ }, Ne = (o) => {
2128
2104
  o && ["bottom", "top"].forEach((t) => O(o, t));
2129
2105
  }, Ht = (o, t) => {
2130
2106
  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");
2107
+ T(i, "open") || q(i, "open"), l && (O(l, "show"), Ne(l)), q(t, "bottom"), eo(t), q(t, "show"), a && o.update(), o.isOpen || (He(o, !0), o.updateDropdownPosition(), o.isOpen = !0, m(o.input, X, "0"), r && m(r, X, "0")), m(h, Nt, "true"), c && m(c, Nt, "false");
2132
2108
  };
2133
- class ko {
2109
+ class mo {
2134
2110
  // bring utils to staic
2135
2111
  static Color = y;
2136
- static ColorPalette = Kt;
2137
- static getInstance = wo;
2138
- static init = $o;
2139
- static selector = mo;
2112
+ static ColorPalette = It;
2113
+ static getInstance = po;
2114
+ static init = fo;
2115
+ static selector = uo;
2140
2116
  // utils important for render
2141
2117
  static roundPart = k;
2142
2118
  static setElementStyle = D;
2143
2119
  static setAttribute = m;
2144
2120
  static getBoundingClientRect = gt;
2145
- static version = fo;
2146
- static colorNames = mt;
2147
- static colorPickerLabels = Vt;
2121
+ static version = go;
2122
+ static colorNames = it;
2123
+ static colorPickerLabels = Kt;
2148
2124
  id;
2149
2125
  input;
2150
2126
  color;
@@ -2153,7 +2129,7 @@ class ko {
2153
2129
  dragElement;
2154
2130
  isOpen = !1;
2155
2131
  controlPositions;
2156
- colorLabels = {};
2132
+ colorLabels = Zt(it.map((t) => [t, t]));
2157
2133
  colorKeywords;
2158
2134
  colorPresets;
2159
2135
  componentLabels;
@@ -2173,43 +2149,37 @@ class ko {
2173
2149
  * @param config instance options
2174
2150
  */
2175
2151
  constructor(t, e) {
2176
- const s = _(t);
2177
- if (typeof t > "u")
2178
- throw new TypeError("ColorPicker target not specified.");
2179
- if (V(t) && !s)
2180
- throw new TypeError(`ColorPicker target "${t}" cannot be found.`);
2152
+ const s = z(t);
2153
+ if (typeof t > "u") throw new TypeError("ColorPicker target not specified.");
2154
+ if (B(t) && !s) throw new TypeError(`ColorPicker target "${t}" cannot be found.`);
2181
2155
  this.input = s;
2182
- const r = me(s, le);
2183
- if (!r)
2184
- throw new TypeError("ColorPicker requires a specific markup to work.");
2185
- this.parent = r, this.id = fe(s, Z), this.dragElement = void 0, this.isOpen = !1, this.controlPositions = {
2156
+ const r = fe(s, ce);
2157
+ if (!r) throw new TypeError("ColorPicker requires a specific markup to work.");
2158
+ this.parent = r, this.id = de(s, Y), this.dragElement = void 0, this.isOpen = !1, this.controlPositions = {
2186
2159
  c1x: 0,
2187
2160
  c1y: 0,
2188
2161
  c2y: 0,
2189
2162
  c3y: 0
2190
- }, this.colorLabels = {}, this.colorKeywords = !1, this.colorPresets = !1;
2191
- const { format: n, componentLabels: i, colorLabels: a, colorKeywords: l, colorPresets: c } = ro(
2163
+ }, this.colorKeywords = !1, this.colorPresets = !1;
2164
+ const { format: n, componentLabels: i, colorLabels: a, colorKeywords: l, colorPresets: c } = to(
2192
2165
  s,
2193
- vo,
2166
+ bo,
2194
2167
  e || {}
2195
2168
  );
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) => {
2198
- this.colorLabels[p] = h[f].trim();
2199
- });
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)
2169
+ let h = it;
2170
+ Lt(a) && a.length === 17 ? h = a : B(a) && a.split(",").length === 17 && (h = a.split(",")), K(this.colorLabels, Zt(h.map((p, f) => [it[f], p])));
2171
+ const b = B(i) && ae(i) ? JSON.parse(i) : i;
2172
+ if (this.componentLabels = K({ ...Kt }, b), this.color = new y(s.value || "#fff", n), this.format = n, Lt(l) && l.length ? this.colorKeywords = l : B(l) && l.length && (this.colorKeywords = l.split(",").map((p) => p.trim())), Lt(c) && c.length)
2202
2173
  this.colorPresets = c;
2203
- else if (c && ie(c)) {
2174
+ else if (c && ae(c)) {
2204
2175
  const { hue: p, hueSteps: f, lightSteps: w, saturation: $ } = JSON.parse(c);
2205
- this.colorPresets = new Kt(p, f, w, $);
2206
- } else
2207
- V(c) && (this.colorPresets = c.split(",").map((p) => p.trim()));
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);
2176
+ this.colorPresets = new It(p, f, w, $);
2177
+ } else B(c) && (this.colorPresets = c.split(",").map((p) => p.trim()));
2178
+ ho(this);
2179
+ const [u, d] = st("color-dropdown", r);
2180
+ this.pickerToggle = z(".picker-toggle", r), this.menuToggle = z(".menu-toggle", r), this.colorPicker = u, this.colorMenu = d, this.inputs = [...st("color-input", r)];
2181
+ const [g] = st("color-controls", r);
2182
+ this.controls = g, this.controlKnobs = [...st("knob", g)], this.visuals = [...st("visual-control", g)], this.update(), he(this, !0), ct.set(s, Y, this);
2213
2183
  }
2214
2184
  /** Returns the current colour value */
2215
2185
  get value() {
@@ -2282,8 +2252,7 @@ class ko {
2282
2252
  else if (n >= 45 && n < 75) {
2283
2253
  const b = n > 46 && n < 54 && c < 80 && a > 90, u = n >= 54 && n < 75 && c < 80;
2284
2254
  h = b ? t.gold : t.yellow, h = u ? t.olive : h;
2285
- } else
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);
2255
+ } else 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);
2287
2256
  return h;
2288
2257
  }
2289
2258
  /** Updates `ColorPicker` visuals. */
@@ -2322,17 +2291,16 @@ class ko {
2322
2291
  * @this {ColorPicker}
2323
2292
  */
2324
2293
  handleDismiss = ({ code: t }) => {
2325
- this.isOpen && t === ze && this.hide();
2294
+ this.isOpen && t === qe && this.hide();
2326
2295
  };
2327
2296
  /**
2328
2297
  * The `ColorPicker` *scroll* event listener when open.
2329
2298
  *
2330
2299
  * @param e
2331
- * @this {ColorPicker}
2332
2300
  */
2333
2301
  handleScroll = (t) => {
2334
- const { activeElement: e } = K(this.input);
2335
- this.updateDropdownPosition(), ([be, je].includes(t.type) && this.dragElement || e && this.controlKnobs.includes(e)) && (t.stopPropagation(), t.preventDefault());
2302
+ const { activeElement: e } = V(this.input);
2303
+ this.updateDropdownPosition(), ([ue, Be].includes(t.type) && this.dragElement || e && this.controlKnobs.includes(e)) && (t.stopPropagation(), t.preventDefault());
2336
2304
  };
2337
2305
  /**
2338
2306
  * The `ColorPicker` keyboard event listener for menu navigation.
@@ -2340,8 +2308,8 @@ class ko {
2340
2308
  * @param e
2341
2309
  */
2342
2310
  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);
2311
+ 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 && Tt(i, "grid-template-columns").split(" ").length, h = l.indexOf(e), b = h > -1 && c && l[h - c], u = h > -1 && c && l[h + c];
2312
+ [j, ot, Wt].includes(s) && t.preventDefault(), a ? b && s === ot ? _(b) : u && s === j ? _(u) : r && s === ht ? _(r) : n && s === U && _(n) : r && [ht, ot].includes(s) ? _(r) : n && [U, j].includes(s) && _(n), [je, Wt].includes(s) && this.menuClickHandler(t);
2345
2313
  };
2346
2314
  /**
2347
2315
  * The `ColorPicker` click event listener for the colour menu presets / defaults.
@@ -2350,19 +2318,18 @@ class ko {
2350
2318
  * @this {ColorPicker}
2351
2319
  */
2352
2320
  menuClickHandler = (t) => {
2353
- const { target: e } = t, { colorMenu: s } = this, r = (xt(e, "data-value") || "").trim();
2354
- if (!r.length)
2355
- return;
2356
- const n = _("li.active", s);
2321
+ const { target: e } = t, { colorMenu: s } = this, r = (yt(e, "data-value") || "").trim();
2322
+ if (!r.length) return;
2323
+ const n = z("li.active", s);
2357
2324
  let i = r;
2358
2325
  i = bt.includes(i) ? "white" : i, i = i === "transparent" ? "rgba(0,0,0,0)" : i;
2359
2326
  const { r: a, g: l, b: c, a: h } = new y(i);
2360
- B(this.color, {
2327
+ K(this.color, {
2361
2328
  r: a,
2362
2329
  g: l,
2363
2330
  b: c,
2364
2331
  a: h
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));
2332
+ }), this.update(), n !== e && (n && (O(n, "active"), Pt(n, St)), q(e, "active"), m(e, St, "true"), bt.includes(r) && (this.value = r), ge(this));
2366
2333
  };
2367
2334
  /**
2368
2335
  * The `ColorPicker` *touchstart* / *mousedown* events listener for control knobs.
@@ -2370,10 +2337,11 @@ class ko {
2370
2337
  * @param e
2371
2338
  */
2372
2339
  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;
2340
+ if (t.button !== 0) return;
2341
+ 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 = Ct(l), w = s - f.scrollLeft - p.left, $ = r - f.scrollTop - p.top;
2374
2342
  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));
2343
+ const S = z("li.active", n);
2344
+ S && (O(S, "active"), Pt(S, St));
2377
2345
  }
2378
2346
  t.preventDefault();
2379
2347
  };
@@ -2384,7 +2352,7 @@ class ko {
2384
2352
  * @this
2385
2353
  */
2386
2354
  pointerUp = ({ target: t }) => {
2387
- const { parent: e } = this, s = K(e), r = _(`${le}.open`, s) !== null, n = s.getSelection();
2355
+ const { parent: e } = this, s = V(e), r = z(`${ce}.open`, s) !== null, n = s.getSelection();
2388
2356
  !this.dragElement && (!n || !n.toString().length) && !e.contains(t) && this.hide(r), this.dragElement = void 0;
2389
2357
  };
2390
2358
  /**
@@ -2394,9 +2362,8 @@ class ko {
2394
2362
  */
2395
2363
  pointerMove = (t) => {
2396
2364
  const { dragElement: e, visuals: s } = this, [r, n, i] = s, { pageX: a, pageY: l } = t;
2397
- if (!e)
2398
- return;
2399
- const c = gt(e), h = Lt(r), b = a - h.scrollLeft - c.left, u = l - h.scrollTop - c.top;
2365
+ if (!e) return;
2366
+ const c = gt(e), h = Ct(r), b = a - h.scrollLeft - c.left, u = l - h.scrollTop - c.top;
2400
2367
  e === r && this.changeControl1(b, u), e === n && this.changeControl2(u), e === i && this.changeAlpha(u);
2401
2368
  };
2402
2369
  /**
@@ -2406,24 +2373,22 @@ class ko {
2406
2373
  */
2407
2374
  handleKnobs = (t) => {
2408
2375
  const { target: e, code: s } = t;
2409
- if (![st, j, ht, G].includes(s))
2410
- return;
2376
+ if (![ot, j, ht, U].includes(s)) return;
2411
2377
  t.preventDefault();
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;
2378
+ 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;
2413
2379
  if (u) {
2414
2380
  let g = 0, p = 0;
2415
2381
  if (e === l) {
2416
2382
  const f = i / 100;
2417
- [ht, G].includes(s) ? this.controlPositions.c1x += s === G ? f : -f : [st, j].includes(s) && (this.controlPositions.c1y += s === j ? d : -d), g = this.controlPositions.c1x, p = this.controlPositions.c1y, this.changeControl1(g, p);
2418
- } else
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));
2383
+ [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);
2384
+ } 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));
2420
2385
  this.handleScroll(t);
2421
2386
  }
2422
2387
  };
2423
2388
  /** The event listener of the colour form inputs. */
2424
2389
  changeHandler = () => {
2425
2390
  let t;
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;
2391
+ 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(($) => 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
2392
  if (l === n || l && e.includes(l)) {
2428
2393
  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 = {
2429
2394
  h: u,
@@ -2441,12 +2406,12 @@ class ko {
2441
2406
  b: g,
2442
2407
  a: w
2443
2408
  };
2444
- const { r: $, g: P, b: L, a: S } = new y(t);
2445
- B(this.color, {
2409
+ const { r: $, g: S, b: L, a: P } = new y(t);
2410
+ K(this.color, {
2446
2411
  r: $,
2447
- g: P,
2412
+ g: S,
2448
2413
  b: L,
2449
- a: S
2414
+ a: P
2450
2415
  }), this.setControlPositions(), this.updateAppearance(), this.updateInputs(), this.updateControls(), this.updateVisuals(), l === n && f && (this.value = r);
2451
2416
  }
2452
2417
  };
@@ -2468,7 +2433,7 @@ class ko {
2468
2433
  v: b,
2469
2434
  a: u
2470
2435
  });
2471
- B(this.color, {
2436
+ K(this.color, {
2472
2437
  r: d,
2473
2438
  g,
2474
2439
  b: p,
@@ -2492,7 +2457,7 @@ class ko {
2492
2457
  v: c,
2493
2458
  a: h
2494
2459
  });
2495
- B(this.color, {
2460
+ K(this.color, {
2496
2461
  r: b,
2497
2462
  g: u,
2498
2463
  b: d,
@@ -2522,9 +2487,8 @@ class ko {
2522
2487
  };
2523
2488
  /** Updates the open dropdown position on *scroll* event. */
2524
2489
  updateDropdownPosition() {
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;
2526
- if (!h)
2527
- return;
2490
+ const { input: t, colorPicker: e, colorMenu: s } = this, r = gt(t), { top: n, bottom: i } = r, { offsetHeight: a } = t, l = Ct(t).clientHeight, h = T(e, "show") ? e : s;
2491
+ if (!h) return;
2528
2492
  const { offsetHeight: b } = h, u = l - i, d = n, g = n + b + a > l, p = n - b < 0;
2529
2493
  (T(h, "bottom") || !p) && u < d && g ? (O(h, "bottom"), q(h, "top")) : (O(h, "top"), q(h, "bottom"));
2530
2494
  }
@@ -2537,15 +2501,15 @@ class ko {
2537
2501
  updateAppearance() {
2538
2502
  const { componentLabels: t, color: e, parent: s, hsv: r, hex: n, format: i, controlKnobs: a } = this, { appearanceLabel: l, hexLabel: c, valueLabel: h } = t;
2539
2503
  let { r: b, g: u, b: d } = e.toRgb();
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;
2504
+ const [g, p, f] = a, w = k(r.h * 360), $ = e.a, S = k(r.s * 100), L = k(r.v * 100), P = this.appearance;
2541
2505
  let C = `${c} ${n.split("").join(" ")}`;
2542
2506
  if (i === "hwb") {
2543
- const { hwb: A } = this, F = k(A.w * 100), tt = k(A.b * 100);
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}`);
2507
+ const { hwb: A } = this, F = k(A.w * 100), Q = k(A.b * 100);
2508
+ C = `HWB: ${w}°, ${F}%, ${Q}%`, m(g, et, `${F}% & ${Q}%`), m(g, tt, `${F}`), m(p, _t, `${h}: ${C}. ${l}: ${P}.`), m(p, et, `${w}%`), m(p, tt, `${w}`);
2545
2509
  } else
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}`);
2510
+ [b, u, d] = [b, u, d].map(k), C = i === "hsl" ? `HSL: ${w}°, ${S}%, ${L}%` : C, C = i === "rgb" ? `RGB: ${b}, ${u}, ${d}` : C, m(g, et, `${L}% & ${S}%`), m(g, tt, `${L}`), m(p, _t, `${h}: ${C}. ${l}: ${P}.`), m(p, et, `${w}°`), m(p, tt, `${w}`);
2547
2511
  const M = k($ * 100);
2548
- m(f, ot, `${M}%`), m(f, et, `${M}`);
2512
+ m(f, et, `${M}%`), m(f, tt, `${M}`);
2549
2513
  const E = e.toString();
2550
2514
  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"));
2551
2515
  }
@@ -2578,7 +2542,7 @@ class ko {
2578
2542
  let { r: g, g: p, b: f } = this.rgb;
2579
2543
  [g, p, f] = [g, p, f].map(k), d = this.color.toRgbString(), a.value = `${g}`, l.value = `${p}`, c.value = `${f}`, h.value = `${b}`;
2580
2544
  }
2581
- this.value = d, !t && d !== e && he(this);
2545
+ this.value = d, !t && d !== e && ge(this);
2582
2546
  }
2583
2547
  /**
2584
2548
  * Toggle the `ColorPicker` dropdown visibility.
@@ -2613,21 +2577,21 @@ class ko {
2613
2577
  */
2614
2578
  hide(t) {
2615
2579
  if (this.isOpen) {
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);
2619
- }, b)), t || U(e), m(a, Y, "-1"), h === s && m(s, Y, "-1");
2580
+ 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 && Qe(c);
2581
+ this.value = this.color.toString(!0), c && (O(c, "show"), m(h, Nt, "false"), setTimeout(() => {
2582
+ Ne(c), z(".show", i) || (O(i, "open"), He(this), this.isOpen = !1);
2583
+ }, b)), t || _(e), m(a, X, "-1"), h === s && m(s, X, "-1");
2620
2584
  }
2621
2585
  }
2622
2586
  /** Removes `ColorPicker` from target `<input>`. */
2623
2587
  dispose() {
2624
2588
  const { input: t, parent: e } = this;
2625
- this.hide(!0), ce(this), [...e.children].forEach((s) => {
2589
+ this.hide(!0), he(this), [...e.children].forEach((s) => {
2626
2590
  s !== t && s.remove();
2627
- }), Ct(t, Y), D(t, { backgroundColor: "" }), ["txt-light", "txt-dark"].forEach((s) => O(e, s)), ct.remove(t, Z);
2591
+ }), Pt(t, X), D(t, { backgroundColor: "" }), ["txt-light", "txt-dark"].forEach((s) => O(e, s)), ct.remove(t, Y);
2628
2592
  }
2629
2593
  }
2630
2594
  export {
2631
- ko as default
2595
+ mo as default
2632
2596
  };
2633
2597
  //# sourceMappingURL=color-picker.mjs.map