tekivex-ui 2.2.0 → 2.5.1
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/TkxForm-BWK4LqY3.js +1461 -0
- package/dist/TkxForm-ljQjX7KD.cjs +15 -0
- package/dist/charts.cjs +1 -0
- package/dist/charts.js +480 -0
- package/dist/headless.cjs +1 -0
- package/dist/headless.js +258 -0
- package/dist/index-BINBzXuY.cjs +2 -0
- package/dist/index-eT_U4qB2.js +512 -0
- package/dist/index.cjs +63 -14
- package/dist/index.d.ts +33 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11396 -6336
- package/dist/src/charts/TkxAreaChart.d.ts +29 -0
- package/dist/src/charts/TkxAreaChart.d.ts.map +1 -0
- package/dist/src/charts/TkxBarChart.d.ts +28 -0
- package/dist/src/charts/TkxBarChart.d.ts.map +1 -0
- package/dist/src/charts/TkxDonutChart.d.ts +23 -0
- package/dist/src/charts/TkxDonutChart.d.ts.map +1 -0
- package/dist/src/charts/TkxLineChart.d.ts +35 -0
- package/dist/src/charts/TkxLineChart.d.ts.map +1 -0
- package/dist/src/charts/TkxPieChart.d.ts +19 -0
- package/dist/src/charts/TkxPieChart.d.ts.map +1 -0
- package/dist/src/charts/TkxRadarChart.d.ts +20 -0
- package/dist/src/charts/TkxRadarChart.d.ts.map +1 -0
- package/dist/src/charts/TkxScatterChart.d.ts +28 -0
- package/dist/src/charts/TkxScatterChart.d.ts.map +1 -0
- package/dist/src/charts/index.d.ts +15 -0
- package/dist/src/charts/index.d.ts.map +1 -0
- package/dist/src/charts/shared.d.ts +33 -0
- package/dist/src/charts/shared.d.ts.map +1 -0
- package/dist/src/components/TkxAffix.d.ts +10 -0
- package/dist/src/components/TkxAffix.d.ts.map +1 -0
- package/dist/src/components/TkxAnchor.d.ts +14 -0
- package/dist/src/components/TkxAnchor.d.ts.map +1 -0
- package/dist/src/components/TkxCascader.d.ts +16 -0
- package/dist/src/components/TkxCascader.d.ts.map +1 -0
- package/dist/src/components/TkxDataGrid.d.ts +19 -1
- package/dist/src/components/TkxDataGrid.d.ts.map +1 -1
- package/dist/src/components/TkxForm.d.ts +33 -3
- package/dist/src/components/TkxForm.d.ts.map +1 -1
- package/dist/src/components/TkxImage.d.ts.map +1 -1
- package/dist/src/components/TkxList.d.ts +24 -0
- package/dist/src/components/TkxList.d.ts.map +1 -0
- package/dist/src/components/TkxMentions.d.ts +15 -0
- package/dist/src/components/TkxMentions.d.ts.map +1 -0
- package/dist/src/components/TkxQRCode.d.ts +11 -0
- package/dist/src/components/TkxQRCode.d.ts.map +1 -0
- package/dist/src/components/TkxResult.d.ts +11 -0
- package/dist/src/components/TkxResult.d.ts.map +1 -0
- package/dist/src/components/TkxSegmented.d.ts +16 -0
- package/dist/src/components/TkxSegmented.d.ts.map +1 -0
- package/dist/src/components/TkxSelect.d.ts +5 -1
- package/dist/src/components/TkxSelect.d.ts.map +1 -1
- package/dist/src/components/TkxTour.d.ts +15 -0
- package/dist/src/components/TkxTour.d.ts.map +1 -0
- package/dist/src/components/TkxTypography.d.ts +1 -1
- package/dist/src/components/TkxTypography.d.ts.map +1 -1
- package/dist/src/components/TkxWatermark.d.ts +12 -0
- package/dist/src/components/TkxWatermark.d.ts.map +1 -0
- package/dist/src/components/index.d.ts +10 -0
- package/dist/src/components/index.d.ts.map +1 -1
- package/dist/src/engine/tkx.d.ts +38 -0
- package/dist/src/engine/tkx.d.ts.map +1 -1
- package/dist/src/headless/index.d.ts +18 -0
- package/dist/src/headless/index.d.ts.map +1 -0
- package/dist/src/headless/useControllable.d.ts +20 -0
- package/dist/src/headless/useControllable.d.ts.map +1 -0
- package/dist/src/headless/useDebounce.d.ts +14 -0
- package/dist/src/headless/useDebounce.d.ts.map +1 -0
- package/dist/src/headless/useDisclosure.d.ts +20 -0
- package/dist/src/headless/useDisclosure.d.ts.map +1 -0
- package/dist/src/headless/useFormState.d.ts +44 -0
- package/dist/src/headless/useFormState.d.ts.map +1 -0
- package/dist/src/headless/useIntersectionObserver.d.ts +23 -0
- package/dist/src/headless/useIntersectionObserver.d.ts.map +1 -0
- package/dist/src/headless/useListSelection.d.ts +29 -0
- package/dist/src/headless/useListSelection.d.ts.map +1 -0
- package/dist/src/headless/useLocalStorage.d.ts +9 -0
- package/dist/src/headless/useLocalStorage.d.ts.map +1 -0
- package/dist/src/headless/useMediaQuery.d.ts +21 -0
- package/dist/src/headless/useMediaQuery.d.ts.map +1 -0
- package/dist/src/headless/useRovingTabIndex.d.ts +33 -0
- package/dist/src/headless/useRovingTabIndex.d.ts.map +1 -0
- package/dist/src/headless/useThrottle.d.ts +9 -0
- package/dist/src/headless/useThrottle.d.ts.map +1 -0
- package/dist/src/i18n/index.d.ts +47 -2
- package/dist/src/i18n/index.d.ts.map +1 -1
- package/dist/src/themes/index.d.ts.map +1 -1
- package/package.json +61 -7
- package/src/charts/TkxAreaChart.tsx +119 -0
- package/src/charts/TkxBarChart.tsx +115 -0
- package/src/charts/TkxDonutChart.tsx +145 -0
- package/src/charts/TkxLineChart.tsx +135 -0
- package/src/charts/TkxPieChart.tsx +82 -0
- package/src/charts/TkxRadarChart.tsx +90 -0
- package/src/charts/TkxScatterChart.tsx +102 -0
- package/src/charts/index.ts +20 -0
- package/src/charts/shared.ts +45 -0
- package/src/components/TkxAffix.tsx +138 -0
- package/src/components/TkxAnchor.tsx +193 -0
- package/src/components/TkxCascader.tsx +276 -0
- package/src/components/TkxDataGrid.tsx +557 -230
- package/src/components/TkxForm.tsx +67 -15
- package/src/components/TkxImage.tsx +1 -1
- package/src/components/TkxList.tsx +242 -0
- package/src/components/TkxMentions.tsx +210 -0
- package/src/components/TkxQRCode.tsx +174 -0
- package/src/components/TkxResult.tsx +128 -0
- package/src/components/TkxSegmented.tsx +169 -0
- package/src/components/TkxSelect.tsx +209 -6
- package/src/components/TkxTour.tsx +239 -0
- package/src/components/TkxTypography.tsx +4 -2
- package/src/components/TkxWatermark.tsx +143 -0
- package/src/components/index.ts +10 -0
- package/src/engine/tkx.ts +122 -3
- package/src/headless/index.ts +44 -0
- package/src/headless/useControllable.ts +40 -0
- package/src/headless/useDebounce.ts +35 -0
- package/src/headless/useDisclosure.ts +28 -0
- package/src/headless/useFormState.ts +111 -0
- package/src/headless/useIntersectionObserver.ts +51 -0
- package/src/headless/useListSelection.ts +101 -0
- package/src/headless/useLocalStorage.ts +46 -0
- package/src/headless/useMediaQuery.ts +37 -0
- package/src/headless/useRovingTabIndex.ts +84 -0
- package/src/headless/useThrottle.ts +46 -0
- package/src/i18n/I18nProvider.tsx +1 -1
- package/src/i18n/index.ts +678 -38
- package/src/themes/index.ts +31 -4
|
@@ -0,0 +1,1461 @@
|
|
|
1
|
+
import { useRef as S, useEffect as U, useCallback as k, useState as nt, useMemo as X, cloneElement as wt, useContext as dt, createContext as yt } from "react";
|
|
2
|
+
import { n as Q, G as $t, i as kt, w as St, x as Ft, u as ut } from "./index-eT_U4qB2.js";
|
|
3
|
+
import { jsx as _, jsxs as L, Fragment as jt } from "react/jsx-runtime";
|
|
4
|
+
const Mt = {
|
|
5
|
+
"<": "<",
|
|
6
|
+
">": ">",
|
|
7
|
+
"&": "&",
|
|
8
|
+
"'": "'",
|
|
9
|
+
'"': """
|
|
10
|
+
};
|
|
11
|
+
function K(t) {
|
|
12
|
+
return String(t).replace(/[<>&'"]/g, (i) => Mt[i] ?? i);
|
|
13
|
+
}
|
|
14
|
+
function pt(t) {
|
|
15
|
+
const i = {};
|
|
16
|
+
for (const o of Object.keys(t))
|
|
17
|
+
i[o] = mt(t[o]);
|
|
18
|
+
return i;
|
|
19
|
+
}
|
|
20
|
+
function mt(t) {
|
|
21
|
+
return typeof t == "string" ? K(t) : Array.isArray(t) ? t.map(mt) : t !== null && typeof t == "object" && !zt(t) ? pt(t) : t;
|
|
22
|
+
}
|
|
23
|
+
function zt(t) {
|
|
24
|
+
return typeof t == "object" && t !== null && "$$typeof" in t;
|
|
25
|
+
}
|
|
26
|
+
function Et(t, i) {
|
|
27
|
+
const o = [];
|
|
28
|
+
for (const [s, a] of Object.entries(i)) {
|
|
29
|
+
const l = t[s], g = l == null;
|
|
30
|
+
if (a.required && g) {
|
|
31
|
+
o.push(`prop '${s}' is required`);
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
if (!g) {
|
|
35
|
+
if (typeof l !== a.type) {
|
|
36
|
+
o.push(`prop '${s}' must be of type ${a.type}, got ${typeof l}`);
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
a.type === "number" && typeof l == "number" && (a.min !== void 0 && l < a.min && o.push(`prop '${s}' must be >= ${a.min}`), a.max !== void 0 && l > a.max && o.push(`prop '${s}' must be <= ${a.max}`)), a.type === "string" && typeof l == "string" && a.pattern && !a.pattern.test(l) && o.push(`prop '${s}' does not match pattern ${a.pattern}`), a.enum && !a.enum.includes(l) && o.push(`prop '${s}' must be one of: ${a.enum.join(", ")}`);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return { valid: o.length === 0, errors: o };
|
|
43
|
+
}
|
|
44
|
+
const ht = /* @__PURE__ */ new Map();
|
|
45
|
+
function Rt(t, i) {
|
|
46
|
+
const o = {
|
|
47
|
+
"default-src": ["'self'"],
|
|
48
|
+
"style-src": i.allowInlineStyles ? ["'self'", "'unsafe-inline'"] : ["'self'"],
|
|
49
|
+
"img-src": i.allowDataUrls ? ["'self'", "data:"] : i.allowExternalSrc ? ["'self'", "*"] : ["'self'"],
|
|
50
|
+
"script-src": i.allowScripts ? ["'self'"] : ["'none'"]
|
|
51
|
+
}, s = { componentId: t, permissions: i, directives: o };
|
|
52
|
+
return ht.set(t, s), s;
|
|
53
|
+
}
|
|
54
|
+
function Tt(t, i) {
|
|
55
|
+
const o = ht.get(t);
|
|
56
|
+
return (o == null ? void 0 : o.permissions[i]) === !0;
|
|
57
|
+
}
|
|
58
|
+
let D = [];
|
|
59
|
+
function At(t, i, o) {
|
|
60
|
+
const s = Q(JSON.stringify(o ?? {})), a = D.length > 0 ? D[D.length - 1].chainHash : "00000000", l = Q(a + s + i + t), g = Object.freeze({
|
|
61
|
+
timestamp: Date.now(),
|
|
62
|
+
component: i,
|
|
63
|
+
action: t,
|
|
64
|
+
propsHash: s,
|
|
65
|
+
chainHash: l
|
|
66
|
+
});
|
|
67
|
+
return D = Object.freeze([...D, g]), g;
|
|
68
|
+
}
|
|
69
|
+
function Ct(t) {
|
|
70
|
+
let i = D;
|
|
71
|
+
return t != null && t.component && (i = i.filter((o) => o.component === t.component)), t != null && t.action && (i = i.filter((o) => o.action === t.action)), t != null && t.limit && (i = i.slice(-t.limit)), i;
|
|
72
|
+
}
|
|
73
|
+
function It() {
|
|
74
|
+
let t = "00000000";
|
|
75
|
+
for (const i of D) {
|
|
76
|
+
if (Q(t + i.propsHash + i.component + i.action) !== i.chainHash) return !1;
|
|
77
|
+
t = i.chainHash;
|
|
78
|
+
}
|
|
79
|
+
return !0;
|
|
80
|
+
}
|
|
81
|
+
const re = {
|
|
82
|
+
sanitize: K,
|
|
83
|
+
sanitizeProps: pt,
|
|
84
|
+
validateProps: Et,
|
|
85
|
+
createCSP: Rt,
|
|
86
|
+
hasPermission: Tt,
|
|
87
|
+
audit: At,
|
|
88
|
+
getAuditLog: Ct,
|
|
89
|
+
verifyAuditIntegrity: It
|
|
90
|
+
};
|
|
91
|
+
function ne() {
|
|
92
|
+
const [t, i] = nt(() => typeof window > "u" ? !1 : Ft());
|
|
93
|
+
return U(() => {
|
|
94
|
+
if (typeof window > "u") return;
|
|
95
|
+
const o = window.matchMedia("(prefers-reduced-motion: reduce)"), s = (a) => i(a.matches);
|
|
96
|
+
return o.addEventListener("change", s), () => o.removeEventListener("change", s);
|
|
97
|
+
}, []), t;
|
|
98
|
+
}
|
|
99
|
+
function ie() {
|
|
100
|
+
const [t, i] = nt(() => typeof window > "u" ? !1 : St());
|
|
101
|
+
return U(() => {
|
|
102
|
+
if (typeof window > "u") return;
|
|
103
|
+
const o = window.matchMedia("(forced-colors: active)"), s = (a) => i(a.matches);
|
|
104
|
+
return o.addEventListener("change", s), () => o.removeEventListener("change", s);
|
|
105
|
+
}, []), t;
|
|
106
|
+
}
|
|
107
|
+
function oe(t) {
|
|
108
|
+
const i = S(null);
|
|
109
|
+
return U(() => {
|
|
110
|
+
if (!t || !i.current) return;
|
|
111
|
+
const o = kt(i.current);
|
|
112
|
+
return o.activate(), () => o.deactivate();
|
|
113
|
+
}, [t]), i;
|
|
114
|
+
}
|
|
115
|
+
function se() {
|
|
116
|
+
const t = S(null);
|
|
117
|
+
return U(() => {
|
|
118
|
+
if (!(typeof document > "u"))
|
|
119
|
+
return t.current = $t(), () => {
|
|
120
|
+
var i;
|
|
121
|
+
(i = t.current) == null || i.destroy();
|
|
122
|
+
};
|
|
123
|
+
}, []), k((i, o = "polite") => {
|
|
124
|
+
var s;
|
|
125
|
+
(s = t.current) == null || s.announce(i, o);
|
|
126
|
+
}, []);
|
|
127
|
+
}
|
|
128
|
+
function ae(t, i = !0) {
|
|
129
|
+
const o = S(t);
|
|
130
|
+
o.current = t, U(() => {
|
|
131
|
+
if (!i || typeof document > "u") return;
|
|
132
|
+
const s = (a) => {
|
|
133
|
+
a.key === "Escape" && o.current();
|
|
134
|
+
};
|
|
135
|
+
return document.addEventListener("keydown", s), () => document.removeEventListener("keydown", s);
|
|
136
|
+
}, [i]);
|
|
137
|
+
}
|
|
138
|
+
function ce(t, i) {
|
|
139
|
+
const o = S(i);
|
|
140
|
+
o.current = i, U(() => {
|
|
141
|
+
const s = (a) => {
|
|
142
|
+
!t.current || t.current.contains(a.target) || o.current();
|
|
143
|
+
};
|
|
144
|
+
return document.addEventListener("pointerdown", s), () => document.removeEventListener("pointerdown", s);
|
|
145
|
+
}, [t]);
|
|
146
|
+
}
|
|
147
|
+
const d = {
|
|
148
|
+
0: "0",
|
|
149
|
+
px: "1px",
|
|
150
|
+
"0.5": "2px",
|
|
151
|
+
1: "4px",
|
|
152
|
+
"1.5": "6px",
|
|
153
|
+
2: "8px",
|
|
154
|
+
"2.5": "10px",
|
|
155
|
+
3: "12px",
|
|
156
|
+
"3.5": "14px",
|
|
157
|
+
4: "16px",
|
|
158
|
+
5: "20px",
|
|
159
|
+
6: "24px",
|
|
160
|
+
7: "28px",
|
|
161
|
+
8: "32px",
|
|
162
|
+
9: "36px",
|
|
163
|
+
10: "40px",
|
|
164
|
+
11: "44px",
|
|
165
|
+
12: "48px",
|
|
166
|
+
14: "56px",
|
|
167
|
+
16: "64px",
|
|
168
|
+
20: "80px",
|
|
169
|
+
24: "96px",
|
|
170
|
+
28: "112px",
|
|
171
|
+
32: "128px",
|
|
172
|
+
36: "144px",
|
|
173
|
+
40: "160px",
|
|
174
|
+
44: "176px",
|
|
175
|
+
48: "192px",
|
|
176
|
+
52: "208px",
|
|
177
|
+
56: "224px",
|
|
178
|
+
60: "240px",
|
|
179
|
+
64: "256px",
|
|
180
|
+
72: "288px",
|
|
181
|
+
80: "320px",
|
|
182
|
+
96: "384px",
|
|
183
|
+
auto: "auto",
|
|
184
|
+
full: "100%",
|
|
185
|
+
screen: "100vw",
|
|
186
|
+
svh: "100svh",
|
|
187
|
+
dvh: "100dvh",
|
|
188
|
+
fit: "fit-content",
|
|
189
|
+
max: "max-content",
|
|
190
|
+
min: "min-content"
|
|
191
|
+
}, ot = { ...d, screen: "100vh" }, A = {
|
|
192
|
+
"1/2": "50%",
|
|
193
|
+
"1/3": "33.333333%",
|
|
194
|
+
"2/3": "66.666667%",
|
|
195
|
+
"1/4": "25%",
|
|
196
|
+
"2/4": "50%",
|
|
197
|
+
"3/4": "75%",
|
|
198
|
+
"1/5": "20%",
|
|
199
|
+
"2/5": "40%",
|
|
200
|
+
"3/5": "60%",
|
|
201
|
+
"4/5": "80%",
|
|
202
|
+
"1/6": "16.666667%",
|
|
203
|
+
"5/6": "83.333333%",
|
|
204
|
+
"1/12": "8.333333%",
|
|
205
|
+
"5/12": "41.666667%",
|
|
206
|
+
"7/12": "58.333333%",
|
|
207
|
+
"11/12": "91.666667%"
|
|
208
|
+
}, Z = {
|
|
209
|
+
none: "0",
|
|
210
|
+
sm: "2px",
|
|
211
|
+
"": "4px",
|
|
212
|
+
md: "6px",
|
|
213
|
+
lg: "8px",
|
|
214
|
+
xl: "12px",
|
|
215
|
+
"2xl": "16px",
|
|
216
|
+
"3xl": "24px",
|
|
217
|
+
full: "9999px"
|
|
218
|
+
}, st = {
|
|
219
|
+
sm: "0 1px 2px 0 rgba(0,0,0,.05)",
|
|
220
|
+
"": "0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1)",
|
|
221
|
+
md: "0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1)",
|
|
222
|
+
lg: "0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1)",
|
|
223
|
+
xl: "0 20px 25px -5px rgba(0,0,0,.1),0 8px 10px -6px rgba(0,0,0,.1)",
|
|
224
|
+
"2xl": "0 25px 50px -12px rgba(0,0,0,.25)",
|
|
225
|
+
inner: "inset 0 2px 4px 0 rgba(0,0,0,.05)",
|
|
226
|
+
none: "none"
|
|
227
|
+
}, Wt = {
|
|
228
|
+
xs: ["0.75rem", "1rem"],
|
|
229
|
+
sm: ["0.875rem", "1.25rem"],
|
|
230
|
+
base: ["1rem", "1.5rem"],
|
|
231
|
+
lg: ["1.125rem", "1.75rem"],
|
|
232
|
+
xl: ["1.25rem", "1.75rem"],
|
|
233
|
+
"2xl": ["1.5rem", "2rem"],
|
|
234
|
+
"3xl": ["1.875rem", "2.25rem"],
|
|
235
|
+
"4xl": ["2.25rem", "2.5rem"],
|
|
236
|
+
"5xl": ["3rem", "1"],
|
|
237
|
+
"6xl": ["3.75rem", "1"],
|
|
238
|
+
"7xl": ["4.5rem", "1"],
|
|
239
|
+
"8xl": ["6rem", "1"],
|
|
240
|
+
"9xl": ["8rem", "1"]
|
|
241
|
+
}, Ht = {
|
|
242
|
+
thin: "100",
|
|
243
|
+
extralight: "200",
|
|
244
|
+
light: "300",
|
|
245
|
+
normal: "400",
|
|
246
|
+
medium: "500",
|
|
247
|
+
semibold: "600",
|
|
248
|
+
bold: "700",
|
|
249
|
+
extrabold: "800",
|
|
250
|
+
black: "900"
|
|
251
|
+
}, Nt = {
|
|
252
|
+
none: "1",
|
|
253
|
+
tight: "1.25",
|
|
254
|
+
snug: "1.375",
|
|
255
|
+
normal: "1.5",
|
|
256
|
+
relaxed: "1.625",
|
|
257
|
+
loose: "2",
|
|
258
|
+
3: "0.75rem",
|
|
259
|
+
4: "1rem",
|
|
260
|
+
5: "1.25rem",
|
|
261
|
+
6: "1.5rem",
|
|
262
|
+
7: "1.75rem",
|
|
263
|
+
8: "2rem",
|
|
264
|
+
9: "2.25rem",
|
|
265
|
+
10: "2.5rem"
|
|
266
|
+
}, Ot = {
|
|
267
|
+
tighter: "-0.05em",
|
|
268
|
+
tight: "-0.025em",
|
|
269
|
+
normal: "0em",
|
|
270
|
+
wide: "0.025em",
|
|
271
|
+
wider: "0.05em",
|
|
272
|
+
widest: "0.1em"
|
|
273
|
+
}, J = {
|
|
274
|
+
none: "0",
|
|
275
|
+
sm: "4px",
|
|
276
|
+
"": "8px",
|
|
277
|
+
md: "12px",
|
|
278
|
+
lg: "16px",
|
|
279
|
+
xl: "24px",
|
|
280
|
+
"2xl": "40px",
|
|
281
|
+
"3xl": "64px"
|
|
282
|
+
}, qt = Object.fromEntries(
|
|
283
|
+
[0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100].map((t) => [String(t), String(t / 100)])
|
|
284
|
+
), xt = /* @__PURE__ */ new Set([
|
|
285
|
+
"bg",
|
|
286
|
+
"surface",
|
|
287
|
+
"surfaceAlt",
|
|
288
|
+
"border",
|
|
289
|
+
"text",
|
|
290
|
+
"textMuted",
|
|
291
|
+
"primary",
|
|
292
|
+
"secondary",
|
|
293
|
+
"danger",
|
|
294
|
+
"warning",
|
|
295
|
+
"success",
|
|
296
|
+
"info"
|
|
297
|
+
]), Pt = {
|
|
298
|
+
sm: "640px",
|
|
299
|
+
md: "768px",
|
|
300
|
+
lg: "1024px",
|
|
301
|
+
xl: "1280px",
|
|
302
|
+
"2xl": "1536px"
|
|
303
|
+
};
|
|
304
|
+
function c(t) {
|
|
305
|
+
const i = t.match(/^\[(.+)]$/);
|
|
306
|
+
return i ? i[1] : null;
|
|
307
|
+
}
|
|
308
|
+
function z(t) {
|
|
309
|
+
if (xt.has(t)) return `var(--tkx-${t})`;
|
|
310
|
+
if (t === "transparent") return "transparent";
|
|
311
|
+
if (t === "current") return "currentColor";
|
|
312
|
+
if (t === "white") return "#ffffff";
|
|
313
|
+
if (t === "black") return "#000000";
|
|
314
|
+
if (t === "inherit") return "inherit";
|
|
315
|
+
const i = c(t);
|
|
316
|
+
return i || t;
|
|
317
|
+
}
|
|
318
|
+
function Lt(t) {
|
|
319
|
+
const i = t.match(/^\[([a-zA-Z-]+):(.+)]$/);
|
|
320
|
+
if (i) return { [i[1]]: i[2] };
|
|
321
|
+
const o = {
|
|
322
|
+
flex: "flex",
|
|
323
|
+
"inline-flex": "inline-flex",
|
|
324
|
+
grid: "grid",
|
|
325
|
+
"inline-grid": "inline-grid",
|
|
326
|
+
block: "block",
|
|
327
|
+
"inline-block": "inline-block",
|
|
328
|
+
inline: "inline",
|
|
329
|
+
hidden: "none",
|
|
330
|
+
contents: "contents",
|
|
331
|
+
"flow-root": "flow-root",
|
|
332
|
+
table: "table",
|
|
333
|
+
"table-row": "table-row",
|
|
334
|
+
"table-cell": "table-cell",
|
|
335
|
+
"table-caption": "table-caption",
|
|
336
|
+
"list-item": "list-item"
|
|
337
|
+
};
|
|
338
|
+
if (o[t]) return { display: o[t] };
|
|
339
|
+
const s = {
|
|
340
|
+
"flex-row": "row",
|
|
341
|
+
"flex-col": "column",
|
|
342
|
+
"flex-row-reverse": "row-reverse",
|
|
343
|
+
"flex-col-reverse": "column-reverse"
|
|
344
|
+
};
|
|
345
|
+
if (s[t]) return { "flex-direction": s[t] };
|
|
346
|
+
const a = {
|
|
347
|
+
"flex-wrap": "wrap",
|
|
348
|
+
"flex-nowrap": "nowrap",
|
|
349
|
+
"flex-wrap-reverse": "wrap-reverse"
|
|
350
|
+
};
|
|
351
|
+
if (a[t]) return { "flex-wrap": a[t] };
|
|
352
|
+
const l = {
|
|
353
|
+
"flex-1": "1 1 0%",
|
|
354
|
+
"flex-auto": "1 1 auto",
|
|
355
|
+
"flex-none": "none",
|
|
356
|
+
"flex-initial": "0 1 auto"
|
|
357
|
+
};
|
|
358
|
+
if (l[t]) return { flex: l[t] };
|
|
359
|
+
if (t === "grow" || t === "flex-grow") return { "flex-grow": "1" };
|
|
360
|
+
if (t === "grow-0") return { "flex-grow": "0" };
|
|
361
|
+
if (t === "shrink" || t === "flex-shrink") return { "flex-shrink": "1" };
|
|
362
|
+
if (t === "shrink-0" || t === "flex-shrink-0") return { "flex-shrink": "0" };
|
|
363
|
+
const g = {
|
|
364
|
+
"items-start": "flex-start",
|
|
365
|
+
"items-end": "flex-end",
|
|
366
|
+
"items-center": "center",
|
|
367
|
+
"items-stretch": "stretch",
|
|
368
|
+
"items-baseline": "baseline"
|
|
369
|
+
};
|
|
370
|
+
if (g[t]) return { "align-items": g[t] };
|
|
371
|
+
const h = {
|
|
372
|
+
"justify-start": "flex-start",
|
|
373
|
+
"justify-end": "flex-end",
|
|
374
|
+
"justify-center": "center",
|
|
375
|
+
"justify-between": "space-between",
|
|
376
|
+
"justify-around": "space-around",
|
|
377
|
+
"justify-evenly": "space-evenly",
|
|
378
|
+
"justify-stretch": "stretch",
|
|
379
|
+
"justify-normal": "normal"
|
|
380
|
+
};
|
|
381
|
+
if (h[t]) return { "justify-content": h[t] };
|
|
382
|
+
const u = {
|
|
383
|
+
"self-auto": "auto",
|
|
384
|
+
"self-start": "flex-start",
|
|
385
|
+
"self-end": "flex-end",
|
|
386
|
+
"self-center": "center",
|
|
387
|
+
"self-stretch": "stretch",
|
|
388
|
+
"self-baseline": "baseline"
|
|
389
|
+
};
|
|
390
|
+
if (u[t]) return { "align-self": u[t] };
|
|
391
|
+
const m = {
|
|
392
|
+
"content-start": "flex-start",
|
|
393
|
+
"content-end": "flex-end",
|
|
394
|
+
"content-center": "center",
|
|
395
|
+
"content-between": "space-between",
|
|
396
|
+
"content-around": "space-around",
|
|
397
|
+
"content-evenly": "space-evenly",
|
|
398
|
+
"content-stretch": "stretch"
|
|
399
|
+
};
|
|
400
|
+
if (m[t]) return { "align-content": m[t] };
|
|
401
|
+
let e;
|
|
402
|
+
if (e = t.match(/^grid-cols-(\d+|none|subgrid)$/))
|
|
403
|
+
return { "grid-template-columns": e[1] === "none" ? "none" : e[1] === "subgrid" ? "subgrid" : `repeat(${e[1]},minmax(0,1fr))` };
|
|
404
|
+
if (e = t.match(/^grid-rows-(\d+|none|subgrid)$/))
|
|
405
|
+
return { "grid-template-rows": e[1] === "none" ? "none" : e[1] === "subgrid" ? "subgrid" : `repeat(${e[1]},minmax(0,1fr))` };
|
|
406
|
+
if (e = t.match(/^col-span-(full|\d+)$/))
|
|
407
|
+
return { "grid-column": e[1] === "full" ? "1 / -1" : `span ${e[1]} / span ${e[1]}` };
|
|
408
|
+
if (e = t.match(/^col-start-(\d+|auto)$/)) return { "grid-column-start": e[1] };
|
|
409
|
+
if (e = t.match(/^col-end-(\d+|auto)$/)) return { "grid-column-end": e[1] };
|
|
410
|
+
if (e = t.match(/^row-span-(full|\d+)$/))
|
|
411
|
+
return { "grid-row": e[1] === "full" ? "1 / -1" : `span ${e[1]} / span ${e[1]}` };
|
|
412
|
+
if (e = t.match(/^row-start-(\d+|auto)$/)) return { "grid-row-start": e[1] };
|
|
413
|
+
if (e = t.match(/^row-end-(\d+|auto)$/)) return { "grid-row-end": e[1] };
|
|
414
|
+
if (t === "grid-flow-row") return { "grid-auto-flow": "row" };
|
|
415
|
+
if (t === "grid-flow-col") return { "grid-auto-flow": "column" };
|
|
416
|
+
if (t === "grid-flow-dense") return { "grid-auto-flow": "dense" };
|
|
417
|
+
if (t === "grid-flow-row-dense") return { "grid-auto-flow": "row dense" };
|
|
418
|
+
if (t === "grid-flow-col-dense") return { "grid-auto-flow": "column dense" };
|
|
419
|
+
if (e = t.match(/^p-(.+)$/)) {
|
|
420
|
+
const r = d[e[1]] ?? c(e[1]);
|
|
421
|
+
if (r) return { padding: r };
|
|
422
|
+
}
|
|
423
|
+
if (e = t.match(/^px-(.+)$/)) {
|
|
424
|
+
const r = d[e[1]] ?? c(e[1]);
|
|
425
|
+
if (r) return { "padding-left": r, "padding-right": r };
|
|
426
|
+
}
|
|
427
|
+
if (e = t.match(/^py-(.+)$/)) {
|
|
428
|
+
const r = d[e[1]] ?? c(e[1]);
|
|
429
|
+
if (r) return { "padding-top": r, "padding-bottom": r };
|
|
430
|
+
}
|
|
431
|
+
if (e = t.match(/^pt-(.+)$/)) {
|
|
432
|
+
const r = d[e[1]] ?? c(e[1]);
|
|
433
|
+
if (r) return { "padding-top": r };
|
|
434
|
+
}
|
|
435
|
+
if (e = t.match(/^pr-(.+)$/)) {
|
|
436
|
+
const r = d[e[1]] ?? c(e[1]);
|
|
437
|
+
if (r) return { "padding-right": r };
|
|
438
|
+
}
|
|
439
|
+
if (e = t.match(/^pb-(.+)$/)) {
|
|
440
|
+
const r = d[e[1]] ?? c(e[1]);
|
|
441
|
+
if (r) return { "padding-bottom": r };
|
|
442
|
+
}
|
|
443
|
+
if (e = t.match(/^pl-(.+)$/)) {
|
|
444
|
+
const r = d[e[1]] ?? c(e[1]);
|
|
445
|
+
if (r) return { "padding-left": r };
|
|
446
|
+
}
|
|
447
|
+
if (e = t.match(/^-?m-(.+)$/)) {
|
|
448
|
+
const r = t.startsWith("-"), n = d[e[1]] ?? c(e[1]);
|
|
449
|
+
if (n) return { margin: r && n !== "0" ? `-${n}` : n };
|
|
450
|
+
}
|
|
451
|
+
if (e = t.match(/^-?mx-(.+)$/)) {
|
|
452
|
+
const r = t.startsWith("-"), n = d[e[1]] ?? c(e[1]);
|
|
453
|
+
if (n) {
|
|
454
|
+
const p = r && n !== "0" ? `-${n}` : n;
|
|
455
|
+
return { "margin-left": p, "margin-right": p };
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
if (e = t.match(/^-?my-(.+)$/)) {
|
|
459
|
+
const r = t.startsWith("-"), n = d[e[1]] ?? c(e[1]);
|
|
460
|
+
if (n) {
|
|
461
|
+
const p = r && n !== "0" ? `-${n}` : n;
|
|
462
|
+
return { "margin-top": p, "margin-bottom": p };
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
if (e = t.match(/^-?mt-(.+)$/)) {
|
|
466
|
+
const r = t.startsWith("-"), n = d[e[1]] ?? c(e[1]);
|
|
467
|
+
if (n) return { "margin-top": r && n !== "0" ? `-${n}` : n };
|
|
468
|
+
}
|
|
469
|
+
if (e = t.match(/^-?mr-(.+)$/)) {
|
|
470
|
+
const r = t.startsWith("-"), n = d[e[1]] ?? c(e[1]);
|
|
471
|
+
if (n) return { "margin-right": r && n !== "0" ? `-${n}` : n };
|
|
472
|
+
}
|
|
473
|
+
if (e = t.match(/^-?mb-(.+)$/)) {
|
|
474
|
+
const r = t.startsWith("-"), n = d[e[1]] ?? c(e[1]);
|
|
475
|
+
if (n) return { "margin-bottom": r && n !== "0" ? `-${n}` : n };
|
|
476
|
+
}
|
|
477
|
+
if (e = t.match(/^-?ml-(.+)$/)) {
|
|
478
|
+
const r = t.startsWith("-"), n = d[e[1]] ?? c(e[1]);
|
|
479
|
+
if (n) return { "margin-left": r && n !== "0" ? `-${n}` : n };
|
|
480
|
+
}
|
|
481
|
+
if (t === "mx-auto") return { "margin-left": "auto", "margin-right": "auto" };
|
|
482
|
+
if (t === "my-auto") return { "margin-top": "auto", "margin-bottom": "auto" };
|
|
483
|
+
if (e = t.match(/^gap-(.+)$/)) {
|
|
484
|
+
const r = d[e[1]] ?? c(e[1]);
|
|
485
|
+
if (r) return { gap: r };
|
|
486
|
+
}
|
|
487
|
+
if (e = t.match(/^gap-x-(.+)$/)) {
|
|
488
|
+
const r = d[e[1]] ?? c(e[1]);
|
|
489
|
+
if (r) return { "column-gap": r };
|
|
490
|
+
}
|
|
491
|
+
if (e = t.match(/^gap-y-(.+)$/)) {
|
|
492
|
+
const r = d[e[1]] ?? c(e[1]);
|
|
493
|
+
if (r) return { "row-gap": r };
|
|
494
|
+
}
|
|
495
|
+
if (e = t.match(/^w-(.+)$/)) {
|
|
496
|
+
const r = e[1], n = d[r] ?? A[r] ?? c(r);
|
|
497
|
+
if (n) return { width: n };
|
|
498
|
+
}
|
|
499
|
+
if (e = t.match(/^min-w-(.+)$/)) {
|
|
500
|
+
const r = d[e[1]] ?? c(e[1]);
|
|
501
|
+
if (r) return { "min-width": r };
|
|
502
|
+
}
|
|
503
|
+
if (e = t.match(/^max-w-(.+)$/)) {
|
|
504
|
+
const n = {
|
|
505
|
+
none: "none",
|
|
506
|
+
xs: "20rem",
|
|
507
|
+
sm: "24rem",
|
|
508
|
+
md: "28rem",
|
|
509
|
+
lg: "32rem",
|
|
510
|
+
xl: "36rem",
|
|
511
|
+
"2xl": "42rem",
|
|
512
|
+
"3xl": "48rem",
|
|
513
|
+
"4xl": "56rem",
|
|
514
|
+
"5xl": "64rem",
|
|
515
|
+
"6xl": "72rem",
|
|
516
|
+
"7xl": "80rem",
|
|
517
|
+
full: "100%",
|
|
518
|
+
screen: "100vw",
|
|
519
|
+
min: "min-content",
|
|
520
|
+
max: "max-content",
|
|
521
|
+
fit: "fit-content"
|
|
522
|
+
}[e[1]] ?? d[e[1]] ?? c(e[1]);
|
|
523
|
+
if (n) return { "max-width": n };
|
|
524
|
+
}
|
|
525
|
+
if (e = t.match(/^h-(.+)$/)) {
|
|
526
|
+
const r = e[1], n = ot[r] ?? A[r] ?? c(r);
|
|
527
|
+
if (n) return { height: n };
|
|
528
|
+
}
|
|
529
|
+
if (e = t.match(/^min-h-(.+)$/)) {
|
|
530
|
+
const n = { 0: "0", full: "100%", screen: "100vh", svh: "100svh", dvh: "100dvh" }[e[1]] ?? d[e[1]] ?? c(e[1]);
|
|
531
|
+
if (n) return { "min-height": n };
|
|
532
|
+
}
|
|
533
|
+
if (e = t.match(/^max-h-(.+)$/)) {
|
|
534
|
+
const r = ot[e[1]] ?? c(e[1]);
|
|
535
|
+
if (r) return { "max-height": r };
|
|
536
|
+
}
|
|
537
|
+
if (e = t.match(/^size-(.+)$/)) {
|
|
538
|
+
const r = d[e[1]] ?? A[e[1]] ?? c(e[1]);
|
|
539
|
+
if (r) return { width: r, height: r };
|
|
540
|
+
}
|
|
541
|
+
if (e = t.match(/^text-(xs|sm|base|lg|[2-9]xl|\d+xl)$/)) {
|
|
542
|
+
const [r, n] = Wt[e[1]] ?? ["1rem", "1.5rem"];
|
|
543
|
+
return { "font-size": r, "line-height": n };
|
|
544
|
+
}
|
|
545
|
+
if (e = t.match(/^font-(thin|extralight|light|normal|medium|semibold|bold|extrabold|black|\d+)$/))
|
|
546
|
+
return { "font-weight": Ht[e[1]] ?? e[1] };
|
|
547
|
+
if (e = t.match(/^leading-(.+)$/)) {
|
|
548
|
+
const r = Nt[e[1]] ?? c(e[1]);
|
|
549
|
+
if (r) return { "line-height": r };
|
|
550
|
+
}
|
|
551
|
+
if (e = t.match(/^tracking-(.+)$/)) {
|
|
552
|
+
const r = Ot[e[1]] ?? c(e[1]);
|
|
553
|
+
if (r) return { "letter-spacing": r };
|
|
554
|
+
}
|
|
555
|
+
const x = {
|
|
556
|
+
"text-left": "left",
|
|
557
|
+
"text-center": "center",
|
|
558
|
+
"text-right": "right",
|
|
559
|
+
"text-justify": "justify",
|
|
560
|
+
"text-start": "start",
|
|
561
|
+
"text-end": "end"
|
|
562
|
+
};
|
|
563
|
+
if (x[t]) return { "text-align": x[t] };
|
|
564
|
+
if (t === "italic") return { "font-style": "italic" };
|
|
565
|
+
if (t === "not-italic") return { "font-style": "normal" };
|
|
566
|
+
if (t === "uppercase") return { "text-transform": "uppercase" };
|
|
567
|
+
if (t === "lowercase") return { "text-transform": "lowercase" };
|
|
568
|
+
if (t === "capitalize") return { "text-transform": "capitalize" };
|
|
569
|
+
if (t === "normal-case") return { "text-transform": "none" };
|
|
570
|
+
if (t === "underline") return { "text-decoration-line": "underline" };
|
|
571
|
+
if (t === "overline") return { "text-decoration-line": "overline" };
|
|
572
|
+
if (t === "line-through") return { "text-decoration-line": "line-through" };
|
|
573
|
+
if (t === "no-underline") return { "text-decoration-line": "none" };
|
|
574
|
+
if (t === "truncate") return { overflow: "hidden", "text-overflow": "ellipsis", "white-space": "nowrap" };
|
|
575
|
+
if (t === "text-ellipsis") return { "text-overflow": "ellipsis" };
|
|
576
|
+
if (t === "text-clip") return { "text-overflow": "clip" };
|
|
577
|
+
if (t === "whitespace-normal") return { "white-space": "normal" };
|
|
578
|
+
if (t === "whitespace-nowrap") return { "white-space": "nowrap" };
|
|
579
|
+
if (t === "whitespace-pre") return { "white-space": "pre" };
|
|
580
|
+
if (t === "whitespace-pre-wrap") return { "white-space": "pre-wrap" };
|
|
581
|
+
if (t === "whitespace-pre-line") return { "white-space": "pre-line" };
|
|
582
|
+
if (t === "break-words") return { "overflow-wrap": "break-word" };
|
|
583
|
+
if (t === "break-all") return { "word-break": "break-all" };
|
|
584
|
+
if (t === "break-keep") return { "word-break": "keep-all" };
|
|
585
|
+
if (t === "font-mono") return { "font-family": "var(--tkx-font-mono,monospace)" };
|
|
586
|
+
if (t === "font-sans") return { "font-family": "var(--tkx-font-family,system-ui,sans-serif)" };
|
|
587
|
+
if (t === "font-serif") return { "font-family": "ui-serif,Georgia,serif" };
|
|
588
|
+
if (t === "antialiased") return { "-webkit-font-smoothing": "antialiased", "-moz-osx-font-smoothing": "grayscale" };
|
|
589
|
+
if (e = t.match(/^indent-(.+)$/)) {
|
|
590
|
+
const r = d[e[1]] ?? c(e[1]);
|
|
591
|
+
if (r) return { "text-indent": r };
|
|
592
|
+
}
|
|
593
|
+
if (e = t.match(/^line-clamp-(\d+)$/))
|
|
594
|
+
return { overflow: "hidden", display: "-webkit-box", "-webkit-line-clamp": e[1], "-webkit-box-orient": "vertical" };
|
|
595
|
+
if (e = t.match(/^text-(.+)$/)) {
|
|
596
|
+
const [r, n] = e[1].split("/"), p = z(r);
|
|
597
|
+
if (![
|
|
598
|
+
"left",
|
|
599
|
+
"center",
|
|
600
|
+
"right",
|
|
601
|
+
"justify",
|
|
602
|
+
"start",
|
|
603
|
+
"end",
|
|
604
|
+
"xs",
|
|
605
|
+
"sm",
|
|
606
|
+
"base",
|
|
607
|
+
"lg",
|
|
608
|
+
"xl",
|
|
609
|
+
"2xl",
|
|
610
|
+
"3xl",
|
|
611
|
+
"4xl",
|
|
612
|
+
"5xl",
|
|
613
|
+
"6xl",
|
|
614
|
+
"7xl",
|
|
615
|
+
"8xl",
|
|
616
|
+
"9xl"
|
|
617
|
+
].includes(r)) {
|
|
618
|
+
if (n) {
|
|
619
|
+
const y = parseInt(n) / 100;
|
|
620
|
+
return { color: p, opacity: String(y) };
|
|
621
|
+
}
|
|
622
|
+
return { color: p };
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
if (e = t.match(/^bg-(.+)$/)) {
|
|
626
|
+
const [r, n] = e[1].split("/"), p = z(r);
|
|
627
|
+
return n ? { "background-color": p, opacity: String(parseInt(n) / 100) } : r === "none" ? { background: "none" } : { "background-color": p };
|
|
628
|
+
}
|
|
629
|
+
if (e = t.match(/^border-color-(.+)$/))
|
|
630
|
+
return { "border-color": z(e[1]) };
|
|
631
|
+
if (e = t.match(/^fill-(.+)$/))
|
|
632
|
+
return { fill: z(e[1]) };
|
|
633
|
+
if (e = t.match(/^stroke-(.+)$/))
|
|
634
|
+
return { stroke: z(e[1]) };
|
|
635
|
+
if (e = t.match(/^shadow-color-(.+)$/))
|
|
636
|
+
return { "--tkx-shadow-color": z(e[1]) };
|
|
637
|
+
if (e = t.match(/^ring-color-(.+)$/))
|
|
638
|
+
return { "--tkx-ring-color": z(e[1]) };
|
|
639
|
+
if (e = t.match(/^accent-(.+)$/))
|
|
640
|
+
return { "accent-color": z(e[1]) };
|
|
641
|
+
if (e = t.match(/^caret-(.+)$/))
|
|
642
|
+
return { "caret-color": z(e[1]) };
|
|
643
|
+
if (e = t.match(/^outline-color-(.+)$/))
|
|
644
|
+
return { "outline-color": z(e[1]) };
|
|
645
|
+
if (t === "border") return { "border-width": "1px" };
|
|
646
|
+
if (e = t.match(/^border-(\d+)$/)) return { "border-width": `${e[1]}px` };
|
|
647
|
+
if (t === "border-t") return { "border-top-width": "1px" };
|
|
648
|
+
if (e = t.match(/^border-t-(\d+)$/)) return { "border-top-width": `${e[1]}px` };
|
|
649
|
+
if (t === "border-r") return { "border-right-width": "1px" };
|
|
650
|
+
if (e = t.match(/^border-r-(\d+)$/)) return { "border-right-width": `${e[1]}px` };
|
|
651
|
+
if (t === "border-b") return { "border-bottom-width": "1px" };
|
|
652
|
+
if (e = t.match(/^border-b-(\d+)$/)) return { "border-bottom-width": `${e[1]}px` };
|
|
653
|
+
if (t === "border-l") return { "border-left-width": "1px" };
|
|
654
|
+
if (e = t.match(/^border-l-(\d+)$/)) return { "border-left-width": `${e[1]}px` };
|
|
655
|
+
if (t === "border-x") return { "border-left-width": "1px", "border-right-width": "1px" };
|
|
656
|
+
if (t === "border-y") return { "border-top-width": "1px", "border-bottom-width": "1px" };
|
|
657
|
+
if (t === "border-none") return { "border-style": "none" };
|
|
658
|
+
if (t === "border-solid") return { "border-style": "solid" };
|
|
659
|
+
if (t === "border-dashed") return { "border-style": "dashed" };
|
|
660
|
+
if (t === "border-dotted") return { "border-style": "dotted" };
|
|
661
|
+
if (t === "border-double") return { "border-style": "double" };
|
|
662
|
+
if ((e = t.match(/^border-([a-zA-Z].*)$/)) && xt.has(e[1]))
|
|
663
|
+
return { "border-color": `var(--tkx-${e[1]})` };
|
|
664
|
+
if (e = t.match(/^border-\[(.+)]$/))
|
|
665
|
+
return { "border-color": e[1] };
|
|
666
|
+
if (t === "border-0") return { "border-width": "0" };
|
|
667
|
+
if (t === "rounded") return { "border-radius": Z[""] };
|
|
668
|
+
if (e = t.match(/^rounded-(none|sm|md|lg|xl|2xl|3xl|full|\[.+])$/))
|
|
669
|
+
return { "border-radius": Z[e[1]] ?? c(e[1]) ?? e[1] };
|
|
670
|
+
if (e = t.match(/^rounded-(t|r|b|l|tl|tr|br|bl)(?:-(none|sm|md|lg|xl|2xl|3xl|full))?$/)) {
|
|
671
|
+
const r = e[1], n = Z[e[2] ?? ""] ?? Z[""];
|
|
672
|
+
return {
|
|
673
|
+
t: { "border-top-left-radius": n, "border-top-right-radius": n },
|
|
674
|
+
r: { "border-top-right-radius": n, "border-bottom-right-radius": n },
|
|
675
|
+
b: { "border-bottom-left-radius": n, "border-bottom-right-radius": n },
|
|
676
|
+
l: { "border-top-left-radius": n, "border-bottom-left-radius": n },
|
|
677
|
+
tl: { "border-top-left-radius": n },
|
|
678
|
+
tr: { "border-top-right-radius": n },
|
|
679
|
+
br: { "border-bottom-right-radius": n },
|
|
680
|
+
bl: { "border-bottom-left-radius": n }
|
|
681
|
+
}[r] ?? {};
|
|
682
|
+
}
|
|
683
|
+
const w = { 0: "0", 1: "1px", 2: "2px", ring: "3px", 4: "4px", 8: "8px" };
|
|
684
|
+
if (t === "ring") return { "box-shadow": "0 0 0 3px var(--tkx-ring-color,var(--tkx-primary))" };
|
|
685
|
+
if ((e = t.match(/^ring-(\d+)$/)) && w[e[1]])
|
|
686
|
+
return { "box-shadow": `0 0 0 ${w[e[1]]} var(--tkx-ring-color,var(--tkx-primary))` };
|
|
687
|
+
if (t === "ring-inset") return { "--tkx-ring-offset": "inset" };
|
|
688
|
+
if (e = t.match(/^ring-offset-(\d+)$/))
|
|
689
|
+
return { "--tkx-ring-offset-width": `${e[1]}px`, "box-shadow": `0 0 0 ${e[1]}px var(--tkx-bg)` };
|
|
690
|
+
if (t === "shadow") return { "box-shadow": st[""] };
|
|
691
|
+
if (e = t.match(/^shadow-(sm|md|lg|xl|2xl|inner|none)$/)) return { "box-shadow": st[e[1]] };
|
|
692
|
+
if (e = t.match(/^opacity-(\d+)$/)) {
|
|
693
|
+
const r = qt[e[1]];
|
|
694
|
+
if (r !== void 0) return { opacity: r };
|
|
695
|
+
}
|
|
696
|
+
if (t === "bg-none") return { background: "none" };
|
|
697
|
+
const b = { "bg-auto": "auto", "bg-cover": "cover", "bg-contain": "contain" };
|
|
698
|
+
if (b[t]) return { "background-size": b[t] };
|
|
699
|
+
const v = {
|
|
700
|
+
"bg-center": "center",
|
|
701
|
+
"bg-top": "top",
|
|
702
|
+
"bg-bottom": "bottom",
|
|
703
|
+
"bg-left": "left",
|
|
704
|
+
"bg-right": "right"
|
|
705
|
+
};
|
|
706
|
+
if (v[t]) return { "background-position": v[t] };
|
|
707
|
+
const E = {
|
|
708
|
+
"bg-repeat": "repeat",
|
|
709
|
+
"bg-no-repeat": "no-repeat",
|
|
710
|
+
"bg-repeat-x": "repeat-x",
|
|
711
|
+
"bg-repeat-y": "repeat-y"
|
|
712
|
+
};
|
|
713
|
+
if (E[t]) return { "background-repeat": E[t] };
|
|
714
|
+
if (t === "backdrop-blur") return { "backdrop-filter": `blur(${J[""]})` };
|
|
715
|
+
if (e = t.match(/^backdrop-blur-(none|sm|md|lg|xl|2xl|3xl)$/))
|
|
716
|
+
return { "backdrop-filter": `blur(${J[e[1]]})` };
|
|
717
|
+
if (t === "blur") return { filter: `blur(${J[""]})` };
|
|
718
|
+
if (e = t.match(/^blur-(none|sm|md|lg|xl|2xl|3xl)$/))
|
|
719
|
+
return { filter: `blur(${J[e[1]]})` };
|
|
720
|
+
if (t === "grayscale") return { filter: "grayscale(100%)" };
|
|
721
|
+
if (t === "grayscale-0") return { filter: "grayscale(0)" };
|
|
722
|
+
if (t === "invert") return { filter: "invert(100%)" };
|
|
723
|
+
if (t === "invert-0") return { filter: "invert(0)" };
|
|
724
|
+
const I = {
|
|
725
|
+
static: "static",
|
|
726
|
+
relative: "relative",
|
|
727
|
+
absolute: "absolute",
|
|
728
|
+
fixed: "fixed",
|
|
729
|
+
sticky: "sticky"
|
|
730
|
+
};
|
|
731
|
+
if (I[t]) return { position: I[t] };
|
|
732
|
+
if (t === "inset-0") return { top: "0", right: "0", bottom: "0", left: "0" };
|
|
733
|
+
if (t === "inset-auto") return { top: "auto", right: "auto", bottom: "auto", left: "auto" };
|
|
734
|
+
if (t === "inset-full") return { top: "100%", right: "100%", bottom: "100%", left: "100%" };
|
|
735
|
+
if (t === "inset-x-0") return { left: "0", right: "0" };
|
|
736
|
+
if (t === "inset-y-0") return { top: "0", bottom: "0" };
|
|
737
|
+
if (e = t.match(/^-?top-(.+)$/)) {
|
|
738
|
+
const r = t.startsWith("-"), n = d[e[1]] ?? A[e[1]] ?? c(e[1]);
|
|
739
|
+
if (n) return { top: r && n !== "0" ? `-${n}` : n };
|
|
740
|
+
}
|
|
741
|
+
if (e = t.match(/^-?right-(.+)$/)) {
|
|
742
|
+
const r = t.startsWith("-"), n = d[e[1]] ?? A[e[1]] ?? c(e[1]);
|
|
743
|
+
if (n) return { right: r && n !== "0" ? `-${n}` : n };
|
|
744
|
+
}
|
|
745
|
+
if (e = t.match(/^-?bottom-(.+)$/)) {
|
|
746
|
+
const r = t.startsWith("-"), n = d[e[1]] ?? A[e[1]] ?? c(e[1]);
|
|
747
|
+
if (n) return { bottom: r && n !== "0" ? `-${n}` : n };
|
|
748
|
+
}
|
|
749
|
+
if (e = t.match(/^-?left-(.+)$/)) {
|
|
750
|
+
const r = t.startsWith("-"), n = d[e[1]] ?? A[e[1]] ?? c(e[1]);
|
|
751
|
+
if (n) return { left: r && n !== "0" ? `-${n}` : n };
|
|
752
|
+
}
|
|
753
|
+
const W = { 0: "0", 10: "10", 20: "20", 30: "30", 40: "40", 50: "50", 100: "100", 1e3: "1000", 9e3: "9000", auto: "auto" };
|
|
754
|
+
if (e = t.match(/^z-(.+)$/)) {
|
|
755
|
+
const r = W[e[1]] ?? c(e[1]);
|
|
756
|
+
if (r) return { "z-index": r };
|
|
757
|
+
}
|
|
758
|
+
const H = {
|
|
759
|
+
"overflow-auto": "auto",
|
|
760
|
+
"overflow-hidden": "hidden",
|
|
761
|
+
"overflow-visible": "visible",
|
|
762
|
+
"overflow-scroll": "scroll",
|
|
763
|
+
"overflow-clip": "clip"
|
|
764
|
+
};
|
|
765
|
+
if (H[t]) return { overflow: H[t] };
|
|
766
|
+
if (e = t.match(/^overflow-(x|y)-(auto|hidden|visible|scroll|clip)$/))
|
|
767
|
+
return { [`overflow-${e[1]}`]: e[2] };
|
|
768
|
+
if (t === "scrollbar-hide") return { "-ms-overflow-style": "none", "scrollbar-width": "none" };
|
|
769
|
+
if (t === "visible") return { visibility: "visible" };
|
|
770
|
+
if (t === "invisible") return { visibility: "hidden" };
|
|
771
|
+
if (t === "collapse") return { visibility: "collapse" };
|
|
772
|
+
const F = {
|
|
773
|
+
"cursor-auto": "auto",
|
|
774
|
+
"cursor-default": "default",
|
|
775
|
+
"cursor-pointer": "pointer",
|
|
776
|
+
"cursor-wait": "wait",
|
|
777
|
+
"cursor-text": "text",
|
|
778
|
+
"cursor-move": "move",
|
|
779
|
+
"cursor-help": "help",
|
|
780
|
+
"cursor-not-allowed": "not-allowed",
|
|
781
|
+
"cursor-none": "none",
|
|
782
|
+
"cursor-grab": "grab",
|
|
783
|
+
"cursor-grabbing": "grabbing",
|
|
784
|
+
"cursor-zoom-in": "zoom-in",
|
|
785
|
+
"cursor-zoom-out": "zoom-out",
|
|
786
|
+
"cursor-crosshair": "crosshair"
|
|
787
|
+
};
|
|
788
|
+
if (F[t]) return { cursor: F[t] };
|
|
789
|
+
if (t === "select-none") return { "user-select": "none" };
|
|
790
|
+
if (t === "select-text") return { "user-select": "text" };
|
|
791
|
+
if (t === "select-all") return { "user-select": "all" };
|
|
792
|
+
if (t === "select-auto") return { "user-select": "auto" };
|
|
793
|
+
if (t === "pointer-events-none") return { "pointer-events": "none" };
|
|
794
|
+
if (t === "pointer-events-auto") return { "pointer-events": "auto" };
|
|
795
|
+
const j = { 0: "0", 50: ".5", 75: ".75", 90: ".9", 95: ".95", 100: "1", 105: "1.05", 110: "1.1", 125: "1.25", 150: "1.5" };
|
|
796
|
+
if (e = t.match(/^scale-(.+)$/)) {
|
|
797
|
+
const r = j[e[1]] ?? c(e[1]);
|
|
798
|
+
if (r) return { transform: `scale(${r})` };
|
|
799
|
+
}
|
|
800
|
+
if (e = t.match(/^scale-x-(.+)$/)) {
|
|
801
|
+
const r = j[e[1]] ?? c(e[1]);
|
|
802
|
+
if (r) return { transform: `scaleX(${r})` };
|
|
803
|
+
}
|
|
804
|
+
if (e = t.match(/^scale-y-(.+)$/)) {
|
|
805
|
+
const r = j[e[1]] ?? c(e[1]);
|
|
806
|
+
if (r) return { transform: `scaleY(${r})` };
|
|
807
|
+
}
|
|
808
|
+
const R = { 0: "0deg", 1: "1deg", 2: "2deg", 3: "3deg", 6: "6deg", 12: "12deg", 45: "45deg", 90: "90deg", 180: "180deg" };
|
|
809
|
+
if (e = t.match(/^-?rotate-(.+)$/)) {
|
|
810
|
+
const r = t.startsWith("-"), n = R[e[1]] ?? c(e[1]);
|
|
811
|
+
if (n) return { transform: r ? `rotate(-${n})` : `rotate(${n})` };
|
|
812
|
+
}
|
|
813
|
+
if (e = t.match(/^-?translate-x-(.+)$/)) {
|
|
814
|
+
const r = t.startsWith("-"), n = d[e[1]] ?? A[e[1]] ?? c(e[1]);
|
|
815
|
+
if (n) return { transform: `translateX(${r && n !== "0" ? `-${n}` : n})` };
|
|
816
|
+
}
|
|
817
|
+
if (e = t.match(/^-?translate-y-(.+)$/)) {
|
|
818
|
+
const r = t.startsWith("-"), n = d[e[1]] ?? A[e[1]] ?? c(e[1]);
|
|
819
|
+
if (n) return { transform: `translateY(${r && n !== "0" ? `-${n}` : n})` };
|
|
820
|
+
}
|
|
821
|
+
if (e = t.match(/^-?skew-x-(.+)$/)) {
|
|
822
|
+
const r = t.startsWith("-"), n = c(e[1]) ?? `${e[1]}deg`;
|
|
823
|
+
return { transform: r ? `skewX(-${n})` : `skewX(${n})` };
|
|
824
|
+
}
|
|
825
|
+
if (e = t.match(/^-?skew-y-(.+)$/)) {
|
|
826
|
+
const r = t.startsWith("-"), n = c(e[1]) ?? `${e[1]}deg`;
|
|
827
|
+
return { transform: r ? `skewY(-${n})` : `skewY(${n})` };
|
|
828
|
+
}
|
|
829
|
+
const O = {
|
|
830
|
+
"origin-center": "center",
|
|
831
|
+
"origin-top": "top",
|
|
832
|
+
"origin-top-right": "top right",
|
|
833
|
+
"origin-right": "right",
|
|
834
|
+
"origin-bottom-right": "bottom right",
|
|
835
|
+
"origin-bottom": "bottom",
|
|
836
|
+
"origin-bottom-left": "bottom left",
|
|
837
|
+
"origin-left": "left",
|
|
838
|
+
"origin-top-left": "top left"
|
|
839
|
+
};
|
|
840
|
+
if (O[t]) return { "transform-origin": O[t] };
|
|
841
|
+
const B = {
|
|
842
|
+
transition: "color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter",
|
|
843
|
+
"transition-all": "all",
|
|
844
|
+
"transition-colors": "color,background-color,border-color,text-decoration-color,fill,stroke",
|
|
845
|
+
"transition-opacity": "opacity",
|
|
846
|
+
"transition-shadow": "box-shadow",
|
|
847
|
+
"transition-transform": "transform",
|
|
848
|
+
"transition-none": "none"
|
|
849
|
+
};
|
|
850
|
+
if (B[t]) return { "transition-property": B[t], "transition-timing-function": "cubic-bezier(0.4,0,0.2,1)", "transition-duration": "150ms" };
|
|
851
|
+
const N = { 75: "75ms", 100: "100ms", 150: "150ms", 200: "200ms", 300: "300ms", 500: "500ms", 700: "700ms", 1e3: "1000ms" };
|
|
852
|
+
if (e = t.match(/^duration-(.+)$/)) {
|
|
853
|
+
const r = N[e[1]] ?? c(e[1]);
|
|
854
|
+
if (r) return { "transition-duration": r };
|
|
855
|
+
}
|
|
856
|
+
if (e = t.match(/^delay-(.+)$/)) {
|
|
857
|
+
const r = N[e[1]] ?? c(e[1]);
|
|
858
|
+
if (r) return { "transition-delay": r };
|
|
859
|
+
}
|
|
860
|
+
const q = {
|
|
861
|
+
"ease-linear": "linear",
|
|
862
|
+
"ease-in": "cubic-bezier(0.4,0,1,1)",
|
|
863
|
+
"ease-out": "cubic-bezier(0,0,0.2,1)",
|
|
864
|
+
"ease-in-out": "cubic-bezier(0.4,0,0.2,1)"
|
|
865
|
+
};
|
|
866
|
+
if (q[t]) return { "transition-timing-function": q[t] };
|
|
867
|
+
const P = {
|
|
868
|
+
"animate-none": "none",
|
|
869
|
+
"animate-spin": "tkx-spin 1s linear infinite",
|
|
870
|
+
"animate-ping": "tkx-ping 1s cubic-bezier(0,0,0.2,1) infinite",
|
|
871
|
+
"animate-pulse": "tkx-pulse 2s cubic-bezier(0.4,0,0.6,1) infinite",
|
|
872
|
+
"animate-bounce": "tkx-bounce 1s infinite",
|
|
873
|
+
"animate-fade-in": "tkx-fade-in 200ms ease both",
|
|
874
|
+
"animate-slide-up": "tkx-slide-up 200ms ease both",
|
|
875
|
+
"animate-shimmer": "tkx-shimmer 1.5s infinite"
|
|
876
|
+
};
|
|
877
|
+
if (P[t]) return { animation: P[t] };
|
|
878
|
+
const Y = {
|
|
879
|
+
"object-contain": "contain",
|
|
880
|
+
"object-cover": "cover",
|
|
881
|
+
"object-fill": "fill",
|
|
882
|
+
"object-none": "none",
|
|
883
|
+
"object-scale-down": "scale-down"
|
|
884
|
+
};
|
|
885
|
+
if (Y[t]) return { "object-fit": Y[t] };
|
|
886
|
+
if (t === "aspect-square") return { "aspect-ratio": "1 / 1" };
|
|
887
|
+
if (t === "aspect-video") return { "aspect-ratio": "16 / 9" };
|
|
888
|
+
if (t === "aspect-auto") return { "aspect-ratio": "auto" };
|
|
889
|
+
if (e = t.match(/^aspect-\[(.+)]$/))
|
|
890
|
+
return { "aspect-ratio": e[1] };
|
|
891
|
+
if (t === "list-none") return { "list-style-type": "none" };
|
|
892
|
+
if (t === "list-disc") return { "list-style-type": "disc" };
|
|
893
|
+
if (t === "list-decimal") return { "list-style-type": "decimal" };
|
|
894
|
+
if (t === "list-inside") return { "list-style-position": "inside" };
|
|
895
|
+
if (t === "list-outside") return { "list-style-position": "outside" };
|
|
896
|
+
if (e = t.match(/^columns-(\d+)$/)) return { columns: e[1] };
|
|
897
|
+
if (t === "resize") return { resize: "both" };
|
|
898
|
+
if (t === "resize-none") return { resize: "none" };
|
|
899
|
+
if (t === "resize-x") return { resize: "horizontal" };
|
|
900
|
+
if (t === "resize-y") return { resize: "vertical" };
|
|
901
|
+
if (t === "sr-only") return {
|
|
902
|
+
position: "absolute",
|
|
903
|
+
width: "1px",
|
|
904
|
+
height: "1px",
|
|
905
|
+
padding: "0",
|
|
906
|
+
margin: "-1px",
|
|
907
|
+
overflow: "hidden",
|
|
908
|
+
clip: "rect(0,0,0,0)",
|
|
909
|
+
"white-space": "nowrap",
|
|
910
|
+
border: "0"
|
|
911
|
+
};
|
|
912
|
+
if (t === "not-sr-only") return {
|
|
913
|
+
position: "static",
|
|
914
|
+
width: "auto",
|
|
915
|
+
height: "auto",
|
|
916
|
+
padding: "0",
|
|
917
|
+
margin: "0",
|
|
918
|
+
overflow: "visible",
|
|
919
|
+
clip: "auto",
|
|
920
|
+
"white-space": "normal"
|
|
921
|
+
};
|
|
922
|
+
if (t === "focus-ring") return {
|
|
923
|
+
outline: "2px solid var(--tkx-primary)",
|
|
924
|
+
"outline-offset": "2px",
|
|
925
|
+
"border-radius": "2px"
|
|
926
|
+
};
|
|
927
|
+
if (t === "appearance-none") return { appearance: "none" };
|
|
928
|
+
if (t === "outline-none") return { outline: "none" };
|
|
929
|
+
if (t === "outline") return { outline: "2px solid currentColor", "outline-offset": "2px" };
|
|
930
|
+
if (t === "float-left") return { float: "left" };
|
|
931
|
+
if (t === "float-right") return { float: "right" };
|
|
932
|
+
if (t === "float-none") return { float: "none" };
|
|
933
|
+
if (t === "clear-both") return { clear: "both" };
|
|
934
|
+
if (t === "isolate") return { isolation: "isolate" };
|
|
935
|
+
if (t === "isolation-auto") return { isolation: "auto" };
|
|
936
|
+
if (e = t.match(/^will-change-(.+)$/))
|
|
937
|
+
return { "will-change": e[1] };
|
|
938
|
+
if (t === "touch-manipulation") return { "touch-action": "manipulation" };
|
|
939
|
+
if (t === "touch-none") return { "touch-action": "none" };
|
|
940
|
+
if (t === "touch-pan-x") return { "touch-action": "pan-x" };
|
|
941
|
+
if (t === "touch-pan-y") return { "touch-action": "pan-y" };
|
|
942
|
+
if (t === "scroll-smooth") return { "scroll-behavior": "smooth" };
|
|
943
|
+
if (t === "scroll-auto") return { "scroll-behavior": "auto" };
|
|
944
|
+
if (e = t.match(/^\[(--[a-zA-Z0-9-]+):(.+)]$/))
|
|
945
|
+
return { [e[1]]: e[2] };
|
|
946
|
+
const f = Gt(t);
|
|
947
|
+
return f || null;
|
|
948
|
+
}
|
|
949
|
+
function Dt(t) {
|
|
950
|
+
let i = 0, o = -1;
|
|
951
|
+
for (let s = 0; s < t.length; s++)
|
|
952
|
+
if (t[s] === "[") i++;
|
|
953
|
+
else if (t[s] === "]") i--;
|
|
954
|
+
else if (t[s] === ":" && i === 0) {
|
|
955
|
+
o = s;
|
|
956
|
+
break;
|
|
957
|
+
}
|
|
958
|
+
return o === -1 ? { variant: null, utility: t } : { variant: t.slice(0, o), utility: t.slice(o + 1) };
|
|
959
|
+
}
|
|
960
|
+
function at(t, i) {
|
|
961
|
+
for (const [o, s] of Object.entries(i))
|
|
962
|
+
t[o] = s;
|
|
963
|
+
}
|
|
964
|
+
function rt(t) {
|
|
965
|
+
return Object.entries(t).map(([i, o]) => `${i}:${o}`).join(";");
|
|
966
|
+
}
|
|
967
|
+
const tt = /* @__PURE__ */ new Map();
|
|
968
|
+
let C = null, G = null;
|
|
969
|
+
function ct() {
|
|
970
|
+
return (!C || !C.isConnected) && (C = document.getElementById("tkx-atomic"), C || (C = document.createElement("style"), C.id = "tkx-atomic", document.head.appendChild(C))), C;
|
|
971
|
+
}
|
|
972
|
+
function Bt() {
|
|
973
|
+
if (G) return G;
|
|
974
|
+
try {
|
|
975
|
+
const t = new CSSStyleSheet();
|
|
976
|
+
return document.adoptedStyleSheets = [...document.adoptedStyleSheets, t], G = t, t;
|
|
977
|
+
} catch {
|
|
978
|
+
return null;
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
function Yt(t, i) {
|
|
982
|
+
if (tt.has(t) || (tt.set(t, i), typeof document > "u")) return;
|
|
983
|
+
const o = Bt();
|
|
984
|
+
if (o) {
|
|
985
|
+
const s = _t(i);
|
|
986
|
+
for (const a of s)
|
|
987
|
+
try {
|
|
988
|
+
o.insertRule(a, o.cssRules.length);
|
|
989
|
+
} catch {
|
|
990
|
+
ct().textContent += a + `
|
|
991
|
+
`;
|
|
992
|
+
}
|
|
993
|
+
} else
|
|
994
|
+
ct().textContent += i + `
|
|
995
|
+
`;
|
|
996
|
+
}
|
|
997
|
+
function _t(t) {
|
|
998
|
+
const i = [];
|
|
999
|
+
let o = 0, s = 0;
|
|
1000
|
+
for (let a = 0; a < t.length; a++)
|
|
1001
|
+
if (t[a] === "{") o++;
|
|
1002
|
+
else if (t[a] === "}" && (o--, o === 0)) {
|
|
1003
|
+
const l = t.slice(s, a + 1).trim();
|
|
1004
|
+
l && i.push(l), s = a + 1;
|
|
1005
|
+
}
|
|
1006
|
+
return i;
|
|
1007
|
+
}
|
|
1008
|
+
function gt(t) {
|
|
1009
|
+
const i = [];
|
|
1010
|
+
for (const o of t)
|
|
1011
|
+
if (o) {
|
|
1012
|
+
if (typeof o == "string")
|
|
1013
|
+
i.push(...o.split(/\s+/).filter(Boolean));
|
|
1014
|
+
else if (Array.isArray(o))
|
|
1015
|
+
i.push(...gt(o));
|
|
1016
|
+
else if (typeof o == "object")
|
|
1017
|
+
for (const [s, a] of Object.entries(o))
|
|
1018
|
+
a && i.push(s);
|
|
1019
|
+
}
|
|
1020
|
+
return i;
|
|
1021
|
+
}
|
|
1022
|
+
function M(...t) {
|
|
1023
|
+
const i = gt(t);
|
|
1024
|
+
if (i.length === 0) return "";
|
|
1025
|
+
const o = { base: {}, variants: {} };
|
|
1026
|
+
for (const u of i) {
|
|
1027
|
+
const { variant: m, utility: e } = Dt(u), x = Lt(e);
|
|
1028
|
+
x && (m ? (o.variants[m] || (o.variants[m] = {}), at(o.variants[m], x)) : at(o.base, x));
|
|
1029
|
+
}
|
|
1030
|
+
const s = [], a = rt(o.base), l = [a, ...Object.entries(o.variants).map(([u, m]) => `${u}{${rt(m)}}`)].join("|"), g = Q(l), h = `tkx-${g}`;
|
|
1031
|
+
a && s.push(`.${h}{${a}}`);
|
|
1032
|
+
for (const [u, m] of Object.entries(o.variants)) {
|
|
1033
|
+
const e = rt(m);
|
|
1034
|
+
if (e)
|
|
1035
|
+
if (u.startsWith("@")) {
|
|
1036
|
+
const x = u.slice(1), w = Pt[x];
|
|
1037
|
+
w && s.push(`@media(min-width:${w}){.${h}{${e}}}`);
|
|
1038
|
+
} else if (u === "motion-safe")
|
|
1039
|
+
s.push(`@media(prefers-reduced-motion:no-preference){.${h}{${e}}}`);
|
|
1040
|
+
else if (u === "motion-reduce")
|
|
1041
|
+
s.push(`@media(prefers-reduced-motion:reduce){.${h}{${e}}}`);
|
|
1042
|
+
else if (u === "contrast-more")
|
|
1043
|
+
s.push(`@media(prefers-contrast:more){.${h}{${e}}}`);
|
|
1044
|
+
else if (u === "forced-colors")
|
|
1045
|
+
s.push(`@media(forced-colors:active){.${h}{${e}}}`);
|
|
1046
|
+
else if (u === "dark")
|
|
1047
|
+
s.push(`@media(prefers-color-scheme:dark){.${h}{${e}}}`);
|
|
1048
|
+
else if (u === "print")
|
|
1049
|
+
s.push(`@media print{.${h}{${e}}}`);
|
|
1050
|
+
else if (u === "group-hover")
|
|
1051
|
+
s.push(`.group:hover .${h}{${e}}`);
|
|
1052
|
+
else if (u === "group-focus")
|
|
1053
|
+
s.push(`.group:focus-within .${h}{${e}}`);
|
|
1054
|
+
else if (u === "peer-hover")
|
|
1055
|
+
s.push(`.peer:hover~.${h}{${e}}`);
|
|
1056
|
+
else {
|
|
1057
|
+
const w = {
|
|
1058
|
+
hover: ":hover",
|
|
1059
|
+
focus: ":focus",
|
|
1060
|
+
"focus-visible": ":focus-visible",
|
|
1061
|
+
"focus-within": ":focus-within",
|
|
1062
|
+
active: ":active",
|
|
1063
|
+
disabled: ":disabled",
|
|
1064
|
+
checked: ":checked",
|
|
1065
|
+
required: ":required",
|
|
1066
|
+
valid: ":valid",
|
|
1067
|
+
invalid: ":invalid",
|
|
1068
|
+
first: ":first-child",
|
|
1069
|
+
last: ":last-child",
|
|
1070
|
+
odd: ":nth-child(odd)",
|
|
1071
|
+
even: ":nth-child(even)",
|
|
1072
|
+
"first-of-type": ":first-of-type",
|
|
1073
|
+
"last-of-type": ":last-of-type",
|
|
1074
|
+
"only-child": ":only-child",
|
|
1075
|
+
"only-of-type": ":only-of-type",
|
|
1076
|
+
empty: ":empty",
|
|
1077
|
+
visited: ":visited",
|
|
1078
|
+
target: ":target",
|
|
1079
|
+
"placeholder-shown": ":placeholder-shown",
|
|
1080
|
+
"read-only": ":read-only",
|
|
1081
|
+
before: "::before",
|
|
1082
|
+
after: "::after",
|
|
1083
|
+
placeholder: "::placeholder",
|
|
1084
|
+
selection: "::selection",
|
|
1085
|
+
"file-selector": "::file-selector-button",
|
|
1086
|
+
marker: "::marker"
|
|
1087
|
+
}[u] ?? `:${u}`;
|
|
1088
|
+
s.push(`.${h}${w}{${e}}`);
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1091
|
+
return s.length > 0 && Yt(g, s.join("")), h;
|
|
1092
|
+
}
|
|
1093
|
+
const le = M;
|
|
1094
|
+
function fe() {
|
|
1095
|
+
return Array.from(tt.values()).join(`
|
|
1096
|
+
`);
|
|
1097
|
+
}
|
|
1098
|
+
function de() {
|
|
1099
|
+
tt.clear(), C = null, G && typeof document < "u" && (document.adoptedStyleSheets = document.adoptedStyleSheets.filter((t) => t !== G), G = null);
|
|
1100
|
+
}
|
|
1101
|
+
function V(...t) {
|
|
1102
|
+
return t.filter(Boolean).join(" ");
|
|
1103
|
+
}
|
|
1104
|
+
const et = /* @__PURE__ */ new Map();
|
|
1105
|
+
function ue(t) {
|
|
1106
|
+
et.set(t.name, t.utilities);
|
|
1107
|
+
}
|
|
1108
|
+
function pe(t) {
|
|
1109
|
+
et.delete(t);
|
|
1110
|
+
}
|
|
1111
|
+
function me() {
|
|
1112
|
+
return Array.from(et.keys());
|
|
1113
|
+
}
|
|
1114
|
+
function Gt(t) {
|
|
1115
|
+
for (const i of et.values())
|
|
1116
|
+
if (i[t]) return i[t];
|
|
1117
|
+
return null;
|
|
1118
|
+
}
|
|
1119
|
+
const it = yt(null);
|
|
1120
|
+
function Ut() {
|
|
1121
|
+
const t = dt(it);
|
|
1122
|
+
if (!t)
|
|
1123
|
+
throw new Error("TkxFormField must be used inside a <TkxForm>. Wrap your fields in a TkxForm component.");
|
|
1124
|
+
return t;
|
|
1125
|
+
}
|
|
1126
|
+
async function lt(t, i) {
|
|
1127
|
+
for (const o of i) {
|
|
1128
|
+
if (o.required && (t == null || t === "" || Array.isArray(t) && t.length === 0))
|
|
1129
|
+
return o.message ?? "This field is required";
|
|
1130
|
+
if (!(t == null || t === "")) {
|
|
1131
|
+
if (o.min !== void 0) {
|
|
1132
|
+
if (typeof t == "string" && t.length < o.min)
|
|
1133
|
+
return o.message ?? `Must be at least ${o.min} characters`;
|
|
1134
|
+
if (typeof t == "number" && t < o.min)
|
|
1135
|
+
return o.message ?? `Must be at least ${o.min}`;
|
|
1136
|
+
}
|
|
1137
|
+
if (o.max !== void 0) {
|
|
1138
|
+
if (typeof t == "string" && t.length > o.max)
|
|
1139
|
+
return o.message ?? `Must be no more than ${o.max} characters`;
|
|
1140
|
+
if (typeof t == "number" && t > o.max)
|
|
1141
|
+
return o.message ?? `Must be no more than ${o.max}`;
|
|
1142
|
+
}
|
|
1143
|
+
if (o.pattern && typeof t == "string" && !o.pattern.test(t))
|
|
1144
|
+
return o.message ?? "Invalid format";
|
|
1145
|
+
if (o.validator) {
|
|
1146
|
+
const s = await o.validator(t);
|
|
1147
|
+
if (s)
|
|
1148
|
+
return s;
|
|
1149
|
+
}
|
|
1150
|
+
}
|
|
1151
|
+
}
|
|
1152
|
+
return null;
|
|
1153
|
+
}
|
|
1154
|
+
function Kt(t, i) {
|
|
1155
|
+
const o = t ? [...t] : [];
|
|
1156
|
+
return i && !o.some((s) => s.required) && o.unshift({ required: !0, message: "This field is required" }), o;
|
|
1157
|
+
}
|
|
1158
|
+
function Xt(t) {
|
|
1159
|
+
return t.some((i) => i.required);
|
|
1160
|
+
}
|
|
1161
|
+
function he() {
|
|
1162
|
+
const t = dt(it), i = S({}), o = S({}), s = S({}), a = X(() => ({
|
|
1163
|
+
getFieldValue: (l) => i.current[l],
|
|
1164
|
+
setFieldValue: (l, g) => {
|
|
1165
|
+
i.current[l] = g;
|
|
1166
|
+
},
|
|
1167
|
+
getFieldsValue: () => ({ ...i.current }),
|
|
1168
|
+
setFieldsValue: (l) => {
|
|
1169
|
+
Object.assign(i.current, l);
|
|
1170
|
+
},
|
|
1171
|
+
validateFields: () => Promise.resolve({ ...i.current }),
|
|
1172
|
+
validateField: (l) => Promise.resolve(!0),
|
|
1173
|
+
resetFields: () => {
|
|
1174
|
+
i.current = {}, o.current = {}, s.current = {};
|
|
1175
|
+
},
|
|
1176
|
+
getFieldError: (l) => o.current[l] ?? null,
|
|
1177
|
+
isFieldTouched: (l) => s.current[l] ?? !1
|
|
1178
|
+
}), []);
|
|
1179
|
+
return t ? t.instance : a;
|
|
1180
|
+
}
|
|
1181
|
+
function Zt({
|
|
1182
|
+
onSubmit: t,
|
|
1183
|
+
onValuesChange: i,
|
|
1184
|
+
initialValues: o = {},
|
|
1185
|
+
layout: s = "vertical",
|
|
1186
|
+
disabled: a = !1,
|
|
1187
|
+
children: l,
|
|
1188
|
+
className: g,
|
|
1189
|
+
style: h,
|
|
1190
|
+
form: u
|
|
1191
|
+
}) {
|
|
1192
|
+
const m = ut(), [e, x] = nt({
|
|
1193
|
+
values: { ...o },
|
|
1194
|
+
errors: {},
|
|
1195
|
+
touched: {}
|
|
1196
|
+
}), w = S(o), b = S({}), v = S(e);
|
|
1197
|
+
v.current = e;
|
|
1198
|
+
const E = k((f, r) => {
|
|
1199
|
+
b.current[f] = r;
|
|
1200
|
+
}, []), I = k((f) => {
|
|
1201
|
+
delete b.current[f];
|
|
1202
|
+
}, []), W = k((f, r) => {
|
|
1203
|
+
x((n) => {
|
|
1204
|
+
const p = {
|
|
1205
|
+
...n,
|
|
1206
|
+
values: { ...n.values, [f]: r }
|
|
1207
|
+
};
|
|
1208
|
+
return i == null || i({ [f]: r }, p.values), p;
|
|
1209
|
+
});
|
|
1210
|
+
}, [i]), H = k((f, r) => {
|
|
1211
|
+
x((n) => ({
|
|
1212
|
+
...n,
|
|
1213
|
+
errors: { ...n.errors, [f]: r }
|
|
1214
|
+
}));
|
|
1215
|
+
}, []), F = k((f) => {
|
|
1216
|
+
x((r) => ({
|
|
1217
|
+
...r,
|
|
1218
|
+
touched: { ...r.touched, [f]: !0 }
|
|
1219
|
+
}));
|
|
1220
|
+
}, []), j = k(async (f) => {
|
|
1221
|
+
const r = b.current[f];
|
|
1222
|
+
if (!r) return !0;
|
|
1223
|
+
const n = v.current.values[f], p = await lt(n, r.rules);
|
|
1224
|
+
return x((y) => ({
|
|
1225
|
+
...y,
|
|
1226
|
+
errors: { ...y.errors, [f]: p },
|
|
1227
|
+
touched: { ...y.touched, [f]: !0 }
|
|
1228
|
+
})), p === null;
|
|
1229
|
+
}, []), R = k(async () => {
|
|
1230
|
+
const f = Object.keys(b.current), r = await Promise.all(
|
|
1231
|
+
f.map(async ($) => {
|
|
1232
|
+
const T = b.current[$], bt = v.current.values[$], vt = await lt(bt, T.rules);
|
|
1233
|
+
return { name: $, error: vt };
|
|
1234
|
+
})
|
|
1235
|
+
), n = {}, p = {};
|
|
1236
|
+
let y = !1;
|
|
1237
|
+
for (const { name: $, error: T } of r)
|
|
1238
|
+
n[$] = T, p[$] = !0, T && (y = !0);
|
|
1239
|
+
if (x(($) => ({
|
|
1240
|
+
...$,
|
|
1241
|
+
errors: { ...$.errors, ...n },
|
|
1242
|
+
touched: { ...$.touched, ...p }
|
|
1243
|
+
})), y) {
|
|
1244
|
+
const $ = Object.fromEntries(
|
|
1245
|
+
r.filter((T) => T.error).map((T) => [T.name, T.error])
|
|
1246
|
+
);
|
|
1247
|
+
return Promise.reject($);
|
|
1248
|
+
}
|
|
1249
|
+
return { ...v.current.values };
|
|
1250
|
+
}, []), O = k(() => {
|
|
1251
|
+
x({
|
|
1252
|
+
values: { ...w.current },
|
|
1253
|
+
errors: {},
|
|
1254
|
+
touched: {}
|
|
1255
|
+
});
|
|
1256
|
+
}, []), B = X(() => ({
|
|
1257
|
+
getFieldValue: (f) => v.current.values[f],
|
|
1258
|
+
setFieldValue: W,
|
|
1259
|
+
getFieldsValue: () => ({ ...v.current.values }),
|
|
1260
|
+
setFieldsValue: (f) => {
|
|
1261
|
+
x((r) => {
|
|
1262
|
+
const n = { ...r.values, ...f };
|
|
1263
|
+
return i == null || i(f, n), { ...r, values: n };
|
|
1264
|
+
});
|
|
1265
|
+
},
|
|
1266
|
+
validateFields: R,
|
|
1267
|
+
validateField: j,
|
|
1268
|
+
resetFields: O,
|
|
1269
|
+
getFieldError: (f) => v.current.errors[f] ?? null,
|
|
1270
|
+
isFieldTouched: (f) => !!v.current.touched[f]
|
|
1271
|
+
}), [W, R, j, O, i]), N = k(async (f) => {
|
|
1272
|
+
f.preventDefault();
|
|
1273
|
+
try {
|
|
1274
|
+
const r = await R();
|
|
1275
|
+
await (t == null ? void 0 : t(r));
|
|
1276
|
+
} catch {
|
|
1277
|
+
}
|
|
1278
|
+
}, [R, t]), q = M(s === "inline" ? "flex flex-row flex-wrap items-end gap-4" : "flex flex-col gap-5"), P = u ?? B, Y = X(() => ({
|
|
1279
|
+
state: e,
|
|
1280
|
+
initialValues: w.current,
|
|
1281
|
+
layout: s,
|
|
1282
|
+
disabled: a,
|
|
1283
|
+
fieldMeta: b,
|
|
1284
|
+
setFieldValue: W,
|
|
1285
|
+
setFieldError: H,
|
|
1286
|
+
setFieldTouched: F,
|
|
1287
|
+
registerField: E,
|
|
1288
|
+
unregisterField: I,
|
|
1289
|
+
validateField: j,
|
|
1290
|
+
instance: P
|
|
1291
|
+
}), [e, s, a, W, H, F, E, I, j, P]);
|
|
1292
|
+
return /* @__PURE__ */ _(it.Provider, { value: Y, children: /* @__PURE__ */ _(
|
|
1293
|
+
"form",
|
|
1294
|
+
{
|
|
1295
|
+
noValidate: !0,
|
|
1296
|
+
role: "form",
|
|
1297
|
+
"aria-label": "Form",
|
|
1298
|
+
onSubmit: N,
|
|
1299
|
+
className: V(q, g),
|
|
1300
|
+
style: {
|
|
1301
|
+
color: m.text,
|
|
1302
|
+
...h
|
|
1303
|
+
},
|
|
1304
|
+
children: l
|
|
1305
|
+
}
|
|
1306
|
+
) });
|
|
1307
|
+
}
|
|
1308
|
+
Zt.displayName = "TkxForm";
|
|
1309
|
+
function Jt({
|
|
1310
|
+
name: t,
|
|
1311
|
+
label: i,
|
|
1312
|
+
rules: o,
|
|
1313
|
+
help: s,
|
|
1314
|
+
required: a,
|
|
1315
|
+
children: l,
|
|
1316
|
+
className: g,
|
|
1317
|
+
style: h
|
|
1318
|
+
}) {
|
|
1319
|
+
const u = ut(), m = Ut(), { state: e, layout: x, disabled: w } = m, b = X(() => Kt(o, a), [o, a]), v = Xt(b), E = S({ rules: b });
|
|
1320
|
+
E.current.rules = b;
|
|
1321
|
+
const I = S(!1);
|
|
1322
|
+
I.current || (m.registerField(t, E.current), I.current = !0), X(() => {
|
|
1323
|
+
m.registerField(t, E.current);
|
|
1324
|
+
}, [b, t, m]);
|
|
1325
|
+
const W = e.values[t], H = e.touched[t] ? e.errors[t] ?? null : null, F = H ? K(H) : null, j = i ? K(i) : void 0, R = s ? K(s) : void 0, O = k(
|
|
1326
|
+
(n) => {
|
|
1327
|
+
let p;
|
|
1328
|
+
if (n !== null && typeof n == "object" && "target" in n) {
|
|
1329
|
+
const y = n.target;
|
|
1330
|
+
p = y.type === "checkbox" ? y.checked : y.value;
|
|
1331
|
+
} else
|
|
1332
|
+
p = n;
|
|
1333
|
+
m.setFieldValue(t, p);
|
|
1334
|
+
},
|
|
1335
|
+
[m, t]
|
|
1336
|
+
), B = k(() => {
|
|
1337
|
+
m.setFieldTouched(t), m.validateField(t);
|
|
1338
|
+
}, [m, t]), N = wt(l, {
|
|
1339
|
+
value: W ?? "",
|
|
1340
|
+
onChange: O,
|
|
1341
|
+
onBlur: B,
|
|
1342
|
+
error: F ?? void 0,
|
|
1343
|
+
isInvalid: !!F,
|
|
1344
|
+
isRequired: v,
|
|
1345
|
+
disabled: w || l.props.disabled,
|
|
1346
|
+
name: t
|
|
1347
|
+
}), q = x === "horizontal", P = x === "inline", Y = /* @__PURE__ */ _("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ _("path", { d: "M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z" }) }), f = j ? /* @__PURE__ */ L(
|
|
1348
|
+
"label",
|
|
1349
|
+
{
|
|
1350
|
+
className: M(
|
|
1351
|
+
"text-sm font-medium font-sans",
|
|
1352
|
+
q ? "min-w-[140px] pt-2.5" : ""
|
|
1353
|
+
),
|
|
1354
|
+
style: { color: u.text },
|
|
1355
|
+
children: [
|
|
1356
|
+
j,
|
|
1357
|
+
v && /* @__PURE__ */ _("span", { "aria-hidden": "true", className: M("ml-1"), style: { color: u.danger }, children: "*" })
|
|
1358
|
+
]
|
|
1359
|
+
}
|
|
1360
|
+
) : null, r = /* @__PURE__ */ L(jt, { children: [
|
|
1361
|
+
R && !F && /* @__PURE__ */ _("span", { className: M("text-xs mt-0.5"), style: { color: u.textMuted }, children: R }),
|
|
1362
|
+
F && /* @__PURE__ */ L(
|
|
1363
|
+
"span",
|
|
1364
|
+
{
|
|
1365
|
+
role: "alert",
|
|
1366
|
+
className: M("text-xs flex items-center gap-1 mt-0.5"),
|
|
1367
|
+
style: {
|
|
1368
|
+
color: u.danger,
|
|
1369
|
+
animation: "tkxFormErrorReveal 200ms ease-out"
|
|
1370
|
+
},
|
|
1371
|
+
children: [
|
|
1372
|
+
Y,
|
|
1373
|
+
F
|
|
1374
|
+
]
|
|
1375
|
+
}
|
|
1376
|
+
)
|
|
1377
|
+
] });
|
|
1378
|
+
return P ? /* @__PURE__ */ L(
|
|
1379
|
+
"div",
|
|
1380
|
+
{
|
|
1381
|
+
className: V(M("flex flex-col gap-1"), g),
|
|
1382
|
+
style: h,
|
|
1383
|
+
children: [
|
|
1384
|
+
f,
|
|
1385
|
+
N,
|
|
1386
|
+
r
|
|
1387
|
+
]
|
|
1388
|
+
}
|
|
1389
|
+
) : q ? /* @__PURE__ */ L(
|
|
1390
|
+
"div",
|
|
1391
|
+
{
|
|
1392
|
+
className: V(M("flex flex-row gap-4 items-start"), g),
|
|
1393
|
+
style: h,
|
|
1394
|
+
children: [
|
|
1395
|
+
f,
|
|
1396
|
+
/* @__PURE__ */ L("div", { className: M("flex flex-col gap-1 flex-1 min-w-0"), children: [
|
|
1397
|
+
N,
|
|
1398
|
+
r
|
|
1399
|
+
] })
|
|
1400
|
+
]
|
|
1401
|
+
}
|
|
1402
|
+
) : /* @__PURE__ */ L(
|
|
1403
|
+
"div",
|
|
1404
|
+
{
|
|
1405
|
+
className: V(M("flex flex-col gap-1"), g),
|
|
1406
|
+
style: h,
|
|
1407
|
+
children: [
|
|
1408
|
+
f,
|
|
1409
|
+
N,
|
|
1410
|
+
r
|
|
1411
|
+
]
|
|
1412
|
+
}
|
|
1413
|
+
);
|
|
1414
|
+
}
|
|
1415
|
+
Jt.displayName = "TkxFormField";
|
|
1416
|
+
let ft = !1;
|
|
1417
|
+
function Vt() {
|
|
1418
|
+
if (ft || typeof document > "u") return;
|
|
1419
|
+
ft = !0;
|
|
1420
|
+
const t = document.createElement("style");
|
|
1421
|
+
t.setAttribute("data-tkx-form", ""), t.textContent = `
|
|
1422
|
+
@keyframes tkxFormErrorReveal {
|
|
1423
|
+
from {
|
|
1424
|
+
opacity: 0;
|
|
1425
|
+
transform: translateY(-4px);
|
|
1426
|
+
}
|
|
1427
|
+
to {
|
|
1428
|
+
opacity: 1;
|
|
1429
|
+
transform: translateY(0);
|
|
1430
|
+
}
|
|
1431
|
+
}
|
|
1432
|
+
`, document.head.appendChild(t);
|
|
1433
|
+
}
|
|
1434
|
+
Vt();
|
|
1435
|
+
export {
|
|
1436
|
+
re as S,
|
|
1437
|
+
Zt as T,
|
|
1438
|
+
se as a,
|
|
1439
|
+
oe as b,
|
|
1440
|
+
V as c,
|
|
1441
|
+
ae as d,
|
|
1442
|
+
ce as e,
|
|
1443
|
+
Jt as f,
|
|
1444
|
+
At as g,
|
|
1445
|
+
fe as h,
|
|
1446
|
+
Ct as i,
|
|
1447
|
+
Gt as j,
|
|
1448
|
+
pt as k,
|
|
1449
|
+
me as l,
|
|
1450
|
+
ue as m,
|
|
1451
|
+
pe as n,
|
|
1452
|
+
le as o,
|
|
1453
|
+
ie as p,
|
|
1454
|
+
he as q,
|
|
1455
|
+
de as r,
|
|
1456
|
+
K as s,
|
|
1457
|
+
M as t,
|
|
1458
|
+
ne as u,
|
|
1459
|
+
Et as v,
|
|
1460
|
+
It as w
|
|
1461
|
+
};
|