@thednp/color-picker 2.0.0-alpha8 → 2.0.0-alpha9

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.
@@ -1,41 +1,41 @@
1
- const J = {}, ge = (o) => {
1
+ const Z = {}, ue = (o) => {
2
2
  const { type: t, currentTarget: e } = o;
3
- [...J[t]].forEach(([s, r]) => {
3
+ [...Z[t]].forEach(([s, r]) => {
4
4
  e === s && [...r].forEach(([n, i]) => {
5
5
  n.apply(s, [o]), typeof i == "object" && i.once && jt(s, t, n, i);
6
6
  });
7
7
  });
8
- }, ue = (o, t, e, s) => {
9
- J[t] || (J[t] = /* @__PURE__ */ new Map());
10
- const r = J[t];
8
+ }, be = (o, t, e, s) => {
9
+ Z[t] || (Z[t] = /* @__PURE__ */ new Map());
10
+ const r = Z[t];
11
11
  r.has(o) || r.set(o, /* @__PURE__ */ new Map());
12
12
  const n = r.get(o), { size: i } = n;
13
- n.set(e, s), i || o.addEventListener(t, ge, s);
13
+ n.set(e, s), i || o.addEventListener(t, ue, s);
14
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)) : (
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)) : (
21
21
  /* istanbul ignore next */
22
- Jt.test(wt)
22
+ Zt.test(wt)
23
23
  );
24
24
  wt && wt.includes("Firefox");
25
25
  const { head: yt } = document;
26
26
  ["webkitPerspective", "perspective"].some((o) => o in yt.style);
27
- const Xe = (o, t, e, s) => {
27
+ const Ze = (o, t, e, s) => {
28
28
  const r = s || !1;
29
29
  o.addEventListener(t, e, r);
30
- }, Je = (o, t, e, s) => {
30
+ }, Xe = (o, t, e, s) => {
31
31
  const r = s || !1;
32
32
  o.removeEventListener(t, e, r);
33
33
  }, Ye = (o, t, e, s) => {
34
34
  const r = (n) => {
35
- (n.target === o || n.currentTarget === o) && (e.apply(o, [n]), Je(o, t, r, s));
35
+ (n.target === o || n.currentTarget === o) && (e.apply(o, [n]), Xe(o, t, r, s));
36
36
  };
37
- Xe(o, t, r, s);
38
- }, Ze = () => {
37
+ Ze(o, t, r, s);
38
+ }, Qe = () => {
39
39
  };
40
40
  (() => {
41
41
  let o = !1;
@@ -43,7 +43,7 @@ const Xe = (o, t, e, s) => {
43
43
  const t = Object.defineProperty({}, "passive", {
44
44
  get: () => (o = !0, o)
45
45
  });
46
- Ye(document, Re, Ze, t);
46
+ Ye(document, Oe, Qe, t);
47
47
  } catch {
48
48
  }
49
49
  return o;
@@ -55,7 +55,7 @@ const xt = (o, t) => o.getAttribute(t), m = (o, t, e) => o.setAttribute(t, e), C
55
55
  o.classList.add(...t);
56
56
  }, O = (o, ...t) => {
57
57
  o.classList.remove(...t);
58
- }, T = (o, t) => o.classList.contains(t), 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 = {
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 = {
59
59
  data: W,
60
60
  /**
61
61
  * Sets web components data.
@@ -65,7 +65,7 @@ const xt = (o, t) => o.getAttribute(t), m = (o, t, e) => o.setAttribute(t, e), C
65
65
  * @param instance the component instance
66
66
  */
67
67
  set: (o, t, e) => {
68
- at(o) && (W.has(t) || W.set(t, /* @__PURE__ */ new Map()), W.get(t).set(o, e));
68
+ lt(o) && (W.has(t) || W.set(t, /* @__PURE__ */ new Map()), W.get(t).set(o, e));
69
69
  },
70
70
  /**
71
71
  * Returns all instances for specified component.
@@ -82,9 +82,9 @@ const xt = (o, t) => o.getAttribute(t), m = (o, t, e) => o.setAttribute(t, e), C
82
82
  * @returns the instance
83
83
  */
84
84
  get: (o, t) => {
85
- if (!at(o) || !t)
85
+ if (!lt(o) || !t)
86
86
  return null;
87
- const e = ct.getAllFor(t);
87
+ const e = ht.getAllFor(t);
88
88
  return o && e && e.get(o) || null;
89
89
  },
90
90
  /**
@@ -94,34 +94,34 @@ const xt = (o, t) => o.getAttribute(t), m = (o, t, e) => o.setAttribute(t, e), C
94
94
  * @param component the component's name or a unique key
95
95
  */
96
96
  remove: (o, t) => {
97
- const e = ct.getAllFor(t);
98
- !e || !at(o) || (e.delete(o), e.size === 0 && W.delete(t));
97
+ const e = ht.getAllFor(t);
98
+ !e || !lt(o) || (e.delete(o), e.size === 0 && W.delete(t));
99
99
  }
100
- }, Qe = (o, t) => ct.get(o, t), V = (o) => typeof o == "string" || !1, to = (o) => 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) => {
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
101
  if (!o)
102
102
  return;
103
- if (V(o))
104
- return K().createElement(o);
103
+ if (B(o))
104
+ return V().createElement(o);
105
105
  const { tagName: t } = o, e = x(t);
106
106
  if (!e)
107
107
  return;
108
108
  const s = { ...o };
109
- return delete s.tagName, B(e, s);
109
+ return delete s.tagName, K(e, s);
110
110
  }, Tt = (o, t) => {
111
111
  if (!o || !t)
112
112
  return;
113
- if (V(t))
114
- return K().createElementNS(o, t);
113
+ if (B(t))
114
+ return V().createElementNS(o, t);
115
115
  const { tagName: e } = t, s = Tt(o, e);
116
116
  if (!s)
117
117
  return;
118
118
  const r = { ...t };
119
- return delete r.tagName, B(s, r);
120
- }, eo = (o, t) => o.dispatchEvent(t), Rt = (o, t) => {
119
+ return delete r.tagName, K(s, r);
120
+ }, oo = (o, t) => o.dispatchEvent(t), Rt = (o, t) => {
121
121
  const e = getComputedStyle(o), s = t.replace("webkit", "Webkit").replace(/([A-Z])/g, "-$1").toLowerCase();
122
122
  return e.getPropertyValue(s);
123
- }, oo = (o) => {
124
- const t = Rt(o, Ue), e = Rt(o, Ge), s = e.includes("ms") ? (
123
+ }, so = (o) => {
124
+ const t = Rt(o, _e), e = Rt(o, Ue), s = e.includes("ms") ? (
125
125
  /* istanbul ignore next */
126
126
  1
127
127
  ) : 1e3, r = t && t !== "none" ? parseFloat(e) * s : (
@@ -132,29 +132,29 @@ const xt = (o, t) => o.getAttribute(t), m = (o, t, e) => o.setAttribute(t, e), C
132
132
  /* istanbul ignore next */
133
133
  0
134
134
  ) : r;
135
- }, U = (o, t) => o.focus(t), Yt = (o) => ["true", !0].includes(o) ? !0 : ["false", !1].includes(o) ? !1 : ["null", "", null, void 0].includes(o) ? null : o !== "" && !Number.isNaN(+o) ? +o : o, pt = (o) => Object.entries(o), so = (o) => o.toLowerCase(), ro = (o, t, e, s) => {
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) => {
136
136
  const r = { ...e }, n = { ...o.dataset }, i = { ...t }, a = {}, l = "title";
137
- 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;
139
- a[b] = Yt(h);
140
- }), pt(r).forEach(([c, h]) => {
141
- r[c] = Yt(h);
142
- }), pt(t).forEach(([c, h]) => {
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
143
  c in r ? i[c] = r[c] : c in a ? i[c] = a[c] : i[c] = c === l ? xt(o, l) : h;
144
144
  }), i;
145
- }, no = (o) => o.offsetHeight, D = (o, t) => {
146
- pt(t).forEach(([e, s]) => {
147
- if (s && V(e) && e.includes("--"))
145
+ }, Yt = (o) => Object.fromEntries(o), io = (o) => o.offsetHeight, D = (o, t) => {
146
+ dt(t).forEach(([e, s]) => {
147
+ if (s && B(e) && e.includes("--"))
148
148
  o.style.setProperty(e, s);
149
149
  else {
150
150
  const r = {};
151
- r[e] = s, B(o.style, r);
151
+ r[e] = s, K(o.style, r);
152
152
  }
153
153
  });
154
- }, io = (o) => qt(o) && o.constructor.name === "Map" || !1, de = (o) => o.toUpperCase(), gt = (o, t) => {
154
+ }, ao = (o) => qt(o) && o.constructor.name === "Map" || !1, fe = (o) => o.toUpperCase(), ut = (o, t) => {
155
155
  const { width: e, height: s, top: r, right: n, bottom: i, left: a } = o.getBoundingClientRect();
156
156
  let l = 1, c = 1;
157
- if (t && at(o)) {
157
+ if (t && lt(o)) {
158
158
  const { offsetWidth: h, offsetHeight: b } = o;
159
159
  l = h > 0 ? Math.round(e) / h : (
160
160
  /* istanbul ignore next */
@@ -174,23 +174,23 @@ const xt = (o, t) => o.getAttribute(t), m = (o, t, e) => o.setAttribute(t, e), C
174
174
  x: a / l,
175
175
  y: r / c
176
176
  };
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;
177
+ }, Lt = (o) => V(o).documentElement;
178
+ let Qt = 0, te = 0;
179
+ const J = /* @__PURE__ */ new Map(), me = (o, t) => {
180
+ let e = t ? Qt : te;
181
181
  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);
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);
184
184
  } else {
185
185
  const s = o.id || o;
186
- X.has(s) ? e = X.get(s) : (X.set(s, e), Qt += 1);
186
+ J.has(s) ? e = J.get(s) : (J.set(s, e), te += 1);
187
187
  }
188
188
  return e;
189
- }, ao = (o) => {
189
+ }, lo = (o) => {
190
190
  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(
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(
194
194
  o
195
195
  ), zt = ["transparent", "currentColor", "inherit", "revert", "initial"], v = (o) => {
196
196
  const t = Math.floor(o);
@@ -1380,12 +1380,12 @@ me(o.getRootNode().host, t) : null, _ = (o, t) => at(o) ? o : (Q(t) ? t : K()).q
1380
1380
  b: 50
1381
1381
  }
1382
1382
  ]
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 = {
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
1384
  CSS_UNIT: new RegExp(Ot),
1385
- ANGLES: ve,
1386
- CSS_ANGLE: ke,
1387
- CSS_INTEGER: we,
1388
- CSS_NUMBER: $e,
1385
+ ANGLES: we,
1386
+ CSS_ANGLE: ye,
1387
+ CSS_INTEGER: $e,
1388
+ CSS_NUMBER: ke,
1389
1389
  CSS_UNIT2: Ot,
1390
1390
  PERMISSIVE_MATCH: nt,
1391
1391
  hwb: new RegExp(`hwb${nt}`),
@@ -1396,21 +1396,21 @@ me(o.getRootNode().host, t) : null, _ = (o, t) => at(o) ? o : (Q(t) ? t : K()).q
1396
1396
  hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
1397
1397
  hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
1398
1398
  hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
1399
- }, 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) => {
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) => {
1400
1400
  let e = o;
1401
1401
  if (typeof o == "number" && Math.min(o, 0) === 0 && // round values to 6 decimals Math.round(N * (10 ** 6)) / 10 ** 6
1402
1402
  Math.max(o, 1) === 1)
1403
1403
  return o;
1404
- xe(o) && (e = "100%");
1404
+ Pe(o) && (e = "100%");
1405
1405
  const s = kt(e);
1406
1406
  return e = t === 360 ? parseFloat(e) : Math.min(t, Math.max(0, parseFloat(e))), s && (e = e * t / 100), Math.abs(e - t) < 1e-6 ? 1 : (t === 360 ? e = (e < 0 ? e % t + t : e % t) / t : e = e % t / t, e);
1407
1407
  }, Dt = (o) => {
1408
1408
  let t = parseFloat(o);
1409
1409
  return (Number.isNaN(t) || t < 0 || t > 1) && (t = 1), t;
1410
- }, ut = (o) => Math.min(1, Math.max(0, o)), z = (o) => o.length === 1 ? `0${o}` : String(o), Ce = (o) => {
1410
+ }, bt = (o) => Math.min(1, Math.max(0, o)), z = (o) => o.length === 1 ? `0${o}` : String(o), Le = (o) => {
1411
1411
  const [[, t]] = $t.filter(([e]) => e === o.toLowerCase());
1412
1412
  return t;
1413
- }, H = (o) => parseInt(o, 16), Ft = (o) => H(o) / 255, Le = (o) => v(o * 255).toString(16), ee = (o, t, e) => {
1413
+ }, N = (o) => parseInt(o, 16), Ft = (o) => N(o) / 255, Ae = (o) => v(o * 255).toString(16), oe = (o, t, e) => {
1414
1414
  const s = Math.max(o, t, e), r = Math.min(o, t, e);
1415
1415
  let n = 0, i = 0;
1416
1416
  const a = (s + r) / 2;
@@ -1421,19 +1421,19 @@ me(o.getRootNode().host, t) : null, _ = (o, t) => at(o) ? o : (Q(t) ? t : K()).q
1421
1421
  i = a > 0.5 ? l / (2 - s - r) : l / (s + r), s === o && (n = (t - e) / l + (t < e ? 6 : 0)), s === t && (n = (e - o) / l + 2), s === e && (n = (o - t) / l + 4), n /= 6;
1422
1422
  }
1423
1423
  return { h: n, s: i, l: a };
1424
- }, ft = (o, t, e) => {
1424
+ }, mt = (o, t, e) => {
1425
1425
  let s = e;
1426
1426
  return s < 0 && (s += 1), s > 1 && (s -= 1), s < 1 / 6 ? o + (t - o) * (6 * s) : s < 1 / 2 ? t : s < 2 / 3 ? o + (t - o) * (2 / 3 - s) * 6 : o;
1427
- }, lt = (o, t, e) => {
1427
+ }, ct = (o, t, e) => {
1428
1428
  let s = 0, r = 0, n = 0;
1429
1429
  if (t === 0)
1430
1430
  r = e, n = e, s = e;
1431
1431
  else if (e) {
1432
1432
  const i = e < 0.5 ? e * (1 + t) : e + t - e * t, a = 2 * e - i;
1433
- s = ft(a, i, o + 1 / 3), r = ft(a, i, o), n = ft(a, i, o - 1 / 3);
1433
+ s = mt(a, i, o + 1 / 3), r = mt(a, i, o), n = mt(a, i, o - 1 / 3);
1434
1434
  }
1435
1435
  return { r: s, g: r, b: n };
1436
- }, oe = (o, t, e) => {
1436
+ }, se = (o, t, e) => {
1437
1437
  let s = 0, r = 0;
1438
1438
  const n = Math.min(o, t, e), i = Math.max(o, t, e), a = 1 - i;
1439
1439
  if (i === n)
@@ -1445,14 +1445,14 @@ me(o.getRootNode().host, t) : null, _ = (o, t) => at(o) ? o : (Q(t) ? t : K()).q
1445
1445
  w: n,
1446
1446
  b: a
1447
1447
  };
1448
- }, Ae = (o, t, e) => {
1448
+ }, He = (o, t, e) => {
1449
1449
  if (t + e >= 1) {
1450
1450
  const i = t / (t + e);
1451
1451
  return { r: i, g: i, b: i };
1452
1452
  }
1453
- let { r: s, g: r, b: n } = lt(o, 1, 0.5);
1453
+ let { r: s, g: r, b: n } = ct(o, 1, 0.5);
1454
1454
  return [s, r, n] = [s, r, n].map((i) => i * (1 - t - e) + t), { r: s, g: r, b: n };
1455
- }, se = (o, t, e) => {
1455
+ }, re = (o, t, e) => {
1456
1456
  const s = Math.max(o, t, e), r = Math.min(o, t, e);
1457
1457
  let n = 0;
1458
1458
  const i = s, a = s - r, l = s === 0 ? 0 : a / s;
@@ -1460,30 +1460,30 @@ me(o.getRootNode().host, t) : null, _ = (o, t) => at(o) ? o : (Q(t) ? t : K()).q
1460
1460
  }, It = (o, t, e) => {
1461
1461
  const s = o * 6, r = t, n = e, i = Math.floor(s), a = s - i, l = n * (1 - r), c = n * (1 - a * r), h = n * (1 - (1 - a) * r), b = i % 6, u = [n, c, l, l, h, n][b], d = [h, n, n, c, l, l][b], g = [l, l, h, n, n, c][b];
1462
1462
  return { r: u, g: d, b: g };
1463
- }, re = (o, t, e, s) => {
1463
+ }, ne = (o, t, e, s) => {
1464
1464
  const r = [
1465
1465
  z(v(o).toString(16)),
1466
1466
  z(v(t).toString(16)),
1467
1467
  z(v(e).toString(16))
1468
1468
  ];
1469
1469
  return s && r[0].charAt(0) === r[0].charAt(1) && r[1].charAt(0) === r[1].charAt(1) && r[2].charAt(0) === r[2].charAt(1) ? r[0].charAt(0) + r[1].charAt(0) + r[2].charAt(0) : r.join("");
1470
- }, Nt = (o, t, e, s, r) => {
1470
+ }, Ht = (o, t, e, s, r) => {
1471
1471
  const n = [
1472
1472
  z(v(o).toString(16)),
1473
1473
  z(v(t).toString(16)),
1474
1474
  z(v(e).toString(16)),
1475
- z(Le(s))
1475
+ z(Ae(s))
1476
1476
  ];
1477
1477
  return r && n[0].charAt(0) === n[0].charAt(1) && n[1].charAt(0) === n[1].charAt(1) && n[2].charAt(0) === n[2].charAt(1) && n[3].charAt(0) === n[3].charAt(1) ? n[0].charAt(0) + n[1].charAt(0) + n[2].charAt(0) + n[3].charAt(0) : n.join("");
1478
1478
  }, Ne = (o) => {
1479
1479
  const t = String(o).trim().toLowerCase();
1480
- if (Se(t))
1481
- return Object.assign(Ce(t), {
1480
+ if (Ce(t))
1481
+ return Object.assign(Le(t), {
1482
1482
  a: 1,
1483
1483
  format: "rgb",
1484
1484
  ok: !0
1485
1485
  });
1486
- if (ye(t))
1486
+ if (xe(t))
1487
1487
  return {
1488
1488
  r: 0,
1489
1489
  g: 0,
@@ -1522,30 +1522,30 @@ me(o.getRootNode().host, t) : null, _ = (o, t) => at(o) ? o : (Q(t) ? t : K()).q
1522
1522
  format: "hwb",
1523
1523
  ok: !0
1524
1524
  } : ([, e, s, r, n] = I.hex8.exec(t) || [], e && s && r && n ? {
1525
- r: H(e),
1526
- g: H(s),
1527
- b: H(r),
1525
+ r: N(e),
1526
+ g: N(s),
1527
+ b: N(r),
1528
1528
  a: Ft(n),
1529
1529
  format: "hex",
1530
1530
  ok: !0
1531
1531
  } : ([, e, s, r] = I.hex6.exec(t) || [], e && s && r ? {
1532
- r: H(e),
1533
- g: H(s),
1534
- b: H(r),
1532
+ r: N(e),
1533
+ g: N(s),
1534
+ b: N(r),
1535
1535
  a: 1,
1536
1536
  format: "hex",
1537
1537
  ok: !0
1538
1538
  } : ([, e, s, r, n] = I.hex4.exec(t) || [], e && s && r && n ? {
1539
- r: H(e + e),
1540
- g: H(s + s),
1541
- b: H(r + r),
1539
+ r: N(e + e),
1540
+ g: N(s + s),
1541
+ b: N(r + r),
1542
1542
  a: Ft(n + n),
1543
1543
  format: "hex",
1544
1544
  ok: !0
1545
1545
  } : ([, e, s, r] = I.hex3.exec(t) || [], e && s && r ? {
1546
- r: H(e + e),
1547
- g: H(s + s),
1548
- b: H(r + r),
1546
+ r: N(e + e),
1547
+ g: N(s + s),
1548
+ b: N(r + r),
1549
1549
  a: 1,
1550
1550
  format: "hex",
1551
1551
  ok: !0
@@ -1557,9 +1557,9 @@ me(o.getRootNode().host, t) : null, _ = (o, t) => at(o) ? o : (Q(t) ? t : K()).q
1557
1557
  format: "rgb",
1558
1558
  ok: !o
1559
1559
  })))))));
1560
- }, ne = (o) => {
1560
+ }, ie = (o) => {
1561
1561
  let t = { r: 0, g: 0, b: 0 }, e = o, s = 1, r, n, i, a, l, c, h, b, u = "rgb", d = !1;
1562
- return (!e || typeof e == "string") && (e = Ne(e), d = e.ok), it(e, t) && N(e.r) && N(e.g) && N(e.b) && ({ r: h, g: b, b: l } = e, [h, b, l] = [h, b, l].map((g) => R(g, kt(g) ? 100 : 255)), t = { r: h, g: b, b: l }, u = "format" in e ? e.format : "rgb"), it(e, { h: 0, s: 0, v: 0 }) && N(e.h) && N(e.s) && N(e.v) && ({ h: c, s: r, v: n } = e, c = R(c, 360), r = R(r, 100), n = R(n, 100), t = It(c, r, n), u = "hsv"), it(e, { h: 0, s: 0, l: 0 }) && N(e.h) && N(e.s) && N(e.l) && ({ h: c, s: r, l: i } = e, c = R(c, 360), r = R(r, 100), i = R(i, 100), t = lt(c, r, i), u = "hsl"), it(e, { h: 0, w: 0, b: 0 }) && N(e.h) && N(e.w) && N(e.b) && ({ h: c, w: a, b: l } = e, c = R(c, 360), a = R(a, 100), l = R(l, 100), t = Ae(c, a, l), u = "hwb"), N(e.a) && (s = e.a, s = kt(s) || parseFloat(`${s}`) > 1 ? R(s, 100) : s), {
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), {
1563
1563
  r: t.r,
1564
1564
  g: t.g,
1565
1565
  b: t.b,
@@ -1567,39 +1567,39 @@ me(o.getRootNode().host, t) : null, _ = (o, t) => at(o) ? o : (Q(t) ? t : K()).q
1567
1567
  format: u,
1568
1568
  ok: d
1569
1569
  };
1570
- }, go = "1.0.8";
1570
+ }, uo = "1.0.8";
1571
1571
  class y {
1572
1572
  // bring main utilities to front
1573
1573
  static matchers = I;
1574
- static isOnePointZero = xe;
1574
+ static isOnePointZero = Pe;
1575
1575
  static isPercentage = kt;
1576
- static isValidCSSUnit = N;
1577
- static isNonColor = ye;
1578
- static isColorName = Se;
1576
+ static isValidCSSUnit = H;
1577
+ static isNonColor = xe;
1578
+ static isColorName = Ce;
1579
1579
  static isColorType = it;
1580
1580
  static pad2 = z;
1581
- static clamp01 = ut;
1581
+ static clamp01 = bt;
1582
1582
  static bound01 = R;
1583
1583
  static boundAlpha = Dt;
1584
- static getRGBFromName = Ce;
1584
+ static getRGBFromName = Le;
1585
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;
1586
+ static convertDecimalToHex = Ae;
1587
+ static rgbToHsl = oe;
1588
+ static rgbToHex = ne;
1589
+ static rgbToHsv = re;
1590
+ static rgbToHwb = se;
1591
+ static rgbaToHex = Ht;
1592
1592
  static hslToRgb = It;
1593
1593
  static hsvToRgb = It;
1594
- static hueToRgb = ft;
1595
- static hwbToRgb = Ae;
1596
- static parseIntFromHex = H;
1594
+ static hueToRgb = mt;
1595
+ static hwbToRgb = He;
1596
+ static parseIntFromHex = N;
1597
1597
  static stringInputToObject = Ne;
1598
- static inputToRGB = ne;
1598
+ static inputToRGB = ie;
1599
1599
  static roundPart = v;
1600
1600
  static webColors = $t;
1601
1601
  static nonColors = zt;
1602
- static version = go;
1602
+ static version = uo;
1603
1603
  // main public properties
1604
1604
  r;
1605
1605
  g;
@@ -1610,7 +1610,7 @@ class y {
1610
1610
  originalInput;
1611
1611
  // main public methods
1612
1612
  constructor(t, e) {
1613
- const s = e && Pe.includes(e) ? e : "", { r, g: n, b: i, a, ok: l, format: c } = ne(t);
1613
+ const s = e && Se.includes(e) ? e : "", { r, g: n, b: i, a, ok: l, format: c } = ie(t);
1614
1614
  this.originalInput = t, this.r = r, this.g = n, this.b = i, this.a = a, this.ok = l, this.format = s || c;
1615
1615
  }
1616
1616
  /**
@@ -1691,7 +1691,7 @@ class y {
1691
1691
  */
1692
1692
  toHex(t) {
1693
1693
  const { r: e, g: s, b: r, a: n } = this.toRgb();
1694
- return n === 1 ? re(e, s, r, t) : Nt(e, s, r, n, t);
1694
+ return n === 1 ? ne(e, s, r, t) : Ht(e, s, r, n, t);
1695
1695
  }
1696
1696
  /**
1697
1697
  * Returns the CSS valid hexadecimal vaue of the colour. When the parameter is *true*
@@ -1705,7 +1705,7 @@ class y {
1705
1705
  */
1706
1706
  toHex8(t) {
1707
1707
  const { r: e, g: s, b: r, a: n } = this.toRgb();
1708
- return Nt(e, s, r, n, t);
1708
+ return Ht(e, s, r, n, t);
1709
1709
  }
1710
1710
  /**
1711
1711
  * Returns the HEX8 value of the colour.
@@ -1717,7 +1717,7 @@ class y {
1717
1717
  * Returns the colour as a HSVA object.
1718
1718
  */
1719
1719
  toHsv() {
1720
- const { r: t, g: e, b: s, a: r } = this, { h: n, s: i, v: a } = se(t, e, s);
1720
+ const { r: t, g: e, b: s, a: r } = this, { h: n, s: i, v: a } = re(t, e, s);
1721
1721
  return {
1722
1722
  h: n,
1723
1723
  s: i,
@@ -1729,7 +1729,7 @@ class y {
1729
1729
  * Returns the colour as an HSLA object.
1730
1730
  */
1731
1731
  toHsl() {
1732
- const { r: t, g: e, b: s, a: r } = this, { h: n, s: i, l: a } = ee(t, e, s);
1732
+ const { r: t, g: e, b: s, a: r } = this, { h: n, s: i, l: a } = oe(t, e, s);
1733
1733
  return {
1734
1734
  h: n,
1735
1735
  s: i,
@@ -1761,7 +1761,7 @@ class y {
1761
1761
  * Returns the colour as an HWBA object.
1762
1762
  */
1763
1763
  toHwb() {
1764
- const { r: t, g: e, b: s, a: r } = this, { h: n, w: i, b: a } = oe(t, e, s);
1764
+ const { r: t, g: e, b: s, a: r } = this, { h: n, w: i, b: a } = se(t, e, s);
1765
1765
  return {
1766
1766
  h: n,
1767
1767
  w: i,
@@ -1790,7 +1790,7 @@ class y {
1790
1790
  saturate(t) {
1791
1791
  if (typeof t != "number")
1792
1792
  return this;
1793
- const { h: e, s, l: r } = this.toHsl(), { r: n, g: i, b: a } = lt(e, ut(s + t / 100), r);
1793
+ const { h: e, s, l: r } = this.toHsl(), { r: n, g: i, b: a } = ct(e, bt(s + t / 100), r);
1794
1794
  return Object.assign(this, { r: n, g: i, b: a }), this;
1795
1795
  }
1796
1796
  /**
@@ -1812,7 +1812,7 @@ class y {
1812
1812
  lighten(t) {
1813
1813
  if (typeof t != "number")
1814
1814
  return this;
1815
- const { h: e, s, l: r } = this.toHsl(), { r: n, g: i, b: a } = lt(e, s, ut(r + t / 100));
1815
+ const { h: e, s, l: r } = this.toHsl(), { r: n, g: i, b: a } = ct(e, s, bt(r + t / 100));
1816
1816
  return Object.assign(this, { r: n, g: i, b: a }), this;
1817
1817
  }
1818
1818
  /**
@@ -1828,7 +1828,7 @@ class y {
1828
1828
  spin(t) {
1829
1829
  if (typeof t != "number")
1830
1830
  return this;
1831
- const { h: e, s, l: r } = this.toHsl(), { r: n, g: i, b: a } = lt(ut((e * 360 + t) % 360 / 360), s, r);
1831
+ const { h: e, s, l: r } = this.toHsl(), { r: n, g: i, b: a } = ct(bt((e * 360 + t) % 360 / 360), s, r);
1832
1832
  return Object.assign(this, { r: n, g: i, b: a }), this;
1833
1833
  }
1834
1834
  /** Returns a clone of the current `Color` instance. */
@@ -1905,7 +1905,7 @@ const Vt = {
1905
1905
  redLabel: "Red",
1906
1906
  greenLabel: "Green",
1907
1907
  blueLabel: "Blue"
1908
- }, mt = [
1908
+ }, at = [
1909
1909
  "white",
1910
1910
  "black",
1911
1911
  "grey",
@@ -1923,8 +1923,8 @@ const Vt = {
1923
1923
  "violet",
1924
1924
  "magenta",
1925
1925
  "pink"
1926
- ], ie = (o) => {
1927
- if (!V(o))
1926
+ ], ae = (o) => {
1927
+ if (!B(o))
1928
1928
  return !1;
1929
1929
  try {
1930
1930
  JSON.parse(o);
@@ -1932,14 +1932,14 @@ const Vt = {
1932
1932
  return !1;
1933
1933
  }
1934
1934
  return !0;
1935
- }, Bt = "v-hidden", uo = (o) => {
1935
+ }, Bt = "v-hidden", bo = (o) => {
1936
1936
  const { format: t, id: e, componentLabels: s } = o, r = x({
1937
1937
  tagName: "div",
1938
1938
  className: `color-form ${t}`
1939
1939
  });
1940
1940
  let n = ["hex"];
1941
1941
  return t === "rgb" ? n = ["red", "green", "blue", "alpha"] : t === "hsl" ? n = ["hue", "saturation", "lightness", "alpha"] : t === "hwb" && (n = ["hue", "whiteness", "blackness", "alpha"]), n.forEach((i) => {
1942
- const [a] = t === "hex" ? ["#"] : de(i).split(""), l = `color_${t}_${i}_${e}`, c = s[`${i}Label`], h = x({ tagName: "label" });
1942
+ const [a] = t === "hex" ? ["#"] : fe(i).split(""), l = `color_${t}_${i}_${e}`, c = s[`${i}Label`], h = x({ tagName: "label" });
1943
1943
  m(h, "for", l), h.append(
1944
1944
  x({
1945
1945
  tagName: "span",
@@ -1963,13 +1963,13 @@ const Vt = {
1963
1963
  spellcheck: !1
1964
1964
  });
1965
1965
  let u = "100", d = "1";
1966
- i !== "alpha" && (t === "rgb" ? (u = "255", d = "1") : i === "hue" && (u = "360", d = "1")), B(b, {
1966
+ i !== "alpha" && (t === "rgb" ? (u = "255", d = "1") : i === "hue" && (u = "360", d = "1")), K(b, {
1967
1967
  min: "0",
1968
1968
  max: u,
1969
1969
  step: d
1970
1970
  }), r.append(h, b);
1971
1971
  }), r;
1972
- }, bo = (o) => {
1972
+ }, po = (o) => {
1973
1973
  const { format: t, componentLabels: e } = o, { hueLabel: s, alphaLabel: r, lightnessLabel: n, saturationLabel: i, whitenessLabel: a, blacknessLabel: l } = e, c = t === "hsl" ? 360 : 100, h = t === "hsl" ? 100 : 360, b = 100;
1974
1974
  let u = t === "hsl" ? `${s} & ${n}` : `${n} & ${i}`;
1975
1975
  u = t === "hwb" ? `${a} & ${l}` : u;
@@ -2023,7 +2023,7 @@ const Vt = {
2023
2023
  });
2024
2024
  E.append(A), g.append(E);
2025
2025
  }), g;
2026
- }, ae = (o, t, e) => {
2026
+ }, le = (o, t, e) => {
2027
2027
  const { input: s, format: r, componentLabels: n } = o, { defaultsLabel: i, presetsLabel: a } = n, l = e === "color-options", c = t instanceof Kt, h = l ? a : i, b = c ? t.colors : t, u = b.length, { lightSteps: d } = c ? t : { lightSteps: null }, g = d || [9, 10].find((A) => u >= A * 2 && !(u % A)) || 5, p = l && u > g;
2028
2028
  let f = 2;
2029
2029
  f = p && u > g * 2 ? 3 : f, f = p && u > g * 3 ? 4 : f, f = p && u > g * 4 ? 5 : f;
@@ -2058,10 +2058,10 @@ const Vt = {
2058
2058
  });
2059
2059
  m(Pt, "data-value", `${F}`), l && D(Pt, { backgroundColor: F }), E.append(Pt);
2060
2060
  }), E;
2061
- }, po = (o) => {
2061
+ }, fo = (o) => {
2062
2062
  const { input: t, parent: e, format: s, id: r, componentLabels: n, colorKeywords: i, colorPresets: a } = o, l = xt(t, "value") || "#fff", { nonColors: c } = y, { toggleLabel: h, pickerLabel: b, formatLabel: u, hexLabel: d } = n, g = c.includes(l) ? "#fff" : l;
2063
2063
  o.color = new y(g, s);
2064
- const p = s === "hex" ? d : de(s), f = x({
2064
+ const p = s === "hex" ? d : fe(s), f = x({
2065
2065
  id: `picker-btn-${r}`,
2066
2066
  tagName: "button",
2067
2067
  className: "picker-toggle btn-appearance",
@@ -2080,13 +2080,13 @@ const Vt = {
2080
2080
  className: "color-dropdown picker",
2081
2081
  role: "group",
2082
2082
  ariaLabelledBy: `picker-btn-${r}`
2083
- }), $ = bo(o), P = uo(o);
2083
+ }), $ = po(o), P = bo(o);
2084
2084
  if (w.append($, P), t.before(f), e.append(w), i || a) {
2085
2085
  const L = x({
2086
2086
  tagName: "div",
2087
2087
  className: "color-dropdown scrollable menu"
2088
2088
  });
2089
- a && L.append(ae(o, a, "color-options")), i && i.length && L.append(ae(o, i, "color-defaults"));
2089
+ a && L.append(le(o, a, "color-options")), i && i.length && L.append(le(o, i, "color-defaults"));
2090
2090
  const S = x({
2091
2091
  tagName: "button",
2092
2092
  className: "menu-toggle btn-appearance",
@@ -2096,7 +2096,7 @@ const Vt = {
2096
2096
  }), C = encodeURI("http://www.w3.org/2000/svg"), M = Tt(C, {
2097
2097
  tagName: "svg"
2098
2098
  });
2099
- m(M, "xmlns", C), m(M, "viewBox", "0 0 512 512"), m(M, Me, "true");
2099
+ m(M, "xmlns", C), m(M, "viewBox", "0 0 512 512"), m(M, Te, "true");
2100
2100
  const E = Tt(C, {
2101
2101
  tagName: "path"
2102
2102
  });
@@ -2109,41 +2109,41 @@ const Vt = {
2109
2109
  M
2110
2110
  ), e.append(S, L);
2111
2111
  }
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 = {
2112
+ 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
2114
  componentLabels: Vt,
2115
- colorLabels: mt,
2115
+ colorLabels: at,
2116
2116
  format: "rgb",
2117
2117
  colorPresets: !1,
2118
2118
  colorKeywords: !1
2119
- }, { roundPart: k, nonColors: bt } = y, wo = (o) => Qe(o, Z), $o = (o) => new ko(o), ce = (o, t) => {
2120
- const e = t ? ue : jt, { input: s, pickerToggle: r, menuToggle: n } = o;
2121
- e(s, Oe, o.showPicker), e(r, Mt, o.togglePicker), n && e(n, Mt, o.toggleMenu);
2122
- }, He = (o, t) => {
2123
- const e = t ? ue : jt, { input: s, colorMenu: r, parent: n } = o, i = K(s), a = ao(i);
2124
- e(o.controls, Ie, o.pointerDown), o.controlKnobs.forEach((l) => e(l, _t, o.handleKnobs)), e(a, Be, o.handleScroll), e(a, Ve, o.update), [s, ...o.inputs].forEach((l) => e(l, Te, o.changeHandler)), r && (e(r, Mt, o.menuClickHandler), e(r, _t, o.menuKeyHandler)), e(i, be, o.pointerMove), e(i, Ke, o.pointerUp), e(n, De, o.handleFocusOut), e(i, Fe, o.handleDismiss);
2125
- }, he = (o) => {
2126
- eo(o.input, new CustomEvent("colorpicker.change"));
2127
- }, Ee = (o) => {
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);
2125
+ }, ge = (o) => {
2126
+ oo(o.input, new CustomEvent("colorpicker.change"));
2127
+ }, Me = (o) => {
2128
2128
  o && ["bottom", "top"].forEach((t) => O(o, t));
2129
- }, Ht = (o, t) => {
2129
+ }, Nt = (o, t) => {
2130
2130
  const { colorPicker: e, colorMenu: s, menuToggle: r, pickerToggle: n, parent: i } = o, a = t === e, l = a ? s : e, c = a ? r : n, h = a ? n : r;
2131
- T(i, "open") || q(i, "open"), l && (O(l, "show"), Ee(l)), q(t, "bottom"), no(t), q(t, "show"), a && o.update(), o.isOpen || (He(o, !0), o.updateDropdownPosition(), o.isOpen = !0, m(o.input, Y, "0"), r && m(r, Y, "0")), m(h, Et, "true"), c && m(c, Et, "false");
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");
2132
2132
  };
2133
- class ko {
2133
+ class yo {
2134
2134
  // bring utils to staic
2135
2135
  static Color = y;
2136
2136
  static ColorPalette = Kt;
2137
- static getInstance = wo;
2138
- static init = $o;
2139
- static selector = mo;
2137
+ static getInstance = $o;
2138
+ static init = ko;
2139
+ static selector = vo;
2140
2140
  // utils important for render
2141
2141
  static roundPart = k;
2142
2142
  static setElementStyle = D;
2143
2143
  static setAttribute = m;
2144
- static getBoundingClientRect = gt;
2145
- static version = fo;
2146
- static colorNames = mt;
2144
+ static getBoundingClientRect = ut;
2145
+ static version = mo;
2146
+ static colorNames = at;
2147
2147
  static colorPickerLabels = Vt;
2148
2148
  id;
2149
2149
  input;
@@ -2153,7 +2153,7 @@ class ko {
2153
2153
  dragElement;
2154
2154
  isOpen = !1;
2155
2155
  controlPositions;
2156
- colorLabels = {};
2156
+ colorLabels = Yt(at.map((t) => [t, t]));
2157
2157
  colorKeywords;
2158
2158
  colorPresets;
2159
2159
  componentLabels;
@@ -2176,40 +2176,38 @@ class ko {
2176
2176
  const s = _(t);
2177
2177
  if (typeof t > "u")
2178
2178
  throw new TypeError("ColorPicker target not specified.");
2179
- if (V(t) && !s)
2179
+ if (B(t) && !s)
2180
2180
  throw new TypeError(`ColorPicker target "${t}" cannot be found.`);
2181
2181
  this.input = s;
2182
- const r = me(s, le);
2182
+ const r = ve(s, ce);
2183
2183
  if (!r)
2184
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 = {
2185
+ this.parent = r, this.id = me(s, Y), this.dragElement = void 0, this.isOpen = !1, this.controlPositions = {
2186
2186
  c1x: 0,
2187
2187
  c1y: 0,
2188
2188
  c2y: 0,
2189
2189
  c3y: 0
2190
- }, this.colorLabels = {}, this.colorKeywords = !1, this.colorPresets = !1;
2191
- const { format: n, componentLabels: i, colorLabels: a, colorKeywords: l, colorPresets: c } = ro(
2190
+ }, this.colorKeywords = !1, this.colorPresets = !1;
2191
+ const { format: n, componentLabels: i, colorLabels: a, colorKeywords: l, colorPresets: c } = no(
2192
2192
  s,
2193
- vo,
2193
+ wo,
2194
2194
  e || {}
2195
2195
  );
2196
- let h = mt;
2197
- At(a) && a.length === 17 ? h = a : V(a) && a.split(",").length === 17 && (h = a.split(",")), mt.forEach((p, f) => {
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)
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])));
2198
+ 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)
2202
2200
  this.colorPresets = c;
2203
- else if (c && ie(c)) {
2201
+ else if (c && ae(c)) {
2204
2202
  const { hue: p, hueSteps: f, lightSteps: w, saturation: $ } = JSON.parse(c);
2205
2203
  this.colorPresets = new Kt(p, f, w, $);
2206
2204
  } else
2207
- V(c) && (this.colorPresets = c.split(",").map((p) => p.trim()));
2208
- po(this);
2205
+ B(c) && (this.colorPresets = c.split(",").map((p) => p.trim()));
2206
+ fo(this);
2209
2207
  const [u, d] = rt("color-dropdown", r);
2210
2208
  this.pickerToggle = _(".picker-toggle", r), this.menuToggle = _(".menu-toggle", r), this.colorPicker = u, this.colorMenu = d, this.inputs = [...rt("color-input", r)];
2211
2209
  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);
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);
2213
2211
  }
2214
2212
  /** Returns the current colour value */
2215
2213
  get value() {
@@ -2225,7 +2223,7 @@ class ko {
2225
2223
  }
2226
2224
  /** Check if the colour presets include any non-colour. */
2227
2225
  get hasNonColor() {
2228
- return this.colorKeywords instanceof Array && this.colorKeywords.some((t) => bt.includes(t));
2226
+ return this.colorKeywords instanceof Array && this.colorKeywords.some((t) => pt.includes(t));
2229
2227
  }
2230
2228
  /** Returns hexadecimal value of the current colour. */
2231
2229
  get hex() {
@@ -2322,17 +2320,16 @@ class ko {
2322
2320
  * @this {ColorPicker}
2323
2321
  */
2324
2322
  handleDismiss = ({ code: t }) => {
2325
- this.isOpen && t === ze && this.hide();
2323
+ this.isOpen && t === Ge && this.hide();
2326
2324
  };
2327
2325
  /**
2328
2326
  * The `ColorPicker` *scroll* event listener when open.
2329
2327
  *
2330
2328
  * @param e
2331
- * @this {ColorPicker}
2332
2329
  */
2333
2330
  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());
2331
+ 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());
2336
2333
  };
2337
2334
  /**
2338
2335
  * The `ColorPicker` keyboard event listener for menu navigation.
@@ -2341,7 +2338,7 @@ class ko {
2341
2338
  */
2342
2339
  menuKeyHandler = (t) => {
2343
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];
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);
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);
2345
2342
  };
2346
2343
  /**
2347
2344
  * The `ColorPicker` click event listener for the colour menu presets / defaults.
@@ -2355,14 +2352,14 @@ class ko {
2355
2352
  return;
2356
2353
  const n = _("li.active", s);
2357
2354
  let i = r;
2358
- i = bt.includes(i) ? "white" : i, i = i === "transparent" ? "rgba(0,0,0,0)" : i;
2355
+ i = pt.includes(i) ? "white" : i, i = i === "transparent" ? "rgba(0,0,0,0)" : i;
2359
2356
  const { r: a, g: l, b: c, a: h } = new y(i);
2360
- B(this.color, {
2357
+ K(this.color, {
2361
2358
  r: a,
2362
2359
  g: l,
2363
2360
  b: c,
2364
2361
  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));
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));
2366
2363
  };
2367
2364
  /**
2368
2365
  * The `ColorPicker` *touchstart* / *mousedown* events listener for control knobs.
@@ -2370,7 +2367,9 @@ class ko {
2370
2367
  * @param e
2371
2368
  */
2372
2369
  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;
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;
2374
2373
  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
2374
  const P = _("li.active", n);
2376
2375
  P && (O(P, "active"), Ct(P, St));
@@ -2384,7 +2383,7 @@ class ko {
2384
2383
  * @this
2385
2384
  */
2386
2385
  pointerUp = ({ target: t }) => {
2387
- const { parent: e } = this, s = K(e), r = _(`${le}.open`, s) !== null, n = s.getSelection();
2386
+ const { parent: e } = this, s = V(e), r = _(`${ce}.open`, s) !== null, n = s.getSelection();
2388
2387
  !this.dragElement && (!n || !n.toString().length) && !e.contains(t) && this.hide(r), this.dragElement = void 0;
2389
2388
  };
2390
2389
  /**
@@ -2396,7 +2395,7 @@ class ko {
2396
2395
  const { dragElement: e, visuals: s } = this, [r, n, i] = s, { pageX: a, pageY: l } = t;
2397
2396
  if (!e)
2398
2397
  return;
2399
- const c = gt(e), h = Lt(r), b = a - h.scrollLeft - c.left, u = l - h.scrollTop - c.top;
2398
+ const c = ut(e), h = Lt(r), b = a - h.scrollLeft - c.left, u = l - h.scrollTop - c.top;
2400
2399
  e === r && this.changeControl1(b, u), e === n && this.changeControl2(u), e === i && this.changeAlpha(u);
2401
2400
  };
2402
2401
  /**
@@ -2406,15 +2405,15 @@ class ko {
2406
2405
  */
2407
2406
  handleKnobs = (t) => {
2408
2407
  const { target: e, code: s } = t;
2409
- if (![st, j, ht, G].includes(s))
2408
+ if (![st, j, gt, G].includes(s))
2410
2409
  return;
2411
2410
  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;
2411
+ 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
2412
  if (u) {
2414
2413
  let g = 0, p = 0;
2415
2414
  if (e === l) {
2416
2415
  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);
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);
2418
2417
  } else
2419
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));
2420
2419
  this.handleScroll(t);
@@ -2423,7 +2422,7 @@ class ko {
2423
2422
  /** The event listener of the colour form inputs. */
2424
2423
  changeHandler = () => {
2425
2424
  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;
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;
2427
2426
  if (l === n || l && e.includes(l)) {
2428
2427
  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
2428
  h: u,
@@ -2442,7 +2441,7 @@ class ko {
2442
2441
  a: w
2443
2442
  };
2444
2443
  const { r: $, g: P, b: L, a: S } = new y(t);
2445
- B(this.color, {
2444
+ K(this.color, {
2446
2445
  r: $,
2447
2446
  g: P,
2448
2447
  b: L,
@@ -2468,7 +2467,7 @@ class ko {
2468
2467
  v: b,
2469
2468
  a: u
2470
2469
  });
2471
- B(this.color, {
2470
+ K(this.color, {
2472
2471
  r: d,
2473
2472
  g,
2474
2473
  b: p,
@@ -2492,7 +2491,7 @@ class ko {
2492
2491
  v: c,
2493
2492
  a: h
2494
2493
  });
2495
- B(this.color, {
2494
+ K(this.color, {
2496
2495
  r: b,
2497
2496
  g: u,
2498
2497
  b: d,
@@ -2522,7 +2521,7 @@ class ko {
2522
2521
  };
2523
2522
  /** Updates the open dropdown position on *scroll* event. */
2524
2523
  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;
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;
2526
2525
  if (!h)
2527
2526
  return;
2528
2527
  const { offsetHeight: b } = h, u = l - i, d = n, g = n + b + a > l, p = n - b < 0;
@@ -2578,7 +2577,7 @@ class ko {
2578
2577
  let { r: g, g: p, b: f } = this.rgb;
2579
2578
  [g, p, f] = [g, p, f].map(k), d = this.color.toRgbString(), a.value = `${g}`, l.value = `${p}`, c.value = `${f}`, h.value = `${b}`;
2580
2579
  }
2581
- this.value = d, !t && d !== e && he(this);
2580
+ this.value = d, !t && d !== e && ge(this);
2582
2581
  }
2583
2582
  /**
2584
2583
  * Toggle the `ColorPicker` dropdown visibility.
@@ -2588,12 +2587,12 @@ class ko {
2588
2587
  togglePicker = (t) => {
2589
2588
  t && t.preventDefault();
2590
2589
  const { colorPicker: e } = this;
2591
- this.isOpen && T(e, "show") ? this.hide(!0) : Ht(this, e);
2590
+ this.isOpen && T(e, "show") ? this.hide(!0) : Nt(this, e);
2592
2591
  };
2593
2592
  /** Shows the `ColorPicker` dropdown. */
2594
2593
  showPicker = () => {
2595
2594
  const { colorPicker: t } = this;
2596
- ["top", "bottom"].some((e) => T(t, e)) || Ht(this, t);
2595
+ ["top", "bottom"].some((e) => T(t, e)) || Nt(this, t);
2597
2596
  };
2598
2597
  /**
2599
2598
  * Toggles the visibility of the `ColorPicker` presets menu.
@@ -2604,7 +2603,7 @@ class ko {
2604
2603
  toggleMenu = (t) => {
2605
2604
  t && t.preventDefault();
2606
2605
  const { colorMenu: e } = this;
2607
- this.isOpen && T(e, "show") ? this.hide(!0) : Ht(this, e);
2606
+ this.isOpen && T(e, "show") ? this.hide(!0) : Nt(this, e);
2608
2607
  };
2609
2608
  /**
2610
2609
  * Hides the currently open `ColorPicker` dropdown.
@@ -2613,21 +2612,21 @@ class ko {
2613
2612
  */
2614
2613
  hide(t) {
2615
2614
  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);
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);
2617
2616
  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");
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");
2620
2619
  }
2621
2620
  }
2622
2621
  /** Removes `ColorPicker` from target `<input>`. */
2623
2622
  dispose() {
2624
2623
  const { input: t, parent: e } = this;
2625
- this.hide(!0), ce(this), [...e.children].forEach((s) => {
2624
+ this.hide(!0), he(this), [...e.children].forEach((s) => {
2626
2625
  s !== t && s.remove();
2627
- }), Ct(t, Y), D(t, { backgroundColor: "" }), ["txt-light", "txt-dark"].forEach((s) => O(e, s)), ct.remove(t, Z);
2626
+ }), Ct(t, X), D(t, { backgroundColor: "" }), ["txt-light", "txt-dark"].forEach((s) => O(e, s)), ht.remove(t, Y);
2628
2627
  }
2629
2628
  }
2630
2629
  export {
2631
- ko as default
2630
+ yo as default
2632
2631
  };
2633
2632
  //# sourceMappingURL=color-picker.mjs.map