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.
- package/CHANGELOG.md +15 -1
- package/dist/{analyzeWorkspace-DuJKh7Ty.d.mts → analyzeWorkspace-BS5O4rhC.d.mts} +47 -2
- package/dist/{analyzeWorkspace-Ct_NTAWt.d.ts → analyzeWorkspace-DDOQdzzI.d.ts} +47 -2
- package/dist/analyzer.d.mts +5 -3
- package/dist/analyzer.d.ts +5 -3
- package/dist/analyzer.js +563 -468
- package/dist/analyzer.js.map +1 -1
- package/dist/analyzer.mjs +562 -467
- package/dist/analyzer.mjs.map +1 -1
- package/dist/animate.d.mts +4 -7
- package/dist/animate.d.ts +4 -7
- package/dist/animate.js +171 -265
- package/dist/animate.js.map +1 -1
- package/dist/animate.mjs +165 -264
- package/dist/animate.mjs.map +1 -1
- package/dist/atomic.d.mts +22 -1
- package/dist/atomic.d.ts +22 -1
- package/dist/atomic.js +221 -165
- package/dist/atomic.js.map +1 -1
- package/dist/atomic.mjs +200 -165
- package/dist/atomic.mjs.map +1 -1
- package/dist/cli.d.mts +60 -1
- package/dist/cli.d.ts +60 -1
- package/dist/cli.js +1261 -1517
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +1238 -1513
- package/dist/cli.mjs.map +1 -1
- package/dist/compiler.d.mts +38 -7
- package/dist/compiler.d.ts +38 -7
- package/dist/compiler.js +174 -197
- package/dist/compiler.js.map +1 -1
- package/dist/compiler.mjs +151 -194
- package/dist/compiler.mjs.map +1 -1
- package/dist/devtools.js +7 -31
- package/dist/devtools.js.map +1 -1
- package/dist/devtools.mjs +7 -31
- package/dist/devtools.mjs.map +1 -1
- package/dist/engine.d.mts +134 -63
- package/dist/engine.d.ts +134 -63
- package/dist/engine.js +2863 -2482
- package/dist/engine.js.map +1 -1
- package/dist/engine.mjs +2852 -2485
- package/dist/engine.mjs.map +1 -1
- package/dist/{index-eWAocnD2.d.mts → index-NDINUhLN.d.mts} +3 -1
- package/dist/{index-eWAocnD2.d.ts → index-NDINUhLN.d.ts} +3 -1
- package/dist/index.d.mts +45 -32
- package/dist/index.d.ts +45 -32
- package/dist/index.js +271 -158
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +251 -158
- package/dist/index.mjs.map +1 -1
- package/dist/{liveTokenEngine-DSUk88P6.d.ts → liveTokenEngine-CN9ian1R.d.ts} +1 -1
- package/dist/{liveTokenEngine-CX5_0c4q.d.mts → liveTokenEngine-DKoWRtqH.d.mts} +1 -1
- package/dist/next.js +20 -39
- package/dist/next.js.map +1 -1
- package/dist/next.mjs +18 -37
- package/dist/next.mjs.map +1 -1
- package/dist/plugin-api.d.mts +8 -2
- package/dist/plugin-api.d.ts +8 -2
- package/dist/plugin-api.js +14 -2
- package/dist/plugin-api.js.map +1 -1
- package/dist/plugin-api.mjs +14 -3
- package/dist/plugin-api.mjs.map +1 -1
- package/dist/plugin-registry.js +51 -11
- package/dist/plugin-registry.js.map +1 -1
- package/dist/plugin-registry.mjs +51 -11
- package/dist/plugin-registry.mjs.map +1 -1
- package/dist/plugin.d.mts +5 -7
- package/dist/plugin.d.ts +5 -7
- package/dist/plugin.js +16 -15
- package/dist/plugin.js.map +1 -1
- package/dist/plugin.mjs +16 -16
- package/dist/plugin.mjs.map +1 -1
- package/dist/rspack.js +17 -38
- package/dist/rspack.js.map +1 -1
- package/dist/rspack.mjs +15 -36
- package/dist/rspack.mjs.map +1 -1
- package/dist/runtime.d.mts +2 -2
- package/dist/runtime.d.ts +2 -2
- package/dist/scanner.d.mts +10 -1
- package/dist/scanner.d.ts +10 -1
- package/dist/scanner.js +298 -124
- package/dist/scanner.js.map +1 -1
- package/dist/scanner.mjs +296 -124
- package/dist/scanner.mjs.map +1 -1
- package/dist/shared.d.mts +1 -1
- package/dist/shared.d.ts +1 -1
- package/dist/shared.js +104 -176
- package/dist/shared.js.map +1 -1
- package/dist/shared.mjs +85 -176
- package/dist/shared.mjs.map +1 -1
- package/dist/storybook-addon.d.mts +1 -1
- package/dist/storybook-addon.d.ts +1 -1
- package/dist/svelte.d.mts +1 -1
- package/dist/svelte.d.ts +1 -1
- package/dist/svelte.js +166 -3
- package/dist/svelte.js.map +1 -1
- package/dist/svelte.mjs +143 -1
- package/dist/svelte.mjs.map +1 -1
- package/dist/syntax.js +21 -21
- package/dist/syntax.js.map +1 -1
- package/dist/syntax.mjs +21 -21
- package/dist/syntax.mjs.map +1 -1
- package/dist/testing.js +9 -1
- package/dist/testing.js.map +1 -1
- package/dist/testing.mjs +9 -1
- package/dist/testing.mjs.map +1 -1
- package/dist/theme.d.mts +2 -2
- package/dist/theme.d.ts +2 -2
- package/dist/theme.js +40 -112
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs +37 -110
- package/dist/theme.mjs.map +1 -1
- package/dist/turbopackLoader.js +79 -124
- package/dist/turbopackLoader.js.map +1 -1
- package/dist/turbopackLoader.mjs +63 -122
- package/dist/turbopackLoader.mjs.map +1 -1
- package/dist/tw.js +1256 -1517
- package/dist/tw.js.map +1 -1
- package/dist/tw.mjs +1236 -1513
- package/dist/tw.mjs.map +1 -1
- package/dist/vite.js +1783 -823
- package/dist/vite.js.map +1 -1
- package/dist/vite.mjs +1767 -821
- package/dist/vite.mjs.map +1 -1
- package/dist/vue.d.mts +1 -1
- package/dist/vue.d.ts +1 -1
- package/dist/vue.js +165 -4
- package/dist/vue.js.map +1 -1
- package/dist/vue.mjs +141 -1
- package/dist/vue.mjs.map +1 -1
- package/dist/webpackLoader.js +65 -108
- package/dist/webpackLoader.js.map +1 -1
- package/dist/webpackLoader.mjs +45 -104
- package/dist/webpackLoader.mjs.map +1 -1
- package/native/tailwind-styled-native.node +0 -0
- package/package.json +22 -24
package/dist/index.js
CHANGED
|
@@ -1,10 +1,35 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var path = require('path');
|
|
4
|
+
var url = require('url');
|
|
5
|
+
require('crypto');
|
|
6
|
+
var fs = require('fs');
|
|
7
|
+
var module$1 = require('module');
|
|
3
8
|
var React3 = require('react');
|
|
4
|
-
var tailwindMerge = require('tailwind-merge');
|
|
5
9
|
|
|
10
|
+
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
6
11
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
7
12
|
|
|
13
|
+
function _interopNamespace(e) {
|
|
14
|
+
if (e && e.__esModule) return e;
|
|
15
|
+
var n = Object.create(null);
|
|
16
|
+
if (e) {
|
|
17
|
+
Object.keys(e).forEach(function (k) {
|
|
18
|
+
if (k !== 'default') {
|
|
19
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
20
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function () { return e[k]; }
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
n.default = e;
|
|
28
|
+
return Object.freeze(n);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
var path__namespace = /*#__PURE__*/_interopNamespace(path);
|
|
32
|
+
var fs__namespace = /*#__PURE__*/_interopNamespace(fs);
|
|
8
33
|
var React3__default = /*#__PURE__*/_interopDefault(React3);
|
|
9
34
|
|
|
10
35
|
/* tailwind-styled-v4 v5.0.4 | MIT | https://github.com/dictionar32/tailwind-styled-v4 */
|
|
@@ -14,6 +39,119 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
14
39
|
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
15
40
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
16
41
|
});
|
|
42
|
+
var isBrowser = typeof window !== "undefined" || typeof document !== "undefined";
|
|
43
|
+
var _require = typeof __require !== "undefined" ? __require : module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.js', document.baseURI).href)));
|
|
44
|
+
var PLATFORM_MAP = {
|
|
45
|
+
"linux-x64": ["@tailwind-styled/native-linux-x64"],
|
|
46
|
+
"linux-arm64": ["@tailwind-styled/native-linux-arm64"],
|
|
47
|
+
"darwin-x64": ["@tailwind-styled/native-darwin-x64"],
|
|
48
|
+
"darwin-arm64": ["@tailwind-styled/native-darwin-arm64"],
|
|
49
|
+
"win32-x64": ["@tailwind-styled/native-win32-x64"],
|
|
50
|
+
"win32-arm64": ["@tailwind-styled/native-win32-arm64"]
|
|
51
|
+
};
|
|
52
|
+
function platformKey() {
|
|
53
|
+
if (isBrowser) return "browser";
|
|
54
|
+
return `${process.platform}-${process.arch}`;
|
|
55
|
+
}
|
|
56
|
+
function resolveNativeBinary(runtimeDir) {
|
|
57
|
+
const platform = platformKey();
|
|
58
|
+
const tried = [];
|
|
59
|
+
if (isBrowser) {
|
|
60
|
+
return { path: null, source: "not-found", platform, tried: ["not available in browser"] };
|
|
61
|
+
}
|
|
62
|
+
if (process.env.TWS_DISABLE_NATIVE === "1") {
|
|
63
|
+
return { path: null, source: "not-found", platform, tried: [] };
|
|
64
|
+
}
|
|
65
|
+
const envPath = process.env.TW_NATIVE_PATH?.trim();
|
|
66
|
+
if (envPath) {
|
|
67
|
+
if (fs__namespace.existsSync(envPath)) {
|
|
68
|
+
return { path: envPath, source: "env", platform, tried };
|
|
69
|
+
}
|
|
70
|
+
tried.push(`env:${envPath} (not found)`);
|
|
71
|
+
}
|
|
72
|
+
const prebuiltPkgs = PLATFORM_MAP[platform] ?? [];
|
|
73
|
+
for (const pkg of prebuiltPkgs) {
|
|
74
|
+
try {
|
|
75
|
+
const candidate = _require.resolve(`${pkg}/tailwind_styled_parser.node`);
|
|
76
|
+
if (fs__namespace.existsSync(candidate)) {
|
|
77
|
+
return { path: candidate, source: "prebuilt", platform, tried };
|
|
78
|
+
}
|
|
79
|
+
tried.push(`prebuilt:${pkg} (resolved but missing)`);
|
|
80
|
+
} catch {
|
|
81
|
+
tried.push(`prebuilt:${pkg} (not installed)`);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
const cwd = process.cwd();
|
|
85
|
+
const base = runtimeDir ?? cwd;
|
|
86
|
+
const napiPlatform = platform === "linux-x64" ? "linux-x64-gnu" : platform === "linux-arm64" ? "linux-arm64-gnu" : platform;
|
|
87
|
+
const BINARY_NAMES = ["tailwind-styled-native", "tailwind_styled_parser"];
|
|
88
|
+
const localCandidates = [];
|
|
89
|
+
for (const bin of BINARY_NAMES) {
|
|
90
|
+
localCandidates.push(path__namespace.resolve(base, `${bin}.node`));
|
|
91
|
+
localCandidates.push(path__namespace.resolve(base, "..", `${bin}.node`));
|
|
92
|
+
localCandidates.push(path__namespace.resolve(base, `${bin}.${platform}.node`));
|
|
93
|
+
localCandidates.push(path__namespace.resolve(base, `${bin}.${napiPlatform}.node`));
|
|
94
|
+
}
|
|
95
|
+
for (const startDir of [cwd, base]) {
|
|
96
|
+
let dir = startDir;
|
|
97
|
+
for (let i = 0; i < 6; i++) {
|
|
98
|
+
const nativeDir = path__namespace.resolve(dir, "native");
|
|
99
|
+
for (const bin of BINARY_NAMES) {
|
|
100
|
+
localCandidates.push(path__namespace.resolve(nativeDir, `${bin}.node`));
|
|
101
|
+
localCandidates.push(path__namespace.resolve(nativeDir, `${bin}.${platform}.node`));
|
|
102
|
+
localCandidates.push(path__namespace.resolve(nativeDir, `${bin}.${napiPlatform}.node`));
|
|
103
|
+
localCandidates.push(path__namespace.resolve(nativeDir, "target", "release", `${bin}.node`));
|
|
104
|
+
}
|
|
105
|
+
const parent = path__namespace.resolve(dir, "..");
|
|
106
|
+
if (parent === dir) break;
|
|
107
|
+
dir = parent;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
for (const candidate of localCandidates) {
|
|
111
|
+
tried.push(`local:${candidate}`);
|
|
112
|
+
if (fs__namespace.existsSync(candidate)) {
|
|
113
|
+
return { path: candidate, source: "local", platform, tried };
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return { path: null, source: "not-found", platform, tried };
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// packages/domain/shared/src/index.ts
|
|
120
|
+
module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.js', document.baseURI).href)));
|
|
121
|
+
|
|
122
|
+
// packages/domain/core/src/native.ts
|
|
123
|
+
var isBrowser2 = typeof window !== "undefined" || typeof document !== "undefined";
|
|
124
|
+
var NATIVE_UNAVAILABLE_MESSAGE = "[tailwind-styled/core] Native binding is required but not available.\nPlease ensure you have run: npm run build:rust";
|
|
125
|
+
var _loadNative = (path3) => __require(path3);
|
|
126
|
+
var nativeBinding = null;
|
|
127
|
+
var bindingLoadAttempted = false;
|
|
128
|
+
var getBinding = () => {
|
|
129
|
+
if (isBrowser2) {
|
|
130
|
+
throw new Error(NATIVE_UNAVAILABLE_MESSAGE + "\n\nNative bindings are not available in browser. Use the compiled CSS output instead.");
|
|
131
|
+
}
|
|
132
|
+
if (nativeBinding) return nativeBinding;
|
|
133
|
+
if (bindingLoadAttempted) {
|
|
134
|
+
throw new Error(NATIVE_UNAVAILABLE_MESSAGE);
|
|
135
|
+
}
|
|
136
|
+
bindingLoadAttempted = true;
|
|
137
|
+
try {
|
|
138
|
+
const runtimeDir = isBrowser2 ? "" : path.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.js', document.baseURI).href))));
|
|
139
|
+
const result = isBrowser2 ? { path: null, source: "not-found", platform: "browser", tried: [] } : resolveNativeBinary(runtimeDir);
|
|
140
|
+
if (result.path && result.path.endsWith(".node")) {
|
|
141
|
+
const mod = _loadNative(result.path);
|
|
142
|
+
if (mod?.batchSplitClasses) {
|
|
143
|
+
nativeBinding = mod;
|
|
144
|
+
return nativeBinding;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
throw new Error(`${NATIVE_UNAVAILABLE_MESSAGE}
|
|
148
|
+
|
|
149
|
+
Tried: ${result.tried.join("\n")}`);
|
|
150
|
+
} catch (err) {
|
|
151
|
+
throw err instanceof Error ? err : new Error(String(err));
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
var getNativeBinding = getBinding;
|
|
17
155
|
|
|
18
156
|
// packages/domain/core/src/containerQuery.ts
|
|
19
157
|
var CONTAINER_BREAKPOINTS = {
|
|
@@ -85,6 +223,13 @@ var LAYOUT_MAP = {
|
|
|
85
223
|
"justify-end": "justify-content:flex-end"
|
|
86
224
|
};
|
|
87
225
|
function layoutClassesToCss(classes) {
|
|
226
|
+
try {
|
|
227
|
+
const native = getNativeBinding();
|
|
228
|
+
if (native?.layoutClassesToCss) {
|
|
229
|
+
return native.layoutClassesToCss(classes);
|
|
230
|
+
}
|
|
231
|
+
} catch {
|
|
232
|
+
}
|
|
88
233
|
const decls = [];
|
|
89
234
|
for (const cls of classes.trim().split(/\s+/)) {
|
|
90
235
|
if (LAYOUT_MAP[cls]) decls.push(LAYOUT_MAP[cls]);
|
|
@@ -148,18 +293,36 @@ function processContainer(tag, container, containerName) {
|
|
|
148
293
|
}
|
|
149
294
|
function generateContainerCss(tag, container, containerName) {
|
|
150
295
|
const id = hashContainer(tag, container, containerName);
|
|
296
|
+
try {
|
|
297
|
+
const native = getNativeBinding();
|
|
298
|
+
if (native?.buildContainerRules) {
|
|
299
|
+
const breakpoints = Object.entries(container).map(([key, value]) => ({
|
|
300
|
+
key,
|
|
301
|
+
classes: typeof value === "string" ? value : value.classes
|
|
302
|
+
}));
|
|
303
|
+
return native.buildContainerRules(id, breakpoints, containerName ?? null);
|
|
304
|
+
}
|
|
305
|
+
} catch {
|
|
306
|
+
}
|
|
151
307
|
return buildContainerRules(id, container, containerName);
|
|
152
308
|
}
|
|
153
309
|
function getContainerRegistry() {
|
|
154
310
|
return containerRegistry;
|
|
155
311
|
}
|
|
312
|
+
|
|
313
|
+
// packages/domain/core/src/merge.ts
|
|
156
314
|
function normalizeClassInput(classLists) {
|
|
157
315
|
return classLists.filter(Boolean).map((v) => String(v).trim()).filter((v) => v.length > 0);
|
|
158
316
|
}
|
|
159
317
|
function createTwMerge(_options = {}) {
|
|
160
|
-
return function
|
|
318
|
+
return function twMerge2(...classLists) {
|
|
161
319
|
const clean = normalizeClassInput(classLists);
|
|
162
|
-
|
|
320
|
+
if (clean.length === 0) return "";
|
|
321
|
+
const native = getNativeBinding();
|
|
322
|
+
if (!native?.twMergeMany) {
|
|
323
|
+
throw new Error("FATAL: Native binding 'twMergeMany' is required but not available.");
|
|
324
|
+
}
|
|
325
|
+
return native.twMergeMany(clean);
|
|
163
326
|
};
|
|
164
327
|
}
|
|
165
328
|
var twMerge = createTwMerge();
|
|
@@ -182,113 +345,12 @@ function hashState(tag, state) {
|
|
|
182
345
|
const hash = key.split("").reduce((h, char) => (h << 5) + h ^ char.charCodeAt(0), 5381);
|
|
183
346
|
return `tw-s-${Math.abs(hash).toString(36).slice(0, 6)}`;
|
|
184
347
|
}
|
|
185
|
-
var TW_MAP = {
|
|
186
|
-
// Display
|
|
187
|
-
hidden: "display:none",
|
|
188
|
-
block: "display:block",
|
|
189
|
-
flex: "display:flex",
|
|
190
|
-
inline: "display:inline",
|
|
191
|
-
"inline-flex": "display:inline-flex",
|
|
192
|
-
grid: "display:grid",
|
|
193
|
-
// Opacity
|
|
194
|
-
"opacity-0": "opacity:0",
|
|
195
|
-
"opacity-5": "opacity:0.05",
|
|
196
|
-
"opacity-10": "opacity:0.1",
|
|
197
|
-
"opacity-20": "opacity:0.2",
|
|
198
|
-
"opacity-25": "opacity:0.25",
|
|
199
|
-
"opacity-30": "opacity:0.3",
|
|
200
|
-
"opacity-40": "opacity:0.4",
|
|
201
|
-
"opacity-50": "opacity:0.5",
|
|
202
|
-
"opacity-60": "opacity:0.6",
|
|
203
|
-
"opacity-70": "opacity:0.7",
|
|
204
|
-
"opacity-75": "opacity:0.75",
|
|
205
|
-
"opacity-80": "opacity:0.8",
|
|
206
|
-
"opacity-90": "opacity:0.9",
|
|
207
|
-
"opacity-95": "opacity:0.95",
|
|
208
|
-
"opacity-100": "opacity:1",
|
|
209
|
-
// Cursor
|
|
210
|
-
"cursor-pointer": "cursor:pointer",
|
|
211
|
-
"cursor-not-allowed": "cursor:not-allowed",
|
|
212
|
-
"cursor-default": "cursor:default",
|
|
213
|
-
"cursor-wait": "cursor:wait",
|
|
214
|
-
"cursor-move": "cursor:move",
|
|
215
|
-
"cursor-grab": "cursor:grab",
|
|
216
|
-
"cursor-grabbing": "cursor:grabbing",
|
|
217
|
-
// Pointer events
|
|
218
|
-
"pointer-events-none": "pointer-events:none",
|
|
219
|
-
"pointer-events-auto": "pointer-events:auto",
|
|
220
|
-
// Scale
|
|
221
|
-
"scale-90": "transform:scale(0.9)",
|
|
222
|
-
"scale-95": "transform:scale(0.95)",
|
|
223
|
-
"scale-100": "transform:scale(1)",
|
|
224
|
-
"scale-105": "transform:scale(1.05)",
|
|
225
|
-
"scale-110": "transform:scale(1.1)",
|
|
226
|
-
// Translate
|
|
227
|
-
"translate-x-0": "transform:translateX(0)",
|
|
228
|
-
"translate-y-0": "transform:translateY(0)",
|
|
229
|
-
"-translate-x-1": "transform:translateX(-0.25rem)",
|
|
230
|
-
"-translate-y-1": "transform:translateY(-0.25rem)",
|
|
231
|
-
"translate-x-1": "transform:translateX(0.25rem)",
|
|
232
|
-
"translate-y-1": "transform:translateY(0.25rem)",
|
|
233
|
-
// Ring
|
|
234
|
-
ring: "box-shadow:0 0 0 3px rgba(59,130,246,0.5)",
|
|
235
|
-
"ring-2": "box-shadow:0 0 0 2px rgba(59,130,246,0.5)",
|
|
236
|
-
"ring-4": "box-shadow:0 0 0 4px rgba(59,130,246,0.5)",
|
|
237
|
-
"ring-inset": "box-shadow:inset 0 0 0 3px rgba(59,130,246,0.5)",
|
|
238
|
-
// Border
|
|
239
|
-
border: "border-width:1px",
|
|
240
|
-
"border-2": "border-width:2px",
|
|
241
|
-
"border-transparent": "border-color:transparent",
|
|
242
|
-
// Outline
|
|
243
|
-
"outline-none": "outline:2px solid transparent;outline-offset:2px",
|
|
244
|
-
outline: "outline:2px solid currentColor",
|
|
245
|
-
// Overflow
|
|
246
|
-
"overflow-hidden": "overflow:hidden",
|
|
247
|
-
"overflow-auto": "overflow:auto",
|
|
248
|
-
"overflow-scroll": "overflow:scroll",
|
|
249
|
-
// Text decoration
|
|
250
|
-
underline: "text-decoration-line:underline",
|
|
251
|
-
"no-underline": "text-decoration-line:none",
|
|
252
|
-
"line-through": "text-decoration-line:line-through",
|
|
253
|
-
// Font weight
|
|
254
|
-
"font-bold": "font-weight:700",
|
|
255
|
-
"font-semibold": "font-weight:600",
|
|
256
|
-
"font-medium": "font-weight:500",
|
|
257
|
-
"font-normal": "font-weight:400",
|
|
258
|
-
// Background colors (common)
|
|
259
|
-
"bg-transparent": "background-color:transparent",
|
|
260
|
-
"bg-white": "background-color:#fff",
|
|
261
|
-
"bg-black": "background-color:#000",
|
|
262
|
-
"bg-blue-500": "background-color:rgb(59,130,246)",
|
|
263
|
-
"bg-blue-600": "background-color:rgb(37,99,235)",
|
|
264
|
-
"bg-red-500": "background-color:rgb(239,68,68)",
|
|
265
|
-
"bg-green-500": "background-color:rgb(34,197,94)",
|
|
266
|
-
"bg-yellow-500": "background-color:rgb(234,179,8)",
|
|
267
|
-
"bg-zinc-900": "background-color:rgb(24,24,27)",
|
|
268
|
-
"bg-zinc-800": "background-color:rgb(39,39,42)",
|
|
269
|
-
// Text colors
|
|
270
|
-
"text-white": "color:#fff",
|
|
271
|
-
"text-black": "color:#000",
|
|
272
|
-
"text-blue-500": "color:rgb(59,130,246)",
|
|
273
|
-
"text-red-500": "color:rgb(239,68,68)",
|
|
274
|
-
"text-zinc-400": "color:rgb(161,161,170)",
|
|
275
|
-
"text-zinc-500": "color:rgb(113,113,122)"
|
|
276
|
-
};
|
|
277
348
|
function twClassesToCss(classes) {
|
|
278
|
-
const
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
else if (cls.includes("[") && cls.includes("]")) {
|
|
282
|
-
const val = cls.match(/\[(.+)\]/)?.[1];
|
|
283
|
-
if (!val) continue;
|
|
284
|
-
if (cls.startsWith("bg-[")) decls.push(`background-color:${val}`);
|
|
285
|
-
else if (cls.startsWith("text-[")) decls.push(`color:${val}`);
|
|
286
|
-
else if (cls.startsWith("w-[")) decls.push(`width:${val}`);
|
|
287
|
-
else if (cls.startsWith("h-[")) decls.push(`height:${val}`);
|
|
288
|
-
else if (cls.startsWith("opacity-[")) decls.push(`opacity:${val}`);
|
|
289
|
-
}
|
|
349
|
+
const native = getNativeBinding();
|
|
350
|
+
if (!native?.twClassesToCss) {
|
|
351
|
+
throw new Error("FATAL: Native binding 'twClassesToCss' is required but not available.");
|
|
290
352
|
}
|
|
291
|
-
return
|
|
353
|
+
return native.twClassesToCss(classes);
|
|
292
354
|
}
|
|
293
355
|
function injectStateStyles(id, state) {
|
|
294
356
|
if (typeof document === "undefined") return;
|
|
@@ -342,17 +404,23 @@ function getStateRegistry() {
|
|
|
342
404
|
// packages/domain/core/src/createComponent.ts
|
|
343
405
|
var ALWAYS_BLOCKED = /* @__PURE__ */ new Set(["base", "_ref", "state", "container", "containerName"]);
|
|
344
406
|
function parseSubComponentBlocks(template) {
|
|
345
|
-
const
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
while ((m = re.exec(template)) !== null) {
|
|
349
|
-
const name = m[1] ?? m[2];
|
|
350
|
-
const classes = m[3].trim().replace(/\s+/g, " ");
|
|
351
|
-
if (classes) map.set(name, classes);
|
|
407
|
+
const native = getNativeBinding();
|
|
408
|
+
if (!native?.parseSubcomponentBlocksNapi) {
|
|
409
|
+
throw new Error("FATAL: Native binding 'parseSubcomponentBlocksNapi' is required but not available.");
|
|
352
410
|
}
|
|
353
|
-
|
|
411
|
+
const result = native.parseSubcomponentBlocksNapi(template, "tw");
|
|
412
|
+
const raw = JSON.parse(result.subMapJson);
|
|
413
|
+
return new Map(Object.entries(raw));
|
|
354
414
|
}
|
|
355
415
|
function extractBaseClasses(template) {
|
|
416
|
+
try {
|
|
417
|
+
const native = getNativeBinding();
|
|
418
|
+
if (native?.parseSubcomponentBlocksNapi) {
|
|
419
|
+
const result = native.parseSubcomponentBlocksNapi(template, "tw");
|
|
420
|
+
return result.baseClasses;
|
|
421
|
+
}
|
|
422
|
+
} catch {
|
|
423
|
+
}
|
|
356
424
|
return template.replace(/(?:\[[a-zA-Z][a-zA-Z0-9_-]*\]|[a-zA-Z][a-zA-Z0-9_-]*)\s*\{[^}]*\}/g, "").replace(/\s+/g, " ").trim();
|
|
357
425
|
}
|
|
358
426
|
function createSubComponentAccessor(parentDisplayName, name, classes) {
|
|
@@ -398,14 +466,15 @@ function makeFilterProps(variantKeys) {
|
|
|
398
466
|
};
|
|
399
467
|
}
|
|
400
468
|
function resolveVariants(variants, props, defaults) {
|
|
401
|
-
const
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
if (value !== void 0 && variants[key][String(value)]) {
|
|
405
|
-
classes.push(variants[key][String(value)]);
|
|
406
|
-
}
|
|
469
|
+
const binding = getNativeBinding();
|
|
470
|
+
if (!binding?.resolveSimpleVariants) {
|
|
471
|
+
throw new Error("FATAL: Native binding 'resolveSimpleVariants' is required but not available.");
|
|
407
472
|
}
|
|
408
|
-
|
|
473
|
+
const cleanProps = {};
|
|
474
|
+
for (const [k, v] of Object.entries(props)) {
|
|
475
|
+
if (v !== void 0 && v !== null) cleanProps[k] = String(v);
|
|
476
|
+
}
|
|
477
|
+
return binding.resolveSimpleVariants(null, variants, defaults, cleanProps);
|
|
409
478
|
}
|
|
410
479
|
function resolveCompound(compounds, props) {
|
|
411
480
|
const classes = [];
|
|
@@ -568,6 +637,8 @@ function wrapWithSubProxy(component, tagLabel) {
|
|
|
568
637
|
}
|
|
569
638
|
});
|
|
570
639
|
}
|
|
640
|
+
|
|
641
|
+
// packages/domain/core/src/cv.ts
|
|
571
642
|
var __generatedRegistry = {};
|
|
572
643
|
function lookupGenerated(componentId, props, defaultVariants) {
|
|
573
644
|
const table = __generatedRegistry[componentId];
|
|
@@ -576,27 +647,40 @@ function lookupGenerated(componentId, props, defaultVariants) {
|
|
|
576
647
|
const key = Object.keys(merged).sort().filter((k) => k !== "className").map((k) => `${k}:${String(merged[k])}`).join("|");
|
|
577
648
|
return table[key];
|
|
578
649
|
}
|
|
579
|
-
function
|
|
650
|
+
function resolveVariantsNative(config, props) {
|
|
580
651
|
const { base = "", variants = {}, compoundVariants = [], defaultVariants = {} } = config;
|
|
581
|
-
const
|
|
582
|
-
if (
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
if (value !== void 0 && value !== null) {
|
|
587
|
-
const variantClass = variantMap[String(value)];
|
|
588
|
-
if (variantClass) classes.push(...variantClass.split(" ").filter(Boolean));
|
|
652
|
+
const binding = getNativeBinding();
|
|
653
|
+
if (binding?.resolveSimpleVariants) {
|
|
654
|
+
const mergedProps = {};
|
|
655
|
+
for (const [k, v] of Object.entries(defaultVariants)) {
|
|
656
|
+
if (v !== void 0 && v !== null) mergedProps[k] = String(v);
|
|
589
657
|
}
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
if (matches) {
|
|
595
|
-
if (compoundClass) classes.push(...String(compoundClass).split(" ").filter(Boolean));
|
|
596
|
-
if (compoundClassName) classes.push(...String(compoundClassName).split(" ").filter(Boolean));
|
|
658
|
+
for (const [k, v] of Object.entries(props)) {
|
|
659
|
+
if (v !== void 0 && v !== null && k !== "className") {
|
|
660
|
+
mergedProps[k] = String(v);
|
|
661
|
+
}
|
|
597
662
|
}
|
|
663
|
+
let result = binding.resolveSimpleVariants(
|
|
664
|
+
base || null,
|
|
665
|
+
variants,
|
|
666
|
+
{},
|
|
667
|
+
// already merged into mergedProps
|
|
668
|
+
mergedProps
|
|
669
|
+
);
|
|
670
|
+
const resolved = { ...defaultVariants, ...props };
|
|
671
|
+
const extra = [];
|
|
672
|
+
for (const compound of compoundVariants) {
|
|
673
|
+
const { class: compoundClass, className: compoundClassName, ...conditions } = compound;
|
|
674
|
+
const matches = Object.entries(conditions).every(([key, val]) => resolved[key] === val);
|
|
675
|
+
if (matches) {
|
|
676
|
+
if (compoundClass) extra.push(String(compoundClass));
|
|
677
|
+
if (compoundClassName) extra.push(String(compoundClassName));
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
if (extra.length > 0) result = `${result} ${extra.join(" ")}`.trim();
|
|
681
|
+
return result;
|
|
598
682
|
}
|
|
599
|
-
|
|
683
|
+
throw new Error("FATAL: Native binding 'resolveSimpleVariants' is required but not available.");
|
|
600
684
|
}
|
|
601
685
|
function cv(config, componentId) {
|
|
602
686
|
if (process.env.NODE_ENV !== "production") {
|
|
@@ -615,18 +699,34 @@ function cv(config, componentId) {
|
|
|
615
699
|
props,
|
|
616
700
|
config.defaultVariants
|
|
617
701
|
);
|
|
618
|
-
result = generated ??
|
|
702
|
+
result = generated ?? resolveVariantsNative(config, props);
|
|
619
703
|
} else {
|
|
620
|
-
result =
|
|
704
|
+
result = resolveVariantsNative(config, props);
|
|
621
705
|
}
|
|
622
|
-
return props.className ?
|
|
706
|
+
return props.className ? twMerge(result, props.className) : result;
|
|
623
707
|
};
|
|
624
708
|
}
|
|
709
|
+
|
|
710
|
+
// packages/domain/core/src/cx.ts
|
|
625
711
|
function cn(...inputs) {
|
|
626
|
-
|
|
712
|
+
const native = getNativeBinding();
|
|
713
|
+
if (!native?.resolveClassNames) {
|
|
714
|
+
throw new Error("FATAL: Native binding 'resolveClassNames' is required but not available.");
|
|
715
|
+
}
|
|
716
|
+
const strings = inputs.flat().filter(Boolean);
|
|
717
|
+
return native.resolveClassNames(strings);
|
|
627
718
|
}
|
|
628
719
|
function cx(...inputs) {
|
|
629
|
-
|
|
720
|
+
const filtered = inputs.flat().filter(Boolean);
|
|
721
|
+
if (filtered.length === 0) return "";
|
|
722
|
+
const native = getNativeBinding();
|
|
723
|
+
if (!native?.twMergeMany && !native?.twMerge) {
|
|
724
|
+
throw new Error("FATAL: Native binding 'twMerge' or 'twMergeMany' is required but not available.");
|
|
725
|
+
}
|
|
726
|
+
if (native.twMergeMany) {
|
|
727
|
+
return native.twMergeMany(filtered);
|
|
728
|
+
}
|
|
729
|
+
return native.twMerge(filtered.join(" "));
|
|
630
730
|
}
|
|
631
731
|
var cxm = cx;
|
|
632
732
|
var TOKEN_ENGINE_KEY = "__TW_TOKEN_ENGINE__";
|
|
@@ -916,8 +1016,8 @@ function tokenVarRef(prefix, group, name) {
|
|
|
916
1016
|
}
|
|
917
1017
|
function resolveTokenRef(tokens, prefix, value) {
|
|
918
1018
|
if (value.startsWith("token:")) {
|
|
919
|
-
const
|
|
920
|
-
const [group, name] =
|
|
1019
|
+
const path3 = value.slice(6);
|
|
1020
|
+
const [group, name] = path3.split(".");
|
|
921
1021
|
if (group && name && tokens[group]?.[name] !== void 0) {
|
|
922
1022
|
return tokenVarRef(prefix, group, name);
|
|
923
1023
|
}
|
|
@@ -1016,13 +1116,13 @@ function createStyledSystem(config) {
|
|
|
1016
1116
|
return createComponent(runtimeTag, merged);
|
|
1017
1117
|
};
|
|
1018
1118
|
}
|
|
1019
|
-
function token(
|
|
1020
|
-
const [group, name] =
|
|
1021
|
-
if (!group || !name) return
|
|
1119
|
+
function token(path3) {
|
|
1120
|
+
const [group, name] = path3.split(".");
|
|
1121
|
+
if (!group || !name) return path3;
|
|
1022
1122
|
return tokenVarRef(prefix, group, name);
|
|
1023
1123
|
}
|
|
1024
|
-
function rawToken(
|
|
1025
|
-
const [group, name] =
|
|
1124
|
+
function rawToken(path3) {
|
|
1125
|
+
const [group, name] = path3.split(".");
|
|
1026
1126
|
if (!group || !name) return void 0;
|
|
1027
1127
|
return tokens[group]?.[name];
|
|
1028
1128
|
}
|
|
@@ -1063,7 +1163,7 @@ function createStyledSystem(config) {
|
|
|
1063
1163
|
}
|
|
1064
1164
|
var SUB_RE = /(?:\[([a-zA-Z][a-zA-Z0-9_-]*)\]|([a-zA-Z][a-zA-Z0-9_-]*))\s*\{([^}]*)\}/g;
|
|
1065
1165
|
var COMMENT_RE = /\/\/[^\n]*/g;
|
|
1066
|
-
function
|
|
1166
|
+
function parseTemplateFallback(strings, exprs) {
|
|
1067
1167
|
const raw = strings.raw.reduce((acc, str, i) => {
|
|
1068
1168
|
const expr = exprs[i];
|
|
1069
1169
|
const exprStr = typeof expr === "function" ? "" : expr ?? "";
|
|
@@ -1080,11 +1180,24 @@ function parseTemplate(strings, exprs) {
|
|
|
1080
1180
|
base = base.replace(match[0], "");
|
|
1081
1181
|
}
|
|
1082
1182
|
const cleanBase = base.replace(COMMENT_RE, "").split("\n").map((l) => l.trim()).filter(Boolean).join(" ").replace(/\s+/g, " ").trim();
|
|
1083
|
-
return {
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1183
|
+
return { base: cleanBase, subs, hasSubs: Object.keys(subs).length > 0 };
|
|
1184
|
+
}
|
|
1185
|
+
function parseTemplate(strings, exprs) {
|
|
1186
|
+
const raw = strings.raw.reduce((acc, str, i) => {
|
|
1187
|
+
const expr = exprs[i];
|
|
1188
|
+
const exprStr = typeof expr === "function" ? "" : expr ?? "";
|
|
1189
|
+
return acc + str + String(exprStr);
|
|
1190
|
+
}, "");
|
|
1191
|
+
try {
|
|
1192
|
+
const binding = getNativeBinding();
|
|
1193
|
+
if (binding?.parseTemplate) {
|
|
1194
|
+
const result = binding.parseTemplate(raw);
|
|
1195
|
+
const subs = result.hasSubs ? JSON.parse(result.subsJson) : {};
|
|
1196
|
+
return { base: result.base, subs, hasSubs: result.hasSubs };
|
|
1197
|
+
}
|
|
1198
|
+
} catch {
|
|
1199
|
+
}
|
|
1200
|
+
return parseTemplateFallback(strings, exprs);
|
|
1088
1201
|
}
|
|
1089
1202
|
function makeTag(tag) {
|
|
1090
1203
|
return ((stringsOrConfig, ...exprs) => {
|