tailwind-styled-v4 5.0.11 → 5.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/dist/{analyzeWorkspace-DDOQdzzI.d.ts → analyzeWorkspace-CopJNGmi.d.ts} +2 -0
  2. package/dist/{analyzeWorkspace-BS5O4rhC.d.mts → analyzeWorkspace-DpVPccjz.d.mts} +2 -0
  3. package/dist/analyzer.d.mts +4 -4
  4. package/dist/analyzer.d.ts +4 -4
  5. package/dist/analyzer.js +34 -69
  6. package/dist/analyzer.js.map +1 -1
  7. package/dist/analyzer.mjs +33 -68
  8. package/dist/analyzer.mjs.map +1 -1
  9. package/dist/animate.js +11 -11
  10. package/dist/animate.js.map +1 -1
  11. package/dist/animate.mjs +11 -11
  12. package/dist/animate.mjs.map +1 -1
  13. package/dist/atomic.js +16 -7
  14. package/dist/atomic.js.map +1 -1
  15. package/dist/atomic.mjs +16 -7
  16. package/dist/atomic.mjs.map +1 -1
  17. package/dist/cli.js +262 -190
  18. package/dist/cli.js.map +1 -1
  19. package/dist/cli.mjs +259 -187
  20. package/dist/cli.mjs.map +1 -1
  21. package/dist/compiler.d.mts +2543 -109
  22. package/dist/compiler.d.ts +2543 -109
  23. package/dist/compiler.js +1962 -435
  24. package/dist/compiler.js.map +1 -1
  25. package/dist/compiler.mjs +1816 -382
  26. package/dist/compiler.mjs.map +1 -1
  27. package/dist/devtools.js +17 -4
  28. package/dist/devtools.js.map +1 -1
  29. package/dist/devtools.mjs +17 -4
  30. package/dist/devtools.mjs.map +1 -1
  31. package/dist/engine.d.mts +11 -470
  32. package/dist/engine.d.ts +11 -470
  33. package/dist/engine.js +1442 -417
  34. package/dist/engine.js.map +1 -1
  35. package/dist/engine.mjs +1442 -417
  36. package/dist/engine.mjs.map +1 -1
  37. package/dist/index-BDQw13kn.d.ts +464 -0
  38. package/dist/index-DJv28Uzq.d.mts +464 -0
  39. package/dist/index.browser.mjs +143 -255
  40. package/dist/index.browser.mjs.map +1 -1
  41. package/dist/index.d.mts +23 -39
  42. package/dist/index.d.ts +23 -39
  43. package/dist/index.js +6000 -1463
  44. package/dist/index.js.map +1 -1
  45. package/dist/index.mjs +5995 -1458
  46. package/dist/index.mjs.map +1 -1
  47. package/dist/next.d.mts +44 -1
  48. package/dist/next.d.ts +44 -1
  49. package/dist/next.js +3197 -1128
  50. package/dist/next.js.map +1 -1
  51. package/dist/next.mjs +3196 -1129
  52. package/dist/next.mjs.map +1 -1
  53. package/dist/rspack.d.mts +9 -0
  54. package/dist/rspack.d.ts +9 -0
  55. package/dist/rspack.js +99 -61
  56. package/dist/rspack.js.map +1 -1
  57. package/dist/rspack.mjs +99 -61
  58. package/dist/rspack.mjs.map +1 -1
  59. package/dist/runtime-css.d.mts +8 -0
  60. package/dist/runtime-css.d.ts +8 -0
  61. package/dist/runtime-css.js +23 -7
  62. package/dist/runtime-css.js.map +1 -1
  63. package/dist/runtime-css.mjs +23 -7
  64. package/dist/runtime-css.mjs.map +1 -1
  65. package/dist/scanner.js +16 -37
  66. package/dist/scanner.js.map +1 -1
  67. package/dist/scanner.mjs +15 -36
  68. package/dist/scanner.mjs.map +1 -1
  69. package/dist/shared.d.mts +107 -1
  70. package/dist/shared.d.ts +107 -1
  71. package/dist/shared.js +1627 -376
  72. package/dist/shared.js.map +1 -1
  73. package/dist/shared.mjs +1620 -354
  74. package/dist/shared.mjs.map +1 -1
  75. package/dist/svelte.js +39 -35
  76. package/dist/svelte.js.map +1 -1
  77. package/dist/svelte.mjs +38 -34
  78. package/dist/svelte.mjs.map +1 -1
  79. package/dist/theme.js +85 -76
  80. package/dist/theme.js.map +1 -1
  81. package/dist/theme.mjs +83 -74
  82. package/dist/theme.mjs.map +1 -1
  83. package/dist/turbopackLoader.js +943 -76
  84. package/dist/turbopackLoader.js.map +1 -1
  85. package/dist/turbopackLoader.mjs +943 -76
  86. package/dist/turbopackLoader.mjs.map +1 -1
  87. package/dist/tw.js +262 -190
  88. package/dist/tw.js.map +1 -1
  89. package/dist/tw.mjs +259 -187
  90. package/dist/tw.mjs.map +1 -1
  91. package/dist/vite.js +1336 -296
  92. package/dist/vite.js.map +1 -1
  93. package/dist/vite.mjs +1336 -296
  94. package/dist/vite.mjs.map +1 -1
  95. package/dist/vue.js +39 -35
  96. package/dist/vue.js.map +1 -1
  97. package/dist/vue.mjs +38 -34
  98. package/dist/vue.mjs.map +1 -1
  99. package/dist/webpackLoader.js +140 -34
  100. package/dist/webpackLoader.js.map +1 -1
  101. package/dist/webpackLoader.mjs +140 -34
  102. package/dist/webpackLoader.mjs.map +1 -1
  103. package/native/index.node +0 -0
  104. package/native/tailwind-styled-native.node +0 -0
  105. package/native/tailwind-styled-native.win32-x64-msvc.node +0 -0
  106. package/package.json +9 -4
  107. package/CHANGELOG.md +0 -285
@@ -29,94 +29,20 @@ function hashContainer(tag, container, name) {
29
29
  const sortedKey = tag + (name ?? "") + JSON.stringify(Object.entries(container).sort());
30
30
  const cached = _hashContainerCache.get(sortedKey);
31
31
  if (cached) return cached;
32
- let id;
33
- try {
34
- const native = getNativeBinding();
35
- if (native?.hashContent) ; else {
36
- throw new Error("no hashContent");
37
- }
38
- } catch {
39
- const hash = sortedKey.split("").reduce((h, char) => (h << 5) + h ^ char.charCodeAt(0), 5381);
40
- id = `tw-cq-${Math.abs(hash).toString(36).slice(0, 6)}`;
32
+ {
33
+ throw new Error("FATAL: Native binding 'hashContent' is required but not available.");
41
34
  }
42
- _hashContainerCache.set(sortedKey, id);
43
- return id;
44
- }
45
- var LAYOUT_MAP = {
46
- "flex-col": "flex-direction:column",
47
- "flex-row": "flex-direction:row",
48
- "flex-wrap": "flex-wrap:wrap",
49
- "flex-nowrap": "flex-wrap:nowrap",
50
- "flex-1": "flex:1 1 0%",
51
- hidden: "display:none",
52
- block: "display:block",
53
- flex: "display:flex",
54
- grid: "display:grid",
55
- "grid-cols-1": "grid-template-columns:repeat(1,minmax(0,1fr))",
56
- "grid-cols-2": "grid-template-columns:repeat(2,minmax(0,1fr))",
57
- "grid-cols-3": "grid-template-columns:repeat(3,minmax(0,1fr))",
58
- "grid-cols-4": "grid-template-columns:repeat(4,minmax(0,1fr))",
59
- "grid-cols-6": "grid-template-columns:repeat(6,minmax(0,1fr))",
60
- "grid-cols-12": "grid-template-columns:repeat(12,minmax(0,1fr))",
61
- "text-sm": "font-size:0.875rem;line-height:1.25rem",
62
- "text-base": "font-size:1rem;line-height:1.5rem",
63
- "text-lg": "font-size:1.125rem;line-height:1.75rem",
64
- "text-xl": "font-size:1.25rem;line-height:1.75rem",
65
- "text-2xl": "font-size:1.5rem;line-height:2rem",
66
- "text-xs": "font-size:0.75rem;line-height:1rem",
67
- "p-2": "padding:0.5rem",
68
- "p-4": "padding:1rem",
69
- "p-6": "padding:1.5rem",
70
- "p-8": "padding:2rem",
71
- "px-2": "padding-left:0.5rem;padding-right:0.5rem",
72
- "px-4": "padding-left:1rem;padding-right:1rem",
73
- "px-6": "padding-left:1.5rem;padding-right:1.5rem",
74
- "py-2": "padding-top:0.5rem;padding-bottom:0.5rem",
75
- "py-4": "padding-top:1rem;padding-bottom:1rem",
76
- "gap-2": "gap:0.5rem",
77
- "gap-4": "gap:1rem",
78
- "gap-6": "gap:1.5rem",
79
- "gap-8": "gap:2rem",
80
- "w-full": "width:100%",
81
- "w-1/2": "width:50%",
82
- "w-1/3": "width:33.333333%",
83
- "w-2/3": "width:66.666667%",
84
- "max-w-sm": "max-width:24rem",
85
- "max-w-md": "max-width:28rem",
86
- "max-w-lg": "max-width:32rem",
87
- "max-w-xl": "max-width:36rem",
88
- "items-center": "align-items:center",
89
- "items-start": "align-items:flex-start",
90
- "items-end": "align-items:flex-end",
91
- "justify-center": "justify-content:center",
92
- "justify-between": "justify-content:space-between",
93
- "justify-start": "justify-content:flex-start",
94
- "justify-end": "justify-content:flex-end"
95
- };
35
+ }
96
36
  function layoutClassesToCss(classes) {
97
- try {
98
- const native = getNativeBinding();
99
- if (native?.layoutClassesToCss) ;
100
- } catch {
101
- }
102
- const decls = [];
103
- for (const cls of classes.trim().split(/\s+/)) {
104
- if (LAYOUT_MAP[cls]) decls.push(LAYOUT_MAP[cls]);
105
- else if (cls.startsWith("w-[")) {
106
- const val = cls.match(/\[(.+)\]/)?.[1];
107
- if (val) decls.push(`width:${val}`);
108
- } else if (cls.startsWith("max-w-[")) {
109
- const val = cls.match(/\[(.+)\]/)?.[1];
110
- if (val) decls.push(`max-width:${val}`);
111
- }
37
+ {
38
+ throw new Error("FATAL: Native binding 'layoutClassesToCss' is required but not available.");
112
39
  }
113
- return decls.join(";");
114
40
  }
115
41
  function buildContainerRules(id, container, containerName) {
116
42
  const rules = Object.entries(container).map(([key, value]) => {
117
43
  const minWidth = typeof value === "string" ? CONTAINER_BREAKPOINTS[key] ?? key : value.minWidth ?? CONTAINER_BREAKPOINTS[key] ?? key;
118
- const classes = typeof value === "string" ? value : value.classes;
119
- const css = layoutClassesToCss(classes);
44
+ typeof value === "string" ? value : value.classes;
45
+ const css = layoutClassesToCss();
120
46
  if (!css) return null;
121
47
  const query = containerName ? `@container ${containerName} (min-width: ${minWidth})` : `@container (min-width: ${minWidth})`;
122
48
  return `${query}{.${id}{${css}}}`;
@@ -129,10 +55,29 @@ try {
129
55
  if (typeof mod?.batchedInject === "function") _cqBatchedInjectFn = mod.batchedInject;
130
56
  } catch {
131
57
  }
58
+ var _cqStaticDetected = /* @__PURE__ */ new Set();
132
59
  function injectContainerStyles(id, container, containerName) {
133
60
  if (typeof document === "undefined") return;
134
61
  const styleId = `tw-cq-${id}`;
135
62
  if (document.getElementById(styleId)) return;
63
+ if (_cqStaticDetected.has(id)) return;
64
+ if (typeof document.styleSheets !== "undefined") {
65
+ const selectorTarget = `.${id}`;
66
+ for (let i = 0; i < document.styleSheets.length; i++) {
67
+ try {
68
+ const rules = document.styleSheets[i].cssRules;
69
+ for (let j = 0; j < rules.length; j++) {
70
+ const rule = rules[j];
71
+ if (rule.cssText.includes(selectorTarget)) {
72
+ _cqStaticDetected.add(id);
73
+ return;
74
+ }
75
+ }
76
+ } catch {
77
+ continue;
78
+ }
79
+ }
80
+ }
136
81
  const css = buildContainerRules(id, container, containerName);
137
82
  if (!css) return;
138
83
  if (_cqBatchedInjectFn) {
@@ -165,39 +110,27 @@ function processContainer(tag, container, containerName) {
165
110
  return { containerClass: id, hasContainer: true };
166
111
  }
167
112
  function generateContainerCss(tag, container, containerName) {
168
- const id = hashContainer(tag, container, containerName);
169
- try {
170
- const native = getNativeBinding();
171
- if (native?.buildContainerRules) ;
172
- } catch {
113
+ hashContainer(tag, container, containerName);
114
+ {
115
+ throw new Error("FATAL: Native binding 'buildContainerRules' is required but not available.");
173
116
  }
174
- return buildContainerRules(id, container, containerName);
175
117
  }
176
118
  function getContainerRegistry() {
177
119
  return containerRegistry;
178
120
  }
179
121
 
180
122
  // packages/domain/core/src/merge.ts
181
- function normalizeClassInput(classLists) {
182
- const result = [];
183
- for (let i = 0; i < classLists.length; i++) {
184
- const v = classLists[i];
185
- if (!v) continue;
186
- const s = String(v).trim();
187
- if (s.length > 0) result.push(s);
188
- }
189
- return result;
190
- }
191
123
  function createTwMerge(_options = {}) {
192
124
  return function twMerge2(...classLists) {
193
- const clean = normalizeClassInput(classLists);
194
- if (clean.length === 0) return "";
195
- try {
196
- const native = getNativeBinding();
197
- if (native?.twMergeMany) ;
198
- } catch {
125
+ const inputs = [];
126
+ for (let i = 0; i < classLists.length; i++) {
127
+ const v = classLists[i];
128
+ if (v) inputs.push(String(v));
129
+ }
130
+ if (inputs.length === 0) return "";
131
+ {
132
+ throw new Error("Native binding 'twMergeRaw' is required but not available.");
199
133
  }
200
- return clean.join(" ");
201
134
  };
202
135
  }
203
136
  var twMerge = createTwMerge();
@@ -220,18 +153,9 @@ function hashState(tag, state) {
220
153
  const sortedKey = tag + JSON.stringify(Object.entries(state).sort());
221
154
  const cached = _hashStateCache.get(sortedKey);
222
155
  if (cached) return cached;
223
- let id;
224
- try {
225
- const native = getNativeBinding();
226
- if (native?.hashContent) ; else {
227
- throw new Error("no hashContent");
228
- }
229
- } catch {
230
- const hash = sortedKey.split("").reduce((h, char) => (h << 5) + h ^ char.charCodeAt(0), 5381);
231
- id = `tw-s-${Math.abs(hash).toString(36).slice(0, 6)}`;
156
+ {
157
+ throw new Error("FATAL: Native binding 'hashContent' is required but not available.");
232
158
  }
233
- _hashStateCache.set(sortedKey, id);
234
- return id;
235
159
  }
236
160
  var _twClassesToCssCache = /* @__PURE__ */ new Map();
237
161
  function twClassesToCss(classes) {
@@ -241,6 +165,7 @@ function twClassesToCss(classes) {
241
165
  throw new Error("FATAL: Native binding 'twClassesToCss' is required but not available.");
242
166
  }
243
167
  }
168
+ var _staticCssDetected = /* @__PURE__ */ new Set();
244
169
  var _batchedInjectFn = null;
245
170
  try {
246
171
  const mod = __require("@tailwind-styled/runtime-css/batched");
@@ -251,6 +176,25 @@ function injectStateStyles(id, state) {
251
176
  if (typeof document === "undefined") return;
252
177
  const styleId = `tw-state-${id}`;
253
178
  if (document.getElementById(styleId)) return;
179
+ if (_staticCssDetected.has(id)) return;
180
+ if (typeof document.styleSheets !== "undefined") {
181
+ const selectorPrefix = `.${id}[data-`;
182
+ for (let i = 0; i < document.styleSheets.length; i++) {
183
+ try {
184
+ const sheet = document.styleSheets[i];
185
+ const rules2 = sheet.cssRules;
186
+ for (let j = 0; j < rules2.length; j++) {
187
+ const rule = rules2[j];
188
+ if (rule instanceof CSSStyleRule && rule.selectorText.startsWith(selectorPrefix)) {
189
+ _staticCssDetected.add(id);
190
+ return;
191
+ }
192
+ }
193
+ } catch {
194
+ continue;
195
+ }
196
+ }
197
+ }
254
198
  const rules = Object.entries(state).map(([stateName, classes]) => {
255
199
  const css = twClassesToCss(classes);
256
200
  return css ? `.${id}[data-${stateName}="true"]{${css}}` : null;
@@ -266,8 +210,8 @@ function injectStateStyles(id, state) {
266
210
  style.textContent = rules.join("\n");
267
211
  document.head.appendChild(style);
268
212
  }
269
- function processState(tag, state) {
270
- const id = hashState(tag, state);
213
+ function processState(tag, state, precomputedHash) {
214
+ const id = precomputedHash ? `tw-s-${precomputedHash}` : hashState(tag, state);
271
215
  const stateNames = Object.keys(state);
272
216
  if (!stateRegistry.has(id)) {
273
217
  stateRegistry.set(id, {
@@ -307,19 +251,7 @@ function _getParsedTemplate(template) {
307
251
  if (native?.parseSubcomponentBlocksNapi) ;
308
252
  } catch {
309
253
  }
310
- const subMap = /* @__PURE__ */ new Map();
311
- const regex = /((?:\[[a-zA-Z][a-zA-Z0-9_-]*\]|[a-zA-Z][a-zA-Z0-9_-]*))\s*\{([^}]*)\}/g;
312
- let match;
313
- while ((match = regex.exec(template)) !== null) {
314
- const rawName = match[1];
315
- const name = rawName.startsWith("[") ? rawName.slice(1, -1) : rawName;
316
- const classes = match[2].trim().replace(/\s+/g, " ");
317
- if (classes) subMap.set(name, classes);
318
- }
319
- const baseClasses = template.replace(/(?:\[[a-zA-Z][a-zA-Z0-9_-]*\]|[a-zA-Z][a-zA-Z0-9_-]*)\s*\{[^}]*\}/g, "").replace(/\s+/g, " ").trim();
320
- result = { baseClasses, subMap };
321
- _templateParseCache.set(template, result);
322
- return result;
254
+ throw new Error("FATAL: Native binding 'parseSubcomponentBlocksNapi' is required but not available.");
323
255
  }
324
256
  function parseSubComponentBlocks(template) {
325
257
  return _getParsedTemplate(template).subMap;
@@ -465,17 +397,7 @@ function resolveVariants(variants, props, defaults) {
465
397
  if (binding?.resolveSimpleVariants) ;
466
398
  } catch {
467
399
  }
468
- const resolved = { ...defaults, ...cleanProps };
469
- const classes = [];
470
- const sortedVariantEntries = Object.entries(variants).sort(([a], [b]) => a.localeCompare(b));
471
- for (const [variantKey, variantMap] of sortedVariantEntries) {
472
- const selected = resolved[variantKey];
473
- if (selected !== void 0 && variantMap[selected] !== void 0) {
474
- const normalized = variantMap[selected].trim().replace(/\s+/g, " ");
475
- classes.push(normalized);
476
- }
477
- }
478
- return classes.filter(Boolean).join(" ");
400
+ throw new Error("FATAL: Native binding 'resolveSimpleVariants' is required but not available.");
479
401
  }
480
402
  function resolveStates(statesConfig, stateKeys, statesLookup, props) {
481
403
  if (statesLookup && stateKeys.length > 0) {
@@ -602,7 +524,13 @@ function createComponent(tag, config) {
602
524
  }
603
525
  }
604
526
  }
605
- const stateResult = stateConfig ? processState(typeof tag === "string" ? tag : "component", stateConfig) : null;
527
+ const stateResult = stateConfig ? processState(
528
+ typeof tag === "string" ? tag : "component",
529
+ stateConfig,
530
+ // Pakai pre-computed hash dari turbopackLoader (Rust inject_state_hash)
531
+ // kalau tersedia — skip runtime hashState() computation sepenuhnya
532
+ config.__hash
533
+ ) : null;
606
534
  const containerResult = containerConfig ? processContainer(typeof tag === "string" ? tag : "component", containerConfig, containerName) : null;
607
535
  const engineClasses = [stateResult?.stateClass, containerResult?.containerClass].filter(Boolean).join(" ");
608
536
  const filterProps = makeFilterProps(new Set(Object.keys(variants)), new Set(stateKeys));
@@ -688,59 +616,74 @@ function lookupGenerated(componentId, props, defaultVariants, variantKeys) {
688
616
  sortedKeys = [...keysToUse].sort();
689
617
  _sortedVariantKeysCache.set(componentId, sortedKeys);
690
618
  }
691
- let key = "";
692
- for (let i = 0; i < sortedKeys.length; i++) {
693
- if (i > 0) key += "|";
694
- key += sortedKeys[i] + ":" + String(merged[sortedKeys[i]]);
695
- }
696
- return table[key];
697
- }
698
- var _configJsonCache = /* @__PURE__ */ new WeakMap();
699
- function _getConfigJson(config) {
700
- let json = _configJsonCache.get(config);
701
- if (!json) {
702
- json = JSON.stringify(config);
703
- _configJsonCache.set(config, json);
619
+ {
620
+ throw new Error("FATAL: Native binding 'buildVariantLookupKey' is required but not available.");
704
621
  }
705
- return json;
706
622
  }
707
623
  function resolveVariantsNative(config, props) {
708
- const { base = "", variants = {}, compoundVariants = [], defaultVariants = {} } = config;
709
- const variantKeys = Object.keys(variants);
624
+ const { variants = {}, defaultVariants = {} } = config;
710
625
  try {
711
626
  const binding = getNativeBinding();
712
- if (binding?.resolveVariants) ;
713
- if (binding?.resolveSimpleVariants) ;
714
- } catch {
715
- }
716
- const resolved = {};
717
- for (const k of variantKeys) {
718
- const dv = defaultVariants[k];
719
- if (dv !== void 0) resolved[k] = dv;
720
- }
721
- for (const k of variantKeys) {
722
- const v = props[k];
723
- if (v !== void 0 && v !== null) resolved[k] = String(v);
724
- }
725
- const classes = [];
726
- if (base) classes.push(base);
727
- for (const k of variantKeys) {
728
- const variantMap = variants[k];
729
- const selected = resolved[k];
730
- if (selected !== void 0 && variantMap?.[selected] !== void 0) {
731
- classes.push(variantMap[selected]);
627
+ if (!binding?.resolveVariants) {
628
+ throw new Error("resolveVariants not available");
732
629
  }
733
- }
734
- const resolvedFull = { ...defaultVariants, ...props };
735
- for (const compound of compoundVariants) {
736
- const { class: compoundClass, className: compoundClassName, ...conditions } = compound;
737
- const matches = Object.entries(conditions).every(([key, val]) => resolvedFull[key] === val);
738
- if (matches) {
739
- if (compoundClass) classes.push(String(compoundClass));
740
- if (compoundClassName) classes.push(String(compoundClassName));
630
+ const variantKeys = Object.keys(variants);
631
+ const configJson = (() => {
632
+ const cfgObj = config;
633
+ const cfgStr = JSON.stringify(cfgObj);
634
+ const parsed = JSON.parse(cfgStr);
635
+ if ("defaultVariants" in parsed && !("default_variants" in parsed)) {
636
+ parsed.default_variants = parsed.defaultVariants;
637
+ delete parsed.defaultVariants;
638
+ }
639
+ if ("compoundVariants" in parsed && !("compound_variants" in parsed)) {
640
+ parsed.compound_variants = parsed.compoundVariants;
641
+ delete parsed.compoundVariants;
642
+ }
643
+ if (!("variants" in parsed) || parsed.variants == null) {
644
+ parsed.variants = {};
645
+ }
646
+ return JSON.stringify(parsed);
647
+ })();
648
+ const cleanProps = {};
649
+ for (const k of variantKeys) {
650
+ const dv = defaultVariants[k];
651
+ if (dv !== void 0 && dv !== null) cleanProps[k] = String(dv);
741
652
  }
653
+ for (const k of variantKeys) {
654
+ const v = props[k];
655
+ if (v !== void 0 && v !== null) cleanProps[k] = String(v);
656
+ }
657
+ const propsJson = JSON.stringify(cleanProps);
658
+ const result = binding.resolveVariants(configJson, propsJson);
659
+ return result?.classes ?? "";
660
+ } catch (_err) {
661
+ {
662
+ console.warn("[cv() fallback] getNativeBinding threw error, using JS fallback");
663
+ }
664
+ const result = [];
665
+ const { base = "", compoundVariants = [] } = config;
666
+ if (base) result.push(base);
667
+ const merged = { ...defaultVariants };
668
+ for (const [key, values] of Object.entries(variants || {})) {
669
+ const selected = props[key] ?? defaultVariants?.[key];
670
+ if (selected !== void 0 && selected !== null) merged[key] = selected;
671
+ if (selected && typeof values === "object" && values !== null) {
672
+ const variantValues = values;
673
+ if (variantValues[String(selected)]) {
674
+ result.push(variantValues[String(selected)]);
675
+ }
676
+ }
677
+ }
678
+ for (const compound of compoundVariants) {
679
+ const { class: compoundClass, ...conditions } = compound;
680
+ const matches = Object.entries(conditions).every(
681
+ ([k, v]) => String(merged[k]) === String(v)
682
+ );
683
+ if (matches && compoundClass) result.push(compoundClass);
684
+ }
685
+ return result.join(" ");
742
686
  }
743
- return classes.filter(Boolean).join(" ");
744
687
  }
745
688
  function cv(config, componentId) {
746
689
  {
@@ -782,23 +725,16 @@ function cn(...inputs) {
782
725
  }
783
726
  }
784
727
  if (strings.length === 0) return "";
785
- try {
786
- const native = getNativeBinding();
787
- if (native?.resolveClassNames) ;
788
- } catch {
728
+ {
729
+ throw new Error("Native binding 'resolveClassNames' is required but not available.");
789
730
  }
790
- return strings.join(" ");
791
731
  }
792
732
  function cx(...inputs) {
793
733
  const filtered = inputs.flat().filter(Boolean);
794
734
  if (filtered.length === 0) return "";
795
- try {
796
- const native = getNativeBinding();
797
- if (native?.twMergeMany) ;
798
- if (native?.twMerge) ;
799
- } catch {
735
+ {
736
+ throw new Error("Native binding 'twMergeMany' is required but not available.");
800
737
  }
801
- return filtered.join(" ");
802
738
  }
803
739
  var cxm = cx;
804
740
  var TOKEN_ENGINE_KEY = "__TW_TOKEN_ENGINE__";
@@ -1100,18 +1036,16 @@ function injectTokensToRoot(tokens, prefix) {
1100
1036
  if (typeof document === "undefined") return;
1101
1037
  const styleId = `__tw-sys-tokens-${prefix}`;
1102
1038
  if (document.getElementById(styleId)) return;
1103
- const lines = [":root {"];
1104
- for (const [group, map] of Object.entries(tokens)) {
1105
- for (const [name, value] of Object.entries(map)) {
1106
- lines.push(` ${tokenVarName(prefix, group, name)}: ${value};`);
1107
- }
1108
- }
1109
- lines.push("}");
1110
1039
  const style = document.createElement("style");
1111
1040
  style.id = styleId;
1112
- style.textContent = lines.join("\n");
1041
+ style.textContent = _buildTokenCss();
1113
1042
  document.head.appendChild(style);
1114
1043
  }
1044
+ function _buildTokenCss(tokens, prefix) {
1045
+ {
1046
+ throw new Error("FATAL: Native binding 'generateSystemTokenCss' is required but not available.");
1047
+ }
1048
+ }
1115
1049
  function resolveComponentConfig(config, tokens, prefix) {
1116
1050
  const resolveStr = (s) => resolveTokenRef(tokens, prefix, s);
1117
1051
  const base = resolveStr(config.base ?? "");
@@ -1213,14 +1147,7 @@ function createStyledSystem(config) {
1213
1147
  tokens[group][name] = value;
1214
1148
  }
1215
1149
  }
1216
- const lines = [":root {"];
1217
- for (const [group, map] of Object.entries(tokens)) {
1218
- for (const [name, value] of Object.entries(map)) {
1219
- lines.push(` ${tokenVarName(prefix, group, name)}: ${value};`);
1220
- }
1221
- }
1222
- lines.push("}");
1223
- style.textContent = lines.join("\n");
1150
+ style.textContent = _buildTokenCss();
1224
1151
  }
1225
1152
  function getConfig(name) {
1226
1153
  return resolvedConfigs.get(name);
@@ -1233,39 +1160,6 @@ function createStyledSystem(config) {
1233
1160
  tokens
1234
1161
  });
1235
1162
  }
1236
- var SUB_RE = /(?:\[([a-zA-Z][a-zA-Z0-9_-]*)\]|([a-zA-Z][a-zA-Z0-9_-]*))\s*\{([^}]*)\}/g;
1237
- var COMMENT_RE = /\/\/[^\n]*/g;
1238
- function parseTemplateFallback(strings, exprs) {
1239
- const raw = strings.raw.reduce((acc, str, i) => {
1240
- const expr = exprs[i];
1241
- const exprStr = typeof expr === "function" ? "" : expr ?? "";
1242
- return acc + str + String(exprStr);
1243
- }, "");
1244
- const subs = {};
1245
- let base = raw;
1246
- let match;
1247
- SUB_RE.lastIndex = 0;
1248
- while ((match = SUB_RE.exec(raw)) !== null) {
1249
- const name = match[1] ?? match[2];
1250
- const rawInner = match[3].replace(COMMENT_RE, "");
1251
- let inner = "";
1252
- for (const line of rawInner.split("\n")) {
1253
- const t2 = line.trim();
1254
- if (t2) inner += (inner ? " " : "") + t2;
1255
- }
1256
- inner = inner.replace(/\s+/g, " ").trim();
1257
- subs[name] = inner;
1258
- base = base.replace(match[0], "");
1259
- }
1260
- const rawBase = base.replace(COMMENT_RE, "");
1261
- let cleanBase = "";
1262
- for (const line of rawBase.split("\n")) {
1263
- const t2 = line.trim();
1264
- if (t2) cleanBase += (cleanBase ? " " : "") + t2;
1265
- }
1266
- cleanBase = cleanBase.replace(/\s+/g, " ").trim();
1267
- return { base: cleanBase, subs, hasSubs: Object.keys(subs).length > 0 };
1268
- }
1269
1163
  var _parsedTemplateCache = /* @__PURE__ */ new Map();
1270
1164
  function parseTemplate(strings, exprs) {
1271
1165
  const raw = strings.raw.reduce((acc, str, i) => {
@@ -1275,15 +1169,9 @@ function parseTemplate(strings, exprs) {
1275
1169
  }, "");
1276
1170
  const cached = _parsedTemplateCache.get(raw);
1277
1171
  if (cached) return cached;
1278
- let result;
1279
- try {
1280
- const binding = getNativeBinding();
1281
- if (binding?.parseTemplate) ;
1282
- } catch {
1172
+ {
1173
+ throw new Error("FATAL: Native binding 'parseTemplate' is required but not available.");
1283
1174
  }
1284
- result = parseTemplateFallback(strings, exprs);
1285
- _parsedTemplateCache.set(raw, result);
1286
- return result;
1287
1175
  }
1288
1176
  function makeTag(tag) {
1289
1177
  return ((stringsOrConfig, ...exprs) => {