tailwind-styled-v4 5.0.11 → 5.0.13
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/README.md +100 -4
- package/dist/{analyzeWorkspace-DDOQdzzI.d.ts → analyzeWorkspace-CopJNGmi.d.ts} +2 -0
- package/dist/{analyzeWorkspace-BS5O4rhC.d.mts → analyzeWorkspace-DpVPccjz.d.mts} +2 -0
- package/dist/analyzer.d.mts +4 -4
- package/dist/analyzer.d.ts +4 -4
- package/dist/analyzer.js +34 -69
- package/dist/analyzer.js.map +1 -1
- package/dist/analyzer.mjs +33 -68
- package/dist/analyzer.mjs.map +1 -1
- package/dist/animate.d.mts +4 -0
- package/dist/animate.d.ts +4 -0
- package/dist/animate.js +33 -11
- package/dist/animate.js.map +1 -1
- package/dist/animate.mjs +33 -11
- package/dist/animate.mjs.map +1 -1
- package/dist/atomic.js +57 -6
- package/dist/atomic.js.map +1 -1
- package/dist/atomic.mjs +57 -6
- package/dist/atomic.mjs.map +1 -1
- package/dist/cli.js +404 -190
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +401 -187
- package/dist/cli.mjs.map +1 -1
- package/dist/compiler.d.mts +2700 -212
- package/dist/compiler.d.ts +2700 -212
- package/dist/compiler.js +1996 -503
- package/dist/compiler.js.map +1 -1
- package/dist/compiler.mjs +1847 -448
- package/dist/compiler.mjs.map +1 -1
- package/dist/devtools.js +17 -4
- package/dist/devtools.js.map +1 -1
- package/dist/devtools.mjs +17 -4
- package/dist/devtools.mjs.map +1 -1
- package/dist/engine.d.mts +11 -470
- package/dist/engine.d.ts +11 -470
- package/dist/engine.js +2777 -455
- package/dist/engine.js.map +1 -1
- package/dist/engine.mjs +2776 -454
- package/dist/engine.mjs.map +1 -1
- package/dist/index-BDQw13kn.d.ts +464 -0
- package/dist/index-DJv28Uzq.d.mts +464 -0
- package/dist/index.browser.mjs +143 -255
- package/dist/index.browser.mjs.map +1 -1
- package/dist/index.d.mts +23 -39
- package/dist/index.d.ts +23 -39
- package/dist/index.js +7234 -1400
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7234 -1400
- package/dist/index.mjs.map +1 -1
- package/dist/next.d.mts +44 -1
- package/dist/next.d.ts +44 -1
- package/dist/next.js +3224 -1065
- package/dist/next.js.map +1 -1
- package/dist/next.mjs +3223 -1066
- package/dist/next.mjs.map +1 -1
- package/dist/rspack.d.mts +9 -0
- package/dist/rspack.d.ts +9 -0
- package/dist/rspack.js +99 -61
- package/dist/rspack.js.map +1 -1
- package/dist/rspack.mjs +99 -61
- package/dist/rspack.mjs.map +1 -1
- package/dist/runtime-css.d.mts +8 -0
- package/dist/runtime-css.d.ts +8 -0
- package/dist/runtime-css.js +23 -7
- package/dist/runtime-css.js.map +1 -1
- package/dist/runtime-css.mjs +23 -7
- package/dist/runtime-css.mjs.map +1 -1
- package/dist/scanner.js +16 -37
- package/dist/scanner.js.map +1 -1
- package/dist/scanner.mjs +15 -36
- package/dist/scanner.mjs.map +1 -1
- package/dist/shared.d.mts +107 -1
- package/dist/shared.d.ts +107 -1
- package/dist/shared.js +3014 -466
- package/dist/shared.js.map +1 -1
- package/dist/shared.mjs +3008 -445
- package/dist/shared.mjs.map +1 -1
- package/dist/svelte.js +39 -35
- package/dist/svelte.js.map +1 -1
- package/dist/svelte.mjs +38 -34
- package/dist/svelte.mjs.map +1 -1
- package/dist/theme.js +85 -76
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs +83 -74
- package/dist/theme.mjs.map +1 -1
- package/dist/turbopackLoader.js +2351 -187
- package/dist/turbopackLoader.js.map +1 -1
- package/dist/turbopackLoader.mjs +2351 -187
- package/dist/turbopackLoader.mjs.map +1 -1
- package/dist/tw.js +404 -190
- package/dist/tw.js.map +1 -1
- package/dist/tw.mjs +401 -187
- package/dist/tw.mjs.map +1 -1
- package/dist/vite.js +2657 -320
- package/dist/vite.js.map +1 -1
- package/dist/vite.mjs +2657 -320
- package/dist/vite.mjs.map +1 -1
- package/dist/vue.js +39 -35
- package/dist/vue.js.map +1 -1
- package/dist/vue.mjs +38 -34
- package/dist/vue.mjs.map +1 -1
- package/dist/webpackLoader.js +190 -33
- package/dist/webpackLoader.js.map +1 -1
- package/dist/webpackLoader.mjs +190 -33
- package/dist/webpackLoader.mjs.map +1 -1
- package/native/index.node +0 -0
- package/native/tailwind-styled-native.node +0 -0
- package/native/tailwind-styled-native.win32-x64-msvc.node +0 -0
- package/package.json +9 -4
- package/CHANGELOG.md +0 -285
package/dist/webpackLoader.mjs
CHANGED
|
@@ -27,7 +27,7 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
27
27
|
if (isBrowser) {
|
|
28
28
|
return { path: null, source: "not-found", platform, tried: ["not available in browser"] };
|
|
29
29
|
}
|
|
30
|
-
if (process.env.TWS_DISABLE_NATIVE === "1") {
|
|
30
|
+
if (process.env.TWS_NO_NATIVE === "1" || process.env.TWS_DISABLE_NATIVE === "1") {
|
|
31
31
|
return { path: null, source: "not-found", platform, tried: [] };
|
|
32
32
|
}
|
|
33
33
|
const envPath = process.env.TW_NATIVE_PATH?.trim();
|
|
@@ -132,7 +132,7 @@ var _loadNative, log, NATIVE_UNAVAILABLE_MESSAGE, nativeBridge, bridgeLoadAttemp
|
|
|
132
132
|
var init_nativeBridge = __esm({
|
|
133
133
|
"packages/domain/compiler/src/nativeBridge.ts"() {
|
|
134
134
|
init_src();
|
|
135
|
-
_loadNative = (
|
|
135
|
+
_loadNative = (path6) => __require(path6);
|
|
136
136
|
log = (...args) => {
|
|
137
137
|
if (process.env.DEBUG?.includes("compiler:native")) {
|
|
138
138
|
console.log("[compiler:native]", ...args);
|
|
@@ -190,41 +190,196 @@ Tried paths: ${result.tried.join("\n")}`);
|
|
|
190
190
|
}
|
|
191
191
|
});
|
|
192
192
|
|
|
193
|
-
// packages/domain/compiler/src/index.ts
|
|
194
|
-
|
|
195
|
-
|
|
193
|
+
// packages/domain/compiler/src/compiler/index.ts
|
|
194
|
+
var init_compiler = __esm({
|
|
195
|
+
"packages/domain/compiler/src/compiler/index.ts"() {
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
// packages/domain/compiler/src/parser/index.ts
|
|
200
|
+
var init_parser = __esm({
|
|
201
|
+
"packages/domain/compiler/src/parser/index.ts"() {
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
// packages/domain/compiler/src/analyzer/index.ts
|
|
206
|
+
var init_analyzer = __esm({
|
|
207
|
+
"packages/domain/compiler/src/analyzer/index.ts"() {
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
// packages/domain/compiler/src/cache/index.ts
|
|
212
|
+
var init_cache = __esm({
|
|
213
|
+
"packages/domain/compiler/src/cache/index.ts"() {
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
// packages/domain/compiler/src/redis/index.ts
|
|
218
|
+
var init_redis = __esm({
|
|
219
|
+
"packages/domain/compiler/src/redis/index.ts"() {
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
// packages/domain/compiler/src/watch/index.ts
|
|
224
|
+
var init_watch = __esm({
|
|
225
|
+
"packages/domain/compiler/src/watch/index.ts"() {
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
function _layoutClassesToCss(classes) {
|
|
196
229
|
const native = getNativeBridge();
|
|
197
|
-
if (!native?.
|
|
198
|
-
throw new Error("FATAL: Native binding '
|
|
230
|
+
if (!native?.layoutClassesToCss) {
|
|
231
|
+
throw new Error("FATAL: Native binding 'layoutClassesToCss' is required but not available.");
|
|
199
232
|
}
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
233
|
+
return native.layoutClassesToCss(classes);
|
|
234
|
+
}
|
|
235
|
+
function _hashContainer(tag, containerJson, name) {
|
|
236
|
+
const sortedKey = tag + (name ?? "") + containerJson;
|
|
237
|
+
const native = getNativeBridge();
|
|
238
|
+
if (!native?.hashContent) {
|
|
239
|
+
throw new Error("FATAL: Native binding 'hashContent' is required but not available.");
|
|
203
240
|
}
|
|
204
|
-
return
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
const
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
code: result?.code || "",
|
|
211
|
-
changed: result?.changed || false,
|
|
212
|
-
classes: result?.classes || []
|
|
213
|
-
};
|
|
214
|
-
};
|
|
215
|
-
var shouldSkipFile = (filepath) => {
|
|
216
|
-
const SKIP_PATHS = ["node_modules", ".next", ".rspack-dist", ".turbo", "dist/", "out/"];
|
|
217
|
-
const skipExtensions = [".css", ".json", ".md", ".txt", ".yaml", ".yml"];
|
|
218
|
-
for (const p of SKIP_PATHS) {
|
|
219
|
-
if (filepath.includes(p)) return true;
|
|
241
|
+
return `tw-cq-${native.hashContent(sortedKey, "fnv", 6)}`;
|
|
242
|
+
}
|
|
243
|
+
function extractContainerCssFromSource(source) {
|
|
244
|
+
const native = getNativeBridge();
|
|
245
|
+
if (!native?.extractTwContainerConfigs) {
|
|
246
|
+
throw new Error("FATAL: Native binding 'extractTwContainerConfigs' is required but not available.");
|
|
220
247
|
}
|
|
221
|
-
|
|
222
|
-
|
|
248
|
+
const configs = native.extractTwContainerConfigs(source);
|
|
249
|
+
const rules = [];
|
|
250
|
+
for (const cfg of configs) {
|
|
251
|
+
const id = _hashContainer(cfg.tag, cfg.containerJson, cfg.containerName);
|
|
252
|
+
for (const { key, classes } of cfg.breakpoints) {
|
|
253
|
+
const minWidth = _CONTAINER_BREAKPOINTS[key] ?? key;
|
|
254
|
+
const css = _layoutClassesToCss(classes);
|
|
255
|
+
if (!css) continue;
|
|
256
|
+
const query = cfg.containerName ? `@container ${cfg.containerName} (min-width: ${minWidth})` : `@container (min-width: ${minWidth})`;
|
|
257
|
+
rules.push(`${query}{.${id}{${css}}}`);
|
|
258
|
+
}
|
|
223
259
|
}
|
|
224
|
-
return
|
|
225
|
-
}
|
|
226
|
-
var
|
|
227
|
-
|
|
260
|
+
return rules.join("\n");
|
|
261
|
+
}
|
|
262
|
+
var transformSource, _CONTAINER_BREAKPOINTS, runLoaderTransform, shouldSkipFile, registerFileClasses, extractTwStateConfigs, generateStaticStateCss, extractAndGenerateStateCss;
|
|
263
|
+
var init_src2 = __esm({
|
|
264
|
+
"packages/domain/compiler/src/index.ts"() {
|
|
265
|
+
init_nativeBridge();
|
|
266
|
+
init_compiler();
|
|
267
|
+
init_parser();
|
|
268
|
+
init_analyzer();
|
|
269
|
+
init_cache();
|
|
270
|
+
init_redis();
|
|
271
|
+
init_watch();
|
|
272
|
+
transformSource = (source, opts) => {
|
|
273
|
+
const native = getNativeBridge();
|
|
274
|
+
if (!native?.transformSource) {
|
|
275
|
+
throw new Error("FATAL: Native binding 'transformSource' is required but not available.");
|
|
276
|
+
}
|
|
277
|
+
const result = native.transformSource(source, opts);
|
|
278
|
+
if (!result) {
|
|
279
|
+
throw new Error("FATAL: transformSource returned null");
|
|
280
|
+
}
|
|
281
|
+
return result;
|
|
282
|
+
};
|
|
283
|
+
_CONTAINER_BREAKPOINTS = {
|
|
284
|
+
xs: "240px",
|
|
285
|
+
sm: "320px",
|
|
286
|
+
md: "640px",
|
|
287
|
+
lg: "1024px",
|
|
288
|
+
xl: "1280px",
|
|
289
|
+
"2xl": "1536px"
|
|
290
|
+
};
|
|
291
|
+
runLoaderTransform = (ctx) => {
|
|
292
|
+
const { filepath, source, options } = ctx;
|
|
293
|
+
const result = transformSource(source, { filename: filepath, ...options });
|
|
294
|
+
let staticCss;
|
|
295
|
+
try {
|
|
296
|
+
const cssChunks = [];
|
|
297
|
+
const stateRules = extractAndGenerateStateCss(source, filepath);
|
|
298
|
+
if (stateRules.length > 0) {
|
|
299
|
+
cssChunks.push(stateRules.map((r) => r.cssRule).join("\n"));
|
|
300
|
+
}
|
|
301
|
+
const containerCss = extractContainerCssFromSource(source);
|
|
302
|
+
if (containerCss) cssChunks.push(containerCss);
|
|
303
|
+
const combined = cssChunks.join("\n").trim();
|
|
304
|
+
if (combined) staticCss = combined;
|
|
305
|
+
} catch (err) {
|
|
306
|
+
console.debug("Static CSS extraction warning:", err);
|
|
307
|
+
}
|
|
308
|
+
return {
|
|
309
|
+
code: result?.code || "",
|
|
310
|
+
changed: result?.changed || false,
|
|
311
|
+
classes: result?.classes || [],
|
|
312
|
+
staticCss
|
|
313
|
+
};
|
|
314
|
+
};
|
|
315
|
+
shouldSkipFile = (filepath) => {
|
|
316
|
+
const SKIP_PATHS = ["node_modules", ".next", ".rspack-dist", ".turbo", "dist/", "out/"];
|
|
317
|
+
const skipExtensions = [".css", ".json", ".md", ".txt", ".yaml", ".yml"];
|
|
318
|
+
for (const p of SKIP_PATHS) {
|
|
319
|
+
if (filepath.includes(p)) return true;
|
|
320
|
+
}
|
|
321
|
+
for (const ext of skipExtensions) {
|
|
322
|
+
if (filepath.endsWith(ext)) return true;
|
|
323
|
+
}
|
|
324
|
+
return false;
|
|
325
|
+
};
|
|
326
|
+
registerFileClasses = (_filepath, _classes) => {
|
|
327
|
+
};
|
|
328
|
+
extractTwStateConfigs = (source, filename) => {
|
|
329
|
+
const native = getNativeBridge();
|
|
330
|
+
if (!native?.extractTwStateConfigs) {
|
|
331
|
+
throw new Error("FATAL: Native binding 'extractTwStateConfigs' is required but not available.");
|
|
332
|
+
}
|
|
333
|
+
return native.extractTwStateConfigs(source, filename);
|
|
334
|
+
};
|
|
335
|
+
generateStaticStateCss = (entries, _themeConfig) => {
|
|
336
|
+
const rules = [];
|
|
337
|
+
for (const entry of entries) {
|
|
338
|
+
const stateConfig = JSON.parse(entry.statesJson);
|
|
339
|
+
for (const [stateName, classes] of Object.entries(stateConfig)) {
|
|
340
|
+
rules.push({
|
|
341
|
+
selector: `.${entry.componentName}[data-state="${stateName}"]`,
|
|
342
|
+
declarations: classes,
|
|
343
|
+
cssRule: `.${entry.componentName}[data-state="${stateName}"]{${classes}}`,
|
|
344
|
+
componentName: entry.componentName,
|
|
345
|
+
stateName
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
return rules;
|
|
350
|
+
};
|
|
351
|
+
extractAndGenerateStateCss = (source, filename) => {
|
|
352
|
+
const entries = extractTwStateConfigs(source, filename);
|
|
353
|
+
return generateStaticStateCss(entries);
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
});
|
|
357
|
+
|
|
358
|
+
// packages/domain/compiler/src/internal.ts
|
|
359
|
+
var init_internal = __esm({
|
|
360
|
+
"packages/domain/compiler/src/internal.ts"() {
|
|
361
|
+
init_src2();
|
|
362
|
+
init_compiler();
|
|
363
|
+
init_parser();
|
|
364
|
+
init_analyzer();
|
|
365
|
+
init_cache();
|
|
366
|
+
init_redis();
|
|
367
|
+
init_watch();
|
|
368
|
+
}
|
|
369
|
+
});
|
|
370
|
+
|
|
371
|
+
// packages/presentation/next/src/webpackLoader.ts
|
|
372
|
+
init_internal();
|
|
373
|
+
var _fileStaticCssMap = /* @__PURE__ */ new Map();
|
|
374
|
+
function setFileStaticCss(filepath, css) {
|
|
375
|
+
if (css && css.trim()) {
|
|
376
|
+
_fileStaticCssMap.set(filepath, css.trim());
|
|
377
|
+
} else {
|
|
378
|
+
_fileStaticCssMap.delete(filepath);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
// packages/presentation/next/src/webpackLoader.ts
|
|
228
383
|
var WebpackLoaderOptionsSchema = z.object({
|
|
229
384
|
mode: z.literal("zero-runtime").optional(),
|
|
230
385
|
autoClientBoundary: z.boolean().optional(),
|
|
@@ -233,7 +388,8 @@ var WebpackLoaderOptionsSchema = z.object({
|
|
|
233
388
|
routeCss: z.boolean().optional(),
|
|
234
389
|
incremental: z.boolean().optional(),
|
|
235
390
|
verbose: z.boolean().optional(),
|
|
236
|
-
preserveImports: z.boolean().optional()
|
|
391
|
+
preserveImports: z.boolean().optional(),
|
|
392
|
+
safelistPath: z.string().optional()
|
|
237
393
|
});
|
|
238
394
|
var isNextBuildArtifact = (filepath) => filepath.includes(`${path__default.sep}.next${path__default.sep}`);
|
|
239
395
|
function webpackLoader(source) {
|
|
@@ -267,6 +423,7 @@ function webpackLoader(source) {
|
|
|
267
423
|
if (typeof output.code !== "string") {
|
|
268
424
|
throw new TypeError(`[tailwind-styled] Invalid transform output for ${filepath}: code is not a string`);
|
|
269
425
|
}
|
|
426
|
+
setFileStaticCss(filepath, output.staticCss);
|
|
270
427
|
if (!output.changed) {
|
|
271
428
|
callback(null, source);
|
|
272
429
|
return;
|