tailwind-styled-v4 5.0.9 → 5.0.10

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 (137) hide show
  1. package/CHANGELOG.md +15 -1
  2. package/dist/{analyzeWorkspace-DuJKh7Ty.d.mts → analyzeWorkspace-BS5O4rhC.d.mts} +47 -2
  3. package/dist/{analyzeWorkspace-Ct_NTAWt.d.ts → analyzeWorkspace-DDOQdzzI.d.ts} +47 -2
  4. package/dist/analyzer.d.mts +5 -3
  5. package/dist/analyzer.d.ts +5 -3
  6. package/dist/analyzer.js +563 -468
  7. package/dist/analyzer.js.map +1 -1
  8. package/dist/analyzer.mjs +562 -467
  9. package/dist/analyzer.mjs.map +1 -1
  10. package/dist/animate.d.mts +4 -7
  11. package/dist/animate.d.ts +4 -7
  12. package/dist/animate.js +171 -265
  13. package/dist/animate.js.map +1 -1
  14. package/dist/animate.mjs +165 -264
  15. package/dist/animate.mjs.map +1 -1
  16. package/dist/atomic.d.mts +22 -1
  17. package/dist/atomic.d.ts +22 -1
  18. package/dist/atomic.js +221 -165
  19. package/dist/atomic.js.map +1 -1
  20. package/dist/atomic.mjs +200 -165
  21. package/dist/atomic.mjs.map +1 -1
  22. package/dist/cli.d.mts +60 -1
  23. package/dist/cli.d.ts +60 -1
  24. package/dist/cli.js +1261 -1517
  25. package/dist/cli.js.map +1 -1
  26. package/dist/cli.mjs +1238 -1513
  27. package/dist/cli.mjs.map +1 -1
  28. package/dist/compiler.d.mts +38 -7
  29. package/dist/compiler.d.ts +38 -7
  30. package/dist/compiler.js +174 -197
  31. package/dist/compiler.js.map +1 -1
  32. package/dist/compiler.mjs +151 -194
  33. package/dist/compiler.mjs.map +1 -1
  34. package/dist/devtools.js +7 -31
  35. package/dist/devtools.js.map +1 -1
  36. package/dist/devtools.mjs +7 -31
  37. package/dist/devtools.mjs.map +1 -1
  38. package/dist/engine.d.mts +134 -63
  39. package/dist/engine.d.ts +134 -63
  40. package/dist/engine.js +2863 -2482
  41. package/dist/engine.js.map +1 -1
  42. package/dist/engine.mjs +2852 -2485
  43. package/dist/engine.mjs.map +1 -1
  44. package/dist/{index-eWAocnD2.d.mts → index-NDINUhLN.d.mts} +3 -1
  45. package/dist/{index-eWAocnD2.d.ts → index-NDINUhLN.d.ts} +3 -1
  46. package/dist/index.d.mts +45 -32
  47. package/dist/index.d.ts +45 -32
  48. package/dist/index.js +271 -158
  49. package/dist/index.js.map +1 -1
  50. package/dist/index.mjs +251 -158
  51. package/dist/index.mjs.map +1 -1
  52. package/dist/{liveTokenEngine-DSUk88P6.d.ts → liveTokenEngine-CN9ian1R.d.ts} +1 -1
  53. package/dist/{liveTokenEngine-CX5_0c4q.d.mts → liveTokenEngine-DKoWRtqH.d.mts} +1 -1
  54. package/dist/next.js +20 -39
  55. package/dist/next.js.map +1 -1
  56. package/dist/next.mjs +18 -37
  57. package/dist/next.mjs.map +1 -1
  58. package/dist/plugin-api.d.mts +8 -2
  59. package/dist/plugin-api.d.ts +8 -2
  60. package/dist/plugin-api.js +14 -2
  61. package/dist/plugin-api.js.map +1 -1
  62. package/dist/plugin-api.mjs +14 -3
  63. package/dist/plugin-api.mjs.map +1 -1
  64. package/dist/plugin-registry.js +51 -11
  65. package/dist/plugin-registry.js.map +1 -1
  66. package/dist/plugin-registry.mjs +51 -11
  67. package/dist/plugin-registry.mjs.map +1 -1
  68. package/dist/plugin.d.mts +5 -7
  69. package/dist/plugin.d.ts +5 -7
  70. package/dist/plugin.js +16 -15
  71. package/dist/plugin.js.map +1 -1
  72. package/dist/plugin.mjs +16 -16
  73. package/dist/plugin.mjs.map +1 -1
  74. package/dist/rspack.js +17 -38
  75. package/dist/rspack.js.map +1 -1
  76. package/dist/rspack.mjs +15 -36
  77. package/dist/rspack.mjs.map +1 -1
  78. package/dist/runtime.d.mts +2 -2
  79. package/dist/runtime.d.ts +2 -2
  80. package/dist/scanner.d.mts +10 -1
  81. package/dist/scanner.d.ts +10 -1
  82. package/dist/scanner.js +298 -124
  83. package/dist/scanner.js.map +1 -1
  84. package/dist/scanner.mjs +296 -124
  85. package/dist/scanner.mjs.map +1 -1
  86. package/dist/shared.d.mts +1 -1
  87. package/dist/shared.d.ts +1 -1
  88. package/dist/shared.js +104 -176
  89. package/dist/shared.js.map +1 -1
  90. package/dist/shared.mjs +85 -176
  91. package/dist/shared.mjs.map +1 -1
  92. package/dist/storybook-addon.d.mts +1 -1
  93. package/dist/storybook-addon.d.ts +1 -1
  94. package/dist/svelte.d.mts +1 -1
  95. package/dist/svelte.d.ts +1 -1
  96. package/dist/svelte.js +166 -3
  97. package/dist/svelte.js.map +1 -1
  98. package/dist/svelte.mjs +143 -1
  99. package/dist/svelte.mjs.map +1 -1
  100. package/dist/syntax.js +21 -21
  101. package/dist/syntax.js.map +1 -1
  102. package/dist/syntax.mjs +21 -21
  103. package/dist/syntax.mjs.map +1 -1
  104. package/dist/testing.js +9 -1
  105. package/dist/testing.js.map +1 -1
  106. package/dist/testing.mjs +9 -1
  107. package/dist/testing.mjs.map +1 -1
  108. package/dist/theme.d.mts +2 -2
  109. package/dist/theme.d.ts +2 -2
  110. package/dist/theme.js +40 -112
  111. package/dist/theme.js.map +1 -1
  112. package/dist/theme.mjs +37 -110
  113. package/dist/theme.mjs.map +1 -1
  114. package/dist/turbopackLoader.js +79 -124
  115. package/dist/turbopackLoader.js.map +1 -1
  116. package/dist/turbopackLoader.mjs +63 -122
  117. package/dist/turbopackLoader.mjs.map +1 -1
  118. package/dist/tw.js +1256 -1517
  119. package/dist/tw.js.map +1 -1
  120. package/dist/tw.mjs +1236 -1513
  121. package/dist/tw.mjs.map +1 -1
  122. package/dist/vite.js +1783 -823
  123. package/dist/vite.js.map +1 -1
  124. package/dist/vite.mjs +1767 -821
  125. package/dist/vite.mjs.map +1 -1
  126. package/dist/vue.d.mts +1 -1
  127. package/dist/vue.d.ts +1 -1
  128. package/dist/vue.js +165 -4
  129. package/dist/vue.js.map +1 -1
  130. package/dist/vue.mjs +141 -1
  131. package/dist/vue.mjs.map +1 -1
  132. package/dist/webpackLoader.js +65 -108
  133. package/dist/webpackLoader.js.map +1 -1
  134. package/dist/webpackLoader.mjs +45 -104
  135. package/dist/webpackLoader.mjs.map +1 -1
  136. package/native/tailwind-styled-native.node +0 -0
  137. package/package.json +22 -24
package/dist/index.mjs CHANGED
@@ -1,5 +1,10 @@
1
+ import * as path from 'path';
2
+ import { dirname } from 'path';
3
+ import { fileURLToPath } from 'url';
4
+ import 'crypto';
5
+ import * as fs from 'fs';
6
+ import { createRequire } from 'module';
1
7
  import React3 from 'react';
2
- import { twMerge as twMerge$1 } from 'tailwind-merge';
3
8
 
4
9
  /* tailwind-styled-v4 v5.0.4 | MIT | https://github.com/dictionar32/tailwind-styled-v4 */
5
10
  var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
@@ -8,6 +13,119 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
8
13
  if (typeof require !== "undefined") return require.apply(this, arguments);
9
14
  throw Error('Dynamic require of "' + x + '" is not supported');
10
15
  });
16
+ var isBrowser = typeof window !== "undefined" || typeof document !== "undefined";
17
+ var _require = typeof __require !== "undefined" ? __require : createRequire(import.meta.url);
18
+ var PLATFORM_MAP = {
19
+ "linux-x64": ["@tailwind-styled/native-linux-x64"],
20
+ "linux-arm64": ["@tailwind-styled/native-linux-arm64"],
21
+ "darwin-x64": ["@tailwind-styled/native-darwin-x64"],
22
+ "darwin-arm64": ["@tailwind-styled/native-darwin-arm64"],
23
+ "win32-x64": ["@tailwind-styled/native-win32-x64"],
24
+ "win32-arm64": ["@tailwind-styled/native-win32-arm64"]
25
+ };
26
+ function platformKey() {
27
+ if (isBrowser) return "browser";
28
+ return `${process.platform}-${process.arch}`;
29
+ }
30
+ function resolveNativeBinary(runtimeDir) {
31
+ const platform = platformKey();
32
+ const tried = [];
33
+ if (isBrowser) {
34
+ return { path: null, source: "not-found", platform, tried: ["not available in browser"] };
35
+ }
36
+ if (process.env.TWS_DISABLE_NATIVE === "1") {
37
+ return { path: null, source: "not-found", platform, tried: [] };
38
+ }
39
+ const envPath = process.env.TW_NATIVE_PATH?.trim();
40
+ if (envPath) {
41
+ if (fs.existsSync(envPath)) {
42
+ return { path: envPath, source: "env", platform, tried };
43
+ }
44
+ tried.push(`env:${envPath} (not found)`);
45
+ }
46
+ const prebuiltPkgs = PLATFORM_MAP[platform] ?? [];
47
+ for (const pkg of prebuiltPkgs) {
48
+ try {
49
+ const candidate = _require.resolve(`${pkg}/tailwind_styled_parser.node`);
50
+ if (fs.existsSync(candidate)) {
51
+ return { path: candidate, source: "prebuilt", platform, tried };
52
+ }
53
+ tried.push(`prebuilt:${pkg} (resolved but missing)`);
54
+ } catch {
55
+ tried.push(`prebuilt:${pkg} (not installed)`);
56
+ }
57
+ }
58
+ const cwd = process.cwd();
59
+ const base = runtimeDir ?? cwd;
60
+ const napiPlatform = platform === "linux-x64" ? "linux-x64-gnu" : platform === "linux-arm64" ? "linux-arm64-gnu" : platform;
61
+ const BINARY_NAMES = ["tailwind-styled-native", "tailwind_styled_parser"];
62
+ const localCandidates = [];
63
+ for (const bin of BINARY_NAMES) {
64
+ localCandidates.push(path.resolve(base, `${bin}.node`));
65
+ localCandidates.push(path.resolve(base, "..", `${bin}.node`));
66
+ localCandidates.push(path.resolve(base, `${bin}.${platform}.node`));
67
+ localCandidates.push(path.resolve(base, `${bin}.${napiPlatform}.node`));
68
+ }
69
+ for (const startDir of [cwd, base]) {
70
+ let dir = startDir;
71
+ for (let i = 0; i < 6; i++) {
72
+ const nativeDir = path.resolve(dir, "native");
73
+ for (const bin of BINARY_NAMES) {
74
+ localCandidates.push(path.resolve(nativeDir, `${bin}.node`));
75
+ localCandidates.push(path.resolve(nativeDir, `${bin}.${platform}.node`));
76
+ localCandidates.push(path.resolve(nativeDir, `${bin}.${napiPlatform}.node`));
77
+ localCandidates.push(path.resolve(nativeDir, "target", "release", `${bin}.node`));
78
+ }
79
+ const parent = path.resolve(dir, "..");
80
+ if (parent === dir) break;
81
+ dir = parent;
82
+ }
83
+ }
84
+ for (const candidate of localCandidates) {
85
+ tried.push(`local:${candidate}`);
86
+ if (fs.existsSync(candidate)) {
87
+ return { path: candidate, source: "local", platform, tried };
88
+ }
89
+ }
90
+ return { path: null, source: "not-found", platform, tried };
91
+ }
92
+
93
+ // packages/domain/shared/src/index.ts
94
+ createRequire(import.meta.url);
95
+
96
+ // packages/domain/core/src/native.ts
97
+ var isBrowser2 = typeof window !== "undefined" || typeof document !== "undefined";
98
+ var NATIVE_UNAVAILABLE_MESSAGE = "[tailwind-styled/core] Native binding is required but not available.\nPlease ensure you have run: npm run build:rust";
99
+ var _loadNative = (path3) => __require(path3);
100
+ var nativeBinding = null;
101
+ var bindingLoadAttempted = false;
102
+ var getBinding = () => {
103
+ if (isBrowser2) {
104
+ throw new Error(NATIVE_UNAVAILABLE_MESSAGE + "\n\nNative bindings are not available in browser. Use the compiled CSS output instead.");
105
+ }
106
+ if (nativeBinding) return nativeBinding;
107
+ if (bindingLoadAttempted) {
108
+ throw new Error(NATIVE_UNAVAILABLE_MESSAGE);
109
+ }
110
+ bindingLoadAttempted = true;
111
+ try {
112
+ const runtimeDir = isBrowser2 ? "" : dirname(fileURLToPath(import.meta.url));
113
+ const result = isBrowser2 ? { path: null, source: "not-found", platform: "browser", tried: [] } : resolveNativeBinary(runtimeDir);
114
+ if (result.path && result.path.endsWith(".node")) {
115
+ const mod = _loadNative(result.path);
116
+ if (mod?.batchSplitClasses) {
117
+ nativeBinding = mod;
118
+ return nativeBinding;
119
+ }
120
+ }
121
+ throw new Error(`${NATIVE_UNAVAILABLE_MESSAGE}
122
+
123
+ Tried: ${result.tried.join("\n")}`);
124
+ } catch (err) {
125
+ throw err instanceof Error ? err : new Error(String(err));
126
+ }
127
+ };
128
+ var getNativeBinding = getBinding;
11
129
 
12
130
  // packages/domain/core/src/containerQuery.ts
13
131
  var CONTAINER_BREAKPOINTS = {
@@ -79,6 +197,13 @@ var LAYOUT_MAP = {
79
197
  "justify-end": "justify-content:flex-end"
80
198
  };
81
199
  function layoutClassesToCss(classes) {
200
+ try {
201
+ const native = getNativeBinding();
202
+ if (native?.layoutClassesToCss) {
203
+ return native.layoutClassesToCss(classes);
204
+ }
205
+ } catch {
206
+ }
82
207
  const decls = [];
83
208
  for (const cls of classes.trim().split(/\s+/)) {
84
209
  if (LAYOUT_MAP[cls]) decls.push(LAYOUT_MAP[cls]);
@@ -142,18 +267,36 @@ function processContainer(tag, container, containerName) {
142
267
  }
143
268
  function generateContainerCss(tag, container, containerName) {
144
269
  const id = hashContainer(tag, container, containerName);
270
+ try {
271
+ const native = getNativeBinding();
272
+ if (native?.buildContainerRules) {
273
+ const breakpoints = Object.entries(container).map(([key, value]) => ({
274
+ key,
275
+ classes: typeof value === "string" ? value : value.classes
276
+ }));
277
+ return native.buildContainerRules(id, breakpoints, containerName ?? null);
278
+ }
279
+ } catch {
280
+ }
145
281
  return buildContainerRules(id, container, containerName);
146
282
  }
147
283
  function getContainerRegistry() {
148
284
  return containerRegistry;
149
285
  }
286
+
287
+ // packages/domain/core/src/merge.ts
150
288
  function normalizeClassInput(classLists) {
151
289
  return classLists.filter(Boolean).map((v) => String(v).trim()).filter((v) => v.length > 0);
152
290
  }
153
291
  function createTwMerge(_options = {}) {
154
- return function twMerge4(...classLists) {
292
+ return function twMerge2(...classLists) {
155
293
  const clean = normalizeClassInput(classLists);
156
- return twMerge$1(clean.join(" "));
294
+ if (clean.length === 0) return "";
295
+ const native = getNativeBinding();
296
+ if (!native?.twMergeMany) {
297
+ throw new Error("FATAL: Native binding 'twMergeMany' is required but not available.");
298
+ }
299
+ return native.twMergeMany(clean);
157
300
  };
158
301
  }
159
302
  var twMerge = createTwMerge();
@@ -176,113 +319,12 @@ function hashState(tag, state) {
176
319
  const hash = key.split("").reduce((h, char) => (h << 5) + h ^ char.charCodeAt(0), 5381);
177
320
  return `tw-s-${Math.abs(hash).toString(36).slice(0, 6)}`;
178
321
  }
179
- var TW_MAP = {
180
- // Display
181
- hidden: "display:none",
182
- block: "display:block",
183
- flex: "display:flex",
184
- inline: "display:inline",
185
- "inline-flex": "display:inline-flex",
186
- grid: "display:grid",
187
- // Opacity
188
- "opacity-0": "opacity:0",
189
- "opacity-5": "opacity:0.05",
190
- "opacity-10": "opacity:0.1",
191
- "opacity-20": "opacity:0.2",
192
- "opacity-25": "opacity:0.25",
193
- "opacity-30": "opacity:0.3",
194
- "opacity-40": "opacity:0.4",
195
- "opacity-50": "opacity:0.5",
196
- "opacity-60": "opacity:0.6",
197
- "opacity-70": "opacity:0.7",
198
- "opacity-75": "opacity:0.75",
199
- "opacity-80": "opacity:0.8",
200
- "opacity-90": "opacity:0.9",
201
- "opacity-95": "opacity:0.95",
202
- "opacity-100": "opacity:1",
203
- // Cursor
204
- "cursor-pointer": "cursor:pointer",
205
- "cursor-not-allowed": "cursor:not-allowed",
206
- "cursor-default": "cursor:default",
207
- "cursor-wait": "cursor:wait",
208
- "cursor-move": "cursor:move",
209
- "cursor-grab": "cursor:grab",
210
- "cursor-grabbing": "cursor:grabbing",
211
- // Pointer events
212
- "pointer-events-none": "pointer-events:none",
213
- "pointer-events-auto": "pointer-events:auto",
214
- // Scale
215
- "scale-90": "transform:scale(0.9)",
216
- "scale-95": "transform:scale(0.95)",
217
- "scale-100": "transform:scale(1)",
218
- "scale-105": "transform:scale(1.05)",
219
- "scale-110": "transform:scale(1.1)",
220
- // Translate
221
- "translate-x-0": "transform:translateX(0)",
222
- "translate-y-0": "transform:translateY(0)",
223
- "-translate-x-1": "transform:translateX(-0.25rem)",
224
- "-translate-y-1": "transform:translateY(-0.25rem)",
225
- "translate-x-1": "transform:translateX(0.25rem)",
226
- "translate-y-1": "transform:translateY(0.25rem)",
227
- // Ring
228
- ring: "box-shadow:0 0 0 3px rgba(59,130,246,0.5)",
229
- "ring-2": "box-shadow:0 0 0 2px rgba(59,130,246,0.5)",
230
- "ring-4": "box-shadow:0 0 0 4px rgba(59,130,246,0.5)",
231
- "ring-inset": "box-shadow:inset 0 0 0 3px rgba(59,130,246,0.5)",
232
- // Border
233
- border: "border-width:1px",
234
- "border-2": "border-width:2px",
235
- "border-transparent": "border-color:transparent",
236
- // Outline
237
- "outline-none": "outline:2px solid transparent;outline-offset:2px",
238
- outline: "outline:2px solid currentColor",
239
- // Overflow
240
- "overflow-hidden": "overflow:hidden",
241
- "overflow-auto": "overflow:auto",
242
- "overflow-scroll": "overflow:scroll",
243
- // Text decoration
244
- underline: "text-decoration-line:underline",
245
- "no-underline": "text-decoration-line:none",
246
- "line-through": "text-decoration-line:line-through",
247
- // Font weight
248
- "font-bold": "font-weight:700",
249
- "font-semibold": "font-weight:600",
250
- "font-medium": "font-weight:500",
251
- "font-normal": "font-weight:400",
252
- // Background colors (common)
253
- "bg-transparent": "background-color:transparent",
254
- "bg-white": "background-color:#fff",
255
- "bg-black": "background-color:#000",
256
- "bg-blue-500": "background-color:rgb(59,130,246)",
257
- "bg-blue-600": "background-color:rgb(37,99,235)",
258
- "bg-red-500": "background-color:rgb(239,68,68)",
259
- "bg-green-500": "background-color:rgb(34,197,94)",
260
- "bg-yellow-500": "background-color:rgb(234,179,8)",
261
- "bg-zinc-900": "background-color:rgb(24,24,27)",
262
- "bg-zinc-800": "background-color:rgb(39,39,42)",
263
- // Text colors
264
- "text-white": "color:#fff",
265
- "text-black": "color:#000",
266
- "text-blue-500": "color:rgb(59,130,246)",
267
- "text-red-500": "color:rgb(239,68,68)",
268
- "text-zinc-400": "color:rgb(161,161,170)",
269
- "text-zinc-500": "color:rgb(113,113,122)"
270
- };
271
322
  function twClassesToCss(classes) {
272
- const decls = [];
273
- for (const cls of classes.trim().split(/\s+/)) {
274
- if (TW_MAP[cls]) decls.push(TW_MAP[cls]);
275
- else if (cls.includes("[") && cls.includes("]")) {
276
- const val = cls.match(/\[(.+)\]/)?.[1];
277
- if (!val) continue;
278
- if (cls.startsWith("bg-[")) decls.push(`background-color:${val}`);
279
- else if (cls.startsWith("text-[")) decls.push(`color:${val}`);
280
- else if (cls.startsWith("w-[")) decls.push(`width:${val}`);
281
- else if (cls.startsWith("h-[")) decls.push(`height:${val}`);
282
- else if (cls.startsWith("opacity-[")) decls.push(`opacity:${val}`);
283
- }
323
+ const native = getNativeBinding();
324
+ if (!native?.twClassesToCss) {
325
+ throw new Error("FATAL: Native binding 'twClassesToCss' is required but not available.");
284
326
  }
285
- return decls.join(";");
327
+ return native.twClassesToCss(classes);
286
328
  }
287
329
  function injectStateStyles(id, state) {
288
330
  if (typeof document === "undefined") return;
@@ -336,17 +378,23 @@ function getStateRegistry() {
336
378
  // packages/domain/core/src/createComponent.ts
337
379
  var ALWAYS_BLOCKED = /* @__PURE__ */ new Set(["base", "_ref", "state", "container", "containerName"]);
338
380
  function parseSubComponentBlocks(template) {
339
- const map = /* @__PURE__ */ new Map();
340
- const re = /(?:\[([a-zA-Z][a-zA-Z0-9_-]*)\]|([a-zA-Z][a-zA-Z0-9_-]*))\s*\{([^}]*)\}/g;
341
- let m;
342
- while ((m = re.exec(template)) !== null) {
343
- const name = m[1] ?? m[2];
344
- const classes = m[3].trim().replace(/\s+/g, " ");
345
- if (classes) map.set(name, classes);
381
+ const native = getNativeBinding();
382
+ if (!native?.parseSubcomponentBlocksNapi) {
383
+ throw new Error("FATAL: Native binding 'parseSubcomponentBlocksNapi' is required but not available.");
346
384
  }
347
- return map;
385
+ const result = native.parseSubcomponentBlocksNapi(template, "tw");
386
+ const raw = JSON.parse(result.subMapJson);
387
+ return new Map(Object.entries(raw));
348
388
  }
349
389
  function extractBaseClasses(template) {
390
+ try {
391
+ const native = getNativeBinding();
392
+ if (native?.parseSubcomponentBlocksNapi) {
393
+ const result = native.parseSubcomponentBlocksNapi(template, "tw");
394
+ return result.baseClasses;
395
+ }
396
+ } catch {
397
+ }
350
398
  return template.replace(/(?:\[[a-zA-Z][a-zA-Z0-9_-]*\]|[a-zA-Z][a-zA-Z0-9_-]*)\s*\{[^}]*\}/g, "").replace(/\s+/g, " ").trim();
351
399
  }
352
400
  function createSubComponentAccessor(parentDisplayName, name, classes) {
@@ -392,14 +440,15 @@ function makeFilterProps(variantKeys) {
392
440
  };
393
441
  }
394
442
  function resolveVariants(variants, props, defaults) {
395
- const classes = [];
396
- for (const key in variants) {
397
- const value = props[key] ?? defaults[key];
398
- if (value !== void 0 && variants[key][String(value)]) {
399
- classes.push(variants[key][String(value)]);
400
- }
443
+ const binding = getNativeBinding();
444
+ if (!binding?.resolveSimpleVariants) {
445
+ throw new Error("FATAL: Native binding 'resolveSimpleVariants' is required but not available.");
401
446
  }
402
- return classes.join(" ");
447
+ const cleanProps = {};
448
+ for (const [k, v] of Object.entries(props)) {
449
+ if (v !== void 0 && v !== null) cleanProps[k] = String(v);
450
+ }
451
+ return binding.resolveSimpleVariants(null, variants, defaults, cleanProps);
403
452
  }
404
453
  function resolveCompound(compounds, props) {
405
454
  const classes = [];
@@ -562,6 +611,8 @@ function wrapWithSubProxy(component, tagLabel) {
562
611
  }
563
612
  });
564
613
  }
614
+
615
+ // packages/domain/core/src/cv.ts
565
616
  var __generatedRegistry = {};
566
617
  function lookupGenerated(componentId, props, defaultVariants) {
567
618
  const table = __generatedRegistry[componentId];
@@ -570,27 +621,40 @@ function lookupGenerated(componentId, props, defaultVariants) {
570
621
  const key = Object.keys(merged).sort().filter((k) => k !== "className").map((k) => `${k}:${String(merged[k])}`).join("|");
571
622
  return table[key];
572
623
  }
573
- function resolveVariantsJS(config, props) {
624
+ function resolveVariantsNative(config, props) {
574
625
  const { base = "", variants = {}, compoundVariants = [], defaultVariants = {} } = config;
575
- const classes = [];
576
- if (base) classes.push(...base.split(" ").filter(Boolean));
577
- const resolved = { ...defaultVariants, ...props };
578
- for (const [key, variantMap] of Object.entries(variants)) {
579
- const value = resolved[key];
580
- if (value !== void 0 && value !== null) {
581
- const variantClass = variantMap[String(value)];
582
- if (variantClass) classes.push(...variantClass.split(" ").filter(Boolean));
626
+ const binding = getNativeBinding();
627
+ if (binding?.resolveSimpleVariants) {
628
+ const mergedProps = {};
629
+ for (const [k, v] of Object.entries(defaultVariants)) {
630
+ if (v !== void 0 && v !== null) mergedProps[k] = String(v);
583
631
  }
584
- }
585
- for (const compound of compoundVariants) {
586
- const { class: compoundClass, className: compoundClassName, ...conditions } = compound;
587
- const matches = Object.entries(conditions).every(([key, val]) => resolved[key] === val);
588
- if (matches) {
589
- if (compoundClass) classes.push(...String(compoundClass).split(" ").filter(Boolean));
590
- if (compoundClassName) classes.push(...String(compoundClassName).split(" ").filter(Boolean));
632
+ for (const [k, v] of Object.entries(props)) {
633
+ if (v !== void 0 && v !== null && k !== "className") {
634
+ mergedProps[k] = String(v);
635
+ }
591
636
  }
637
+ let result = binding.resolveSimpleVariants(
638
+ base || null,
639
+ variants,
640
+ {},
641
+ // already merged into mergedProps
642
+ mergedProps
643
+ );
644
+ const resolved = { ...defaultVariants, ...props };
645
+ const extra = [];
646
+ for (const compound of compoundVariants) {
647
+ const { class: compoundClass, className: compoundClassName, ...conditions } = compound;
648
+ const matches = Object.entries(conditions).every(([key, val]) => resolved[key] === val);
649
+ if (matches) {
650
+ if (compoundClass) extra.push(String(compoundClass));
651
+ if (compoundClassName) extra.push(String(compoundClassName));
652
+ }
653
+ }
654
+ if (extra.length > 0) result = `${result} ${extra.join(" ")}`.trim();
655
+ return result;
592
656
  }
593
- return [...new Set(classes)].join(" ");
657
+ throw new Error("FATAL: Native binding 'resolveSimpleVariants' is required but not available.");
594
658
  }
595
659
  function cv(config, componentId) {
596
660
  if (process.env.NODE_ENV !== "production") {
@@ -609,18 +673,34 @@ function cv(config, componentId) {
609
673
  props,
610
674
  config.defaultVariants
611
675
  );
612
- result = generated ?? resolveVariantsJS(config, props);
676
+ result = generated ?? resolveVariantsNative(config, props);
613
677
  } else {
614
- result = resolveVariantsJS(config, props);
678
+ result = resolveVariantsNative(config, props);
615
679
  }
616
- return props.className ? twMerge$1(result, props.className) : result;
680
+ return props.className ? twMerge(result, props.className) : result;
617
681
  };
618
682
  }
683
+
684
+ // packages/domain/core/src/cx.ts
619
685
  function cn(...inputs) {
620
- return inputs.filter(Boolean).join(" ").replace(/\s+/g, " ").trim();
686
+ const native = getNativeBinding();
687
+ if (!native?.resolveClassNames) {
688
+ throw new Error("FATAL: Native binding 'resolveClassNames' is required but not available.");
689
+ }
690
+ const strings = inputs.flat().filter(Boolean);
691
+ return native.resolveClassNames(strings);
621
692
  }
622
693
  function cx(...inputs) {
623
- return twMerge$1(...inputs.filter(Boolean));
694
+ const filtered = inputs.flat().filter(Boolean);
695
+ if (filtered.length === 0) return "";
696
+ const native = getNativeBinding();
697
+ if (!native?.twMergeMany && !native?.twMerge) {
698
+ throw new Error("FATAL: Native binding 'twMerge' or 'twMergeMany' is required but not available.");
699
+ }
700
+ if (native.twMergeMany) {
701
+ return native.twMergeMany(filtered);
702
+ }
703
+ return native.twMerge(filtered.join(" "));
624
704
  }
625
705
  var cxm = cx;
626
706
  var TOKEN_ENGINE_KEY = "__TW_TOKEN_ENGINE__";
@@ -910,8 +990,8 @@ function tokenVarRef(prefix, group, name) {
910
990
  }
911
991
  function resolveTokenRef(tokens, prefix, value) {
912
992
  if (value.startsWith("token:")) {
913
- const path = value.slice(6);
914
- const [group, name] = path.split(".");
993
+ const path3 = value.slice(6);
994
+ const [group, name] = path3.split(".");
915
995
  if (group && name && tokens[group]?.[name] !== void 0) {
916
996
  return tokenVarRef(prefix, group, name);
917
997
  }
@@ -1010,13 +1090,13 @@ function createStyledSystem(config) {
1010
1090
  return createComponent(runtimeTag, merged);
1011
1091
  };
1012
1092
  }
1013
- function token(path) {
1014
- const [group, name] = path.split(".");
1015
- if (!group || !name) return path;
1093
+ function token(path3) {
1094
+ const [group, name] = path3.split(".");
1095
+ if (!group || !name) return path3;
1016
1096
  return tokenVarRef(prefix, group, name);
1017
1097
  }
1018
- function rawToken(path) {
1019
- const [group, name] = path.split(".");
1098
+ function rawToken(path3) {
1099
+ const [group, name] = path3.split(".");
1020
1100
  if (!group || !name) return void 0;
1021
1101
  return tokens[group]?.[name];
1022
1102
  }
@@ -1057,7 +1137,7 @@ function createStyledSystem(config) {
1057
1137
  }
1058
1138
  var SUB_RE = /(?:\[([a-zA-Z][a-zA-Z0-9_-]*)\]|([a-zA-Z][a-zA-Z0-9_-]*))\s*\{([^}]*)\}/g;
1059
1139
  var COMMENT_RE = /\/\/[^\n]*/g;
1060
- function parseTemplate(strings, exprs) {
1140
+ function parseTemplateFallback(strings, exprs) {
1061
1141
  const raw = strings.raw.reduce((acc, str, i) => {
1062
1142
  const expr = exprs[i];
1063
1143
  const exprStr = typeof expr === "function" ? "" : expr ?? "";
@@ -1074,11 +1154,24 @@ function parseTemplate(strings, exprs) {
1074
1154
  base = base.replace(match[0], "");
1075
1155
  }
1076
1156
  const cleanBase = base.replace(COMMENT_RE, "").split("\n").map((l) => l.trim()).filter(Boolean).join(" ").replace(/\s+/g, " ").trim();
1077
- return {
1078
- base: cleanBase,
1079
- subs,
1080
- hasSubs: Object.keys(subs).length > 0
1081
- };
1157
+ return { base: cleanBase, subs, hasSubs: Object.keys(subs).length > 0 };
1158
+ }
1159
+ function parseTemplate(strings, exprs) {
1160
+ const raw = strings.raw.reduce((acc, str, i) => {
1161
+ const expr = exprs[i];
1162
+ const exprStr = typeof expr === "function" ? "" : expr ?? "";
1163
+ return acc + str + String(exprStr);
1164
+ }, "");
1165
+ try {
1166
+ const binding = getNativeBinding();
1167
+ if (binding?.parseTemplate) {
1168
+ const result = binding.parseTemplate(raw);
1169
+ const subs = result.hasSubs ? JSON.parse(result.subsJson) : {};
1170
+ return { base: result.base, subs, hasSubs: result.hasSubs };
1171
+ }
1172
+ } catch {
1173
+ }
1174
+ return parseTemplateFallback(strings, exprs);
1082
1175
  }
1083
1176
  function makeTag(tag) {
1084
1177
  return ((stringsOrConfig, ...exprs) => {