@kbach/ui 0.1.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3712 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/core/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ BASE_RESET: () => BASE_RESET,
24
+ LRUCache: () => LRUCache,
25
+ RESET_STYLE_ID: () => RESET_STYLE_ID,
26
+ buildConfig: () => buildConfig,
27
+ clearCache: () => clearCache,
28
+ clearPluginModifiers: () => clearPluginModifiers,
29
+ defaultColors: () => defaultColors,
30
+ defaultTheme: () => defaultTheme,
31
+ disableRuntimeCSS: () => disableRuntimeCSS,
32
+ escapeCSSSelector: () => escapeCSSSelector,
33
+ expandModeAwareColorClasses: () => expandModeAwareColorClasses,
34
+ flatten: () => flatten,
35
+ generateClassCSS: () => generateClassCSS,
36
+ generateKbachTypesDts: () => generateKbachTypesDts,
37
+ getActiveBreakpoints: () => getActiveBreakpoints,
38
+ getAllModifierNames: () => getAllModifierNames,
39
+ getBuiltinStandaloneNames: () => getBuiltinStandaloneNames,
40
+ getBuiltinUtilityPrefixes: () => getBuiltinUtilityPrefixes,
41
+ getConfig: () => getConfig,
42
+ getDefaultFontFamily: () => getDefaultFontFamily,
43
+ getEffectiveIsWeb: () => getEffectiveIsWeb,
44
+ getGlobalDarkMode: () => getGlobalDarkMode,
45
+ getGlobalScreens: () => getGlobalScreens,
46
+ getGlobalWidth: () => getGlobalWidth,
47
+ getInteractiveModifiers: () => getInteractiveModifiers,
48
+ getModeModifiers: () => getModeModifiers,
49
+ getModifier: () => getModifier,
50
+ getResponsiveModifiers: () => getResponsiveModifiers,
51
+ initConfig: () => initConfig,
52
+ isKnownModifier: () => isKnownModifier,
53
+ isKnownUtility: () => isKnownUtility,
54
+ isModeAwareColor: () => isModeAwareColor,
55
+ isNative: () => isNative,
56
+ isRuntimeCSSDisabled: () => isRuntimeCSSDisabled,
57
+ isWeb: () => isWeb,
58
+ kbachWarn: () => kbachWarn,
59
+ matchModifier: () => matchModifier,
60
+ normalizeClassString: () => normalizeClassString,
61
+ onConfigChange: () => onConfigChange,
62
+ parseClass: () => parseClass,
63
+ parseClasses: () => parseClasses,
64
+ parseHexRgb: () => parseHexRgb,
65
+ registerModifier: () => registerModifier,
66
+ resetConfig: () => resetConfig,
67
+ resolve: () => resolve,
68
+ resolveColor: () => resolveColor,
69
+ resolveSizing: () => resolveSizing,
70
+ resolveSpacing: () => resolveSpacing,
71
+ resolveUtility: () => resolveUtility,
72
+ setDefaultFontFamily: () => setDefaultFontFamily,
73
+ setGlobalDarkMode: () => setGlobalDarkMode,
74
+ setGlobalWidth: () => setGlobalWidth,
75
+ setResolveTarget: () => setResolveTarget,
76
+ splitClassTokens: () => splitClassTokens,
77
+ subscribeGlobalDarkMode: () => subscribeGlobalDarkMode,
78
+ subscribeGlobalWidth: () => subscribeGlobalWidth,
79
+ syncGlobalDarkMode: () => syncGlobalDarkMode,
80
+ syncGlobalScreens: () => syncGlobalScreens,
81
+ syncGlobalWidth: () => syncGlobalWidth,
82
+ toNativeValue: () => toNativeValue,
83
+ updateConfig: () => updateConfig
84
+ });
85
+ module.exports = __toCommonJS(index_exports);
86
+
87
+ // src/core/colorValue.ts
88
+ function isModeAwareColor(v) {
89
+ return typeof v === "object" && v !== null && "light" in v && "dark" in v;
90
+ }
91
+ function splitColorShadeRef(ref) {
92
+ const lastDash = ref.lastIndexOf("-");
93
+ if (lastDash <= 0) return null;
94
+ return { name: ref.slice(0, lastDash), shade: ref.slice(lastDash + 1) };
95
+ }
96
+
97
+ // src/core/platform.ts
98
+ var isWeb = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
99
+ var isNative = !isWeb && (typeof globalThis.HermesInternal !== "undefined" || typeof globalThis.__fbBatchedBridge !== "undefined" || typeof navigator !== "undefined" && navigator.product === "ReactNative" || typeof globalThis.__REACT_NATIVE__ !== "undefined" || typeof globalThis.nativeFabricUIManager !== "undefined" || typeof globalThis.__turboModuleProxy !== "undefined" || typeof globalThis.RN$Bridgeless !== "undefined" || typeof globalThis.nativePerformanceNow !== "undefined");
100
+ var _resolveTargetOverride = null;
101
+ function setResolveTarget(target) {
102
+ _resolveTargetOverride = target;
103
+ }
104
+ function getEffectiveIsWeb() {
105
+ if (_resolveTargetOverride) return _resolveTargetOverride === "web";
106
+ return isWeb || !isNative;
107
+ }
108
+ function toNativeValue(raw) {
109
+ if (/^-?\d+(\.\d+)?px$/.test(raw)) return parseFloat(raw);
110
+ if (/^-?\d+(\.\d+)?rem$/.test(raw)) return parseFloat(raw) * 16;
111
+ if (/^-?\d+(\.\d+)?em$/.test(raw)) return parseFloat(raw) * 16;
112
+ if (/^-?\d+(\.\d+)?$/.test(raw)) return parseFloat(raw);
113
+ return raw;
114
+ }
115
+ function escapeCSSSelector(cls) {
116
+ return cls.replace(/[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g, "\\$&");
117
+ }
118
+
119
+ // src/core/devWarn.ts
120
+ function kbachWarn(message) {
121
+ console.warn(
122
+ "%c[kbach]%c " + message,
123
+ "color:#8b5cf6;font-weight:700",
124
+ "color:inherit;font-weight:400"
125
+ );
126
+ }
127
+
128
+ // src/core/cache.ts
129
+ var LRUCache = class {
130
+ constructor(capacity = 1e4, onEvict) {
131
+ this.capacity = capacity;
132
+ if (capacity <= 0) throw new Error("LRUCache: capacity must be a positive integer");
133
+ this.cache = /* @__PURE__ */ new Map();
134
+ this.onEvict = onEvict;
135
+ }
136
+ get(key) {
137
+ if (!this.cache.has(key)) return void 0;
138
+ const value = this.cache.get(key);
139
+ this.cache.delete(key);
140
+ this.cache.set(key, value);
141
+ return value;
142
+ }
143
+ set(key, value) {
144
+ if (this.cache.has(key)) {
145
+ this.cache.delete(key);
146
+ } else if (this.cache.size >= this.capacity) {
147
+ const oldestKey = this.cache.keys().next().value;
148
+ const oldestValue = this.cache.get(oldestKey);
149
+ this.cache.delete(oldestKey);
150
+ this.onEvict?.(oldestKey, oldestValue);
151
+ }
152
+ this.cache.set(key, value);
153
+ return this;
154
+ }
155
+ has(key) {
156
+ return this.cache.has(key);
157
+ }
158
+ delete(key) {
159
+ return this.cache.delete(key);
160
+ }
161
+ clear() {
162
+ this.cache.clear();
163
+ }
164
+ get size() {
165
+ return this.cache.size;
166
+ }
167
+ };
168
+
169
+ // src/core/registry.ts
170
+ var BUILTIN_MODIFIERS = {
171
+ // ── Mode ─────────────────────────────────────────────────────────────────
172
+ dark: { order: 60, darkScheme: "dark", jsBehavior: "mode", jsMatch: (d) => d },
173
+ "not-light": { order: 60, darkScheme: "dark", jsBehavior: "mode", jsMatch: (d) => d },
174
+ light: { order: 60, darkScheme: "light", jsBehavior: "mode", jsMatch: (d) => !d },
175
+ "not-dark": { order: 60, darkScheme: "light", jsBehavior: "mode", jsMatch: (d) => !d },
176
+ // ── Interactive — JS state + CSS pseudo ───────────────────────────────────
177
+ hover: { order: 10, pseudo: ":hover", jsBehavior: "interactive", jsMatch: (_, s) => !!s.hover },
178
+ "not-hover": { order: 10, pseudo: ":not(:hover)", jsBehavior: "interactive", jsMatch: (_, s) => !s.hover },
179
+ focus: { order: 20, pseudo: ":focus", jsBehavior: "interactive", jsMatch: (_, s) => !!s.focus },
180
+ "not-focus": { order: 20, pseudo: ":not(:focus)", jsBehavior: "interactive", jsMatch: (_, s) => !s.focus },
181
+ active: { order: 30, pseudo: ":active", jsBehavior: "interactive", jsMatch: (_, s) => !!s.active || !!s.pressed },
182
+ "not-active": { order: 30, pseudo: ":not(:active)", jsBehavior: "interactive", jsMatch: (_, s) => !s.active && !s.pressed },
183
+ pressed: { order: 30, pseudo: ":active", jsBehavior: "interactive", jsMatch: (_, s) => !!s.pressed || !!s.active },
184
+ "not-pressed": { order: 30, pseudo: ":not(:active)", jsBehavior: "interactive", jsMatch: (_, s) => !s.pressed && !s.active },
185
+ disabled: { order: 40, pseudo: ":disabled", jsBehavior: "interactive", jsMatch: (_, s) => !!s.disabled },
186
+ "not-disabled": { order: 40, pseudo: ":not(:disabled)", jsBehavior: "interactive", jsMatch: (_, s) => !s.disabled },
187
+ checked: { order: 35, pseudo: ":checked", jsBehavior: "interactive", jsMatch: (_, s) => !!s.checked },
188
+ "not-checked": { order: 35, pseudo: ":not(:checked)", jsBehavior: "interactive", jsMatch: (_, s) => !s.checked },
189
+ visited: { order: 5, pseudo: ":visited", jsBehavior: "interactive", jsMatch: (_, s) => !!s.visited },
190
+ "not-visited": { order: 5, pseudo: ":not(:visited)", jsBehavior: "interactive", jsMatch: (_, s) => !s.visited },
191
+ placeholder: { order: 0, pseudo: "::placeholder", jsBehavior: "interactive", jsMatch: (_, s) => !!s.placeholder },
192
+ // ── CSS-only pseudo-classes (structural) ──────────────────────────────────
193
+ first: { order: 0, pseudo: ":first-child", jsBehavior: "css-only", forcesImportant: true },
194
+ last: { order: 0, pseudo: ":last-child", jsBehavior: "css-only", forcesImportant: true },
195
+ odd: { order: 0, pseudo: ":nth-child(odd)", jsBehavior: "css-only", forcesImportant: true },
196
+ even: { order: 0, pseudo: ":nth-child(even)", jsBehavior: "css-only", forcesImportant: true },
197
+ only: { order: 0, pseudo: ":only-child", jsBehavior: "css-only", forcesImportant: true },
198
+ "focus-within": { order: 15, pseudo: ":focus-within", jsBehavior: "css-only", forcesImportant: true },
199
+ "focus-visible": { order: 25, pseudo: ":focus-visible", jsBehavior: "css-only", forcesImportant: true },
200
+ // ── CSS-only pseudo-elements ───────────────────────────────────────────────
201
+ before: { order: 0, pseudo: "::before", jsBehavior: "css-only" },
202
+ after: { order: 0, pseudo: "::after", jsBehavior: "css-only" },
203
+ selection: { order: 0, pseudo: "::selection", jsBehavior: "css-only" },
204
+ "first-letter": { order: 0, pseudo: "::first-letter", jsBehavior: "css-only" },
205
+ "first-line": { order: 0, pseudo: "::first-line", jsBehavior: "css-only" },
206
+ marker: { order: 0, pseudo: "::marker", jsBehavior: "css-only" },
207
+ // ── Group / peer ancestor selectors (CSS-only) ─────────────────────────────
208
+ "group-hover": { order: 10, ancestorSelector: ".group:hover ", jsBehavior: "css-only", forcesImportant: true },
209
+ "group-focus": { order: 20, ancestorSelector: ".group:focus ", jsBehavior: "css-only", forcesImportant: true },
210
+ "peer-hover": { order: 10, ancestorSelector: ".peer:hover ~ ", jsBehavior: "css-only", forcesImportant: true },
211
+ "peer-focus": { order: 20, ancestorSelector: ".peer:focus ~ ", jsBehavior: "css-only", forcesImportant: true },
212
+ // ── Responsive — both CSS (@media min-width) and JS (breakpoints set) ──────
213
+ sm: { order: 50, isResponsive: true, jsBehavior: "responsive", jsMatch: (_, __, bp) => bp.has("sm") },
214
+ md: { order: 50, isResponsive: true, jsBehavior: "responsive", jsMatch: (_, __, bp) => bp.has("md") },
215
+ lg: { order: 50, isResponsive: true, jsBehavior: "responsive", jsMatch: (_, __, bp) => bp.has("lg") },
216
+ xl: { order: 50, isResponsive: true, jsBehavior: "responsive", jsMatch: (_, __, bp) => bp.has("xl") },
217
+ "2xl": { order: 50, isResponsive: true, jsBehavior: "responsive", jsMatch: (_, __, bp) => bp.has("2xl") },
218
+ // ── Print media (CSS-only) ─────────────────────────────────────────────────
219
+ print: { order: 70, mediaQuery: "print", jsBehavior: "css-only", forcesImportant: true },
220
+ // ── Orientation / accessibility media (CSS-only) ───────────────────────────
221
+ landscape: { order: 70, mediaQuery: "(orientation: landscape)", jsBehavior: "css-only", forcesImportant: true },
222
+ portrait: { order: 70, mediaQuery: "(orientation: portrait)", jsBehavior: "css-only", forcesImportant: true },
223
+ "motion-reduce": { order: 70, mediaQuery: "(prefers-reduced-motion: reduce)", jsBehavior: "css-only", forcesImportant: true },
224
+ "motion-safe": { order: 70, mediaQuery: "(prefers-reduced-motion: no-preference)", jsBehavior: "css-only", forcesImportant: true },
225
+ "contrast-more": { order: 70, mediaQuery: "(prefers-contrast: more)", jsBehavior: "css-only", forcesImportant: true },
226
+ "contrast-less": { order: 70, mediaQuery: "(prefers-contrast: less)", jsBehavior: "css-only", forcesImportant: true },
227
+ // ── Directionality (CSS-only) ──────────────────────────────────────────────
228
+ rtl: { order: 80, dirSelector: '[dir="rtl"] ', jsBehavior: "css-only", forcesImportant: true },
229
+ ltr: { order: 80, dirSelector: '[dir="ltr"] ', jsBehavior: "css-only", forcesImportant: true }
230
+ };
231
+ var _pluginModifiers = {};
232
+ var _allNames = null;
233
+ var _interactiveNames = null;
234
+ var _modeNames = null;
235
+ var _responsiveNames = null;
236
+ function _invalidate() {
237
+ _allNames = null;
238
+ _interactiveNames = null;
239
+ _modeNames = null;
240
+ _responsiveNames = null;
241
+ }
242
+ function registerModifier(name, def) {
243
+ if (process.env.NODE_ENV !== "production" && name in BUILTIN_MODIFIERS) {
244
+ kbachWarn(`"${name}" is built-in \u2014 pick another modifier name`);
245
+ return;
246
+ }
247
+ _pluginModifiers[name] = def;
248
+ _invalidate();
249
+ }
250
+ function clearPluginModifiers() {
251
+ for (const k of Object.keys(_pluginModifiers)) delete _pluginModifiers[k];
252
+ _invalidate();
253
+ }
254
+ var NAMED_GROUP_PEER_RE = /^(group|peer)-(hover|focus)\/(.+)$/;
255
+ var _namedModifierCache = new LRUCache(1e4);
256
+ function getNamedGroupPeerModifier(name) {
257
+ const cached = _namedModifierCache.get(name);
258
+ if (cached) return cached;
259
+ const m = NAMED_GROUP_PEER_RE.exec(name);
260
+ if (!m) return void 0;
261
+ const [, kind, trigger, groupName] = m;
262
+ const escapedName = escapeCSSSelector(groupName);
263
+ const pseudo = trigger === "hover" ? ":hover" : ":focus";
264
+ const combinator = kind === "group" ? " " : " ~ ";
265
+ const def = {
266
+ // Matches the plain group-hover/group-focus/peer-hover/peer-focus order below.
267
+ order: trigger === "hover" ? 10 : 20,
268
+ ancestorSelector: `.${kind}\\/${escapedName}${pseudo}${combinator}`,
269
+ jsBehavior: "css-only",
270
+ forcesImportant: true
271
+ };
272
+ _namedModifierCache.set(name, def);
273
+ return def;
274
+ }
275
+ function getModifier(name) {
276
+ return BUILTIN_MODIFIERS[name] ?? _pluginModifiers[name] ?? getNamedGroupPeerModifier(name);
277
+ }
278
+ function isKnownModifier(name) {
279
+ return name in BUILTIN_MODIFIERS || name in _pluginModifiers || NAMED_GROUP_PEER_RE.test(name);
280
+ }
281
+ function _allEntries() {
282
+ return [...Object.entries(BUILTIN_MODIFIERS), ...Object.entries(_pluginModifiers)];
283
+ }
284
+ function getAllModifierNames() {
285
+ if (!_allNames) _allNames = new Set(_allEntries().map(([k]) => k));
286
+ return _allNames;
287
+ }
288
+ function getInteractiveModifiers() {
289
+ if (!_interactiveNames) {
290
+ _interactiveNames = new Set(_allEntries().filter(([, d]) => d.jsBehavior === "interactive").map(([k]) => k));
291
+ }
292
+ return _interactiveNames;
293
+ }
294
+ function getModeModifiers() {
295
+ if (!_modeNames) {
296
+ _modeNames = new Set(_allEntries().filter(([, d]) => d.jsBehavior === "mode").map(([k]) => k));
297
+ }
298
+ return _modeNames;
299
+ }
300
+ function getResponsiveModifiers() {
301
+ if (!_responsiveNames) {
302
+ _responsiveNames = new Set(_allEntries().filter(([, d]) => d.jsBehavior === "responsive").map(([k]) => k));
303
+ }
304
+ return _responsiveNames;
305
+ }
306
+ function getModifierOrder(bucketKey) {
307
+ if (bucketKey === "base") return -1;
308
+ let max = 0;
309
+ for (const mod of bucketKey.split(":")) {
310
+ const order = getModifier(mod)?.order ?? 0;
311
+ if (order > max) max = order;
312
+ }
313
+ return max;
314
+ }
315
+ function matchModifier(name, isDark, state, breakpoints) {
316
+ return getModifier(name)?.jsMatch?.(isDark, state, breakpoints) ?? false;
317
+ }
318
+
319
+ // src/core/resolvers/color.ts
320
+ function pickModeAwareFallback(v) {
321
+ return isModeAwareColor(v) ? v.light : v;
322
+ }
323
+ function resolveColor(value, colors, isArbitrary) {
324
+ if (isArbitrary) return value;
325
+ const slashIdx = value.indexOf("/");
326
+ const colorPart = slashIdx > 0 ? value.slice(0, slashIdx) : value;
327
+ const opacityPart = slashIdx > 0 ? value.slice(slashIdx + 1) : null;
328
+ let hex = null;
329
+ if (colorPart.startsWith("[") && colorPart.endsWith("]")) {
330
+ hex = colorPart.slice(1, -1);
331
+ } else if (colorPart in colors) {
332
+ const entry = colors[colorPart];
333
+ if (typeof entry === "string") hex = entry;
334
+ else if (isModeAwareColor(entry)) hex = pickModeAwareFallback(entry);
335
+ else if (typeof entry === "object" && "6" in entry) hex = pickModeAwareFallback(entry["6"]);
336
+ } else {
337
+ const split = splitColorShadeRef(colorPart);
338
+ if (split) {
339
+ const scale = colors[split.name];
340
+ if (scale && typeof scale === "object" && !isModeAwareColor(scale) && split.shade in scale) {
341
+ const shadeVal = scale[split.shade];
342
+ hex = shadeVal !== void 0 ? pickModeAwareFallback(shadeVal) : null;
343
+ }
344
+ }
345
+ }
346
+ if (!hex) return null;
347
+ if (!opacityPart) {
348
+ if (!getEffectiveIsWeb() && hex.startsWith("#") && hex.length === 9) {
349
+ return hexToRgba(hex, Math.round(parseInt(hex.slice(7, 9), 16) / 255 * 1e3) / 1e3);
350
+ }
351
+ return hex;
352
+ }
353
+ let alpha;
354
+ if (opacityPart.startsWith("[") && opacityPart.endsWith("]")) {
355
+ const v = parseFloat(opacityPart.slice(1, -1));
356
+ alpha = v > 1 ? v / 100 : v;
357
+ } else {
358
+ alpha = parseFloat(opacityPart) / 100;
359
+ }
360
+ if (isNaN(alpha)) return hex;
361
+ if (alpha < 0) alpha = 0;
362
+ else if (alpha > 1) alpha = 1;
363
+ return hexToRgba(hex, alpha);
364
+ }
365
+ function parseHexRgb(hex) {
366
+ const h = hex.replace("#", "");
367
+ if (h.length === 3 || h.length === 4) {
368
+ return [
369
+ parseInt(h[0] + h[0], 16),
370
+ parseInt(h[1] + h[1], 16),
371
+ parseInt(h[2] + h[2], 16)
372
+ ];
373
+ }
374
+ if (h.length === 6 || h.length === 8) {
375
+ return [
376
+ parseInt(h.slice(0, 2), 16),
377
+ parseInt(h.slice(2, 4), 16),
378
+ parseInt(h.slice(4, 6), 16)
379
+ ];
380
+ }
381
+ return null;
382
+ }
383
+ function hexToRgba(hex, alpha) {
384
+ const rgb = parseHexRgb(hex);
385
+ if (!rgb) return hex;
386
+ const [r, g, b] = rgb;
387
+ return `rgba(${r},${g},${b},${alpha})`;
388
+ }
389
+ function withOpacityVar(color, varName) {
390
+ if (!color.startsWith("#")) return color;
391
+ const rgb = parseHexRgb(color);
392
+ if (!rgb) return color;
393
+ const [r, g, b] = rgb;
394
+ return `rgba(${r},${g},${b},var(${varName},1))`;
395
+ }
396
+ var colorResolvers = {
397
+ // ── Background ─────────────────────────────────────────────────────────────
398
+ bg: ({ value, isArbitrary }, { colors }) => {
399
+ const color = resolveColor(value, colors, isArbitrary);
400
+ if (!color) return null;
401
+ return { backgroundColor: getEffectiveIsWeb() ? withOpacityVar(color, "--bg-opacity") : color };
402
+ },
403
+ "bg-opacity": ({ value, isArbitrary }, _) => {
404
+ if (!getEffectiveIsWeb()) return null;
405
+ const n = parseFloat(value);
406
+ if (isNaN(n)) return null;
407
+ const v = isArbitrary ? n > 1 ? n / 100 : n : n / 100;
408
+ return { "--bg-opacity": v };
409
+ },
410
+ // ── Background gradient (CSS variable gradient stops, web-only) ──────────
411
+ "bg-gradient-to": ({ value }) => {
412
+ if (!getEffectiveIsWeb()) return null;
413
+ const directions = {
414
+ t: "to top",
415
+ tr: "to top right",
416
+ r: "to right",
417
+ br: "to bottom right",
418
+ b: "to bottom",
419
+ bl: "to bottom left",
420
+ l: "to left",
421
+ tl: "to top left"
422
+ };
423
+ const dir = directions[value];
424
+ if (!dir) return null;
425
+ return {
426
+ backgroundImage: `linear-gradient(${dir}, var(--kb-gradient-from, transparent), var(--kb-gradient-stops, transparent))`
427
+ };
428
+ },
429
+ from: ({ value, isArbitrary }, { colors }) => {
430
+ if (!getEffectiveIsWeb()) return null;
431
+ const color = resolveColor(value, colors, isArbitrary);
432
+ if (!color) return null;
433
+ return {
434
+ "--kb-gradient-from": color,
435
+ "--kb-gradient-stops": `var(--kb-gradient-from), var(--kb-gradient-to, transparent)`
436
+ };
437
+ },
438
+ via: ({ value, isArbitrary }, { colors }) => {
439
+ if (!getEffectiveIsWeb()) return null;
440
+ const color = resolveColor(value, colors, isArbitrary);
441
+ if (!color) return null;
442
+ return {
443
+ "--kb-gradient-via": color,
444
+ "--kb-gradient-stops": `var(--kb-gradient-from), var(--kb-gradient-via), var(--kb-gradient-to, transparent)`
445
+ };
446
+ },
447
+ to: ({ value, isArbitrary }, { colors }) => {
448
+ if (!getEffectiveIsWeb()) return null;
449
+ const color = resolveColor(value, colors, isArbitrary);
450
+ if (!color) return null;
451
+ return { "--kb-gradient-to": color };
452
+ },
453
+ // ── Tint color (native-only, for Image and icon components) ──────────────
454
+ tint: ({ value, isArbitrary }, { colors }) => {
455
+ if (getEffectiveIsWeb()) return null;
456
+ const color = resolveColor(value, colors, isArbitrary);
457
+ return color ? { tintColor: color } : null;
458
+ },
459
+ // ── Caret color (web-only) ────────────────────────────────────────────────
460
+ caret: ({ value, isArbitrary }, { colors }) => {
461
+ if (!getEffectiveIsWeb()) return null;
462
+ if (value === "auto" || value === "transparent") return { caretColor: value };
463
+ const color = resolveColor(value, colors, isArbitrary);
464
+ return color ? { caretColor: color } : null;
465
+ },
466
+ // ── Accent color (web-only) ───────────────────────────────────────────────
467
+ accent: ({ value, isArbitrary }, { colors }) => {
468
+ if (!getEffectiveIsWeb()) return null;
469
+ if (value === "auto") return { accentColor: "auto" };
470
+ const color = resolveColor(value, colors, isArbitrary);
471
+ return color ? { accentColor: color } : null;
472
+ }
473
+ };
474
+
475
+ // src/core/resolvers/spacing.ts
476
+ function resolveSpacing(value, negative, spacing, isArbitrary) {
477
+ if (isArbitrary) {
478
+ const resolved = getEffectiveIsWeb() ? value : toNativeValue(value);
479
+ if (negative) {
480
+ if (typeof resolved === "number") return -resolved;
481
+ if (typeof resolved === "string") {
482
+ if (resolved.startsWith("-")) return resolved.slice(1);
483
+ if (/^\d/.test(resolved)) return `-${resolved}`;
484
+ if (/^(calc|var|min|max|clamp|env)\s*\(/.test(resolved)) return `calc(-1 * (${resolved}))`;
485
+ }
486
+ }
487
+ return resolved;
488
+ }
489
+ const raw = spacing[value];
490
+ if (raw === void 0) return null;
491
+ if (typeof raw === "number") return negative ? -raw : raw;
492
+ if (raw === "auto") return "auto";
493
+ if (negative && typeof raw === "string" && raw.endsWith("%")) {
494
+ return `-${raw}`;
495
+ }
496
+ return raw;
497
+ }
498
+ function resolveSizing(value, spacing, isArbitrary) {
499
+ if (isArbitrary) return getEffectiveIsWeb() ? value : toNativeValue(value);
500
+ const raw = spacing[value];
501
+ if (raw !== void 0) return raw;
502
+ if (/^\d+\/\d+$/.test(value)) {
503
+ const [num, den] = value.split("/").map(Number);
504
+ if (!den) return null;
505
+ return `${(num / den * 100).toFixed(6)}%`;
506
+ }
507
+ return null;
508
+ }
509
+ function makeSpacingResolver(prop) {
510
+ return ({ value, negative, isArbitrary }, { spacing }) => {
511
+ const v = resolveSpacing(value, negative, spacing, isArbitrary);
512
+ return v !== null ? { [prop]: v } : null;
513
+ };
514
+ }
515
+ var PADDING_MARGIN_PROPS = {
516
+ p: "padding",
517
+ px: "paddingHorizontal",
518
+ py: "paddingVertical",
519
+ pt: "paddingTop",
520
+ pr: "paddingRight",
521
+ pb: "paddingBottom",
522
+ pl: "paddingLeft",
523
+ m: "margin",
524
+ mx: "marginHorizontal",
525
+ my: "marginVertical",
526
+ mt: "marginTop",
527
+ mr: "marginRight",
528
+ mb: "marginBottom",
529
+ ml: "marginLeft"
530
+ };
531
+ var spacingResolvers = {
532
+ // ── Sizing ─────────────────────────────────────────────────────────────────
533
+ w: ({ value, isArbitrary }, { spacing }) => {
534
+ const v = resolveSizing(value, spacing, isArbitrary);
535
+ return v !== null ? { width: v } : null;
536
+ },
537
+ h: ({ value, isArbitrary }, { spacing }) => {
538
+ const v = resolveSizing(value, spacing, isArbitrary);
539
+ return v !== null ? { height: v } : null;
540
+ },
541
+ "min-w": ({ value, isArbitrary }, { spacing }) => {
542
+ const v = resolveSizing(value, spacing, isArbitrary);
543
+ return v !== null ? { minWidth: v } : null;
544
+ },
545
+ "min-h": ({ value, isArbitrary }, { spacing }) => {
546
+ const v = resolveSizing(value, spacing, isArbitrary);
547
+ return v !== null ? { minHeight: v } : null;
548
+ },
549
+ "max-w": ({ value, isArbitrary }, { spacing }) => {
550
+ const v = resolveSizing(value, spacing, isArbitrary);
551
+ return v !== null ? { maxWidth: v } : null;
552
+ },
553
+ "max-h": ({ value, isArbitrary }, { spacing }) => {
554
+ const v = resolveSizing(value, spacing, isArbitrary);
555
+ return v !== null ? { maxHeight: v } : null;
556
+ },
557
+ // ── Size shorthand (sets width AND height in one utility) ────────────────
558
+ size: ({ value, isArbitrary }, { spacing }) => {
559
+ const v = resolveSizing(value, spacing, isArbitrary);
560
+ return v !== null ? { width: v, height: v } : null;
561
+ },
562
+ // ── Flex basis ─────────────────────────────────────────────────────────────
563
+ basis: ({ value, isArbitrary }, { spacing }) => {
564
+ const v = resolveSizing(value, spacing, isArbitrary);
565
+ return v !== null ? { flexBasis: v } : null;
566
+ },
567
+ // ── Gap ────────────────────────────────────────────────────────────────────
568
+ gap: ({ value, negative, isArbitrary }, { spacing }) => {
569
+ const v = resolveSpacing(value, negative, spacing, isArbitrary);
570
+ return v !== null ? { gap: v } : null;
571
+ },
572
+ "gap-x": ({ value, negative, isArbitrary }, { spacing }) => {
573
+ const v = resolveSpacing(value, negative, spacing, isArbitrary);
574
+ return v !== null ? { columnGap: v } : null;
575
+ },
576
+ "gap-y": ({ value, negative, isArbitrary }, { spacing }) => {
577
+ const v = resolveSpacing(value, negative, spacing, isArbitrary);
578
+ return v !== null ? { rowGap: v } : null;
579
+ },
580
+ // ── Position ───────────────────────────────────────────────────────────────
581
+ top: ({ value, negative, isArbitrary }, { spacing }) => {
582
+ const v = resolveSpacing(value, negative, spacing, isArbitrary);
583
+ return v !== null ? { top: v } : null;
584
+ },
585
+ right: ({ value, negative, isArbitrary }, { spacing }) => {
586
+ const v = resolveSpacing(value, negative, spacing, isArbitrary);
587
+ return v !== null ? { right: v } : null;
588
+ },
589
+ bottom: ({ value, negative, isArbitrary }, { spacing }) => {
590
+ const v = resolveSpacing(value, negative, spacing, isArbitrary);
591
+ return v !== null ? { bottom: v } : null;
592
+ },
593
+ left: ({ value, negative, isArbitrary }, { spacing }) => {
594
+ const v = resolveSpacing(value, negative, spacing, isArbitrary);
595
+ return v !== null ? { left: v } : null;
596
+ },
597
+ inset: ({ value, negative, isArbitrary }, { spacing }) => {
598
+ const v = resolveSpacing(value, negative, spacing, isArbitrary);
599
+ return v !== null ? { top: v, right: v, bottom: v, left: v } : null;
600
+ },
601
+ "inset-x": ({ value, negative, isArbitrary }, { spacing }) => {
602
+ const v = resolveSpacing(value, negative, spacing, isArbitrary);
603
+ return v !== null ? { left: v, right: v } : null;
604
+ },
605
+ "inset-y": ({ value, negative, isArbitrary }, { spacing }) => {
606
+ const v = resolveSpacing(value, negative, spacing, isArbitrary);
607
+ return v !== null ? { top: v, bottom: v } : null;
608
+ },
609
+ // ── Translate ──────────────────────────────────────────────────────────────
610
+ "translate-x": ({ value, negative, isArbitrary }, { spacing }) => {
611
+ const v = resolveSpacing(value, negative, spacing, isArbitrary);
612
+ if (v === null) return null;
613
+ if (getEffectiveIsWeb()) return { transform: `translateX(${typeof v === "number" ? `${v}px` : v})` };
614
+ if (typeof v === "string") {
615
+ const n = parseFloat(v);
616
+ return isNaN(n) ? null : { transform: [{ translateX: n }] };
617
+ }
618
+ return { transform: [{ translateX: v }] };
619
+ },
620
+ "translate-y": ({ value, negative, isArbitrary }, { spacing }) => {
621
+ const v = resolveSpacing(value, negative, spacing, isArbitrary);
622
+ if (v === null) return null;
623
+ if (getEffectiveIsWeb()) return { transform: `translateY(${typeof v === "number" ? `${v}px` : v})` };
624
+ if (typeof v === "string") {
625
+ const n = parseFloat(v);
626
+ return isNaN(n) ? null : { transform: [{ translateY: n }] };
627
+ }
628
+ return { transform: [{ translateY: v }] };
629
+ },
630
+ // ── Space between ─────────────────────────────────────────────────────────
631
+ // On web: emits __spaceX/__spaceY markers → resolver generates > * + * CSS rules.
632
+ // On native (RN 0.71+): uses columnGap/rowGap directly.
633
+ "space-x": ({ value, negative, isArbitrary }, { spacing }) => {
634
+ const v = resolveSpacing(value, negative, spacing, isArbitrary);
635
+ if (v === null) return null;
636
+ if (getEffectiveIsWeb()) return { __spaceX: v };
637
+ return { columnGap: v };
638
+ },
639
+ "space-y": ({ value, negative, isArbitrary }, { spacing }) => {
640
+ const v = resolveSpacing(value, negative, spacing, isArbitrary);
641
+ if (v === null) return null;
642
+ if (getEffectiveIsWeb()) return { __spaceY: v };
643
+ return { rowGap: v };
644
+ }
645
+ };
646
+ for (const [utility, prop] of Object.entries(PADDING_MARGIN_PROPS)) {
647
+ spacingResolvers[utility] = makeSpacingResolver(prop);
648
+ }
649
+
650
+ // src/core/resolvers/border.ts
651
+ function resolveRadius(value, radii, isArbitrary) {
652
+ if (isArbitrary) return getEffectiveIsWeb() ? value : toNativeValue(value);
653
+ const key = value === "" ? "DEFAULT" : value;
654
+ return radii[key] ?? null;
655
+ }
656
+ function makeBorderSideResolver(widthProp, colorProp) {
657
+ return ({ value, isArbitrary }, { colors, borderWidth }) => {
658
+ if (!value) return { [widthProp]: 1 };
659
+ if (isArbitrary) {
660
+ const w2 = toNativeValue(value);
661
+ if (typeof w2 === "number") return { [widthProp]: getEffectiveIsWeb() ? value : w2 };
662
+ return { [colorProp]: value };
663
+ }
664
+ const color = resolveColor(value, colors, false);
665
+ if (color) return { [colorProp]: color };
666
+ const w = borderWidth[value];
667
+ return w !== void 0 ? { [widthProp]: w } : null;
668
+ };
669
+ }
670
+ var BORDER_SIDE_PROPS = {
671
+ "border-t": ["borderTopWidth", "borderTopColor"],
672
+ "border-r": ["borderRightWidth", "borderRightColor"],
673
+ "border-b": ["borderBottomWidth", "borderBottomColor"],
674
+ "border-l": ["borderLeftWidth", "borderLeftColor"]
675
+ };
676
+ var borderResolvers = {
677
+ // ── Border width ───────────────────────────────────────────────────────────
678
+ border: ({ value, isArbitrary }, { colors, borderWidth, spacing }) => {
679
+ if (!value) return { borderWidth: borderWidth["DEFAULT"] ?? 1 };
680
+ if (isArbitrary) {
681
+ const w2 = toNativeValue(value);
682
+ if (typeof w2 === "number") return { borderWidth: getEffectiveIsWeb() ? value : w2 };
683
+ return { borderColor: value };
684
+ }
685
+ const color = resolveColor(value, colors, false);
686
+ if (color) return { borderColor: color };
687
+ const w = borderWidth[value] ?? spacing[value];
688
+ if (w !== void 0) {
689
+ const numW = typeof w === "number" ? w : parseFloat(String(w));
690
+ if (isNaN(numW)) return null;
691
+ return { borderWidth: numW };
692
+ }
693
+ return null;
694
+ },
695
+ // border-t/-r/-b/-l generated below via makeBorderSideResolver() — see BORDER_SIDE_PROPS.
696
+ // ── Border radius ──────────────────────────────────────────────────────────
697
+ rounded: ({ value, isArbitrary }, { borderRadius }) => {
698
+ const r = resolveRadius(value, borderRadius, isArbitrary);
699
+ return r !== null ? { borderRadius: r } : null;
700
+ },
701
+ "rounded-t": ({ value, isArbitrary }, { borderRadius }) => {
702
+ const r = resolveRadius(value, borderRadius, isArbitrary);
703
+ return r !== null ? { borderTopLeftRadius: r, borderTopRightRadius: r } : null;
704
+ },
705
+ "rounded-r": ({ value, isArbitrary }, { borderRadius }) => {
706
+ const r = resolveRadius(value, borderRadius, isArbitrary);
707
+ return r !== null ? { borderTopRightRadius: r, borderBottomRightRadius: r } : null;
708
+ },
709
+ "rounded-b": ({ value, isArbitrary }, { borderRadius }) => {
710
+ const r = resolveRadius(value, borderRadius, isArbitrary);
711
+ return r !== null ? { borderBottomLeftRadius: r, borderBottomRightRadius: r } : null;
712
+ },
713
+ "rounded-l": ({ value, isArbitrary }, { borderRadius }) => {
714
+ const r = resolveRadius(value, borderRadius, isArbitrary);
715
+ return r !== null ? { borderTopLeftRadius: r, borderBottomLeftRadius: r } : null;
716
+ },
717
+ "rounded-tl": ({ value, isArbitrary }, { borderRadius }) => {
718
+ const r = resolveRadius(value, borderRadius, isArbitrary);
719
+ return r !== null ? { borderTopLeftRadius: r } : null;
720
+ },
721
+ "rounded-tr": ({ value, isArbitrary }, { borderRadius }) => {
722
+ const r = resolveRadius(value, borderRadius, isArbitrary);
723
+ return r !== null ? { borderTopRightRadius: r } : null;
724
+ },
725
+ "rounded-bl": ({ value, isArbitrary }, { borderRadius }) => {
726
+ const r = resolveRadius(value, borderRadius, isArbitrary);
727
+ return r !== null ? { borderBottomLeftRadius: r } : null;
728
+ },
729
+ "rounded-br": ({ value, isArbitrary }, { borderRadius }) => {
730
+ const r = resolveRadius(value, borderRadius, isArbitrary);
731
+ return r !== null ? { borderBottomRightRadius: r } : null;
732
+ },
733
+ // ── Outline extended (web-only) ───────────────────────────────────────────
734
+ outline: ({ value, isArbitrary }, { colors }) => {
735
+ if (!getEffectiveIsWeb()) return null;
736
+ if (!value) return { outline: "2px solid transparent", outlineOffset: "2px" };
737
+ if (value === "none") return { outline: "none", outlineOffset: "0" };
738
+ if (isArbitrary) {
739
+ if (/^\d/.test(value) || value.startsWith("calc(")) return { outlineWidth: value };
740
+ return { outlineColor: value };
741
+ }
742
+ const widths = { "0": "0px", "1": "1px", "2": "2px", "4": "4px", "8": "8px" };
743
+ if (value in widths) return { outlineWidth: widths[value] };
744
+ const color = resolveColor(value, colors, false);
745
+ return color ? { outlineColor: color } : null;
746
+ },
747
+ "outline-offset": ({ value, isArbitrary }) => {
748
+ if (!getEffectiveIsWeb()) return null;
749
+ if (isArbitrary) return { outlineOffset: value };
750
+ const offsets = { "0": "0px", "1": "1px", "2": "2px", "4": "4px", "8": "8px" };
751
+ return offsets[value] ? { outlineOffset: offsets[value] } : null;
752
+ },
753
+ // ── Divide (child combinator CSS, web-only) ───────────────────────────────
754
+ // These return special __divide* markers that resolver.ts converts to
755
+ // .cls > * + * { border-... } CSS rules. No inline style is applied.
756
+ "divide-x": ({ value, isArbitrary }) => {
757
+ if (!getEffectiveIsWeb()) return null;
758
+ if (value === "reverse") return null;
759
+ if (!value) return { __divideX: 1 };
760
+ const n = parseFloat(value);
761
+ return isNaN(n) ? null : { __divideX: n };
762
+ },
763
+ "divide-y": ({ value, isArbitrary }) => {
764
+ if (!getEffectiveIsWeb()) return null;
765
+ if (value === "reverse") return null;
766
+ if (!value) return { __divideY: 1 };
767
+ const n = parseFloat(value);
768
+ return isNaN(n) ? null : { __divideY: n };
769
+ },
770
+ divide: ({ value, isArbitrary }, { colors }) => {
771
+ if (!getEffectiveIsWeb()) return null;
772
+ if (isArbitrary) return { __divideColor: value };
773
+ const styleTokens = {
774
+ solid: "solid",
775
+ dashed: "dashed",
776
+ dotted: "dotted",
777
+ double: "double",
778
+ none: "none"
779
+ };
780
+ if (value in styleTokens) return { __divideStyle: styleTokens[value] };
781
+ const color = resolveColor(value, colors, false);
782
+ return color ? { __divideColor: color } : null;
783
+ },
784
+ // ── Ring ───────────────────────────────────────────────────────────────────
785
+ // Web: box-shadow outline ring (doesn't affect layout).
786
+ // Native: React Native has no box-shadow, so this falls back to borderWidth/
787
+ // borderColor — the closest visual approximation (used by other RN Tailwind-
788
+ // likes for the same reason). Unlike the web ring, this DOES affect layout,
789
+ // and it shares its properties with the `border` utility — combining
790
+ // `border-*` and `ring-*` on the same native element means whichever class
791
+ // comes later wins, since both ultimately set borderWidth/borderColor.
792
+ ring: ({ value, isArbitrary }, { colors }) => {
793
+ const onWeb = getEffectiveIsWeb();
794
+ const DEFAULT_COLOR = "rgba(59, 130, 246, 0.5)";
795
+ const DEFAULT_WIDTH = 3;
796
+ const asNative = (w, color2) => w === 0 ? { borderWidth: 0 } : { borderWidth: w, borderColor: color2 };
797
+ if (!value) {
798
+ return onWeb ? { boxShadow: `0 0 0 ${DEFAULT_WIDTH}px ${DEFAULT_COLOR}` } : asNative(DEFAULT_WIDTH, DEFAULT_COLOR);
799
+ }
800
+ if (value === "inset") {
801
+ return onWeb ? { boxShadow: `inset 0 0 0 ${DEFAULT_WIDTH}px ${DEFAULT_COLOR}` } : asNative(DEFAULT_WIDTH, DEFAULT_COLOR);
802
+ }
803
+ const widthTokens = { "0": 0, "1": 1, "2": 2, "4": 4, "8": 8 };
804
+ if (!isArbitrary && value in widthTokens) {
805
+ const w = widthTokens[value];
806
+ return onWeb ? { boxShadow: w === 0 ? "none" : `0 0 0 ${w}px ${DEFAULT_COLOR}` } : asNative(w, DEFAULT_COLOR);
807
+ }
808
+ if (isArbitrary) {
809
+ const numMatch = /^(\d+(?:\.\d+)?)(px|rem|em|vw|vh)?$/.exec(value);
810
+ if (numMatch) {
811
+ const unit = numMatch[2] ?? "px";
812
+ if (onWeb) return { boxShadow: `0 0 0 ${numMatch[1]}${unit} ${DEFAULT_COLOR}` };
813
+ return unit === "px" ? asNative(parseFloat(numMatch[1]), DEFAULT_COLOR) : null;
814
+ }
815
+ return onWeb ? { boxShadow: value.replace(/_/g, " ") } : null;
816
+ }
817
+ const color = resolveColor(value, colors, false);
818
+ if (color) {
819
+ return onWeb ? { boxShadow: `0 0 0 ${DEFAULT_WIDTH}px ${color}` } : asNative(DEFAULT_WIDTH, color);
820
+ }
821
+ return null;
822
+ },
823
+ // Web-only, unlike `ring` above: this stacks a second box-shadow layer to
824
+ // create a gap between the element and the ring. There's no native
825
+ // equivalent to approximate that with (a border can't create a gap outside
826
+ // its own element without an extra wrapper view), so this stays a no-op
827
+ // on native rather than rendering a misleading half-translation.
828
+ "ring-offset": ({ value, isArbitrary }, _theme) => {
829
+ if (!getEffectiveIsWeb()) return null;
830
+ const DEFAULT_RING_COLOR = "rgba(59, 130, 246, 0.5)";
831
+ const DEFAULT_RING_WIDTH = 3;
832
+ const offsetTokens = { "0": 0, "1": 1, "2": 2, "4": 4, "8": 8 };
833
+ let offsetWidth;
834
+ if (!isArbitrary) {
835
+ offsetWidth = value in offsetTokens ? offsetTokens[value] : null;
836
+ } else {
837
+ offsetWidth = /^-?\d+(\.\d+)?$/.test(value) ? parseFloat(value) : value;
838
+ }
839
+ if (offsetWidth === null || typeof offsetWidth === "number" && isNaN(offsetWidth)) return null;
840
+ const isZero = offsetWidth === 0 || offsetWidth === "0";
841
+ const offsetCss = typeof offsetWidth === "number" ? `${offsetWidth}px` : offsetWidth;
842
+ return {
843
+ boxShadow: isZero ? `0 0 0 ${DEFAULT_RING_WIDTH}px ${DEFAULT_RING_COLOR}` : `0 0 0 ${offsetCss} #fff, 0 0 0 calc(${offsetCss} + ${DEFAULT_RING_WIDTH}px) ${DEFAULT_RING_COLOR}`
844
+ };
845
+ }
846
+ };
847
+ for (const [utility, [widthProp, colorProp]] of Object.entries(BORDER_SIDE_PROPS)) {
848
+ borderResolvers[utility] = makeBorderSideResolver(widthProp, colorProp);
849
+ }
850
+
851
+ // src/core/resolvers/filters.ts
852
+ var FILTER_COMPOSE = "var(--kb-blur,) var(--kb-brightness,) var(--kb-contrast,) var(--kb-grayscale,) var(--kb-hue-rotate,) var(--kb-invert,) var(--kb-saturate,) var(--kb-sepia,) var(--kb-drop-shadow,)";
853
+ var BACKDROP_FILTER_COMPOSE = "var(--kb-backdrop-blur,) var(--kb-backdrop-brightness,) var(--kb-backdrop-contrast,) var(--kb-backdrop-grayscale,) var(--kb-backdrop-hue-rotate,) var(--kb-backdrop-invert,) var(--kb-backdrop-opacity,) var(--kb-backdrop-saturate,) var(--kb-backdrop-sepia,)";
854
+ var filterResolvers = {
855
+ // ── CSS Filters (composable via CSS variables, web-only) ─────────────────
856
+ blur: ({ value, isArbitrary }) => {
857
+ if (!getEffectiveIsWeb()) return null;
858
+ const sizes = {
859
+ "": "blur(8px)",
860
+ sm: "blur(4px)",
861
+ md: "blur(12px)",
862
+ lg: "blur(16px)",
863
+ xl: "blur(24px)",
864
+ "2xl": "blur(40px)",
865
+ "3xl": "blur(64px)"
866
+ };
867
+ if (value === "none") return { "--kb-blur": "", filter: FILTER_COMPOSE };
868
+ const v = isArbitrary ? `blur(${value})` : sizes[value];
869
+ return v !== void 0 ? { "--kb-blur": v, filter: FILTER_COMPOSE } : null;
870
+ },
871
+ brightness: ({ value, isArbitrary }) => {
872
+ if (!getEffectiveIsWeb()) return null;
873
+ const v = isArbitrary ? `brightness(${value})` : `brightness(${parseFloat(value) / 100})`;
874
+ return isNaN(parseFloat(value)) && !isArbitrary ? null : { "--kb-brightness": v, filter: FILTER_COMPOSE };
875
+ },
876
+ contrast: ({ value, isArbitrary }) => {
877
+ if (!getEffectiveIsWeb()) return null;
878
+ const v = isArbitrary ? `contrast(${value})` : `contrast(${parseFloat(value) / 100})`;
879
+ return isNaN(parseFloat(value)) && !isArbitrary ? null : { "--kb-contrast": v, filter: FILTER_COMPOSE };
880
+ },
881
+ grayscale: ({ value, isArbitrary }) => {
882
+ if (!getEffectiveIsWeb()) return null;
883
+ const v = isArbitrary ? `grayscale(${value})` : value === "0" ? "grayscale(0)" : "grayscale(100%)";
884
+ return { "--kb-grayscale": v, filter: FILTER_COMPOSE };
885
+ },
886
+ "hue-rotate": ({ value, negative, isArbitrary }) => {
887
+ if (!getEffectiveIsWeb()) return null;
888
+ const deg = isArbitrary ? value : `${(negative ? -1 : 1) * parseFloat(value)}deg`;
889
+ if (isNaN(parseFloat(deg)) && !isArbitrary) return null;
890
+ return { "--kb-hue-rotate": `hue-rotate(${deg})`, filter: FILTER_COMPOSE };
891
+ },
892
+ invert: ({ value, isArbitrary }) => {
893
+ if (!getEffectiveIsWeb()) return null;
894
+ const v = isArbitrary ? `invert(${value})` : value === "0" ? "invert(0)" : "invert(100%)";
895
+ return { "--kb-invert": v, filter: FILTER_COMPOSE };
896
+ },
897
+ saturate: ({ value, isArbitrary }) => {
898
+ if (!getEffectiveIsWeb()) return null;
899
+ const v = isArbitrary ? `saturate(${value})` : `saturate(${parseFloat(value) / 100})`;
900
+ return isNaN(parseFloat(value)) && !isArbitrary ? null : { "--kb-saturate": v, filter: FILTER_COMPOSE };
901
+ },
902
+ sepia: ({ value, isArbitrary }) => {
903
+ if (!getEffectiveIsWeb()) return null;
904
+ const v = isArbitrary ? `sepia(${value})` : value === "0" ? "sepia(0)" : "sepia(100%)";
905
+ return { "--kb-sepia": v, filter: FILTER_COMPOSE };
906
+ },
907
+ "drop-shadow": ({ value, isArbitrary }) => {
908
+ if (!getEffectiveIsWeb()) return null;
909
+ if (isArbitrary) return { "--kb-drop-shadow": `drop-shadow(${value.replace(/_/g, " ")})`, filter: FILTER_COMPOSE };
910
+ const presets = {
911
+ "": "drop-shadow(0 1px 2px rgb(0 0 0/0.1)) drop-shadow(0 1px 1px rgb(0 0 0/0.06))",
912
+ sm: "drop-shadow(0 1px 1px rgb(0 0 0/0.05))",
913
+ md: "drop-shadow(0 4px 3px rgb(0 0 0/0.07)) drop-shadow(0 2px 2px rgb(0 0 0/0.06))",
914
+ lg: "drop-shadow(0 10px 8px rgb(0 0 0/0.04)) drop-shadow(0 4px 3px rgb(0 0 0/0.1))",
915
+ xl: "drop-shadow(0 20px 13px rgb(0 0 0/0.03)) drop-shadow(0 8px 5px rgb(0 0 0/0.08))",
916
+ "2xl": "drop-shadow(0 25px 25px rgb(0 0 0/0.15))",
917
+ none: "drop-shadow(0 0 #0000)"
918
+ };
919
+ const v = presets[value];
920
+ return v !== void 0 ? { "--kb-drop-shadow": v, filter: FILTER_COMPOSE } : null;
921
+ },
922
+ // Arbitrary full filter string: filter-[blur(4px)_grayscale(1)]
923
+ filter: ({ value, isArbitrary }) => {
924
+ if (!getEffectiveIsWeb()) return null;
925
+ if (isArbitrary) return { filter: value.replace(/_/g, " ") };
926
+ if (value === "none") return { filter: "none" };
927
+ return null;
928
+ },
929
+ // ── Backdrop Filters (composable via CSS variables, web-only) ────────────
930
+ "backdrop-blur": ({ value, isArbitrary }) => {
931
+ if (!getEffectiveIsWeb()) return null;
932
+ const sizes = {
933
+ "": "blur(8px)",
934
+ sm: "blur(4px)",
935
+ md: "blur(12px)",
936
+ lg: "blur(16px)",
937
+ xl: "blur(24px)",
938
+ "2xl": "blur(40px)",
939
+ "3xl": "blur(64px)"
940
+ };
941
+ if (value === "none") return { "--kb-backdrop-blur": "", backdropFilter: BACKDROP_FILTER_COMPOSE };
942
+ const v = isArbitrary ? `blur(${value})` : sizes[value];
943
+ return v !== void 0 ? { "--kb-backdrop-blur": v, backdropFilter: BACKDROP_FILTER_COMPOSE } : null;
944
+ },
945
+ "backdrop-brightness": ({ value, isArbitrary }) => {
946
+ if (!getEffectiveIsWeb()) return null;
947
+ const v = isArbitrary ? `brightness(${value})` : `brightness(${parseFloat(value) / 100})`;
948
+ return isNaN(parseFloat(value)) && !isArbitrary ? null : { "--kb-backdrop-brightness": v, backdropFilter: BACKDROP_FILTER_COMPOSE };
949
+ },
950
+ "backdrop-contrast": ({ value, isArbitrary }) => {
951
+ if (!getEffectiveIsWeb()) return null;
952
+ const v = isArbitrary ? `contrast(${value})` : `contrast(${parseFloat(value) / 100})`;
953
+ return isNaN(parseFloat(value)) && !isArbitrary ? null : { "--kb-backdrop-contrast": v, backdropFilter: BACKDROP_FILTER_COMPOSE };
954
+ },
955
+ "backdrop-grayscale": ({ value, isArbitrary }) => {
956
+ if (!getEffectiveIsWeb()) return null;
957
+ const v = isArbitrary ? `grayscale(${value})` : value === "0" ? "grayscale(0)" : "grayscale(100%)";
958
+ return { "--kb-backdrop-grayscale": v, backdropFilter: BACKDROP_FILTER_COMPOSE };
959
+ },
960
+ "backdrop-hue-rotate": ({ value, negative, isArbitrary }) => {
961
+ if (!getEffectiveIsWeb()) return null;
962
+ const deg = isArbitrary ? value : `${(negative ? -1 : 1) * parseFloat(value)}deg`;
963
+ if (isNaN(parseFloat(deg)) && !isArbitrary) return null;
964
+ return { "--kb-backdrop-hue-rotate": `hue-rotate(${deg})`, backdropFilter: BACKDROP_FILTER_COMPOSE };
965
+ },
966
+ "backdrop-invert": ({ value, isArbitrary }) => {
967
+ if (!getEffectiveIsWeb()) return null;
968
+ const v = isArbitrary ? `invert(${value})` : value === "0" ? "invert(0)" : "invert(100%)";
969
+ return { "--kb-backdrop-invert": v, backdropFilter: BACKDROP_FILTER_COMPOSE };
970
+ },
971
+ "backdrop-opacity": ({ value, isArbitrary }) => {
972
+ if (!getEffectiveIsWeb()) return null;
973
+ const v = isArbitrary ? `opacity(${value})` : `opacity(${parseFloat(value) / 100})`;
974
+ return isNaN(parseFloat(value)) && !isArbitrary ? null : { "--kb-backdrop-opacity": v, backdropFilter: BACKDROP_FILTER_COMPOSE };
975
+ },
976
+ "backdrop-saturate": ({ value, isArbitrary }) => {
977
+ if (!getEffectiveIsWeb()) return null;
978
+ const v = isArbitrary ? `saturate(${value})` : `saturate(${parseFloat(value) / 100})`;
979
+ return isNaN(parseFloat(value)) && !isArbitrary ? null : { "--kb-backdrop-saturate": v, backdropFilter: BACKDROP_FILTER_COMPOSE };
980
+ },
981
+ "backdrop-sepia": ({ value, isArbitrary }) => {
982
+ if (!getEffectiveIsWeb()) return null;
983
+ const v = isArbitrary ? `sepia(${value})` : value === "0" ? "sepia(0)" : "sepia(100%)";
984
+ return { "--kb-backdrop-sepia": v, backdropFilter: BACKDROP_FILTER_COMPOSE };
985
+ },
986
+ "backdrop-filter": ({ value, isArbitrary }) => {
987
+ if (!getEffectiveIsWeb()) return null;
988
+ if (isArbitrary) return { backdropFilter: value.replace(/_/g, " ") };
989
+ if (value === "none") return { backdropFilter: "none" };
990
+ return null;
991
+ },
992
+ // ── Mix / background blend mode (web-only) ───────────────────────────────
993
+ "mix-blend": ({ value }) => {
994
+ if (!getEffectiveIsWeb()) return null;
995
+ const modes = [
996
+ "normal",
997
+ "multiply",
998
+ "screen",
999
+ "overlay",
1000
+ "darken",
1001
+ "lighten",
1002
+ "color-dodge",
1003
+ "color-burn",
1004
+ "hard-light",
1005
+ "soft-light",
1006
+ "difference",
1007
+ "exclusion",
1008
+ "hue",
1009
+ "saturation",
1010
+ "color",
1011
+ "luminosity",
1012
+ "plus-lighter"
1013
+ ];
1014
+ return modes.includes(value) ? { mixBlendMode: value } : null;
1015
+ },
1016
+ "bg-blend": ({ value }) => {
1017
+ if (!getEffectiveIsWeb()) return null;
1018
+ const modes = [
1019
+ "normal",
1020
+ "multiply",
1021
+ "screen",
1022
+ "overlay",
1023
+ "darken",
1024
+ "lighten",
1025
+ "color-dodge",
1026
+ "color-burn",
1027
+ "hard-light",
1028
+ "soft-light",
1029
+ "difference",
1030
+ "exclusion",
1031
+ "hue",
1032
+ "saturation",
1033
+ "color",
1034
+ "luminosity"
1035
+ ];
1036
+ return modes.includes(value) ? { backgroundBlendMode: value } : null;
1037
+ },
1038
+ // ── Will-change (web-only) ─────────────────────────────────────────────────
1039
+ "will-change": ({ value, isArbitrary }) => {
1040
+ if (!getEffectiveIsWeb()) return null;
1041
+ if (isArbitrary) return { willChange: value.replace(/_/g, ", ") };
1042
+ const presets = {
1043
+ auto: "auto",
1044
+ scroll: "scroll-position",
1045
+ contents: "contents",
1046
+ transform: "transform"
1047
+ };
1048
+ return presets[value] ? { willChange: presets[value] } : null;
1049
+ }
1050
+ };
1051
+
1052
+ // src/core/resolvers/layout.ts
1053
+ var _standalone = null;
1054
+ var _standaloneWeb = null;
1055
+ function buildStandalone(web) {
1056
+ return {
1057
+ // Display
1058
+ // React Native only supports display:'flex'|'none'. Setting 'flex' explicitly is
1059
+ // a no-op normally, but is needed to re-show an element that was hidden via `hidden`.
1060
+ // `grid`, `contents`, `flow-root` have no native equivalent and stay null there.
1061
+ // The inline-* family (inline, inline-block, inline-flex, inline-grid) falls back
1062
+ // to 'flex' on native instead — like plain `flex`, this is a no-op most of the
1063
+ // time, but without it these utilities couldn't re-show a `hidden` element on
1064
+ // native either (null → no style applied → still display:'none').
1065
+ flex: { display: "flex" },
1066
+ block: web ? { display: "block" } : null,
1067
+ "inline-block": { display: web ? "inline-block" : "flex" },
1068
+ inline: { display: web ? "inline" : "flex" },
1069
+ grid: web ? { display: "grid" } : null,
1070
+ "inline-flex": { display: web ? "inline-flex" : "flex" },
1071
+ "inline-grid": { display: web ? "inline-grid" : "flex" },
1072
+ hidden: { display: "none" },
1073
+ contents: web ? { display: "contents" } : null,
1074
+ "flow-root": web ? { display: "flow-root" } : null,
1075
+ // Flex direction, wrap, grow/shrink, and alignment (both web and native) —
1076
+ // every one of these is meaningless without the element also being a flex
1077
+ // container. React Native Views are ALWAYS flex containers by default, so
1078
+ // on native this was already true for free; on web a plain <div> defaults
1079
+ // to display:block, so e.g. `items-center` alone silently did nothing.
1080
+ // Folding `display: 'flex'` into these on web closes that native/web gap —
1081
+ // `flex-1 items-center justify-center` now behaves the same on both,
1082
+ // without also needing a separate `flex` class.
1083
+ "flex-row": { flexDirection: "row", ...web ? { display: "flex" } : {} },
1084
+ "flex-col": { flexDirection: "column", ...web ? { display: "flex" } : {} },
1085
+ "flex-row-reverse": { flexDirection: "row-reverse", ...web ? { display: "flex" } : {} },
1086
+ "flex-col-reverse": { flexDirection: "column-reverse", ...web ? { display: "flex" } : {} },
1087
+ // Flex wrap (both)
1088
+ "flex-wrap": { flexWrap: "wrap", ...web ? { display: "flex" } : {} },
1089
+ "flex-wrap-reverse": { flexWrap: "wrap-reverse", ...web ? { display: "flex" } : {} },
1090
+ "flex-nowrap": { flexWrap: "nowrap", ...web ? { display: "flex" } : {} },
1091
+ // Flex grow / shrink (both) — deliberately NOT folding in display:flex
1092
+ // like the container-level properties above. flex-grow/flex-shrink are
1093
+ // item-level: they already take effect purely via the PARENT already
1094
+ // being a flex container, with zero dependency on this element's own
1095
+ // display. Forcing display:flex here would instead be an unrelated side
1096
+ // effect on THIS element's own children (turning what may be an ordinary
1097
+ // block stack into a flex row) — exactly the kind of surprise the
1098
+ // container-level properties above can never cause, since those are
1099
+ // no-ops without display:flex to begin with.
1100
+ "flex-grow": { flexGrow: 1 },
1101
+ "flex-grow-0": { flexGrow: 0 },
1102
+ "flex-shrink": { flexShrink: 1 },
1103
+ "flex-shrink-0": { flexShrink: 0 },
1104
+ // Align items (both)
1105
+ "items-start": { alignItems: "flex-start", ...web ? { display: "flex" } : {} },
1106
+ "items-end": { alignItems: "flex-end", ...web ? { display: "flex" } : {} },
1107
+ "items-center": { alignItems: "center", ...web ? { display: "flex" } : {} },
1108
+ "items-baseline": { alignItems: "baseline", ...web ? { display: "flex" } : {} },
1109
+ "items-stretch": { alignItems: "stretch", ...web ? { display: "flex" } : {} },
1110
+ // Justify content (both)
1111
+ "justify-start": { justifyContent: "flex-start", ...web ? { display: "flex" } : {} },
1112
+ "justify-end": { justifyContent: "flex-end", ...web ? { display: "flex" } : {} },
1113
+ "justify-center": { justifyContent: "center", ...web ? { display: "flex" } : {} },
1114
+ "justify-between": { justifyContent: "space-between", ...web ? { display: "flex" } : {} },
1115
+ "justify-around": { justifyContent: "space-around", ...web ? { display: "flex" } : {} },
1116
+ "justify-evenly": { justifyContent: "space-evenly", ...web ? { display: "flex" } : {} },
1117
+ // Align content (both)
1118
+ "content-start": { alignContent: "flex-start", ...web ? { display: "flex" } : {} },
1119
+ "content-end": { alignContent: "flex-end", ...web ? { display: "flex" } : {} },
1120
+ "content-center": { alignContent: "center", ...web ? { display: "flex" } : {} },
1121
+ "content-between": { alignContent: "space-between", ...web ? { display: "flex" } : {} },
1122
+ "content-around": { alignContent: "space-around", ...web ? { display: "flex" } : {} },
1123
+ "content-evenly": { alignContent: "space-evenly", ...web ? { display: "flex" } : {} },
1124
+ "content-stretch": { alignContent: "stretch", ...web ? { display: "flex" } : {} },
1125
+ // Align self (both)
1126
+ "self-auto": { alignSelf: "auto" },
1127
+ "self-start": { alignSelf: "flex-start" },
1128
+ "self-end": { alignSelf: "flex-end" },
1129
+ "self-center": { alignSelf: "center" },
1130
+ "self-stretch": { alignSelf: "stretch" },
1131
+ "self-baseline": { alignSelf: "baseline" },
1132
+ // Text align (both)
1133
+ "text-left": { textAlign: "left" },
1134
+ "text-right": { textAlign: "right" },
1135
+ "text-center": { textAlign: "center" },
1136
+ "text-justify": { textAlign: "justify" },
1137
+ // Font weight shortcuts (both)
1138
+ "font-thin": { fontWeight: "100" },
1139
+ "font-extralight": { fontWeight: "200" },
1140
+ "font-light": { fontWeight: "300" },
1141
+ "font-normal": { fontWeight: "400" },
1142
+ "font-medium": { fontWeight: "500" },
1143
+ "font-semibold": { fontWeight: "600" },
1144
+ "font-bold": { fontWeight: "700" },
1145
+ "font-extrabold": { fontWeight: "800" },
1146
+ "font-black": { fontWeight: "900" },
1147
+ // Text decoration (overline is web-only)
1148
+ underline: { textDecorationLine: "underline" },
1149
+ overline: web ? { textDecorationLine: "overline" } : null,
1150
+ "line-through": { textDecorationLine: "line-through" },
1151
+ "no-underline": { textDecorationLine: "none" },
1152
+ // Text transform (both)
1153
+ uppercase: { textTransform: "uppercase" },
1154
+ lowercase: { textTransform: "lowercase" },
1155
+ capitalize: { textTransform: "capitalize" },
1156
+ "normal-case": { textTransform: "none" },
1157
+ // Font style (both)
1158
+ italic: { fontStyle: "italic" },
1159
+ "non-italic": { fontStyle: "normal" },
1160
+ // Position (fixed/sticky/static are web-only; RN only supports relative/absolute)
1161
+ relative: { position: "relative" },
1162
+ absolute: { position: "absolute" },
1163
+ fixed: web ? { position: "fixed" } : null,
1164
+ sticky: web ? { position: "sticky" } : null,
1165
+ static: web ? { position: "static" } : null,
1166
+ // Visibility (no `visibility` prop on native; use opacity instead)
1167
+ visible: web ? { visibility: "visible" } : null,
1168
+ invisible: web ? { visibility: "hidden" } : { opacity: 0 },
1169
+ // Overflow (RN supports 'hidden' | 'visible' | 'scroll'; not 'auto')
1170
+ "overflow-hidden": { overflow: "hidden" },
1171
+ "overflow-visible": { overflow: "visible" },
1172
+ "overflow-scroll": { overflow: "scroll" },
1173
+ "overflow-auto": web ? { overflow: "auto" } : { overflow: "scroll" },
1174
+ // overflowX / overflowY are web-only
1175
+ "overflow-x-hidden": web ? { overflowX: "hidden" } : null,
1176
+ "overflow-x-scroll": web ? { overflowX: "scroll" } : null,
1177
+ "overflow-x-auto": web ? { overflowX: "auto" } : null,
1178
+ "overflow-y-hidden": web ? { overflowY: "hidden" } : null,
1179
+ "overflow-y-scroll": web ? { overflowY: "scroll" } : null,
1180
+ "overflow-y-auto": web ? { overflowY: "auto" } : null,
1181
+ // Object fit (web-only; use resizeMode prop on RN Image)
1182
+ "object-contain": web ? { objectFit: "contain" } : null,
1183
+ "object-cover": web ? { objectFit: "cover" } : null,
1184
+ "object-fill": web ? { objectFit: "fill" } : null,
1185
+ "object-none": web ? { objectFit: "none" } : null,
1186
+ "object-scale-down": web ? { objectFit: "scale-down" } : null,
1187
+ // Border style (both)
1188
+ "border-solid": { borderStyle: "solid" },
1189
+ "border-dashed": { borderStyle: "dashed" },
1190
+ "border-dotted": { borderStyle: "dotted" },
1191
+ "border-none": { borderWidth: 0 },
1192
+ // Border sides default width (both)
1193
+ "border-t": { borderTopWidth: 1 },
1194
+ "border-r": { borderRightWidth: 1 },
1195
+ "border-b": { borderBottomWidth: 1 },
1196
+ "border-l": { borderLeftWidth: 1 },
1197
+ // Cursor (web-only)
1198
+ "cursor-auto": web ? { cursor: "auto" } : null,
1199
+ "cursor-default": web ? { cursor: "default" } : null,
1200
+ "cursor-pointer": web ? { cursor: "pointer" } : null,
1201
+ "cursor-wait": web ? { cursor: "wait" } : null,
1202
+ "cursor-text": web ? { cursor: "text" } : null,
1203
+ "cursor-move": web ? { cursor: "move" } : null,
1204
+ "cursor-not-allowed": web ? { cursor: "not-allowed" } : null,
1205
+ // User select (web-only)
1206
+ "select-none": web ? { userSelect: "none" } : null,
1207
+ "select-text": web ? { userSelect: "text" } : null,
1208
+ "select-all": web ? { userSelect: "all" } : null,
1209
+ "select-auto": web ? { userSelect: "auto" } : null,
1210
+ // Pointer events (both)
1211
+ "pointer-events-none": { pointerEvents: "none" },
1212
+ "pointer-events-auto": { pointerEvents: "auto" },
1213
+ // Whitespace (web-only; RN Text uses numberOfLines prop instead)
1214
+ "whitespace-normal": web ? { whiteSpace: "normal" } : null,
1215
+ "whitespace-nowrap": web ? { whiteSpace: "nowrap" } : null,
1216
+ "whitespace-pre": web ? { whiteSpace: "pre" } : null,
1217
+ "whitespace-pre-wrap": web ? { whiteSpace: "pre-wrap" } : null,
1218
+ "whitespace-pre-line": web ? { whiteSpace: "pre-line" } : null,
1219
+ // Word break (web-only)
1220
+ "break-normal": web ? { overflowWrap: "normal", wordBreak: "normal" } : null,
1221
+ "break-words": web ? { overflowWrap: "break-word" } : null,
1222
+ "break-all": web ? { wordBreak: "break-all" } : null,
1223
+ // Misc web-only
1224
+ truncate: web ? { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } : null,
1225
+ "box-border": web ? { boxSizing: "border-box" } : null,
1226
+ "box-content": web ? { boxSizing: "content-box" } : null,
1227
+ "appearance-none": web ? { appearance: "none" } : null,
1228
+ "outline-none": web ? { outline: "none", outlineOffset: "0" } : null,
1229
+ outline: web ? { outline: "2px solid transparent", outlineOffset: "2px" } : null,
1230
+ resize: web ? { resize: "both" } : null,
1231
+ "resize-none": web ? { resize: "none" } : null,
1232
+ "resize-y": web ? { resize: "vertical" } : null,
1233
+ "resize-x": web ? { resize: "horizontal" } : null,
1234
+ antialiased: web ? { WebkitFontSmoothing: "antialiased", MozOsxFontSmoothing: "grayscale" } : null,
1235
+ "subpixel-antialiased": web ? { WebkitFontSmoothing: "subpixel-antialiased", MozOsxFontSmoothing: "auto" } : null,
1236
+ "overflow-ellipsis": web ? { textOverflow: "ellipsis" } : null,
1237
+ "sr-only": web ? {
1238
+ position: "absolute",
1239
+ width: 1,
1240
+ height: 1,
1241
+ padding: 0,
1242
+ margin: -1,
1243
+ overflow: "hidden",
1244
+ clip: "rect(0,0,0,0)",
1245
+ whiteSpace: "nowrap",
1246
+ border: 0
1247
+ } : null,
1248
+ "not-sr-only": web ? {
1249
+ position: "static",
1250
+ width: "auto",
1251
+ height: "auto",
1252
+ padding: 0,
1253
+ margin: 0,
1254
+ overflow: "visible",
1255
+ clip: "auto",
1256
+ whiteSpace: "normal"
1257
+ } : null,
1258
+ // Lists (web-only)
1259
+ "list-none": web ? { listStyleType: "none" } : null,
1260
+ "list-disc": web ? { listStyleType: "disc" } : null,
1261
+ "list-decimal": web ? { listStyleType: "decimal" } : null,
1262
+ // Background clip (web-only)
1263
+ "bg-clip-border": web ? { backgroundClip: "border-box" } : null,
1264
+ "bg-clip-padding": web ? { backgroundClip: "padding-box" } : null,
1265
+ "bg-clip-content": web ? { backgroundClip: "content-box" } : null,
1266
+ "bg-clip-text": web ? { backgroundClip: "text", WebkitBackgroundClip: "text" } : null,
1267
+ // Background image
1268
+ "bg-none": web ? { backgroundImage: "none" } : null,
1269
+ // Background size (web-only)
1270
+ "bg-auto": web ? { backgroundSize: "auto" } : null,
1271
+ "bg-cover": web ? { backgroundSize: "cover" } : null,
1272
+ "bg-contain": web ? { backgroundSize: "contain" } : null,
1273
+ // Background position (web-only)
1274
+ "bg-center": web ? { backgroundPosition: "center" } : null,
1275
+ "bg-top": web ? { backgroundPosition: "top" } : null,
1276
+ "bg-bottom": web ? { backgroundPosition: "bottom" } : null,
1277
+ "bg-left": web ? { backgroundPosition: "left" } : null,
1278
+ "bg-right": web ? { backgroundPosition: "right" } : null,
1279
+ "bg-left-top": web ? { backgroundPosition: "left top" } : null,
1280
+ "bg-left-bottom": web ? { backgroundPosition: "left bottom" } : null,
1281
+ "bg-right-top": web ? { backgroundPosition: "right top" } : null,
1282
+ "bg-right-bottom": web ? { backgroundPosition: "right bottom" } : null,
1283
+ // Background repeat (web-only)
1284
+ "bg-repeat": web ? { backgroundRepeat: "repeat" } : null,
1285
+ "bg-no-repeat": web ? { backgroundRepeat: "no-repeat" } : null,
1286
+ "bg-repeat-x": web ? { backgroundRepeat: "repeat-x" } : null,
1287
+ "bg-repeat-y": web ? { backgroundRepeat: "repeat-y" } : null,
1288
+ "bg-repeat-round": web ? { backgroundRepeat: "round" } : null,
1289
+ "bg-repeat-space": web ? { backgroundRepeat: "space" } : null,
1290
+ // Background attachment (web-only)
1291
+ "bg-fixed": web ? { backgroundAttachment: "fixed" } : null,
1292
+ "bg-local": web ? { backgroundAttachment: "local" } : null,
1293
+ "bg-scroll": web ? { backgroundAttachment: "scroll" } : null,
1294
+ // Object position (web-only)
1295
+ "object-center": web ? { objectPosition: "center" } : null,
1296
+ "object-top": web ? { objectPosition: "top" } : null,
1297
+ "object-bottom": web ? { objectPosition: "bottom" } : null,
1298
+ "object-left": web ? { objectPosition: "left" } : null,
1299
+ "object-right": web ? { objectPosition: "right" } : null,
1300
+ "object-left-top": web ? { objectPosition: "left top" } : null,
1301
+ "object-left-bottom": web ? { objectPosition: "left bottom" } : null,
1302
+ "object-right-top": web ? { objectPosition: "right top" } : null,
1303
+ "object-right-bottom": web ? { objectPosition: "right bottom" } : null,
1304
+ // Table (web-only)
1305
+ table: web ? { display: "table" } : null,
1306
+ "table-auto": web ? { tableLayout: "auto" } : null,
1307
+ "table-fixed": web ? { tableLayout: "fixed" } : null,
1308
+ "caption-top": web ? { captionSide: "top" } : null,
1309
+ "caption-bottom": web ? { captionSide: "bottom" } : null,
1310
+ "border-collapse": web ? { borderCollapse: "collapse" } : null,
1311
+ "border-separate": web ? { borderCollapse: "separate" } : null,
1312
+ // List style position (web-only)
1313
+ "list-inside": web ? { listStylePosition: "inside" } : null,
1314
+ "list-outside": web ? { listStylePosition: "outside" } : null,
1315
+ // Font variant numeric (web-only)
1316
+ "normal-nums": web ? { fontVariantNumeric: "normal" } : null,
1317
+ ordinal: web ? { fontVariantNumeric: "ordinal" } : null,
1318
+ "slashed-zero": web ? { fontVariantNumeric: "slashed-zero" } : null,
1319
+ "lining-nums": web ? { fontVariantNumeric: "lining-nums" } : null,
1320
+ "oldstyle-nums": web ? { fontVariantNumeric: "oldstyle-nums" } : null,
1321
+ "proportional-nums": web ? { fontVariantNumeric: "proportional-nums" } : null,
1322
+ "tabular-nums": web ? { fontVariantNumeric: "tabular-nums" } : null,
1323
+ "diagonal-fractions": web ? { fontVariantNumeric: "diagonal-fractions" } : null,
1324
+ "stacked-fractions": web ? { fontVariantNumeric: "stacked-fractions" } : null,
1325
+ // Isolation (web-only)
1326
+ isolate: web ? { isolation: "isolate" } : null,
1327
+ "isolation-auto": web ? { isolation: "auto" } : null,
1328
+ // Backface visibility (both iOS and Android)
1329
+ "backface-visible": { backfaceVisibility: "visible" },
1330
+ "backface-hidden": { backfaceVisibility: "hidden" },
1331
+ // CSS filters — standalone = default/full effect (web-only)
1332
+ grayscale: web ? { "--kb-grayscale": "grayscale(100%)", filter: FILTER_COMPOSE } : null,
1333
+ invert: web ? { "--kb-invert": "invert(100%)", filter: FILTER_COMPOSE } : null,
1334
+ sepia: web ? { "--kb-sepia": "sepia(100%)", filter: FILTER_COMPOSE } : null,
1335
+ // Divide none
1336
+ "divide-none": web ? { __divideX: 0, __divideY: 0 } : null,
1337
+ // Group / peer markers (no-op: no style emitted; just ensures isKnownUtility returns true)
1338
+ group: web ? {} : null,
1339
+ peer: web ? {} : null,
1340
+ // Text-wrap (web-only)
1341
+ "text-wrap": web ? { textWrap: "wrap" } : null,
1342
+ "text-nowrap": web ? { textWrap: "nowrap" } : null,
1343
+ "text-balance": web ? { textWrap: "balance" } : null,
1344
+ "text-pretty": web ? { textWrap: "pretty" } : null,
1345
+ // Screen sizing — dvw/dvh (dynamic viewport units) instead of vw/vh: on mobile
1346
+ // browsers, vh/vw are pinned to the LARGEST viewport size (address bar hidden),
1347
+ // so `h-screen` overflows behind the address bar when it's shown. dvh/dvw track
1348
+ // the actual visible viewport as browser chrome shows/hides. Desktop behavior
1349
+ // is unchanged since there's no dynamic chrome to account for.
1350
+ // (vw/dvw values are web-only; vh/dvh values work cross-platform via spacing scale for h-*)
1351
+ "w-screen": web ? { width: "100dvw" } : null,
1352
+ "min-h-screen": { minHeight: "100dvh" },
1353
+ "max-h-screen": { maxHeight: "100dvh" },
1354
+ "min-w-screen": web ? { minWidth: "100dvw" } : null,
1355
+ "max-w-screen": web ? { maxWidth: "100dvw" } : null,
1356
+ // max-w named container sizes (mirrors Tailwind's container scale)
1357
+ "max-w-none": { maxWidth: "none" },
1358
+ "max-w-xs": { maxWidth: 320 },
1359
+ "max-w-sm": { maxWidth: 384 },
1360
+ "max-w-md": { maxWidth: 448 },
1361
+ "max-w-lg": { maxWidth: 512 },
1362
+ "max-w-xl": { maxWidth: 576 },
1363
+ "max-w-2xl": { maxWidth: 672 },
1364
+ "max-w-3xl": { maxWidth: 768 },
1365
+ "max-w-4xl": { maxWidth: 896 },
1366
+ "max-w-5xl": { maxWidth: 1024 },
1367
+ "max-w-6xl": { maxWidth: 1152 },
1368
+ "max-w-7xl": { maxWidth: 1280 },
1369
+ "max-w-prose": web ? { maxWidth: "65ch" } : null,
1370
+ // Extended cursors (web-only)
1371
+ "cursor-grab": web ? { cursor: "grab" } : null,
1372
+ "cursor-grabbing": web ? { cursor: "grabbing" } : null,
1373
+ "cursor-zoom-in": web ? { cursor: "zoom-in" } : null,
1374
+ "cursor-zoom-out": web ? { cursor: "zoom-out" } : null,
1375
+ "cursor-crosshair": web ? { cursor: "crosshair" } : null,
1376
+ "cursor-help": web ? { cursor: "help" } : null,
1377
+ "cursor-none": web ? { cursor: "none" } : null,
1378
+ // Overflow clip (web-only)
1379
+ "overflow-clip": web ? { overflow: "clip" } : null,
1380
+ "overflow-x-clip": web ? { overflowX: "clip" } : null,
1381
+ "overflow-y-clip": web ? { overflowY: "clip" } : null,
1382
+ // Scroll behavior (web-only)
1383
+ "scroll-smooth": web ? { scrollBehavior: "smooth" } : null,
1384
+ "scroll-auto": web ? { scrollBehavior: "auto" } : null,
1385
+ // Float (web-only)
1386
+ "float-left": web ? { float: "left" } : null,
1387
+ "float-right": web ? { float: "right" } : null,
1388
+ "float-start": web ? { float: "inline-start" } : null,
1389
+ "float-end": web ? { float: "inline-end" } : null,
1390
+ "float-none": web ? { float: "none" } : null,
1391
+ // Clear (web-only)
1392
+ "clear-left": web ? { clear: "left" } : null,
1393
+ "clear-right": web ? { clear: "right" } : null,
1394
+ "clear-both": web ? { clear: "both" } : null,
1395
+ "clear-start": web ? { clear: "inline-start" } : null,
1396
+ "clear-end": web ? { clear: "inline-end" } : null,
1397
+ "clear-none": web ? { clear: "none" } : null,
1398
+ // Vertical align (web-only)
1399
+ "align-baseline": web ? { verticalAlign: "baseline" } : null,
1400
+ "align-top": web ? { verticalAlign: "top" } : null,
1401
+ "align-middle": web ? { verticalAlign: "middle" } : null,
1402
+ "align-bottom": web ? { verticalAlign: "bottom" } : null,
1403
+ "align-text-top": web ? { verticalAlign: "text-top" } : null,
1404
+ "align-text-bottom": web ? { verticalAlign: "text-bottom" } : null,
1405
+ "align-sub": web ? { verticalAlign: "sub" } : null,
1406
+ "align-super": web ? { verticalAlign: "super" } : null,
1407
+ // Touch action (web-only)
1408
+ "touch-auto": web ? { touchAction: "auto" } : null,
1409
+ "touch-none": web ? { touchAction: "none" } : null,
1410
+ "touch-pan-x": web ? { touchAction: "pan-x" } : null,
1411
+ "touch-pan-y": web ? { touchAction: "pan-y" } : null,
1412
+ "touch-pan-left": web ? { touchAction: "pan-left" } : null,
1413
+ "touch-pan-right": web ? { touchAction: "pan-right" } : null,
1414
+ "touch-pan-up": web ? { touchAction: "pan-up" } : null,
1415
+ "touch-pan-down": web ? { touchAction: "pan-down" } : null,
1416
+ "touch-pinch-zoom": web ? { touchAction: "pinch-zoom" } : null,
1417
+ "touch-manipulation": web ? { touchAction: "manipulation" } : null
1418
+ };
1419
+ }
1420
+ function getStandalone() {
1421
+ const web = getEffectiveIsWeb();
1422
+ if (!_standalone || _standaloneWeb !== web) {
1423
+ _standalone = buildStandalone(web);
1424
+ _standaloneWeb = web;
1425
+ }
1426
+ return _standalone;
1427
+ }
1428
+ var layoutResolvers = {
1429
+ // ── Grid (responsive column count: grid-1 … grid-12, or arbitrary) ───────
1430
+ grid: ({ value, isArbitrary }) => {
1431
+ if (!value) return null;
1432
+ if (isArbitrary) return { display: "grid", gridTemplateColumns: value };
1433
+ const n = parseInt(value, 10);
1434
+ if (isNaN(n) || n < 1 || n > 12) return null;
1435
+ return { display: "grid", gridTemplateColumns: `repeat(${n}, minmax(0, 1fr))` };
1436
+ },
1437
+ // ── Grid template columns/rows (Tailwind-style aliases, web-only) ──────────
1438
+ "grid-cols": ({ value, isArbitrary }) => {
1439
+ if (!getEffectiveIsWeb()) return null;
1440
+ if (!value) return null;
1441
+ if (isArbitrary) return { display: "grid", gridTemplateColumns: value };
1442
+ if (value === "none") return { display: "grid", gridTemplateColumns: "none" };
1443
+ const n = parseInt(value, 10);
1444
+ if (isNaN(n) || n < 1 || n > 12) return null;
1445
+ return { display: "grid", gridTemplateColumns: `repeat(${n}, minmax(0, 1fr))` };
1446
+ },
1447
+ "grid-rows": ({ value, isArbitrary }) => {
1448
+ if (!getEffectiveIsWeb()) return null;
1449
+ if (!value) return null;
1450
+ if (isArbitrary) return { gridTemplateRows: value };
1451
+ if (value === "none") return { gridTemplateRows: "none" };
1452
+ const n = parseInt(value, 10);
1453
+ if (isNaN(n) || n < 1) return null;
1454
+ return { gridTemplateRows: `repeat(${n}, minmax(0, 1fr))` };
1455
+ },
1456
+ // ── Grid auto flow (web-only) ─────────────────────────────────────────────
1457
+ "grid-flow": ({ value }) => {
1458
+ if (!getEffectiveIsWeb()) return null;
1459
+ const flows = {
1460
+ row: "row",
1461
+ col: "column",
1462
+ dense: "dense",
1463
+ "row-dense": "row dense",
1464
+ "col-dense": "column dense"
1465
+ };
1466
+ const flow = flows[value];
1467
+ return flow ? { gridAutoFlow: flow } : null;
1468
+ },
1469
+ // ── Grid auto sizing (web-only) ───────────────────────────────────────────
1470
+ "auto-cols": ({ value, isArbitrary }) => {
1471
+ if (!getEffectiveIsWeb()) return null;
1472
+ if (isArbitrary) return { gridAutoColumns: value };
1473
+ const presets = {
1474
+ auto: "auto",
1475
+ min: "min-content",
1476
+ max: "max-content",
1477
+ fr: "minmax(0, 1fr)"
1478
+ };
1479
+ const v = presets[value];
1480
+ return v ? { gridAutoColumns: v } : null;
1481
+ },
1482
+ "auto-rows": ({ value, isArbitrary }) => {
1483
+ if (!getEffectiveIsWeb()) return null;
1484
+ if (isArbitrary) return { gridAutoRows: value };
1485
+ const presets = {
1486
+ auto: "auto",
1487
+ min: "min-content",
1488
+ max: "max-content",
1489
+ fr: "minmax(0, 1fr)"
1490
+ };
1491
+ const v = presets[value];
1492
+ return v ? { gridAutoRows: v } : null;
1493
+ },
1494
+ // ── Grid column placement (web-only) ──────────────────────────────────────
1495
+ "col-span": ({ value }) => {
1496
+ if (!getEffectiveIsWeb()) return null;
1497
+ if (value === "full") return { gridColumn: "1 / -1" };
1498
+ const n = parseInt(value, 10);
1499
+ return isNaN(n) ? null : { gridColumn: `span ${n} / span ${n}` };
1500
+ },
1501
+ "col-start": ({ value, isArbitrary }) => {
1502
+ if (!getEffectiveIsWeb()) return null;
1503
+ if (value === "auto") return { gridColumnStart: "auto" };
1504
+ if (isArbitrary) return { gridColumnStart: value };
1505
+ const n = parseInt(value, 10);
1506
+ return isNaN(n) ? null : { gridColumnStart: n };
1507
+ },
1508
+ "col-end": ({ value, isArbitrary }) => {
1509
+ if (!getEffectiveIsWeb()) return null;
1510
+ if (value === "auto") return { gridColumnEnd: "auto" };
1511
+ if (isArbitrary) return { gridColumnEnd: value };
1512
+ const n = parseInt(value, 10);
1513
+ return isNaN(n) ? null : { gridColumnEnd: n };
1514
+ },
1515
+ col: ({ value, isArbitrary }) => {
1516
+ if (!getEffectiveIsWeb()) return null;
1517
+ if (!value || value === "auto") return { gridColumn: "auto" };
1518
+ if (isArbitrary) return { gridColumn: value };
1519
+ return null;
1520
+ },
1521
+ // ── Grid row placement (web-only) ─────────────────────────────────────────
1522
+ "row-span": ({ value }) => {
1523
+ if (!getEffectiveIsWeb()) return null;
1524
+ if (value === "full") return { gridRow: "1 / -1" };
1525
+ const n = parseInt(value, 10);
1526
+ return isNaN(n) ? null : { gridRow: `span ${n} / span ${n}` };
1527
+ },
1528
+ "row-start": ({ value, isArbitrary }) => {
1529
+ if (!getEffectiveIsWeb()) return null;
1530
+ if (value === "auto") return { gridRowStart: "auto" };
1531
+ if (isArbitrary) return { gridRowStart: value };
1532
+ const n = parseInt(value, 10);
1533
+ return isNaN(n) ? null : { gridRowStart: n };
1534
+ },
1535
+ "row-end": ({ value, isArbitrary }) => {
1536
+ if (!getEffectiveIsWeb()) return null;
1537
+ if (value === "auto") return { gridRowEnd: "auto" };
1538
+ if (isArbitrary) return { gridRowEnd: value };
1539
+ const n = parseInt(value, 10);
1540
+ return isNaN(n) ? null : { gridRowEnd: n };
1541
+ },
1542
+ row: ({ value, isArbitrary }) => {
1543
+ if (!getEffectiveIsWeb()) return null;
1544
+ if (!value || value === "auto") return { gridRow: "auto" };
1545
+ if (isArbitrary) return { gridRow: value };
1546
+ return null;
1547
+ },
1548
+ // ── Grid alignment (web-only) ──────────────────────────────────────────────
1549
+ // place-items is shorthand for align-items + justify-items on a grid container
1550
+ "place-items": ({ value }) => {
1551
+ if (!getEffectiveIsWeb()) return null;
1552
+ const map = {
1553
+ start: "start",
1554
+ end: "end",
1555
+ center: "center",
1556
+ stretch: "stretch",
1557
+ baseline: "baseline"
1558
+ };
1559
+ return map[value] ? { placeItems: map[value] } : null;
1560
+ },
1561
+ // place-content is shorthand for align-content + justify-content on a grid container
1562
+ "place-content": ({ value }) => {
1563
+ if (!getEffectiveIsWeb()) return null;
1564
+ const map = {
1565
+ start: "start",
1566
+ end: "end",
1567
+ center: "center",
1568
+ stretch: "stretch",
1569
+ between: "space-between",
1570
+ around: "space-around",
1571
+ evenly: "space-evenly",
1572
+ baseline: "baseline"
1573
+ };
1574
+ return map[value] ? { placeContent: map[value] } : null;
1575
+ },
1576
+ // justify-items controls inline-axis alignment of grid items within their cells
1577
+ "justify-items": ({ value }) => {
1578
+ if (!getEffectiveIsWeb()) return null;
1579
+ const map = {
1580
+ start: "start",
1581
+ end: "end",
1582
+ center: "center",
1583
+ stretch: "stretch"
1584
+ };
1585
+ return map[value] ? { justifyItems: map[value] } : null;
1586
+ },
1587
+ // place-self is shorthand for align-self + justify-self on a grid item
1588
+ "place-self": ({ value }) => {
1589
+ if (!getEffectiveIsWeb()) return null;
1590
+ const map = {
1591
+ auto: "auto",
1592
+ start: "start",
1593
+ end: "end",
1594
+ center: "center",
1595
+ stretch: "stretch"
1596
+ };
1597
+ return map[value] ? { placeSelf: map[value] } : null;
1598
+ },
1599
+ // justify-self controls inline-axis self-alignment of a grid item
1600
+ "justify-self": ({ value }) => {
1601
+ if (!getEffectiveIsWeb()) return null;
1602
+ const map = {
1603
+ auto: "auto",
1604
+ start: "start",
1605
+ end: "end",
1606
+ center: "center",
1607
+ stretch: "stretch"
1608
+ };
1609
+ return map[value] ? { justifySelf: map[value] } : null;
1610
+ },
1611
+ // ── Flex ───────────────────────────────────────────────────────────────────
1612
+ // flex-1/flex-auto/flex-none/grow/shrink are item-level sizing properties —
1613
+ // deliberately NOT implying display:flex here. See the "Flex grow / shrink"
1614
+ // comment in the standalone table above for why: these already work via the
1615
+ // PARENT's flex context regardless of this element's own display, so
1616
+ // forcing display:flex here would only be a surprising, unrelated side
1617
+ // effect on this element's OWN children.
1618
+ flex: ({ value, isArbitrary }, { flex }) => {
1619
+ if (!value) return { display: "flex" };
1620
+ if (isArbitrary) {
1621
+ const v = parseFloat(value);
1622
+ return isNaN(v) ? null : { flex: v };
1623
+ }
1624
+ if (value in flex) {
1625
+ const v = flex[value];
1626
+ if (typeof v === "string" && !getEffectiveIsWeb()) {
1627
+ if (v === "auto" || v === "initial") return { flex: 1 };
1628
+ if (v === "none") return { flex: 0 };
1629
+ return null;
1630
+ }
1631
+ return { flex: v };
1632
+ }
1633
+ const n = parseFloat(value);
1634
+ return isNaN(n) ? null : { flex: n };
1635
+ },
1636
+ grow: ({ value }, _) => {
1637
+ if (!value) return { flexGrow: 1 };
1638
+ const n = parseFloat(value);
1639
+ return { flexGrow: isNaN(n) ? 1 : n };
1640
+ },
1641
+ shrink: ({ value }, _) => {
1642
+ if (!value) return { flexShrink: 1 };
1643
+ const n = parseFloat(value);
1644
+ return { flexShrink: isNaN(n) ? 1 : n };
1645
+ },
1646
+ order: ({ value, negative }, _) => {
1647
+ const n = parseInt(value, 10);
1648
+ return isNaN(n) ? null : { order: negative ? -n : n };
1649
+ },
1650
+ // ── Z-index ────────────────────────────────────────────────────────────────
1651
+ z: ({ value, isArbitrary }, { zIndex }) => {
1652
+ if (isArbitrary) {
1653
+ const n2 = parseInt(value);
1654
+ return isNaN(n2) ? null : { zIndex: n2 };
1655
+ }
1656
+ const v = zIndex[value];
1657
+ if (v !== void 0) {
1658
+ if (v === "auto") return getEffectiveIsWeb() ? { zIndex: "auto" } : null;
1659
+ return { zIndex: v };
1660
+ }
1661
+ const n = parseInt(value);
1662
+ return isNaN(n) ? null : { zIndex: n };
1663
+ },
1664
+ // ── Aspect ratio ───────────────────────────────────────────────────────────
1665
+ aspect: ({ value, isArbitrary }) => {
1666
+ if (isArbitrary) return { aspectRatio: value };
1667
+ const presets = { auto: "auto", square: 1, video: 16 / 9 };
1668
+ if (!(value in presets)) return null;
1669
+ const v = presets[value];
1670
+ if (v === "auto") return getEffectiveIsWeb() ? { aspectRatio: "auto" } : null;
1671
+ return { aspectRatio: v };
1672
+ },
1673
+ // ── Columns (web-only) ─────────────────────────────────────────────────────
1674
+ columns: ({ value, isArbitrary }) => {
1675
+ if (!getEffectiveIsWeb()) return null;
1676
+ if (isArbitrary) return { columnCount: value };
1677
+ if (value === "auto") return { columnCount: "auto" };
1678
+ const n = parseInt(value, 10);
1679
+ if (!isNaN(n)) return { columnCount: n };
1680
+ const widths = {
1681
+ "3xs": "16rem",
1682
+ "2xs": "18rem",
1683
+ xs: "20rem",
1684
+ sm: "24rem",
1685
+ md: "28rem",
1686
+ lg: "32rem",
1687
+ xl: "36rem",
1688
+ "2xl": "42rem",
1689
+ "3xl": "48rem",
1690
+ "4xl": "56rem",
1691
+ "5xl": "64rem",
1692
+ "6xl": "72rem",
1693
+ "7xl": "80rem"
1694
+ };
1695
+ return widths[value] ? { columnWidth: widths[value] } : null;
1696
+ }
1697
+ };
1698
+
1699
+ // src/core/resolvers/typography.ts
1700
+ function resolveFontSize(value, fontSizes, isArbitrary) {
1701
+ if (isArbitrary) return getEffectiveIsWeb() ? value : toNativeValue(value);
1702
+ return fontSizes[value] ?? null;
1703
+ }
1704
+ var typographyResolvers = {
1705
+ // ── Text ───────────────────────────────────────────────────────────────────
1706
+ text: ({ value, isArbitrary }, { colors, fontSize }) => {
1707
+ const size = resolveFontSize(value, fontSize, false);
1708
+ if (!isArbitrary && size !== null) return { fontSize: size };
1709
+ if (isArbitrary) {
1710
+ if (/^\d/.test(value) || /^(calc|min|max|clamp)/.test(value)) {
1711
+ return { fontSize: getEffectiveIsWeb() ? value : toNativeValue(value) };
1712
+ }
1713
+ return { color: getEffectiveIsWeb() ? withOpacityVar(value, "--text-opacity") : value };
1714
+ }
1715
+ const color = resolveColor(value, colors, false);
1716
+ if (!color) return null;
1717
+ return { color: getEffectiveIsWeb() ? withOpacityVar(color, "--text-opacity") : color };
1718
+ },
1719
+ "text-opacity": ({ value, isArbitrary }, _) => {
1720
+ if (!getEffectiveIsWeb()) return null;
1721
+ const n = parseFloat(value);
1722
+ if (isNaN(n)) return null;
1723
+ const v = isArbitrary ? n > 1 ? n / 100 : n : n / 100;
1724
+ return { "--text-opacity": v };
1725
+ },
1726
+ // ── Text decoration advanced (web-only) ───────────────────────────────────
1727
+ decoration: ({ value, isArbitrary }, { colors }) => {
1728
+ if (!getEffectiveIsWeb()) return null;
1729
+ if (isArbitrary) {
1730
+ if (/^\d/.test(value) || value.startsWith("calc(")) return { textDecorationThickness: value };
1731
+ return { textDecorationColor: value };
1732
+ }
1733
+ const thickTokens = {
1734
+ auto: "auto",
1735
+ "from-font": "from-font",
1736
+ "0": "0px",
1737
+ "1": "1px",
1738
+ "2": "2px",
1739
+ "4": "4px",
1740
+ "8": "8px"
1741
+ };
1742
+ if (value in thickTokens) return { textDecorationThickness: thickTokens[value] };
1743
+ const styleTokens = {
1744
+ solid: "solid",
1745
+ dashed: "dashed",
1746
+ dotted: "dotted",
1747
+ double: "double",
1748
+ wavy: "wavy"
1749
+ };
1750
+ if (value in styleTokens) return { textDecorationStyle: styleTokens[value] };
1751
+ const color = resolveColor(value, colors, false);
1752
+ return color ? { textDecorationColor: color } : null;
1753
+ },
1754
+ "underline-offset": ({ value, isArbitrary }) => {
1755
+ if (!getEffectiveIsWeb()) return null;
1756
+ if (isArbitrary) return { textUnderlineOffset: value };
1757
+ const offsets = {
1758
+ auto: "auto",
1759
+ "0": "0px",
1760
+ "1": "1px",
1761
+ "2": "2px",
1762
+ "4": "4px",
1763
+ "8": "8px"
1764
+ };
1765
+ return offsets[value] ? { textUnderlineOffset: offsets[value] } : null;
1766
+ },
1767
+ // ── Content (web-only — for before:/after: pseudo-elements, which don't exist on native) ──
1768
+ // Arbitrary value carries its own quotes from the bracket syntax (content-['*'] parses to
1769
+ // the literal string 'you can see it' quotes included), so it passes straight through as a
1770
+ // valid `content: '*'` CSS value with no extra wrapping needed.
1771
+ content: ({ value, isArbitrary }) => {
1772
+ if (!getEffectiveIsWeb()) return null;
1773
+ if (isArbitrary) return { content: value };
1774
+ const presets = { none: "none" };
1775
+ return value in presets ? { content: presets[value] } : null;
1776
+ },
1777
+ // ── Font ───────────────────────────────────────────────────────────────────
1778
+ font: ({ value, isArbitrary }, { fontFamily, fontWeight }) => {
1779
+ if (isArbitrary) return { fontFamily: value };
1780
+ if (value in fontFamily) {
1781
+ const ff = fontFamily[value];
1782
+ return { fontFamily: Array.isArray(ff) ? ff.join(", ") : ff };
1783
+ }
1784
+ if (value in fontWeight) return { fontWeight: String(fontWeight[value]) };
1785
+ return null;
1786
+ },
1787
+ // ── Line height ────────────────────────────────────────────────────────────
1788
+ leading: ({ value, isArbitrary }, { lineHeight }) => {
1789
+ if (isArbitrary) return { lineHeight: getEffectiveIsWeb() ? value : toNativeValue(value) };
1790
+ const v = lineHeight[value];
1791
+ if (v === void 0) return null;
1792
+ if (typeof v === "string" && !getEffectiveIsWeb()) return { lineHeight: toNativeValue(v) };
1793
+ return { lineHeight: v };
1794
+ },
1795
+ // ── Letter spacing ─────────────────────────────────────────────────────────
1796
+ tracking: ({ value, isArbitrary }, { letterSpacing }) => {
1797
+ if (isArbitrary) return { letterSpacing: getEffectiveIsWeb() ? value : toNativeValue(value) };
1798
+ const v = letterSpacing[value];
1799
+ return v !== void 0 ? { letterSpacing: v } : null;
1800
+ },
1801
+ // ── Line-clamp (web-only) ─────────────────────────────────────────────────
1802
+ "line-clamp": ({ value }) => {
1803
+ if (!getEffectiveIsWeb()) return null;
1804
+ if (value === "none") return { overflow: "visible", display: "block", WebkitLineClamp: "unset" };
1805
+ const n = parseInt(value, 10);
1806
+ if (isNaN(n) || n < 1) return null;
1807
+ return {
1808
+ overflow: "hidden",
1809
+ display: "-webkit-box",
1810
+ WebkitBoxOrient: "vertical",
1811
+ WebkitLineClamp: n
1812
+ };
1813
+ }
1814
+ };
1815
+
1816
+ // src/core/resolvers/transform.ts
1817
+ var transformResolvers = {
1818
+ // ── Transform extras (web-only) ───────────────────────────────────────────
1819
+ "skew-x": ({ value, negative, isArbitrary }) => {
1820
+ const deg = isArbitrary ? value : `${(negative ? -1 : 1) * parseFloat(value)}deg`;
1821
+ if (!isArbitrary && isNaN(parseFloat(value))) return null;
1822
+ return getEffectiveIsWeb() ? { transform: `skewX(${deg})` } : { transform: [{ skewX: deg }] };
1823
+ },
1824
+ "skew-y": ({ value, negative, isArbitrary }) => {
1825
+ const deg = isArbitrary ? value : `${(negative ? -1 : 1) * parseFloat(value)}deg`;
1826
+ if (!isArbitrary && isNaN(parseFloat(value))) return null;
1827
+ return getEffectiveIsWeb() ? { transform: `skewY(${deg})` } : { transform: [{ skewY: deg }] };
1828
+ },
1829
+ // Arbitrary full transform string: transform-[rotate(45deg)_scale(1.5)]
1830
+ transform: ({ value, isArbitrary }) => {
1831
+ if (!getEffectiveIsWeb()) return null;
1832
+ if (isArbitrary) return { transform: value.replace(/_/g, " ") };
1833
+ if (value === "none") return { transform: "none" };
1834
+ return null;
1835
+ },
1836
+ // Transform origin
1837
+ origin: ({ value, isArbitrary }) => {
1838
+ if (!getEffectiveIsWeb()) return null;
1839
+ if (isArbitrary) return { transformOrigin: value.replace(/_/g, " ") };
1840
+ const origins = {
1841
+ center: "center",
1842
+ top: "top",
1843
+ "top-right": "top right",
1844
+ right: "right",
1845
+ "bottom-right": "bottom right",
1846
+ bottom: "bottom",
1847
+ "bottom-left": "bottom left",
1848
+ left: "left",
1849
+ "top-left": "top left"
1850
+ };
1851
+ return origins[value] ? { transformOrigin: origins[value] } : null;
1852
+ },
1853
+ // ── Scale ──────────────────────────────────────────────────────────────────
1854
+ // Non-arbitrary: scale-150 → value='150' → 150/100 = 1.5
1855
+ // Arbitrary: scale-[1.5] → value='1.5' → used as-is (already the factor)
1856
+ scale: ({ value, isArbitrary }) => {
1857
+ const n = isArbitrary ? parseFloat(value) : parseFloat(value) / 100;
1858
+ if (isNaN(n)) return null;
1859
+ return getEffectiveIsWeb() ? { transform: `scale(${n})` } : { transform: [{ scale: n }] };
1860
+ },
1861
+ "scale-x": ({ value, isArbitrary }) => {
1862
+ const n = isArbitrary ? parseFloat(value) : parseFloat(value) / 100;
1863
+ if (isNaN(n)) return null;
1864
+ return getEffectiveIsWeb() ? { transform: `scaleX(${n})` } : { transform: [{ scaleX: n }] };
1865
+ },
1866
+ "scale-y": ({ value, isArbitrary }) => {
1867
+ const n = isArbitrary ? parseFloat(value) : parseFloat(value) / 100;
1868
+ if (isNaN(n)) return null;
1869
+ return getEffectiveIsWeb() ? { transform: `scaleY(${n})` } : { transform: [{ scaleY: n }] };
1870
+ },
1871
+ // ── Rotate ─────────────────────────────────────────────────────────────────
1872
+ rotate: ({ value, negative, isArbitrary }) => {
1873
+ if (isArbitrary) {
1874
+ const finalValue = negative ? `-${value}` : value;
1875
+ return getEffectiveIsWeb() ? { transform: `rotate(${finalValue})` } : { transform: [{ rotate: finalValue }] };
1876
+ }
1877
+ const deg = parseFloat(value);
1878
+ if (isNaN(deg)) return null;
1879
+ const finalDeg = negative ? -deg : deg;
1880
+ return getEffectiveIsWeb() ? { transform: `rotate(${finalDeg}deg)` } : { transform: [{ rotate: `${finalDeg}deg` }] };
1881
+ },
1882
+ // ── Perspective transform (cross-platform: iOS, Android, web) ────────────
1883
+ perspective: ({ value, isArbitrary }) => {
1884
+ if (isArbitrary) {
1885
+ const numPx = parseFloat(value);
1886
+ if (getEffectiveIsWeb()) return { transform: `perspective(${value})` };
1887
+ return isNaN(numPx) ? null : { transform: [{ perspective: numPx }] };
1888
+ }
1889
+ if (value === "none") return getEffectiveIsWeb() ? { transform: "none" } : null;
1890
+ const n = parseFloat(value);
1891
+ if (isNaN(n)) return null;
1892
+ return getEffectiveIsWeb() ? { transform: `perspective(${n}px)` } : { transform: [{ perspective: n }] };
1893
+ }
1894
+ };
1895
+
1896
+ // src/core/resolvers/effects.ts
1897
+ function keyframeDeclToCSS(decl) {
1898
+ return Object.entries(decl).map(([prop, val]) => `${prop.replace(/([A-Z])/g, "-$1").toLowerCase()}: ${val}`).join("; ");
1899
+ }
1900
+ function buildKeyframeCSS(name, steps) {
1901
+ const body = Object.entries(steps).map(([selector, decl]) => `${selector} { ${keyframeDeclToCSS(decl)} }`).join(" ");
1902
+ return `@keyframes ${name} { ${body} }`;
1903
+ }
1904
+ var BUILTIN_ANIMATIONS = {
1905
+ none: { animation: "none" },
1906
+ spin: {
1907
+ animation: "kb-spin 1s linear infinite",
1908
+ __keyframe: "@keyframes kb-spin { from { transform: rotate(0deg) } to { transform: rotate(360deg) } }"
1909
+ },
1910
+ ping: {
1911
+ animation: "kb-ping 1s cubic-bezier(0,0,0.2,1) infinite",
1912
+ __keyframe: "@keyframes kb-ping { 75%, 100% { transform: scale(2); opacity: 0 } }"
1913
+ },
1914
+ pulse: {
1915
+ animation: "kb-pulse 2s cubic-bezier(0.4,0,0.6,1) infinite",
1916
+ __keyframe: "@keyframes kb-pulse { 0%, 100% { opacity: 1 } 50% { opacity: .5 } }"
1917
+ },
1918
+ bounce: {
1919
+ animation: "kb-bounce 1s infinite",
1920
+ __keyframe: "@keyframes kb-bounce { 0%, 100% { transform: translateY(-25%); animation-timing-function: cubic-bezier(0.8,0,1,1) } 50% { transform: none; animation-timing-function: cubic-bezier(0,0,0.2,1) } }"
1921
+ }
1922
+ };
1923
+ function buildAnimationValue(animation, keyframes) {
1924
+ const words = animation.trim().split(/\s+/);
1925
+ const name = words[0];
1926
+ if (!name) return { animation };
1927
+ const builtin = BUILTIN_ANIMATIONS[name];
1928
+ if (builtin?.__keyframe) {
1929
+ const kbName = builtin.animation.split(/\s+/, 1)[0];
1930
+ return { animation: [kbName, ...words.slice(1)].join(" "), __keyframe: builtin.__keyframe };
1931
+ }
1932
+ const steps = keyframes?.[name];
1933
+ return steps ? { animation, __keyframe: buildKeyframeCSS(name, steps) } : { animation };
1934
+ }
1935
+ var effectResolvers = {
1936
+ // ── Opacity ────────────────────────────────────────────────────────────────
1937
+ opacity: ({ value, isArbitrary }, { opacity }) => {
1938
+ if (isArbitrary) {
1939
+ const v2 = parseFloat(value);
1940
+ return isNaN(v2) ? null : { opacity: v2 > 1 ? v2 / 100 : v2 };
1941
+ }
1942
+ const v = opacity[value];
1943
+ if (v !== void 0) return { opacity: v };
1944
+ const n = parseFloat(value);
1945
+ return isNaN(n) ? null : { opacity: n > 1 ? n / 100 : n };
1946
+ },
1947
+ // ── Shadow ─────────────────────────────────────────────────────────────────
1948
+ shadow: ({ value }, { shadow }) => {
1949
+ const key = value === "" ? "DEFAULT" : value;
1950
+ return shadow[key] ?? null;
1951
+ },
1952
+ // ── Animations (CSS keyframe animations, web-only) ────────────────────────
1953
+ // Each variant injects a @keyframes rule once via the __keyframe marker.
1954
+ // resolver.ts detects __keyframe, injects the rule, then strips the marker
1955
+ // so it never reaches element inline styles.
1956
+ animate: ({ value, isArbitrary }, theme) => {
1957
+ if (!getEffectiveIsWeb()) return null;
1958
+ if (isArbitrary) return buildAnimationValue(value.replace(/_/g, " "), theme.keyframes);
1959
+ if (value in BUILTIN_ANIMATIONS) return BUILTIN_ANIMATIONS[value];
1960
+ const custom = theme.animation?.[value];
1961
+ return custom ? buildAnimationValue(custom, theme.keyframes) : null;
1962
+ },
1963
+ // ── Transition (web-only; use Animated API on native) ─────────────────────
1964
+ transition: ({ value }) => {
1965
+ if (!getEffectiveIsWeb()) return null;
1966
+ const presets = {
1967
+ "": "color 150ms, background-color 150ms, border-color 150ms, text-decoration-color 150ms, fill 150ms, stroke 150ms, opacity 150ms, box-shadow 150ms, transform 150ms, filter 150ms, backdrop-filter 150ms",
1968
+ all: "all 150ms",
1969
+ none: "none",
1970
+ colors: "color 150ms, background-color 150ms, border-color 150ms",
1971
+ opacity: "opacity 150ms",
1972
+ shadow: "box-shadow 150ms",
1973
+ transform: "transform 150ms"
1974
+ };
1975
+ const v = presets[value];
1976
+ return v !== void 0 ? { transition: v } : null;
1977
+ },
1978
+ duration: ({ value, isArbitrary }) => {
1979
+ if (!getEffectiveIsWeb()) return null;
1980
+ if (!isArbitrary && isNaN(parseFloat(value))) return null;
1981
+ const ms = isArbitrary ? value : `${value}ms`;
1982
+ return { transitionDuration: ms };
1983
+ },
1984
+ delay: ({ value, isArbitrary }) => {
1985
+ if (!getEffectiveIsWeb()) return null;
1986
+ if (!isArbitrary && isNaN(parseFloat(value))) return null;
1987
+ const ms = isArbitrary ? value : `${value}ms`;
1988
+ return { transitionDelay: ms };
1989
+ },
1990
+ ease: ({ value, isArbitrary }) => {
1991
+ if (!getEffectiveIsWeb()) return null;
1992
+ if (isArbitrary) return { transitionTimingFunction: value };
1993
+ const presets = {
1994
+ linear: "linear",
1995
+ in: "cubic-bezier(0.4, 0, 1, 1)",
1996
+ out: "cubic-bezier(0, 0, 0.2, 1)",
1997
+ "in-out": "cubic-bezier(0.4, 0, 0.2, 1)"
1998
+ };
1999
+ const v = presets[value];
2000
+ return v !== void 0 ? { transitionTimingFunction: v } : null;
2001
+ }
2002
+ };
2003
+
2004
+ // src/core/resolvers/misc.ts
2005
+ var miscResolvers = {
2006
+ // ── Arbitrary CSS property (web-only): [property:value] with no utility prefix ──
2007
+ // e.g. [mask-type:luminance], [--my-var:10px]. parser.ts already isolates this case
2008
+ // as utility: '' — it's ALSO how a stray, prefix-less negative bracket ("-[10px]",
2009
+ // presumably a typo) parses, which is why this only fires when the arbitrary value
2010
+ // itself contains a "property:value" pair; anything else (no colon) still resolves
2011
+ // to null exactly as before this resolver existed, rather than guessing a property.
2012
+ //
2013
+ // Only the FIRST colon splits property from value — the value itself may contain
2014
+ // more colons (a URL's "http://…") and must stay intact: [background:url(http://x/a.png)].
2015
+ // camelToKebab() in resolver.ts is a no-op on an already-kebab-case (or "--"-prefixed
2016
+ // custom property) key, so it can be used as the style object key as-written with no
2017
+ // extra case conversion — it only needs to look like a plausible CSS property name.
2018
+ "": ({ value, isArbitrary, negative }) => {
2019
+ if (!getEffectiveIsWeb() || !isArbitrary || !value) return null;
2020
+ if (negative) return null;
2021
+ const colonIdx = value.indexOf(":");
2022
+ if (colonIdx <= 0) return null;
2023
+ const prop = value.slice(0, colonIdx).trim();
2024
+ const cssValue = value.slice(colonIdx + 1).trim();
2025
+ if (!cssValue || !/^(--[\w-]+|[a-zA-Z-]+)$/.test(prop)) return null;
2026
+ return { [prop]: cssValue };
2027
+ },
2028
+ // ── SVG stroke/fill (web-only) ────────────────────────────────────────────
2029
+ // Native is intentionally excluded: react-native-svg's <Path>/<Circle>/etc.
2030
+ // take stroke/fill as component PROPS, not style entries, so there's no
2031
+ // reliable way to apply a resolved color through the `style` prop there.
2032
+ // `stroke-{n}` sets strokeWidth (a plain number, unlike a color) — same
2033
+ // color-first-then-numeric-fallback disambiguation `border` uses above.
2034
+ stroke: ({ value, isArbitrary }, { colors }) => {
2035
+ if (!getEffectiveIsWeb()) return null;
2036
+ if (!value) return null;
2037
+ if (value === "none") return { stroke: "none" };
2038
+ if (isArbitrary) {
2039
+ const w = toNativeValue(value);
2040
+ return typeof w === "number" ? { strokeWidth: w } : { stroke: value };
2041
+ }
2042
+ const color = resolveColor(value, colors, false);
2043
+ if (color) return { stroke: color };
2044
+ const n = parseFloat(value);
2045
+ return isNaN(n) ? null : { strokeWidth: n };
2046
+ },
2047
+ fill: ({ value, isArbitrary }, { colors }) => {
2048
+ if (!getEffectiveIsWeb()) return null;
2049
+ if (!value) return null;
2050
+ if (value === "none") return { fill: "none" };
2051
+ if (isArbitrary) return { fill: value };
2052
+ const color = resolveColor(value, colors, false);
2053
+ return color ? { fill: color } : null;
2054
+ },
2055
+ // ── Text shadow (cross-platform: iOS, Android, web) ─────────────────────
2056
+ // Named presets give cross-platform shadow; arbitrary is web-only.
2057
+ "text-shadow": ({ value, isArbitrary }, { colors }) => {
2058
+ if (value === "none") {
2059
+ return getEffectiveIsWeb() ? { textShadow: "none" } : { textShadowColor: "transparent", textShadowOffset: { width: 0, height: 0 }, textShadowRadius: 0 };
2060
+ }
2061
+ const webPresets = {
2062
+ "": "0 2px 4px rgba(0,0,0,0.3)",
2063
+ sm: "0 1px 2px rgba(0,0,0,0.3)",
2064
+ md: "0 4px 6px rgba(0,0,0,0.3)",
2065
+ lg: "0 8px 16px rgba(0,0,0,0.5)",
2066
+ xl: "0 16px 32px rgba(0,0,0,0.5)"
2067
+ };
2068
+ const nativePresets = {
2069
+ "": { textShadowColor: "rgba(0,0,0,0.3)", textShadowOffset: { width: 0, height: 2 }, textShadowRadius: 4 },
2070
+ sm: { textShadowColor: "rgba(0,0,0,0.3)", textShadowOffset: { width: 0, height: 1 }, textShadowRadius: 2 },
2071
+ md: { textShadowColor: "rgba(0,0,0,0.3)", textShadowOffset: { width: 0, height: 4 }, textShadowRadius: 6 },
2072
+ lg: { textShadowColor: "rgba(0,0,0,0.5)", textShadowOffset: { width: 0, height: 8 }, textShadowRadius: 16 },
2073
+ xl: { textShadowColor: "rgba(0,0,0,0.5)", textShadowOffset: { width: 0, height: 16 }, textShadowRadius: 32 }
2074
+ };
2075
+ if (value in webPresets) {
2076
+ if (getEffectiveIsWeb()) return { textShadow: webPresets[value] };
2077
+ return nativePresets[value] ?? null;
2078
+ }
2079
+ if (isArbitrary) {
2080
+ return getEffectiveIsWeb() ? { textShadow: value.replace(/_/g, " ") } : null;
2081
+ }
2082
+ const color = resolveColor(value, colors, false);
2083
+ if (color) {
2084
+ return getEffectiveIsWeb() ? { textShadow: `0 2px 4px ${color}` } : { textShadowColor: color };
2085
+ }
2086
+ return null;
2087
+ }
2088
+ };
2089
+
2090
+ // src/core/utilities.ts
2091
+ var RESOLVERS = {
2092
+ ...colorResolvers,
2093
+ ...spacingResolvers,
2094
+ ...borderResolvers,
2095
+ ...layoutResolvers,
2096
+ ...typographyResolvers,
2097
+ ...filterResolvers,
2098
+ ...transformResolvers,
2099
+ ...effectResolvers,
2100
+ ...miscResolvers
2101
+ };
2102
+ var NAMED_GROUP_PEER_MARKER_RE = /^(group|peer)\/.+$/;
2103
+ function resolveUtility(parsed, theme) {
2104
+ if (!parsed.value) {
2105
+ if (parsed.utility in PLUGIN_STANDALONE) return PLUGIN_STANDALONE[parsed.utility] ?? null;
2106
+ if (parsed.utility in getStandalone()) return getStandalone()[parsed.utility] ?? null;
2107
+ if (NAMED_GROUP_PEER_MARKER_RE.test(parsed.utility)) return getEffectiveIsWeb() ? {} : null;
2108
+ }
2109
+ const resolver = PLUGIN_RESOLVERS[parsed.utility] ?? RESOLVERS[parsed.utility];
2110
+ if (resolver) return resolver(parsed, theme);
2111
+ return null;
2112
+ }
2113
+ var PLUGIN_STANDALONE = {};
2114
+ var PLUGIN_RESOLVERS = {};
2115
+ function clearPluginUtilities() {
2116
+ for (const key of Object.keys(PLUGIN_STANDALONE)) delete PLUGIN_STANDALONE[key];
2117
+ for (const key of Object.keys(PLUGIN_RESOLVERS)) delete PLUGIN_RESOLVERS[key];
2118
+ _sortedPrefixes = null;
2119
+ _standaloneNames = null;
2120
+ }
2121
+ function getPluginStandaloneMap() {
2122
+ return PLUGIN_STANDALONE;
2123
+ }
2124
+ function isKnownUtility(utility) {
2125
+ return utility in getStandalone() || utility in RESOLVERS || utility in PLUGIN_STANDALONE || utility in PLUGIN_RESOLVERS || NAMED_GROUP_PEER_MARKER_RE.test(utility);
2126
+ }
2127
+ var _sortedPrefixes = null;
2128
+ var _standaloneNames = null;
2129
+ function getBuiltinUtilityPrefixes() {
2130
+ if (!_sortedPrefixes) {
2131
+ const all = [.../* @__PURE__ */ new Set([...Object.keys(RESOLVERS), ...Object.keys(PLUGIN_RESOLVERS)])];
2132
+ _sortedPrefixes = all.sort((a, b) => b.length - a.length);
2133
+ }
2134
+ return _sortedPrefixes;
2135
+ }
2136
+ function getBuiltinStandaloneNames() {
2137
+ if (!_standaloneNames) {
2138
+ _standaloneNames = /* @__PURE__ */ new Set([...Object.keys(getStandalone()), ...Object.keys(PLUGIN_STANDALONE)]);
2139
+ }
2140
+ return _standaloneNames;
2141
+ }
2142
+
2143
+ // src/core/parser.ts
2144
+ var UNSAFE_ARBITRARY_VALUE = /[{};\\]|\/\*|\*\//;
2145
+ function isSafeArbitraryValue(value) {
2146
+ if (!UNSAFE_ARBITRARY_VALUE.test(value)) return true;
2147
+ if (process.env.NODE_ENV !== "production") {
2148
+ kbachWarn(`Unsafe arbitrary value rejected: "${value}"`);
2149
+ }
2150
+ return false;
2151
+ }
2152
+ function parseClass(className) {
2153
+ const trimmed = className.trim();
2154
+ if (!trimmed) return null;
2155
+ const modifiers = [];
2156
+ let remaining = trimmed;
2157
+ while (true) {
2158
+ const colonIdx = findOuterColon(remaining);
2159
+ if (colonIdx === -1) break;
2160
+ const candidate = remaining.slice(0, colonIdx);
2161
+ if (!isKnownModifier(candidate)) break;
2162
+ modifiers.push(candidate);
2163
+ remaining = remaining.slice(colonIdx + 1);
2164
+ }
2165
+ let important = false;
2166
+ if (remaining.startsWith("!") && remaining.length > 1) {
2167
+ important = true;
2168
+ remaining = remaining.slice(1);
2169
+ }
2170
+ let negative = false;
2171
+ if (remaining.startsWith("-") && remaining.length > 1 && remaining[1] !== "-") {
2172
+ negative = true;
2173
+ remaining = remaining.slice(1);
2174
+ }
2175
+ let bracketDepth = 0;
2176
+ let bracketStart = -1;
2177
+ for (let i = remaining.length - 1; i >= 0; i--) {
2178
+ if (remaining[i] === "]") bracketDepth++;
2179
+ else if (remaining[i] === "[") {
2180
+ bracketDepth--;
2181
+ if (bracketDepth === 0) {
2182
+ bracketStart = i;
2183
+ break;
2184
+ }
2185
+ }
2186
+ }
2187
+ if (bracketStart > 0 && remaining[bracketStart - 1] === "-" && remaining.endsWith("]")) {
2188
+ const utility = remaining.slice(0, bracketStart - 1);
2189
+ const value = remaining.slice(bracketStart + 1, -1).replace(/_/g, " ");
2190
+ if (!isSafeArbitraryValue(value)) return null;
2191
+ return { original: trimmed, modifiers, negative, important, utility, value, isArbitrary: true };
2192
+ }
2193
+ if (remaining.endsWith("]") && bracketStart === -1) {
2194
+ if (process.env.NODE_ENV !== "production") {
2195
+ kbachWarn(`Unbalanced brackets: "${trimmed}"`);
2196
+ }
2197
+ }
2198
+ if (remaining.startsWith("[") && remaining.endsWith("]")) {
2199
+ const value = remaining.slice(1, -1).replace(/_/g, " ");
2200
+ if (!isSafeArbitraryValue(value)) return null;
2201
+ return { original: trimmed, modifiers, negative, important, utility: "", value, isArbitrary: true };
2202
+ }
2203
+ if (getBuiltinStandaloneNames().has(remaining)) {
2204
+ return { original: trimmed, modifiers, negative, important, utility: remaining, value: "", isArbitrary: false };
2205
+ }
2206
+ for (const prefix of getBuiltinUtilityPrefixes()) {
2207
+ if (remaining === prefix) {
2208
+ return { original: trimmed, modifiers, negative, important, utility: prefix, value: "", isArbitrary: false };
2209
+ }
2210
+ if (remaining.startsWith(prefix + "-")) {
2211
+ const value = remaining.slice(prefix.length + 1);
2212
+ return { original: trimmed, modifiers, negative, important, utility: prefix, value, isArbitrary: false };
2213
+ }
2214
+ }
2215
+ const firstDash = remaining.indexOf("-");
2216
+ if (firstDash > 0) {
2217
+ return {
2218
+ original: trimmed,
2219
+ modifiers,
2220
+ negative,
2221
+ important,
2222
+ utility: remaining.slice(0, firstDash),
2223
+ value: remaining.slice(firstDash + 1),
2224
+ isArbitrary: false
2225
+ };
2226
+ }
2227
+ return { original: trimmed, modifiers, negative, important, utility: remaining, value: "", isArbitrary: false };
2228
+ }
2229
+ function splitClassTokens(classString) {
2230
+ const tokens = [];
2231
+ let current = "";
2232
+ let depth = 0;
2233
+ let parenDepth = 0;
2234
+ for (let i = 0; i < classString.length; i++) {
2235
+ const ch = classString[i];
2236
+ if (ch === "[") {
2237
+ depth++;
2238
+ current += ch;
2239
+ continue;
2240
+ }
2241
+ if (ch === "]") {
2242
+ depth--;
2243
+ current += ch;
2244
+ continue;
2245
+ }
2246
+ if (ch === "(") {
2247
+ parenDepth++;
2248
+ current += ch;
2249
+ continue;
2250
+ }
2251
+ if (ch === ")") {
2252
+ parenDepth--;
2253
+ current += ch;
2254
+ continue;
2255
+ }
2256
+ if (/\s/.test(ch)) {
2257
+ if (depth === 0 && parenDepth === 0) {
2258
+ if (current) {
2259
+ tokens.push(current);
2260
+ current = "";
2261
+ }
2262
+ }
2263
+ } else {
2264
+ current += ch;
2265
+ }
2266
+ }
2267
+ if (current) tokens.push(current);
2268
+ return tokens;
2269
+ }
2270
+ function normalizeClassString(classString) {
2271
+ return splitClassTokens(classString).join(" ");
2272
+ }
2273
+ function parseClasses(classString) {
2274
+ const results = [];
2275
+ for (const token of splitClassTokens(classString)) {
2276
+ const parsed = parseClass(token);
2277
+ if (parsed) results.push(parsed);
2278
+ }
2279
+ return results;
2280
+ }
2281
+ function findOuterColon(s) {
2282
+ let depth = 0;
2283
+ for (let i = 0; i < s.length; i++) {
2284
+ const ch = s[i];
2285
+ if (ch === "[") depth++;
2286
+ else if (ch === "]") depth--;
2287
+ else if (ch === ":" && depth === 0) return i;
2288
+ }
2289
+ return -1;
2290
+ }
2291
+
2292
+ // src/core/modeAwareColors.ts
2293
+ var _modeAwareMapCache = /* @__PURE__ */ new WeakMap();
2294
+ function buildModeAwareMap(colors) {
2295
+ const map = /* @__PURE__ */ new Map();
2296
+ for (const [name, entry] of Object.entries(colors)) {
2297
+ if (isModeAwareColor(entry)) {
2298
+ map.set(name, entry);
2299
+ } else if (entry && typeof entry === "object") {
2300
+ for (const [shade, val] of Object.entries(entry)) {
2301
+ if (isModeAwareColor(val)) map.set(`${name}-${shade}`, val);
2302
+ }
2303
+ }
2304
+ }
2305
+ return map;
2306
+ }
2307
+ function getModeAwareMap(colors) {
2308
+ let map = _modeAwareMapCache.get(colors);
2309
+ if (!map) {
2310
+ map = buildModeAwareMap(colors);
2311
+ _modeAwareMapCache.set(colors, map);
2312
+ }
2313
+ return map;
2314
+ }
2315
+ function expandModeAwareColorClasses(classString, colors) {
2316
+ const map = getModeAwareMap(colors);
2317
+ if (map.size === 0) return classString;
2318
+ const tokens = splitClassTokens(classString);
2319
+ let changed = false;
2320
+ const out = [];
2321
+ for (const token of tokens) {
2322
+ const parsed = parseClass(token);
2323
+ if (!parsed || parsed.isArbitrary) {
2324
+ out.push(token);
2325
+ continue;
2326
+ }
2327
+ const slashIdx = parsed.value.indexOf("/");
2328
+ const colorPart = slashIdx > 0 ? parsed.value.slice(0, slashIdx) : parsed.value;
2329
+ const opacitySuffix = slashIdx > 0 ? parsed.value.slice(slashIdx) : "";
2330
+ const pair = map.get(colorPart);
2331
+ if (!pair) {
2332
+ out.push(token);
2333
+ continue;
2334
+ }
2335
+ changed = true;
2336
+ const bang = parsed.important ? "!" : "";
2337
+ const modPrefix = parsed.modifiers.map((m) => `${m}:`).join("");
2338
+ const explicitScheme = parsed.modifiers.map((m) => getModifier(m)?.darkScheme).find((s) => s);
2339
+ if (explicitScheme) {
2340
+ const side = explicitScheme === "dark" ? pair.dark : pair.light;
2341
+ out.push(`${bang}${modPrefix}${parsed.utility}-[${side}]${opacitySuffix}`);
2342
+ continue;
2343
+ }
2344
+ out.push(`${bang}${modPrefix}${parsed.utility}-[${pair.light}]${opacitySuffix}`);
2345
+ out.push(`${bang}dark:${modPrefix}${parsed.utility}-[${pair.dark}]${opacitySuffix}`);
2346
+ }
2347
+ return changed ? out.join(" ") : classString;
2348
+ }
2349
+
2350
+ // src/core/theme.ts
2351
+ var defaultColors = {
2352
+ transparent: "transparent",
2353
+ current: "currentColor",
2354
+ black: "#000000",
2355
+ white: "#ffffff",
2356
+ slate: {
2357
+ 1: "#f8fafc",
2358
+ 2: "#f1f5f9",
2359
+ 3: "#e2e8f0",
2360
+ 4: "#cbd5e1",
2361
+ 5: "#94a3b8",
2362
+ 6: "#64748b",
2363
+ 7: "#475569",
2364
+ 8: "#334155",
2365
+ 9: "#1e293b",
2366
+ 10: "#0f172a",
2367
+ 11: "#020617",
2368
+ 12: "#01020a"
2369
+ },
2370
+ gray: {
2371
+ 1: "#f9fafb",
2372
+ 2: "#f3f4f6",
2373
+ 3: "#e5e7eb",
2374
+ 4: "#d1d5db",
2375
+ 5: "#9ca3af",
2376
+ 6: "#6b7280",
2377
+ 7: "#4b5563",
2378
+ 8: "#374151",
2379
+ 9: "#1f2937",
2380
+ 10: "#111827",
2381
+ 11: "#030712",
2382
+ 12: "#020409"
2383
+ },
2384
+ zinc: {
2385
+ 1: "#fafafa",
2386
+ 2: "#f4f4f5",
2387
+ 3: "#e4e4e7",
2388
+ 4: "#d4d4d8",
2389
+ 5: "#a1a1aa",
2390
+ 6: "#71717a",
2391
+ 7: "#52525b",
2392
+ 8: "#3f3f46",
2393
+ 9: "#27272a",
2394
+ 10: "#18181b",
2395
+ 11: "#09090b",
2396
+ 12: "#050506"
2397
+ },
2398
+ neutral: {
2399
+ 1: "#fafafa",
2400
+ 2: "#f5f5f5",
2401
+ 3: "#e5e5e5",
2402
+ 4: "#d4d4d4",
2403
+ 5: "#a3a3a3",
2404
+ 6: "#737373",
2405
+ 7: "#525252",
2406
+ 8: "#404040",
2407
+ 9: "#262626",
2408
+ 10: "#171717",
2409
+ 11: "#0a0a0a",
2410
+ 12: "#050505"
2411
+ },
2412
+ stone: {
2413
+ 1: "#fafaf9",
2414
+ 2: "#f5f5f4",
2415
+ 3: "#e7e5e4",
2416
+ 4: "#d6d3d1",
2417
+ 5: "#a8a29e",
2418
+ 6: "#78716c",
2419
+ 7: "#57534e",
2420
+ 8: "#44403c",
2421
+ 9: "#292524",
2422
+ 10: "#1c1917",
2423
+ 11: "#0c0a09",
2424
+ 12: "#070605"
2425
+ },
2426
+ red: {
2427
+ 1: "#fef2f2",
2428
+ 2: "#fee2e2",
2429
+ 3: "#fecaca",
2430
+ 4: "#fca5a5",
2431
+ 5: "#f87171",
2432
+ 6: "#ef4444",
2433
+ 7: "#dc2626",
2434
+ 8: "#b91c1c",
2435
+ 9: "#991b1b",
2436
+ 10: "#7f1d1d",
2437
+ 11: "#450a0a",
2438
+ 12: "#280606"
2439
+ },
2440
+ orange: {
2441
+ 1: "#fff7ed",
2442
+ 2: "#ffedd5",
2443
+ 3: "#fed7aa",
2444
+ 4: "#fdba74",
2445
+ 5: "#fb923c",
2446
+ 6: "#f97316",
2447
+ 7: "#ea580c",
2448
+ 8: "#c2410c",
2449
+ 9: "#9a3412",
2450
+ 10: "#7c2d12",
2451
+ 11: "#431407",
2452
+ 12: "#270c04"
2453
+ },
2454
+ amber: {
2455
+ 1: "#fffbeb",
2456
+ 2: "#fef3c7",
2457
+ 3: "#fde68a",
2458
+ 4: "#fcd34d",
2459
+ 5: "#fbbf24",
2460
+ 6: "#f59e0b",
2461
+ 7: "#d97706",
2462
+ 8: "#b45309",
2463
+ 9: "#92400e",
2464
+ 10: "#78350f",
2465
+ 11: "#451a03",
2466
+ 12: "#291002"
2467
+ },
2468
+ yellow: {
2469
+ 1: "#fefce8",
2470
+ 2: "#fef9c3",
2471
+ 3: "#fef08a",
2472
+ 4: "#fde047",
2473
+ 5: "#facc15",
2474
+ 6: "#eab308",
2475
+ 7: "#ca8a04",
2476
+ 8: "#a16207",
2477
+ 9: "#854d0e",
2478
+ 10: "#713f12",
2479
+ 11: "#422006",
2480
+ 12: "#271304"
2481
+ },
2482
+ lime: {
2483
+ 1: "#f7fee7",
2484
+ 2: "#ecfccb",
2485
+ 3: "#d9f99d",
2486
+ 4: "#bef264",
2487
+ 5: "#a3e635",
2488
+ 6: "#84cc16",
2489
+ 7: "#65a30d",
2490
+ 8: "#4d7c0f",
2491
+ 9: "#3f6212",
2492
+ 10: "#365314",
2493
+ 11: "#1a2e05",
2494
+ 12: "#0f1b03"
2495
+ },
2496
+ green: {
2497
+ 1: "#f0fdf4",
2498
+ 2: "#dcfce7",
2499
+ 3: "#bbf7d0",
2500
+ 4: "#86efac",
2501
+ 5: "#4ade80",
2502
+ 6: "#22c55e",
2503
+ 7: "#16a34a",
2504
+ 8: "#15803d",
2505
+ 9: "#166534",
2506
+ 10: "#14532d",
2507
+ 11: "#052e16",
2508
+ 12: "#031b0d"
2509
+ },
2510
+ emerald: {
2511
+ 1: "#ecfdf5",
2512
+ 2: "#d1fae5",
2513
+ 3: "#a7f3d0",
2514
+ 4: "#6ee7b7",
2515
+ 5: "#34d399",
2516
+ 6: "#10b981",
2517
+ 7: "#059669",
2518
+ 8: "#047857",
2519
+ 9: "#065f46",
2520
+ 10: "#064e3b",
2521
+ 11: "#022c22",
2522
+ 12: "#011a14"
2523
+ },
2524
+ teal: {
2525
+ 1: "#f0fdfa",
2526
+ 2: "#ccfbf1",
2527
+ 3: "#99f6e4",
2528
+ 4: "#5eead4",
2529
+ 5: "#2dd4bf",
2530
+ 6: "#14b8a6",
2531
+ 7: "#0d9488",
2532
+ 8: "#0f766e",
2533
+ 9: "#115e59",
2534
+ 10: "#134e4a",
2535
+ 11: "#042f2e",
2536
+ 12: "#021c1b"
2537
+ },
2538
+ cyan: {
2539
+ 1: "#ecfeff",
2540
+ 2: "#cffafe",
2541
+ 3: "#a5f3fc",
2542
+ 4: "#67e8f9",
2543
+ 5: "#22d3ee",
2544
+ 6: "#06b6d4",
2545
+ 7: "#0891b2",
2546
+ 8: "#0e7490",
2547
+ 9: "#155e75",
2548
+ 10: "#164e63",
2549
+ 11: "#083344",
2550
+ 12: "#041e28"
2551
+ },
2552
+ sky: {
2553
+ 1: "#f0f9ff",
2554
+ 2: "#e0f2fe",
2555
+ 3: "#bae6fd",
2556
+ 4: "#7dd3fc",
2557
+ 5: "#38bdf8",
2558
+ 6: "#0ea5e9",
2559
+ 7: "#0284c7",
2560
+ 8: "#0369a1",
2561
+ 9: "#075985",
2562
+ 10: "#0c4a6e",
2563
+ 11: "#082f49",
2564
+ 12: "#041b2b"
2565
+ },
2566
+ blue: {
2567
+ 1: "#eff6ff",
2568
+ 2: "#dbeafe",
2569
+ 3: "#bfdbfe",
2570
+ 4: "#93c5fd",
2571
+ 5: "#60a5fa",
2572
+ 6: "#3b82f6",
2573
+ 7: "#2563eb",
2574
+ 8: "#1d4ed8",
2575
+ 9: "#1e40af",
2576
+ 10: "#1e3a8a",
2577
+ 11: "#172554",
2578
+ 12: "#0d1633"
2579
+ },
2580
+ indigo: {
2581
+ 1: "#eef2ff",
2582
+ 2: "#e0e7ff",
2583
+ 3: "#c7d2fe",
2584
+ 4: "#a5b4fc",
2585
+ 5: "#818cf8",
2586
+ 6: "#6366f1",
2587
+ 7: "#4f46e5",
2588
+ 8: "#4338ca",
2589
+ 9: "#3730a3",
2590
+ 10: "#312e81",
2591
+ 11: "#1e1b4b",
2592
+ 12: "#12102d"
2593
+ },
2594
+ violet: {
2595
+ 1: "#f5f3ff",
2596
+ 2: "#ede9fe",
2597
+ 3: "#ddd6fe",
2598
+ 4: "#c4b5fd",
2599
+ 5: "#a78bfa",
2600
+ 6: "#8b5cf6",
2601
+ 7: "#7c3aed",
2602
+ 8: "#6d28d9",
2603
+ 9: "#5b21b6",
2604
+ 10: "#4c1d95",
2605
+ 11: "#2e1065",
2606
+ 12: "#1c0a3d"
2607
+ },
2608
+ purple: {
2609
+ 1: "#faf5ff",
2610
+ 2: "#f3e8ff",
2611
+ 3: "#e9d5ff",
2612
+ 4: "#d8b4fe",
2613
+ 5: "#c084fc",
2614
+ 6: "#a855f7",
2615
+ 7: "#9333ea",
2616
+ 8: "#7e22ce",
2617
+ 9: "#6b21a8",
2618
+ 10: "#581c87",
2619
+ 11: "#3b0764",
2620
+ 12: "#23043c"
2621
+ },
2622
+ fuchsia: {
2623
+ 1: "#fdf4ff",
2624
+ 2: "#fae8ff",
2625
+ 3: "#f5d0fe",
2626
+ 4: "#f0abfc",
2627
+ 5: "#e879f9",
2628
+ 6: "#d946ef",
2629
+ 7: "#c026d3",
2630
+ 8: "#a21caf",
2631
+ 9: "#86198f",
2632
+ 10: "#701a75",
2633
+ 11: "#4a044e",
2634
+ 12: "#2d022f"
2635
+ },
2636
+ pink: {
2637
+ 1: "#fdf2f8",
2638
+ 2: "#fce7f3",
2639
+ 3: "#fbcfe8",
2640
+ 4: "#f9a8d4",
2641
+ 5: "#f472b6",
2642
+ 6: "#ec4899",
2643
+ 7: "#db2777",
2644
+ 8: "#be185d",
2645
+ 9: "#9d174d",
2646
+ 10: "#831843",
2647
+ 11: "#500724",
2648
+ 12: "#300415"
2649
+ },
2650
+ rose: {
2651
+ 1: "#fff1f2",
2652
+ 2: "#ffe4e6",
2653
+ 3: "#fecdd3",
2654
+ 4: "#fda4af",
2655
+ 5: "#fb7185",
2656
+ 6: "#f43f5e",
2657
+ 7: "#e11d48",
2658
+ 8: "#be123c",
2659
+ 9: "#9f1239",
2660
+ 10: "#881337",
2661
+ 11: "#4c0519",
2662
+ 12: "#2d030e"
2663
+ }
2664
+ };
2665
+ var defaultTheme = {
2666
+ colors: defaultColors,
2667
+ // 1 unit = 4px
2668
+ spacing: {
2669
+ px: 1,
2670
+ 0: 0,
2671
+ "0.5": 2,
2672
+ 1: 4,
2673
+ "1.5": 6,
2674
+ 2: 8,
2675
+ "2.5": 10,
2676
+ 3: 12,
2677
+ "3.5": 14,
2678
+ 4: 16,
2679
+ 5: 20,
2680
+ 6: 24,
2681
+ 7: 28,
2682
+ 8: 32,
2683
+ 9: 36,
2684
+ 10: 40,
2685
+ 11: 44,
2686
+ 12: 48,
2687
+ 14: 56,
2688
+ 16: 64,
2689
+ 20: 80,
2690
+ 24: 96,
2691
+ 28: 112,
2692
+ 32: 128,
2693
+ 36: 144,
2694
+ 40: 160,
2695
+ 44: 176,
2696
+ 48: 192,
2697
+ 52: 208,
2698
+ 56: 224,
2699
+ 60: 240,
2700
+ 64: 256,
2701
+ 72: 288,
2702
+ 80: 320,
2703
+ 96: 384,
2704
+ auto: "auto",
2705
+ full: "100%",
2706
+ "1/2": "50%",
2707
+ "1/3": "33.333333%",
2708
+ "2/3": "66.666667%",
2709
+ "1/4": "25%",
2710
+ "3/4": "75%",
2711
+ // Dynamic viewport unit — see the comment on the 'screen' standalone utilities
2712
+ // in utilities.ts for why dvh beats vh on mobile. Used by h-screen (w-screen
2713
+ // has its own standalone entry so it never reaches this spacing lookup).
2714
+ screen: "100dvh",
2715
+ min: "min-content",
2716
+ max: "max-content",
2717
+ fit: "fit-content"
2718
+ },
2719
+ fontSize: {
2720
+ xs: 12,
2721
+ sm: 14,
2722
+ base: 16,
2723
+ lg: 18,
2724
+ xl: 20,
2725
+ "2xl": 24,
2726
+ "3xl": 30,
2727
+ "4xl": 36,
2728
+ "5xl": 48,
2729
+ "6xl": 60,
2730
+ "7xl": 72,
2731
+ "8xl": 96,
2732
+ "9xl": 128
2733
+ },
2734
+ fontFamily: {
2735
+ sans: "System",
2736
+ mono: "Courier New",
2737
+ serif: "Georgia"
2738
+ },
2739
+ fontWeight: {
2740
+ thin: "100",
2741
+ extralight: "200",
2742
+ light: "300",
2743
+ normal: "400",
2744
+ medium: "500",
2745
+ semibold: "600",
2746
+ bold: "700",
2747
+ extrabold: "800",
2748
+ black: "900"
2749
+ },
2750
+ borderRadius: {
2751
+ none: 0,
2752
+ sm: 2,
2753
+ DEFAULT: 4,
2754
+ md: 6,
2755
+ lg: 8,
2756
+ xl: 12,
2757
+ "2xl": 16,
2758
+ "3xl": 24,
2759
+ full: 9999
2760
+ },
2761
+ borderWidth: {
2762
+ DEFAULT: 1,
2763
+ 0: 0,
2764
+ 2: 2,
2765
+ 4: 4,
2766
+ 8: 8
2767
+ },
2768
+ opacity: {
2769
+ 0: 0,
2770
+ 5: 0.05,
2771
+ 10: 0.1,
2772
+ 15: 0.15,
2773
+ 20: 0.2,
2774
+ 25: 0.25,
2775
+ 30: 0.3,
2776
+ 40: 0.4,
2777
+ 50: 0.5,
2778
+ 60: 0.6,
2779
+ 70: 0.7,
2780
+ 75: 0.75,
2781
+ 80: 0.8,
2782
+ 90: 0.9,
2783
+ 95: 0.95,
2784
+ 100: 1
2785
+ },
2786
+ lineHeight: {
2787
+ none: 1,
2788
+ tight: 1.25,
2789
+ snug: 1.375,
2790
+ normal: 1.5,
2791
+ relaxed: 1.625,
2792
+ loose: 2,
2793
+ // Pixel values stored as strings; styleValueToCSS passes them through, toNativeValue strips the unit
2794
+ 3: "12px",
2795
+ 4: "16px",
2796
+ 5: "20px",
2797
+ 6: "24px",
2798
+ 7: "28px",
2799
+ 8: "32px",
2800
+ 9: "36px",
2801
+ 10: "40px"
2802
+ },
2803
+ letterSpacing: {
2804
+ tighter: -0.8,
2805
+ tight: -0.4,
2806
+ normal: 0,
2807
+ wide: 0.4,
2808
+ wider: 0.8,
2809
+ widest: 1.6
2810
+ },
2811
+ zIndex: {
2812
+ auto: "auto",
2813
+ 0: 0,
2814
+ 10: 10,
2815
+ 20: 20,
2816
+ 30: 30,
2817
+ 40: 40,
2818
+ 50: 50
2819
+ },
2820
+ flex: {
2821
+ 1: 1,
2822
+ auto: "auto",
2823
+ // CSS: flex: auto = 1 1 auto; native: mapped to 1 in resolver
2824
+ initial: "initial",
2825
+ // CSS: flex: initial = 0 1 auto; native: mapped to 1
2826
+ none: "none"
2827
+ // CSS: flex: none = 0 0 auto; native: mapped to 0
2828
+ },
2829
+ shadow: {
2830
+ sm: {
2831
+ shadowColor: "#000",
2832
+ shadowOffset: { width: 0, height: 1 },
2833
+ shadowOpacity: 0.05,
2834
+ shadowRadius: 2,
2835
+ elevation: 1
2836
+ },
2837
+ DEFAULT: {
2838
+ shadowColor: "#000",
2839
+ shadowOffset: { width: 0, height: 2 },
2840
+ shadowOpacity: 0.1,
2841
+ shadowRadius: 4,
2842
+ elevation: 2
2843
+ },
2844
+ md: {
2845
+ shadowColor: "#000",
2846
+ shadowOffset: { width: 0, height: 4 },
2847
+ shadowOpacity: 0.1,
2848
+ shadowRadius: 8,
2849
+ elevation: 3
2850
+ },
2851
+ lg: {
2852
+ shadowColor: "#000",
2853
+ shadowOffset: { width: 0, height: 8 },
2854
+ shadowOpacity: 0.1,
2855
+ shadowRadius: 15,
2856
+ elevation: 4
2857
+ },
2858
+ xl: {
2859
+ shadowColor: "#000",
2860
+ shadowOffset: { width: 0, height: 16 },
2861
+ shadowOpacity: 0.1,
2862
+ shadowRadius: 24,
2863
+ elevation: 6
2864
+ },
2865
+ "2xl": {
2866
+ shadowColor: "#000",
2867
+ shadowOffset: { width: 0, height: 24 },
2868
+ shadowOpacity: 0.25,
2869
+ shadowRadius: 48,
2870
+ elevation: 8
2871
+ },
2872
+ none: {
2873
+ shadowColor: "transparent",
2874
+ shadowOffset: { width: 0, height: 0 },
2875
+ shadowOpacity: 0,
2876
+ shadowRadius: 0,
2877
+ elevation: 0
2878
+ }
2879
+ },
2880
+ screens: {
2881
+ sm: 576,
2882
+ // small tablets / large phones (landscape)
2883
+ md: 768,
2884
+ // tablets (iPad and up)
2885
+ lg: 1024,
2886
+ // large tablets (iPad Pro)
2887
+ xl: 1280,
2888
+ // desktop
2889
+ "2xl": 1536
2890
+ },
2891
+ // Empty by default — the 4 built-in presets (spin/ping/pulse/bounce) are handled
2892
+ // directly in the `animate` resolver, not through this theme table. This exists so
2893
+ // user-defined ones (kbach.config.js theme.extend.keyframes/animation) merge in
2894
+ // alongside them without needing to redeclare the built-ins.
2895
+ keyframes: {},
2896
+ animation: {}
2897
+ };
2898
+
2899
+ // src/core/generateTypesDts.ts
2900
+ var HEADER = `// AUTO-GENERATED by Kbach from your kbach.config.js \u2014 do not edit by hand.
2901
+ // Regenerated automatically every time your dev server / Metro picks up a
2902
+ // change to that file. Safe (and recommended) to add to .gitignore.
2903
+ //
2904
+ // Gives useColors()/useSpacing() full autocomplete and typo-catching for your
2905
+ // custom colors/spacing keys with zero manual setup \u2014 see KbachCustomColors'
2906
+ // doc comment in @kbach/ui if you'd rather hand-author this instead.
2907
+ import '@kbach/ui';
2908
+ `;
2909
+ var IDENT_RE = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/;
2910
+ function propKey(name) {
2911
+ return IDENT_RE.test(name) ? name : JSON.stringify(name);
2912
+ }
2913
+ function generateKbachTypesDts(theme) {
2914
+ const colorLines = [];
2915
+ for (const [name, value] of Object.entries(theme.colors)) {
2916
+ if (name in defaultColors) continue;
2917
+ const isFlat = typeof value === "string" || isModeAwareColor(value);
2918
+ colorLines.push(` ${propKey(name)}: ${isFlat ? "string" : "ColorScale"};`);
2919
+ }
2920
+ const spacingLines = [];
2921
+ for (const key of Object.keys(theme.spacing)) {
2922
+ if (key in defaultTheme.spacing) continue;
2923
+ spacingLines.push(` ${propKey(key)}: true;`);
2924
+ }
2925
+ if (colorLines.length === 0 && spacingLines.length === 0) return "";
2926
+ const body = [
2927
+ colorLines.length > 0 ? ` interface KbachCustomColors {
2928
+ ${colorLines.join("\n")}
2929
+ }` : null,
2930
+ spacingLines.length > 0 ? ` interface KbachCustomSpacing {
2931
+ ${spacingLines.join("\n")}
2932
+ }` : null
2933
+ ].filter((s) => s !== null).join("\n\n");
2934
+ return `${HEADER}
2935
+ declare module '@kbach/ui' {
2936
+ ${body}
2937
+ }
2938
+ `;
2939
+ }
2940
+
2941
+ // src/core/reset.ts
2942
+ var RESET_STYLE_ID = "kbach-reset";
2943
+ var BASE_RESET = [
2944
+ // border-style: solid means border-N utilities show a visible border without an extra border-solid class.
2945
+ // border-width: 0 keeps all elements borderless by default.
2946
+ "*, *::before, *::after { box-sizing: border-box; border-width: 0; border-style: solid; border-color: currentColor; }",
2947
+ "body { margin: 0; padding: 0; }",
2948
+ "h1, h2, h3, h4, h5, h6 { margin: 0; font-size: inherit; font-weight: inherit; }",
2949
+ "p { margin: 0; }",
2950
+ "a { color: inherit; text-decoration: none; }",
2951
+ "ul, ol { margin: 0; padding: 0; list-style: none; }",
2952
+ "img, video, svg { display: block; max-width: 100%; }",
2953
+ // appearance: none is deliberately NOT applied to checkbox/radio/select below —
2954
+ // stripping it hides their native checkmark/arrow with nothing rendered in its
2955
+ // place, leaving an invisible checkbox or an arrow-less <select> that looks like
2956
+ // plain text. Text-like inputs, textarea, and button don't have that problem
2957
+ // (their native chrome is just a skin around content utilities can fully
2958
+ // restyle), so they keep the blank-canvas treatment.
2959
+ // :where() wraps the :not() exclusions so they contribute ZERO specificity
2960
+ // (unlike a bare `input:not([type='checkbox']):not([type='radio'])`, whose
2961
+ // two :not([attr]) clauses each add a class-level specificity point — (0,2,1)
2962
+ // total, MORE than any single utility class (0,1,0)). Without :where(), this
2963
+ // reset's `color: inherit` always won the cascade over a text-* color
2964
+ // utility applied directly to a <input>/<textarea> regardless of source
2965
+ // order, since author rules only override on a tie or higher specificity —
2966
+ // confirmed on a real app: a TextInput's own text color utility resolved
2967
+ // and injected correctly, class and all, but silently never painted.
2968
+ "input:where(:not([type='checkbox']):not([type='radio'])), textarea { appearance: none; -webkit-appearance: none; background: transparent; padding: 0; margin: 0; font: inherit; color: inherit; line-height: inherit; }",
2969
+ // Native checkbox/radio/range still get typography + spacing normalized, and
2970
+ // accent-color re-themes their native indicator to the current text color
2971
+ // instead of the browser/OS default blue, so they stay on-brand without
2972
+ // needing to be rebuilt from scratch.
2973
+ "input[type='checkbox'], input[type='radio'], input[type='range'] { margin: 0; font: inherit; accent-color: currentColor; }",
2974
+ // select keeps its native chrome (border/background/arrow are all part of the
2975
+ // same OS-drawn widget that appearance: none would blank out) — only typography
2976
+ // and spacing are normalized so it still matches surrounding text.
2977
+ "select { margin: 0; font: inherit; color: inherit; line-height: inherit; }",
2978
+ "button { appearance: none; -webkit-appearance: none; background: transparent; padding: 0; margin: 0; font: inherit; color: inherit; cursor: pointer; line-height: inherit; text-align: inherit; }",
2979
+ "button, [role='button'] { cursor: pointer; }",
2980
+ ":disabled { cursor: default; }",
2981
+ "textarea { resize: vertical; }",
2982
+ // Firefox renders placeholders at ~54% opacity by default; every other browser uses 1 —
2983
+ // normalize to 1 so placeholder color is consistent and fully controlled by the placeholder: modifier.
2984
+ "::placeholder { opacity: 1; }",
2985
+ "input[type='number']::-webkit-inner-spin-button, input[type='number']::-webkit-outer-spin-button { margin: 0; }",
2986
+ "input[type='search']::-webkit-search-decoration, input[type='search']::-webkit-search-cancel-button { -webkit-appearance: none; }",
2987
+ "fieldset { padding: 0; margin: 0; }",
2988
+ "table { border-collapse: collapse; border-spacing: 0; }"
2989
+ ].join("\n");
2990
+
2991
+ // src/core/responsiveStore.ts
2992
+ var store = { width: 0, notifiedWidth: 0, screens: {}, listeners: /* @__PURE__ */ new Set() };
2993
+ function syncGlobalWidth(width) {
2994
+ store.width = width;
2995
+ }
2996
+ function syncGlobalScreens(screens) {
2997
+ store.screens = screens;
2998
+ }
2999
+ function getGlobalScreens() {
3000
+ return store.screens;
3001
+ }
3002
+ function setGlobalWidth(width) {
3003
+ store.width = width;
3004
+ if (store.notifiedWidth === width) return;
3005
+ store.notifiedWidth = width;
3006
+ for (const l of store.listeners) l();
3007
+ }
3008
+ function getGlobalWidth() {
3009
+ return store.width;
3010
+ }
3011
+ function subscribeGlobalWidth(listener) {
3012
+ store.listeners.add(listener);
3013
+ return () => store.listeners.delete(listener);
3014
+ }
3015
+ function getActiveBreakpoints(width, screens) {
3016
+ const w = width ?? store.width;
3017
+ const s = screens ?? store.screens;
3018
+ const active = /* @__PURE__ */ new Set();
3019
+ for (const [name, minW] of Object.entries(s)) {
3020
+ if (typeof minW === "number" && w >= minW) active.add(name);
3021
+ }
3022
+ return active;
3023
+ }
3024
+
3025
+ // src/core/resolver.ts
3026
+ var _themeCache = /* @__PURE__ */ new WeakMap();
3027
+ function getThemeCache(theme) {
3028
+ let cache = _themeCache.get(theme);
3029
+ if (!cache) {
3030
+ cache = new LRUCache(1e4);
3031
+ _themeCache.set(theme, cache);
3032
+ }
3033
+ return cache;
3034
+ }
3035
+ var _sortCache = /* @__PURE__ */ new WeakMap();
3036
+ function getSortedEntries(resolved) {
3037
+ let sorted = _sortCache.get(resolved);
3038
+ if (!sorted) {
3039
+ const entries = Object.entries(resolved);
3040
+ entries.sort((a, b) => {
3041
+ const pa = a[0] === "base" ? -1 : a[0].split(":").length;
3042
+ const pb = b[0] === "base" ? -1 : b[0].split(":").length;
3043
+ return pa - pb;
3044
+ });
3045
+ sorted = entries;
3046
+ _sortCache.set(resolved, sorted);
3047
+ }
3048
+ return sorted;
3049
+ }
3050
+ var _defaultFontFamily;
3051
+ function setDefaultFontFamily(font) {
3052
+ _defaultFontFamily = font;
3053
+ }
3054
+ function getDefaultFontFamily() {
3055
+ return _defaultFontFamily;
3056
+ }
3057
+ var _styleEl = null;
3058
+ var _ruleIndexByKey = /* @__PURE__ */ new Map();
3059
+ var _sheetKeys = [];
3060
+ var _ruleOrderByKey = /* @__PURE__ */ new Map();
3061
+ function findInsertionIndex(order) {
3062
+ let lo = 0, hi = _sheetKeys.length;
3063
+ while (lo < hi) {
3064
+ const mid = lo + hi >>> 1;
3065
+ if (_ruleOrderByKey.get(_sheetKeys[mid]) > order) hi = mid;
3066
+ else lo = mid + 1;
3067
+ }
3068
+ return lo;
3069
+ }
3070
+ function evictInjectedRule(rule) {
3071
+ const idx = _ruleIndexByKey.get(rule);
3072
+ _ruleIndexByKey.delete(rule);
3073
+ _ruleOrderByKey.delete(rule);
3074
+ if (idx === void 0) return;
3075
+ const sheet = _styleEl?.sheet;
3076
+ if (!sheet) return;
3077
+ try {
3078
+ sheet.deleteRule(idx);
3079
+ } catch {
3080
+ return;
3081
+ }
3082
+ _sheetKeys.splice(idx, 1);
3083
+ for (const [key, i] of _ruleIndexByKey) {
3084
+ if (i > idx) _ruleIndexByKey.set(key, i - 1);
3085
+ }
3086
+ }
3087
+ var _injectedRules = new LRUCache(5e4, evictInjectedRule);
3088
+ var _runtimeCSSDisabled = false;
3089
+ function disableRuntimeCSS() {
3090
+ _runtimeCSSDisabled = true;
3091
+ }
3092
+ function isRuntimeCSSDisabled() {
3093
+ return _runtimeCSSDisabled;
3094
+ }
3095
+ function getStyleEl() {
3096
+ if (_styleEl) return _styleEl;
3097
+ _styleEl = document.createElement("style");
3098
+ _styleEl.setAttribute("data-kbach", "");
3099
+ document.head.appendChild(_styleEl);
3100
+ return _styleEl;
3101
+ }
3102
+ function injectRule(rule, order) {
3103
+ if (isRuntimeCSSDisabled()) return;
3104
+ if (_injectedRules.get(rule)) return;
3105
+ try {
3106
+ const sheet = getStyleEl().sheet;
3107
+ if (sheet) {
3108
+ const idx = findInsertionIndex(order);
3109
+ sheet.insertRule(rule, idx);
3110
+ _sheetKeys.splice(idx, 0, rule);
3111
+ for (const [key, i] of _ruleIndexByKey) {
3112
+ if (i >= idx) _ruleIndexByKey.set(key, i + 1);
3113
+ }
3114
+ _ruleIndexByKey.set(rule, idx);
3115
+ _ruleOrderByKey.set(rule, order);
3116
+ _injectedRules.set(rule, true);
3117
+ }
3118
+ } catch {
3119
+ }
3120
+ }
3121
+ var _globalStyleEl = null;
3122
+ function getGlobalStyleEl() {
3123
+ if (_globalStyleEl) return _globalStyleEl;
3124
+ _globalStyleEl = document.createElement("style");
3125
+ _globalStyleEl.setAttribute("data-kbach-global", "");
3126
+ document.head.insertBefore(_globalStyleEl, getStyleEl());
3127
+ return _globalStyleEl;
3128
+ }
3129
+ function injectGlobalStyles(theme) {
3130
+ if (typeof document === "undefined" || isRuntimeCSSDisabled()) return;
3131
+ const rules = document.getElementById(RESET_STYLE_ID) ? [] : [BASE_RESET];
3132
+ const ff = theme.fontFamily;
3133
+ if (ff?.sans && ff.sans !== "System") {
3134
+ const family = Array.isArray(ff.sans) ? ff.sans.join(", ") : ff.sans;
3135
+ rules.push(`body { font-family: ${family}; }`);
3136
+ }
3137
+ getGlobalStyleEl().textContent = rules.join("\n");
3138
+ }
3139
+ function buildDivideDecls(styles, forceImportant) {
3140
+ const imp = forceImportant ? " !important" : "";
3141
+ const parts = [];
3142
+ if ("__divideX" in styles) {
3143
+ const w = Number(styles.__divideX);
3144
+ parts.push(`border-left-width: ${w}px${imp}`, `border-right-width: 0px${imp}`);
3145
+ }
3146
+ if ("__divideY" in styles) {
3147
+ const w = Number(styles.__divideY);
3148
+ parts.push(`border-top-width: ${w}px${imp}`, `border-bottom-width: 0px${imp}`);
3149
+ }
3150
+ if ("__divideColor" in styles) parts.push(`border-color: ${String(styles.__divideColor)}${imp}`);
3151
+ if ("__divideStyle" in styles) parts.push(`border-style: ${String(styles.__divideStyle)}${imp}`);
3152
+ return parts.join("; ");
3153
+ }
3154
+ function buildSpaceDecls(styles, forceImportant) {
3155
+ const imp = forceImportant ? " !important" : "";
3156
+ const parts = [];
3157
+ if ("__spaceX" in styles) {
3158
+ const v = styles.__spaceX;
3159
+ const val = typeof v === "number" ? `${v}px` : String(v);
3160
+ parts.push(`margin-left: ${val}${imp}`);
3161
+ }
3162
+ if ("__spaceY" in styles) {
3163
+ const v = styles.__spaceY;
3164
+ const val = typeof v === "number" ? `${v}px` : String(v);
3165
+ parts.push(`margin-top: ${val}${imp}`);
3166
+ }
3167
+ return parts.join("; ");
3168
+ }
3169
+ var RN_ONLY_PROPS = /* @__PURE__ */ new Set([
3170
+ "shadowColor",
3171
+ "shadowOffset",
3172
+ "shadowOpacity",
3173
+ "shadowRadius",
3174
+ "elevation",
3175
+ "includeFontPadding",
3176
+ "textAlignVertical",
3177
+ "writingDirection",
3178
+ "textShadowColor",
3179
+ "textShadowOffset",
3180
+ "textShadowRadius",
3181
+ "tintColor",
3182
+ "__divideX",
3183
+ "__divideY",
3184
+ "__divideColor",
3185
+ "__divideStyle",
3186
+ "__keyframe",
3187
+ "__spaceX",
3188
+ "__spaceY"
3189
+ ]);
3190
+ var CSS_UNITLESS = /* @__PURE__ */ new Set([
3191
+ "opacity",
3192
+ "fontWeight",
3193
+ "flex",
3194
+ "flexGrow",
3195
+ "flexShrink",
3196
+ "order",
3197
+ "zIndex",
3198
+ "aspectRatio",
3199
+ "columnCount",
3200
+ "lineHeight",
3201
+ "gridColumnStart",
3202
+ "gridColumnEnd",
3203
+ "gridRowStart",
3204
+ "gridRowEnd"
3205
+ ]);
3206
+ var TEXT_ONLY_STYLE_KEYS = [
3207
+ "color",
3208
+ "fontSize",
3209
+ "fontWeight",
3210
+ "fontStyle",
3211
+ "fontVariant",
3212
+ "letterSpacing",
3213
+ "lineHeight",
3214
+ "textAlign",
3215
+ "textAlignVertical",
3216
+ "textDecorationLine",
3217
+ "textDecorationColor",
3218
+ "textDecorationStyle",
3219
+ "textShadowColor",
3220
+ "textShadowOffset",
3221
+ "textShadowRadius",
3222
+ "textTransform",
3223
+ "writingDirection",
3224
+ "includeFontPadding",
3225
+ "verticalAlign"
3226
+ ];
3227
+ var RN_SHORTHAND_EXPAND = {
3228
+ marginHorizontal: ["margin-left", "margin-right"],
3229
+ marginVertical: ["margin-top", "margin-bottom"],
3230
+ paddingHorizontal: ["padding-left", "padding-right"],
3231
+ paddingVertical: ["padding-top", "padding-bottom"]
3232
+ };
3233
+ function styleValueToCSS(styles, forceImportant = false) {
3234
+ const parts = [];
3235
+ for (const [prop, val] of Object.entries(styles)) {
3236
+ if (val === void 0 || val === null || typeof val === "object" || RN_ONLY_PROPS.has(prop)) continue;
3237
+ let cssVal;
3238
+ if (typeof val === "number") {
3239
+ const isCustomProp = prop.startsWith("--");
3240
+ cssVal = val === 0 || isCustomProp || CSS_UNITLESS.has(prop) ? String(val) : `${val}px`;
3241
+ } else {
3242
+ cssVal = String(val);
3243
+ }
3244
+ const imp = forceImportant || prop === "display" && (cssVal === "grid" || cssVal === "inline-grid") || prop === "position" && (cssVal === "sticky" || cssVal === "fixed" || cssVal === "static") ? " !important" : "";
3245
+ if (prop in RN_SHORTHAND_EXPAND) {
3246
+ const [p1, p2] = RN_SHORTHAND_EXPAND[prop];
3247
+ parts.push(`${p1}: ${cssVal}${imp}`, `${p2}: ${cssVal}${imp}`);
3248
+ continue;
3249
+ }
3250
+ parts.push(`${camelToKebab(prop)}: ${cssVal}${imp}`);
3251
+ }
3252
+ return parts.join("; ");
3253
+ }
3254
+ function camelToKebab(str) {
3255
+ return str.replace(/([A-Z])/g, "-$1").toLowerCase();
3256
+ }
3257
+ function buildClassCSSRules(cls, bucketKey, styles, darkMode, important, screens) {
3258
+ const rules = [];
3259
+ if ("__keyframe" in styles && typeof styles.__keyframe === "string") {
3260
+ rules.push(styles.__keyframe);
3261
+ }
3262
+ const isDivide = "__divideX" in styles || "__divideY" in styles || "__divideColor" in styles || "__divideStyle" in styles;
3263
+ const isSpace = "__spaceX" in styles || "__spaceY" in styles;
3264
+ const isChildCombinator = isDivide || isSpace;
3265
+ const escaped = escapeCSSSelector(cls);
3266
+ const childSuffix = isChildCombinator ? " > * + *" : "";
3267
+ if (bucketKey === "base") {
3268
+ const decls2 = isDivide ? buildDivideDecls(styles, important) : isSpace ? buildSpaceDecls(styles, important) : styleValueToCSS(styles, important);
3269
+ if (!decls2) return rules;
3270
+ rules.push(`.${escaped}${childSuffix} { ${decls2} }`);
3271
+ return rules;
3272
+ }
3273
+ const mods = bucketKey.split(":");
3274
+ let darkScheme;
3275
+ let needsImportant = important;
3276
+ const pseudoParts = [];
3277
+ const ancestorParts = [];
3278
+ const dirParts = [];
3279
+ const mediaWrappers = [];
3280
+ let minWidth = 0;
3281
+ for (const mod of mods) {
3282
+ const def = getModifier(mod);
3283
+ if (!def) continue;
3284
+ if (def.darkScheme) darkScheme = def.darkScheme;
3285
+ if (def.pseudo) pseudoParts.push(def.pseudo);
3286
+ if (def.ancestorSelector) {
3287
+ ancestorParts.push(def.ancestorSelector);
3288
+ needsImportant = true;
3289
+ }
3290
+ if (def.dirSelector) {
3291
+ dirParts.push(def.dirSelector);
3292
+ needsImportant = true;
3293
+ }
3294
+ if (def.mediaQuery) {
3295
+ mediaWrappers.push(`@media ${def.mediaQuery}`);
3296
+ needsImportant = true;
3297
+ }
3298
+ if (def.isResponsive) {
3299
+ const w = screens[mod] ?? 0;
3300
+ if (w > minWidth) minWidth = w;
3301
+ }
3302
+ if (def.forcesImportant) needsImportant = true;
3303
+ }
3304
+ const pseudoSuffix = pseudoParts.join("");
3305
+ const elementSelector = `.${escaped}${pseudoSuffix}${childSuffix}`;
3306
+ const ancestorPrefix = ancestorParts.join("");
3307
+ const dirPrefix = dirParts.join("");
3308
+ const selector = `${dirPrefix}${ancestorPrefix}${elementSelector}`;
3309
+ const decls = isDivide ? buildDivideDecls(styles, needsImportant) : isSpace ? buildSpaceDecls(styles, needsImportant) : styleValueToCSS(styles, needsImportant);
3310
+ if (!decls) return rules;
3311
+ let rule;
3312
+ if (darkScheme === "dark") {
3313
+ if (darkMode === "media") rule = `@media (prefers-color-scheme: dark) { ${selector} { ${decls} } }`;
3314
+ else if (darkMode === "class") rule = `.dark ${selector} { ${decls} }`;
3315
+ else rule = `[data-theme="dark"] ${selector} { ${decls} }`;
3316
+ } else if (darkScheme === "light") {
3317
+ if (darkMode === "media") rule = `@media (prefers-color-scheme: light) { ${selector} { ${decls} } }`;
3318
+ else if (darkMode === "class") rule = `.light ${selector} { ${decls} }`;
3319
+ else rule = `[data-theme="light"] ${selector} { ${decls} }`;
3320
+ } else {
3321
+ rule = `${selector} { ${decls} }`;
3322
+ }
3323
+ for (const mw of mediaWrappers) rule = `${mw} { ${rule} }`;
3324
+ if (minWidth > 0) rule = `@media (min-width: ${minWidth}px) { ${rule} }`;
3325
+ rules.push(rule);
3326
+ return rules;
3327
+ }
3328
+ function injectClassRule(cls, bucketKey, styles, darkMode, important, order) {
3329
+ const cssRules = buildClassCSSRules(cls, bucketKey, styles, darkMode, important, getGlobalScreens());
3330
+ for (const r of cssRules) injectRule(r, order);
3331
+ return cssRules;
3332
+ }
3333
+ function generateClassCSS(classString, theme, darkMode = "attribute", screens = {}) {
3334
+ const rules = [];
3335
+ for (const parsed of parseClasses(expandModeAwareColorClasses(classString, theme.colors))) {
3336
+ const styles = resolveUtility(parsed, theme);
3337
+ if (!styles) continue;
3338
+ const bucketKey = parsed.modifiers.length === 0 ? "base" : parsed.modifiers.join(":");
3339
+ rules.push(...buildClassCSSRules(parsed.original, bucketKey, styles, darkMode, parsed.important, screens));
3340
+ }
3341
+ return rules.join("\n");
3342
+ }
3343
+ function isPureDisplayStyle(styles) {
3344
+ const keys = Object.keys(styles);
3345
+ return keys.length === 1 && keys[0] === "display";
3346
+ }
3347
+ function resolve(classString, theme, darkMode = "attribute") {
3348
+ const cache = getThemeCache(theme);
3349
+ const cacheKey = `${classString}::${darkMode}::${getEffectiveIsWeb() ? "web" : "native"}`;
3350
+ const cached = cache.get(cacheKey);
3351
+ if (cached) {
3352
+ if (isWeb) {
3353
+ for (const { rule, order } of cached.rules) injectRule(rule, order);
3354
+ }
3355
+ return cached.result;
3356
+ }
3357
+ const result = {};
3358
+ const rules = [];
3359
+ const onWeb = isWeb;
3360
+ for (const parsed of parseClasses(expandModeAwareColorClasses(classString, theme.colors))) {
3361
+ const styles = resolveUtility(parsed, theme);
3362
+ if (!styles) {
3363
+ if (process.env.NODE_ENV !== "production" && !parsed.isArbitrary && !isKnownUtility(parsed.utility) && !parsed.original.startsWith("__")) {
3364
+ kbachWarn(`Unknown class "${parsed.original}"`);
3365
+ }
3366
+ continue;
3367
+ }
3368
+ const bucketKey = parsed.modifiers.length === 0 ? "base" : parsed.modifiers.join(":");
3369
+ if (!result[bucketKey]) result[bucketKey] = {};
3370
+ Object.assign(result[bucketKey], styles);
3371
+ if (onWeb) {
3372
+ const order = getModifierOrder(bucketKey) + (isPureDisplayStyle(styles) ? 0.5 : 0);
3373
+ for (const r of injectClassRule(parsed.original, bucketKey, styles, darkMode, parsed.important, order)) {
3374
+ rules.push({ rule: r, order });
3375
+ }
3376
+ }
3377
+ }
3378
+ cache.set(cacheKey, { result, rules });
3379
+ return result;
3380
+ }
3381
+ function flatten(resolved, isDark, state = {}, breakpoints = /* @__PURE__ */ new Set()) {
3382
+ const result = {};
3383
+ for (const [key, styles] of getSortedEntries(resolved)) {
3384
+ if (!styles) continue;
3385
+ if (key === "base") {
3386
+ Object.assign(result, styles);
3387
+ continue;
3388
+ }
3389
+ const mods = key.split(":");
3390
+ if (mods.every((mod) => matchModifier(mod, isDark, state, breakpoints))) {
3391
+ Object.assign(result, styles);
3392
+ }
3393
+ }
3394
+ if (isNative) {
3395
+ const defaultFont = getDefaultFontFamily();
3396
+ const r = result;
3397
+ const looksLikeText = TEXT_ONLY_STYLE_KEYS.some((k) => k in r);
3398
+ if (defaultFont && looksLikeText && !("fontFamily" in r)) {
3399
+ r.fontFamily = defaultFont;
3400
+ }
3401
+ }
3402
+ if (!isNative) {
3403
+ const r = result;
3404
+ const ph = r.paddingHorizontal;
3405
+ if (ph !== void 0) {
3406
+ r.paddingLeft = ph;
3407
+ r.paddingRight = ph;
3408
+ delete r.paddingHorizontal;
3409
+ }
3410
+ const pv = r.paddingVertical;
3411
+ if (pv !== void 0) {
3412
+ r.paddingTop = pv;
3413
+ r.paddingBottom = pv;
3414
+ delete r.paddingVertical;
3415
+ }
3416
+ const mh = r.marginHorizontal;
3417
+ if (mh !== void 0) {
3418
+ r.marginLeft = mh;
3419
+ r.marginRight = mh;
3420
+ delete r.marginHorizontal;
3421
+ }
3422
+ const mv = r.marginVertical;
3423
+ if (mv !== void 0) {
3424
+ r.marginTop = mv;
3425
+ r.marginBottom = mv;
3426
+ delete r.marginVertical;
3427
+ }
3428
+ }
3429
+ return result;
3430
+ }
3431
+ function clearCache() {
3432
+ _injectedRules.clear();
3433
+ _ruleIndexByKey.clear();
3434
+ _ruleOrderByKey.clear();
3435
+ _sheetKeys.length = 0;
3436
+ if (_styleEl) {
3437
+ _styleEl.remove();
3438
+ _styleEl = null;
3439
+ }
3440
+ if (_globalStyleEl) {
3441
+ _globalStyleEl.remove();
3442
+ _globalStyleEl = null;
3443
+ }
3444
+ }
3445
+
3446
+ // src/core/config.ts
3447
+ function deepMerge(base, override) {
3448
+ const result = { ...base };
3449
+ for (const key of Object.keys(override)) {
3450
+ const baseVal = base[key];
3451
+ const overVal = override[key];
3452
+ if (baseVal !== null && typeof baseVal === "object" && !Array.isArray(baseVal) && overVal !== null && typeof overVal === "object" && !Array.isArray(overVal)) {
3453
+ result[key] = deepMerge(
3454
+ baseVal,
3455
+ overVal
3456
+ );
3457
+ } else if (overVal !== void 0) {
3458
+ result[key] = overVal;
3459
+ }
3460
+ }
3461
+ return result;
3462
+ }
3463
+ var configStore = { resolved: null, listeners: /* @__PURE__ */ new Set() };
3464
+ function getConfig() {
3465
+ if (configStore.resolved) return configStore.resolved;
3466
+ configStore.resolved = buildConfig({});
3467
+ return configStore.resolved;
3468
+ }
3469
+ function resetConfig() {
3470
+ configStore.resolved = null;
3471
+ }
3472
+ function resolveColorRefs(colors) {
3473
+ const MAX_DEPTH = 5;
3474
+ function resolveChain(raw, side) {
3475
+ let current = raw;
3476
+ for (let i = 0; i < MAX_DEPTH; i++) {
3477
+ const next = resolveOneRef(current, side);
3478
+ if (!next || next === current) break;
3479
+ current = next;
3480
+ }
3481
+ return current;
3482
+ }
3483
+ function resolveOneRef(ref, side) {
3484
+ const slashIdx = ref.indexOf("/");
3485
+ if (slashIdx > 0) {
3486
+ const baseName = ref.slice(0, slashIdx);
3487
+ const opacity = Number(ref.slice(slashIdx + 1));
3488
+ if (!Number.isFinite(opacity)) return null;
3489
+ let baseRef;
3490
+ const entry2 = colors[baseName];
3491
+ if (typeof entry2 === "string") {
3492
+ baseRef = entry2;
3493
+ } else if (isModeAwareColor(entry2)) {
3494
+ if (!side) return null;
3495
+ baseRef = entry2[side];
3496
+ } else if (entry2 && typeof entry2 === "object" && "6" in entry2) {
3497
+ const v = entry2["6"];
3498
+ baseRef = typeof v === "string" ? v : void 0;
3499
+ }
3500
+ if (baseRef === void 0) return null;
3501
+ const baseHex = resolveChain(baseRef, side);
3502
+ const a = opacity > 1 ? opacity / 100 : opacity;
3503
+ return hexToRgba(baseHex, a);
3504
+ }
3505
+ const split = splitColorShadeRef(ref);
3506
+ if (!split) return null;
3507
+ const { name, shade } = split;
3508
+ if (!/^\d+$/.test(shade)) return null;
3509
+ const entry = colors[name];
3510
+ if (!entry || typeof entry !== "object" || isModeAwareColor(entry)) return null;
3511
+ const target = entry[shade];
3512
+ return typeof target === "string" ? target : null;
3513
+ }
3514
+ function resolveValue(val) {
3515
+ return typeof val === "string" ? resolveChain(val, null) : { light: resolveChain(val.light, "light"), dark: resolveChain(val.dark, "dark") };
3516
+ }
3517
+ const out = {};
3518
+ for (const [key, val] of Object.entries(colors)) {
3519
+ if (typeof val === "string" || isModeAwareColor(val)) {
3520
+ out[key] = resolveValue(val);
3521
+ } else {
3522
+ const shades = {};
3523
+ for (const [shade, v] of Object.entries(val)) {
3524
+ shades[shade] = resolveValue(v);
3525
+ }
3526
+ out[key] = shades;
3527
+ }
3528
+ }
3529
+ return out;
3530
+ }
3531
+ function buildConfig(userConfig) {
3532
+ let theme = { ...defaultTheme };
3533
+ if (userConfig.theme) {
3534
+ theme = { ...theme, ...userConfig.theme };
3535
+ }
3536
+ if (userConfig.extend) {
3537
+ const extendConfig = userConfig.extend;
3538
+ const { theme: nestedTheme, ...directKeys } = extendConfig;
3539
+ const extSources = [];
3540
+ if (nestedTheme) extSources.push(nestedTheme);
3541
+ if (Object.keys(directKeys).length) extSources.push(directKeys);
3542
+ for (const ext of extSources) {
3543
+ for (const [key, value] of Object.entries(ext)) {
3544
+ if (typeof value !== "object" || value === null || Array.isArray(value)) {
3545
+ if (process.env.NODE_ENV !== "production") {
3546
+ kbachWarn(`extend.${key} should be an object, got ${typeof value} \u2014 skipped`);
3547
+ }
3548
+ continue;
3549
+ }
3550
+ if (value !== null && typeof value === "object" && !Array.isArray(value)) {
3551
+ theme[key] = deepMerge(
3552
+ theme[key] ?? {},
3553
+ value
3554
+ );
3555
+ }
3556
+ }
3557
+ }
3558
+ }
3559
+ theme = { ...theme, colors: resolveColorRefs(theme.colors) };
3560
+ const resolved = {
3561
+ darkMode: userConfig.darkMode ?? "attribute",
3562
+ theme,
3563
+ plugins: userConfig.plugins ?? []
3564
+ };
3565
+ if (userConfig.plugins !== void 0) {
3566
+ clearPluginUtilities();
3567
+ clearPluginModifiers();
3568
+ }
3569
+ const pluginAPI = makePluginAPI(resolved.theme);
3570
+ for (const plugin of resolved.plugins) {
3571
+ plugin(pluginAPI);
3572
+ }
3573
+ const rawSans = theme.fontFamily?.sans;
3574
+ const sansFontValue = Array.isArray(rawSans) ? rawSans[0] : rawSans;
3575
+ const nativeSansFont = sansFontValue?.split(",")[0]?.trim().replace(/^['"]|['"]$/g, "");
3576
+ setDefaultFontFamily(nativeSansFont && nativeSansFont !== "System" ? nativeSansFont : void 0);
3577
+ injectGlobalStyles(resolved.theme);
3578
+ return resolved;
3579
+ }
3580
+ function _selectorToModifierDef(selector) {
3581
+ const s = selector.trim();
3582
+ if (s.startsWith("@media ")) {
3583
+ return { mediaQuery: s.slice(7), jsBehavior: "css-only", forcesImportant: true };
3584
+ }
3585
+ if (s.startsWith("::") || s.startsWith(":") && !s.includes(" ") && !s.includes("&") && !s.includes("(")) {
3586
+ return { pseudo: s, jsBehavior: "css-only", forcesImportant: true };
3587
+ }
3588
+ return { ancestorSelector: s.endsWith(" ") ? s : `${s} `, jsBehavior: "css-only", forcesImportant: true };
3589
+ }
3590
+ function makePluginAPI(theme) {
3591
+ const standalone = getPluginStandaloneMap();
3592
+ return {
3593
+ addUtility(name, styles) {
3594
+ standalone[name] = styles;
3595
+ },
3596
+ addVariant(name, selectorOrDef) {
3597
+ const def = typeof selectorOrDef === "string" ? _selectorToModifierDef(selectorOrDef) : selectorOrDef;
3598
+ registerModifier(name, def);
3599
+ },
3600
+ theme(path, defaultValue) {
3601
+ const parts = path.replace(/\[([^\]]+)\]/g, ".$1").split(".");
3602
+ let current = theme;
3603
+ for (const part of parts) {
3604
+ if (current === null || typeof current !== "object") return defaultValue;
3605
+ current = current[part];
3606
+ }
3607
+ return current ?? defaultValue;
3608
+ },
3609
+ e(className) {
3610
+ return className.replace(/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g, "\\$&");
3611
+ }
3612
+ };
3613
+ }
3614
+ function onConfigChange(listener) {
3615
+ configStore.listeners.add(listener);
3616
+ return () => configStore.listeners.delete(listener);
3617
+ }
3618
+ function updateConfig(userConfig) {
3619
+ clearCache();
3620
+ configStore.resolved = buildConfig(userConfig);
3621
+ configStore._src = userConfig;
3622
+ for (const listener of configStore.listeners) {
3623
+ listener(configStore.resolved);
3624
+ }
3625
+ }
3626
+ function initConfig(userConfig) {
3627
+ if (configStore._src === userConfig) return;
3628
+ updateConfig(userConfig);
3629
+ }
3630
+
3631
+ // src/core/darkModeStore.ts
3632
+ var store2 = { isDark: false, notifiedIsDark: false, subscribers: /* @__PURE__ */ new Set() };
3633
+ function syncGlobalDarkMode(isDark) {
3634
+ store2.isDark = isDark;
3635
+ }
3636
+ function setGlobalDarkMode(isDark) {
3637
+ store2.isDark = isDark;
3638
+ if (store2.notifiedIsDark === isDark) return;
3639
+ store2.notifiedIsDark = isDark;
3640
+ for (const sub of store2.subscribers) sub();
3641
+ }
3642
+ function getGlobalDarkMode() {
3643
+ return store2.isDark;
3644
+ }
3645
+ function subscribeGlobalDarkMode(callback) {
3646
+ store2.subscribers.add(callback);
3647
+ return () => store2.subscribers.delete(callback);
3648
+ }
3649
+ // Annotate the CommonJS export names for ESM import in node:
3650
+ 0 && (module.exports = {
3651
+ BASE_RESET,
3652
+ LRUCache,
3653
+ RESET_STYLE_ID,
3654
+ buildConfig,
3655
+ clearCache,
3656
+ clearPluginModifiers,
3657
+ defaultColors,
3658
+ defaultTheme,
3659
+ disableRuntimeCSS,
3660
+ escapeCSSSelector,
3661
+ expandModeAwareColorClasses,
3662
+ flatten,
3663
+ generateClassCSS,
3664
+ generateKbachTypesDts,
3665
+ getActiveBreakpoints,
3666
+ getAllModifierNames,
3667
+ getBuiltinStandaloneNames,
3668
+ getBuiltinUtilityPrefixes,
3669
+ getConfig,
3670
+ getDefaultFontFamily,
3671
+ getEffectiveIsWeb,
3672
+ getGlobalDarkMode,
3673
+ getGlobalScreens,
3674
+ getGlobalWidth,
3675
+ getInteractiveModifiers,
3676
+ getModeModifiers,
3677
+ getModifier,
3678
+ getResponsiveModifiers,
3679
+ initConfig,
3680
+ isKnownModifier,
3681
+ isKnownUtility,
3682
+ isModeAwareColor,
3683
+ isNative,
3684
+ isRuntimeCSSDisabled,
3685
+ isWeb,
3686
+ kbachWarn,
3687
+ matchModifier,
3688
+ normalizeClassString,
3689
+ onConfigChange,
3690
+ parseClass,
3691
+ parseClasses,
3692
+ parseHexRgb,
3693
+ registerModifier,
3694
+ resetConfig,
3695
+ resolve,
3696
+ resolveColor,
3697
+ resolveSizing,
3698
+ resolveSpacing,
3699
+ resolveUtility,
3700
+ setDefaultFontFamily,
3701
+ setGlobalDarkMode,
3702
+ setGlobalWidth,
3703
+ setResolveTarget,
3704
+ splitClassTokens,
3705
+ subscribeGlobalDarkMode,
3706
+ subscribeGlobalWidth,
3707
+ syncGlobalDarkMode,
3708
+ syncGlobalScreens,
3709
+ syncGlobalWidth,
3710
+ toNativeValue,
3711
+ updateConfig
3712
+ });