@thednp/color-picker 2.0.0-alpha9 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) 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 → compile.cjs} +0 -0
  8. package/cypress/e2e/color-palette.cy.ts +0 -0
  9. package/cypress/e2e/color-picker.cy.ts +0 -0
  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 +0 -0
  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 +2 -1
  23. package/dist/css/color-picker.css +7 -7
  24. package/dist/css/color-picker.min.css +2 -2
  25. package/dist/css/color-picker.rtl.css +7 -7
  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 +11 -7
  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 +254 -289
  33. package/dist/js/color-picker.mjs.map +1 -1
  34. package/dts.config.ts +0 -0
  35. package/package.json +56 -54
  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 -6
  39. package/src/ts/colorPalette.ts +0 -0
  40. package/src/ts/index.ts +4 -4
  41. package/src/ts/interface/colorPickerLabels.ts +0 -0
  42. package/src/ts/interface/colorPickerOptions.ts +0 -0
  43. package/src/ts/interface/paletteOptions.ts +0 -0
  44. package/src/ts/util/colorNames.ts +0 -0
  45. package/src/ts/util/colorPickerLabels.ts +0 -0
  46. package/src/ts/util/getColorControls.ts +0 -0
  47. package/src/ts/util/getColorForm.ts +0 -0
  48. package/src/ts/util/getColorMenu.ts +0 -0
  49. package/src/ts/util/isValidJSON.ts +0 -0
  50. package/src/ts/util/setMarkup.ts +6 -4
  51. package/src/ts/util/vHidden.ts +0 -0
  52. package/tsconfig.json +2 -2
  53. package/{vite.config.ts → vite.config.mts} +1 -0
@@ -1,41 +1,25 @@
1
- const Z = {}, ue = (o) => {
2
- const { type: t, currentTarget: e } = o;
3
- [...Z[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
- }, be = (o, t, e, s) => {
9
- Z[t] || (Z[t] = /* @__PURE__ */ new Map());
10
- const r = Z[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, ue, s);
14
- }, jt = (o, t, e, s) => {
15
- const r = Z[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 Z[t], (!n || !n.size) && o.removeEventListener(t, ue, a);
17
- }, Ut = "aria-description", Et = "aria-expanded", Te = "aria-hidden", St = "aria-selected", et = "aria-valuenow", ot = "aria-valuetext", Re = "change", Oe = "DOMContentLoaded", De = "focusin", Fe = "focusout", _t = "keydown", Ie = "keyup", Mt = "click", Ke = "pointerdown", pe = "pointermove", Ve = "pointerup", Be = "resize", je = "scroll", qe = "touchmove", j = "ArrowDown", st = "ArrowUp", gt = "ArrowLeft", G = "ArrowRight", ze = "Enter", Ge = "Escape", Wt = "Space", Ue = "transitionDuration", _e = "transitionProperty", X = "tabindex", We = navigator.userAgentData, vt = We, { userAgent: Je } = navigator, wt = Je, Jt = /iPhone|iPad|iPod|Android/i;
18
- vt ? vt.brands.some((o) => Jt.test(o.brand)) : Jt.test(wt);
19
- const Zt = /(iPhone|iPod|iPad)/;
20
- vt ? vt.brands.some((o) => Zt.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
- Zt.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 Ze = (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
- }, Xe = (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]), Xe(o, t, r, s));
19
+ (n.target === o || n.currentTarget === o) && (e.apply(o, [n]), jt(o, t, r, s));
36
20
  };
37
- Ze(o, t, r, s);
38
- }, Qe = () => {
21
+ Bt(o, t, r, s);
22
+ }, Je = () => {
39
23
  };
40
24
  (() => {
41
25
  let o = !1;
@@ -43,19 +27,19 @@ const Ze = (o, t, e, s) => {
43
27
  const t = Object.defineProperty({}, "passive", {
44
28
  get: () => (o = !0, o)
45
29
  });
46
- Ye(document, Oe, Qe, 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, lt = (o) => Q(o) && o.nodeType === 1 || !1, W = /* @__PURE__ */ new Map(), ht = {
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.
@@ -65,7 +49,7 @@ const xt = (o, t) => o.getAttribute(t), m = (o, t, e) => o.setAttribute(t, e), C
65
49
  * @param instance the component instance
66
50
  */
67
51
  set: (o, t, e) => {
68
- lt(o) && (W.has(t) || W.set(t, /* @__PURE__ */ new Map()), W.get(t).set(o, e));
52
+ at(o) && (W.has(t) || W.set(t, /* @__PURE__ */ new Map()), W.get(t).set(o, e));
69
53
  },
70
54
  /**
71
55
  * Returns all instances for specified component.
@@ -82,9 +66,8 @@ 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 (!lt(o) || !t)
86
- return null;
87
- const e = ht.getAllFor(t);
69
+ if (!at(o) || !t) return null;
70
+ const e = ct.getAllFor(t);
88
71
  return o && e && e.get(o) || null;
89
72
  },
90
73
  /**
@@ -94,34 +77,30 @@ const xt = (o, t) => o.getAttribute(t), m = (o, t, e) => o.setAttribute(t, e), C
94
77
  * @param component the component's name or a unique key
95
78
  */
96
79
  remove: (o, t) => {
97
- const e = ht.getAllFor(t);
98
- !e || !lt(o) || (e.delete(o), e.size === 0 && W.delete(t));
80
+ const e = ct.getAllFor(t);
81
+ !e || !at(o) || (e.delete(o), e.size === 0 && W.delete(t));
99
82
  }
100
- }, to = (o, t) => ht.get(o, t), B = (o) => typeof o == "string" || !1, eo = (o) => qt(o) && o.constructor.name === "Window" || !1, de = (o) => Q(o) && o.nodeType === 9 || !1, V = (o) => eo(o) ? o.document : de(o) ? o : Q(o) ? o.ownerDocument : window.document, K = (o, ...t) => Object.assign(o, ...t), x = (o) => {
101
- if (!o)
102
- return;
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;
103
85
  if (B(o))
104
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
90
  return delete s.tagName, K(e, s);
110
- }, Tt = (o, t) => {
111
- if (!o || !t)
112
- return;
91
+ }, Mt = (o, t) => {
92
+ if (!o || !t) return;
113
93
  if (B(t))
114
94
  return V().createElementNS(o, t);
115
- const { tagName: e } = t, s = Tt(o, e);
116
- if (!s)
117
- return;
95
+ const { tagName: e } = t, s = Mt(o, e);
96
+ if (!s) return;
118
97
  const r = { ...t };
119
98
  return delete r.tagName, K(s, r);
120
- }, oo = (o, t) => o.dispatchEvent(t), Rt = (o, t) => {
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
- }, so = (o) => {
124
- const t = Rt(o, _e), e = Rt(o, Ue), 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,18 +111,18 @@ 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), Xt = (o) => ["true", !0].includes(o) ? !0 : ["false", !1].includes(o) ? !1 : ["null", "", null, void 0].includes(o) ? null : o !== "" && !Number.isNaN(+o) ? +o : o, dt = (o) => Object.entries(o), ro = (o) => o.toLowerCase(), no = (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
- return dt(n).forEach(([c, h]) => {
138
- const b = s && typeof c == "string" && c.includes(s) ? c.replace(s, "").replace(/[A-Z]/g, (u) => ro(u)) : c;
139
- a[b] = Xt(h);
140
- }), dt(r).forEach(([c, h]) => {
141
- r[c] = Xt(h);
142
- }), dt(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;
116
+ return pt(n).forEach(([c, h]) => {
117
+ const b = c;
118
+ a[b] = Yt(h);
119
+ }), pt(r).forEach(([c, h]) => {
120
+ r[c] = Yt(h);
121
+ }), pt(t).forEach(([c, 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
- }, Yt = (o) => Object.fromEntries(o), io = (o) => o.offsetHeight, D = (o, t) => {
146
- dt(t).forEach(([e, s]) => {
124
+ }, Zt = (o) => Object.fromEntries(o), eo = (o) => o.offsetHeight, D = (o, t) => {
125
+ pt(t).forEach(([e, s]) => {
147
126
  if (s && B(e) && e.includes("--"))
148
127
  o.style.setProperty(e, s);
149
128
  else {
@@ -151,10 +130,10 @@ const xt = (o, t) => o.getAttribute(t), m = (o, t, e) => o.setAttribute(t, e), C
151
130
  r[e] = s, K(o.style, r);
152
131
  }
153
132
  });
154
- }, ao = (o) => qt(o) && o.constructor.name === "Map" || !1, fe = (o) => o.toUpperCase(), ut = (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
- if (t && lt(o)) {
136
+ if (t && at(o)) {
158
137
  const { offsetWidth: h, offsetHeight: b } = o;
159
138
  l = h > 0 ? Math.round(e) / h : (
160
139
  /* istanbul ignore next */
@@ -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) => V(o).documentElement;
156
+ }, Ct = (o) => V(o).documentElement;
178
157
  let Qt = 0, te = 0;
179
- const J = /* @__PURE__ */ new Map(), me = (o, t) => {
158
+ const J = /* @__PURE__ */ new Map(), de = (o, t) => {
180
159
  let e = t ? Qt : te;
181
160
  if (t) {
182
- const s = me(o), r = J.get(s) || /* @__PURE__ */ new Map();
183
- J.has(s) || J.set(s, r), ao(r) && !r.has(t) ? (r.set(t, e), Qt += 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
165
  J.has(s) ? e = J.get(s) : (J.set(s, e), te += 1);
187
166
  }
188
167
  return e;
189
- }, lo = (o) => {
168
+ }, so = (o) => {
190
169
  var t;
191
- return o ? de(o) ? o.defaultView : Q(o) ? (t = o?.ownerDocument) == null ? void 0 : t.defaultView : o : window;
192
- }, At = (o) => Array.isArray(o) || !1, ve = (o, t) => o ? o.closest(t) || // break out of `ShadowRoot`
193
- ve(o.getRootNode().host, t) : null, _ = (o, t) => lt(o) ? o : (Q(t) ? t : V()).querySelector(o), rt = (o, t) => (t && Q(t) ? t : V()).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 @@ ve(o.getRootNode().host, t) : null, _ = (o, t) => lt(o) ? o : (Q(t) ? t : V()).q
1380
1359
  b: 50
1381
1360
  }
1382
1361
  ]
1383
- ], we = "deg|rad|grad|turn", $e = "[-\\+]?\\d+%?", ke = "[-\\+]?\\d*\\.\\d+%?", ye = `[-\\+]?\\d*\\.?\\d+(?:${we})?`, ft = `(?:${ke})|(?:${$e})`, Ot = `(?:${ft})|(?:${ye}?)`, co = "(?:[\\s|\\(\\s|\\s\\(\\s]+)?", ho = "(?:[\\s|\\)\\s]+)?", ee = "(?:[,|\\s]+)", go = "(?:[,|\\/\\s]*)?", nt = `${co}(${Ot})${ee}(${ft})${ee}(${ft})${go}(${ft})?${ho}`, I = {
1384
- CSS_UNIT: new RegExp(Ot),
1385
- ANGLES: we,
1386
- CSS_ANGLE: ye,
1387
- CSS_INTEGER: $e,
1388
- CSS_NUMBER: ke,
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
- }, xe = (o) => zt.includes(o), it = (o, t) => o !== null && typeof o == "object" && Object.keys(t).every((e) => e in o), Pe = (o) => `${o}`.includes(".") && parseFloat(o) === 1, kt = (o) => typeof o == "string" && o.includes("%"), H = (o) => !!I.CSS_UNIT.exec(`${o}`), Se = ["rgb", "hex", "hsl", "hsv", "hwb"], Ce = (o) => zt.includes(o) || ["#", ...Se].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
- Pe(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
- }, bt = (o) => Math.min(1, Math.max(0, o)), z = (o) => o.length === 1 ? `0${o}` : String(o), Le = (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
- }, N = (o) => parseInt(o, 16), Ft = (o) => N(o) / 255, Ae = (o) => v(o * 255).toString(16), oe = (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;
@@ -1421,23 +1400,22 @@ ve(o.getRootNode().host, t) : null, _ = (o, t) => lt(o) ? o : (Q(t) ? t : V()).q
1421
1400
  i = a > 0.5 ? l / (2 - s - r) : l / (s + r), s === o && (n = (t - e) / l + (t < e ? 6 : 0)), s === t && (n = (e - o) / l + 2), s === e && (n = (o - t) / l + 4), n /= 6;
1422
1401
  }
1423
1402
  return { h: n, s: i, l: a };
1424
- }, mt = (o, t, e) => {
1403
+ }, ft = (o, t, e) => {
1425
1404
  let s = e;
1426
1405
  return s < 0 && (s += 1), s > 1 && (s -= 1), s < 1 / 6 ? o + (t - o) * (6 * s) : s < 1 / 2 ? t : s < 2 / 3 ? o + (t - o) * (2 / 3 - s) * 6 : o;
1427
- }, ct = (o, t, e) => {
1406
+ }, lt = (o, t, e) => {
1428
1407
  let s = 0, r = 0, n = 0;
1429
1408
  if (t === 0)
1430
1409
  r = e, n = e, s = e;
1431
1410
  else if (e) {
1432
1411
  const i = e < 0.5 ? e * (1 + t) : e + t - e * t, a = 2 * e - i;
1433
- s = mt(a, i, o + 1 / 3), r = mt(a, i, o), n = mt(a, i, o - 1 / 3);
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
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 @@ ve(o.getRootNode().host, t) : null, _ = (o, t) => lt(o) ? o : (Q(t) ? t : V()).q
1445
1423
  w: n,
1446
1424
  b: a
1447
1425
  };
1448
- }, He = (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
- let { r: s, g: r, b: n } = ct(o, 1, 0.5);
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
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
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
- }, Ht = (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(Ae(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
- if (Ce(t))
1481
- return Object.assign(Le(t), {
1458
+ if (Se(t))
1459
+ return Object.assign(Pe(t), {
1482
1460
  a: 1,
1483
1461
  format: "rgb",
1484
1462
  ok: !0
1485
1463
  });
1486
- if (xe(t))
1464
+ if (ke(t))
1487
1465
  return {
1488
1466
  r: 0,
1489
1467
  g: 0,
@@ -1525,7 +1503,7 @@ ve(o.getRootNode().host, t) : null, _ = (o, t) => lt(o) ? o : (Q(t) ? t : V()).q
1525
1503
  r: N(e),
1526
1504
  g: N(s),
1527
1505
  b: N(r),
1528
- a: Ft(n),
1506
+ a: Dt(n),
1529
1507
  format: "hex",
1530
1508
  ok: !0
1531
1509
  } : ([, e, s, r] = I.hex6.exec(t) || [], e && s && r ? {
@@ -1539,7 +1517,7 @@ ve(o.getRootNode().host, t) : null, _ = (o, t) => lt(o) ? o : (Q(t) ? t : V()).q
1539
1517
  r: N(e + e),
1540
1518
  g: N(s + s),
1541
1519
  b: N(r + r),
1542
- a: Ft(n + n),
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 ? {
@@ -1559,47 +1537,47 @@ ve(o.getRootNode().host, t) : null, _ = (o, t) => lt(o) ? o : (Q(t) ? t : V()).q
1559
1537
  })))))));
1560
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) && 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, 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 }) && 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 = It(c, r, n), u = "hsv"), it(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 = ct(c, r, i), u = "hsl"), it(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 = He(c, a, l), u = "hwb"), H(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
- }, uo = "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 = Pe;
1575
- static isPercentage = kt;
1552
+ static isOnePointZero = ye;
1553
+ static isPercentage = $t;
1576
1554
  static isValidCSSUnit = H;
1577
- static isNonColor = xe;
1578
- static isColorName = Ce;
1579
- static isColorType = it;
1580
- static pad2 = z;
1581
- static clamp01 = bt;
1555
+ static isNonColor = ke;
1556
+ static isColorName = Se;
1557
+ static isColorType = nt;
1558
+ static pad2 = G;
1559
+ static clamp01 = ut;
1582
1560
  static bound01 = R;
1583
- static boundAlpha = Dt;
1584
- static getRGBFromName = Le;
1585
- static convertHexToDecimal = Ft;
1586
- static convertDecimalToHex = Ae;
1561
+ static boundAlpha = Ot;
1562
+ static getRGBFromName = Pe;
1563
+ static convertHexToDecimal = Dt;
1564
+ static convertDecimalToHex = Ce;
1587
1565
  static rgbToHsl = oe;
1588
1566
  static rgbToHex = ne;
1589
1567
  static rgbToHsv = re;
1590
1568
  static rgbToHwb = se;
1591
- static rgbaToHex = Ht;
1592
- static hslToRgb = It;
1593
- static hsvToRgb = It;
1594
- static hueToRgb = mt;
1595
- static hwbToRgb = He;
1569
+ static rgbaToHex = At;
1570
+ static hslToRgb = Ft;
1571
+ static hsvToRgb = Ft;
1572
+ static hueToRgb = ft;
1573
+ static hwbToRgb = Le;
1596
1574
  static parseIntFromHex = N;
1597
- static stringInputToObject = Ne;
1575
+ static stringInputToObject = Ae;
1598
1576
  static inputToRGB = ie;
1599
1577
  static roundPart = v;
1600
- static webColors = $t;
1601
- static nonColors = zt;
1602
- static version = uo;
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 && Se.includes(e) ? e : "", { r, g: n, b: i, a, ok: l, format: c } = ie(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 ? ne(e, s, r, t) : Ht(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 Ht(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.
@@ -1782,15 +1760,14 @@ 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;
1793
- const { h: e, s, l: r } = this.toHsl(), { r: n, g: i, b: a } = ct(e, bt(s + t / 100), r);
1769
+ if (typeof t != "number") return this;
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
  }
1796
1773
  /**
@@ -1810,9 +1787,8 @@ 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;
1815
- const { h: e, s, l: r } = this.toHsl(), { r: n, g: i, b: a } = ct(e, s, bt(r + t / 100));
1790
+ if (typeof t != "number") return this;
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
  }
1818
1794
  /**
@@ -1826,9 +1802,8 @@ 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;
1831
- const { h: e, s, l: r } = this.toHsl(), { r: n, g: i, b: a } = ct(bt((e * 360 + t) % 360 / 360), s, r);
1805
+ if (typeof t != "number") return this;
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
  }
1834
1809
  /** Returns a clone of the current `Color` instance. */
@@ -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
- }, at = [
1883
+ }, it = [
1909
1884
  "white",
1910
1885
  "black",
1911
1886
  "grey",
@@ -1924,22 +1899,21 @@ const Vt = {
1924
1899
  "magenta",
1925
1900
  "pink"
1926
1901
  ], ae = (o) => {
1927
- if (!B(o))
1928
- return !1;
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", bo = (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" ? ["#"] : fe(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
  );
@@ -1969,7 +1943,7 @@ const Vt = {
1969
1943
  step: d
1970
1944
  }), r.append(h, b);
1971
1945
  }), r;
1972
- }, po = (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}`,
@@ -2024,46 +1998,47 @@ const Vt = {
2024
1998
  E.append(A), g.append(E);
2025
1999
  }), g;
2026
2000
  }, le = (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;
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
- }, fo = (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 : fe(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
- }), $ = po(o), P = bo(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
2064
  a && L.append(le(o, a, "color-options")), i && i.length && L.append(le(o, i, "color-defaults"));
2090
- const S = x({
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, Te, "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
2088
  i && c.includes(l) && (o.value = l), m(t, X, "-1");
2113
- }, mo = "2.0.0-alpha9", Y = "color-picker", vo = `[data-function="${Y}"]`, ce = `.${Y}`, wo = {
2114
- componentLabels: Vt,
2115
- colorLabels: at,
2089
+ }, go = "2.0.1", 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: pt } = y, $o = (o) => to(o, Y), ko = (o) => new yo(o), he = (o, t) => {
2120
- const e = t ? be : jt, { input: s, pickerToggle: r, menuToggle: n } = o;
2121
- e(s, De, o.showPicker), e(r, Mt, o.togglePicker), n && e(n, Mt, o.toggleMenu);
2122
- }, Ee = (o, t) => {
2123
- const e = t ? be : jt, { input: s, colorMenu: r, parent: n } = o, i = V(s), a = lo(i);
2124
- e(o.controls, Ke, o.pointerDown), o.controlKnobs.forEach((l) => e(l, _t, o.handleKnobs)), e(a, je, o.handleScroll), e(a, Be, o.update), [s, ...o.inputs].forEach((l) => e(l, Re, o.changeHandler)), r && (e(r, Mt, o.menuClickHandler), e(r, _t, o.menuKeyHandler)), e(i, pe, o.pointerMove), e(i, Ve, o.pointerUp), e(n, Fe, o.handleFocusOut), e(i, Ie, o.handleDismiss);
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);
2098
+ }, He = (o, t) => {
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);
2125
2101
  }, ge = (o) => {
2126
- oo(o.input, new CustomEvent("colorpicker.change"));
2127
- }, Me = (o) => {
2102
+ Ze(o.input, new CustomEvent("colorpicker.change"));
2103
+ }, Ne = (o) => {
2128
2104
  o && ["bottom", "top"].forEach((t) => O(o, t));
2129
- }, Nt = (o, t) => {
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"), Me(l)), q(t, "bottom"), io(t), q(t, "show"), a && o.update(), o.isOpen || (Ee(o, !0), o.updateDropdownPosition(), o.isOpen = !0, m(o.input, X, "0"), r && m(r, X, "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 yo {
2109
+ class mo {
2134
2110
  // bring utils to staic
2135
2111
  static Color = y;
2136
- static ColorPalette = Kt;
2137
- static getInstance = $o;
2138
- static init = ko;
2139
- static selector = vo;
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
- static getBoundingClientRect = ut;
2145
- static version = mo;
2146
- static colorNames = at;
2147
- static colorPickerLabels = Vt;
2120
+ static getBoundingClientRect = gt;
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 yo {
2153
2129
  dragElement;
2154
2130
  isOpen = !1;
2155
2131
  controlPositions;
2156
- colorLabels = Yt(at.map((t) => [t, t]));
2132
+ colorLabels = Zt(it.map((t) => [t, t]));
2157
2133
  colorKeywords;
2158
2134
  colorPresets;
2159
2135
  componentLabels;
@@ -2173,41 +2149,37 @@ class yo {
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 (B(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 = ve(s, ce);
2183
- if (!r)
2184
- throw new TypeError("ColorPicker requires a specific markup to work.");
2185
- this.parent = r, this.id = me(s, Y), 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
2163
  }, this.colorKeywords = !1, this.colorPresets = !1;
2191
- const { format: n, componentLabels: i, colorLabels: a, colorKeywords: l, colorPresets: c } = no(
2164
+ const { format: n, componentLabels: i, colorLabels: a, colorKeywords: l, colorPresets: c } = to(
2192
2165
  s,
2193
- wo,
2166
+ bo,
2194
2167
  e || {}
2195
2168
  );
2196
- let h = at;
2197
- At(a) && a.length === 17 ? h = a : B(a) && a.split(",").length === 17 && (h = a.split(",")), K(this.colorLabels, Yt(h.map((p, f) => [at[f], p])));
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])));
2198
2171
  const b = B(i) && ae(i) ? JSON.parse(i) : i;
2199
- if (this.componentLabels = K({ ...Vt }, b), this.color = new y(s.value || "#fff", n), this.format = n, At(l) && l.length ? this.colorKeywords = l : B(l) && l.length && (this.colorKeywords = l.split(",").map((p) => p.trim())), At(c) && c.length)
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)
2200
2173
  this.colorPresets = c;
2201
2174
  else if (c && ae(c)) {
2202
2175
  const { hue: p, hueSteps: f, lightSteps: w, saturation: $ } = JSON.parse(c);
2203
- this.colorPresets = new Kt(p, f, w, $);
2204
- } else
2205
- B(c) && (this.colorPresets = c.split(",").map((p) => p.trim()));
2206
- fo(this);
2207
- const [u, d] = rt("color-dropdown", r);
2208
- this.pickerToggle = _(".picker-toggle", r), this.menuToggle = _(".menu-toggle", r), this.colorPicker = u, this.colorMenu = d, this.inputs = [...rt("color-input", r)];
2209
- const [g] = rt("color-controls", r);
2210
- this.controls = g, this.controlKnobs = [...rt("knob", g)], this.visuals = [...rt("visual-control", g)], this.update(), he(this, !0), ht.set(s, Y, 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);
2211
2183
  }
2212
2184
  /** Returns the current colour value */
2213
2185
  get value() {
@@ -2223,7 +2195,7 @@ class yo {
2223
2195
  }
2224
2196
  /** Check if the colour presets include any non-colour. */
2225
2197
  get hasNonColor() {
2226
- return this.colorKeywords instanceof Array && this.colorKeywords.some((t) => pt.includes(t));
2198
+ return this.colorKeywords instanceof Array && this.colorKeywords.some((t) => bt.includes(t));
2227
2199
  }
2228
2200
  /** Returns hexadecimal value of the current colour. */
2229
2201
  get hex() {
@@ -2280,8 +2252,7 @@ class yo {
2280
2252
  else if (n >= 45 && n < 75) {
2281
2253
  const b = n > 46 && n < 54 && c < 80 && a > 90, u = n >= 54 && n < 75 && c < 80;
2282
2254
  h = b ? t.gold : t.yellow, h = u ? t.olive : h;
2283
- } else
2284
- 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);
2285
2256
  return h;
2286
2257
  }
2287
2258
  /** Updates `ColorPicker` visuals. */
@@ -2320,7 +2291,7 @@ class yo {
2320
2291
  * @this {ColorPicker}
2321
2292
  */
2322
2293
  handleDismiss = ({ code: t }) => {
2323
- this.isOpen && t === Ge && this.hide();
2294
+ this.isOpen && t === qe && this.hide();
2324
2295
  };
2325
2296
  /**
2326
2297
  * The `ColorPicker` *scroll* event listener when open.
@@ -2329,7 +2300,7 @@ class yo {
2329
2300
  */
2330
2301
  handleScroll = (t) => {
2331
2302
  const { activeElement: e } = V(this.input);
2332
- this.updateDropdownPosition(), ([pe, qe].includes(t.type) && this.dragElement || e && this.controlKnobs.includes(e)) && (t.stopPropagation(), t.preventDefault());
2303
+ this.updateDropdownPosition(), ([ue, Be].includes(t.type) && this.dragElement || e && this.controlKnobs.includes(e)) && (t.stopPropagation(), t.preventDefault());
2333
2304
  };
2334
2305
  /**
2335
2306
  * The `ColorPicker` keyboard event listener for menu navigation.
@@ -2337,8 +2308,8 @@ class yo {
2337
2308
  * @param e
2338
2309
  */
2339
2310
  menuKeyHandler = (t) => {
2340
- 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];
2341
- [j, st, Wt].includes(s) && t.preventDefault(), a ? b && s === st ? U(b) : u && s === j ? U(u) : r && s === gt ? U(r) : n && s === G && U(n) : r && [gt, st].includes(s) ? U(r) : n && [G, j].includes(s) && U(n), [ze, 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);
2342
2313
  };
2343
2314
  /**
2344
2315
  * The `ColorPicker` click event listener for the colour menu presets / defaults.
@@ -2347,19 +2318,18 @@ class yo {
2347
2318
  * @this {ColorPicker}
2348
2319
  */
2349
2320
  menuClickHandler = (t) => {
2350
- const { target: e } = t, { colorMenu: s } = this, r = (xt(e, "data-value") || "").trim();
2351
- if (!r.length)
2352
- return;
2353
- 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);
2354
2324
  let i = r;
2355
- i = pt.includes(i) ? "white" : i, i = i === "transparent" ? "rgba(0,0,0,0)" : i;
2325
+ i = bt.includes(i) ? "white" : i, i = i === "transparent" ? "rgba(0,0,0,0)" : i;
2356
2326
  const { r: a, g: l, b: c, a: h } = new y(i);
2357
2327
  K(this.color, {
2358
2328
  r: a,
2359
2329
  g: l,
2360
2330
  b: c,
2361
2331
  a: h
2362
- }), this.update(), n !== e && (n && (O(n, "active"), Ct(n, St)), q(e, "active"), m(e, St, "true"), pt.includes(r) && (this.value = r), ge(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));
2363
2333
  };
2364
2334
  /**
2365
2335
  * The `ColorPicker` *touchstart* / *mousedown* events listener for control knobs.
@@ -2367,12 +2337,11 @@ class yo {
2367
2337
  * @param e
2368
2338
  */
2369
2339
  pointerDown = (t) => {
2370
- if (t.button !== 0)
2371
- return;
2372
- 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 = ut(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;
2373
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) {
2374
- const P = _("li.active", n);
2375
- P && (O(P, "active"), Ct(P, St));
2343
+ const S = z("li.active", n);
2344
+ S && (O(S, "active"), Pt(S, St));
2376
2345
  }
2377
2346
  t.preventDefault();
2378
2347
  };
@@ -2383,7 +2352,7 @@ class yo {
2383
2352
  * @this
2384
2353
  */
2385
2354
  pointerUp = ({ target: t }) => {
2386
- const { parent: e } = this, s = V(e), r = _(`${ce}.open`, s) !== null, n = s.getSelection();
2355
+ const { parent: e } = this, s = V(e), r = z(`${ce}.open`, s) !== null, n = s.getSelection();
2387
2356
  !this.dragElement && (!n || !n.toString().length) && !e.contains(t) && this.hide(r), this.dragElement = void 0;
2388
2357
  };
2389
2358
  /**
@@ -2393,9 +2362,8 @@ class yo {
2393
2362
  */
2394
2363
  pointerMove = (t) => {
2395
2364
  const { dragElement: e, visuals: s } = this, [r, n, i] = s, { pageX: a, pageY: l } = t;
2396
- if (!e)
2397
- return;
2398
- const c = ut(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;
2399
2367
  e === r && this.changeControl1(b, u), e === n && this.changeControl2(u), e === i && this.changeAlpha(u);
2400
2368
  };
2401
2369
  /**
@@ -2405,24 +2373,22 @@ class yo {
2405
2373
  */
2406
2374
  handleKnobs = (t) => {
2407
2375
  const { target: e, code: s } = t;
2408
- if (![st, j, gt, G].includes(s))
2409
- return;
2376
+ if (![ot, j, ht, U].includes(s)) return;
2410
2377
  t.preventDefault();
2411
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;
2412
2379
  if (u) {
2413
2380
  let g = 0, p = 0;
2414
2381
  if (e === l) {
2415
2382
  const f = i / 100;
2416
- [gt, 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);
2417
- } else
2418
- 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));
2419
2385
  this.handleScroll(t);
2420
2386
  }
2421
2387
  };
2422
2388
  /** The event listener of the colour form inputs. */
2423
2389
  changeHandler = () => {
2424
2390
  let t;
2425
- 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 && pt.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;
2426
2392
  if (l === n || l && e.includes(l)) {
2427
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 = {
2428
2394
  h: u,
@@ -2440,12 +2406,12 @@ class yo {
2440
2406
  b: g,
2441
2407
  a: w
2442
2408
  };
2443
- const { r: $, g: P, b: L, a: S } = new y(t);
2409
+ const { r: $, g: S, b: L, a: P } = new y(t);
2444
2410
  K(this.color, {
2445
2411
  r: $,
2446
- g: P,
2412
+ g: S,
2447
2413
  b: L,
2448
- a: S
2414
+ a: P
2449
2415
  }), this.setControlPositions(), this.updateAppearance(), this.updateInputs(), this.updateControls(), this.updateVisuals(), l === n && f && (this.value = r);
2450
2416
  }
2451
2417
  };
@@ -2521,9 +2487,8 @@ class yo {
2521
2487
  };
2522
2488
  /** Updates the open dropdown position on *scroll* event. */
2523
2489
  updateDropdownPosition() {
2524
- const { input: t, colorPicker: e, colorMenu: s } = this, r = ut(t), { top: n, bottom: i } = r, { offsetHeight: a } = t, l = Lt(t).clientHeight, h = T(e, "show") ? e : s;
2525
- if (!h)
2526
- 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;
2527
2492
  const { offsetHeight: b } = h, u = l - i, d = n, g = n + b + a > l, p = n - b < 0;
2528
2493
  (T(h, "bottom") || !p) && u < d && g ? (O(h, "bottom"), q(h, "top")) : (O(h, "top"), q(h, "bottom"));
2529
2494
  }
@@ -2536,15 +2501,15 @@ class yo {
2536
2501
  updateAppearance() {
2537
2502
  const { componentLabels: t, color: e, parent: s, hsv: r, hex: n, format: i, controlKnobs: a } = this, { appearanceLabel: l, hexLabel: c, valueLabel: h } = t;
2538
2503
  let { r: b, g: u, b: d } = e.toRgb();
2539
- 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;
2540
2505
  let C = `${c} ${n.split("").join(" ")}`;
2541
2506
  if (i === "hwb") {
2542
- const { hwb: A } = this, F = k(A.w * 100), tt = k(A.b * 100);
2543
- 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}`);
2544
2509
  } else
2545
- [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}`);
2546
2511
  const M = k($ * 100);
2547
- m(f, ot, `${M}%`), m(f, et, `${M}`);
2512
+ m(f, et, `${M}%`), m(f, tt, `${M}`);
2548
2513
  const E = e.toString();
2549
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"));
2550
2515
  }
@@ -2587,12 +2552,12 @@ class yo {
2587
2552
  togglePicker = (t) => {
2588
2553
  t && t.preventDefault();
2589
2554
  const { colorPicker: e } = this;
2590
- this.isOpen && T(e, "show") ? this.hide(!0) : Nt(this, e);
2555
+ this.isOpen && T(e, "show") ? this.hide(!0) : Ht(this, e);
2591
2556
  };
2592
2557
  /** Shows the `ColorPicker` dropdown. */
2593
2558
  showPicker = () => {
2594
2559
  const { colorPicker: t } = this;
2595
- ["top", "bottom"].some((e) => T(t, e)) || Nt(this, t);
2560
+ ["top", "bottom"].some((e) => T(t, e)) || Ht(this, t);
2596
2561
  };
2597
2562
  /**
2598
2563
  * Toggles the visibility of the `ColorPicker` presets menu.
@@ -2603,7 +2568,7 @@ class yo {
2603
2568
  toggleMenu = (t) => {
2604
2569
  t && t.preventDefault();
2605
2570
  const { colorMenu: e } = this;
2606
- this.isOpen && T(e, "show") ? this.hide(!0) : Nt(this, e);
2571
+ this.isOpen && T(e, "show") ? this.hide(!0) : Ht(this, e);
2607
2572
  };
2608
2573
  /**
2609
2574
  * Hides the currently open `ColorPicker` dropdown.
@@ -2612,10 +2577,10 @@ class yo {
2612
2577
  */
2613
2578
  hide(t) {
2614
2579
  if (this.isOpen) {
2615
- 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 && so(c);
2616
- this.value = this.color.toString(!0), c && (O(c, "show"), m(h, Et, "false"), setTimeout(() => {
2617
- Me(c), _(".show", i) || (O(i, "open"), Ee(this), this.isOpen = !1);
2618
- }, b)), t || U(e), m(a, X, "-1"), h === s && m(s, X, "-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");
2619
2584
  }
2620
2585
  }
2621
2586
  /** Removes `ColorPicker` from target `<input>`. */
@@ -2623,10 +2588,10 @@ class yo {
2623
2588
  const { input: t, parent: e } = this;
2624
2589
  this.hide(!0), he(this), [...e.children].forEach((s) => {
2625
2590
  s !== t && s.remove();
2626
- }), Ct(t, X), D(t, { backgroundColor: "" }), ["txt-light", "txt-dark"].forEach((s) => O(e, s)), ht.remove(t, Y);
2591
+ }), Pt(t, X), D(t, { backgroundColor: "" }), ["txt-light", "txt-dark"].forEach((s) => O(e, s)), ct.remove(t, Y);
2627
2592
  }
2628
2593
  }
2629
2594
  export {
2630
- yo as default
2595
+ mo as default
2631
2596
  };
2632
2597
  //# sourceMappingURL=color-picker.mjs.map