@luzmo/lucero 1.0.1-alpha.4 → 1.0.1-alpha.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (236) hide show
  1. package/components/accordion/index.cjs +6 -6
  2. package/components/accordion/index.js +14 -13
  3. package/components/action-bar/index.cjs +4 -4
  4. package/components/action-bar/index.js +20 -18
  5. package/components/action-button/index.cjs +3 -3
  6. package/components/action-button/index.js +7 -6
  7. package/components/action-group/index.cjs +1 -1
  8. package/components/action-group/index.js +2 -2
  9. package/components/{action-group-DBImibFn.js → action-group-Bwt9w8Vh.js} +10 -9
  10. package/components/action-group-D917z7XF.cjs +20 -0
  11. package/components/action-menu/index.cjs +9 -9
  12. package/components/action-menu/index.js +10 -10
  13. package/components/avatar/index.cjs +3 -3
  14. package/components/avatar/index.js +7 -7
  15. package/components/base-5nDSSNeT.cjs +18 -0
  16. package/components/base-CdYjmV_8.js +96 -0
  17. package/components/button/button-base.d.ts +16 -0
  18. package/components/button/button.d.ts +38 -2
  19. package/components/button/index.cjs +2 -2
  20. package/components/button/index.js +37 -32
  21. package/components/{button-base-DbkDzb71.js → button-base-B5uul3tZ.js} +54 -39
  22. package/components/button-base-C7or8-FB.cjs +25 -0
  23. package/components/button-group/index.cjs +1 -1
  24. package/components/button-group/index.js +11 -9
  25. package/components/calendar/index.cjs +96 -1
  26. package/components/calendar/index.js +538 -6
  27. package/components/checkbox/index.cjs +4 -4
  28. package/components/checkbox/index.js +10 -8
  29. package/components/{checkbox-mixin-Do7EgtpQ.js → checkbox-mixin-DUbGDm7f.js} +9 -9
  30. package/components/{checkbox-mixin-BDN0dBtS.cjs → checkbox-mixin-DhN8CIXY.cjs} +3 -3
  31. package/components/{clear-button-DoeRUWQ3.js → clear-button-Bjp7N52G.js} +14 -13
  32. package/components/clear-button-C39c3PH0.cjs +18 -0
  33. package/components/close-button-C4zqQJRL.cjs +18 -0
  34. package/components/close-button-R-Cyxi_j.js +52 -0
  35. package/components/color-area/index.cjs +5 -5
  36. package/components/color-area/index.js +12 -11
  37. package/components/color-controller-7sNUf7SP.js +386 -0
  38. package/components/color-controller-ChN-A9Ft.cjs +18 -0
  39. package/components/color-field/color-field.d.ts +8 -0
  40. package/components/color-field/index.cjs +4 -4
  41. package/components/color-field/index.js +38 -25
  42. package/components/color-handle/index.cjs +2 -2
  43. package/components/color-handle/index.js +8 -6
  44. package/components/color-loupe/index.cjs +1 -1
  45. package/components/color-loupe/index.js +2 -2
  46. package/components/color-loupe-CIEFp7ln.cjs +56 -0
  47. package/components/{color-loupe-CmMsXbjT.js → color-loupe-CLPX6xVb.js} +6 -4
  48. package/components/color-menu/index.cjs +8 -8
  49. package/components/color-menu/index.js +46 -46
  50. package/components/color-palette/color-palette.d.ts +6 -2
  51. package/components/color-palette/index.cjs +1 -1
  52. package/components/color-palette/index.js +35 -34
  53. package/components/color-palette-group/color-palette-group.d.ts +79 -0
  54. package/components/color-palette-group/index.cjs +28 -0
  55. package/components/color-palette-group/index.d.ts +7 -0
  56. package/components/color-palette-group/index.js +206 -0
  57. package/components/color-picker/color-picker.d.ts +31 -2
  58. package/components/color-picker/index.cjs +6 -5
  59. package/components/color-picker/index.js +16 -12
  60. package/components/color-slider/index.cjs +40 -1
  61. package/components/color-slider/index.js +452 -6
  62. package/components/date-time-picker/index.cjs +16 -16
  63. package/components/date-time-picker/index.js +105 -106
  64. package/components/{dependency-manger-CEXvGQUV.js → dependency-manger-CO-VPlqq.js} +4 -4
  65. package/components/{dependency-manger-C5HCkMMB.cjs → dependency-manger-uthev62E.cjs} +1 -1
  66. package/components/divider/index.cjs +1 -1
  67. package/components/divider/index.js +11 -9
  68. package/components/field-group/index.cjs +1 -1
  69. package/components/field-group/index.js +2 -2
  70. package/components/field-group-BYHNJmv0.cjs +23 -0
  71. package/components/{field-group-DXfBWrkO.js → field-group-CHmw159R.js} +7 -5
  72. package/components/field-label/index.cjs +1 -1
  73. package/components/field-label/index.js +2 -2
  74. package/components/{field-label-CZ2zzChK.js → field-label-Cy3xMWZ-.js} +9 -8
  75. package/components/field-label-DZoeqJJX.cjs +25 -0
  76. package/components/{focus-visible-DBlJGoEW.js → focus-visible-BvScGDCE.js} +20 -20
  77. package/components/focus-visible-D4BXb5RB.cjs +18 -0
  78. package/components/{focusable-BxtpnzWp.js → focusable-BjvsvVam.js} +3 -2
  79. package/components/focusable-CbVKgGfS.cjs +18 -0
  80. package/components/icon/index.cjs +1 -1
  81. package/components/icon/index.js +22 -20
  82. package/components/index.cjs +1 -1
  83. package/components/index.js +140 -138
  84. package/components/infield-button/index.cjs +2 -2
  85. package/components/infield-button/index.js +6 -5
  86. package/components/label/index.cjs +1 -1
  87. package/components/label/index.js +7 -5
  88. package/components/{language-resolution-8yZa5r_P.js → language-resolution-B-wjV5bb.js} +9 -8
  89. package/components/{directive-C7oCP5Bh.cjs → language-resolution-EUER43cg.cjs} +1 -5
  90. package/components/like-anchor-B2EqJPdw.cjs +32 -0
  91. package/components/{like-anchor-Bvn_vLQ8.js → like-anchor-CgqCU210.js} +23 -22
  92. package/components/{manage-help-text-DhgARkZX.cjs → manage-help-text-Bat9yGvF.cjs} +3 -3
  93. package/components/{manage-help-text-syYnjKGL.js → manage-help-text-C9sCHK3R.js} +8 -8
  94. package/components/menu/index.cjs +38 -13
  95. package/components/menu/index.js +138 -105
  96. package/components/menu/menu-item.d.ts +8 -1
  97. package/components/multi-language-field/index.cjs +2 -2
  98. package/components/multi-language-field/index.js +9 -7
  99. package/components/number-field/index.cjs +5 -5
  100. package/components/number-field/index.js +122 -85
  101. package/components/number-field/number-field.d.ts +145 -0
  102. package/components/observe-slot-presence-CNltc0C0.cjs +18 -0
  103. package/components/{observe-slot-presence-CmVi0zTc.js → observe-slot-presence-DFi6GE3H.js} +1 -1
  104. package/components/observe-slot-text-CBMHpuIK.cjs +18 -0
  105. package/components/{observe-slot-text-BPfIQQtz.js → observe-slot-text-DorVpCL4.js} +14 -15
  106. package/components/options/index.cjs +26 -58
  107. package/components/options/index.js +205 -849
  108. package/components/overlay/index.cjs +6 -6
  109. package/components/overlay/index.js +31 -32
  110. package/components/overlay-BhrVS5h7.cjs +47 -0
  111. package/components/overlay-C-No3oJQ.js +1736 -0
  112. package/components/{pending-state-CaH1si5b.cjs → pending-state-DQctFHI8.cjs} +2 -2
  113. package/components/{pending-state-DTX7ggyF.js → pending-state-Dx1u3EXA.js} +2 -2
  114. package/components/picker/index.cjs +1 -1
  115. package/components/picker/index.js +3 -3
  116. package/components/{picker-BmoXv1jt.js → picker-Cm6_didQ.js} +44 -44
  117. package/components/picker-DxYgh4LR.cjs +123 -0
  118. package/components/picker-button/index.cjs +4 -4
  119. package/components/picker-button/index.js +8 -7
  120. package/components/{platform-BiXhwqk3.cjs → platform-BJnOJJag.cjs} +1 -1
  121. package/components/{platform-BM-uMWpX.js → platform-CqwNrovd.js} +12 -12
  122. package/components/popover/index.cjs +1 -1
  123. package/components/popover/index.js +2 -2
  124. package/components/popover-lcZnODPK.cjs +30 -0
  125. package/components/{popover-DjX0aAnY.js → popover-ucIgjbQs.js} +8 -7
  126. package/components/progress-circle/index.cjs +1 -1
  127. package/components/progress-circle/index.js +2 -2
  128. package/components/{progress-circle-DXH9z8-6.js → progress-circle-D5J0ZwY0.js} +8 -7
  129. package/components/progress-circle-DgMbqrzG.cjs +33 -0
  130. package/components/radio/index.cjs +2 -2
  131. package/components/radio/index.js +12 -11
  132. package/components/search/index.cjs +6 -6
  133. package/components/search/index.js +6 -6
  134. package/components/select/index.cjs +43 -42
  135. package/components/select/index.js +142 -126
  136. package/components/select/select.d.ts +1 -1
  137. package/components/{base-BjTwmyRF.cjs → sized-mixin-DcvJLFeo.cjs} +1 -5
  138. package/components/{sized-mixin-D4ACoVUr.js → sized-mixin-cJbo3PKR.js} +5 -5
  139. package/components/slider/index.cjs +1 -1
  140. package/components/slider/index.js +48 -1101
  141. package/components/{strategies-9indNIEb.js → strategies-Bk97oVn1.js} +15 -50
  142. package/components/strategies-CNgBb6dM.cjs +18 -0
  143. package/components/{streaming-listener-CP-JE6Fa.js → streaming-listener-BlWm-XZU.js} +5 -6
  144. package/components/streaming-listener-D9Wc7skA.cjs +18 -0
  145. package/components/swatch/index.cjs +7 -7
  146. package/components/swatch/index.js +18 -17
  147. package/components/switch/index.cjs +2 -2
  148. package/components/switch/index.js +6 -5
  149. package/components/tabs/index.cjs +16 -24
  150. package/components/tabs/index.js +94 -162
  151. package/components/tags/index.cjs +4 -4
  152. package/components/tags/index.js +15 -14
  153. package/components/text-field/index.cjs +3 -3
  154. package/components/text-field/index.js +13 -11
  155. package/components/text-field/text-field.d.ts +1 -0
  156. package/components/{text-field-BIADXoLC.js → text-field-BHaLKkf1.js} +73 -99
  157. package/components/text-field-DFP7p8Rv.cjs +81 -0
  158. package/components/text-field.module-Bp4Mwuvj.js +21 -0
  159. package/components/text-field.module-eAEqjvZu.cjs +18 -0
  160. package/components/toast/index.cjs +11 -11
  161. package/components/toast/index.js +11 -9
  162. package/components/tooltip/index.cjs +4 -4
  163. package/components/tooltip/index.js +60 -36
  164. package/components/tooltip/tooltip.d.ts +12 -1
  165. package/components/unit-input/index.cjs +6 -6
  166. package/components/unit-input/index.js +12 -11
  167. package/components/utils.cjs +1 -1
  168. package/components/utils.js +6 -6
  169. package/custom-elements.json +1 -1
  170. package/index.d.ts +1 -0
  171. package/package.json +67 -1
  172. package/components/NumberFormatter-DewVDY5w.cjs +0 -18
  173. package/components/NumberFormatter-DgOUVrge.js +0 -136
  174. package/components/NumberParser-Dik4a0h-.cjs +0 -18
  175. package/components/NumberParser-ci9J5EKv.js +0 -173
  176. package/components/action-group-DJGMcRHb.cjs +0 -20
  177. package/components/async-directive-BX1T1e1_.cjs +0 -22
  178. package/components/async-directive-BfcqVjDp.js +0 -82
  179. package/components/base-CBCg3yyw.cjs +0 -40
  180. package/components/base-D76d76ww.js +0 -26
  181. package/components/base-WsynuqaS.js +0 -677
  182. package/components/button-base-XgPLmwP-.cjs +0 -25
  183. package/components/class-map-Di1D_rCm.cjs +0 -22
  184. package/components/class-map-NbVXqBU0.js +0 -51
  185. package/components/clear-button-Qi1pMA5S.cjs +0 -18
  186. package/components/close-button-BFMBEw3q.cjs +0 -18
  187. package/components/close-button-BWXdHSx3.js +0 -51
  188. package/components/color-controller-DTp1juRz.js +0 -3198
  189. package/components/color-controller-_ZwyhvaU.cjs +0 -18
  190. package/components/color-loupe-CaA_Lfkk.cjs +0 -56
  191. package/components/directive-helpers-Cm6gitnu.js +0 -62
  192. package/components/directive-helpers-DyIRTWwA.cjs +0 -22
  193. package/components/directive-oAbCiebi.js +0 -44
  194. package/components/field-group-DkGst3r5.cjs +0 -23
  195. package/components/field-label-mO1AkUgR.cjs +0 -25
  196. package/components/flow-D-0MTYCm.js +0 -527
  197. package/components/flow-DM3dNAKs.cjs +0 -30
  198. package/components/focus-visible-B0P9aY_G.cjs +0 -18
  199. package/components/focusable-EbipgXRh.cjs +0 -18
  200. package/components/if-defined-C9YGdo33.cjs +0 -22
  201. package/components/if-defined-DOaE2coe.js +0 -27
  202. package/components/index-A-yOTB_d.js +0 -1490
  203. package/components/index-BLWuwZXx.cjs +0 -113
  204. package/components/index-BwxgAdzi.cjs +0 -57
  205. package/components/index-HjQa8tew.js +0 -1174
  206. package/components/language-resolution-DJzmyzZq.cjs +0 -18
  207. package/components/like-anchor-sod1C1fR.cjs +0 -32
  208. package/components/luzmo-icons-DbwDQtuO.js +0 -229
  209. package/components/luzmo-icons-DletXGWU.cjs +0 -29
  210. package/components/mutation-controller-DH7YOCyj.js +0 -52
  211. package/components/mutation-controller-DkOMCW-c.cjs +0 -22
  212. package/components/observe-slot-presence-bc9chhsi.cjs +0 -18
  213. package/components/observe-slot-text-Ceb7SvYT.cjs +0 -18
  214. package/components/overlay-Cig9r6uU.js +0 -2747
  215. package/components/overlay-KSKMzzkh.cjs +0 -47
  216. package/components/picker-DWsBWdPN.cjs +0 -123
  217. package/components/popover-KFfO0IYL.cjs +0 -30
  218. package/components/progress-circle-BvRJNuNo.cjs +0 -33
  219. package/components/query-BL-TJj7K.cjs +0 -22
  220. package/components/query-D_KR_GUc.js +0 -51
  221. package/components/query-assigned-elements-DjfhL1cl.js +0 -36
  222. package/components/query-assigned-elements-DsKsfk7G.cjs +0 -22
  223. package/components/query-assigned-nodes-BcKWmGzy.cjs +0 -22
  224. package/components/query-assigned-nodes-C76XVPWY.js +0 -36
  225. package/components/sized-mixin-CPxE5C96.cjs +0 -18
  226. package/components/state-D8JEtYqe.cjs +0 -22
  227. package/components/state-Deh-vKYE.js +0 -29
  228. package/components/strategies-BACP6MhR.cjs +0 -18
  229. package/components/streaming-listener-B00MvALi.cjs +0 -18
  230. package/components/style-map-CeilmSgs.cjs +0 -22
  231. package/components/style-map-IgqIKvlE.js +0 -53
  232. package/components/text-field-D5d_Gt0t.cjs +0 -85
  233. package/components/text-field.module-ColtFhf_.js +0 -21
  234. package/components/text-field.module-p_VF2tC_.cjs +0 -18
  235. package/components/when-CDK1Tt5Y.js +0 -28
  236. package/components/when-CDZyJPvd.cjs +0 -22
@@ -1,1174 +0,0 @@
1
- /*! * Lucero - The design system for Luzmo.
2
- *
3
- * Copyright © 2025 Luzmo
4
- * All rights reserved.
5
- * Lucero (“Luzmo Design System”) must be used according to the Luzmo Terms of Service.
6
- * This license allows users with a current active Luzmo account to use Lucero.
7
- * This license terminates automatically if a user no longer has an active Luzmo account.
8
- * Please view the Luzmo Terms of Service at: https://www.luzmo.com/information-pages/terms-of-use.
9
- *
10
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
11
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
12
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
13
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
14
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
15
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
16
- * SOFTWARE.
17
- * */
18
- import { r as W, x as j, n as v } from "./base-WsynuqaS.js";
19
- import { e as T } from "./query-D_KR_GUc.js";
20
- import { o as C } from "./if-defined-DOaE2coe.js";
21
- import { o as q } from "./style-map-IgqIKvlE.js";
22
- import "./color-handle/index.js";
23
- import { F as U } from "./focusable-BxtpnzWp.js";
24
- import { L as V } from "./language-resolution-8yZa5r_P.js";
25
- import { s as G } from "./streaming-listener-CP-JE6Fa.js";
26
- function c(r, t) {
27
- K(r) && (r = "100%");
28
- const e = X(r);
29
- return r = t === 360 ? r : Math.min(t, Math.max(0, parseFloat(r))), e && (r = parseInt(String(r * t), 10) / 100), Math.abs(r - t) < 1e-6 ? 1 : (t === 360 ? r = (r < 0 ? r % t + t : r % t) / parseFloat(String(t)) : r = r % t / parseFloat(String(t)), r);
30
- }
31
- function w(r) {
32
- return Math.min(1, Math.max(0, r));
33
- }
34
- function K(r) {
35
- return typeof r == "string" && r.indexOf(".") !== -1 && parseFloat(r) === 1;
36
- }
37
- function X(r) {
38
- return typeof r == "string" && r.indexOf("%") !== -1;
39
- }
40
- function L(r) {
41
- return r = parseFloat(r), (isNaN(r) || r < 0 || r > 1) && (r = 1), r;
42
- }
43
- function S(r) {
44
- return Number(r) <= 1 ? `${Number(r) * 100}%` : r;
45
- }
46
- function k(r) {
47
- return r.length === 1 ? "0" + r : String(r);
48
- }
49
- function Y(r, t, e) {
50
- return {
51
- r: c(r, 255) * 255,
52
- g: c(t, 255) * 255,
53
- b: c(e, 255) * 255
54
- };
55
- }
56
- function A(r, t, e) {
57
- r = c(r, 255), t = c(t, 255), e = c(e, 255);
58
- const s = Math.max(r, t, e), o = Math.min(r, t, e);
59
- let i = 0, n = 0;
60
- const a = (s + o) / 2;
61
- if (s === o)
62
- n = 0, i = 0;
63
- else {
64
- const l = s - o;
65
- switch (n = a > 0.5 ? l / (2 - s - o) : l / (s + o), s) {
66
- case r:
67
- i = (t - e) / l + (t < e ? 6 : 0);
68
- break;
69
- case t:
70
- i = (e - r) / l + 2;
71
- break;
72
- case e:
73
- i = (r - t) / l + 4;
74
- break;
75
- }
76
- i /= 6;
77
- }
78
- return { h: i, s: n, l: a };
79
- }
80
- function R(r, t, e) {
81
- return e < 0 && (e += 1), e > 1 && (e -= 1), e < 1 / 6 ? r + (t - r) * (6 * e) : e < 1 / 2 ? t : e < 2 / 3 ? r + (t - r) * (2 / 3 - e) * 6 : r;
82
- }
83
- function Z(r, t, e) {
84
- let s, o, i;
85
- if (r = c(r, 360), t = c(t, 100), e = c(e, 100), t === 0)
86
- o = e, i = e, s = e;
87
- else {
88
- const n = e < 0.5 ? e * (1 + t) : e + t - e * t, a = 2 * e - n;
89
- s = R(a, n, r + 1 / 3), o = R(a, n, r), i = R(a, n, r - 1 / 3);
90
- }
91
- return { r: s * 255, g: o * 255, b: i * 255 };
92
- }
93
- function F(r, t, e) {
94
- r = c(r, 255), t = c(t, 255), e = c(e, 255);
95
- const s = Math.max(r, t, e), o = Math.min(r, t, e);
96
- let i = 0;
97
- const n = s, a = s - o, l = s === 0 ? 0 : a / s;
98
- if (s === o)
99
- i = 0;
100
- else {
101
- switch (s) {
102
- case r:
103
- i = (t - e) / a + (t < e ? 6 : 0);
104
- break;
105
- case t:
106
- i = (e - r) / a + 2;
107
- break;
108
- case e:
109
- i = (r - t) / a + 4;
110
- break;
111
- }
112
- i /= 6;
113
- }
114
- return { h: i, s: l, v: n };
115
- }
116
- function J(r, t, e) {
117
- r = c(r, 360) * 6, t = c(t, 100), e = c(e, 100);
118
- const s = Math.floor(r), o = r - s, i = e * (1 - t), n = e * (1 - o * t), a = e * (1 - (1 - o) * t), l = s % 6, m = [e, n, i, i, a, e][l], u = [a, e, e, n, i, i][l], y = [i, i, a, e, e, n][l];
119
- return { r: m * 255, g: u * 255, b: y * 255 };
120
- }
121
- function E(r, t, e, s) {
122
- const o = [
123
- k(Math.round(r).toString(16)),
124
- k(Math.round(t).toString(16)),
125
- k(Math.round(e).toString(16))
126
- ];
127
- return s && o[0].startsWith(o[0].charAt(1)) && o[1].startsWith(o[1].charAt(1)) && o[2].startsWith(o[2].charAt(1)) ? o[0].charAt(0) + o[1].charAt(0) + o[2].charAt(0) : o.join("");
128
- }
129
- function Q(r, t, e, s, o) {
130
- const i = [
131
- k(Math.round(r).toString(16)),
132
- k(Math.round(t).toString(16)),
133
- k(Math.round(e).toString(16)),
134
- k(et(s))
135
- ];
136
- return o && i[0].startsWith(i[0].charAt(1)) && i[1].startsWith(i[1].charAt(1)) && i[2].startsWith(i[2].charAt(1)) && i[3].startsWith(i[3].charAt(1)) ? i[0].charAt(0) + i[1].charAt(0) + i[2].charAt(0) + i[3].charAt(0) : i.join("");
137
- }
138
- function tt(r, t, e, s) {
139
- const o = r / 100, i = t / 100, n = e / 100, a = s / 100, l = 255 * (1 - o) * (1 - a), m = 255 * (1 - i) * (1 - a), u = 255 * (1 - n) * (1 - a);
140
- return { r: l, g: m, b: u };
141
- }
142
- function _(r, t, e) {
143
- let s = 1 - r / 255, o = 1 - t / 255, i = 1 - e / 255, n = Math.min(s, o, i);
144
- return n === 1 ? (s = 0, o = 0, i = 0) : (s = (s - n) / (1 - n) * 100, o = (o - n) / (1 - n) * 100, i = (i - n) / (1 - n) * 100), n *= 100, {
145
- c: Math.round(s),
146
- m: Math.round(o),
147
- y: Math.round(i),
148
- k: Math.round(n)
149
- };
150
- }
151
- function et(r) {
152
- return Math.round(parseFloat(r) * 255).toString(16);
153
- }
154
- function I(r) {
155
- return g(r) / 255;
156
- }
157
- function g(r) {
158
- return parseInt(r, 16);
159
- }
160
- function rt(r) {
161
- return {
162
- r: r >> 16,
163
- g: (r & 65280) >> 8,
164
- b: r & 255
165
- };
166
- }
167
- const P = {
168
- aliceblue: "#f0f8ff",
169
- antiquewhite: "#faebd7",
170
- aqua: "#00ffff",
171
- aquamarine: "#7fffd4",
172
- azure: "#f0ffff",
173
- beige: "#f5f5dc",
174
- bisque: "#ffe4c4",
175
- black: "#000000",
176
- blanchedalmond: "#ffebcd",
177
- blue: "#0000ff",
178
- blueviolet: "#8a2be2",
179
- brown: "#a52a2a",
180
- burlywood: "#deb887",
181
- cadetblue: "#5f9ea0",
182
- chartreuse: "#7fff00",
183
- chocolate: "#d2691e",
184
- coral: "#ff7f50",
185
- cornflowerblue: "#6495ed",
186
- cornsilk: "#fff8dc",
187
- crimson: "#dc143c",
188
- cyan: "#00ffff",
189
- darkblue: "#00008b",
190
- darkcyan: "#008b8b",
191
- darkgoldenrod: "#b8860b",
192
- darkgray: "#a9a9a9",
193
- darkgreen: "#006400",
194
- darkgrey: "#a9a9a9",
195
- darkkhaki: "#bdb76b",
196
- darkmagenta: "#8b008b",
197
- darkolivegreen: "#556b2f",
198
- darkorange: "#ff8c00",
199
- darkorchid: "#9932cc",
200
- darkred: "#8b0000",
201
- darksalmon: "#e9967a",
202
- darkseagreen: "#8fbc8f",
203
- darkslateblue: "#483d8b",
204
- darkslategray: "#2f4f4f",
205
- darkslategrey: "#2f4f4f",
206
- darkturquoise: "#00ced1",
207
- darkviolet: "#9400d3",
208
- deeppink: "#ff1493",
209
- deepskyblue: "#00bfff",
210
- dimgray: "#696969",
211
- dimgrey: "#696969",
212
- dodgerblue: "#1e90ff",
213
- firebrick: "#b22222",
214
- floralwhite: "#fffaf0",
215
- forestgreen: "#228b22",
216
- fuchsia: "#ff00ff",
217
- gainsboro: "#dcdcdc",
218
- ghostwhite: "#f8f8ff",
219
- goldenrod: "#daa520",
220
- gold: "#ffd700",
221
- gray: "#808080",
222
- green: "#008000",
223
- greenyellow: "#adff2f",
224
- grey: "#808080",
225
- honeydew: "#f0fff0",
226
- hotpink: "#ff69b4",
227
- indianred: "#cd5c5c",
228
- indigo: "#4b0082",
229
- ivory: "#fffff0",
230
- khaki: "#f0e68c",
231
- lavenderblush: "#fff0f5",
232
- lavender: "#e6e6fa",
233
- lawngreen: "#7cfc00",
234
- lemonchiffon: "#fffacd",
235
- lightblue: "#add8e6",
236
- lightcoral: "#f08080",
237
- lightcyan: "#e0ffff",
238
- lightgoldenrodyellow: "#fafad2",
239
- lightgray: "#d3d3d3",
240
- lightgreen: "#90ee90",
241
- lightgrey: "#d3d3d3",
242
- lightpink: "#ffb6c1",
243
- lightsalmon: "#ffa07a",
244
- lightseagreen: "#20b2aa",
245
- lightskyblue: "#87cefa",
246
- lightslategray: "#778899",
247
- lightslategrey: "#778899",
248
- lightsteelblue: "#b0c4de",
249
- lightyellow: "#ffffe0",
250
- lime: "#00ff00",
251
- limegreen: "#32cd32",
252
- linen: "#faf0e6",
253
- magenta: "#ff00ff",
254
- maroon: "#800000",
255
- mediumaquamarine: "#66cdaa",
256
- mediumblue: "#0000cd",
257
- mediumorchid: "#ba55d3",
258
- mediumpurple: "#9370db",
259
- mediumseagreen: "#3cb371",
260
- mediumslateblue: "#7b68ee",
261
- mediumspringgreen: "#00fa9a",
262
- mediumturquoise: "#48d1cc",
263
- mediumvioletred: "#c71585",
264
- midnightblue: "#191970",
265
- mintcream: "#f5fffa",
266
- mistyrose: "#ffe4e1",
267
- moccasin: "#ffe4b5",
268
- navajowhite: "#ffdead",
269
- navy: "#000080",
270
- oldlace: "#fdf5e6",
271
- olive: "#808000",
272
- olivedrab: "#6b8e23",
273
- orange: "#ffa500",
274
- orangered: "#ff4500",
275
- orchid: "#da70d6",
276
- palegoldenrod: "#eee8aa",
277
- palegreen: "#98fb98",
278
- paleturquoise: "#afeeee",
279
- palevioletred: "#db7093",
280
- papayawhip: "#ffefd5",
281
- peachpuff: "#ffdab9",
282
- peru: "#cd853f",
283
- pink: "#ffc0cb",
284
- plum: "#dda0dd",
285
- powderblue: "#b0e0e6",
286
- purple: "#800080",
287
- rebeccapurple: "#663399",
288
- red: "#ff0000",
289
- rosybrown: "#bc8f8f",
290
- royalblue: "#4169e1",
291
- saddlebrown: "#8b4513",
292
- salmon: "#fa8072",
293
- sandybrown: "#f4a460",
294
- seagreen: "#2e8b57",
295
- seashell: "#fff5ee",
296
- sienna: "#a0522d",
297
- silver: "#c0c0c0",
298
- skyblue: "#87ceeb",
299
- slateblue: "#6a5acd",
300
- slategray: "#708090",
301
- slategrey: "#708090",
302
- snow: "#fffafa",
303
- springgreen: "#00ff7f",
304
- steelblue: "#4682b4",
305
- tan: "#d2b48c",
306
- teal: "#008080",
307
- thistle: "#d8bfd8",
308
- tomato: "#ff6347",
309
- turquoise: "#40e0d0",
310
- violet: "#ee82ee",
311
- wheat: "#f5deb3",
312
- white: "#ffffff",
313
- whitesmoke: "#f5f5f5",
314
- yellow: "#ffff00",
315
- yellowgreen: "#9acd32"
316
- };
317
- function st(r) {
318
- let t = { r: 0, g: 0, b: 0 }, e = 1, s = null, o = null, i = null, n = !1, a = !1;
319
- return typeof r == "string" && (r = nt(r)), typeof r == "object" && (f(r.r) && f(r.g) && f(r.b) ? (t = Y(r.r, r.g, r.b), n = !0, a = String(r.r).substr(-1) === "%" ? "prgb" : "rgb") : f(r.h) && f(r.s) && f(r.v) ? (s = S(r.s), o = S(r.v), t = J(r.h, s, o), n = !0, a = "hsv") : f(r.h) && f(r.s) && f(r.l) ? (s = S(r.s), i = S(r.l), t = Z(r.h, s, i), n = !0, a = "hsl") : f(r.c) && f(r.m) && f(r.y) && f(r.k) && (t = tt(r.c, r.m, r.y, r.k), n = !0, a = "cmyk"), Object.prototype.hasOwnProperty.call(r, "a") && (e = r.a)), e = L(e), {
320
- ok: n,
321
- format: r.format || a,
322
- r: Math.min(255, Math.max(t.r, 0)),
323
- g: Math.min(255, Math.max(t.g, 0)),
324
- b: Math.min(255, Math.max(t.b, 0)),
325
- a: e
326
- };
327
- }
328
- const it = "[-\\+]?\\d+%?", ot = "[-\\+]?\\d*\\.\\d+%?", x = "(?:" + ot + ")|(?:" + it + ")", z = "[\\s|\\(]+(" + x + ")[,|\\s]+(" + x + ")[,|\\s]+(" + x + ")\\s*\\)?", M = (
329
- // eslint-disable-next-line prettier/prettier
330
- "[\\s|\\(]+(" + x + ")[,|\\s]+(" + x + ")[,|\\s]+(" + x + ")[,|\\s]+(" + x + ")\\s*\\)?"
331
- ), p = {
332
- CSS_UNIT: new RegExp(x),
333
- rgb: new RegExp("rgb" + z),
334
- rgba: new RegExp("rgba" + M),
335
- hsl: new RegExp("hsl" + z),
336
- hsla: new RegExp("hsla" + M),
337
- hsv: new RegExp("hsv" + z),
338
- hsva: new RegExp("hsva" + M),
339
- cmyk: new RegExp("cmyk" + M),
340
- hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
341
- hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
342
- hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
343
- hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
344
- };
345
- function nt(r) {
346
- if (r = r.trim().toLowerCase(), r.length === 0)
347
- return !1;
348
- let t = !1;
349
- if (P[r])
350
- r = P[r], t = !0;
351
- else if (r === "transparent")
352
- return { r: 0, g: 0, b: 0, a: 0, format: "name" };
353
- let e = p.rgb.exec(r);
354
- return e ? { r: e[1], g: e[2], b: e[3] } : (e = p.rgba.exec(r), e ? { r: e[1], g: e[2], b: e[3], a: e[4] } : (e = p.hsl.exec(r), e ? { h: e[1], s: e[2], l: e[3] } : (e = p.hsla.exec(r), e ? { h: e[1], s: e[2], l: e[3], a: e[4] } : (e = p.hsv.exec(r), e ? { h: e[1], s: e[2], v: e[3] } : (e = p.hsva.exec(r), e ? { h: e[1], s: e[2], v: e[3], a: e[4] } : (e = p.cmyk.exec(r), e ? {
355
- c: e[1],
356
- m: e[2],
357
- y: e[3],
358
- k: e[4]
359
- } : (e = p.hex8.exec(r), e ? {
360
- r: g(e[1]),
361
- g: g(e[2]),
362
- b: g(e[3]),
363
- a: I(e[4]),
364
- format: t ? "name" : "hex8"
365
- } : (e = p.hex6.exec(r), e ? {
366
- r: g(e[1]),
367
- g: g(e[2]),
368
- b: g(e[3]),
369
- format: t ? "name" : "hex"
370
- } : (e = p.hex4.exec(r), e ? {
371
- r: g(e[1] + e[1]),
372
- g: g(e[2] + e[2]),
373
- b: g(e[3] + e[3]),
374
- a: I(e[4] + e[4]),
375
- format: t ? "name" : "hex8"
376
- } : (e = p.hex3.exec(r), e ? {
377
- r: g(e[1] + e[1]),
378
- g: g(e[2] + e[2]),
379
- b: g(e[3] + e[3]),
380
- format: t ? "name" : "hex"
381
- } : !1))))))))));
382
- }
383
- function f(r) {
384
- return typeof r == "number" ? !Number.isNaN(r) : p.CSS_UNIT.test(r);
385
- }
386
- class h {
387
- constructor(t = "", e = {}) {
388
- if (t instanceof h)
389
- return t;
390
- typeof t == "number" && (t = rt(t)), this.originalInput = t;
391
- const s = st(t);
392
- this.originalInput = t, this.r = s.r, this.g = s.g, this.b = s.b, this.a = s.a, this.roundA = Math.round(100 * this.a) / 100, this.format = e.format ?? s.format, this.gradientType = e.gradientType, this.r < 1 && (this.r = Math.round(this.r)), this.g < 1 && (this.g = Math.round(this.g)), this.b < 1 && (this.b = Math.round(this.b)), this.isValid = s.ok;
393
- }
394
- isDark() {
395
- return this.getBrightness() < 128;
396
- }
397
- isLight() {
398
- return !this.isDark();
399
- }
400
- /**
401
- * Returns the perceived brightness of the color, from 0-255.
402
- */
403
- getBrightness() {
404
- const t = this.toRgb();
405
- return (t.r * 299 + t.g * 587 + t.b * 114) / 1e3;
406
- }
407
- /**
408
- * Returns the perceived luminance of a color, from 0-1.
409
- */
410
- getLuminance() {
411
- const t = this.toRgb();
412
- let e, s, o;
413
- const i = t.r / 255, n = t.g / 255, a = t.b / 255;
414
- return i <= 0.03928 ? e = i / 12.92 : e = Math.pow((i + 0.055) / 1.055, 2.4), n <= 0.03928 ? s = n / 12.92 : s = Math.pow((n + 0.055) / 1.055, 2.4), a <= 0.03928 ? o = a / 12.92 : o = Math.pow((a + 0.055) / 1.055, 2.4), 0.2126 * e + 0.7152 * s + 0.0722 * o;
415
- }
416
- /**
417
- * Returns the alpha value of a color, from 0-1.
418
- */
419
- getAlpha() {
420
- return this.a;
421
- }
422
- /**
423
- * Sets the alpha value on the current color.
424
- *
425
- * @param alpha - The new alpha value. The accepted range is 0-1.
426
- */
427
- setAlpha(t) {
428
- return this.a = L(t), this.roundA = Math.round(100 * this.a) / 100, this;
429
- }
430
- /**
431
- * Returns whether the color is monochrome.
432
- */
433
- isMonochrome() {
434
- const { s: t } = this.toHsl();
435
- return t === 0;
436
- }
437
- /**
438
- * Returns the object as a HSVA object.
439
- */
440
- toHsv() {
441
- const t = F(this.r, this.g, this.b);
442
- return { h: t.h * 360, s: t.s, v: t.v, a: this.a };
443
- }
444
- /**
445
- * Returns the hsva values interpolated into a string with the following format:
446
- * "hsva(xxx, xxx, xxx, xx)".
447
- */
448
- toHsvString() {
449
- const t = F(this.r, this.g, this.b), e = Math.round(t.h * 360), s = Math.round(t.s * 100), o = Math.round(t.v * 100);
450
- return this.a === 1 ? `hsv(${e}, ${s}%, ${o}%)` : `hsva(${e}, ${s}%, ${o}%, ${this.roundA})`;
451
- }
452
- /**
453
- * Returns the object as a HSLA object.
454
- */
455
- toHsl() {
456
- const t = A(this.r, this.g, this.b);
457
- return { h: t.h * 360, s: t.s, l: t.l, a: this.a };
458
- }
459
- /**
460
- * Returns the hsla values interpolated into a string with the following format:
461
- * "hsla(xxx, xxx, xxx, xx)".
462
- */
463
- toHslString() {
464
- const t = A(this.r, this.g, this.b), e = Math.round(t.h * 360), s = Math.round(t.s * 100), o = Math.round(t.l * 100);
465
- return this.a === 1 ? `hsl(${e}, ${s}%, ${o}%)` : `hsla(${e}, ${s}%, ${o}%, ${this.roundA})`;
466
- }
467
- /**
468
- * Returns the hex value of the color.
469
- * @param allow3Char will shorten hex value to 3 char if possible
470
- */
471
- toHex(t = !1) {
472
- return E(this.r, this.g, this.b, t);
473
- }
474
- /**
475
- * Returns the hex value of the color -with a # prefixed.
476
- * @param allow3Char will shorten hex value to 3 char if possible
477
- */
478
- toHexString(t = !1) {
479
- return "#" + this.toHex(t);
480
- }
481
- /**
482
- * Returns the hex 8 value of the color.
483
- * @param allow4Char will shorten hex value to 4 char if possible
484
- */
485
- toHex8(t = !1) {
486
- return Q(this.r, this.g, this.b, this.a, t);
487
- }
488
- /**
489
- * Returns the hex 8 value of the color -with a # prefixed.
490
- * @param allow4Char will shorten hex value to 4 char if possible
491
- */
492
- toHex8String(t = !1) {
493
- return "#" + this.toHex8(t);
494
- }
495
- /**
496
- * Returns the shorter hex value of the color depends on its alpha -with a # prefixed.
497
- * @param allowShortChar will shorten hex value to 3 or 4 char if possible
498
- */
499
- toHexShortString(t = !1) {
500
- return this.a === 1 ? this.toHexString(t) : this.toHex8String(t);
501
- }
502
- /**
503
- * Returns the object as a RGBA object.
504
- */
505
- toRgb() {
506
- return {
507
- r: Math.round(this.r),
508
- g: Math.round(this.g),
509
- b: Math.round(this.b),
510
- a: this.a
511
- };
512
- }
513
- /**
514
- * Returns the RGBA values interpolated into a string with the following format:
515
- * "RGBA(xxx, xxx, xxx, xx)".
516
- */
517
- toRgbString() {
518
- const t = Math.round(this.r), e = Math.round(this.g), s = Math.round(this.b);
519
- return this.a === 1 ? `rgb(${t}, ${e}, ${s})` : `rgba(${t}, ${e}, ${s}, ${this.roundA})`;
520
- }
521
- /**
522
- * Returns the object as a RGBA object.
523
- */
524
- toPercentageRgb() {
525
- const t = (e) => `${Math.round(c(e, 255) * 100)}%`;
526
- return {
527
- r: t(this.r),
528
- g: t(this.g),
529
- b: t(this.b),
530
- a: this.a
531
- };
532
- }
533
- /**
534
- * Returns the RGBA relative values interpolated into a string
535
- */
536
- toPercentageRgbString() {
537
- const t = (e) => Math.round(c(e, 255) * 100);
538
- return this.a === 1 ? `rgb(${t(this.r)}%, ${t(this.g)}%, ${t(this.b)}%)` : `rgba(${t(this.r)}%, ${t(this.g)}%, ${t(this.b)}%, ${this.roundA})`;
539
- }
540
- toCmyk() {
541
- return {
542
- ..._(this.r, this.g, this.b)
543
- };
544
- }
545
- toCmykString() {
546
- const { c: t, m: e, y: s, k: o } = _(this.r, this.g, this.b);
547
- return `cmyk(${t}, ${e}, ${s}, ${o})`;
548
- }
549
- /**
550
- * The 'real' name of the color -if there is one.
551
- */
552
- toName() {
553
- if (this.a === 0)
554
- return "transparent";
555
- if (this.a < 1)
556
- return !1;
557
- const t = "#" + E(this.r, this.g, this.b, !1);
558
- for (const [e, s] of Object.entries(P))
559
- if (t === s)
560
- return e;
561
- return !1;
562
- }
563
- toString(t) {
564
- const e = !!t;
565
- t = t ?? this.format;
566
- let s = !1;
567
- const o = this.a < 1 && this.a >= 0;
568
- return !e && o && (t.startsWith("hex") || t === "name") ? t === "name" && this.a === 0 ? this.toName() : this.toRgbString() : (t === "rgb" && (s = this.toRgbString()), t === "prgb" && (s = this.toPercentageRgbString()), (t === "hex" || t === "hex6") && (s = this.toHexString()), t === "hex3" && (s = this.toHexString(!0)), t === "hex4" && (s = this.toHex8String(!0)), t === "hex8" && (s = this.toHex8String()), t === "name" && (s = this.toName()), t === "hsl" && (s = this.toHslString()), t === "hsv" && (s = this.toHsvString()), t === "cmyk" && (s = this.toCmykString()), s || this.toHexString());
569
- }
570
- toNumber() {
571
- return (Math.round(this.r) << 16) + (Math.round(this.g) << 8) + Math.round(this.b);
572
- }
573
- clone() {
574
- return new h(this.toString());
575
- }
576
- /**
577
- * Lighten the color a given amount. Providing 100 will always return white.
578
- * @param amount - valid between 1-100
579
- */
580
- lighten(t = 10) {
581
- const e = this.toHsl();
582
- return e.l += t / 100, e.l = w(e.l), new h(e);
583
- }
584
- /**
585
- * Brighten the color a given amount, from 0 to 100.
586
- * @param amount - valid between 1-100
587
- */
588
- brighten(t = 10) {
589
- const e = this.toRgb();
590
- return e.r = Math.max(0, Math.min(255, e.r - Math.round(255 * -(t / 100)))), e.g = Math.max(0, Math.min(255, e.g - Math.round(255 * -(t / 100)))), e.b = Math.max(0, Math.min(255, e.b - Math.round(255 * -(t / 100)))), new h(e);
591
- }
592
- /**
593
- * Darken the color a given amount, from 0 to 100.
594
- * Providing 100 will always return black.
595
- * @param amount - valid between 1-100
596
- */
597
- darken(t = 10) {
598
- const e = this.toHsl();
599
- return e.l -= t / 100, e.l = w(e.l), new h(e);
600
- }
601
- /**
602
- * Mix the color with pure white, from 0 to 100.
603
- * Providing 0 will do nothing, providing 100 will always return white.
604
- * @param amount - valid between 1-100
605
- */
606
- tint(t = 10) {
607
- return this.mix("white", t);
608
- }
609
- /**
610
- * Mix the color with pure black, from 0 to 100.
611
- * Providing 0 will do nothing, providing 100 will always return black.
612
- * @param amount - valid between 1-100
613
- */
614
- shade(t = 10) {
615
- return this.mix("black", t);
616
- }
617
- /**
618
- * Desaturate the color a given amount, from 0 to 100.
619
- * Providing 100 will is the same as calling greyscale
620
- * @param amount - valid between 1-100
621
- */
622
- desaturate(t = 10) {
623
- const e = this.toHsl();
624
- return e.s -= t / 100, e.s = w(e.s), new h(e);
625
- }
626
- /**
627
- * Saturate the color a given amount, from 0 to 100.
628
- * @param amount - valid between 1-100
629
- */
630
- saturate(t = 10) {
631
- const e = this.toHsl();
632
- return e.s += t / 100, e.s = w(e.s), new h(e);
633
- }
634
- /**
635
- * Completely desaturates a color into greyscale.
636
- * Same as calling `desaturate(100)`
637
- */
638
- greyscale() {
639
- return this.desaturate(100);
640
- }
641
- /**
642
- * Spin takes a positive or negative amount within [-360, 360] indicating the change of hue.
643
- * Values outside of this range will be wrapped into this range.
644
- */
645
- spin(t) {
646
- const e = this.toHsl(), s = (e.h + t) % 360;
647
- return e.h = s < 0 ? 360 + s : s, new h(e);
648
- }
649
- /**
650
- * Mix the current color a given amount with another color, from 0 to 100.
651
- * 0 means no mixing (return current color).
652
- */
653
- mix(t, e = 50) {
654
- const s = this.toRgb(), o = new h(t).toRgb(), i = e / 100, n = {
655
- r: (o.r - s.r) * i + s.r,
656
- g: (o.g - s.g) * i + s.g,
657
- b: (o.b - s.b) * i + s.b,
658
- a: (o.a - s.a) * i + s.a
659
- };
660
- return new h(n);
661
- }
662
- analogous(t = 6, e = 30) {
663
- const s = this.toHsl(), o = 360 / e, i = [this];
664
- for (s.h = (s.h - (o * t >> 1) + 720) % 360; --t; )
665
- s.h = (s.h + o) % 360, i.push(new h(s));
666
- return i;
667
- }
668
- /**
669
- * taken from https://github.com/infusion/jQuery-xcolor/blob/master/jquery.xcolor.js
670
- */
671
- complement() {
672
- const t = this.toHsl();
673
- return t.h = (t.h + 180) % 360, new h(t);
674
- }
675
- monochromatic(t = 6) {
676
- const e = this.toHsv(), { h: s } = e, { s: o } = e;
677
- let { v: i } = e;
678
- const n = [], a = 1 / t;
679
- for (; t--; )
680
- n.push(new h({ h: s, s: o, v: i })), i = (i + a) % 1;
681
- return n;
682
- }
683
- splitcomplement() {
684
- const t = this.toHsl(), { h: e } = t;
685
- return [
686
- this,
687
- new h({ h: (e + 72) % 360, s: t.s, l: t.l }),
688
- new h({ h: (e + 216) % 360, s: t.s, l: t.l })
689
- ];
690
- }
691
- /**
692
- * Compute how the color would appear on a background
693
- */
694
- onBackground(t) {
695
- const e = this.toRgb(), s = new h(t).toRgb(), o = e.a + s.a * (1 - e.a);
696
- return new h({
697
- r: (e.r * e.a + s.r * s.a * (1 - e.a)) / o,
698
- g: (e.g * e.a + s.g * s.a * (1 - e.a)) / o,
699
- b: (e.b * e.a + s.b * s.a * (1 - e.a)) / o,
700
- a: o
701
- });
702
- }
703
- /**
704
- * Alias for `polyad(3)`
705
- */
706
- triad() {
707
- return this.polyad(3);
708
- }
709
- /**
710
- * Alias for `polyad(4)`
711
- */
712
- tetrad() {
713
- return this.polyad(4);
714
- }
715
- /**
716
- * Get polyad colors, like (for 1, 2, 3, 4, 5, 6, 7, 8, etc...)
717
- * monad, dyad, triad, tetrad, pentad, hexad, heptad, octad, etc...
718
- */
719
- polyad(t) {
720
- const e = this.toHsl(), { h: s } = e, o = [this], i = 360 / t;
721
- for (let n = 1; n < t; n++)
722
- o.push(new h({ h: (s + n * i) % 360, s: e.s, l: e.l }));
723
- return o;
724
- }
725
- /**
726
- * compare color vs current color
727
- */
728
- equals(t) {
729
- const e = new h(t);
730
- return this.format === "cmyk" || e.format === "cmyk" ? this.toCmykString() === e.toCmykString() : this.toRgbString() === e.toRgbString();
731
- }
732
- }
733
- const N = /^hs[v|l]a?\s?\((\d{1,3}\.?\d*?),?\s?(\d{1,3})/, B = /(^hs[v|l]a?\s?\()\d{1,3}\.?\d*?(,?\s?)\d{1,3}/, D = /(^hs[v|l]a?\()\d{1,3}/, H = (r, t) => t ? r.toHexString() : r.toHex();
734
- class at {
735
- constructor(t, {
736
- applyColorToState: e,
737
- extractColorFromState: s,
738
- maintains: o
739
- }) {
740
- this.maintains = "hue", this._hue = 0, this._opacity = 1, this.getColorProcesses = {
741
- rgb: (i, n) => n ? i.toRgbString() : i.toRgb(),
742
- prgb: (i, n) => n ? i.toPercentageRgbString() : i.toPercentageRgb(),
743
- hex8: (i, n) => n ? i.toHex8String() : i.toHex8(),
744
- name: (i) => i.toName() || i.toRgbString(),
745
- hsl: (i, n) => {
746
- if (this.maintains === "hue") {
747
- if (n)
748
- return i.toHslString().replace(D, `$1${this.hue}`);
749
- const { s: u, l: y, a: $ } = i.toHsl();
750
- return { h: this.hue, s: u, l: y, a: $ };
751
- }
752
- if (n)
753
- return i.toHslString().replace(
754
- B,
755
- `$1${this.hue}$2${this.saturation}`
756
- );
757
- const { s: a, l, a: m } = i.toHsl();
758
- return { h: this.hue, s: a, l, a: m };
759
- },
760
- hsv: (i, n) => {
761
- if (this.maintains === "hue") {
762
- if (n)
763
- return i.toHsvString().replace(D, `$1${this.hue}`);
764
- const { s: u, v: y, a: $ } = i.toHsv();
765
- return { h: this.hue, s: u, v: y, a: $ };
766
- }
767
- if (n)
768
- return i.toHsvString().replace(
769
- B,
770
- `$1${this.hue}$2${this.saturation}`
771
- );
772
- const { s: a, v: l, a: m } = i.toHsv();
773
- return { h: this.hue, s: a, v: l, a: m };
774
- },
775
- hex: H,
776
- hex3: H,
777
- hex4: H,
778
- hex6: H
779
- }, this._color = new h({ h: 0, s: 1, v: 1 }), this._previousColor = new h({ h: 0, s: 1, v: 1 }), this._format = {
780
- format: "",
781
- isString: !1
782
- }, this.host = t, this.applyColorToState = e, this.extractColorFromState = s, this.maintains = o || this.maintains;
783
- }
784
- setColorProcess(t, e, s, o) {
785
- this.maintains === "hue" ? this.setColorMaintainHue(t, e, s, o) : this.maintains === "saturation" && this.setColorMaintainSaturation(
786
- t,
787
- e,
788
- s,
789
- o
790
- );
791
- }
792
- setColorMaintainHue(t, e, s, o) {
793
- const { h: i, s: n, v: a, a: l } = this._color.toHsv();
794
- let m;
795
- if (o && s.startsWith("hs")) {
796
- const u = N.exec(e);
797
- if (u !== null) {
798
- const [, y] = u;
799
- m = Number(y);
800
- }
801
- } else if (!o && s.startsWith("hs")) {
802
- const u = t.originalInput;
803
- m = Object.values(u)[0];
804
- }
805
- this.hue = m || i, this.opacity = l ?? 1, this.applyColorToState({ h: i, s: n, v: a, a: l });
806
- }
807
- setColorMaintainSaturation(t, e, s, o) {
808
- const { a: i } = this._color.toHsv();
809
- if (o && s.startsWith("hs")) {
810
- const n = N.exec(e);
811
- if (n !== null) {
812
- const [, a, l] = n;
813
- this.hue = Number(a), this.saturation = Number(l);
814
- }
815
- } else if (!o && s.startsWith("hs")) {
816
- const n = t.originalInput, a = Object.values(n);
817
- this.hue = a[0], this.saturation = a[1];
818
- } else {
819
- const { h: n } = t.toHsv();
820
- this.hue = n;
821
- }
822
- this.opacity = i ?? 1, this.applyColorToState(t.toHsv());
823
- }
824
- applyColorFromState() {
825
- this._color = new h(this.extractColorFromState(this));
826
- }
827
- get hue() {
828
- return this._hue;
829
- }
830
- set hue(t) {
831
- const e = Math.min(360, Math.max(0, t));
832
- if (e === this.hue)
833
- return;
834
- const s = this.hue, { s: o, v: i, a: n } = this._color.toHsv();
835
- this._color = new h({ h: e, s: o, v: i, a: n }), this._hue = e, this.host.requestUpdate("hue", s);
836
- }
837
- get opacity() {
838
- return this._opacity;
839
- }
840
- set opacity(t) {
841
- const e = Math.min(1, Math.max(0, t));
842
- if (e === this.opacity)
843
- return;
844
- const s = this.opacity, { h: o, s: i, v: n } = this._color.toHsv();
845
- this._color = new h({ h: o, s: i, v: n, a: e }), this._opacity = e, this.host.requestUpdate("opacity", s);
846
- }
847
- /* c8 ignore next 3 */
848
- get value() {
849
- return this.color;
850
- }
851
- get color() {
852
- return this.getColorProcesses[this._format.format || "hex"](
853
- this._color,
854
- this._format.isString
855
- );
856
- }
857
- set color(t) {
858
- if (t === this.color)
859
- return;
860
- const e = this._color;
861
- this._color = new h(t);
862
- const s = this._color.format;
863
- let o = typeof t == "string" || t instanceof String;
864
- s.startsWith("hex") && (o = t.startsWith("#")), this._format = {
865
- format: s,
866
- isString: o
867
- }, this.setColorProcess(this._color, t, s, o), this.host.requestUpdate("color", e);
868
- }
869
- getColor(t) {
870
- const e = {
871
- hsl: "toHsl"
872
- };
873
- return this._color[e[t]]();
874
- }
875
- setColor(t) {
876
- this._color = t;
877
- const e = typeof this._color.originalInput == "string" || this._color.originalInput instanceof String;
878
- this.setColorProcess(this._color, t, this._color.format, e);
879
- }
880
- getHslString() {
881
- return this._color.toHslString();
882
- }
883
- savePreviousColor() {
884
- this._previousColor = this._color.clone();
885
- }
886
- restorePreviousColor() {
887
- this.setColor(this._previousColor);
888
- }
889
- }
890
- const ht = '.opacity-checkerboard{position:absolute;block-size:100%;inline-size:100%;background:repeating-conic-gradient(var(--luzmo-color-loupe-checkerboard-light, rgb(255, 255, 255)) 0 25%,var(--luzmo-color-loupe-checkerboard-dark, rgb(230, 230, 230)) 0 50%) var(--luzmo-color-loupe-checkerboard-position, left top)/calc(var(--luzmo-color-loupe-checkerboard-size, 8px) * 2) calc(var(--luzmo-color-loupe-checkerboard-size, 8px) * 2)}:host{--luzmo-color-slider-gradient-fallback: rgb(255 0 0) 0%, rgb(255 255 0) 17%, rgb(0 255 0) 33%, rgb(0 255 255) 50%, rgb(0 0 255) 67%, rgb(255 0 255) 83%, rgb(255 0 0) 100%;touch-action:none}:host([vertical]) .handle{inset-block-start:unset;inset-block-end:0}:host([vertical]) .slider{-webkit-appearance:slider-vertical;-moz-appearance:slider-vertical;appearance:slider-vertical}:host(:focus){outline:none}.gradient{overflow:hidden}::slotted(*){width:100%;height:100%}@media (forced-colors: active){:host{--highcontrast-color-slider-border-color: CanvasText;--highcontrast-color-slider-border-color-disabled: GrayText;--highcontrast-color-slider-background-color-disabled: Canvas;forced-color-adjust:none}}:host{--luzmo-color-handle-hitarea-border-radius: var( --luzmo-color-slider-handle-hitarea-border-radius, 0px );min-inline-size:var(--luzmo-color-slider-minimum-length, 80px);inline-size:var(--luzmo-color-slider-length, 192px);block-size:var(--luzmo-color-slider-control-track-width, 24px);-webkit-user-select:none;user-select:none;cursor:default;display:block;position:relative}:host([focused]){z-index:2}:host([disabled]){pointer-events:none}:host([disabled]) .gradient{display:none}:host([vertical]){min-block-size:var(--luzmo-color-slider-vertical-minimum-height, var(--luzmo-color-slider-minimum-length, 80px));block-size:var(--luzmo-color-slider-vertical-height, var(--luzmo-color-slider-length, 192px));min-inline-size:0;inline-size:var(--luzmo-color-slider-vertical-control-track-width, var(--luzmo-color-slider-control-track-height, 24px));display:inline-block}:host([vertical]) .handle{inset-inline-start:50%}.handle{inset-block-start:50%;inset-inline-start:0}.checkerboard{--luzmo-color-slider-border-color-local: var( --highcontrast-color-slider-border-color, var(--luzmo-color-slider-border-color, var(--luzmo-border-color)) )}.checkerboard:before{content:"";z-index:1;box-shadow:inset 0 0 0 var(--luzmo-color-slider-border-width, var(--luzmo-border-width)) var(--luzmo-color-slider-border-color-local);border-radius:var(--luzmo-color-slider-border-rounding, var(--luzmo-border-radius-s));position:absolute;top:0;right:0;bottom:0;left:0}:host([disabled]) .checkerboard{--luzmo-color-slider-border-color-local: var( --highcontrast-color-slider-border-color-disabled, var(--luzmo-color-slider-border-color-disabled, var(--luzmo-dimmed-color)) );background:var(--highcontrast-color-slider-background-color-disabled, var(--luzmo-color-slider-background-color-disabled, var(--luzmo-dimmed-color)))}.checkerboard,.gradient{inline-size:100%;block-size:100%;border-radius:var(--luzmo-color-slider-border-rounding, var(--luzmo-border-radius-s))}.gradient:dir(rtl),:host([dir=rtl]) .gradient{transform:scaleX(-1)}.slider{opacity:0;inline-size:100%;block-size:100%;z-index:0;pointer-events:none;margin:0;position:absolute;inset-block-start:0;inset-inline-start:0}';
891
- var lt = Object.defineProperty, ct = Object.getOwnPropertyDescriptor, b = (r, t, e, s) => {
892
- for (var o = s > 1 ? void 0 : s ? ct(t, e) : t, i = r.length - 1, n; i >= 0; i--)
893
- (n = r[i]) && (o = (s ? n(t, e, o) : n(o)) || o);
894
- return s && o && lt(t, e, o), o;
895
- };
896
- class d extends U {
897
- constructor() {
898
- super(...arguments), this.disabled = !1, this.focused = !1, this.label = "hue", this.vertical = !1, this.languageResolver = new V(this), this.colorController = new at(this, {
899
- /* c8 ignore next 3 */
900
- applyColorToState: () => {
901
- if (this.mode === "opacity") {
902
- const t = new h(this.colorController.color);
903
- this.sliderHandlePosition = 100 * t.getAlpha();
904
- } else
905
- this.sliderHandlePosition = 100 * (this.colorController.hue / 360);
906
- },
907
- extractColorFromState: (t) => this.mode === "opacity" ? {
908
- ...t.getColor("hsl"),
909
- a: this.value
910
- } : {
911
- ...t.getColor("hsl"),
912
- h: this.value
913
- },
914
- maintains: "saturation"
915
- }), this.sliderHandlePosition = 0, this.step = 1, this.isLTR = !0, this._altered = 0, this._pointerDown = !1;
916
- }
917
- static get styles() {
918
- return [W(ht)];
919
- }
920
- get value() {
921
- return this.mode === "opacity" ? this.colorController.opacity : this.colorController.hue;
922
- }
923
- set value(t) {
924
- this.mode === "opacity" ? this.colorController.opacity = t : this.colorController.hue = t;
925
- }
926
- get color() {
927
- return this.colorController.color;
928
- }
929
- set color(t) {
930
- this.colorController.color = t;
931
- }
932
- get altered() {
933
- return this._altered;
934
- }
935
- set altered(t) {
936
- this._altered = t, this.step = Math.max(1, this.altered * 10);
937
- }
938
- get focusElement() {
939
- return this.input;
940
- }
941
- handleKeydown(t) {
942
- const { key: e } = t;
943
- this.focused = !0, this.altered = [t.shiftKey, t.ctrlKey, t.altKey].filter(
944
- (n) => !!n
945
- ).length;
946
- let s = 0;
947
- switch (e) {
948
- case "ArrowUp": {
949
- s = this.step;
950
- break;
951
- }
952
- case "ArrowDown": {
953
- s = -this.step;
954
- break;
955
- }
956
- case "ArrowLeft": {
957
- s = this.step * (this.isLTR ? -1 : 1);
958
- break;
959
- }
960
- case "ArrowRight": {
961
- s = this.step * (this.isLTR ? 1 : -1);
962
- break;
963
- }
964
- default:
965
- return;
966
- }
967
- t.preventDefault();
968
- const i = 100 / (this.mode === "opacity" ? 100 : 360);
969
- this.sliderHandlePosition = Math.min(
970
- 100,
971
- Math.max(0, this.sliderHandlePosition + s * i)
972
- ), this.value = this.mode === "opacity" ? Math.min(1, Math.max(0, this.value + s / 100)) : Math.min(360, Math.max(0, this.value + s)), this.colorController.applyColorFromState(), s !== 0 && (this.dispatchEvent(
973
- new Event("input", {
974
- bubbles: !0,
975
- composed: !0
976
- })
977
- ), this.dispatchEvent(
978
- new Event("change", {
979
- bubbles: !0,
980
- composed: !0
981
- })
982
- ));
983
- }
984
- handleInput(t) {
985
- const { valueAsNumber: e } = t.target;
986
- this.value = e, this.sliderHandlePosition = 100 * (this.mode === "opacity" ? this.value : this.value / 360), this.colorController.applyColorFromState();
987
- }
988
- handleChange(t) {
989
- this.handleInput(t), this.dispatchEvent(
990
- new Event("change", {
991
- bubbles: !0,
992
- composed: !0
993
- })
994
- );
995
- }
996
- focus(t = {}) {
997
- super.focus(t), this.forwardFocus();
998
- }
999
- forwardFocus() {
1000
- this.input.focus();
1001
- }
1002
- handleFocus() {
1003
- this.focused = !0;
1004
- }
1005
- handleBlur() {
1006
- this._pointerDown || (this.altered = 0, this.focused = !1);
1007
- }
1008
- handlePointerdown(t) {
1009
- if (t.button !== 0) {
1010
- t.preventDefault();
1011
- return;
1012
- }
1013
- this._pointerDown = !0, this.colorController.savePreviousColor(), this.boundingClientRect = this.getBoundingClientRect(), t.target.setPointerCapture(t.pointerId), t.pointerType === "mouse" && (this.focused = !0);
1014
- }
1015
- handlePointermove(t) {
1016
- this.sliderHandlePosition = this.calculateHandlePosition(t), this.value = (this.mode === "opacity" ? 1 : 360) * (this.sliderHandlePosition / 100), this.colorController.applyColorFromState(), this.dispatchEvent(
1017
- new Event("input", {
1018
- bubbles: !0,
1019
- composed: !0,
1020
- cancelable: !0
1021
- })
1022
- );
1023
- }
1024
- handlePointerup(t) {
1025
- this._pointerDown = !1, t.target.releasePointerCapture(t.pointerId), this.dispatchEvent(
1026
- new Event("change", {
1027
- bubbles: !0,
1028
- composed: !0,
1029
- cancelable: !0
1030
- })
1031
- ) || this.colorController.restorePreviousColor(), this.focus(), t.pointerType === "mouse" && (this.focused = !1);
1032
- }
1033
- /**
1034
- * Returns the value under the cursor
1035
- * @param: PointerEvent on slider
1036
- * @return: Slider value that correlates to the position under the pointer
1037
- */
1038
- calculateHandlePosition(t) {
1039
- if (!this.boundingClientRect)
1040
- return this.sliderHandlePosition;
1041
- const e = this.boundingClientRect, s = this.vertical ? e.top : e.left, o = this.vertical ? t.clientY : t.clientX, i = this.vertical ? e.height : e.width, n = Math.max(0, Math.min(1, (o - s) / i));
1042
- return this.vertical || !this.isLTR ? 100 - 100 * n : 100 * n;
1043
- }
1044
- handleGradientPointerdown(t) {
1045
- t.button === 0 && (t.stopPropagation(), t.preventDefault(), this.handle.dispatchEvent(new PointerEvent("pointerdown", t)), this.handlePointermove(t));
1046
- }
1047
- get handlePositionStyles() {
1048
- return `${this.vertical ? "inset-block-end" : "inset-inline-start"}: ${this.sliderHandlePosition}%`;
1049
- }
1050
- get getColorSliderStyle() {
1051
- const t = this.vertical ? "top" : "right";
1052
- if (this.mode === "opacity") {
1053
- const e = new h(this.colorController.color).setAlpha(1).toRgbString();
1054
- return {
1055
- background: `linear-gradient(to ${t}, transparent, ${e})`
1056
- };
1057
- }
1058
- return {
1059
- background: `linear-gradient(to ${t}, var(--luzmo-color-slider-gradient, var(--luzmo-color-slider-gradient-fallback)))`
1060
- };
1061
- }
1062
- render() {
1063
- return j`
1064
- <div
1065
- class="opacity-checkerboard checkerboard"
1066
- role="presentation"
1067
- @pointerdown=${this.handleGradientPointerdown}
1068
- >
1069
- <div
1070
- class="gradient"
1071
- role="presentation"
1072
- style=${q(this.getColorSliderStyle)}
1073
- >
1074
- <slot name="gradient"></slot>
1075
- </div>
1076
- </div>
1077
- <luzmo-color-handle
1078
- tabindex=${C(this.focused ? void 0 : "0")}
1079
- @focus=${this.forwardFocus}
1080
- ?focused=${this.focused}
1081
- class="handle"
1082
- color=${this.mode === "opacity" ? this.color : "hsl(" + this.value + ", 100%, 50%)"}
1083
- ?disabled=${this.disabled}
1084
- style=${this.handlePositionStyles}
1085
- ${G({
1086
- start: ["pointerdown", this.handlePointerdown],
1087
- streamInside: ["pointermove", this.handlePointermove],
1088
- end: [
1089
- ["pointerup", "pointercancel", "pointerleave"],
1090
- this.handlePointerup
1091
- ]
1092
- })}
1093
- ></luzmo-color-handle>
1094
- <input
1095
- type="range"
1096
- class="slider"
1097
- min="0"
1098
- max=${this.mode === "opacity" ? "100" : "360"}
1099
- aria-orientation=${C(this.vertical ? "vertical" : void 0)}
1100
- orient=${C(this.vertical ? "vertical" : void 0)}
1101
- step=${this.step}
1102
- aria-label=${this.label}
1103
- .value=${String(
1104
- this.mode === "opacity" ? this.value * 100 : this.value
1105
- )}
1106
- aria-valuetext=${`${new Intl.NumberFormat(
1107
- this.languageResolver.language,
1108
- {
1109
- maximumFractionDigits: 0,
1110
- minimumIntegerDigits: 1,
1111
- style: "unit",
1112
- unit: this.mode === "opacity" ? "percent" : "degree",
1113
- unitDisplay: "narrow"
1114
- }
1115
- ).format(this.mode === "opacity" ? this.value * 100 : this.value)}`}
1116
- @input=${this.handleInput}
1117
- @change=${this.handleChange}
1118
- @keydown=${this.handleKeydown}
1119
- />
1120
- `;
1121
- }
1122
- firstUpdated(t) {
1123
- super.firstUpdated(t), this.boundingClientRect = this.getBoundingClientRect(), this.addEventListener("focus", this.handleFocus), this.addEventListener("blur", this.handleBlur);
1124
- }
1125
- updated(t) {
1126
- t.has("mode") && (this.handle.style.insetInlineStart = "", this.handle.style.insetBlockEnd = "", this.mode === "opacity" && (this.colorController.color = new h(
1127
- this.colorController.color
1128
- ).toRgbString(), this.handle.style.insetInlineStart = 100 * this.colorController.opacity + "%"));
1129
- }
1130
- }
1131
- b([
1132
- v({ type: String, reflect: !0 })
1133
- ], d.prototype, "dir", 2);
1134
- b([
1135
- v({ type: String, reflect: !0 })
1136
- ], d.prototype, "mode", 2);
1137
- b([
1138
- v({ type: Boolean, reflect: !0 })
1139
- ], d.prototype, "disabled", 2);
1140
- b([
1141
- v({ type: Boolean, reflect: !0 })
1142
- ], d.prototype, "focused", 2);
1143
- b([
1144
- T(".handle")
1145
- ], d.prototype, "handle", 2);
1146
- b([
1147
- v({ type: String })
1148
- ], d.prototype, "label", 2);
1149
- b([
1150
- v({ type: Boolean, reflect: !0 })
1151
- ], d.prototype, "vertical", 2);
1152
- b([
1153
- v({ type: Number })
1154
- ], d.prototype, "value", 1);
1155
- b([
1156
- v({ type: Number, reflect: !0 })
1157
- ], d.prototype, "sliderHandlePosition", 2);
1158
- b([
1159
- v({ type: String })
1160
- ], d.prototype, "color", 1);
1161
- b([
1162
- v({ type: Number })
1163
- ], d.prototype, "step", 2);
1164
- b([
1165
- v({ type: Boolean, attribute: "is-ltr" })
1166
- ], d.prototype, "isLTR", 2);
1167
- b([
1168
- T("input")
1169
- ], d.prototype, "input", 2);
1170
- customElements.get("luzmo-color-slider") || customElements.define("luzmo-color-slider", d);
1171
- export {
1172
- d as L,
1173
- h as T
1174
- };