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.
- 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.js +11 -11
- package/dist/animate.js.map +1 -1
- package/dist/animate.mjs +11 -11
- package/dist/animate.mjs.map +1 -1
- package/dist/atomic.js +16 -7
- package/dist/atomic.js.map +1 -1
- package/dist/atomic.mjs +16 -7
- package/dist/atomic.mjs.map +1 -1
- package/dist/cli.js +262 -190
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +259 -187
- package/dist/cli.mjs.map +1 -1
- package/dist/compiler.d.mts +2543 -109
- package/dist/compiler.d.ts +2543 -109
- package/dist/compiler.js +1962 -435
- package/dist/compiler.js.map +1 -1
- package/dist/compiler.mjs +1816 -382
- 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 +1442 -417
- package/dist/engine.js.map +1 -1
- package/dist/engine.mjs +1442 -417
- 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 +6000 -1463
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5995 -1458
- 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 +3197 -1128
- package/dist/next.js.map +1 -1
- package/dist/next.mjs +3196 -1129
- 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 +1627 -376
- package/dist/shared.js.map +1 -1
- package/dist/shared.mjs +1620 -354
- 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 +943 -76
- package/dist/turbopackLoader.js.map +1 -1
- package/dist/turbopackLoader.mjs +943 -76
- package/dist/turbopackLoader.mjs.map +1 -1
- package/dist/tw.js +262 -190
- package/dist/tw.js.map +1 -1
- package/dist/tw.mjs +259 -187
- package/dist/tw.mjs.map +1 -1
- package/dist/vite.js +1336 -296
- package/dist/vite.js.map +1 -1
- package/dist/vite.mjs +1336 -296
- 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 +140 -34
- package/dist/webpackLoader.js.map +1 -1
- package/dist/webpackLoader.mjs +140 -34
- 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);
|
|
@@ -189,42 +189,146 @@ Tried paths: ${result.tried.join("\n")}`);
|
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
191
|
});
|
|
192
|
-
|
|
193
|
-
// packages/domain/compiler/src/index.ts
|
|
194
|
-
init_nativeBridge();
|
|
195
|
-
var transformSource = (source, opts) => {
|
|
192
|
+
function _layoutClassesToCss(classes) {
|
|
196
193
|
const native = getNativeBridge();
|
|
197
|
-
if (!native?.
|
|
198
|
-
throw new Error("FATAL: Native binding '
|
|
194
|
+
if (!native?.layoutClassesToCss) {
|
|
195
|
+
throw new Error("FATAL: Native binding 'layoutClassesToCss' is required but not available.");
|
|
199
196
|
}
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
197
|
+
return native.layoutClassesToCss(classes);
|
|
198
|
+
}
|
|
199
|
+
function _hashContainer(tag, containerJson, name) {
|
|
200
|
+
const sortedKey = tag + (name ?? "") + containerJson;
|
|
201
|
+
const native = getNativeBridge();
|
|
202
|
+
if (!native?.hashContent) {
|
|
203
|
+
throw new Error("FATAL: Native binding 'hashContent' is required but not available.");
|
|
203
204
|
}
|
|
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;
|
|
205
|
+
return `tw-cq-${native.hashContent(sortedKey, "fnv", 6)}`;
|
|
206
|
+
}
|
|
207
|
+
function extractContainerCssFromSource(source) {
|
|
208
|
+
const native = getNativeBridge();
|
|
209
|
+
if (!native?.extractTwContainerConfigs) {
|
|
210
|
+
throw new Error("FATAL: Native binding 'extractTwContainerConfigs' is required but not available.");
|
|
220
211
|
}
|
|
221
|
-
|
|
222
|
-
|
|
212
|
+
const configs = native.extractTwContainerConfigs(source);
|
|
213
|
+
const rules = [];
|
|
214
|
+
for (const cfg of configs) {
|
|
215
|
+
const id = _hashContainer(cfg.tag, cfg.containerJson, cfg.containerName);
|
|
216
|
+
for (const { key, classes } of cfg.breakpoints) {
|
|
217
|
+
const minWidth = _CONTAINER_BREAKPOINTS[key] ?? key;
|
|
218
|
+
const css = _layoutClassesToCss(classes);
|
|
219
|
+
if (!css) continue;
|
|
220
|
+
const query = cfg.containerName ? `@container ${cfg.containerName} (min-width: ${minWidth})` : `@container (min-width: ${minWidth})`;
|
|
221
|
+
rules.push(`${query}{.${id}{${css}}}`);
|
|
222
|
+
}
|
|
223
223
|
}
|
|
224
|
-
return
|
|
225
|
-
}
|
|
226
|
-
var
|
|
227
|
-
|
|
224
|
+
return rules.join("\n");
|
|
225
|
+
}
|
|
226
|
+
var transformSource, _CONTAINER_BREAKPOINTS, runLoaderTransform, shouldSkipFile, registerFileClasses, extractTwStateConfigs, generateStaticStateCss, extractAndGenerateStateCss;
|
|
227
|
+
var init_src2 = __esm({
|
|
228
|
+
"packages/domain/compiler/src/index.ts"() {
|
|
229
|
+
init_nativeBridge();
|
|
230
|
+
transformSource = (source, opts) => {
|
|
231
|
+
const native = getNativeBridge();
|
|
232
|
+
if (!native?.transformSource) {
|
|
233
|
+
throw new Error("FATAL: Native binding 'transformSource' is required but not available.");
|
|
234
|
+
}
|
|
235
|
+
const result = native.transformSource(source, opts);
|
|
236
|
+
if (!result) {
|
|
237
|
+
throw new Error("FATAL: transformSource returned null");
|
|
238
|
+
}
|
|
239
|
+
return result;
|
|
240
|
+
};
|
|
241
|
+
_CONTAINER_BREAKPOINTS = {
|
|
242
|
+
xs: "240px",
|
|
243
|
+
sm: "320px",
|
|
244
|
+
md: "640px",
|
|
245
|
+
lg: "1024px",
|
|
246
|
+
xl: "1280px",
|
|
247
|
+
"2xl": "1536px"
|
|
248
|
+
};
|
|
249
|
+
runLoaderTransform = (ctx) => {
|
|
250
|
+
const { filepath, source, options } = ctx;
|
|
251
|
+
const result = transformSource(source, { filename: filepath, ...options });
|
|
252
|
+
let staticCss;
|
|
253
|
+
try {
|
|
254
|
+
const cssChunks = [];
|
|
255
|
+
const stateRules = extractAndGenerateStateCss(source, filepath);
|
|
256
|
+
if (stateRules.length > 0) {
|
|
257
|
+
cssChunks.push(stateRules.map((r) => r.cssRule).join("\n"));
|
|
258
|
+
}
|
|
259
|
+
const containerCss = extractContainerCssFromSource(source);
|
|
260
|
+
if (containerCss) cssChunks.push(containerCss);
|
|
261
|
+
const combined = cssChunks.join("\n").trim();
|
|
262
|
+
if (combined) staticCss = combined;
|
|
263
|
+
} catch {
|
|
264
|
+
}
|
|
265
|
+
return {
|
|
266
|
+
code: result?.code || "",
|
|
267
|
+
changed: result?.changed || false,
|
|
268
|
+
classes: result?.classes || [],
|
|
269
|
+
staticCss
|
|
270
|
+
};
|
|
271
|
+
};
|
|
272
|
+
shouldSkipFile = (filepath) => {
|
|
273
|
+
const SKIP_PATHS = ["node_modules", ".next", ".rspack-dist", ".turbo", "dist/", "out/"];
|
|
274
|
+
const skipExtensions = [".css", ".json", ".md", ".txt", ".yaml", ".yml"];
|
|
275
|
+
for (const p of SKIP_PATHS) {
|
|
276
|
+
if (filepath.includes(p)) return true;
|
|
277
|
+
}
|
|
278
|
+
for (const ext of skipExtensions) {
|
|
279
|
+
if (filepath.endsWith(ext)) return true;
|
|
280
|
+
}
|
|
281
|
+
return false;
|
|
282
|
+
};
|
|
283
|
+
registerFileClasses = (_filepath, _classes) => {
|
|
284
|
+
};
|
|
285
|
+
extractTwStateConfigs = (source, filename) => {
|
|
286
|
+
const native = getNativeBridge();
|
|
287
|
+
if (!native?.extractTwStateConfigs) {
|
|
288
|
+
throw new Error("FATAL: Native binding 'extractTwStateConfigs' is required but not available.");
|
|
289
|
+
}
|
|
290
|
+
return native.extractTwStateConfigs(source, filename);
|
|
291
|
+
};
|
|
292
|
+
generateStaticStateCss = (inputs, resolvedCss = null) => {
|
|
293
|
+
const native = getNativeBridge();
|
|
294
|
+
if (!native?.generateStaticStateCss) {
|
|
295
|
+
throw new Error("FATAL: Native binding 'generateStaticStateCss' is required but not available.");
|
|
296
|
+
}
|
|
297
|
+
return native.generateStaticStateCss(inputs, resolvedCss);
|
|
298
|
+
};
|
|
299
|
+
extractAndGenerateStateCss = (source, filename) => {
|
|
300
|
+
const native = getNativeBridge();
|
|
301
|
+
if (!native?.extractAndGenerateStateCss) {
|
|
302
|
+
const configs = extractTwStateConfigs(source, filename);
|
|
303
|
+
if (configs.length === 0) return [];
|
|
304
|
+
return generateStaticStateCss(
|
|
305
|
+
configs.map((c) => ({ tag: c.tag, componentName: c.componentName, statesJson: c.statesJson }))
|
|
306
|
+
);
|
|
307
|
+
}
|
|
308
|
+
return native.extractAndGenerateStateCss(source, filename);
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
});
|
|
312
|
+
|
|
313
|
+
// packages/domain/compiler/src/internal.ts
|
|
314
|
+
var init_internal = __esm({
|
|
315
|
+
"packages/domain/compiler/src/internal.ts"() {
|
|
316
|
+
init_src2();
|
|
317
|
+
}
|
|
318
|
+
});
|
|
319
|
+
|
|
320
|
+
// packages/presentation/next/src/webpackLoader.ts
|
|
321
|
+
init_internal();
|
|
322
|
+
var _fileStaticCssMap = /* @__PURE__ */ new Map();
|
|
323
|
+
function setFileStaticCss(filepath, css) {
|
|
324
|
+
if (css && css.trim()) {
|
|
325
|
+
_fileStaticCssMap.set(filepath, css.trim());
|
|
326
|
+
} else {
|
|
327
|
+
_fileStaticCssMap.delete(filepath);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
// packages/presentation/next/src/webpackLoader.ts
|
|
228
332
|
var WebpackLoaderOptionsSchema = z.object({
|
|
229
333
|
mode: z.literal("zero-runtime").optional(),
|
|
230
334
|
autoClientBoundary: z.boolean().optional(),
|
|
@@ -233,7 +337,8 @@ var WebpackLoaderOptionsSchema = z.object({
|
|
|
233
337
|
routeCss: z.boolean().optional(),
|
|
234
338
|
incremental: z.boolean().optional(),
|
|
235
339
|
verbose: z.boolean().optional(),
|
|
236
|
-
preserveImports: z.boolean().optional()
|
|
340
|
+
preserveImports: z.boolean().optional(),
|
|
341
|
+
safelistPath: z.string().optional()
|
|
237
342
|
});
|
|
238
343
|
var isNextBuildArtifact = (filepath) => filepath.includes(`${path__default.sep}.next${path__default.sep}`);
|
|
239
344
|
function webpackLoader(source) {
|
|
@@ -267,6 +372,7 @@ function webpackLoader(source) {
|
|
|
267
372
|
if (typeof output.code !== "string") {
|
|
268
373
|
throw new TypeError(`[tailwind-styled] Invalid transform output for ${filepath}: code is not a string`);
|
|
269
374
|
}
|
|
375
|
+
setFileStaticCss(filepath, output.staticCss);
|
|
270
376
|
if (!output.changed) {
|
|
271
377
|
callback(null, source);
|
|
272
378
|
return;
|