tailwind-styled-v4 5.0.18 → 5.0.20

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 (66) hide show
  1. package/dist/{analyzeWorkspace-CopJNGmi.d.ts → analyzeWorkspace-B1_XRfdl.d.ts} +1 -0
  2. package/dist/{analyzeWorkspace-DpVPccjz.d.mts → analyzeWorkspace-hYfu4Hg3.d.mts} +1 -0
  3. package/dist/analyzer.d.mts +2 -2
  4. package/dist/analyzer.d.ts +2 -2
  5. package/dist/analyzer.js +5 -4
  6. package/dist/analyzer.js.map +1 -1
  7. package/dist/analyzer.mjs +5 -4
  8. package/dist/analyzer.mjs.map +1 -1
  9. package/dist/animate.js +3 -3
  10. package/dist/animate.js.map +1 -1
  11. package/dist/animate.mjs +3 -3
  12. package/dist/animate.mjs.map +1 -1
  13. package/dist/atomic.js +38 -2
  14. package/dist/atomic.js.map +1 -1
  15. package/dist/atomic.mjs +38 -2
  16. package/dist/atomic.mjs.map +1 -1
  17. package/dist/cli.js +43 -6
  18. package/dist/cli.js.map +1 -1
  19. package/dist/cli.mjs +43 -6
  20. package/dist/cli.mjs.map +1 -1
  21. package/dist/compiler.d.mts +177 -2
  22. package/dist/compiler.d.ts +177 -2
  23. package/dist/compiler.js +172 -10
  24. package/dist/compiler.js.map +1 -1
  25. package/dist/compiler.mjs +159 -11
  26. package/dist/compiler.mjs.map +1 -1
  27. package/dist/engine.d.mts +3 -3
  28. package/dist/engine.d.ts +3 -3
  29. package/dist/engine.js +177 -13
  30. package/dist/engine.js.map +1 -1
  31. package/dist/engine.mjs +177 -13
  32. package/dist/engine.mjs.map +1 -1
  33. package/dist/{index-DJv28Uzq.d.mts → index-DQI6O24n.d.mts} +1 -1
  34. package/dist/{index-BDQw13kn.d.ts → index-UkYbyBkR.d.ts} +1 -1
  35. package/dist/index.d.mts +2 -2
  36. package/dist/index.d.ts +2 -2
  37. package/dist/index.js +177 -13
  38. package/dist/index.js.map +1 -1
  39. package/dist/index.mjs +177 -13
  40. package/dist/index.mjs.map +1 -1
  41. package/dist/next.js +188 -10
  42. package/dist/next.js.map +1 -1
  43. package/dist/next.mjs +188 -10
  44. package/dist/next.mjs.map +1 -1
  45. package/dist/shared.js +172 -9
  46. package/dist/shared.js.map +1 -1
  47. package/dist/shared.mjs +172 -9
  48. package/dist/shared.mjs.map +1 -1
  49. package/dist/turbopackLoader.js +172 -9
  50. package/dist/turbopackLoader.js.map +1 -1
  51. package/dist/turbopackLoader.mjs +172 -9
  52. package/dist/turbopackLoader.mjs.map +1 -1
  53. package/dist/tw.js +43 -6
  54. package/dist/tw.js.map +1 -1
  55. package/dist/tw.mjs +43 -6
  56. package/dist/tw.mjs.map +1 -1
  57. package/dist/vite.js +310 -146
  58. package/dist/vite.js.map +1 -1
  59. package/dist/vite.mjs +310 -146
  60. package/dist/vite.mjs.map +1 -1
  61. package/dist/webpackLoader.js +38 -2
  62. package/dist/webpackLoader.js.map +1 -1
  63. package/dist/webpackLoader.mjs +38 -2
  64. package/dist/webpackLoader.mjs.map +1 -1
  65. package/native/tailwind-styled-native.node +0 -0
  66. package/package.json +1 -1
@@ -202,8 +202,44 @@ var init_nativeBridge = __esm({
202
202
  try {
203
203
  const binding = _loadNative(result.path);
204
204
  if (isValidNativeBridge(binding)) {
205
- nativeBridge = binding;
206
- log("Native bridge loaded successfully from:", result.path);
205
+ const toCamelCase = (str) => {
206
+ return str.replace(/_([a-z0-9])/g, (_, g) => g.toUpperCase());
207
+ };
208
+ nativeBridge = new Proxy(binding, {
209
+ get(target, prop) {
210
+ if (typeof prop === "string") {
211
+ if (prop in target) {
212
+ return target[prop];
213
+ }
214
+ const camelKey = toCamelCase(prop);
215
+ if (camelKey in target) {
216
+ const val = target[camelKey];
217
+ if (typeof val === "function") {
218
+ return val.bind(target);
219
+ }
220
+ return val;
221
+ }
222
+ const napiKey = `${camelKey}Napi`;
223
+ if (napiKey in target) {
224
+ const val = target[napiKey];
225
+ if (typeof val === "function") {
226
+ return val.bind(target);
227
+ }
228
+ return val;
229
+ }
230
+ const napiInnerKey = `${camelKey}NapiInner`;
231
+ if (napiInnerKey in target) {
232
+ const val = target[napiInnerKey];
233
+ if (typeof val === "function") {
234
+ return val.bind(target);
235
+ }
236
+ return val;
237
+ }
238
+ }
239
+ return target[prop];
240
+ }
241
+ });
242
+ log("Native bridge loaded successfully and proxy-wrapped from:", result.path);
207
243
  return nativeBridge;
208
244
  }
209
245
  } catch (e) {
@@ -251,8 +287,8 @@ async function generateCssNative(classes, options) {
251
287
  return css;
252
288
  }
253
289
  function clearThemeCache() {
290
+ const native = getNativeBridge();
254
291
  try {
255
- const native = getNativeBridge();
256
292
  if (!native?.clearThemeCache) {
257
293
  return;
258
294
  }
@@ -260,6 +296,16 @@ function clearThemeCache() {
260
296
  } catch {
261
297
  }
262
298
  }
299
+ function resetCacheStats() {
300
+ const native = getNativeBridge();
301
+ try {
302
+ if (!native?.resetCacheStats) {
303
+ return;
304
+ }
305
+ native.resetCacheStats();
306
+ } catch {
307
+ }
308
+ }
263
309
  var init_cssGeneratorNative = __esm({
264
310
  "packages/domain/compiler/src/compiler/cssGeneratorNative.ts"() {
265
311
  init_nativeBridge();
@@ -385,6 +431,16 @@ function minifyCss(css) {
385
431
  if (!native?.minify_css) throw new Error("minify_css not available");
386
432
  return native.minify_css(css);
387
433
  }
434
+ function generateCss(ruleJson, minify) {
435
+ const native = getNativeBridge();
436
+ if (!native?.generate_css) throw new Error("generate_css not available");
437
+ return native.generate_css(ruleJson, minify);
438
+ }
439
+ function generateCssBatch(rulesJson, minify) {
440
+ const native = getNativeBridge();
441
+ if (!native?.generate_css_batch) throw new Error("generate_css_batch not available");
442
+ return native.generate_css_batch(rulesJson, minify);
443
+ }
388
444
  function compileAnimation(animationName, from, to) {
389
445
  const native = getNativeBridge();
390
446
  if (!native?.compile_animation) throw new Error("compile_animation not available");
@@ -822,7 +878,7 @@ function postProcessWithLightning(rawCss) {
822
878
  }
823
879
  return result.css;
824
880
  }
825
- async function runCssPipeline(classes, cssEntryContent, root, minify = true) {
881
+ async function runCssPipeline(classes, cssEntryContent, root, minify = true, minifier = "lightning") {
826
882
  const filtered = classes.filter(Boolean);
827
883
  const uniqueMap = /* @__PURE__ */ new Map();
828
884
  filtered.forEach((cls) => uniqueMap.set(cls, cls));
@@ -830,7 +886,7 @@ async function runCssPipeline(classes, cssEntryContent, root, minify = true) {
830
886
  if (unique.length === 0) {
831
887
  return { css: "", classes: [], sizeBytes: 0, optimized: false };
832
888
  }
833
- const cacheKey = _getCacheKey(unique, minify, cssEntryContent, root);
889
+ const cacheKey = _getCacheKey(unique, minify, cssEntryContent, root) + `|${minifier}`;
834
890
  const cached = _cssCache.get(cacheKey);
835
891
  if (cached) {
836
892
  _cacheHits++;
@@ -847,7 +903,14 @@ async function runCssPipeline(classes, cssEntryContent, root, minify = true) {
847
903
  const theme = getThemeConfig();
848
904
  rawCss = await generateCssNative(unique, { theme });
849
905
  usedRustCompiler = true;
850
- const finalCss = minify ? postProcessWithLightning(rawCss) : rawCss;
906
+ let finalCss = rawCss;
907
+ if (minify) {
908
+ if (minifier === "fast") {
909
+ finalCss = minifyCss(rawCss);
910
+ } else {
911
+ finalCss = postProcessWithLightning(rawCss);
912
+ }
913
+ }
851
914
  if (process.env.DEBUG?.includes("compiler")) {
852
915
  console.log(
853
916
  `[Compiler] Generated CSS from ${unique.length} classes (${usedRustCompiler ? "Rust" : "JavaScript"})`,
@@ -883,6 +946,7 @@ var init_tailwindEngine = __esm({
883
946
  "packages/domain/compiler/src/compiler/tailwindEngine.ts"() {
884
947
  init_nativeBridge();
885
948
  init_cssGeneratorNative();
949
+ init_cssCompilationNative();
886
950
  module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('turbopackLoader.js', document.baseURI).href)));
887
951
  _cssCache = /* @__PURE__ */ new Map();
888
952
  _cacheHits = 0;
@@ -915,9 +979,10 @@ __export(parser_exports, {
915
979
  mergeClassesStatic: () => mergeClassesStatic,
916
980
  normalizeAndDedupClasses: () => normalizeAndDedupClasses,
917
981
  normalizeClasses: () => normalizeClasses,
982
+ parseClass: () => parseClass,
918
983
  parseClasses: () => parseClasses
919
984
  });
920
- var parseClasses, extractAllClasses, extractClassesFromSource, astExtractClasses, normalizeClasses, mergeClassesStatic, normalizeAndDedupClasses, extractComponentUsage, batchExtractClasses, checkAgainstSafelist, diffClassLists;
985
+ var parseClasses, parseClass, extractAllClasses, extractClassesFromSource, astExtractClasses, normalizeClasses, mergeClassesStatic, normalizeAndDedupClasses, extractComponentUsage, batchExtractClasses, checkAgainstSafelist, diffClassLists;
921
986
  var init_parser = __esm({
922
987
  "packages/domain/compiler/src/parser/index.ts"() {
923
988
  init_nativeBridge();
@@ -928,6 +993,14 @@ var init_parser = __esm({
928
993
  }
929
994
  return native.parseClasses(raw) || [];
930
995
  };
996
+ parseClass = (input) => {
997
+ const native = getNativeBridge();
998
+ if (!native?.parseClass) {
999
+ throw new Error("FATAL: Native binding 'parseClass' is required but not available.");
1000
+ }
1001
+ const result = native.parseClass(input);
1002
+ return typeof result === "string" ? JSON.parse(result) : result;
1003
+ };
931
1004
  extractAllClasses = (source) => {
932
1005
  const native = getNativeBridge();
933
1006
  if (!native?.extractAllClasses) {
@@ -1059,6 +1132,35 @@ function mergeCssDeclarationsNative(cssChunks) {
1059
1132
  if (!native?.mergeCssDeclarations) throw new Error("mergeCssDeclarations not available");
1060
1133
  return native.mergeCssDeclarations(cssChunks);
1061
1134
  }
1135
+ function getWeek6FeaturesStatus() {
1136
+ const native = getNativeBridge();
1137
+ if (!native?.getWeek6FeaturesStatus) throw new Error("getWeek6FeaturesStatus not available");
1138
+ const resultJson = native.getWeek6FeaturesStatus();
1139
+ return JSON.parse(resultJson);
1140
+ }
1141
+ function getMemoryStatsNative() {
1142
+ const native = getNativeBridge();
1143
+ if (!native?.getMemoryStatsNative) throw new Error("getMemoryStatsNative not available");
1144
+ const resultJson = native.getMemoryStatsNative();
1145
+ return JSON.parse(resultJson);
1146
+ }
1147
+ function getMemoryRecommendationsNative() {
1148
+ const native = getNativeBridge();
1149
+ if (!native?.getMemoryRecommendationsNative) throw new Error("getMemoryRecommendationsNative not available");
1150
+ const resultJson = native.getMemoryRecommendationsNative();
1151
+ return JSON.parse(resultJson);
1152
+ }
1153
+ function estimateOptimalCacheConfigNative(workloadType, expectedEntries) {
1154
+ const native = getNativeBridge();
1155
+ if (!native?.estimateOptimalCacheConfigNative) throw new Error("estimateOptimalCacheConfigNative not available");
1156
+ const resultJson = native.estimateOptimalCacheConfigNative(workloadType, expectedEntries);
1157
+ return JSON.parse(resultJson);
1158
+ }
1159
+ function resetMemoryStats() {
1160
+ const native = getNativeBridge();
1161
+ if (!native?.resetMemoryStats) throw new Error("resetMemoryStats not available");
1162
+ native.resetMemoryStats();
1163
+ }
1062
1164
  var init_analyzerNative = __esm({
1063
1165
  "packages/domain/compiler/src/analyzer/analyzerNative.ts"() {
1064
1166
  init_nativeBridge();
@@ -1348,6 +1450,52 @@ function cachePriority(mtimeMs, sizeBytes, hitCount) {
1348
1450
  if (!native?.cache_priority) throw new Error("cache_priority not available");
1349
1451
  return native.cache_priority(mtimeMs, sizeBytes, hitCount);
1350
1452
  }
1453
+ function getResolverPoolStats() {
1454
+ const native = getNativeBridge();
1455
+ if (!native?.getResolverPoolStats) throw new Error("getResolverPoolStats not available");
1456
+ const statsJson = native.getResolverPoolStats();
1457
+ try {
1458
+ return JSON.parse(statsJson);
1459
+ } catch {
1460
+ return {
1461
+ hits: 0,
1462
+ misses: 0,
1463
+ total: 0,
1464
+ hit_rate: 0,
1465
+ cached_resolvers: 0
1466
+ };
1467
+ }
1468
+ }
1469
+ function clearResolverPool() {
1470
+ const native = getNativeBridge();
1471
+ if (!native?.clearResolverPool) throw new Error("clearResolverPool not available");
1472
+ const resultJson = native.clearResolverPool();
1473
+ try {
1474
+ return JSON.parse(resultJson);
1475
+ } catch {
1476
+ return { status: "error" };
1477
+ }
1478
+ }
1479
+ function resolveColorCached(themeId, color, configJson) {
1480
+ const native = getNativeBridge();
1481
+ if (!native?.resolveColorCached) throw new Error("resolveColorCached not available");
1482
+ return native.resolveColorCached(themeId, color, configJson);
1483
+ }
1484
+ function resolveSpacingCached(themeId, spacing, configJson) {
1485
+ const native = getNativeBridge();
1486
+ if (!native?.resolveSpacingCached) throw new Error("resolveSpacingCached not available");
1487
+ return native.resolveSpacingCached(themeId, spacing, configJson);
1488
+ }
1489
+ function resolveFontSizeCached(themeId, size, configJson) {
1490
+ const native = getNativeBridge();
1491
+ if (!native?.resolveFontSizeCached) throw new Error("resolveFontSizeCached not available");
1492
+ return native.resolveFontSizeCached(themeId, size, configJson);
1493
+ }
1494
+ function resetResolverPoolStats() {
1495
+ const native = getNativeBridge();
1496
+ if (!native?.resetResolverPoolStats) throw new Error("resetResolverPoolStats not available");
1497
+ native.resetResolverPoolStats();
1498
+ }
1351
1499
  var init_cacheNative = __esm({
1352
1500
  "packages/domain/compiler/src/cache/cacheNative.ts"() {
1353
1501
  init_nativeBridge();
@@ -1996,9 +2144,9 @@ var init_src2 = __esm({
1996
2144
  if (normalized.includes("/layout.") || normalized.includes("/loading.") || normalized.includes("/error.")) {
1997
2145
  return "__global";
1998
2146
  }
1999
- const pageMatch = normalized.match(/\/app\/(.+?)\/page\.[tj]sx?$/);
2147
+ const pageMatch = normalized.match(/(?:^|\/)app\/(.+?)\/page\.[tj]sx?$/);
2000
2148
  if (pageMatch) return `/${pageMatch[1]}`;
2001
- const rootPage = normalized.match(/\/app\/page\.[tj]sx?$/);
2149
+ const rootPage = normalized.match(/(?:^|\/)app\/page\.[tj]sx?$/);
2002
2150
  if (rootPage) return "/";
2003
2151
  return null;
2004
2152
  };
@@ -2157,6 +2305,7 @@ __export(internal_exports, {
2157
2305
  clearCssGenCache: () => clearCssGenCache,
2158
2306
  clearParseCache: () => clearParseCache,
2159
2307
  clearResolveCache: () => clearResolveCache,
2308
+ clearResolverPool: () => clearResolverPool,
2160
2309
  clearThemeCache: () => clearThemeCache,
2161
2310
  collectFiles: () => collectFiles,
2162
2311
  compileAnimation: () => compileAnimation,
@@ -2179,6 +2328,7 @@ __export(internal_exports, {
2179
2328
  eliminateDeadCssNative: () => eliminateDeadCssNative,
2180
2329
  emitPluginHook: () => emitPluginHook,
2181
2330
  estimateOptimalCacheConfig: () => estimateOptimalCacheConfig,
2331
+ estimateOptimalCacheConfigNative: () => estimateOptimalCacheConfigNative,
2182
2332
  extractAllClasses: () => extractAllClasses,
2183
2333
  extractAndGenerateStateCss: () => extractAndGenerateStateCss,
2184
2334
  extractAndGenerateStateCssNative: () => extractAndGenerateStateCssNative,
@@ -2192,6 +2342,8 @@ __export(internal_exports, {
2192
2342
  fileToRoute: () => fileToRoute,
2193
2343
  findDeadVariants: () => findDeadVariants,
2194
2344
  generateAtomicCss: () => generateAtomicCss,
2345
+ generateCss: () => generateCss,
2346
+ generateCssBatch: () => generateCssBatch,
2195
2347
  generateCssForClasses: () => generateCssForClasses,
2196
2348
  generateCssNative: () => generateCssNative,
2197
2349
  generateSafelist: () => generateSafelist,
@@ -2207,10 +2359,14 @@ __export(internal_exports, {
2207
2359
  getCompilerDiagnostics: () => getCompilerDiagnostics,
2208
2360
  getContentPaths: () => getContentPaths,
2209
2361
  getIncrementalEngine: () => getIncrementalEngine,
2362
+ getMemoryRecommendationsNative: () => getMemoryRecommendationsNative,
2363
+ getMemoryStatsNative: () => getMemoryStatsNative,
2210
2364
  getNativeBridge: () => getNativeBridge,
2211
2365
  getPluginHooks: () => getPluginHooks,
2366
+ getResolverPoolStats: () => getResolverPoolStats,
2212
2367
  getRouteClasses: () => getRouteClasses,
2213
2368
  getWatchStats: () => getWatchStats,
2369
+ getWeek6FeaturesStatus: () => getWeek6FeaturesStatus,
2214
2370
  hasTwUsage: () => hasTwUsage,
2215
2371
  hashContent: () => hashContent,
2216
2372
  hoistComponentsNative: () => hoistComponentsNative,
@@ -2239,6 +2395,7 @@ __export(internal_exports, {
2239
2395
  normalizeClasses: () => normalizeClasses,
2240
2396
  optimizeCssNative: () => optimizeCssNative,
2241
2397
  parseAtomicClass: () => parseAtomicClass,
2398
+ parseClass: () => parseClass,
2242
2399
  parseClasses: () => parseClasses,
2243
2400
  pollWatchEvents: () => pollWatchEvents,
2244
2401
  processFileChange: () => processFileChange,
@@ -2290,12 +2447,18 @@ __export(internal_exports, {
2290
2447
  registerPropertyName: () => registerPropertyName,
2291
2448
  registerValueName: () => registerValueName,
2292
2449
  resetBucketEngine: () => resetBucketEngine,
2450
+ resetCacheStats: () => resetCacheStats,
2293
2451
  resetCompilationMetrics: () => resetCompilationMetrics,
2294
2452
  resetIncrementalEngine: () => resetIncrementalEngine,
2453
+ resetMemoryStats: () => resetMemoryStats,
2454
+ resetResolverPoolStats: () => resetResolverPoolStats,
2295
2455
  resolveCascade: () => resolveCascade,
2296
2456
  resolveClassNames: () => resolveClassNames,
2457
+ resolveColorCached: () => resolveColorCached,
2297
2458
  resolveConflictGroup: () => resolveConflictGroup,
2459
+ resolveFontSizeCached: () => resolveFontSizeCached,
2298
2460
  resolveSimpleVariants: () => resolveSimpleVariants,
2461
+ resolveSpacingCached: () => resolveSpacingCached,
2299
2462
  resolveThemeValue: () => resolveThemeValue,
2300
2463
  resolveVariants: () => resolveVariants,
2301
2464
  reverseLookupProperty: () => reverseLookupProperty,