@protonradio/proton-ui 0.11.0-beta.19 → 0.11.0-beta.2

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 (50) hide show
  1. package/README.md +73 -153
  2. package/dist/constants.cjs.js +1 -1
  3. package/dist/constants.cjs.js.map +1 -1
  4. package/dist/constants.d.ts +147 -4
  5. package/dist/constants.es.js +19 -7
  6. package/dist/constants.es.js.map +1 -1
  7. package/dist/hooks.cjs.js +1 -1
  8. package/dist/hooks.cjs.js.map +1 -1
  9. package/dist/hooks.d.ts +5 -34
  10. package/dist/hooks.es.js +4 -36
  11. package/dist/hooks.es.js.map +1 -1
  12. package/dist/icons.svg +10 -10
  13. package/dist/index.cjs.js +12 -12
  14. package/dist/index.cjs.js.map +1 -1
  15. package/dist/index.d.ts +296 -500
  16. package/dist/index.es.js +11431 -10145
  17. package/dist/index.es.js.map +1 -1
  18. package/dist/palettes-BX86v-qb.js +2 -0
  19. package/dist/palettes-BX86v-qb.js.map +1 -0
  20. package/dist/palettes-mcF0lNKY.mjs +171 -0
  21. package/dist/palettes-mcF0lNKY.mjs.map +1 -0
  22. package/dist/style.css +1 -1
  23. package/dist/useBreakpoint-CjRyGKN-.mjs.map +1 -1
  24. package/dist/useBreakpoint-DA-JqOu3.js.map +1 -1
  25. package/dist/utils.cjs.js +1 -1
  26. package/dist/utils.cjs.js.map +1 -1
  27. package/dist/utils.d.ts +45 -33
  28. package/dist/utils.es.js +451 -17
  29. package/dist/utils.es.js.map +1 -1
  30. package/package.json +100 -104
  31. package/dist/breakpoint-9y1_8U_b.mjs +0 -10
  32. package/dist/breakpoint-9y1_8U_b.mjs.map +0 -1
  33. package/dist/breakpoint-DtqbboOa.js +0 -2
  34. package/dist/breakpoint-DtqbboOa.js.map +0 -1
  35. package/dist/darkTheme-DUWn6YJ-.mjs +0 -345
  36. package/dist/darkTheme-DUWn6YJ-.mjs.map +0 -1
  37. package/dist/darkTheme-ann6VTfq.js +0 -2
  38. package/dist/darkTheme-ann6VTfq.js.map +0 -1
  39. package/dist/image-BlhKzTx8.js +0 -2
  40. package/dist/image-BlhKzTx8.js.map +0 -1
  41. package/dist/image-C8M6y5Op.mjs +0 -205
  42. package/dist/image-C8M6y5Op.mjs.map +0 -1
  43. package/dist/navigation-BB0MBIiR.js +0 -2
  44. package/dist/navigation-BB0MBIiR.js.map +0 -1
  45. package/dist/navigation-Bj7Pex9j.mjs +0 -43
  46. package/dist/navigation-Bj7Pex9j.mjs.map +0 -1
  47. package/dist/theme-DQsfWeLo.mjs +0 -12
  48. package/dist/theme-DQsfWeLo.mjs.map +0 -1
  49. package/dist/theme-Dc0Ahjq9.js +0 -2
  50. package/dist/theme-Dc0Ahjq9.js.map +0 -1
package/dist/utils.d.ts CHANGED
@@ -1,5 +1,3 @@
1
- import { darken } from 'color2k';
2
- import { lighten } from 'color2k';
3
1
  import { toHex } from 'color2k';
4
2
  import { toRgba } from 'color2k';
5
3
 
@@ -11,15 +9,8 @@ import { toRgba } from 'color2k';
11
9
  */
12
10
  export declare const arrayToRgbString: (rgb: RGBArray, opacity?: number) => string;
13
11
 
14
- export declare const copyTextToClipboard: (text: string, onError?: (error: Error) => void) => Promise<boolean>;
15
-
16
- /**
17
- * Concatenates class names into a single string, filtering out non-string values.
18
- */
19
12
  export declare function csx(...classnames: unknown[]): string;
20
13
 
21
- export { darken }
22
-
23
14
  /**
24
15
  * Desaturates a color.
25
16
  *
@@ -45,7 +36,7 @@ export declare const desaturate: (color: string, amount: number) => string;
45
36
  * 3. Creates another 12-color scale for the secondary color
46
37
  * 4. Maps specific positions from these scales to create the final palette structure
47
38
  */
48
- export declare const generatePalette: (baseColor: RGBArray_2) => ProtonPalette;
39
+ export declare const generatePalette: (baseColor: RGBArray) => Palette;
49
40
 
50
41
  /**
51
42
  * Gets the dominant color of an image. Avoids issues with low contrast colors.
@@ -53,9 +44,9 @@ export declare const generatePalette: (baseColor: RGBArray_2) => ProtonPalette;
53
44
  * @param image - The image to get the dominant color from.
54
45
  * @returns A Promise that resolves to an RGB array.
55
46
  */
56
- export declare function getDominantColor(image: HTMLImageElement): Promise<RGBArray_2>;
47
+ export declare function getDominantColor(image: HTMLImageElement): Promise<RGBArray>;
57
48
 
58
- export declare function getDominantColor(image: string): Promise<RGBArray_2>;
49
+ export declare function getDominantColor(image: string): Promise<RGBArray>;
59
50
 
60
51
  /**
61
52
  * Handles internal navigation clicks by preventing default browser behavior and
@@ -75,37 +66,53 @@ export declare const handleInternalNavigation: (e: React.MouseEvent<HTMLAnchorEl
75
66
  */
76
67
  export declare const isUrlExternal: (url: string) => boolean;
77
68
 
78
- export { lighten }
79
-
80
- declare type ProtonColorScale = {
81
- SUPER_DARK: string;
82
- DARK: string;
83
- MEDIUM: string;
84
- MEDIUM_LIGHT: string;
85
- LIGHT: string;
86
- LIGHTEST: string;
87
- SUPER_LIGHT: string;
88
- WHITE: string;
89
- };
90
-
91
- declare type ProtonPalette = {
69
+ declare type Palette = {
92
70
  BASE_COLOR: string;
93
71
  BRAND: {
94
72
  PRIMARY: string;
95
73
  PRIMARY_LIGHT: string;
96
- PRIMARY_SUPER_LIGHT: string;
97
74
  SECONDARY: string;
75
+ };
76
+ PRIMARY: {
77
+ PRIMARY_SUPER_DARK: string;
78
+ PRIMARY_DARK: string;
79
+ PRIMARY_MEDIUM: string;
80
+ PRIMARY_MEDIUM_LIGHT: string;
81
+ PRIMARY_LIGHT: string;
82
+ PRIMARY_LIGHTEST: string;
83
+ PRIMARY_SUPER_LIGHT: string;
84
+ };
85
+ SECONDARY: {
86
+ SECONDARY_SUPER_DARK: string;
87
+ SECONDARY_DARK: string;
88
+ SECONDARY_MEDIUM: string;
89
+ SECONDARY_MEDIUM_LIGHT: string;
98
90
  SECONDARY_LIGHT: string;
91
+ SECONDARY_LIGHTEST: string;
99
92
  SECONDARY_SUPER_LIGHT: string;
100
93
  };
101
- PRIMARY: ProtonColorScale;
102
- SECONDARY: ProtonColorScale;
103
- GRAYSCALE: ProtonColorScale;
94
+ SUCCESS: {
95
+ SUCCESS_DARK: string;
96
+ SUCCESS_MEDIUM: string;
97
+ SUCCESS_LIGHT: string;
98
+ SUCCESS_SUPER_LIGHT: string;
99
+ };
100
+ WARNING: {
101
+ WARNING_DARK: string;
102
+ WARNING_MEDIUM: string;
103
+ WARNING_LIGHT: string;
104
+ WARNING_SUPER_LIGHT: string;
105
+ };
106
+ DANGER: {
107
+ DANGER_SUPER_DARK: string;
108
+ DANGER_DARK: string;
109
+ DANGER_MEDIUM: string;
110
+ DANGER_LIGHT: string;
111
+ DANGER_SUPER_LIGHT: string;
112
+ };
104
113
  };
105
114
 
106
- declare type RGBArray = [number, number, number];
107
-
108
- declare type RGBArray_2 = [number, number, number];
115
+ export declare type RGBArray = [number, number, number];
109
116
 
110
117
  /**
111
118
  * Saturates a color.
@@ -130,3 +137,8 @@ export { toRgba }
130
137
  export declare const transparentize: (color: string, amount: number) => string;
131
138
 
132
139
  export { }
140
+
141
+
142
+ declare namespace ButtonGroup {
143
+ var Option: (props: ButtonGroupOptionProps) => import("react/jsx-runtime").JSX.Element;
144
+ }
package/dist/utils.es.js CHANGED
@@ -1,20 +1,454 @@
1
- import { a as e, b as r, d as s, l as o, s as n, c as i, e as l, t as g } from "./darkTheme-DUWn6YJ-.mjs";
2
- import { a as p, c as d, h as b, i as c } from "./navigation-Bj7Pex9j.mjs";
3
- import { g as f, a as h } from "./image-C8M6y5Op.mjs";
1
+ import { toRgba as _, transparentize as V, saturate as Z, desaturate as tt, getScale as j, adjustHue as nt, getLuminance as y, lighten as Y, darken as F, hasBadContrast as X } from "color2k";
2
+ import { toHex as dt, toRgba as Et } from "color2k";
3
+ import { S as T, W as N, e as P, G as J } from "./palettes-mcF0lNKY.mjs";
4
+ var U = function(n, r) {
5
+ return n < r ? -1 : n > r ? 1 : 0;
6
+ }, $ = function(n) {
7
+ return n.reduce(function(r, a) {
8
+ return r + a;
9
+ }, 0);
10
+ }, et = /* @__PURE__ */ function() {
11
+ function n(a) {
12
+ this.colors = a;
13
+ }
14
+ var r = n.prototype;
15
+ return r.palette = function() {
16
+ return this.colors;
17
+ }, r.map = function(a) {
18
+ return a;
19
+ }, n;
20
+ }(), rt = function() {
21
+ function n(e, t, s) {
22
+ return (e << 10) + (t << 5) + s;
23
+ }
24
+ function r(e) {
25
+ var t = [], s = !1;
26
+ function u() {
27
+ t.sort(e), s = !0;
28
+ }
29
+ return { push: function(c) {
30
+ t.push(c), s = !1;
31
+ }, peek: function(c) {
32
+ return s || u(), c === void 0 && (c = t.length - 1), t[c];
33
+ }, pop: function() {
34
+ return s || u(), t.pop();
35
+ }, size: function() {
36
+ return t.length;
37
+ }, map: function(c) {
38
+ return t.map(c);
39
+ }, debug: function() {
40
+ return s || u(), t;
41
+ } };
42
+ }
43
+ function a(e, t, s, u, c, o, m) {
44
+ var f = this;
45
+ f.r1 = e, f.r2 = t, f.g1 = s, f.g2 = u, f.b1 = c, f.b2 = o, f.histo = m;
46
+ }
47
+ function l() {
48
+ this.vboxes = new r(function(e, t) {
49
+ return U(e.vbox.count() * e.vbox.volume(), t.vbox.count() * t.vbox.volume());
50
+ });
51
+ }
52
+ function h(e, t) {
53
+ if (t.count()) {
54
+ var s = t.r2 - t.r1 + 1, u = t.g2 - t.g1 + 1, c = Math.max.apply(null, [s, u, t.b2 - t.b1 + 1]);
55
+ if (t.count() == 1) return [t.copy()];
56
+ var o, m, f, v, d = 0, p = [], C = [];
57
+ if (c == s) for (o = t.r1; o <= t.r2; o++) {
58
+ for (v = 0, m = t.g1; m <= t.g2; m++) for (f = t.b1; f <= t.b2; f++) v += e[n(o, m, f)] || 0;
59
+ p[o] = d += v;
60
+ }
61
+ else if (c == u) for (o = t.g1; o <= t.g2; o++) {
62
+ for (v = 0, m = t.r1; m <= t.r2; m++) for (f = t.b1; f <= t.b2; f++) v += e[n(m, o, f)] || 0;
63
+ p[o] = d += v;
64
+ }
65
+ else for (o = t.b1; o <= t.b2; o++) {
66
+ for (v = 0, m = t.r1; m <= t.r2; m++) for (f = t.g1; f <= t.g2; f++) v += e[n(m, f, o)] || 0;
67
+ p[o] = d += v;
68
+ }
69
+ return p.forEach(function(D, g) {
70
+ C[g] = d - D;
71
+ }), function(D) {
72
+ var g, b, R, I, E, w = D + "1", S = D + "2", x = 0;
73
+ for (o = t[w]; o <= t[S]; o++) if (p[o] > d / 2) {
74
+ for (R = t.copy(), I = t.copy(), E = (g = o - t[w]) <= (b = t[S] - o) ? Math.min(t[S] - 1, ~~(o + b / 2)) : Math.max(t[w], ~~(o - 1 - g / 2)); !p[E]; ) E++;
75
+ for (x = C[E]; !x && p[E - 1]; ) x = C[--E];
76
+ return R[S] = E, I[w] = R[S] + 1, [R, I];
77
+ }
78
+ }(c == s ? "r" : c == u ? "g" : "b");
79
+ }
80
+ }
81
+ return a.prototype = { volume: function(e) {
82
+ var t = this;
83
+ return t._volume && !e || (t._volume = (t.r2 - t.r1 + 1) * (t.g2 - t.g1 + 1) * (t.b2 - t.b1 + 1)), t._volume;
84
+ }, count: function(e) {
85
+ var t = this, s = t.histo;
86
+ if (!t._count_set || e) {
87
+ var u, c, o, m = 0;
88
+ for (u = t.r1; u <= t.r2; u++) for (c = t.g1; c <= t.g2; c++) for (o = t.b1; o <= t.b2; o++) m += s[n(u, c, o)] || 0;
89
+ t._count = m, t._count_set = !0;
90
+ }
91
+ return t._count;
92
+ }, copy: function() {
93
+ var e = this;
94
+ return new a(e.r1, e.r2, e.g1, e.g2, e.b1, e.b2, e.histo);
95
+ }, avg: function(e) {
96
+ var t = this, s = t.histo;
97
+ if (!t._avg || e) {
98
+ var u, c, o, m, f = 0, v = 0, d = 0, p = 0;
99
+ if (t.r1 === t.r2 && t.g1 === t.g2 && t.b1 === t.b2) t._avg = [t.r1 << 3, t.g1 << 3, t.b1 << 3];
100
+ else {
101
+ for (c = t.r1; c <= t.r2; c++) for (o = t.g1; o <= t.g2; o++) for (m = t.b1; m <= t.b2; m++) f += u = s[n(c, o, m)] || 0, v += u * (c + 0.5) * 8, d += u * (o + 0.5) * 8, p += u * (m + 0.5) * 8;
102
+ t._avg = f ? [~~(v / f), ~~(d / f), ~~(p / f)] : [~~(8 * (t.r1 + t.r2 + 1) / 2), ~~(8 * (t.g1 + t.g2 + 1) / 2), ~~(8 * (t.b1 + t.b2 + 1) / 2)];
103
+ }
104
+ }
105
+ return t._avg;
106
+ }, contains: function(e) {
107
+ var t = this, s = e[0] >> 3;
108
+ return gval = e[1] >> 3, bval = e[2] >> 3, s >= t.r1 && s <= t.r2 && gval >= t.g1 && gval <= t.g2 && bval >= t.b1 && bval <= t.b2;
109
+ } }, l.prototype = { push: function(e) {
110
+ this.vboxes.push({ vbox: e, color: e.avg() });
111
+ }, palette: function() {
112
+ return this.vboxes.map(function(e) {
113
+ return e.color;
114
+ });
115
+ }, size: function() {
116
+ return this.vboxes.size();
117
+ }, map: function(e) {
118
+ for (var t = this.vboxes, s = 0; s < t.size(); s++) if (t.peek(s).vbox.contains(e)) return t.peek(s).color;
119
+ return this.nearest(e);
120
+ }, nearest: function(e) {
121
+ for (var t, s, u, c = this.vboxes, o = 0; o < c.size(); o++) ((s = Math.sqrt(Math.pow(e[0] - c.peek(o).color[0], 2) + Math.pow(e[1] - c.peek(o).color[1], 2) + Math.pow(e[2] - c.peek(o).color[2], 2))) < t || t === void 0) && (t = s, u = c.peek(o).color);
122
+ return u;
123
+ }, forcebw: function() {
124
+ var e = this.vboxes;
125
+ e.sort(function(c, o) {
126
+ return U($(c.color), $(o.color));
127
+ });
128
+ var t = e[0].color;
129
+ t[0] < 5 && t[1] < 5 && t[2] < 5 && (e[0].color = [0, 0, 0]);
130
+ var s = e.length - 1, u = e[s].color;
131
+ u[0] > 251 && u[1] > 251 && u[2] > 251 && (e[s].color = [255, 255, 255]);
132
+ } }, { quantize: function(e, t) {
133
+ if (!Number.isInteger(t) || t < 1 || t > 256) throw new Error("Invalid maximum color count. It must be an integer between 1 and 256.");
134
+ if (!e.length || t < 2 || t > 256 || !e.length || t < 2 || t > 256) return !1;
135
+ for (var s = [], u = /* @__PURE__ */ new Set(), c = 0; c < e.length; c++) {
136
+ var o = e[c], m = o.join(",");
137
+ u.has(m) || (u.add(m), s.push(o));
138
+ }
139
+ if (s.length <= t) return new et(s);
140
+ var f = function(g) {
141
+ var b, R = new Array(32768);
142
+ return g.forEach(function(I) {
143
+ b = n(I[0] >> 3, I[1] >> 3, I[2] >> 3), R[b] = (R[b] || 0) + 1;
144
+ }), R;
145
+ }(e);
146
+ f.forEach(function() {
147
+ });
148
+ var v = function(g, b) {
149
+ var R, I, E, w = 1e6, S = 0, x = 1e6, K = 0, z = 1e6, O = 0;
150
+ return g.forEach(function(W) {
151
+ (R = W[0] >> 3) < w ? w = R : R > S && (S = R), (I = W[1] >> 3) < x ? x = I : I > K && (K = I), (E = W[2] >> 3) < z ? z = E : E > O && (O = E);
152
+ }), new a(w, S, x, K, z, O, b);
153
+ }(e, f), d = new r(function(g, b) {
154
+ return U(g.count(), b.count());
155
+ });
156
+ function p(g, b) {
157
+ for (var R, I = g.size(), E = 0; E < 1e3; ) {
158
+ if (I >= b || E++ > 1e3) return;
159
+ if ((R = g.pop()).count()) {
160
+ var w = h(f, R), S = w[0], x = w[1];
161
+ if (!S) return;
162
+ g.push(S), x && (g.push(x), I++);
163
+ } else g.push(R), E++;
164
+ }
165
+ }
166
+ d.push(v), p(d, 0.75 * t);
167
+ for (var C = new r(function(g, b) {
168
+ return U(g.count() * g.volume(), b.count() * b.volume());
169
+ }); d.size(); ) C.push(d.pop());
170
+ p(C, t);
171
+ for (var D = new l(); C.size(); ) D.push(C.pop());
172
+ return D;
173
+ } };
174
+ }().quantize, Q = function(n) {
175
+ this.canvas = document.createElement("canvas"), this.context = this.canvas.getContext("2d"), this.width = this.canvas.width = n.naturalWidth, this.height = this.canvas.height = n.naturalHeight, this.context.drawImage(n, 0, 0, this.width, this.height);
176
+ };
177
+ Q.prototype.getImageData = function() {
178
+ return this.context.getImageData(0, 0, this.width, this.height);
179
+ };
180
+ var G = function() {
181
+ };
182
+ G.prototype.getColor = function(n, r) {
183
+ return r === void 0 && (r = 10), this.getPalette(n, 5, r)[0];
184
+ }, G.prototype.getPalette = function(n, r, a) {
185
+ var l = function(s) {
186
+ var u = s.colorCount, c = s.quality;
187
+ if (u !== void 0 && Number.isInteger(u)) {
188
+ if (u === 1) throw new Error("colorCount should be between 2 and 20. To get one color, call getColor() instead of getPalette()");
189
+ u = Math.max(u, 2), u = Math.min(u, 20);
190
+ } else u = 10;
191
+ return (c === void 0 || !Number.isInteger(c) || c < 1) && (c = 10), { colorCount: u, quality: c };
192
+ }({ colorCount: r, quality: a }), h = new Q(n), e = function(s, u, c) {
193
+ for (var o, m, f, v, d, p = s, C = [], D = 0; D < u; D += c) m = p[0 + (o = 4 * D)], f = p[o + 1], v = p[o + 2], ((d = p[o + 3]) === void 0 || d >= 125) && (m > 250 && f > 250 && v > 250 || C.push([m, f, v]));
194
+ return C;
195
+ }(h.getImageData().data, h.width * h.height, l.quality), t = rt(e, l.colorCount);
196
+ return t ? t.palette() : null;
197
+ }, G.prototype.getColorFromUrl = function(n, r, a) {
198
+ var l = this, h = document.createElement("img");
199
+ h.addEventListener("load", function() {
200
+ var e = l.getPalette(h, 5, a);
201
+ r(e[0], n);
202
+ }), h.src = n;
203
+ }, G.prototype.getImageData = function(n, r) {
204
+ var a = new XMLHttpRequest();
205
+ a.open("GET", n, !0), a.responseType = "arraybuffer", a.onload = function() {
206
+ if (this.status == 200) {
207
+ var l = new Uint8Array(this.response);
208
+ i = l.length;
209
+ for (var h = new Array(i), e = 0; e < l.length; e++) h[e] = String.fromCharCode(l[e]);
210
+ var t = h.join(""), s = window.btoa(t);
211
+ r("data:image/png;base64," + s);
212
+ }
213
+ }, a.send();
214
+ }, G.prototype.getColorAsync = function(n, r, a) {
215
+ var l = this;
216
+ this.getImageData(n, function(h) {
217
+ var e = document.createElement("img");
218
+ e.addEventListener("load", function() {
219
+ var t = l.getPalette(e, 5, a);
220
+ r(t[0], this);
221
+ }), e.src = h;
222
+ });
223
+ };
224
+ const k = (n, r) => r === void 0 ? `rgb(${n[0]}, ${n[1]}, ${n[2]})` : `rgba(${n[0]}, ${n[1]}, ${n[2]}, ${r})`, lt = (n, r) => _(V(n, r)), M = (n, r) => _(Z(n, r)), L = (n, r) => _(tt(n, r));
225
+ function ft(n) {
226
+ return n instanceof HTMLImageElement ? Promise.resolve(ot(n)) : at(n);
227
+ }
228
+ function ot(n) {
229
+ try {
230
+ return new G().getColor(n);
231
+ } catch {
232
+ return [255, 255, 255];
233
+ }
234
+ }
235
+ function at(n) {
236
+ return new Promise((r, a) => {
237
+ const l = document.createElement("img");
238
+ l.crossOrigin = "anonymous", l.onload = () => {
239
+ try {
240
+ const h = new G().getColor(l);
241
+ r(h);
242
+ } catch {
243
+ r([255, 255, 255]);
244
+ }
245
+ }, l.onerror = () => a(new Error("Failed to load image")), l.src = n;
246
+ });
247
+ }
248
+ const mt = (n) => {
249
+ const r = k(n), a = j("#FFFFFF", r, "#000000"), l = Array.from({ length: 12 }, (o, m) => {
250
+ const f = a(m / 11);
251
+ return L(f, 85e-4);
252
+ }), h = l.map(
253
+ (o) => M(B(o), 5e-3)
254
+ ), e = _(M(nt(r, 180), 1)), t = j("#FFFFFF", e, "#000000"), s = Array.from({ length: 12 }, (o, m) => {
255
+ const f = t(m / 11);
256
+ return L(f, 0.1);
257
+ }), u = s.map(
258
+ (o) => L(B(o), 0.22)
259
+ ), c = it(
260
+ M(h[5], 0.115)
261
+ );
262
+ return {
263
+ BASE_COLOR: k(n),
264
+ BRAND: {
265
+ PRIMARY: c,
266
+ PRIMARY_LIGHT: A(c, 0.25, {
267
+ min: 0.6,
268
+ max: 0.8
269
+ }),
270
+ SECONDARY: L(u[4], 0.02)
271
+ },
272
+ PRIMARY: {
273
+ //backgrounds
274
+ PRIMARY_SUPER_DARK: A(
275
+ H(l[9]),
276
+ -0.6,
277
+ {
278
+ min: 0,
279
+ max: 0.02
280
+ }
281
+ ),
282
+ PRIMARY_DARK: A(
283
+ H(l[8]),
284
+ -0.4,
285
+ {
286
+ min: 0.01,
287
+ max: 0.02
288
+ }
289
+ ),
290
+ //interactive components
291
+ PRIMARY_MEDIUM: A(h[7], -0.2, {
292
+ min: 0,
293
+ max: 0.11
294
+ }),
295
+ //borders and seperators
296
+ PRIMARY_MEDIUM_LIGHT: A(
297
+ L(h[6], 0.1),
298
+ 0.08
299
+ ),
300
+ //solid colors
301
+ PRIMARY_LIGHT: A(
302
+ M(h[5], 0.1),
303
+ 0.16
304
+ ),
305
+ //accessible text
306
+ PRIMARY_LIGHTEST: A(
307
+ M(h[3], 0.2),
308
+ 0.12,
309
+ {
310
+ min: 0.5,
311
+ max: 0.9
312
+ }
313
+ ),
314
+ PRIMARY_SUPER_LIGHT: A(h[1], 0.02, {
315
+ min: 0.86,
316
+ max: 0.98
317
+ })
318
+ },
319
+ SECONDARY: {
320
+ //backgrounds
321
+ SECONDARY_SUPER_DARK: A(
322
+ H(s[9]),
323
+ -0.6,
324
+ {
325
+ min: 0,
326
+ max: 0.02
327
+ }
328
+ ),
329
+ SECONDARY_DARK: A(
330
+ H(s[8]),
331
+ -0.4,
332
+ {
333
+ min: 0.01,
334
+ max: 0.02
335
+ }
336
+ ),
337
+ // interactive components
338
+ SECONDARY_MEDIUM: A(u[7], -0.2, {
339
+ min: 0,
340
+ max: 0.11
341
+ }),
342
+ //borders and seperators
343
+ SECONDARY_MEDIUM_LIGHT: A(
344
+ u[6],
345
+ 0.1
346
+ ),
347
+ //solid colors
348
+ SECONDARY_LIGHT: A(
349
+ M(u[5], 0.1),
350
+ 0.16
351
+ ),
352
+ //accessible text
353
+ SECONDARY_LIGHTEST: A(
354
+ M(u[3], 0.2),
355
+ 0.12,
356
+ {
357
+ min: 0.5,
358
+ max: 0.9
359
+ }
360
+ ),
361
+ SECONDARY_SUPER_LIGHT: A(
362
+ u[0],
363
+ 0.02,
364
+ {
365
+ min: 0.86,
366
+ max: 0.98
367
+ }
368
+ )
369
+ },
370
+ SUCCESS: {
371
+ SUCCESS_DARK: T.DARK,
372
+ SUCCESS_MEDIUM: T.MEDIUM,
373
+ SUCCESS_LIGHT: T.LIGHT,
374
+ SUCCESS_SUPER_LIGHT: T.SUPER_LIGHT
375
+ },
376
+ WARNING: {
377
+ WARNING_DARK: N.DARK,
378
+ WARNING_MEDIUM: N.MEDIUM,
379
+ WARNING_LIGHT: N.LIGHT,
380
+ WARNING_SUPER_LIGHT: N.SUPER_LIGHT
381
+ },
382
+ DANGER: {
383
+ DANGER_SUPER_DARK: P.SUPER_DARK,
384
+ DANGER_DARK: P.DARK,
385
+ DANGER_MEDIUM: P.MEDIUM,
386
+ DANGER_LIGHT: P.LIGHT,
387
+ DANGER_SUPER_LIGHT: P.SUPER_LIGHT
388
+ }
389
+ };
390
+ }, A = (n, r, a = { min: 0.03, max: 0.97 }) => {
391
+ let l = n, h = y(l);
392
+ if (a.min < 0 && (a.min = 0), a.max > 1 && (a.max = 1), a.min >= a.max)
393
+ throw new Error("Invalid range: min must be less than max");
394
+ if (r > 0) {
395
+ const t = a.max - h;
396
+ if (t <= 0) return _(l);
397
+ const s = r * (t / (1 - h));
398
+ l = Y(l, s);
399
+ } else if (r < 0) {
400
+ const t = h - a.min;
401
+ if (t <= 0) return _(l);
402
+ const s = r * (t / h);
403
+ l = F(l, Math.abs(s));
404
+ }
405
+ const e = y(l);
406
+ return (e > a.max || e < a.min) && (l = q(l, a)), _(l);
407
+ }, q = (n, r) => {
408
+ let a = n, l = y(a);
409
+ for (; l > r.max; )
410
+ a = F(a, 0.05), l = y(a);
411
+ for (; l < r.min; )
412
+ a = Y(a, 0.05), l = y(a);
413
+ return _(a);
414
+ }, H = (n) => {
415
+ for (; X(n, "readable", J.GRAY_DARK); )
416
+ n = Y(n, 0.01);
417
+ return _(n);
418
+ }, it = (n) => {
419
+ for (; X(J.GRAY_SUPER_LIGHT, "readable", n); )
420
+ n = F(n, 0.01);
421
+ return _(n);
422
+ }, B = (n) => {
423
+ let r = n, a = y(_(r)), l = 0;
424
+ const h = 6;
425
+ for (; a < 0.16 && l < h; )
426
+ l++, r = Y(r, 0.1), a = y(_(r));
427
+ for (; a > 0.6 && l < h; )
428
+ l++, r = F(r, 0.1), a = y(_(r));
429
+ return _(r);
430
+ }, st = (n) => typeof n == "string" || n instanceof String;
431
+ function ht(...n) {
432
+ return n.filter(st).join(" ");
433
+ }
434
+ const gt = (n) => n.startsWith("http"), vt = (n, r) => {
435
+ if (n.metaKey || n.altKey || n.ctrlKey || n.shiftKey || n.button && n.button !== 0)
436
+ return;
437
+ n.preventDefault();
438
+ const a = r.startsWith("/") ? r : `/${r}`;
439
+ window.history.pushState({}, "", a), window.dispatchEvent(new PopStateEvent("popstate"));
440
+ };
4
441
  export {
5
- e as arrayToRgbString,
6
- p as copyTextToClipboard,
7
- d as csx,
8
- r as darken,
9
- s as desaturate,
10
- f as generatePalette,
11
- h as getDominantColor,
12
- b as handleInternalNavigation,
13
- c as isUrlExternal,
14
- o as lighten,
15
- n as saturate,
16
- i as toHex,
17
- l as toRgba,
18
- g as transparentize
442
+ k as arrayToRgbString,
443
+ ht as csx,
444
+ L as desaturate,
445
+ mt as generatePalette,
446
+ ft as getDominantColor,
447
+ vt as handleInternalNavigation,
448
+ gt as isUrlExternal,
449
+ M as saturate,
450
+ dt as toHex,
451
+ Et as toRgba,
452
+ lt as transparentize
19
453
  };
20
454
  //# sourceMappingURL=utils.es.js.map