@starasia/theme 3.5.0 → 3.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es.js +319 -270
- package/dist/index.umd.js +6 -6
- package/dist/theme/basePalette.d.ts +10 -0
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { createContext as
|
|
3
|
-
const
|
|
1
|
+
import { jsx as C, jsxs as ae } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as me, useState as _, useMemo as Q, useEffect as I, useRef as ye, useCallback as $, useContext as be } from "react";
|
|
3
|
+
const he = (e, r) => {
|
|
4
4
|
if (typeof document > "u")
|
|
5
5
|
return;
|
|
6
6
|
const a = document.getElementById(r);
|
|
@@ -10,7 +10,7 @@ const me = (e, r) => {
|
|
|
10
10
|
const s = document.createElement("style");
|
|
11
11
|
s.id = r, s.textContent = e, document.head.appendChild(s);
|
|
12
12
|
}
|
|
13
|
-
},
|
|
13
|
+
}, we = (e) => {
|
|
14
14
|
if (typeof document > "u")
|
|
15
15
|
return null;
|
|
16
16
|
const r = document.getElementById(e);
|
|
@@ -19,7 +19,7 @@ const me = (e, r) => {
|
|
|
19
19
|
const a = document.createElement("style");
|
|
20
20
|
return a.id = e, document.head.appendChild(a), a;
|
|
21
21
|
};
|
|
22
|
-
function
|
|
22
|
+
function T(e) {
|
|
23
23
|
let r = e.trim().replace(/^#/, "");
|
|
24
24
|
r.length === 3 && (r = r.split("").map((s) => s + s).join("")), r.length === 8 && (r = r.slice(0, 6));
|
|
25
25
|
const a = parseInt(r, 16);
|
|
@@ -29,12 +29,12 @@ function j(e) {
|
|
|
29
29
|
b: (a & 255) / 255
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
|
-
const
|
|
33
|
-
function
|
|
34
|
-
return `#${
|
|
32
|
+
const Y = (e) => Math.max(0, Math.min(255, Math.round(e * 255))).toString(16).padStart(2, "0");
|
|
33
|
+
function xe({ r: e, g: r, b: a }) {
|
|
34
|
+
return `#${Y(e)}${Y(r)}${Y(a)}`;
|
|
35
35
|
}
|
|
36
|
-
const
|
|
37
|
-
function
|
|
36
|
+
const A = (e) => e <= 0.04045 ? e / 12.92 : Math.pow((e + 0.055) / 1.055, 2.4), z = (e) => e <= 31308e-7 ? 12.92 * e : 1.055 * Math.pow(e, 1 / 2.4) - 0.055;
|
|
37
|
+
function Se(e, r, a) {
|
|
38
38
|
const s = 0.4122214708 * e + 0.5363325363 * r + 0.0514459929 * a, c = 0.2119034982 * e + 0.6806995451 * r + 0.1073969566 * a, o = 0.0883024619 * e + 0.2817188376 * r + 0.6299787005 * a, n = Math.cbrt(s), d = Math.cbrt(c), t = Math.cbrt(o);
|
|
39
39
|
return {
|
|
40
40
|
L: 0.2104542553 * n + 0.793617785 * d - 0.0040720468 * t,
|
|
@@ -42,7 +42,7 @@ function we(e, r, a) {
|
|
|
42
42
|
b: 0.0259040371 * n + 0.7827717662 * d - 0.808675766 * t
|
|
43
43
|
};
|
|
44
44
|
}
|
|
45
|
-
function
|
|
45
|
+
function Ee(e, r, a) {
|
|
46
46
|
const s = e + 0.3963377774 * r + 0.2158037573 * a, c = e - 0.1055613458 * r - 0.0638541728 * a, o = e - 0.0894841775 * r - 1.291485548 * a, n = s * s * s, d = c * c * c, t = o * o * o;
|
|
47
47
|
return {
|
|
48
48
|
r: 4.0767416621 * n - 3.3077115913 * d + 0.2309699292 * t,
|
|
@@ -50,53 +50,53 @@ function xe(e, r, a) {
|
|
|
50
50
|
b: -0.0041960863 * n - 0.7034186147 * d + 1.707614701 * t
|
|
51
51
|
};
|
|
52
52
|
}
|
|
53
|
-
function
|
|
54
|
-
const { L: s, a: c, b: o } =
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
53
|
+
function Me({ r: e, g: r, b: a }) {
|
|
54
|
+
const { L: s, a: c, b: o } = Se(
|
|
55
|
+
A(e),
|
|
56
|
+
A(r),
|
|
57
|
+
A(a)
|
|
58
58
|
), n = Math.sqrt(c * c + o * o);
|
|
59
59
|
let d = Math.atan2(o, c) * 180 / Math.PI;
|
|
60
60
|
return d < 0 && (d += 360), { l: s, c: n, h: d };
|
|
61
61
|
}
|
|
62
|
-
const
|
|
63
|
-
function
|
|
64
|
-
const s = a * Math.PI / 180, c = (n) =>
|
|
62
|
+
const w = (e) => Me(T(e)), se = ({ r: e, g: r, b: a }, s = 1e-4) => e >= -s && e <= 1 + s && r >= -s && r <= 1 + s && a >= -s && a <= 1 + s;
|
|
63
|
+
function Ce({ l: e, c: r, h: a }) {
|
|
64
|
+
const s = a * Math.PI / 180, c = (n) => Ee(e, n * Math.cos(s), n * Math.sin(s));
|
|
65
65
|
let o = c(r);
|
|
66
|
-
if (!
|
|
66
|
+
if (!se(o)) {
|
|
67
67
|
let n = 0, d = r;
|
|
68
68
|
for (let t = 0; t < 20; t++) {
|
|
69
69
|
const b = (n + d) / 2;
|
|
70
|
-
o = c(b),
|
|
70
|
+
o = c(b), se(o) ? n = b : d = b;
|
|
71
71
|
}
|
|
72
72
|
o = c(n);
|
|
73
73
|
}
|
|
74
74
|
return {
|
|
75
|
-
r: Math.min(1, Math.max(0,
|
|
76
|
-
g: Math.min(1, Math.max(0,
|
|
77
|
-
b: Math.min(1, Math.max(0,
|
|
75
|
+
r: Math.min(1, Math.max(0, z(o.r))),
|
|
76
|
+
g: Math.min(1, Math.max(0, z(o.g))),
|
|
77
|
+
b: Math.min(1, Math.max(0, z(o.b)))
|
|
78
78
|
};
|
|
79
79
|
}
|
|
80
|
-
const
|
|
81
|
-
function
|
|
82
|
-
return 0.2126 *
|
|
80
|
+
const N = (e) => xe(Ce(e));
|
|
81
|
+
function V({ r: e, g: r, b: a }) {
|
|
82
|
+
return 0.2126 * A(e) + 0.7152 * A(r) + 0.0722 * A(a);
|
|
83
83
|
}
|
|
84
|
-
function
|
|
85
|
-
const a =
|
|
84
|
+
function X(e, r) {
|
|
85
|
+
const a = V(T(e)), s = V(T(r)), c = Math.max(a, s), o = Math.min(a, s);
|
|
86
86
|
return (c + 0.05) / (o + 0.05);
|
|
87
87
|
}
|
|
88
|
-
function
|
|
88
|
+
function R(e, r = ["#ffffff", "#1e1f21"]) {
|
|
89
89
|
let a = r[0], s = -1;
|
|
90
90
|
for (const c of r) {
|
|
91
|
-
const o =
|
|
91
|
+
const o = X(e, c);
|
|
92
92
|
o > s && (s = o, a = c);
|
|
93
93
|
}
|
|
94
94
|
return a;
|
|
95
95
|
}
|
|
96
|
-
function
|
|
97
|
-
return
|
|
96
|
+
function fe(e) {
|
|
97
|
+
return V(T(e)) < 0.4;
|
|
98
98
|
}
|
|
99
|
-
const
|
|
99
|
+
const F = ["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"], P = ["50", "100", "200", "300", "400", "500", "600", "700", "800", "900", "1000", "1100"], U = {
|
|
100
100
|
brand: {
|
|
101
101
|
L: [0.9434, 0.8816, 0.7612, 0.6375, 0.5179, 0.4415, 0.2695, 0.2429, 0.2155, 0.1878],
|
|
102
102
|
C: [0.0143, 0.031, 0.0645, 0.1017, 0.1394, 0.1429, 0.086, 0.0761, 0.066, 0.0549]
|
|
@@ -117,40 +117,40 @@ const T = ["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"],
|
|
|
117
117
|
L: [0.9673, 0.9003, 0.8504, 0.8055, 0.7624, 0.6961, 0.5244, 0.3979, 0.2567, 0.2201],
|
|
118
118
|
C: [0.0205, 0.0679, 0.0991, 0.1284, 0.1495, 0.1346, 0.0998, 0.0731, 0.0415, 0.0332]
|
|
119
119
|
}
|
|
120
|
-
},
|
|
121
|
-
function
|
|
122
|
-
const { c: a, h: s } =
|
|
120
|
+
}, Ae = [1, 0.9791, 0.9577, 0.9007, 0.7857, 0.6501, 0.6028, 0.5383, 0.4389, 0.36, 0.2856, 0.239], Le = [0.2127, 0.2401, 0.3133, 0.3673, 0.4198, 0.5093, 0.603, 0.682, 0.7408, 0.8102, 0.8546, 0.9153], $e = 0.02;
|
|
121
|
+
function H(e, r) {
|
|
122
|
+
const { c: a, h: s } = w(e), c = Math.max(...r.C) || 1;
|
|
123
123
|
return r.L.map(
|
|
124
|
-
(o, n) =>
|
|
124
|
+
(o, n) => N({ l: o, c: a * (r.C[n] / c), h: s })
|
|
125
125
|
);
|
|
126
126
|
}
|
|
127
|
-
function
|
|
128
|
-
const { c: a, h: s } =
|
|
127
|
+
function oe(e, r) {
|
|
128
|
+
const { c: a, h: s } = w(e), c = Math.min(a, $e), o = r.length;
|
|
129
129
|
return r.map((n, d) => {
|
|
130
130
|
const t = d / (o - 1), b = 1 - Math.abs(2 * t - 1);
|
|
131
|
-
return
|
|
131
|
+
return N({ l: n, c: c * b, h: s });
|
|
132
132
|
});
|
|
133
133
|
}
|
|
134
|
-
function
|
|
135
|
-
const o =
|
|
134
|
+
function ce(e, r, a, s, c = 0.018) {
|
|
135
|
+
const o = w(e).l, n = w(r).l;
|
|
136
136
|
return Array.from({ length: a }, (d, t) => {
|
|
137
137
|
if (t === 0)
|
|
138
138
|
return e;
|
|
139
139
|
if (t === a - 1)
|
|
140
140
|
return r;
|
|
141
|
-
const b = t / (a - 1), v = o + (n - o) * b,
|
|
142
|
-
return
|
|
141
|
+
const b = t / (a - 1), v = o + (n - o) * b, k = 1 - Math.abs(2 * b - 1);
|
|
142
|
+
return N({ l: v, c: c * k, h: s });
|
|
143
143
|
});
|
|
144
144
|
}
|
|
145
|
-
function
|
|
145
|
+
function qe(e, r) {
|
|
146
146
|
let a = e[0], s = 1 / 0;
|
|
147
147
|
for (const c of e) {
|
|
148
|
-
const o = Math.abs(
|
|
148
|
+
const o = Math.abs(w(c).l - r);
|
|
149
149
|
o < s && (s = o, a = c);
|
|
150
150
|
}
|
|
151
151
|
return a;
|
|
152
152
|
}
|
|
153
|
-
const
|
|
153
|
+
const ue = [
|
|
154
154
|
{ token: "--sa-text-primary", recipe: "var(--sa-color-gray-1000, #292a2e)", scale: "gray" },
|
|
155
155
|
{ token: "--sa-text-primary-inverse", recipe: "var(--sa-color-gray-50, #ffffff)", scale: "gray" },
|
|
156
156
|
{ token: "--sa-text-on-brand", recipe: "var(--sa-color-gray-50, #ffffff)", scale: "gray" },
|
|
@@ -305,7 +305,7 @@ const be = [
|
|
|
305
305
|
{ token: "--sa-border-danger", recipe: "var(--sa-color-error-600, #c9184a)", scale: "error" },
|
|
306
306
|
{ token: "--sa-border-danger-subtle", recipe: "var(--sa-color-error-200, #ffb3c1)", scale: "error" },
|
|
307
307
|
{ token: "--sa-border-danger-disable", recipe: "var(--sa-color-error-200, #ffb3c1)", scale: "error" },
|
|
308
|
-
{ token: "--sa-border-success", recipe: "var(--sa-color-success-
|
|
308
|
+
{ token: "--sa-border-success", recipe: "var(--sa-color-success-700, #208958)", scale: "success" },
|
|
309
309
|
{ token: "--sa-border-success-subtle", recipe: "var(--sa-color-success-200, #97e6c1)", scale: "success" },
|
|
310
310
|
{ token: "--sa-border-success-disable", recipe: "var(--sa-color-success-200, #97e6c1)", scale: "success" },
|
|
311
311
|
{ token: "--sa-border-info", recipe: "var(--sa-color-info-600, #0090d4)", scale: "info" },
|
|
@@ -333,7 +333,7 @@ const be = [
|
|
|
333
333
|
{ token: "--sa-text-on-accent", recipe: "var(--sa-color-gray-1100, #1e1f21)", scale: "gray" },
|
|
334
334
|
{ token: "--sa-icon-accent", recipe: "var(--sa-color-amber-700, #a8690b)", scale: "amber" },
|
|
335
335
|
{ token: "--sa-border-accent", recipe: "var(--sa-color-amber-500, #f5a524)", scale: "amber" }
|
|
336
|
-
],
|
|
336
|
+
], ke = [
|
|
337
337
|
{ token: "--sa-text-primary", recipe: "var(--sa-color-dark-1100, #e2e3e4)", scale: "dark" },
|
|
338
338
|
{ token: "--sa-text-primary-inverse", recipe: "var(--sa-color-gray-1100, #1e1f21)", scale: "gray" },
|
|
339
339
|
{ token: "--sa-text-brand", recipe: "var(--sa-color-brand-300, #668cc9)", scale: "brand" },
|
|
@@ -356,10 +356,10 @@ const be = [
|
|
|
356
356
|
{ token: "--sa-text-info-hover", recipe: "var(--sa-color-info-100, #def3ff)", scale: "info" },
|
|
357
357
|
{ token: "--sa-text-info-pressed", recipe: "var(--sa-color-info-200, #b6eaff)", scale: "info" },
|
|
358
358
|
{ token: "--sa-text-info-disable", recipe: "var(--sa-color-info-600, #0090d4)", scale: "info" },
|
|
359
|
-
{ token: "--sa-text-subtle", recipe: "var(--sa-color-
|
|
360
|
-
{ token: "--sa-text-subtlest", recipe: "var(--sa-color-gray-
|
|
361
|
-
{ token: "--sa-text-hover", recipe: "var(--sa-color-dark-
|
|
362
|
-
{ token: "--sa-text-pressed", recipe: "var(--sa-color-dark-
|
|
359
|
+
{ token: "--sa-text-subtle", recipe: "var(--sa-color-dark-800, #a9abaf)", scale: "dark" },
|
|
360
|
+
{ token: "--sa-text-subtlest", recipe: "var(--sa-color-gray-500, #8c8f97)", scale: "gray" },
|
|
361
|
+
{ token: "--sa-text-hover", recipe: "var(--sa-color-dark-800, #a9abaf)", scale: "dark" },
|
|
362
|
+
{ token: "--sa-text-pressed", recipe: "var(--sa-color-dark-900, #bfc1c4)", scale: "dark" },
|
|
363
363
|
{ token: "--sa-text-disable", recipe: "var(--sa-color-white-alpha-a20, #ceced933)", scale: "white" },
|
|
364
364
|
{ token: "--sa-text-bolder", recipe: "var(--sa-color-gray-50, #ffffff)", scale: "gray" },
|
|
365
365
|
{ token: "--sa-text-warning", recipe: "var(--sa-color-warning-300, #f1b259)", scale: "warning" },
|
|
@@ -367,10 +367,10 @@ const be = [
|
|
|
367
367
|
{ token: "--sa-text-warning-hover", recipe: "var(--sa-color-warning-100, #f8d9ac)", scale: "warning" },
|
|
368
368
|
{ token: "--sa-text-warning-pressed", recipe: "var(--sa-color-warning-200, #f4c583)", scale: "warning" },
|
|
369
369
|
{ token: "--sa-text-warning-disable", recipe: "var(--sa-color-warning-600, #8e5f1d)", scale: "warning" },
|
|
370
|
-
{ token: "--sa-text-secondary", recipe: "var(--sa-color-secondary-
|
|
370
|
+
{ token: "--sa-text-secondary", recipe: "var(--sa-color-secondary-200, #8a98ea)", scale: "secondary" },
|
|
371
371
|
{ token: "--sa-text-secondary-bolder", recipe: "var(--sa-color-secondary-50, #e6e9fb)", scale: "secondary" },
|
|
372
|
-
{ token: "--sa-text-secondary-hover", recipe: "var(--sa-color-secondary-
|
|
373
|
-
{ token: "--sa-text-secondary-pressed", recipe: "var(--sa-color-secondary-
|
|
372
|
+
{ token: "--sa-text-secondary-hover", recipe: "var(--sa-color-secondary-50, #e6e9fb)", scale: "secondary" },
|
|
373
|
+
{ token: "--sa-text-secondary-pressed", recipe: "var(--sa-color-secondary-100, #b0b9f1)", scale: "secondary" },
|
|
374
374
|
{ token: "--sa-text-secondary-disable", recipe: "var(--sa-color-secondary-600, #001bbf)", scale: "secondary" },
|
|
375
375
|
{ token: "--sa-icon-primary", recipe: "var(--sa-color-dark-1100, #e2e3e4)", scale: "dark" },
|
|
376
376
|
{ token: "--sa-icon-primary-inverse", recipe: "var(--sa-color-gray-1100, #1e1f21)", scale: "gray" },
|
|
@@ -423,7 +423,7 @@ const be = [
|
|
|
423
423
|
{ token: "--sa-background-disable", recipe: "var(--sa-color-white-alpha-a5, #bdbdbd0d)", scale: "white" },
|
|
424
424
|
{ token: "--sa-background-overlay", recipe: "var(--sa-color-black-alpha-a45, #00000073)", scale: "black" },
|
|
425
425
|
{ token: "--sa-background-brand", recipe: "#3b6fe0", scale: null },
|
|
426
|
-
{ token: "--sa-background-brand-hover", recipe: "#
|
|
426
|
+
{ token: "--sa-background-brand-hover", recipe: "#3565d9", scale: null },
|
|
427
427
|
{ token: "--sa-background-brand-pressed", recipe: "#2f5ad2", scale: null },
|
|
428
428
|
{ token: "--sa-background-brand-disable", recipe: "var(--sa-color-brand-600, #04254f)", scale: "brand" },
|
|
429
429
|
{ token: "--sa-background-brand-subtle", recipe: "var(--sa-color-brand-400, #3366b7)", scale: "brand" },
|
|
@@ -477,12 +477,12 @@ const be = [
|
|
|
477
477
|
{ token: "--sa-border-primary", recipe: "var(--sa-color-white-alpha-a20, #ceced933)", scale: "white" },
|
|
478
478
|
{ token: "--sa-border-primary-inverse", recipe: "var(--sa-color-dark-400, #4b4d51)", scale: "dark" },
|
|
479
479
|
{ token: "--sa-border-subtle", recipe: "var(--sa-color-white-alpha-a10, #bdbdbd1a)", scale: "white" },
|
|
480
|
-
{ token: "--sa-border-bold", recipe: "var(--sa-color-
|
|
480
|
+
{ token: "--sa-border-bold", recipe: "var(--sa-color-gray-600, #7d818a)", scale: "gray" },
|
|
481
481
|
{ token: "--sa-border-disabled", recipe: "var(--sa-color-white-alpha-a5, #bdbdbd0d)", scale: "white" },
|
|
482
482
|
{ token: "--sa-border-focused", recipe: "var(--sa-color-brand-300, #668cc9)", scale: "brand" },
|
|
483
|
-
{ token: "--sa-border-input", recipe: "var(--sa-color-
|
|
484
|
-
{ token: "--sa-border-selected", recipe: "var(--sa-color-brand-
|
|
485
|
-
{ token: "--sa-border-brand", recipe: "var(--sa-color-brand-
|
|
483
|
+
{ token: "--sa-border-input", recipe: "var(--sa-color-gray-700, #6b6e76)", scale: "gray" },
|
|
484
|
+
{ token: "--sa-border-selected", recipe: "var(--sa-color-brand-300, #668cc9)", scale: "brand" },
|
|
485
|
+
{ token: "--sa-border-brand", recipe: "var(--sa-color-brand-300, #668cc9)", scale: "brand" },
|
|
486
486
|
{ token: "--sa-border-brand-disable", recipe: "var(--sa-color-brand-600, #04254f)", scale: "brand" },
|
|
487
487
|
{ token: "--sa-border-danger", recipe: "var(--sa-color-error-500, #ff4d6d)", scale: "error" },
|
|
488
488
|
{ token: "--sa-border-danger-subtle", recipe: "var(--sa-color-error-700, #a4133c)", scale: "error" },
|
|
@@ -512,43 +512,92 @@ const be = [
|
|
|
512
512
|
{ token: "--sa-icon-accent", recipe: "var(--sa-color-amber-400, #ffb63f)", scale: "amber" },
|
|
513
513
|
{ token: "--sa-border-accent", recipe: "var(--sa-color-amber-400, #ffb63f)", scale: "amber" }
|
|
514
514
|
];
|
|
515
|
-
function
|
|
515
|
+
function _e(e, r) {
|
|
516
516
|
const a = e.match(/var\(--sa-color-([a-z]+)-(\d+),\s*([^)]+)\)/);
|
|
517
517
|
if (!a)
|
|
518
518
|
return e;
|
|
519
519
|
const [, s, c, o] = a, n = r[s];
|
|
520
520
|
if (!n)
|
|
521
521
|
return o.trim();
|
|
522
|
-
const t = (n.length === 12 ?
|
|
522
|
+
const t = (n.length === 12 ? P : F).indexOf(c);
|
|
523
523
|
return t >= 0 ? n[t] : o.trim();
|
|
524
524
|
}
|
|
525
|
-
function
|
|
526
|
-
const a =
|
|
527
|
-
return
|
|
525
|
+
function Z(e, r) {
|
|
526
|
+
const a = w(e);
|
|
527
|
+
return N({ ...a, l: Math.min(0.98, Math.max(0.02, a.l + r)) });
|
|
528
|
+
}
|
|
529
|
+
function q(e, r, a = 4.5) {
|
|
530
|
+
if (X(e, r) >= a)
|
|
531
|
+
return e;
|
|
532
|
+
const s = w(e).l >= w(r).l ? 1 : -1;
|
|
533
|
+
for (const c of [s, -s])
|
|
534
|
+
for (let o = 1; o <= 96; o++) {
|
|
535
|
+
const n = Z(e, c * o * 0.01);
|
|
536
|
+
if (X(n, r) >= a)
|
|
537
|
+
return n;
|
|
538
|
+
}
|
|
539
|
+
return R(r);
|
|
528
540
|
}
|
|
529
|
-
function
|
|
530
|
-
const r = e.base, a =
|
|
541
|
+
function Re(e) {
|
|
542
|
+
const r = e.base, a = fe(r), s = w(r), c = N({
|
|
531
543
|
l: a ? 0.96 : 0.22,
|
|
532
544
|
c: Math.min(s.c * 0.5, 0.02),
|
|
533
545
|
h: s.h
|
|
534
|
-
}), o = a ? c : r, n = a ? r : c, d =
|
|
535
|
-
["error", "success", "info", "warning"].forEach((
|
|
536
|
-
const
|
|
537
|
-
|
|
546
|
+
}), o = a ? c : r, n = a ? r : c, d = ce(o, n, 12, s.h), t = ce(n, o, 12, s.h), b = H(e.brand, U.brand), v = { gray: d, dark: t, brand: b };
|
|
547
|
+
["error", "success", "info", "warning"].forEach((u) => {
|
|
548
|
+
const g = e[u];
|
|
549
|
+
g && (v[u] = H(g, U[u]));
|
|
538
550
|
});
|
|
539
|
-
const
|
|
540
|
-
for (const
|
|
541
|
-
|
|
542
|
-
const
|
|
543
|
-
|
|
544
|
-
const g = {
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
551
|
+
const k = a ? ke : ue, f = {};
|
|
552
|
+
for (const u of k)
|
|
553
|
+
u.token !== "--sa-text-on-brand" && (f[u.token] = _e(u.recipe, v));
|
|
554
|
+
const p = R(e.brand.toLowerCase()), m = q(e.brand.toLowerCase(), p), E = p === "#ffffff" ? -1 : 1;
|
|
555
|
+
f["--sa-background-brand"] = m, f["--sa-background-brand-hover"] = Z(m, E * 0.06), f["--sa-background-brand-pressed"] = Z(m, E * 0.12), f["--sa-text-on-brand"] = p;
|
|
556
|
+
const y = f["--sa-background-primary"], x = (u, g, i = 4.5) => {
|
|
557
|
+
f[u] && /^#[0-9a-f]{6}$/i.test(f[u]) && (f[u] = q(f[u], g, i));
|
|
558
|
+
};
|
|
559
|
+
for (const u of [
|
|
560
|
+
"--sa-text-primary",
|
|
561
|
+
"--sa-text-subtle",
|
|
562
|
+
"--sa-text-subtlest",
|
|
563
|
+
"--sa-text-hover",
|
|
564
|
+
"--sa-text-pressed",
|
|
565
|
+
"--sa-text-brand",
|
|
566
|
+
"--sa-text-brand-hover",
|
|
567
|
+
"--sa-text-brand-pressed",
|
|
568
|
+
"--sa-text-secondary",
|
|
569
|
+
"--sa-text-error",
|
|
570
|
+
"--sa-text-success",
|
|
571
|
+
"--sa-text-info",
|
|
572
|
+
"--sa-text-warning"
|
|
573
|
+
])
|
|
574
|
+
x(u, y);
|
|
575
|
+
for (const u of [
|
|
576
|
+
"--sa-border-input",
|
|
577
|
+
"--sa-border-bold",
|
|
578
|
+
"--sa-border-brand",
|
|
579
|
+
"--sa-border-selected",
|
|
580
|
+
"--sa-border-focused",
|
|
581
|
+
"--sa-border-danger",
|
|
582
|
+
"--sa-border-success",
|
|
583
|
+
"--sa-border-info",
|
|
584
|
+
"--sa-border-warning"
|
|
585
|
+
])
|
|
586
|
+
x(u, y, 3);
|
|
587
|
+
for (const u of ["--sa-background-neutral", "--sa-background-neutral-hover"])
|
|
588
|
+
x(u, f["--sa-text-primary"]);
|
|
589
|
+
if (f["--sa-text-on-accent"] = R("#f5a524"), a)
|
|
590
|
+
for (const u of ["error", "success", "info", "warning"])
|
|
591
|
+
for (const g of ["", "-hover", "-pressed"])
|
|
592
|
+
x(`--sa-background-${u}${g}`, f["--sa-text-primary-inverse"]);
|
|
593
|
+
const M = {};
|
|
594
|
+
for (const [u, g] of Object.entries(v))
|
|
595
|
+
(g.length === 12 ? P : F).forEach((l, h) => {
|
|
596
|
+
M[`--sa-color-${u}-${l}`] = g[h];
|
|
548
597
|
});
|
|
549
|
-
return { tokens: { ...
|
|
598
|
+
return { tokens: { ...M, ...f }, isDark: a, brand: b, gray: d };
|
|
550
599
|
}
|
|
551
|
-
const
|
|
600
|
+
const er = {
|
|
552
601
|
name: "starasia",
|
|
553
602
|
brand: "#1a4fa0",
|
|
554
603
|
neutral: "#7d818a",
|
|
@@ -558,46 +607,46 @@ const qe = {
|
|
|
558
607
|
warning: "#ed9f30",
|
|
559
608
|
radius: 8,
|
|
560
609
|
font: { body: "Inter" }
|
|
561
|
-
},
|
|
562
|
-
function
|
|
610
|
+
}, ne = '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"', De = 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace', S = (e) => Math.round(e * 10) / 10;
|
|
611
|
+
function B(e, r, a, s) {
|
|
563
612
|
s.forEach((c, o) => {
|
|
564
613
|
e[`--sa-color-${r}-${c}`] = a[o];
|
|
565
614
|
});
|
|
566
615
|
}
|
|
567
|
-
function
|
|
616
|
+
function Ne(e, r = {}) {
|
|
568
617
|
const a = r.as ?? "root";
|
|
569
618
|
if (a === "skin" && !r.name)
|
|
570
619
|
throw new Error('buildTheme: options.name wajib saat as:"skin"');
|
|
571
620
|
const s = a === "skin" ? `[data-skin="${r.name}"]` : r.selector ?? ":root";
|
|
572
621
|
if (e.base)
|
|
573
|
-
return
|
|
574
|
-
const c = r.darkPrimary ?? !0, o = {}, n = {}, d = { brand: [] }, t = /* @__PURE__ */ new Set(["brand"]), b =
|
|
575
|
-
if (d.brand = b,
|
|
576
|
-
const
|
|
577
|
-
if (!
|
|
622
|
+
return Oe(e, s);
|
|
623
|
+
const c = r.darkPrimary ?? !0, o = {}, n = {}, d = { brand: [] }, t = /* @__PURE__ */ new Set(["brand"]), b = H(e.brand, U.brand);
|
|
624
|
+
if (d.brand = b, B(o, "brand", b, F), o["--sa-text-on-brand"] = R(b[6]), ["error", "success", "info", "warning"].forEach((k) => {
|
|
625
|
+
const f = e[k];
|
|
626
|
+
if (!f)
|
|
578
627
|
return;
|
|
579
|
-
const
|
|
580
|
-
d[
|
|
628
|
+
const p = H(f, U[k]);
|
|
629
|
+
d[k] = p, B(o, k, p, F), t.add(k);
|
|
581
630
|
}), e.neutral) {
|
|
582
|
-
const
|
|
583
|
-
d.gray =
|
|
631
|
+
const k = oe(e.neutral, Ae), f = oe(e.neutral, Le);
|
|
632
|
+
d.gray = k, d.dark = f, B(o, "gray", k, P), B(o, "dark", f, P), t.add("gray"), t.add("dark");
|
|
584
633
|
}
|
|
585
|
-
if (
|
|
586
|
-
const f = b[4];
|
|
587
|
-
n["--sa-background-brand"] = f, n["--sa-background-brand-hover"] = b[3], n["--sa-background-brand-pressed"] = b[
|
|
634
|
+
if (pe(o, e), c) {
|
|
635
|
+
const k = R(b[4]), f = q(b[4], k), p = k === "#ffffff";
|
|
636
|
+
n["--sa-background-brand"] = f, n["--sa-background-brand-hover"] = p ? b[5] : b[3], n["--sa-background-brand-pressed"] = p ? b[6] : b[2], n["--sa-text-on-brand"] = k;
|
|
588
637
|
}
|
|
589
|
-
return { css: a === "skin" ?
|
|
638
|
+
return { css: a === "skin" ? Be(s, o, n, t) : Ie(s, o, n), rootTokens: o, darkTokens: n, ramps: d };
|
|
590
639
|
}
|
|
591
|
-
function
|
|
640
|
+
function pe(e, r) {
|
|
592
641
|
var a, s, c;
|
|
593
642
|
if (typeof r.radius == "number") {
|
|
594
643
|
const o = r.radius;
|
|
595
|
-
e["--sa-radii-xs"] = `${
|
|
644
|
+
e["--sa-radii-xs"] = `${S(o * 0.5)}px`, e["--sa-radii-sm"] = `${S(o * 0.75)}px`, e["--sa-radii-md"] = `${S(o)}px`, e["--sa-radii-lg"] = `${S(o * 1.5)}px`, e["--sa-radii-xl"] = `${S(o * 1.75)}px`, e["--sa-radii-2xl"] = `${S(o * 2)}px`, e["--sa-radii-rounded"] = `${S(o)}px`;
|
|
596
645
|
}
|
|
597
|
-
(a = r.font) != null && a.body && (e["--sa-font-family"] = `"${r.font.body}", ${
|
|
646
|
+
(a = r.font) != null && a.body && (e["--sa-font-family"] = `"${r.font.body}", ${ne}`), (s = r.font) != null && s.heading && (e["--sa-font-family-heading"] = `"${r.font.heading}", ${ne}`), (c = r.font) != null && c.mono && (e["--sa-font-family-mono"] = `"${r.font.mono}", ${De}`);
|
|
598
647
|
}
|
|
599
|
-
function
|
|
600
|
-
const { tokens: a, brand: s, gray: c, isDark: o } =
|
|
648
|
+
function Oe(e, r) {
|
|
649
|
+
const { tokens: a, brand: s, gray: c, isDark: o } = Re({
|
|
601
650
|
base: e.base,
|
|
602
651
|
brand: e.brand,
|
|
603
652
|
error: e.error,
|
|
@@ -605,46 +654,46 @@ function Ne(e, r) {
|
|
|
605
654
|
info: e.info,
|
|
606
655
|
warning: e.warning
|
|
607
656
|
});
|
|
608
|
-
|
|
657
|
+
pe(a, e);
|
|
609
658
|
const n = o ? "dark" : "light", d = `${r},
|
|
610
659
|
${r}[data-theme="dark"]`;
|
|
611
660
|
return {
|
|
612
661
|
// color-scheme → scrollbar & kontrol native browser ikut terang/gelap tema.
|
|
613
662
|
// Bukan token, jadi tidak masuk rootTokens.
|
|
614
|
-
css:
|
|
663
|
+
css: D(d, { ...a, "color-scheme": n }),
|
|
615
664
|
rootTokens: a,
|
|
616
665
|
darkTokens: {},
|
|
617
666
|
ramps: { brand: s, gray: c },
|
|
618
667
|
scheme: n
|
|
619
668
|
};
|
|
620
669
|
}
|
|
621
|
-
function
|
|
670
|
+
function D(e, r) {
|
|
622
671
|
const a = Object.entries(r).map(([s, c]) => ` ${s}: ${c};`);
|
|
623
672
|
return a.length ? `${e} {
|
|
624
673
|
${a.join(`
|
|
625
674
|
`)}
|
|
626
675
|
}` : "";
|
|
627
676
|
}
|
|
628
|
-
function
|
|
677
|
+
function Ie(e, r, a) {
|
|
629
678
|
const s = e === ":root" ? '[data-theme="dark"]' : `${e}[data-theme="dark"], ${e} [data-theme="dark"]`;
|
|
630
|
-
return [
|
|
679
|
+
return [D(e, r), D(s, a)].filter(Boolean).join(`
|
|
631
680
|
|
|
632
681
|
`);
|
|
633
682
|
}
|
|
634
|
-
function
|
|
683
|
+
function Be(e, r, a, s) {
|
|
635
684
|
const c = {};
|
|
636
|
-
for (const t of
|
|
685
|
+
for (const t of ue)
|
|
637
686
|
t.scale && s.has(t.scale) && t.token !== "--sa-text-on-brand" && (c[t.token] = t.recipe);
|
|
638
687
|
const o = { ...r, ...c }, n = {};
|
|
639
|
-
for (const t of
|
|
688
|
+
for (const t of ke)
|
|
640
689
|
(t.scale && s.has(t.scale) || t.token in o) && (n[t.token] = t.recipe);
|
|
641
690
|
const d = { ...n, ...a };
|
|
642
|
-
return [
|
|
691
|
+
return [D(e, o), D(`${e}[data-theme="dark"]`, d)].filter(Boolean).join(`
|
|
643
692
|
|
|
644
693
|
`);
|
|
645
694
|
}
|
|
646
|
-
const
|
|
647
|
-
function
|
|
695
|
+
const O = "sa-theme";
|
|
696
|
+
function j(e = O) {
|
|
648
697
|
try {
|
|
649
698
|
if (typeof localStorage > "u")
|
|
650
699
|
return null;
|
|
@@ -654,7 +703,7 @@ function B(e = N) {
|
|
|
654
703
|
return null;
|
|
655
704
|
}
|
|
656
705
|
}
|
|
657
|
-
function
|
|
706
|
+
function je(e, r = O) {
|
|
658
707
|
try {
|
|
659
708
|
if (typeof localStorage > "u")
|
|
660
709
|
return;
|
|
@@ -662,7 +711,7 @@ function Be(e, r = N) {
|
|
|
662
711
|
} catch {
|
|
663
712
|
}
|
|
664
713
|
}
|
|
665
|
-
function
|
|
714
|
+
function Te(e = O) {
|
|
666
715
|
try {
|
|
667
716
|
if (typeof localStorage > "u")
|
|
668
717
|
return;
|
|
@@ -670,7 +719,7 @@ function je(e = N) {
|
|
|
670
719
|
} catch {
|
|
671
720
|
}
|
|
672
721
|
}
|
|
673
|
-
function
|
|
722
|
+
function Fe(e) {
|
|
674
723
|
if (e === "system")
|
|
675
724
|
try {
|
|
676
725
|
return typeof window < "u" && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
@@ -679,22 +728,22 @@ function Te(e) {
|
|
|
679
728
|
}
|
|
680
729
|
return e;
|
|
681
730
|
}
|
|
682
|
-
function
|
|
731
|
+
function G(e) {
|
|
683
732
|
if (typeof document > "u")
|
|
684
733
|
return;
|
|
685
734
|
const r = document.documentElement;
|
|
686
|
-
|
|
735
|
+
Fe(e) === "dark" ? r.setAttribute("data-theme", "dark") : r.removeAttribute("data-theme");
|
|
687
736
|
}
|
|
688
|
-
function
|
|
737
|
+
function te(e) {
|
|
689
738
|
if (typeof document > "u")
|
|
690
739
|
return;
|
|
691
740
|
const r = document.documentElement;
|
|
692
741
|
e ? r.setAttribute("data-skin", e) : r.removeAttribute("data-skin");
|
|
693
742
|
}
|
|
694
|
-
function
|
|
743
|
+
function rr(e = O) {
|
|
695
744
|
return "(function(){try{var p=JSON.parse(localStorage.getItem(" + JSON.stringify(e) + ")||'{}');var d=document.documentElement;var m=p.mode==='system'?((window.matchMedia&&window.matchMedia('(prefers-color-scheme: dark)').matches)?'dark':'light'):p.mode;if(m==='dark')d.setAttribute('data-theme','dark');if(p.skin)d.setAttribute('data-skin',p.skin);}catch(e){}})();";
|
|
696
745
|
}
|
|
697
|
-
const
|
|
746
|
+
const Pe = {
|
|
698
747
|
raw: {
|
|
699
748
|
white: {
|
|
700
749
|
900: "255, 255, 255"
|
|
@@ -793,7 +842,7 @@ const Fe = {
|
|
|
793
842
|
tertiary: "230, 237, 246"
|
|
794
843
|
}
|
|
795
844
|
}
|
|
796
|
-
},
|
|
845
|
+
}, Ue = {
|
|
797
846
|
radii: {
|
|
798
847
|
none: "0",
|
|
799
848
|
xs: "0.25rem",
|
|
@@ -851,7 +900,7 @@ const Fe = {
|
|
|
851
900
|
inner: "inset 0 2px 4px 0 #0000000d",
|
|
852
901
|
card: "0px 4px 35px 0px #7090b040"
|
|
853
902
|
}
|
|
854
|
-
},
|
|
903
|
+
}, He = {
|
|
855
904
|
fontSizes: {
|
|
856
905
|
xs: "0.625rem",
|
|
857
906
|
sm: "0.75rem",
|
|
@@ -891,11 +940,11 @@ const Fe = {
|
|
|
891
940
|
relaxed: 1.625,
|
|
892
941
|
loose: 2
|
|
893
942
|
}
|
|
894
|
-
},
|
|
895
|
-
colors:
|
|
896
|
-
metrics:
|
|
897
|
-
font:
|
|
898
|
-
},
|
|
943
|
+
}, ge = {
|
|
944
|
+
colors: Pe,
|
|
945
|
+
metrics: Ue,
|
|
946
|
+
font: He
|
|
947
|
+
}, ee = me({
|
|
899
948
|
theme: void 0,
|
|
900
949
|
setTheme: () => {
|
|
901
950
|
},
|
|
@@ -908,20 +957,20 @@ const Fe = {
|
|
|
908
957
|
},
|
|
909
958
|
resetTheme: () => {
|
|
910
959
|
}
|
|
911
|
-
}),
|
|
912
|
-
function
|
|
960
|
+
}), Je = "sa-theme-style", W = "sa-theme-seed-style";
|
|
961
|
+
function Ye(e) {
|
|
913
962
|
const r = e.split(",").map((a) => Number(a.trim()));
|
|
914
963
|
return r.length !== 3 || r.some((a) => !Number.isFinite(a) || a < 0 || a > 255) ? null : "#" + r.map((a) => Math.round(a).toString(16).padStart(2, "0")).join("");
|
|
915
964
|
}
|
|
916
|
-
var
|
|
917
|
-
const
|
|
918
|
-
function
|
|
965
|
+
var ie, de;
|
|
966
|
+
const ze = ((de = (ie = ge.colors) == null ? void 0 : ie.raw) == null ? void 0 : de.blue) ?? {}, le = (e) => (e ?? "").replace(/\s+/g, "");
|
|
967
|
+
function Ge(e) {
|
|
919
968
|
if (!e)
|
|
920
969
|
return "";
|
|
921
970
|
const r = /* @__PURE__ */ new Set(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]), a = Object.entries(e).filter(([s]) => r.has(s)).filter(
|
|
922
|
-
([s, c]) =>
|
|
971
|
+
([s, c]) => le(c) !== le(ze[s])
|
|
923
972
|
).map(([s, c]) => {
|
|
924
|
-
const o =
|
|
973
|
+
const o = Ye(c);
|
|
925
974
|
return o ? ` --sa-color-brand-${s}: ${o};` : "";
|
|
926
975
|
}).filter(Boolean).join(`
|
|
927
976
|
`);
|
|
@@ -929,11 +978,11 @@ function ze(e) {
|
|
|
929
978
|
${a}
|
|
930
979
|
}` : "";
|
|
931
980
|
}
|
|
932
|
-
function
|
|
981
|
+
function ar({
|
|
933
982
|
value: e,
|
|
934
983
|
seed: r,
|
|
935
984
|
persist: a = !0,
|
|
936
|
-
storageKey: s =
|
|
985
|
+
storageKey: s = O,
|
|
937
986
|
manageAttributes: c = !1,
|
|
938
987
|
children: o
|
|
939
988
|
}) {
|
|
@@ -941,110 +990,110 @@ function rr({
|
|
|
941
990
|
if (t)
|
|
942
991
|
return r;
|
|
943
992
|
if (a) {
|
|
944
|
-
const i =
|
|
993
|
+
const i = j(s);
|
|
945
994
|
if (i != null && i.seed)
|
|
946
995
|
return i.seed;
|
|
947
996
|
}
|
|
948
997
|
return null;
|
|
949
|
-
}),
|
|
950
|
-
() =>
|
|
951
|
-
[
|
|
998
|
+
}), k = t ? r : b, f = Q(
|
|
999
|
+
() => k ? JSON.stringify(k) : "",
|
|
1000
|
+
[k]
|
|
952
1001
|
);
|
|
953
|
-
|
|
1002
|
+
I(() => {
|
|
954
1003
|
if (typeof document > "u")
|
|
955
1004
|
return;
|
|
956
|
-
if (!
|
|
957
|
-
const l = document.getElementById(
|
|
1005
|
+
if (!f) {
|
|
1006
|
+
const l = document.getElementById(W);
|
|
958
1007
|
l && (l.textContent = "");
|
|
959
1008
|
return;
|
|
960
1009
|
}
|
|
961
|
-
const { css: i } =
|
|
962
|
-
|
|
963
|
-
}, [
|
|
1010
|
+
const { css: i } = Ne(JSON.parse(f));
|
|
1011
|
+
he(i, W);
|
|
1012
|
+
}, [f]), I(() => {
|
|
964
1013
|
var l;
|
|
965
1014
|
if (!c || !a)
|
|
966
1015
|
return;
|
|
967
|
-
const i =
|
|
968
|
-
if (i && (i.mode &&
|
|
969
|
-
const h = window.matchMedia("(prefers-color-scheme: dark)"), L = () =>
|
|
1016
|
+
const i = j(s);
|
|
1017
|
+
if (i && (i.mode && G(i.mode), i.skin !== void 0 && te(i.skin), i.mode === "system" && typeof window < "u")) {
|
|
1018
|
+
const h = window.matchMedia("(prefers-color-scheme: dark)"), L = () => G("system");
|
|
970
1019
|
return (l = h.addEventListener) == null || l.call(h, "change", L), () => {
|
|
971
|
-
var
|
|
972
|
-
return (
|
|
1020
|
+
var re;
|
|
1021
|
+
return (re = h.removeEventListener) == null ? void 0 : re.call(h, "change", L);
|
|
973
1022
|
};
|
|
974
1023
|
}
|
|
975
1024
|
}, [c, a, s]);
|
|
976
|
-
const
|
|
1025
|
+
const p = Q(
|
|
977
1026
|
() => n ? JSON.stringify(n) : "",
|
|
978
1027
|
[n]
|
|
979
|
-
), m =
|
|
980
|
-
|
|
1028
|
+
), m = ye(null);
|
|
1029
|
+
I(() => {
|
|
981
1030
|
var h, L;
|
|
982
|
-
m.current || (m.current =
|
|
1031
|
+
m.current || (m.current = we(Je));
|
|
983
1032
|
const i = m.current;
|
|
984
1033
|
if (!i)
|
|
985
1034
|
return;
|
|
986
|
-
const l =
|
|
987
|
-
i.textContent = l ?
|
|
988
|
-
}, [
|
|
1035
|
+
const l = p ? JSON.parse(p) : void 0;
|
|
1036
|
+
i.textContent = l ? Ge((L = (h = l == null ? void 0 : l.colors) == null ? void 0 : h.raw) == null ? void 0 : L.blue) : "";
|
|
1037
|
+
}, [p]), I(() => () => {
|
|
989
1038
|
m.current && (m.current.textContent = "");
|
|
990
1039
|
}, []);
|
|
991
|
-
const
|
|
1040
|
+
const E = (i) => {
|
|
992
1041
|
i && d(i);
|
|
993
|
-
},
|
|
1042
|
+
}, y = $(
|
|
994
1043
|
(i) => {
|
|
995
1044
|
if (!a)
|
|
996
1045
|
return;
|
|
997
|
-
const l =
|
|
998
|
-
|
|
1046
|
+
const l = j(s) || {};
|
|
1047
|
+
je({ ...l, ...i }, s);
|
|
999
1048
|
},
|
|
1000
1049
|
[a, s]
|
|
1001
|
-
),
|
|
1050
|
+
), x = $(
|
|
1002
1051
|
(i) => {
|
|
1003
|
-
t || (v(i),
|
|
1052
|
+
t || (v(i), y({ seed: i }));
|
|
1004
1053
|
},
|
|
1005
|
-
[t,
|
|
1006
|
-
),
|
|
1054
|
+
[t, y]
|
|
1055
|
+
), M = $(
|
|
1007
1056
|
(i) => {
|
|
1008
|
-
|
|
1057
|
+
G(i), y({ mode: i });
|
|
1009
1058
|
},
|
|
1010
|
-
[
|
|
1011
|
-
),
|
|
1059
|
+
[y]
|
|
1060
|
+
), u = $(
|
|
1012
1061
|
(i) => {
|
|
1013
|
-
|
|
1062
|
+
te(i), y({ skin: i });
|
|
1014
1063
|
},
|
|
1015
|
-
[
|
|
1016
|
-
),
|
|
1017
|
-
if (t || v(null),
|
|
1018
|
-
const i = document.getElementById(
|
|
1064
|
+
[y]
|
|
1065
|
+
), g = $(() => {
|
|
1066
|
+
if (t || v(null), Te(s), typeof document < "u") {
|
|
1067
|
+
const i = document.getElementById(W);
|
|
1019
1068
|
i && (i.textContent = "");
|
|
1020
1069
|
}
|
|
1021
1070
|
}, [t, s]);
|
|
1022
|
-
return /* @__PURE__ */
|
|
1023
|
-
|
|
1071
|
+
return /* @__PURE__ */ C(
|
|
1072
|
+
ee.Provider,
|
|
1024
1073
|
{
|
|
1025
1074
|
value: {
|
|
1026
1075
|
theme: n,
|
|
1027
|
-
setTheme:
|
|
1028
|
-
seed:
|
|
1029
|
-
setSeed:
|
|
1030
|
-
setMode:
|
|
1031
|
-
setSkin:
|
|
1032
|
-
resetTheme:
|
|
1076
|
+
setTheme: E,
|
|
1077
|
+
seed: k,
|
|
1078
|
+
setSeed: x,
|
|
1079
|
+
setMode: M,
|
|
1080
|
+
setSkin: u,
|
|
1081
|
+
resetTheme: g
|
|
1033
1082
|
},
|
|
1034
1083
|
children: o
|
|
1035
1084
|
}
|
|
1036
1085
|
);
|
|
1037
1086
|
}
|
|
1038
|
-
const
|
|
1087
|
+
const We = [
|
|
1039
1088
|
{ name: null, label: "Default" },
|
|
1040
1089
|
{ name: "tech", label: "Tech" }
|
|
1041
|
-
],
|
|
1090
|
+
], Ke = [
|
|
1042
1091
|
{ value: "light", label: "Light" },
|
|
1043
1092
|
{ value: "dark", label: "Dark" },
|
|
1044
1093
|
{ value: "system", label: "System" }
|
|
1045
1094
|
];
|
|
1046
|
-
function
|
|
1047
|
-
skins: e =
|
|
1095
|
+
function sr({
|
|
1096
|
+
skins: e = We,
|
|
1048
1097
|
showMode: r = !0,
|
|
1049
1098
|
allowCustom: a = !1,
|
|
1050
1099
|
storageKey: s,
|
|
@@ -1052,23 +1101,23 @@ function ar({
|
|
|
1052
1101
|
style: o
|
|
1053
1102
|
}) {
|
|
1054
1103
|
var i;
|
|
1055
|
-
const { setMode: n, setSkin: d, setSeed: t } =
|
|
1104
|
+
const { setMode: n, setSkin: d, setSeed: t } = be(ee), b = typeof window < "u" ? j(s) : null, [v, k] = _(
|
|
1056
1105
|
(b == null ? void 0 : b.mode) ?? (typeof document < "u" && document.documentElement.getAttribute("data-theme") === "dark" ? "dark" : "light")
|
|
1057
|
-
), [
|
|
1106
|
+
), [f, p] = _(
|
|
1058
1107
|
(b == null ? void 0 : b.skin) ?? (typeof document < "u" ? document.documentElement.getAttribute("data-skin") : null)
|
|
1059
|
-
), [m,
|
|
1060
|
-
|
|
1061
|
-
},
|
|
1062
|
-
|
|
1063
|
-
},
|
|
1064
|
-
|
|
1065
|
-
},
|
|
1108
|
+
), [m, E] = _(((i = b == null ? void 0 : b.seed) == null ? void 0 : i.brand) ?? "#1a4fa0"), y = (l) => {
|
|
1109
|
+
k(l), n(l);
|
|
1110
|
+
}, x = (l) => {
|
|
1111
|
+
p(l), d(l);
|
|
1112
|
+
}, M = (l) => {
|
|
1113
|
+
E(l), t({ brand: l });
|
|
1114
|
+
}, u = {
|
|
1066
1115
|
display: "inline-flex",
|
|
1067
1116
|
gap: 4,
|
|
1068
1117
|
padding: 4,
|
|
1069
1118
|
borderRadius: "var(--sa-radii-md)",
|
|
1070
1119
|
background: "var(--sa-background-neutral)"
|
|
1071
|
-
},
|
|
1120
|
+
}, g = (l) => ({
|
|
1072
1121
|
border: "none",
|
|
1073
1122
|
cursor: "pointer",
|
|
1074
1123
|
fontSize: 12,
|
|
@@ -1079,35 +1128,35 @@ function ar({
|
|
|
1079
1128
|
color: l ? "var(--sa-text-primary)" : "var(--sa-text-subtle)",
|
|
1080
1129
|
boxShadow: l ? "var(--sa-shadow-sm)" : "none"
|
|
1081
1130
|
});
|
|
1082
|
-
return /* @__PURE__ */
|
|
1131
|
+
return /* @__PURE__ */ ae(
|
|
1083
1132
|
"div",
|
|
1084
1133
|
{
|
|
1085
1134
|
className: c,
|
|
1086
1135
|
style: { display: "flex", gap: 12, flexWrap: "wrap", alignItems: "center", ...o },
|
|
1087
1136
|
children: [
|
|
1088
|
-
r && /* @__PURE__ */
|
|
1137
|
+
r && /* @__PURE__ */ C("div", { role: "group", "aria-label": "Mode", style: u, children: Ke.map((l) => /* @__PURE__ */ C(
|
|
1089
1138
|
"button",
|
|
1090
1139
|
{
|
|
1091
1140
|
type: "button",
|
|
1092
1141
|
"aria-pressed": v === l.value,
|
|
1093
|
-
style:
|
|
1094
|
-
onClick: () =>
|
|
1142
|
+
style: g(v === l.value),
|
|
1143
|
+
onClick: () => y(l.value),
|
|
1095
1144
|
children: l.label
|
|
1096
1145
|
},
|
|
1097
1146
|
l.value
|
|
1098
1147
|
)) }),
|
|
1099
|
-
e.length > 0 && /* @__PURE__ */
|
|
1148
|
+
e.length > 0 && /* @__PURE__ */ C("div", { role: "group", "aria-label": "Skin", style: u, children: e.map((l) => /* @__PURE__ */ C(
|
|
1100
1149
|
"button",
|
|
1101
1150
|
{
|
|
1102
1151
|
type: "button",
|
|
1103
|
-
"aria-pressed":
|
|
1104
|
-
style:
|
|
1105
|
-
onClick: () =>
|
|
1152
|
+
"aria-pressed": f === l.name,
|
|
1153
|
+
style: g(f === l.name),
|
|
1154
|
+
onClick: () => x(l.name),
|
|
1106
1155
|
children: l.label
|
|
1107
1156
|
},
|
|
1108
1157
|
l.name ?? "default"
|
|
1109
1158
|
)) }),
|
|
1110
|
-
a && /* @__PURE__ */
|
|
1159
|
+
a && /* @__PURE__ */ ae(
|
|
1111
1160
|
"label",
|
|
1112
1161
|
{
|
|
1113
1162
|
style: {
|
|
@@ -1119,12 +1168,12 @@ function ar({
|
|
|
1119
1168
|
},
|
|
1120
1169
|
children: [
|
|
1121
1170
|
"Brand",
|
|
1122
|
-
/* @__PURE__ */
|
|
1171
|
+
/* @__PURE__ */ C(
|
|
1123
1172
|
"input",
|
|
1124
1173
|
{
|
|
1125
1174
|
type: "color",
|
|
1126
1175
|
value: m,
|
|
1127
|
-
onChange: (l) =>
|
|
1176
|
+
onChange: (l) => M(l.target.value),
|
|
1128
1177
|
"aria-label": "Custom brand color",
|
|
1129
1178
|
style: {
|
|
1130
1179
|
width: 28,
|
|
@@ -1144,57 +1193,57 @@ function ar({
|
|
|
1144
1193
|
}
|
|
1145
1194
|
);
|
|
1146
1195
|
}
|
|
1147
|
-
const
|
|
1196
|
+
const K = ge, ve = (e, r) => {
|
|
1148
1197
|
const a = {};
|
|
1149
1198
|
return Object.keys(e).forEach((s) => {
|
|
1150
1199
|
if (e != null && e[s] && typeof (e == null ? void 0 : e[s]) == "object") {
|
|
1151
1200
|
a[s] = {
|
|
1152
1201
|
...e == null ? void 0 : e[s],
|
|
1153
1202
|
...r == null ? void 0 : r[s],
|
|
1154
|
-
...
|
|
1203
|
+
...ve(e == null ? void 0 : e[s], r == null ? void 0 : r[s])
|
|
1155
1204
|
};
|
|
1156
1205
|
return;
|
|
1157
1206
|
}
|
|
1158
1207
|
a[s] = (r == null ? void 0 : r[s]) || (e == null ? void 0 : e[s]);
|
|
1159
1208
|
}), a;
|
|
1160
1209
|
};
|
|
1161
|
-
function
|
|
1162
|
-
const e =
|
|
1210
|
+
function J() {
|
|
1211
|
+
const e = be(ee), r = Q(
|
|
1163
1212
|
() => ({
|
|
1164
|
-
...
|
|
1213
|
+
...K,
|
|
1165
1214
|
...e.theme,
|
|
1166
|
-
...
|
|
1215
|
+
...ve(K, e.theme)
|
|
1167
1216
|
}),
|
|
1168
|
-
[e.theme,
|
|
1217
|
+
[e.theme, K]
|
|
1169
1218
|
);
|
|
1170
1219
|
return { ...e, theme: r };
|
|
1171
1220
|
}
|
|
1172
|
-
function
|
|
1173
|
-
const { theme: e } =
|
|
1221
|
+
function or() {
|
|
1222
|
+
const { theme: e } = J();
|
|
1174
1223
|
return e.colors;
|
|
1175
1224
|
}
|
|
1176
|
-
function
|
|
1225
|
+
function cr() {
|
|
1177
1226
|
var r;
|
|
1178
|
-
const { theme: e } =
|
|
1227
|
+
const { theme: e } = J();
|
|
1179
1228
|
return (r = e.metrics) == null ? void 0 : r.spacing;
|
|
1180
1229
|
}
|
|
1181
|
-
function
|
|
1230
|
+
function nr() {
|
|
1182
1231
|
var r;
|
|
1183
|
-
const { theme: e } =
|
|
1232
|
+
const { theme: e } = J();
|
|
1184
1233
|
return (r = e.metrics) == null ? void 0 : r.radii;
|
|
1185
1234
|
}
|
|
1186
|
-
function
|
|
1235
|
+
function tr() {
|
|
1187
1236
|
var r;
|
|
1188
|
-
const { theme: e } =
|
|
1237
|
+
const { theme: e } = J();
|
|
1189
1238
|
return (r = e == null ? void 0 : e.metrics) == null ? void 0 : r.shadows;
|
|
1190
1239
|
}
|
|
1191
|
-
function
|
|
1240
|
+
function lr(e) {
|
|
1192
1241
|
return e;
|
|
1193
1242
|
}
|
|
1194
|
-
function
|
|
1195
|
-
return
|
|
1243
|
+
function Qe(e) {
|
|
1244
|
+
return fe(e) ? "dark" : "light";
|
|
1196
1245
|
}
|
|
1197
|
-
const
|
|
1246
|
+
const Ve = [
|
|
1198
1247
|
// terang
|
|
1199
1248
|
{ name: "light", base: "#ffffff", brand: "#2563eb" },
|
|
1200
1249
|
{ name: "cupcake", base: "#faf7f5", brand: "#65c3c8" },
|
|
@@ -1230,50 +1279,50 @@ const Qe = [
|
|
|
1230
1279
|
{ name: "sunset", base: "#1b2433", brand: "#ff865b" },
|
|
1231
1280
|
{ name: "black", base: "#000000", brand: "#6a6a6a" },
|
|
1232
1281
|
{ name: "abyss", base: "#001a1a", brand: "#18c9b4" }
|
|
1233
|
-
],
|
|
1282
|
+
], ir = Ve.map((e) => ({
|
|
1234
1283
|
name: e.name,
|
|
1235
1284
|
label: e.label ?? e.name.charAt(0).toUpperCase() + e.name.slice(1),
|
|
1236
1285
|
base: e.base,
|
|
1237
1286
|
brand: e.brand,
|
|
1238
|
-
scheme:
|
|
1287
|
+
scheme: Qe(e.base)
|
|
1239
1288
|
}));
|
|
1240
1289
|
export {
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1290
|
+
O as DEFAULT_STORAGE_KEY,
|
|
1291
|
+
U as LADDERS,
|
|
1292
|
+
Le as NEUTRAL_LADDER_DARK,
|
|
1293
|
+
Ae as NEUTRAL_LADDER_GRAY,
|
|
1294
|
+
er as SA_DEFAULT_SEED,
|
|
1295
|
+
F as SCALE_KEYS_10,
|
|
1296
|
+
P as SCALE_KEYS_12,
|
|
1297
|
+
ir as THEME_PRESETS,
|
|
1298
|
+
ee as ThemeContext,
|
|
1299
|
+
ar as ThemeProvider,
|
|
1300
|
+
sr as ThemeSwitcher,
|
|
1301
|
+
G as applyMode,
|
|
1302
|
+
te as applySkin,
|
|
1303
|
+
Ne as buildTheme,
|
|
1304
|
+
Te as clearPref,
|
|
1305
|
+
X as contrastRatio,
|
|
1306
|
+
lr as createTheme,
|
|
1307
|
+
Qe as getThemeScheme,
|
|
1308
|
+
w as hexToOklch,
|
|
1309
|
+
T as hexToRgb,
|
|
1310
|
+
fe as isDarkColor,
|
|
1311
|
+
oe as neutralRamp,
|
|
1312
|
+
N as oklchToHex,
|
|
1313
|
+
qe as pickByLightness,
|
|
1314
|
+
R as pickTextOn,
|
|
1315
|
+
ce as rampBetween,
|
|
1316
|
+
H as rampFromSeed,
|
|
1317
|
+
j as readPref,
|
|
1318
|
+
Fe as resolveMode,
|
|
1319
|
+
xe as rgbToHex,
|
|
1320
|
+
Me as rgbToOklch,
|
|
1321
|
+
rr as themeBootScript,
|
|
1322
|
+
or as useColor,
|
|
1323
|
+
nr as useRadius,
|
|
1324
|
+
tr as useShadow,
|
|
1325
|
+
cr as useSpacing,
|
|
1326
|
+
J as useTheme,
|
|
1327
|
+
je as writePref
|
|
1279
1328
|
};
|