@kbach/react-native 1.0.0-beta.2 → 1.0.0-beta.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/README.md +253 -87
  2. package/android/build.gradle +36 -0
  3. package/android/src/main/AndroidManifest.xml +14 -0
  4. package/android/src/main/java/com/kbachnative/KbachModule.kt +83 -0
  5. package/android/src/main/java/com/kbachnative/KbachPackage.kt +54 -0
  6. package/android/src/main/jniLibs/arm64-v8a/libkbach_core_engine.so +0 -0
  7. package/android/src/main/jniLibs/x86_64/libkbach_core_engine.so +0 -0
  8. package/dist/chunk-AG7ZQ2K4.mjs +552 -0
  9. package/dist/chunk-OS7EPBH5.mjs +40 -0
  10. package/dist/chunk-TS2EEVOE.mjs +107 -0
  11. package/dist/darkModeStore.d.ts +58 -0
  12. package/dist/darkModeStore.js +112 -0
  13. package/dist/dynamicTokens.d.ts +36 -0
  14. package/dist/dynamicTokens.js +75 -0
  15. package/dist/index.d.ts +53 -102
  16. package/dist/index.js +1721 -385
  17. package/dist/index.web.d.ts +18 -0
  18. package/dist/index.web.js +436 -0
  19. package/dist/index.web.mjs +210 -0
  20. package/dist/jsx-dev-runtime.d.ts +3 -12
  21. package/dist/jsx-dev-runtime.js +1738 -343
  22. package/dist/jsx-dev-runtime.web.d.ts +10 -0
  23. package/dist/jsx-dev-runtime.web.js +270 -0
  24. package/dist/jsx-dev-runtime.web.mjs +29 -0
  25. package/dist/jsx-runtime.d.ts +3 -23
  26. package/dist/jsx-runtime.js +1729 -335
  27. package/dist/jsx-runtime.web.d.ts +7 -0
  28. package/dist/jsx-runtime.web.js +252 -0
  29. package/dist/{jsx-runtime.mjs → jsx-runtime.web.mjs} +2 -2
  30. package/dist/theme.d.ts +54 -0
  31. package/dist/{chunk-YHF3QLRL.mjs → theme.js} +94 -72
  32. package/dist/useDynamicToken-Dr15c88t.d.ts +160 -0
  33. package/package.json +62 -14
  34. package/react-native.config.js +29 -0
  35. package/specs/NativeKbachModule.ts +31 -0
  36. package/src/babel-plugin.js +74 -2
  37. package/dist/chunk-SVMYVXY6.mjs +0 -44
  38. package/dist/index.d.mts +0 -148
  39. package/dist/index.mjs +0 -80
  40. package/dist/jsx-dev-runtime.d.mts +0 -19
  41. package/dist/jsx-dev-runtime.mjs +0 -20
  42. package/dist/jsx-runtime.d.mts +0 -27
@@ -25,350 +25,499 @@ __export(jsx_dev_runtime_exports, {
25
25
  });
26
26
  module.exports = __toCommonJS(jsx_dev_runtime_exports);
27
27
 
28
- // src/jsx-runtime.tsx
28
+ // src/jsxRuntimeCore.ts
29
29
  var import_jsx_runtime = require("react/jsx-runtime");
30
30
  var import_react = require("react");
31
- var import_react_native3 = require("react-native");
32
-
33
- // src/nativeBridge.ts
34
- var import_react_native2 = require("react-native");
31
+ var import_react_native = require("react-native");
32
+ var import_darkModeStore = require("./darkModeStore");
33
+ var import_dynamicTokens = require("./dynamicTokens");
35
34
 
36
- // src/generatedPalette.ts
37
- var PALETTE = {
38
- "amber-1": "#fffbeb",
39
- "amber-10": "#78350f",
40
- "amber-11": "#451a03",
41
- "amber-12": "#291002",
42
- "amber-2": "#fef3c7",
43
- "amber-3": "#fde68a",
44
- "amber-4": "#fcd34d",
45
- "amber-5": "#fbbf24",
46
- "amber-6": "#f59e0b",
47
- "amber-7": "#d97706",
48
- "amber-8": "#b45309",
49
- "amber-9": "#92400e",
50
- "black": "#000000",
51
- "blue-1": "#eff6ff",
52
- "blue-10": "#1e3a8a",
53
- "blue-11": "#172554",
54
- "blue-12": "#0d1633",
55
- "blue-2": "#dbeafe",
56
- "blue-3": "#bfdbfe",
57
- "blue-4": "#93c5fd",
58
- "blue-5": "#60a5fa",
59
- "blue-6": "#3b82f6",
60
- "blue-7": "#2563eb",
61
- "blue-8": "#1d4ed8",
62
- "blue-9": "#1e40af",
63
- "bronze": "#cd7f32",
64
- "coal": "#1c1c1c",
65
- "copper": "#b87333",
66
- "current": "currentColor",
67
- "cyan-1": "#ecfeff",
68
- "cyan-10": "#164e63",
69
- "cyan-11": "#083344",
70
- "cyan-12": "#041e28",
71
- "cyan-2": "#cffafe",
72
- "cyan-3": "#a5f3fc",
73
- "cyan-4": "#67e8f9",
74
- "cyan-5": "#22d3ee",
75
- "cyan-6": "#06b6d4",
76
- "cyan-7": "#0891b2",
77
- "cyan-8": "#0e7490",
78
- "cyan-9": "#155e75",
79
- "emerald-1": "#ecfdf5",
80
- "emerald-10": "#064e3b",
81
- "emerald-11": "#022c22",
82
- "emerald-12": "#011a14",
83
- "emerald-2": "#d1fae5",
84
- "emerald-3": "#a7f3d0",
85
- "emerald-4": "#6ee7b7",
86
- "emerald-5": "#34d399",
87
- "emerald-6": "#10b981",
88
- "emerald-7": "#059669",
89
- "emerald-8": "#047857",
90
- "emerald-9": "#065f46",
91
- "fuchsia-1": "#fdf4ff",
92
- "fuchsia-10": "#701a75",
93
- "fuchsia-11": "#4a044e",
94
- "fuchsia-12": "#2d022f",
95
- "fuchsia-2": "#fae8ff",
96
- "fuchsia-3": "#f5d0fe",
97
- "fuchsia-4": "#f0abfc",
98
- "fuchsia-5": "#e879f9",
99
- "fuchsia-6": "#d946ef",
100
- "fuchsia-7": "#c026d3",
101
- "fuchsia-8": "#a21caf",
102
- "fuchsia-9": "#86198f",
103
- "gold": "#d4af37",
104
- "gray-1": "#f9fafb",
105
- "gray-10": "#111827",
106
- "gray-11": "#030712",
107
- "gray-12": "#020409",
108
- "gray-2": "#f3f4f6",
109
- "gray-3": "#e5e7eb",
110
- "gray-4": "#d1d5db",
111
- "gray-5": "#9ca3af",
112
- "gray-6": "#6b7280",
113
- "gray-7": "#4b5563",
114
- "gray-8": "#374151",
115
- "gray-9": "#1f2937",
116
- "green-1": "#f0fdf4",
117
- "green-10": "#14532d",
118
- "green-11": "#052e16",
119
- "green-12": "#031b0d",
120
- "green-2": "#dcfce7",
121
- "green-3": "#bbf7d0",
122
- "green-4": "#86efac",
123
- "green-5": "#4ade80",
124
- "green-6": "#22c55e",
125
- "green-7": "#16a34a",
126
- "green-8": "#15803d",
127
- "green-9": "#166534",
128
- "indigo-1": "#eef2ff",
129
- "indigo-10": "#312e81",
130
- "indigo-11": "#1e1b4b",
131
- "indigo-12": "#12102d",
132
- "indigo-2": "#e0e7ff",
133
- "indigo-3": "#c7d2fe",
134
- "indigo-4": "#a5b4fc",
135
- "indigo-5": "#818cf8",
136
- "indigo-6": "#6366f1",
137
- "indigo-7": "#4f46e5",
138
- "indigo-8": "#4338ca",
139
- "indigo-9": "#3730a3",
140
- "lime-1": "#f7fee7",
141
- "lime-10": "#365314",
142
- "lime-11": "#1a2e05",
143
- "lime-12": "#0f1b03",
144
- "lime-2": "#ecfccb",
145
- "lime-3": "#d9f99d",
146
- "lime-4": "#bef264",
147
- "lime-5": "#a3e635",
148
- "lime-6": "#84cc16",
149
- "lime-7": "#65a30d",
150
- "lime-8": "#4d7c0f",
151
- "lime-9": "#3f6212",
152
- "neutral-1": "#fafafa",
153
- "neutral-10": "#171717",
154
- "neutral-11": "#0a0a0a",
155
- "neutral-12": "#050505",
156
- "neutral-2": "#f5f5f5",
157
- "neutral-3": "#e5e5e5",
158
- "neutral-4": "#d4d4d4",
159
- "neutral-5": "#a3a3a3",
160
- "neutral-6": "#737373",
161
- "neutral-7": "#525252",
162
- "neutral-8": "#404040",
163
- "neutral-9": "#262626",
164
- "orange-1": "#fff7ed",
165
- "orange-10": "#7c2d12",
166
- "orange-11": "#431407",
167
- "orange-12": "#270c04",
168
- "orange-2": "#ffedd5",
169
- "orange-3": "#fed7aa",
170
- "orange-4": "#fdba74",
171
- "orange-5": "#fb923c",
172
- "orange-6": "#f97316",
173
- "orange-7": "#ea580c",
174
- "orange-8": "#c2410c",
175
- "orange-9": "#9a3412",
176
- "pink-1": "#fdf2f8",
177
- "pink-10": "#831843",
178
- "pink-11": "#500724",
179
- "pink-12": "#300415",
180
- "pink-2": "#fce7f3",
181
- "pink-3": "#fbcfe8",
182
- "pink-4": "#f9a8d4",
183
- "pink-5": "#f472b6",
184
- "pink-6": "#ec4899",
185
- "pink-7": "#db2777",
186
- "pink-8": "#be185d",
187
- "pink-9": "#9d174d",
188
- "purple-1": "#faf5ff",
189
- "purple-10": "#581c87",
190
- "purple-11": "#3b0764",
191
- "purple-12": "#23043c",
192
- "purple-2": "#f3e8ff",
193
- "purple-3": "#e9d5ff",
194
- "purple-4": "#d8b4fe",
195
- "purple-5": "#c084fc",
196
- "purple-6": "#a855f7",
197
- "purple-7": "#9333ea",
198
- "purple-8": "#7e22ce",
199
- "purple-9": "#6b21a8",
200
- "red-1": "#fef2f2",
201
- "red-10": "#7f1d1d",
202
- "red-11": "#450a0a",
203
- "red-12": "#280606",
204
- "red-2": "#fee2e2",
205
- "red-3": "#fecaca",
206
- "red-4": "#fca5a5",
207
- "red-5": "#f87171",
208
- "red-6": "#ef4444",
209
- "red-7": "#dc2626",
210
- "red-8": "#b91c1c",
211
- "red-9": "#991b1b",
212
- "rose-1": "#fff1f2",
213
- "rose-10": "#881337",
214
- "rose-11": "#4c0519",
215
- "rose-12": "#2d030e",
216
- "rose-2": "#ffe4e6",
217
- "rose-3": "#fecdd3",
218
- "rose-4": "#fda4af",
219
- "rose-5": "#fb7185",
220
- "rose-6": "#f43f5e",
221
- "rose-7": "#e11d48",
222
- "rose-8": "#be123c",
223
- "rose-9": "#9f1239",
224
- "silver": "#c0c0c0",
225
- "sky-1": "#f0f9ff",
226
- "sky-10": "#0c4a6e",
227
- "sky-11": "#082f49",
228
- "sky-12": "#041b2b",
229
- "sky-2": "#e0f2fe",
230
- "sky-3": "#bae6fd",
231
- "sky-4": "#7dd3fc",
232
- "sky-5": "#38bdf8",
233
- "sky-6": "#0ea5e9",
234
- "sky-7": "#0284c7",
235
- "sky-8": "#0369a1",
236
- "sky-9": "#075985",
237
- "slate-1": "#f8fafc",
238
- "slate-10": "#0f172a",
239
- "slate-11": "#020617",
240
- "slate-12": "#01020a",
241
- "slate-2": "#f1f5f9",
242
- "slate-3": "#e2e8f0",
243
- "slate-4": "#cbd5e1",
244
- "slate-5": "#94a3b8",
245
- "slate-6": "#64748b",
246
- "slate-7": "#475569",
247
- "slate-8": "#334155",
248
- "slate-9": "#1e293b",
249
- "stone-1": "#fafaf9",
250
- "stone-10": "#1c1917",
251
- "stone-11": "#0c0a09",
252
- "stone-12": "#070605",
253
- "stone-2": "#f5f5f4",
254
- "stone-3": "#e7e5e4",
255
- "stone-4": "#d6d3d1",
256
- "stone-5": "#a8a29e",
257
- "stone-6": "#78716c",
258
- "stone-7": "#57534e",
259
- "stone-8": "#44403c",
260
- "stone-9": "#292524",
261
- "teal-1": "#f0fdfa",
262
- "teal-10": "#134e4a",
263
- "teal-11": "#042f2e",
264
- "teal-12": "#021c1b",
265
- "teal-2": "#ccfbf1",
266
- "teal-3": "#99f6e4",
267
- "teal-4": "#5eead4",
268
- "teal-5": "#2dd4bf",
269
- "teal-6": "#14b8a6",
270
- "teal-7": "#0d9488",
271
- "teal-8": "#0f766e",
272
- "teal-9": "#115e59",
273
- "transparent": "transparent",
274
- "violet-1": "#f5f3ff",
275
- "violet-10": "#4c1d95",
276
- "violet-11": "#2e1065",
277
- "violet-12": "#1c0a3d",
278
- "violet-2": "#ede9fe",
279
- "violet-3": "#ddd6fe",
280
- "violet-4": "#c4b5fd",
281
- "violet-5": "#a78bfa",
282
- "violet-6": "#8b5cf6",
283
- "violet-7": "#7c3aed",
284
- "violet-8": "#6d28d9",
285
- "violet-9": "#5b21b6",
286
- "white": "#ffffff",
287
- "yellow-1": "#fefce8",
288
- "yellow-10": "#713f12",
289
- "yellow-11": "#422006",
290
- "yellow-12": "#271304",
291
- "yellow-2": "#fef9c3",
292
- "yellow-3": "#fef08a",
293
- "yellow-4": "#fde047",
294
- "yellow-5": "#facc15",
295
- "yellow-6": "#eab308",
296
- "yellow-7": "#ca8a04",
297
- "yellow-8": "#a16207",
298
- "yellow-9": "#854d0e",
299
- "zinc-1": "#fafafa",
300
- "zinc-10": "#18181b",
301
- "zinc-11": "#09090b",
302
- "zinc-12": "#050506",
303
- "zinc-2": "#f4f4f5",
304
- "zinc-3": "#e4e4e7",
305
- "zinc-4": "#d4d4d8",
306
- "zinc-5": "#a1a1aa",
307
- "zinc-6": "#71717a",
308
- "zinc-7": "#52525b",
309
- "zinc-8": "#3f3f46",
310
- "zinc-9": "#27272a"
35
+ // src/jsEngine/calc.ts
36
+ function reduceConstantMath(raw) {
37
+ const trimmed = raw.trim();
38
+ const calc = stripCall(trimmed, "calc");
39
+ if (calc !== null) {
40
+ return new Evaluator(calc).parseExprToEnd();
41
+ }
42
+ const clamp = stripCall(trimmed, "clamp");
43
+ if (clamp !== null) {
44
+ const args = splitTopLevelCommas(clamp);
45
+ if (args.length !== 3) return null;
46
+ const [min2, preferred, max2] = args.map((a) => new Evaluator(a).parseExprToEnd());
47
+ if (min2 === null || preferred === null || max2 === null) return null;
48
+ return Math.max(min2, Math.min(preferred, max2));
49
+ }
50
+ const min = stripCall(trimmed, "min");
51
+ if (min !== null) {
52
+ const values = splitTopLevelCommas(min).map((a) => new Evaluator(a).parseExprToEnd());
53
+ return values.some((v) => v === null) ? null : Math.min(...values);
54
+ }
55
+ const max = stripCall(trimmed, "max");
56
+ if (max !== null) {
57
+ const values = splitTopLevelCommas(max).map((a) => new Evaluator(a).parseExprToEnd());
58
+ return values.some((v) => v === null) ? null : Math.max(...values);
59
+ }
60
+ return null;
61
+ }
62
+ function stripCall(raw, name) {
63
+ if (!raw.startsWith(name)) return null;
64
+ const afterName = raw.slice(name.length).trimStart();
65
+ if (!afterName.startsWith("(") || !afterName.endsWith(")")) return null;
66
+ return afterName.slice(1, -1);
67
+ }
68
+ function splitTopLevelCommas(s) {
69
+ const parts = [];
70
+ let depth = 0;
71
+ let start = 0;
72
+ for (let i = 0; i < s.length; i++) {
73
+ const ch = s[i];
74
+ if (ch === "(") depth++;
75
+ else if (ch === ")") depth--;
76
+ else if (ch === "," && depth === 0) {
77
+ parts.push(s.slice(start, i).trim());
78
+ start = i + 1;
79
+ }
80
+ }
81
+ parts.push(s.slice(start).trim());
82
+ return parts;
83
+ }
84
+ var Evaluator = class {
85
+ constructor(s) {
86
+ this.pos = 0;
87
+ this.s = s;
88
+ }
89
+ parseExprToEnd() {
90
+ const value = this.expr();
91
+ if (value === null) return null;
92
+ this.skipWs();
93
+ return this.pos === this.s.length ? value : null;
94
+ }
95
+ skipWs() {
96
+ while (this.pos < this.s.length && /\s/.test(this.s[this.pos])) this.pos++;
97
+ }
98
+ peek() {
99
+ this.skipWs();
100
+ return this.s[this.pos];
101
+ }
102
+ expr() {
103
+ let value = this.term();
104
+ if (value === null) return null;
105
+ for (; ; ) {
106
+ const ch = this.peek();
107
+ if (ch === "+") {
108
+ this.pos++;
109
+ const rhs = this.term();
110
+ if (rhs === null) return null;
111
+ value += rhs;
112
+ } else if (ch === "-") {
113
+ this.pos++;
114
+ const rhs = this.term();
115
+ if (rhs === null) return null;
116
+ value -= rhs;
117
+ } else {
118
+ return value;
119
+ }
120
+ }
121
+ }
122
+ term() {
123
+ let value = this.factor();
124
+ if (value === null) return null;
125
+ for (; ; ) {
126
+ const ch = this.peek();
127
+ if (ch === "*") {
128
+ this.pos++;
129
+ const rhs = this.factor();
130
+ if (rhs === null) return null;
131
+ value *= rhs;
132
+ } else if (ch === "/") {
133
+ this.pos++;
134
+ const divisor = this.factor();
135
+ if (divisor === null || divisor === 0) return null;
136
+ value /= divisor;
137
+ } else {
138
+ return value;
139
+ }
140
+ }
141
+ }
142
+ factor() {
143
+ const ch = this.peek();
144
+ if (ch === void 0) return null;
145
+ if (ch === "(") {
146
+ this.pos++;
147
+ const value = this.expr();
148
+ if (value === null || this.peek() !== ")") return null;
149
+ this.pos++;
150
+ return value;
151
+ }
152
+ if (ch === "-") {
153
+ this.pos++;
154
+ const value = this.factor();
155
+ return value === null ? null : -value;
156
+ }
157
+ return this.numberWithUnit();
158
+ }
159
+ numberWithUnit() {
160
+ this.skipWs();
161
+ const start = this.pos;
162
+ while (this.pos < this.s.length && (/[0-9]/.test(this.s[this.pos]) || this.s[this.pos] === ".")) this.pos++;
163
+ if (this.pos === start) return null;
164
+ const n = Number(this.s.slice(start, this.pos));
165
+ if (!Number.isFinite(n)) return null;
166
+ const unitStart = this.pos;
167
+ while (this.pos < this.s.length && /[a-zA-Z]/.test(this.s[this.pos])) this.pos++;
168
+ const unit = this.s.slice(unitStart, this.pos);
169
+ switch (unit) {
170
+ case "":
171
+ return n;
172
+ case "px":
173
+ return n;
174
+ case "rem":
175
+ return n * 16;
176
+ default:
177
+ return null;
178
+ }
179
+ }
311
180
  };
312
181
 
313
- // src/theme.ts
314
- var defaultTheme = {
315
- colors: PALETTE,
316
- spacing: {
317
- // "0" is always a hardcoded zero in real Tailwind's own scale too,
318
- // regardless of the base spacing unit — needed for `p-0`/`m-0`/etc.
319
- // Mirrors the identical fix in @kbach/react's theme.ts.
320
- "0": 0,
321
- "1": 4,
322
- "2": 8,
323
- "4": 16,
324
- "6": 24,
325
- "8": 32
326
- },
327
- screens: {},
328
- darkMode: "attribute"
329
- };
330
- var activeThemeJson = JSON.stringify(defaultTheme);
331
- function getThemeJson() {
332
- return activeThemeJson;
182
+ // src/layoutCalc.ts
183
+ var PERCENT_CALC_TOKEN_RE = /^(w|h)-\[calc\(([^)]+)\)\]$/;
184
+ function parsePercentRelativeCalc(token) {
185
+ const m = PERCENT_CALC_TOKEN_RE.exec(token);
186
+ if (!m) return null;
187
+ const property = m[1] === "w" ? "width" : "height";
188
+ const inner = m[2].replace(/_/g, " ").trim();
189
+ let mm = /^(-?[\d.]+)%\s*([+-])\s*(.+)$/.exec(inner);
190
+ if (mm) {
191
+ const percentCoefficient = Number(mm[1]);
192
+ const magnitude = reduceConstantMath(`calc(${mm[3].trim()})`);
193
+ if (!Number.isFinite(percentCoefficient) || magnitude === null) return null;
194
+ return { property, percentCoefficient, constantPx: mm[2] === "+" ? magnitude : -magnitude };
195
+ }
196
+ mm = /^(.+?)\s*([+-])\s*(-?[\d.]+)%$/.exec(inner);
197
+ if (mm) {
198
+ const constantPx = reduceConstantMath(`calc(${mm[1].trim()})`);
199
+ const percentMagnitude = Number(mm[3]);
200
+ if (constantPx === null || !Number.isFinite(percentMagnitude)) return null;
201
+ return { property, percentCoefficient: mm[2] === "+" ? percentMagnitude : -percentMagnitude, constantPx };
202
+ }
203
+ return null;
204
+ }
205
+ function resolvePercentRelativeCalc(basisPx, calc) {
206
+ return basisPx * calc.percentCoefficient / 100 + calc.constantPx;
333
207
  }
334
208
 
335
- // src/darkModeStore.ts
336
- var import_react_native = require("react-native");
337
- var listeners = /* @__PURE__ */ new Set();
338
- function systemPrefersDark() {
339
- return import_react_native.Appearance.getColorScheme() === "dark";
340
- }
341
- function resolveIsDark(m) {
342
- return m === "system" ? systemPrefersDark() : m === "dark";
343
- }
344
- var mode = "system";
345
- var isDark = resolveIsDark(mode);
346
- var subscription = import_react_native.Appearance.addChangeListener(({ colorScheme }) => {
347
- if (mode !== "system") return;
348
- isDark = colorScheme === "dark";
349
- notify();
350
- });
351
- function notify() {
352
- for (const listener of listeners) listener();
209
+ // src/jsEngine/parser.ts
210
+ var VALUE_PREFIXES = [
211
+ "bg-opacity-",
212
+ "text-opacity-",
213
+ "bg-blend-",
214
+ "text-shadow-",
215
+ "bg-",
216
+ "text-",
217
+ "border-x-",
218
+ "border-y-",
219
+ "border-t-",
220
+ "border-r-",
221
+ "border-b-",
222
+ "border-l-",
223
+ "border-",
224
+ "caret-",
225
+ "accent-",
226
+ "fill-",
227
+ "stroke-width-",
228
+ "stroke-",
229
+ "resize-",
230
+ "touch-",
231
+ "will-change-",
232
+ "scroll-mx-",
233
+ "scroll-my-",
234
+ "scroll-mt-",
235
+ "scroll-mr-",
236
+ "scroll-mb-",
237
+ "scroll-ml-",
238
+ "scroll-m-",
239
+ "scroll-px-",
240
+ "scroll-py-",
241
+ "scroll-pt-",
242
+ "scroll-pr-",
243
+ "scroll-pb-",
244
+ "scroll-pl-",
245
+ "scroll-p-",
246
+ "px-",
247
+ "py-",
248
+ "pt-",
249
+ "pr-",
250
+ "pb-",
251
+ "pl-",
252
+ "p-",
253
+ "mx-",
254
+ "my-",
255
+ "mt-",
256
+ "mr-",
257
+ "mb-",
258
+ "ml-",
259
+ "m-",
260
+ "gap-x-",
261
+ "gap-y-",
262
+ "gap-",
263
+ "min-w-",
264
+ "max-w-",
265
+ "w-",
266
+ "min-h-",
267
+ "max-h-",
268
+ "h-",
269
+ "size-",
270
+ "basis-",
271
+ "rounded-tl-",
272
+ "rounded-tr-",
273
+ "rounded-br-",
274
+ "rounded-bl-",
275
+ "rounded-t-",
276
+ "rounded-r-",
277
+ "rounded-b-",
278
+ "rounded-l-",
279
+ "rounded-",
280
+ "ring-offset-",
281
+ "ring-",
282
+ "outline-offset-",
283
+ "outline-",
284
+ "shadow-",
285
+ "opacity-",
286
+ "duration-",
287
+ "delay-",
288
+ "ease-",
289
+ "cursor-",
290
+ "mix-blend-",
291
+ "animate-",
292
+ "leading-",
293
+ "tracking-",
294
+ "font-",
295
+ "z-",
296
+ "inset-x-",
297
+ "inset-y-",
298
+ "inset-",
299
+ "top-",
300
+ "right-",
301
+ "bottom-",
302
+ "left-",
303
+ "start-",
304
+ "end-",
305
+ "overflow-x-",
306
+ "overflow-y-",
307
+ "overscroll-x-",
308
+ "overscroll-y-",
309
+ "overscroll-",
310
+ "aspect-",
311
+ "divide-color-",
312
+ "space-x-",
313
+ "space-y-",
314
+ "flex-",
315
+ "grow-",
316
+ "shrink-",
317
+ "order-",
318
+ "grid-cols-",
319
+ "grid-rows-",
320
+ "grid-flow-",
321
+ "auto-cols-",
322
+ "auto-rows-",
323
+ "col-span-",
324
+ "col-start-",
325
+ "col-end-",
326
+ "col-",
327
+ "row-span-",
328
+ "row-start-",
329
+ "row-end-",
330
+ "row-",
331
+ "place-items-",
332
+ "place-content-",
333
+ "place-self-",
334
+ "justify-items-",
335
+ "justify-self-",
336
+ "scale-x-",
337
+ "scale-y-",
338
+ "scale-",
339
+ "rotate-",
340
+ "translate-x-",
341
+ "translate-y-",
342
+ "skew-x-",
343
+ "skew-y-",
344
+ "origin-",
345
+ "blur-",
346
+ "brightness-",
347
+ "contrast-",
348
+ "grayscale-",
349
+ "hue-rotate-",
350
+ "invert-",
351
+ "saturate-",
352
+ "sepia-",
353
+ "drop-shadow-",
354
+ "filter-",
355
+ "backdrop-blur-",
356
+ "backdrop-brightness-",
357
+ "backdrop-contrast-",
358
+ "backdrop-grayscale-",
359
+ "backdrop-hue-rotate-",
360
+ "backdrop-invert-",
361
+ "backdrop-opacity-",
362
+ "backdrop-saturate-",
363
+ "backdrop-sepia-",
364
+ "backdrop-filter-",
365
+ "decoration-",
366
+ "underline-offset-",
367
+ "indent-",
368
+ "from-",
369
+ "via-",
370
+ "to-"
371
+ ];
372
+ var ARBITRARY_PROPERTY_SENTINEL = "[arbitrary-property]";
373
+ function isSafeArbitraryValue(value) {
374
+ return !value.includes("{") && !value.includes("}") && !value.includes(";");
353
375
  }
354
- function getGlobalDarkMode() {
355
- return isDark;
376
+ function splitRespectingBrackets(token) {
377
+ const parts = [];
378
+ let depth = 0;
379
+ let start = 0;
380
+ for (let i = 0; i < token.length; i++) {
381
+ const ch = token[i];
382
+ if (ch === "[") depth += 1;
383
+ else if (ch === "]") depth -= 1;
384
+ else if (ch === ":" && depth <= 0) {
385
+ parts.push(token.slice(start, i));
386
+ start = i + 1;
387
+ }
388
+ }
389
+ parts.push(token.slice(start));
390
+ return parts;
356
391
  }
357
-
358
- // src/nativeBridge.ts
359
- function resolveStyle(classString, pressed = false) {
360
- const KbachModule = import_react_native2.TurboModuleRegistry.getEnforcing("KbachModule");
361
- const colorScheme = getGlobalDarkMode() ? "dark" : "light";
362
- const json = KbachModule.resolveStyle(classString, getThemeJson(), colorScheme, pressed);
363
- return JSON.parse(json);
392
+ function parseClass(token) {
393
+ const parts = splitRespectingBrackets(token);
394
+ let base = parts.pop() ?? token;
395
+ const modifiers = parts;
396
+ const important = base.startsWith("!");
397
+ if (important) {
398
+ base = base.slice(1);
399
+ }
400
+ const negative = base.startsWith("-");
401
+ if (negative) {
402
+ base = base.slice(1);
403
+ }
404
+ if (base.length >= 2 && base.startsWith("[") && base.endsWith("]")) {
405
+ const raw = base.slice(1, -1);
406
+ const colonIdx = raw.indexOf(":");
407
+ if (colonIdx !== -1) {
408
+ const property = raw.slice(0, colonIdx);
409
+ const rawValue = raw.slice(colonIdx + 1);
410
+ if (property !== "" && rawValue !== "" && isSafeArbitraryValue(raw)) {
411
+ const value = rawValue.replace(/_/g, " ");
412
+ return {
413
+ modifiers,
414
+ utility: ARBITRARY_PROPERTY_SENTINEL,
415
+ value: `${property}:${value}`,
416
+ isArbitrary: true,
417
+ important,
418
+ negative,
419
+ original: token
420
+ };
421
+ }
422
+ }
423
+ }
424
+ for (const prefix of VALUE_PREFIXES) {
425
+ if (!base.startsWith(prefix)) continue;
426
+ const value = base.slice(prefix.length);
427
+ if (value === "") continue;
428
+ if (value.length >= 2 && value.startsWith("[") && value.endsWith("]")) {
429
+ const raw = value.slice(1, -1);
430
+ if (!isSafeArbitraryValue(raw)) {
431
+ continue;
432
+ }
433
+ const spaced = raw.replace(/_/g, " ");
434
+ return {
435
+ modifiers,
436
+ utility: prefix.slice(0, -1),
437
+ value: spaced,
438
+ isArbitrary: true,
439
+ important,
440
+ negative,
441
+ original: token
442
+ };
443
+ }
444
+ return {
445
+ modifiers,
446
+ utility: prefix.slice(0, -1),
447
+ value,
448
+ isArbitrary: false,
449
+ important,
450
+ negative,
451
+ original: token
452
+ };
453
+ }
454
+ return {
455
+ modifiers,
456
+ utility: base,
457
+ value: null,
458
+ isArbitrary: false,
459
+ important,
460
+ negative,
461
+ original: token
462
+ };
364
463
  }
365
464
 
366
- // src/jsx-runtime.tsx
465
+ // src/jsxRuntimeCore.ts
466
+ var DYNAMIC_TOKEN_MATCH_RE = /var\(--([a-zA-Z0-9-]+)\)/g;
467
+ function substituteDynamicTokens(classStrRaw) {
468
+ if (!classStrRaw.includes("var(--")) return classStrRaw;
469
+ return classStrRaw.replace(DYNAMIC_TOKEN_MATCH_RE, (whole, name) => {
470
+ const value = (0, import_dynamicTokens.getDynamicToken)(name);
471
+ return value ?? whole;
472
+ });
473
+ }
474
+ var PERCENT_RELATIVE_CALC_HINT_RE = /[wh]-\[calc\([^)]*%[^)]*\)\]/;
475
+ function extractPercentRelativeCalcs(classStrRaw) {
476
+ const found = [];
477
+ for (const token of classStrRaw.split(/\s+/)) {
478
+ const parsed = parsePercentRelativeCalc(token);
479
+ if (parsed) found.push(parsed);
480
+ }
481
+ return found;
482
+ }
483
+ function stripPercentRelativeCalcTokens(classStrRaw) {
484
+ return classStrRaw.split(/\s+/).filter((token) => token && parsePercentRelativeCalc(token) === null).join(" ");
485
+ }
486
+ var STATE_MODIFIER_NAMES = /* @__PURE__ */ new Set(["hover", "focus", "disabled"]);
487
+ var STATE_MODIFIER_HINT_RE = /(^|\s|:)(hover|focus|disabled):/;
488
+ function stripModifiers(parts, namesToStrip) {
489
+ const utility = parts[parts.length - 1] ?? "";
490
+ const modifiers = parts.slice(0, -1).filter((m) => !namesToStrip.has(m));
491
+ return [...modifiers, utility].join(":");
492
+ }
493
+ function substituteStateModifiers(classStrRaw, states) {
494
+ if (!STATE_MODIFIER_HINT_RE.test(classStrRaw)) return classStrRaw;
495
+ const kept = [];
496
+ for (const token of classStrRaw.split(/\s+/)) {
497
+ if (!token) continue;
498
+ const parts = splitRespectingBrackets(token);
499
+ const modifiers = parts.slice(0, -1);
500
+ const required = modifiers.filter((m) => STATE_MODIFIER_NAMES.has(m));
501
+ if (required.length === 0) {
502
+ kept.push(token);
503
+ continue;
504
+ }
505
+ if (required.every((m) => states[m])) {
506
+ kept.push(stripModifiers(parts, STATE_MODIFIER_NAMES));
507
+ }
508
+ }
509
+ return kept.join(" ");
510
+ }
367
511
  function makeElement(isStaticChildren, type, props, key) {
368
512
  return (isStaticChildren ? import_jsx_runtime.jsxs : import_jsx_runtime.jsx)(type, props, key);
369
513
  }
370
- function resolvedStyleFor(classStrRaw, userStyle, pressed) {
371
- const resolved = resolveStyle(classStrRaw, pressed);
514
+ function resolvedStyleFor(resolveStyle2, classStrRaw, userStyle, pressed, layoutOverrides, states = { hover: false, focus: false, disabled: false }) {
515
+ const stateResolved = substituteStateModifiers(classStrRaw, states);
516
+ const cleaned = stripPercentRelativeCalcTokens(substituteDynamicTokens(stateResolved));
517
+ const resolved = resolveStyle2(cleaned, pressed);
518
+ if (layoutOverrides) {
519
+ Object.assign(resolved, layoutOverrides);
520
+ }
372
521
  if (userStyle === void 0) {
373
522
  return resolved;
374
523
  }
@@ -377,7 +526,82 @@ function resolvedStyleFor(classStrRaw, userStyle, pressed) {
377
526
  }
378
527
  return [resolved, userStyle];
379
528
  }
380
- function processElement(type, rawProps, key, isStaticChildren) {
529
+ var DARK_MODIFIER_RE = /(^|\s|:)dark:/;
530
+ var BREAKPOINT_MODIFIER_RE = /(^|\s|:)(sm|md|lg|xl|2xl):/;
531
+ var HOVER_MODIFIER_RE = /(^|\s|:)hover:/;
532
+ var FOCUS_MODIFIER_RE = /(^|\s|:)focus:/;
533
+ function ReactiveElement({
534
+ hostType,
535
+ hostRest,
536
+ classStrRaw,
537
+ userStyle,
538
+ resolveStyle: resolveStyle2,
539
+ elementKey,
540
+ isStaticChildren
541
+ }) {
542
+ (0, import_react.useSyncExternalStore)(import_darkModeStore.subscribeGlobalDarkMode, import_darkModeStore.getGlobalDarkMode);
543
+ (0, import_react.useSyncExternalStore)(import_dynamicTokens.subscribeDynamicTokens, import_dynamicTokens.getDynamicTokensVersion);
544
+ (0, import_react_native.useWindowDimensions)();
545
+ const [measuredBasis, setMeasuredBasis] = (0, import_react.useState)(null);
546
+ const measure = (0, import_react.useCallback)((e) => {
547
+ const { width: w, height: h } = e.nativeEvent.layout;
548
+ setMeasuredBasis((prev) => prev && prev.width === w && prev.height === h ? prev : { width: w, height: h });
549
+ }, []);
550
+ const [isHovered, setIsHovered] = (0, import_react.useState)(false);
551
+ const [isFocused, setIsFocused] = (0, import_react.useState)(false);
552
+ const percentCalcs = extractPercentRelativeCalcs(classStrRaw);
553
+ let layoutOverrides;
554
+ let hostRestWithLayout = hostRest;
555
+ if (percentCalcs.length > 0) {
556
+ layoutOverrides = {};
557
+ for (const calc of percentCalcs) {
558
+ const basis = measuredBasis?.[calc.property];
559
+ layoutOverrides[calc.property] = basis === void 0 ? "100%" : resolvePercentRelativeCalc(basis, calc);
560
+ }
561
+ const userOnLayout = hostRest.onLayout;
562
+ hostRestWithLayout = {
563
+ ...hostRest,
564
+ onLayout: userOnLayout ? (e) => {
565
+ measure(e);
566
+ userOnLayout(e);
567
+ } : measure
568
+ };
569
+ }
570
+ if (HOVER_MODIFIER_RE.test(classStrRaw)) {
571
+ const userOnHoverIn = hostRestWithLayout.onHoverIn;
572
+ const userOnHoverOut = hostRestWithLayout.onHoverOut;
573
+ hostRestWithLayout = {
574
+ ...hostRestWithLayout,
575
+ onHoverIn: (e) => {
576
+ setIsHovered(true);
577
+ userOnHoverIn?.(e);
578
+ },
579
+ onHoverOut: (e) => {
580
+ setIsHovered(false);
581
+ userOnHoverOut?.(e);
582
+ }
583
+ };
584
+ }
585
+ if (FOCUS_MODIFIER_RE.test(classStrRaw)) {
586
+ const userOnFocus = hostRestWithLayout.onFocus;
587
+ const userOnBlur = hostRestWithLayout.onBlur;
588
+ hostRestWithLayout = {
589
+ ...hostRestWithLayout,
590
+ onFocus: (e) => {
591
+ setIsFocused(true);
592
+ userOnFocus?.(e);
593
+ },
594
+ onBlur: (e) => {
595
+ setIsFocused(false);
596
+ userOnBlur?.(e);
597
+ }
598
+ };
599
+ }
600
+ const states = { hover: isHovered, focus: isFocused, disabled: hostRest.disabled === true };
601
+ const finalStyle = hostType === import_react_native.Pressable ? (state) => resolvedStyleFor(resolveStyle2, classStrRaw, userStyle, state.pressed, layoutOverrides, states) : resolvedStyleFor(resolveStyle2, classStrRaw, userStyle, false, layoutOverrides, states);
602
+ return makeElement(isStaticChildren, hostType, { ...hostRestWithLayout, style: finalStyle }, elementKey);
603
+ }
604
+ function processElement(resolveStyle2, type, rawProps, key, isStaticChildren) {
381
605
  if (type === null || typeof type === "symbol" || !rawProps) {
382
606
  return makeElement(isStaticChildren, type, rawProps ?? {}, key);
383
607
  }
@@ -385,25 +609,1196 @@ function processElement(type, rawProps, key, isStaticChildren) {
385
609
  if (typeof classStrRaw !== "string") {
386
610
  return makeElement(isStaticChildren, type, rawProps, key);
387
611
  }
388
- const finalStyle = type === import_react_native3.Pressable ? (state) => resolvedStyleFor(classStrRaw, userStyle, state.pressed) : resolvedStyleFor(classStrRaw, userStyle, false);
612
+ if (DARK_MODIFIER_RE.test(classStrRaw) || BREAKPOINT_MODIFIER_RE.test(classStrRaw) || HOVER_MODIFIER_RE.test(classStrRaw) || FOCUS_MODIFIER_RE.test(classStrRaw) || classStrRaw.includes("var(--") || PERCENT_RELATIVE_CALC_HINT_RE.test(classStrRaw)) {
613
+ return (0, import_jsx_runtime.jsx)(
614
+ ReactiveElement,
615
+ { hostType: type, hostRest: rest, classStrRaw, userStyle, resolveStyle: resolveStyle2, elementKey: key, isStaticChildren },
616
+ key
617
+ );
618
+ }
619
+ const staticStates = { hover: false, focus: false, disabled: rest.disabled === true };
620
+ const finalStyle = type === import_react_native.Pressable ? (state) => resolvedStyleFor(resolveStyle2, classStrRaw, userStyle, state.pressed, void 0, staticStates) : resolvedStyleFor(resolveStyle2, classStrRaw, userStyle, false, void 0, staticStates);
389
621
  return makeElement(isStaticChildren, type, { ...rest, style: finalStyle }, key);
390
622
  }
391
- function jsx(type, props, key) {
392
- return processElement(type, props, key, false);
623
+ function createJsxFunctions(resolveStyle2) {
624
+ function jsx2(type, props, key) {
625
+ return processElement(resolveStyle2, type, props, key, false);
626
+ }
627
+ function jsxs2(type, props, key) {
628
+ return processElement(resolveStyle2, type, props, key, true);
629
+ }
630
+ return { jsx: jsx2, jsxs: jsxs2 };
393
631
  }
394
- function jsxs(type, props, key) {
395
- return processElement(type, props, key, true);
632
+ function createJsxDEV(jsx2, jsxs2) {
633
+ return function jsxDEV2(type, props, key, isStaticChildren, source, self) {
634
+ const element = (isStaticChildren ? jsxs2 : jsx2)(type, props, key);
635
+ if (source && element && typeof element === "object" && Object.isExtensible(element)) {
636
+ element._source = source;
637
+ element._self = self;
638
+ }
639
+ return element;
640
+ };
396
641
  }
397
642
 
398
- // src/jsx-dev-runtime.tsx
399
- function jsxDEV(type, props, key, isStaticChildren, source, self) {
400
- const element = (isStaticChildren ? jsxs : jsx)(type, props, key);
401
- if (source && element && typeof element === "object" && Object.isExtensible(element)) {
402
- element._source = source;
403
- element._self = self;
643
+ // src/nativeBridge.ts
644
+ var import_react_native2 = require("react-native");
645
+ var import_theme = require("./theme");
646
+ var import_darkModeStore2 = require("./darkModeStore");
647
+
648
+ // src/jsEngine/shared.ts
649
+ function decl(property, value) {
650
+ return { property, value };
651
+ }
652
+ function spacingPx(theme, value) {
653
+ const fromTable = theme.spacing[value];
654
+ if (fromTable !== void 0) return fromTable;
655
+ const n = Number(value);
656
+ return Number.isFinite(n) && value.trim() !== "" ? n * 4 : void 0;
657
+ }
658
+ function resolveLength(theme, parsed) {
659
+ if (parsed.negative) return null;
660
+ const value = parsed.value;
661
+ if (value === null) return null;
662
+ if (parsed.isArbitrary) return value;
663
+ if (value === "full") return "100%";
664
+ if (value === "auto") return "auto";
665
+ const px = spacingPx(theme, value);
666
+ return px === void 0 ? null : `${px}px`;
667
+ }
668
+ function resolveNegatableLength(theme, parsed) {
669
+ if (!parsed.negative) return resolveLength(theme, parsed);
670
+ if (parsed.isArbitrary) return null;
671
+ const value = parsed.value;
672
+ if (value === null) return null;
673
+ const px = spacingPx(theme, value);
674
+ if (px === void 0) return null;
675
+ if (px === 0) return "0px";
676
+ return `-${px}px`;
677
+ }
678
+ function resolvePercent(parsed) {
679
+ if (parsed.negative) return null;
680
+ const value = parsed.value;
681
+ if (value === null) return null;
682
+ if (parsed.isArbitrary) return value;
683
+ const pct = Number(value);
684
+ if (!Number.isFinite(pct) || value.trim() === "") return null;
685
+ return String(pct / 100);
686
+ }
687
+
688
+ // src/jsEngine/resolvers/layout.ts
689
+ function negateRaw(value, negative) {
690
+ return negative ? `-${value}` : value;
691
+ }
692
+ function overflowAxisValue(property, value) {
693
+ switch (value) {
694
+ case "auto":
695
+ case "hidden":
696
+ case "clip":
697
+ case "visible":
698
+ case "scroll":
699
+ return [decl(property, value)];
700
+ default:
701
+ return null;
702
+ }
703
+ }
704
+ function overscrollValue(property, value) {
705
+ switch (value) {
706
+ case "auto":
707
+ case "contain":
708
+ case "none":
709
+ return [decl(property, value)];
710
+ default:
711
+ return null;
712
+ }
713
+ }
714
+ function resolve(parsed, theme) {
715
+ switch (parsed.utility) {
716
+ case "flex":
717
+ return parsed.value === null ? [decl("display", "flex")] : null;
718
+ case "grid":
719
+ return [decl("display", "grid")];
720
+ case "block":
721
+ return [decl("display", "block")];
722
+ case "inline-block":
723
+ return [decl("display", "inline-block")];
724
+ case "inline":
725
+ return [decl("display", "inline")];
726
+ case "inline-flex":
727
+ return [decl("display", "inline-flex")];
728
+ case "inline-grid":
729
+ return [decl("display", "inline-grid")];
730
+ case "contents":
731
+ return [decl("display", "contents")];
732
+ case "flow-root":
733
+ return [decl("display", "flow-root")];
734
+ case "hidden":
735
+ return [decl("display", "none")];
736
+ case "@container":
737
+ return [decl("container-type", "inline-size")];
738
+ case "items-center":
739
+ return [decl("align-items", "center")];
740
+ case "items-start":
741
+ return [decl("align-items", "flex-start")];
742
+ case "items-end":
743
+ return [decl("align-items", "flex-end")];
744
+ case "items-baseline":
745
+ return [decl("align-items", "baseline")];
746
+ case "items-stretch":
747
+ return [decl("align-items", "stretch")];
748
+ case "justify-center":
749
+ return [decl("justify-content", "center")];
750
+ case "justify-start":
751
+ return [decl("justify-content", "flex-start")];
752
+ case "justify-end":
753
+ return [decl("justify-content", "flex-end")];
754
+ case "justify-between":
755
+ return [decl("justify-content", "space-between")];
756
+ case "justify-around":
757
+ return [decl("justify-content", "space-around")];
758
+ case "justify-evenly":
759
+ return [decl("justify-content", "space-evenly")];
760
+ case "justify-normal":
761
+ return [decl("justify-content", "normal")];
762
+ case "justify-stretch":
763
+ return [decl("justify-content", "stretch")];
764
+ case "content-normal":
765
+ return [decl("align-content", "normal")];
766
+ case "content-start":
767
+ return [decl("align-content", "flex-start")];
768
+ case "content-end":
769
+ return [decl("align-content", "flex-end")];
770
+ case "content-center":
771
+ return [decl("align-content", "center")];
772
+ case "content-between":
773
+ return [decl("align-content", "space-between")];
774
+ case "content-around":
775
+ return [decl("align-content", "space-around")];
776
+ case "content-evenly":
777
+ return [decl("align-content", "space-evenly")];
778
+ case "content-stretch":
779
+ return [decl("align-content", "stretch")];
780
+ case "self-auto":
781
+ return [decl("align-self", "auto")];
782
+ case "self-center":
783
+ return [decl("align-self", "center")];
784
+ case "self-start":
785
+ return [decl("align-self", "flex-start")];
786
+ case "self-end":
787
+ return [decl("align-self", "flex-end")];
788
+ case "self-stretch":
789
+ return [decl("align-self", "stretch")];
790
+ case "self-baseline":
791
+ return [decl("align-self", "baseline")];
792
+ case "overflow-hidden":
793
+ return [decl("overflow", "hidden")];
794
+ case "overflow-auto":
795
+ return [decl("overflow", "auto")];
796
+ case "overflow-scroll":
797
+ return [decl("overflow", "scroll")];
798
+ case "overflow-visible":
799
+ return [decl("overflow", "visible")];
800
+ case "overflow-clip":
801
+ return [decl("overflow", "clip")];
802
+ case "overflow-x":
803
+ return parsed.value === null ? null : overflowAxisValue("overflow-x", parsed.value);
804
+ case "overflow-y":
805
+ return parsed.value === null ? null : overflowAxisValue("overflow-y", parsed.value);
806
+ case "overscroll":
807
+ return parsed.value === null ? null : overscrollValue("overscroll-behavior", parsed.value);
808
+ case "overscroll-x":
809
+ return parsed.value === null ? null : overscrollValue("overscroll-behavior-x", parsed.value);
810
+ case "overscroll-y":
811
+ return parsed.value === null ? null : overscrollValue("overscroll-behavior-y", parsed.value);
812
+ case "static":
813
+ return [decl("position", "static")];
814
+ case "relative":
815
+ return [decl("position", "relative")];
816
+ case "absolute":
817
+ return [decl("position", "absolute")];
818
+ case "fixed":
819
+ return [decl("position", "fixed")];
820
+ case "sticky":
821
+ return [decl("position", "sticky")];
822
+ case "z":
823
+ return parsed.value === null ? null : [decl("z-index", negateRaw(parsed.value, parsed.negative))];
824
+ case "order":
825
+ return parsed.value === null ? null : [decl("order", negateRaw(parsed.value, parsed.negative))];
826
+ case "grow":
827
+ return [decl("flex-grow", parsed.value ?? "1")];
828
+ case "shrink":
829
+ return [decl("flex-shrink", parsed.value ?? "1")];
830
+ // top/right/bottom/left/inset support real Tailwind's negative-value
831
+ // convention ("-top-4") — see resolveNegatableLength's own doc comment.
832
+ case "top": {
833
+ const v = resolveNegatableLength(theme, parsed);
834
+ return v === null ? null : [decl("top", v)];
835
+ }
836
+ case "right": {
837
+ const v = resolveNegatableLength(theme, parsed);
838
+ return v === null ? null : [decl("right", v)];
839
+ }
840
+ case "bottom": {
841
+ const v = resolveNegatableLength(theme, parsed);
842
+ return v === null ? null : [decl("bottom", v)];
843
+ }
844
+ case "left": {
845
+ const v = resolveNegatableLength(theme, parsed);
846
+ return v === null ? null : [decl("left", v)];
847
+ }
848
+ case "inset": {
849
+ const v = resolveNegatableLength(theme, parsed);
850
+ return v === null ? null : [decl("inset", v)];
851
+ }
852
+ case "inset-x": {
853
+ const v = resolveNegatableLength(theme, parsed);
854
+ return v === null ? null : [decl("left", v), decl("right", v)];
855
+ }
856
+ case "inset-y": {
857
+ const v = resolveNegatableLength(theme, parsed);
858
+ return v === null ? null : [decl("top", v), decl("bottom", v)];
859
+ }
860
+ // Logical inset — just a different CSS property name, same reasoning
861
+ // as Rust's layout.rs (no direction-tracking logic needed here).
862
+ case "start": {
863
+ const v = resolveNegatableLength(theme, parsed);
864
+ return v === null ? null : [decl("inset-inline-start", v)];
865
+ }
866
+ case "end": {
867
+ const v = resolveNegatableLength(theme, parsed);
868
+ return v === null ? null : [decl("inset-inline-end", v)];
869
+ }
870
+ // "aspect-" is a registered VALUE_PREFIXES entry (parser.ts), so
871
+ // "aspect-square"/"aspect-video"/"aspect-auto"/arbitrary all arrive
872
+ // here as utility="aspect" + a value, mirroring layout.rs's own
873
+ // "aspect" arm.
874
+ case "aspect": {
875
+ const value = parsed.value;
876
+ if (value === null) return null;
877
+ if (parsed.isArbitrary) return [decl("aspect-ratio", value)];
878
+ switch (value) {
879
+ case "square":
880
+ return [decl("aspect-ratio", "1 / 1")];
881
+ case "video":
882
+ return [decl("aspect-ratio", "16 / 9")];
883
+ case "auto":
884
+ return [decl("aspect-ratio", "auto")];
885
+ default:
886
+ return null;
887
+ }
888
+ }
889
+ default:
890
+ return null;
891
+ }
892
+ }
893
+ function resolveFlex(parsed, web) {
894
+ if (parsed.utility !== "flex") return null;
895
+ const value = parsed.value;
896
+ if (value === null) return null;
897
+ if (parsed.isArbitrary) return [decl("flex", value)];
898
+ switch (value) {
899
+ case "row":
900
+ return [decl("flex-direction", "row")];
901
+ case "col":
902
+ return [decl("flex-direction", "column")];
903
+ case "row-reverse":
904
+ return [decl("flex-direction", "row-reverse")];
905
+ case "col-reverse":
906
+ return [decl("flex-direction", "column-reverse")];
907
+ case "wrap":
908
+ return [decl("flex-wrap", "wrap")];
909
+ case "wrap-reverse":
910
+ return [decl("flex-wrap", "wrap-reverse")];
911
+ case "nowrap":
912
+ return [decl("flex-wrap", "nowrap")];
913
+ case "1":
914
+ return [decl("flex", "1")];
915
+ case "auto":
916
+ return [decl("flex", web ? "auto" : "1")];
917
+ case "initial":
918
+ return [decl("flex", web ? "initial" : "1")];
919
+ case "none":
920
+ return [decl("flex", web ? "none" : "0")];
921
+ case "grow":
922
+ return [decl("flex-grow", "1")];
923
+ case "grow-0":
924
+ return [decl("flex-grow", "0")];
925
+ case "shrink":
926
+ return [decl("flex-shrink", "1")];
927
+ case "shrink-0":
928
+ return [decl("flex-shrink", "0")];
929
+ default:
930
+ return null;
931
+ }
932
+ }
933
+
934
+ // src/jsEngine/resolvers/spacing.ts
935
+ function namedSize(key) {
936
+ switch (key) {
937
+ case "sm":
938
+ return "24rem";
939
+ case "md":
940
+ return "28rem";
941
+ case "lg":
942
+ return "32rem";
943
+ case "xl":
944
+ return "36rem";
945
+ case "2xl":
946
+ return "42rem";
947
+ case "3xl":
948
+ return "48rem";
949
+ case "4xl":
950
+ return "56rem";
951
+ case "5xl":
952
+ return "64rem";
953
+ case "6xl":
954
+ return "72rem";
955
+ case "7xl":
956
+ return "80rem";
957
+ case "8xl":
958
+ return "88rem";
959
+ case "9xl":
960
+ return "96rem";
961
+ default:
962
+ return null;
963
+ }
964
+ }
965
+ function fractionPercent(value) {
966
+ const slashIdx = value.indexOf("/");
967
+ if (slashIdx === -1) return null;
968
+ const numStr = value.slice(0, slashIdx);
969
+ const denStr = value.slice(slashIdx + 1);
970
+ const num = Number(numStr);
971
+ const den = Number(denStr);
972
+ if (!Number.isFinite(num) || !Number.isFinite(den) || numStr.trim() === "" || denStr.trim() === "") return null;
973
+ if (den === 0) return null;
974
+ const pct = num / den * 100;
975
+ const formatted = pct.toFixed(6);
976
+ const trimmed = formatted.replace(/0+$/, "").replace(/\.$/, "");
977
+ return `${trimmed}%`;
978
+ }
979
+ function cssSizeKeyword(key) {
980
+ switch (key) {
981
+ case "min":
982
+ return "min-content";
983
+ case "max":
984
+ return "max-content";
985
+ case "fit":
986
+ return "fit-content";
987
+ default:
988
+ return null;
989
+ }
990
+ }
991
+ function resolveSize(theme, parsed) {
992
+ if (!parsed.isArbitrary && parsed.value !== null) {
993
+ const named = namedSize(parsed.value);
994
+ if (named !== null) return named;
995
+ const kw = cssSizeKeyword(parsed.value);
996
+ if (kw !== null) return kw;
997
+ const fraction = fractionPercent(parsed.value);
998
+ if (fraction !== null) return fraction;
999
+ }
1000
+ return resolveLength(theme, parsed);
1001
+ }
1002
+ function resolve2(parsed, theme) {
1003
+ const length = () => resolveLength(theme, parsed);
1004
+ const size = () => resolveSize(theme, parsed);
1005
+ const negatableLength = () => resolveNegatableLength(theme, parsed);
1006
+ switch (parsed.utility) {
1007
+ case "p": {
1008
+ const v = length();
1009
+ return v === null ? null : [decl("padding", v)];
1010
+ }
1011
+ case "px": {
1012
+ const v = length();
1013
+ return v === null ? null : [decl("padding-left", v), decl("padding-right", v)];
1014
+ }
1015
+ case "py": {
1016
+ const v = length();
1017
+ return v === null ? null : [decl("padding-top", v), decl("padding-bottom", v)];
1018
+ }
1019
+ case "pt": {
1020
+ const v = length();
1021
+ return v === null ? null : [decl("padding-top", v)];
1022
+ }
1023
+ case "pr": {
1024
+ const v = length();
1025
+ return v === null ? null : [decl("padding-right", v)];
1026
+ }
1027
+ case "pb": {
1028
+ const v = length();
1029
+ return v === null ? null : [decl("padding-bottom", v)];
1030
+ }
1031
+ case "pl": {
1032
+ const v = length();
1033
+ return v === null ? null : [decl("padding-left", v)];
1034
+ }
1035
+ case "m": {
1036
+ const v = negatableLength();
1037
+ return v === null ? null : [decl("margin", v)];
1038
+ }
1039
+ case "mx": {
1040
+ const v = negatableLength();
1041
+ return v === null ? null : [decl("margin-left", v), decl("margin-right", v)];
1042
+ }
1043
+ case "my": {
1044
+ const v = negatableLength();
1045
+ return v === null ? null : [decl("margin-top", v), decl("margin-bottom", v)];
1046
+ }
1047
+ case "mt": {
1048
+ const v = negatableLength();
1049
+ return v === null ? null : [decl("margin-top", v)];
1050
+ }
1051
+ case "mr": {
1052
+ const v = negatableLength();
1053
+ return v === null ? null : [decl("margin-right", v)];
1054
+ }
1055
+ case "mb": {
1056
+ const v = negatableLength();
1057
+ return v === null ? null : [decl("margin-bottom", v)];
1058
+ }
1059
+ case "ml": {
1060
+ const v = negatableLength();
1061
+ return v === null ? null : [decl("margin-left", v)];
1062
+ }
1063
+ case "gap": {
1064
+ const v = length();
1065
+ return v === null ? null : [decl("gap", v)];
1066
+ }
1067
+ case "gap-x": {
1068
+ const v = length();
1069
+ return v === null ? null : [decl("column-gap", v)];
1070
+ }
1071
+ case "gap-y": {
1072
+ const v = length();
1073
+ return v === null ? null : [decl("row-gap", v)];
1074
+ }
1075
+ case "w": {
1076
+ const v = size();
1077
+ return v === null ? null : [decl("width", v)];
1078
+ }
1079
+ case "h": {
1080
+ const v = size();
1081
+ return v === null ? null : [decl("height", v)];
1082
+ }
1083
+ case "min-w": {
1084
+ const v = size();
1085
+ return v === null ? null : [decl("min-width", v)];
1086
+ }
1087
+ case "max-w": {
1088
+ const v = size();
1089
+ return v === null ? null : [decl("max-width", v)];
1090
+ }
1091
+ case "min-h": {
1092
+ const v = size();
1093
+ return v === null ? null : [decl("min-height", v)];
1094
+ }
1095
+ case "max-h": {
1096
+ const v = size();
1097
+ return v === null ? null : [decl("max-height", v)];
1098
+ }
1099
+ case "size": {
1100
+ const v = size();
1101
+ return v === null ? null : [decl("width", v), decl("height", v)];
1102
+ }
1103
+ case "basis": {
1104
+ const v = size();
1105
+ return v === null ? null : [decl("flex-basis", v)];
1106
+ }
1107
+ default:
1108
+ return null;
1109
+ }
1110
+ }
1111
+
1112
+ // src/jsEngine/resolvers/color.ts
1113
+ function lookupHex(theme, key) {
1114
+ const entry = theme.colors[key];
1115
+ return typeof entry === "string" ? entry : null;
1116
+ }
1117
+ function hexToRgb(hex) {
1118
+ const m = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(hex.trim());
1119
+ if (!m) return null;
1120
+ let h = m[1];
1121
+ if (h.length === 3) h = h.split("").map((c) => c + c).join("");
1122
+ const n = parseInt(h, 16);
1123
+ return [n >> 16 & 255, n >> 8 & 255, n & 255];
1124
+ }
1125
+ function splitOpacity(value) {
1126
+ const slash = value.lastIndexOf("/");
1127
+ if (slash === -1) return [value, null];
1128
+ const opacityText = value.slice(slash + 1);
1129
+ const n = Number(opacityText);
1130
+ if (opacityText !== "" && Number.isInteger(n) && n >= 0 && n <= 100) {
1131
+ return [value.slice(0, slash), n];
1132
+ }
1133
+ return [value, null];
1134
+ }
1135
+ function colorValue(theme, parsed) {
1136
+ const value = parsed.value;
1137
+ if (value === null) return null;
1138
+ if (parsed.isArbitrary) return value;
1139
+ const [name, opacity] = splitOpacity(value);
1140
+ const hex = lookupHex(theme, name);
1141
+ if (hex === null) return null;
1142
+ if (opacity === null) return hex;
1143
+ const rgb = hexToRgb(hex);
1144
+ if (rgb === null) return hex;
1145
+ return `rgba(${rgb.join(",")},${opacity / 100})`;
1146
+ }
1147
+
1148
+ // src/jsEngine/resolvers/border.ts
1149
+ function radiusSize(key) {
1150
+ switch (key) {
1151
+ case "none":
1152
+ return "0px";
1153
+ case "sm":
1154
+ return "0.125rem";
1155
+ case "md":
1156
+ return "0.375rem";
1157
+ case "lg":
1158
+ return "0.5rem";
1159
+ case "xl":
1160
+ return "0.75rem";
1161
+ case "2xl":
1162
+ return "1rem";
1163
+ case "3xl":
1164
+ return "1.5rem";
1165
+ case "full":
1166
+ return "9999px";
1167
+ default:
1168
+ return null;
1169
+ }
1170
+ }
1171
+ function borderSideProperty(side) {
1172
+ switch (side) {
1173
+ case "t":
1174
+ return "border-top";
1175
+ case "r":
1176
+ return "border-right";
1177
+ case "b":
1178
+ return "border-bottom";
1179
+ case "l":
1180
+ return "border-left";
1181
+ default:
1182
+ return null;
1183
+ }
1184
+ }
1185
+ function borderValue(theme, parsed) {
1186
+ const value = parsed.value;
1187
+ if (value === null) return null;
1188
+ if (!parsed.isArbitrary) {
1189
+ const side = borderSideProperty(value);
1190
+ if (side !== null) {
1191
+ return [decl(`${side}-width`, "1px"), decl(`${side}-style`, "solid")];
1192
+ }
1193
+ if (value === "collapse") return [decl("border-collapse", "collapse")];
1194
+ if (value === "separate") return [decl("border-collapse", "separate")];
1195
+ }
1196
+ if (parsed.isArbitrary) {
1197
+ return [decl("border-width", value)];
1198
+ }
1199
+ if (Number.isFinite(Number(value)) && value.trim() !== "") {
1200
+ const v = resolveLength(theme, parsed);
1201
+ return v === null ? null : [decl("border-width", v)];
1202
+ }
1203
+ if (value === "solid" || value === "dashed" || value === "dotted" || value === "double" || value === "hidden" || value === "none") {
1204
+ return [decl("border-style", value)];
1205
+ }
1206
+ const color = colorValue(theme, parsed);
1207
+ return color === null ? null : [decl("border-color", color)];
1208
+ }
1209
+ function borderSideValue(theme, parsed, sideProperty) {
1210
+ const value = parsed.value;
1211
+ if (value === null) return null;
1212
+ if (parsed.isArbitrary) return [decl(`${sideProperty}-width`, value)];
1213
+ if (Number.isFinite(Number(value)) && value.trim() !== "") {
1214
+ const v = resolveLength(theme, parsed);
1215
+ return v === null ? null : [decl(`${sideProperty}-width`, v)];
1216
+ }
1217
+ if (value === "solid" || value === "dashed" || value === "dotted" || value === "double" || value === "hidden" || value === "none") {
1218
+ return [decl(`${sideProperty}-style`, value)];
1219
+ }
1220
+ const color = colorValue(theme, parsed);
1221
+ return color === null ? null : [decl(`${sideProperty}-color`, color)];
1222
+ }
1223
+ function borderAxisValue(theme, parsed, sideA, sideB) {
1224
+ const value = parsed.value;
1225
+ if (value === null) return null;
1226
+ if (parsed.isArbitrary) return [decl(`${sideA}-width`, value), decl(`${sideB}-width`, value)];
1227
+ if (Number.isFinite(Number(value)) && value.trim() !== "") {
1228
+ const v = resolveLength(theme, parsed);
1229
+ return v === null ? null : [decl(`${sideA}-width`, v), decl(`${sideB}-width`, v)];
1230
+ }
1231
+ if (value === "solid" || value === "dashed" || value === "dotted" || value === "double" || value === "hidden" || value === "none") {
1232
+ return [decl(`${sideA}-style`, value), decl(`${sideB}-style`, value)];
1233
+ }
1234
+ const color = colorValue(theme, parsed);
1235
+ return color === null ? null : [decl(`${sideA}-color`, color), decl(`${sideB}-color`, color)];
1236
+ }
1237
+ function radiusProperties(side) {
1238
+ switch (side) {
1239
+ case "t":
1240
+ return ["border-top-left-radius", "border-top-right-radius"];
1241
+ case "r":
1242
+ return ["border-top-right-radius", "border-bottom-right-radius"];
1243
+ case "b":
1244
+ return ["border-bottom-right-radius", "border-bottom-left-radius"];
1245
+ case "l":
1246
+ return ["border-top-left-radius", "border-bottom-left-radius"];
1247
+ case "tl":
1248
+ return ["border-top-left-radius"];
1249
+ case "tr":
1250
+ return ["border-top-right-radius"];
1251
+ case "br":
1252
+ return ["border-bottom-right-radius"];
1253
+ case "bl":
1254
+ return ["border-bottom-left-radius"];
1255
+ default:
1256
+ return null;
1257
+ }
1258
+ }
1259
+ function resolveRadiusValue(theme, parsed) {
1260
+ if (!parsed.isArbitrary && parsed.value !== null) {
1261
+ const size = radiusSize(parsed.value);
1262
+ if (size !== null) return size;
1263
+ }
1264
+ return resolveLength(theme, parsed);
1265
+ }
1266
+ function resolveRadiusSide(theme, parsed, side) {
1267
+ const properties = radiusProperties(side);
1268
+ if (properties === null) return null;
1269
+ const value = resolveRadiusValue(theme, parsed);
1270
+ if (value === null) return null;
1271
+ return properties.map((p) => decl(p, value));
1272
+ }
1273
+ var OUTLINE_STYLES = ["solid", "dashed", "dotted", "double"];
1274
+ function outlineWidthValue(key) {
1275
+ switch (key) {
1276
+ case "0":
1277
+ return "0px";
1278
+ case "1":
1279
+ return "1px";
1280
+ case "2":
1281
+ return "2px";
1282
+ case "4":
1283
+ return "4px";
1284
+ case "8":
1285
+ return "8px";
1286
+ default:
1287
+ return null;
1288
+ }
1289
+ }
1290
+ function outlineValue(theme, parsed) {
1291
+ const value = parsed.value;
1292
+ if (value === null) return null;
1293
+ if (parsed.isArbitrary) return [decl("outline-width", value)];
1294
+ const w = outlineWidthValue(value);
1295
+ if (w !== null) return [decl("outline-width", w)];
1296
+ if (OUTLINE_STYLES.includes(value)) return [decl("outline-style", value)];
1297
+ const color = colorValue(theme, parsed);
1298
+ return color === null ? null : [decl("outline-color", color)];
1299
+ }
1300
+ function outlineOffsetValue(parsed) {
1301
+ const value = parsed.value;
1302
+ if (value === null) return null;
1303
+ if (parsed.isArbitrary) return [decl("outline-offset", value)];
1304
+ const w = outlineWidthValue(value);
1305
+ return w === null ? null : [decl("outline-offset", w)];
1306
+ }
1307
+ var RING_BOX_SHADOW = "var(--kb-ring-inset,) 0 0 0 var(--kb-ring-offset-width, 0px) var(--kb-ring-offset-color, #fff), var(--kb-ring-inset,) 0 0 0 calc(var(--kb-ring-width, 0px) + var(--kb-ring-offset-width, 0px)) var(--kb-ring-color, rgba(59,130,246,0.5))";
1308
+ function ringWidth(key) {
1309
+ switch (key) {
1310
+ case "0":
1311
+ return "0px";
1312
+ case "1":
1313
+ return "1px";
1314
+ case "2":
1315
+ return "2px";
1316
+ case "4":
1317
+ return "4px";
1318
+ case "8":
1319
+ return "8px";
1320
+ default:
1321
+ return null;
1322
+ }
1323
+ }
1324
+ function ringValue(theme, parsed) {
1325
+ const value = parsed.value;
1326
+ if (value === null) return null;
1327
+ if (value === "inset") {
1328
+ return [decl("--kb-ring-inset", "inset"), decl("box-shadow", RING_BOX_SHADOW)];
1329
+ }
1330
+ if (!parsed.isArbitrary) {
1331
+ const w = ringWidth(value);
1332
+ if (w !== null) return [decl("--kb-ring-width", w), decl("box-shadow", RING_BOX_SHADOW)];
1333
+ }
1334
+ const color = colorValue(theme, parsed);
1335
+ if (color === null) return null;
1336
+ return [decl("--kb-ring-color", color), decl("box-shadow", RING_BOX_SHADOW)];
1337
+ }
1338
+ function ringOffsetValue(theme, parsed) {
1339
+ const value = parsed.value;
1340
+ if (value === null) return null;
1341
+ if (!parsed.isArbitrary) {
1342
+ const w = ringWidth(value);
1343
+ if (w !== null) return [decl("--kb-ring-offset-width", w), decl("box-shadow", RING_BOX_SHADOW)];
1344
+ }
1345
+ const color = colorValue(theme, parsed);
1346
+ if (color === null) return null;
1347
+ return [decl("--kb-ring-offset-color", color), decl("box-shadow", RING_BOX_SHADOW)];
1348
+ }
1349
+ var RADIUS_SIDES = /* @__PURE__ */ new Set(["t", "r", "b", "l", "tl", "tr", "br", "bl"]);
1350
+ function resolve3(parsed, theme) {
1351
+ switch (parsed.utility) {
1352
+ case "border":
1353
+ if (parsed.value === null) return [decl("border-width", "1px"), decl("border-style", "solid")];
1354
+ return borderValue(theme, parsed);
1355
+ case "border-t":
1356
+ return borderSideValue(theme, parsed, "border-top");
1357
+ case "border-r":
1358
+ return borderSideValue(theme, parsed, "border-right");
1359
+ case "border-b":
1360
+ return borderSideValue(theme, parsed, "border-bottom");
1361
+ case "border-l":
1362
+ return borderSideValue(theme, parsed, "border-left");
1363
+ case "border-x":
1364
+ return borderAxisValue(theme, parsed, "border-left", "border-right");
1365
+ case "border-y":
1366
+ return borderAxisValue(theme, parsed, "border-top", "border-bottom");
1367
+ case "rounded": {
1368
+ if (parsed.value === null) return [decl("border-radius", "0.25rem")];
1369
+ const value = parsed.value;
1370
+ if (!parsed.isArbitrary) {
1371
+ const size = radiusSize(value);
1372
+ if (size !== null) return [decl("border-radius", size)];
1373
+ }
1374
+ const v = resolveLength(theme, parsed);
1375
+ return v === null ? null : [decl("border-radius", v)];
1376
+ }
1377
+ case "ring":
1378
+ if (parsed.value === null) return [decl("--kb-ring-width", "3px"), decl("box-shadow", RING_BOX_SHADOW)];
1379
+ return ringValue(theme, parsed);
1380
+ case "ring-offset":
1381
+ return ringOffsetValue(theme, parsed);
1382
+ case "outline":
1383
+ if (parsed.value === null) return [decl("outline-style", "solid")];
1384
+ if (parsed.value === "none") return [decl("outline", "none")];
1385
+ return outlineValue(theme, parsed);
1386
+ case "outline-offset":
1387
+ return outlineOffsetValue(parsed);
1388
+ default:
1389
+ if (parsed.utility.startsWith("rounded-") && RADIUS_SIDES.has(parsed.utility.slice("rounded-".length))) {
1390
+ return resolveRadiusSide(theme, parsed, parsed.utility.slice("rounded-".length));
1391
+ }
1392
+ return null;
1393
+ }
1394
+ }
1395
+
1396
+ // src/jsEngine/resolvers/typography.ts
1397
+ function textSize(key) {
1398
+ switch (key) {
1399
+ case "xs":
1400
+ return "0.75rem";
1401
+ case "sm":
1402
+ return "0.875rem";
1403
+ case "base":
1404
+ return "1rem";
1405
+ case "lg":
1406
+ return "1.125rem";
1407
+ case "xl":
1408
+ return "1.25rem";
1409
+ case "2xl":
1410
+ return "1.5rem";
1411
+ case "3xl":
1412
+ return "1.875rem";
1413
+ case "4xl":
1414
+ return "2.25rem";
1415
+ case "5xl":
1416
+ return "3rem";
1417
+ case "6xl":
1418
+ return "3.75rem";
1419
+ case "7xl":
1420
+ return "4.5rem";
1421
+ case "8xl":
1422
+ return "6rem";
1423
+ case "9xl":
1424
+ return "8rem";
1425
+ default:
1426
+ return null;
1427
+ }
1428
+ }
1429
+ function lineHeightSize(key) {
1430
+ switch (key) {
1431
+ case "3":
1432
+ return "0.75rem";
1433
+ case "4":
1434
+ return "1rem";
1435
+ case "5":
1436
+ return "1.25rem";
1437
+ case "6":
1438
+ return "1.5rem";
1439
+ case "7":
1440
+ return "1.75rem";
1441
+ case "8":
1442
+ return "2rem";
1443
+ case "9":
1444
+ return "2.25rem";
1445
+ case "10":
1446
+ return "2.5rem";
1447
+ default:
1448
+ return null;
1449
+ }
1450
+ }
1451
+ function textAlign(key) {
1452
+ switch (key) {
1453
+ case "left":
1454
+ return "left";
1455
+ case "center":
1456
+ return "center";
1457
+ case "right":
1458
+ return "right";
1459
+ case "justify":
1460
+ return "justify";
1461
+ // Logical alignment — same "no direction-tracking logic needed" reasoning
1462
+ // as layout.rs's start/end inset properties.
1463
+ case "start":
1464
+ return "start";
1465
+ case "end":
1466
+ return "end";
1467
+ default:
1468
+ return null;
1469
+ }
1470
+ }
1471
+ function fontWeight(key) {
1472
+ switch (key) {
1473
+ case "thin":
1474
+ return "100";
1475
+ case "extralight":
1476
+ return "200";
1477
+ case "light":
1478
+ return "300";
1479
+ case "normal":
1480
+ return "400";
1481
+ case "medium":
1482
+ return "500";
1483
+ case "semibold":
1484
+ return "600";
1485
+ case "bold":
1486
+ return "700";
1487
+ case "extrabold":
1488
+ return "800";
1489
+ case "black":
1490
+ return "900";
1491
+ default:
1492
+ return null;
1493
+ }
1494
+ }
1495
+ function fontFamilyValue(theme, key) {
1496
+ const fromTheme = theme.fontFamily?.[key];
1497
+ if (fromTheme !== void 0) return fromTheme;
1498
+ switch (key) {
1499
+ case "sans":
1500
+ return 'ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"';
1501
+ case "serif":
1502
+ return 'ui-serif, Georgia, Cambria, "Times New Roman", Times, serif';
1503
+ case "mono":
1504
+ return 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace';
1505
+ default:
1506
+ return null;
404
1507
  }
405
- return element;
406
1508
  }
1509
+
1510
+ // src/jsEngine/resolvers/effects.ts
1511
+ function nativeShadowValue(key) {
1512
+ switch (key) {
1513
+ case "sm":
1514
+ return { offsetY: 1, radius: 2, opacity: 0.05, elevation: 1 };
1515
+ case "DEFAULT":
1516
+ return { offsetY: 1, radius: 3, opacity: 0.1, elevation: 2 };
1517
+ case "md":
1518
+ return { offsetY: 4, radius: 6, opacity: 0.1, elevation: 4 };
1519
+ case "lg":
1520
+ return { offsetY: 10, radius: 15, opacity: 0.1, elevation: 8 };
1521
+ case "xl":
1522
+ return { offsetY: 20, radius: 25, opacity: 0.1, elevation: 12 };
1523
+ case "2xl":
1524
+ return { offsetY: 25, radius: 50, opacity: 0.25, elevation: 16 };
1525
+ case "none":
1526
+ return { offsetY: 0, radius: 0, opacity: 0, elevation: 0 };
1527
+ default:
1528
+ return null;
1529
+ }
1530
+ }
1531
+ function nativeShadowDeclarations(parsed) {
1532
+ if (parsed.utility !== "shadow" || parsed.isArbitrary) return null;
1533
+ const key = parsed.value ?? "DEFAULT";
1534
+ const s = nativeShadowValue(key);
1535
+ if (s === null) return null;
1536
+ return [
1537
+ decl("shadow-color", "#000000"),
1538
+ decl("shadow-offset-x", "0"),
1539
+ decl("shadow-offset-y", String(s.offsetY)),
1540
+ decl("shadow-opacity", String(s.opacity)),
1541
+ decl("shadow-radius", String(s.radius)),
1542
+ decl("elevation", String(s.elevation))
1543
+ ];
1544
+ }
1545
+
1546
+ // src/jsEngine/resolveUtilityNative.ts
1547
+ function firstFontName(stack) {
1548
+ const first = stack.split(",")[0] ?? stack;
1549
+ return first.trim().replace(/^["']|["']$/g, "");
1550
+ }
1551
+ function resolveTypographyNative(parsed, theme) {
1552
+ switch (parsed.utility) {
1553
+ case "font": {
1554
+ if (parsed.value === null) return null;
1555
+ if (parsed.isArbitrary) {
1556
+ return [decl("font-family", firstFontName(parsed.value))];
1557
+ }
1558
+ const w = fontWeight(parsed.value);
1559
+ if (w !== null) return [decl("font-weight", w)];
1560
+ const family = fontFamilyValue(theme, parsed.value);
1561
+ return family === null ? null : [decl("font-family", firstFontName(family))];
1562
+ }
1563
+ case "uppercase":
1564
+ return [decl("text-transform", "uppercase")];
1565
+ case "lowercase":
1566
+ return [decl("text-transform", "lowercase")];
1567
+ case "capitalize":
1568
+ return [decl("text-transform", "capitalize")];
1569
+ case "underline":
1570
+ return [decl("text-decoration-line", "underline")];
1571
+ case "line-through":
1572
+ return [decl("text-decoration-line", "line-through")];
1573
+ case "no-underline":
1574
+ return [decl("text-decoration-line", "none")];
1575
+ case "italic":
1576
+ return [decl("font-style", "italic")];
1577
+ case "not-italic":
1578
+ return [decl("font-style", "normal")];
1579
+ default:
1580
+ return null;
1581
+ }
1582
+ }
1583
+ function resolveLeadingTrackingNative(parsed) {
1584
+ const value = parsed.value;
1585
+ if (value === null) return null;
1586
+ if (parsed.utility === "leading") {
1587
+ if (parsed.isArbitrary) return [decl("line-height", value)];
1588
+ const v = lineHeightSize(value);
1589
+ return v === null ? null : [decl("line-height", v)];
1590
+ }
1591
+ if (parsed.utility === "tracking" && parsed.isArbitrary) {
1592
+ return [decl("letter-spacing", value)];
1593
+ }
1594
+ return null;
1595
+ }
1596
+ function nativeHexColor(parsed, theme) {
1597
+ return colorValue(theme, parsed);
1598
+ }
1599
+ function resolveTextNative(parsed, theme) {
1600
+ if (!parsed.isArbitrary && parsed.value !== null) {
1601
+ const size = textSize(parsed.value);
1602
+ if (size !== null) return [decl("font-size", size)];
1603
+ const align = textAlign(parsed.value);
1604
+ if (align !== null) return [decl("text-align", align)];
1605
+ }
1606
+ const hex = nativeHexColor(parsed, theme);
1607
+ return hex === null ? null : [decl("color", hex)];
1608
+ }
1609
+ function resolveColorNative(parsed, theme) {
1610
+ switch (parsed.utility) {
1611
+ case "bg": {
1612
+ const hex = nativeHexColor(parsed, theme);
1613
+ return hex === null ? null : [decl("background-color", hex)];
1614
+ }
1615
+ case "text":
1616
+ return resolveTextNative(parsed, theme);
1617
+ default:
1618
+ return null;
1619
+ }
1620
+ }
1621
+ function resolveOpacityNative(parsed) {
1622
+ if (parsed.utility !== "opacity") return null;
1623
+ const v = resolvePercent(parsed);
1624
+ return v === null ? null : [decl("opacity", v)];
1625
+ }
1626
+ function resolveUtilityNative(parsed, theme) {
1627
+ return resolveFlex(parsed, false) ?? resolve(parsed, theme) ?? resolve2(parsed, theme) ?? resolve3(parsed, theme) ?? resolveColorNative(parsed, theme) ?? resolveLeadingTrackingNative(parsed) ?? resolveTypographyNative(parsed, theme) ?? resolveOpacityNative(parsed) ?? nativeShadowDeclarations(parsed);
1628
+ }
1629
+
1630
+ // src/jsEngine/resolveStyle.ts
1631
+ var RESPONSIVE_BREAKPOINTS = /* @__PURE__ */ new Set(["sm", "md", "lg", "xl", "2xl"]);
1632
+ function nativeModifierState(modifier, theme, colorScheme, pressed, width) {
1633
+ if (modifier === "dark") return colorScheme === "dark";
1634
+ if (modifier === "active") return pressed;
1635
+ if (RESPONSIVE_BREAKPOINTS.has(modifier)) {
1636
+ const minWidth = theme.screens[modifier];
1637
+ if (minWidth === void 0) return null;
1638
+ return width >= minWidth;
1639
+ }
1640
+ return null;
1641
+ }
1642
+ function kebabToCamel(s) {
1643
+ return s.replace(/-([a-z])/g, (_, c) => c.toUpperCase());
1644
+ }
1645
+ var NUMERIC_LENGTH_PROPS = /* @__PURE__ */ new Set([
1646
+ "padding",
1647
+ "padding-top",
1648
+ "padding-right",
1649
+ "padding-bottom",
1650
+ "padding-left",
1651
+ "margin",
1652
+ "margin-top",
1653
+ "margin-right",
1654
+ "margin-bottom",
1655
+ "margin-left",
1656
+ "gap",
1657
+ "column-gap",
1658
+ "row-gap",
1659
+ "width",
1660
+ "height",
1661
+ "min-width",
1662
+ "max-width",
1663
+ "min-height",
1664
+ "max-height",
1665
+ "top",
1666
+ "right",
1667
+ "bottom",
1668
+ "left",
1669
+ "inset",
1670
+ "border-radius",
1671
+ "border-width",
1672
+ "font-size",
1673
+ "z-index",
1674
+ "line-height",
1675
+ "letter-spacing",
1676
+ "flex",
1677
+ "flex-grow",
1678
+ "flex-shrink",
1679
+ "order",
1680
+ "flex-basis",
1681
+ "shadow-opacity",
1682
+ "shadow-radius",
1683
+ "elevation",
1684
+ "opacity",
1685
+ // Per-side border width + per-corner radius — see resolvers/border.ts's
1686
+ // new borderSideValue/borderAxisValue/resolveRadiusSide additions; RN's
1687
+ // style system wants plain numbers for these exactly like the generic
1688
+ // "border-width"/"border-radius" forms above.
1689
+ "border-top-width",
1690
+ "border-right-width",
1691
+ "border-bottom-width",
1692
+ "border-left-width",
1693
+ "border-top-left-radius",
1694
+ "border-top-right-radius",
1695
+ "border-bottom-right-radius",
1696
+ "border-bottom-left-radius",
1697
+ "outline-width",
1698
+ "outline-offset"
1699
+ ]);
1700
+ function isPlainPercentage(value) {
1701
+ if (!value.endsWith("%")) return false;
1702
+ let digits = value.slice(0, -1);
1703
+ if (digits.startsWith("-")) digits = digits.slice(1);
1704
+ return digits.length > 0 && /^[0-9.]+$/.test(digits);
1705
+ }
1706
+ function rnStyleValue(property, value) {
1707
+ if (!NUMERIC_LENGTH_PROPS.has(property)) {
1708
+ return { value, warning: null };
1709
+ }
1710
+ let px = null;
1711
+ if (value.endsWith("px")) {
1712
+ const n = Number(value.slice(0, -2));
1713
+ px = Number.isFinite(n) ? n : null;
1714
+ } else if (value.endsWith("rem")) {
1715
+ const n = Number(value.slice(0, -3));
1716
+ px = Number.isFinite(n) ? n * 16 : null;
1717
+ } else {
1718
+ const n = Number(value);
1719
+ px = value.trim() !== "" && Number.isFinite(n) ? n : null;
1720
+ }
1721
+ if (px !== null) return { value: px, warning: null };
1722
+ if (isPlainPercentage(value)) {
1723
+ return { value, warning: null };
1724
+ }
1725
+ const reduced = reduceConstantMath(value);
1726
+ if (reduced !== null) {
1727
+ return { value: reduced, warning: null };
1728
+ }
1729
+ const warning = `Kbach: "${value}" is not a valid native value for "${property}" \u2014 dropped. calc()/clamp()/min()/max() only resolve on native when every operand is a constant px/rem length (no %, vw, vh, var(), or other viewport/CSS-variable units \u2014 those need real layout/DOM, which doesn't exist on native at paint time). Use a plain px/rem calc, a fraction utility (e.g. w-1/2), or resolve this value in JS instead.`;
1730
+ return { value: null, warning };
1731
+ }
1732
+ function resolveStyleJsWithWarnings(classString, theme, colorScheme, pressed, width) {
1733
+ const style = {};
1734
+ const warnings = [];
1735
+ let shadowOffset = null;
1736
+ for (const token of classString.split(/\s+/).filter(Boolean)) {
1737
+ const parsed = parseClass(token);
1738
+ const allModifiersHold = parsed.modifiers.every(
1739
+ (m) => nativeModifierState(m, theme, colorScheme, pressed, width) === true
1740
+ );
1741
+ if (!allModifiersHold) continue;
1742
+ const decls = resolveUtilityNative(parsed, theme);
1743
+ if (decls === null) continue;
1744
+ for (const d of decls) {
1745
+ if (d.property.startsWith("__")) {
1746
+ continue;
1747
+ }
1748
+ if (d.property === "shadow-offset-x" || d.property === "shadow-offset-y") {
1749
+ const n = Number(d.value);
1750
+ if (!Number.isFinite(n)) continue;
1751
+ if (shadowOffset === null) shadowOffset = {};
1752
+ shadowOffset[d.property === "shadow-offset-x" ? "width" : "height"] = n;
1753
+ continue;
1754
+ }
1755
+ const { value, warning } = rnStyleValue(d.property, d.value);
1756
+ if (warning !== null) warnings.push(warning);
1757
+ if (value !== null) style[kebabToCamel(d.property)] = value;
1758
+ }
1759
+ }
1760
+ if (shadowOffset !== null) {
1761
+ style.shadowOffset = { width: shadowOffset.width ?? 0, height: shadowOffset.height ?? 0 };
1762
+ }
1763
+ return { style, warnings };
1764
+ }
1765
+
1766
+ // src/nativeBridge.ts
1767
+ function resolveStyle(classString, pressed = false) {
1768
+ const colorScheme = (0, import_darkModeStore2.getGlobalDarkMode)() ? "dark" : "light";
1769
+ const width = import_react_native2.Dimensions.get("window").width;
1770
+ const KbachModule = import_react_native2.TurboModuleRegistry.get("KbachModule");
1771
+ if (!KbachModule) {
1772
+ const { style: style2, warnings: warnings2 } = resolveStyleJsWithWarnings(classString, (0, import_theme.getTheme)(), colorScheme, pressed, width);
1773
+ warnIfDev(classString, warnings2);
1774
+ return style2;
1775
+ }
1776
+ const json = KbachModule.resolveStyle(classString, (0, import_theme.getThemeJson)(), colorScheme, pressed, width);
1777
+ const style = JSON.parse(json);
1778
+ const warnings = style.__kbachWarnings;
1779
+ if (warnings !== void 0) {
1780
+ delete style.__kbachWarnings;
1781
+ warnIfDev(classString, warnings);
1782
+ }
1783
+ return style;
1784
+ }
1785
+ var warnedMessages = /* @__PURE__ */ new Set();
1786
+ function warnIfDev(classString, warnings) {
1787
+ if (warnings.length === 0) return;
1788
+ if (typeof __DEV__ !== "undefined" && !__DEV__) return;
1789
+ for (const warning of warnings) {
1790
+ const message = `${warning} (from className "${classString}")`;
1791
+ if (warnedMessages.has(message)) continue;
1792
+ warnedMessages.add(message);
1793
+ console.warn(message);
1794
+ }
1795
+ }
1796
+
1797
+ // src/jsx-runtime.tsx
1798
+ var { jsx, jsxs } = createJsxFunctions(resolveStyle);
1799
+
1800
+ // src/jsx-dev-runtime.tsx
1801
+ var jsxDEV = createJsxDEV(jsx, jsxs);
407
1802
  // Annotate the CommonJS export names for ESM import in node:
408
1803
  0 && (module.exports = {
409
1804
  Fragment,