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.
Files changed (107) hide show
  1. package/dist/{analyzeWorkspace-DDOQdzzI.d.ts → analyzeWorkspace-CopJNGmi.d.ts} +2 -0
  2. package/dist/{analyzeWorkspace-BS5O4rhC.d.mts → analyzeWorkspace-DpVPccjz.d.mts} +2 -0
  3. package/dist/analyzer.d.mts +4 -4
  4. package/dist/analyzer.d.ts +4 -4
  5. package/dist/analyzer.js +34 -69
  6. package/dist/analyzer.js.map +1 -1
  7. package/dist/analyzer.mjs +33 -68
  8. package/dist/analyzer.mjs.map +1 -1
  9. package/dist/animate.js +11 -11
  10. package/dist/animate.js.map +1 -1
  11. package/dist/animate.mjs +11 -11
  12. package/dist/animate.mjs.map +1 -1
  13. package/dist/atomic.js +16 -7
  14. package/dist/atomic.js.map +1 -1
  15. package/dist/atomic.mjs +16 -7
  16. package/dist/atomic.mjs.map +1 -1
  17. package/dist/cli.js +262 -190
  18. package/dist/cli.js.map +1 -1
  19. package/dist/cli.mjs +259 -187
  20. package/dist/cli.mjs.map +1 -1
  21. package/dist/compiler.d.mts +2543 -109
  22. package/dist/compiler.d.ts +2543 -109
  23. package/dist/compiler.js +1962 -435
  24. package/dist/compiler.js.map +1 -1
  25. package/dist/compiler.mjs +1816 -382
  26. package/dist/compiler.mjs.map +1 -1
  27. package/dist/devtools.js +17 -4
  28. package/dist/devtools.js.map +1 -1
  29. package/dist/devtools.mjs +17 -4
  30. package/dist/devtools.mjs.map +1 -1
  31. package/dist/engine.d.mts +11 -470
  32. package/dist/engine.d.ts +11 -470
  33. package/dist/engine.js +1442 -417
  34. package/dist/engine.js.map +1 -1
  35. package/dist/engine.mjs +1442 -417
  36. package/dist/engine.mjs.map +1 -1
  37. package/dist/index-BDQw13kn.d.ts +464 -0
  38. package/dist/index-DJv28Uzq.d.mts +464 -0
  39. package/dist/index.browser.mjs +143 -255
  40. package/dist/index.browser.mjs.map +1 -1
  41. package/dist/index.d.mts +23 -39
  42. package/dist/index.d.ts +23 -39
  43. package/dist/index.js +6000 -1463
  44. package/dist/index.js.map +1 -1
  45. package/dist/index.mjs +5995 -1458
  46. package/dist/index.mjs.map +1 -1
  47. package/dist/next.d.mts +44 -1
  48. package/dist/next.d.ts +44 -1
  49. package/dist/next.js +3197 -1128
  50. package/dist/next.js.map +1 -1
  51. package/dist/next.mjs +3196 -1129
  52. package/dist/next.mjs.map +1 -1
  53. package/dist/rspack.d.mts +9 -0
  54. package/dist/rspack.d.ts +9 -0
  55. package/dist/rspack.js +99 -61
  56. package/dist/rspack.js.map +1 -1
  57. package/dist/rspack.mjs +99 -61
  58. package/dist/rspack.mjs.map +1 -1
  59. package/dist/runtime-css.d.mts +8 -0
  60. package/dist/runtime-css.d.ts +8 -0
  61. package/dist/runtime-css.js +23 -7
  62. package/dist/runtime-css.js.map +1 -1
  63. package/dist/runtime-css.mjs +23 -7
  64. package/dist/runtime-css.mjs.map +1 -1
  65. package/dist/scanner.js +16 -37
  66. package/dist/scanner.js.map +1 -1
  67. package/dist/scanner.mjs +15 -36
  68. package/dist/scanner.mjs.map +1 -1
  69. package/dist/shared.d.mts +107 -1
  70. package/dist/shared.d.ts +107 -1
  71. package/dist/shared.js +1627 -376
  72. package/dist/shared.js.map +1 -1
  73. package/dist/shared.mjs +1620 -354
  74. package/dist/shared.mjs.map +1 -1
  75. package/dist/svelte.js +39 -35
  76. package/dist/svelte.js.map +1 -1
  77. package/dist/svelte.mjs +38 -34
  78. package/dist/svelte.mjs.map +1 -1
  79. package/dist/theme.js +85 -76
  80. package/dist/theme.js.map +1 -1
  81. package/dist/theme.mjs +83 -74
  82. package/dist/theme.mjs.map +1 -1
  83. package/dist/turbopackLoader.js +943 -76
  84. package/dist/turbopackLoader.js.map +1 -1
  85. package/dist/turbopackLoader.mjs +943 -76
  86. package/dist/turbopackLoader.mjs.map +1 -1
  87. package/dist/tw.js +262 -190
  88. package/dist/tw.js.map +1 -1
  89. package/dist/tw.mjs +259 -187
  90. package/dist/tw.mjs.map +1 -1
  91. package/dist/vite.js +1336 -296
  92. package/dist/vite.js.map +1 -1
  93. package/dist/vite.mjs +1336 -296
  94. package/dist/vite.mjs.map +1 -1
  95. package/dist/vue.js +39 -35
  96. package/dist/vue.js.map +1 -1
  97. package/dist/vue.mjs +38 -34
  98. package/dist/vue.mjs.map +1 -1
  99. package/dist/webpackLoader.js +140 -34
  100. package/dist/webpackLoader.js.map +1 -1
  101. package/dist/webpackLoader.mjs +140 -34
  102. package/dist/webpackLoader.mjs.map +1 -1
  103. package/native/index.node +0 -0
  104. package/native/tailwind-styled-native.node +0 -0
  105. package/native/tailwind-styled-native.win32-x64-msvc.node +0 -0
  106. package/package.json +9 -4
  107. package/CHANGELOG.md +0 -285
package/dist/index.d.mts CHANGED
@@ -3,6 +3,10 @@ import { a as AnimateOptions } from './types-DXr2PmGP.mjs';
3
3
  import { H as HtmlTagName } from './index-NDINUhLN.mjs';
4
4
  export { T as TokenMap } from './index-NDINUhLN.mjs';
5
5
  export { a as LiveTokenSet, T as TokenSubscriber, b as applyTokenSet, t as containerRef, c as createUseTokens, g as generateTokenCssString, d as getToken, e as getTokens, l as liveToken, s as setToken, h as setTokens, i as subscribeTokens, t as tokenRef, j as tokenVar } from './liveTokenEngine-DKoWRtqH.mjs';
6
+ export { K as createEngine } from './index-DJv28Uzq.mjs';
7
+ import './analyzeWorkspace-DpVPccjz.mjs';
8
+ import './schemas-DR-SLxZZ.mjs';
9
+ import 'zod';
6
10
 
7
11
  /**
8
12
  * tailwind-styled-v4 — Core Types
@@ -83,6 +87,13 @@ interface ComponentConfig {
83
87
  states?: StatesConfig;
84
88
  /** Sub-component definitions — string atau nested { tag: { name: classes } } */
85
89
  sub?: Record<string, SubValue>;
90
+ /**
91
+ * Pre-computed hash — di-inject oleh turbopackLoader via `inject_state_hash()` (Rust).
92
+ * Kalau ada, `stateEngine.ts` skip runtime `hashState()` computation sepenuhnya.
93
+ * Format: 6-char FNV-1a hex string, identik dengan output `hashState()`.
94
+ * @internal — jangan set manual, ini di-inject otomatis saat build/dev.
95
+ */
96
+ __hash?: string;
86
97
  }
87
98
  /**
88
99
  * Strip tag prefix dari "tag:name" format sub key.
@@ -245,8 +256,7 @@ declare function processContainer(tag: string, container: ContainerConfig, conta
245
256
  /**
246
257
  * Generate @container CSS rules dari breakpoint config.
247
258
  *
248
- * Native-first: Rust string building tanpa intermediate allocations.
249
- * JS fallback: `buildContainerRules()` loop.
259
+ * Native-only: Rust string building tanpa intermediate allocations.
250
260
  */
251
261
  declare function generateContainerCss(tag: string, container: ContainerConfig, containerName?: string): string;
252
262
  declare function getContainerRegistry(): Map<string, ContainerEntry>;
@@ -269,40 +279,26 @@ declare function cv<C extends ComponentConfig>(config: C, componentId?: string):
269
279
 
270
280
  /**
271
281
  * tailwind-styled-v4 v2 — cx / cn
272
- *
273
- * Native-first:
274
- * cn() → simple join (no conflict resolution) — delegates ke Rust `resolve_class_names`
275
- * cx() → conflict-aware merge — delegates ke Rust `tw_merge` (preferred)
276
- * cxm() → alias cx() untuk backward compat
277
- *
278
- * Browser fallback: simple join when native binding unavailable.
279
- * In browser/client context, classes were already resolved on server during SSR.
282
+ * Pure Node.js — requires native Rust binding.
280
283
  */
281
284
  type ClassValue = string | undefined | null | false | 0;
282
285
  /**
283
286
  * cn — simple class name joiner (no conflict resolution).
284
- * Native-first: delegates ke Rust `resolve_class_names` yang filter+join
285
- * dalam satu pass tanpa intermediate allocations.
286
- * Browser fallback: flat+filter+join.
287
+ * Delegates ke Rust `resolve_class_names`.
287
288
  *
288
289
  * @example cn("p-4", isActive && "opacity-100") → "p-4 opacity-100"
289
290
  */
290
291
  declare function cn(...inputs: (ClassValue | ClassValue[])[]): string;
291
292
  /**
292
293
  * cx — conflict-aware class merger.
293
- * Native-first: delegates ke Rust `tw_merge` (preferred).
294
- * Mendukung array inputs — flatten sebelum di-pass ke native.
295
- * Browser fallback: simple join without conflict resolution.
294
+ * Delegates ke Rust `tw_merge_many`.
296
295
  *
297
296
  * @example cx("p-4 p-8") → "p-8"
298
297
  * @example cx("bg-red-500", "bg-blue-500") → "bg-blue-500"
299
298
  * @example cx(["flex", "items-center"], "px-4") → "flex items-center px-4"
300
299
  */
301
300
  declare function cx(...inputs: (ClassValue | ClassValue[])[]): string;
302
- /**
303
- * cxm — alias untuk cx(), kept for backward compatibility.
304
- * @deprecated Use cx() instead.
305
- */
301
+ /** @deprecated Use cx() instead. */
306
302
  declare const cxm: typeof cx;
307
303
 
308
304
  interface ThemeConfig$1 {
@@ -316,10 +312,7 @@ interface ThemeConfig$1 {
316
312
 
317
313
  /**
318
314
  * tailwind-styled-v4 — createTwMerge()
319
- *
320
- * Native-first: uses Rust `tw_merge_many` when available.
321
- * Browser fallback: simple join (no conflict resolution).
322
- * In browser/client context, classes were already resolved on the server during SSR.
315
+ * Pure Node.js — requires native Rust binding.
323
316
  */
324
317
 
325
318
  interface MergeOptions {
@@ -327,20 +320,6 @@ interface MergeOptions {
327
320
  separator?: string;
328
321
  theme?: ThemeConfig$1;
329
322
  }
330
- /**
331
- * createTwMerge — returns a conflict-aware merge function.
332
- * Native-first: uses Rust `tw_merge_many` when available.
333
- * Browser fallback: simple join without conflict resolution.
334
- *
335
- * IMPORTANT: The browser fallback must produce output identical to the server
336
- * (Rust) path to avoid React hydration mismatches. For static base classes this
337
- * is fine because they are pre-resolved at build time. For runtime className
338
- * overrides passed by the consumer, the join order must be stable and
339
- * deterministic on both sides.
340
- *
341
- * Note: `prefix` and `separator` options are not supported in native mode
342
- * (Tailwind v3/v4 defaults are used).
343
- */
344
323
  declare function createTwMerge(_options?: MergeOptions): (...classLists: Array<string | undefined | null | false>) => string;
345
324
  declare const twMerge: (...classLists: Array<string | undefined | null | false>) => string;
346
325
  declare function mergeWithRules(rules: Record<string, (classes: string[]) => string>, ...classLists: string[]): string;
@@ -425,8 +404,13 @@ interface StateEngineResult {
425
404
  /**
426
405
  * Process a StateConfig for a component.
427
406
  * Returns the state class and injects CSS (client-side only).
407
+ *
408
+ * @param tag HTML tag name
409
+ * @param state State config object
410
+ * @param precomputedHash Optional pre-computed hash dari `inject_state_hash()` Rust transform.
411
+ * Kalau ada, skip runtime `hashState()` sepenuhnya → zero hashing overhead.
428
412
  */
429
- declare function processState(tag: string, state: StateConfig): StateEngineResult;
413
+ declare function processState(tag: string, state: StateConfig, precomputedHash?: string): StateEngineResult;
430
414
  /**
431
415
  * Generate SSR-safe CSS string for a state config.
432
416
  * Used by SSR to inject styles into <head>.
package/dist/index.d.ts CHANGED
@@ -3,6 +3,10 @@ import { a as AnimateOptions } from './types-DXr2PmGP.js';
3
3
  import { H as HtmlTagName } from './index-NDINUhLN.js';
4
4
  export { T as TokenMap } from './index-NDINUhLN.js';
5
5
  export { a as LiveTokenSet, T as TokenSubscriber, b as applyTokenSet, t as containerRef, c as createUseTokens, g as generateTokenCssString, d as getToken, e as getTokens, l as liveToken, s as setToken, h as setTokens, i as subscribeTokens, t as tokenRef, j as tokenVar } from './liveTokenEngine-CN9ian1R.js';
6
+ export { K as createEngine } from './index-BDQw13kn.js';
7
+ import './analyzeWorkspace-CopJNGmi.js';
8
+ import './schemas-DR-SLxZZ.js';
9
+ import 'zod';
6
10
 
7
11
  /**
8
12
  * tailwind-styled-v4 — Core Types
@@ -83,6 +87,13 @@ interface ComponentConfig {
83
87
  states?: StatesConfig;
84
88
  /** Sub-component definitions — string atau nested { tag: { name: classes } } */
85
89
  sub?: Record<string, SubValue>;
90
+ /**
91
+ * Pre-computed hash — di-inject oleh turbopackLoader via `inject_state_hash()` (Rust).
92
+ * Kalau ada, `stateEngine.ts` skip runtime `hashState()` computation sepenuhnya.
93
+ * Format: 6-char FNV-1a hex string, identik dengan output `hashState()`.
94
+ * @internal — jangan set manual, ini di-inject otomatis saat build/dev.
95
+ */
96
+ __hash?: string;
86
97
  }
87
98
  /**
88
99
  * Strip tag prefix dari "tag:name" format sub key.
@@ -245,8 +256,7 @@ declare function processContainer(tag: string, container: ContainerConfig, conta
245
256
  /**
246
257
  * Generate @container CSS rules dari breakpoint config.
247
258
  *
248
- * Native-first: Rust string building tanpa intermediate allocations.
249
- * JS fallback: `buildContainerRules()` loop.
259
+ * Native-only: Rust string building tanpa intermediate allocations.
250
260
  */
251
261
  declare function generateContainerCss(tag: string, container: ContainerConfig, containerName?: string): string;
252
262
  declare function getContainerRegistry(): Map<string, ContainerEntry>;
@@ -269,40 +279,26 @@ declare function cv<C extends ComponentConfig>(config: C, componentId?: string):
269
279
 
270
280
  /**
271
281
  * tailwind-styled-v4 v2 — cx / cn
272
- *
273
- * Native-first:
274
- * cn() → simple join (no conflict resolution) — delegates ke Rust `resolve_class_names`
275
- * cx() → conflict-aware merge — delegates ke Rust `tw_merge` (preferred)
276
- * cxm() → alias cx() untuk backward compat
277
- *
278
- * Browser fallback: simple join when native binding unavailable.
279
- * In browser/client context, classes were already resolved on server during SSR.
282
+ * Pure Node.js — requires native Rust binding.
280
283
  */
281
284
  type ClassValue = string | undefined | null | false | 0;
282
285
  /**
283
286
  * cn — simple class name joiner (no conflict resolution).
284
- * Native-first: delegates ke Rust `resolve_class_names` yang filter+join
285
- * dalam satu pass tanpa intermediate allocations.
286
- * Browser fallback: flat+filter+join.
287
+ * Delegates ke Rust `resolve_class_names`.
287
288
  *
288
289
  * @example cn("p-4", isActive && "opacity-100") → "p-4 opacity-100"
289
290
  */
290
291
  declare function cn(...inputs: (ClassValue | ClassValue[])[]): string;
291
292
  /**
292
293
  * cx — conflict-aware class merger.
293
- * Native-first: delegates ke Rust `tw_merge` (preferred).
294
- * Mendukung array inputs — flatten sebelum di-pass ke native.
295
- * Browser fallback: simple join without conflict resolution.
294
+ * Delegates ke Rust `tw_merge_many`.
296
295
  *
297
296
  * @example cx("p-4 p-8") → "p-8"
298
297
  * @example cx("bg-red-500", "bg-blue-500") → "bg-blue-500"
299
298
  * @example cx(["flex", "items-center"], "px-4") → "flex items-center px-4"
300
299
  */
301
300
  declare function cx(...inputs: (ClassValue | ClassValue[])[]): string;
302
- /**
303
- * cxm — alias untuk cx(), kept for backward compatibility.
304
- * @deprecated Use cx() instead.
305
- */
301
+ /** @deprecated Use cx() instead. */
306
302
  declare const cxm: typeof cx;
307
303
 
308
304
  interface ThemeConfig$1 {
@@ -316,10 +312,7 @@ interface ThemeConfig$1 {
316
312
 
317
313
  /**
318
314
  * tailwind-styled-v4 — createTwMerge()
319
- *
320
- * Native-first: uses Rust `tw_merge_many` when available.
321
- * Browser fallback: simple join (no conflict resolution).
322
- * In browser/client context, classes were already resolved on the server during SSR.
315
+ * Pure Node.js — requires native Rust binding.
323
316
  */
324
317
 
325
318
  interface MergeOptions {
@@ -327,20 +320,6 @@ interface MergeOptions {
327
320
  separator?: string;
328
321
  theme?: ThemeConfig$1;
329
322
  }
330
- /**
331
- * createTwMerge — returns a conflict-aware merge function.
332
- * Native-first: uses Rust `tw_merge_many` when available.
333
- * Browser fallback: simple join without conflict resolution.
334
- *
335
- * IMPORTANT: The browser fallback must produce output identical to the server
336
- * (Rust) path to avoid React hydration mismatches. For static base classes this
337
- * is fine because they are pre-resolved at build time. For runtime className
338
- * overrides passed by the consumer, the join order must be stable and
339
- * deterministic on both sides.
340
- *
341
- * Note: `prefix` and `separator` options are not supported in native mode
342
- * (Tailwind v3/v4 defaults are used).
343
- */
344
323
  declare function createTwMerge(_options?: MergeOptions): (...classLists: Array<string | undefined | null | false>) => string;
345
324
  declare const twMerge: (...classLists: Array<string | undefined | null | false>) => string;
346
325
  declare function mergeWithRules(rules: Record<string, (classes: string[]) => string>, ...classLists: string[]): string;
@@ -425,8 +404,13 @@ interface StateEngineResult {
425
404
  /**
426
405
  * Process a StateConfig for a component.
427
406
  * Returns the state class and injects CSS (client-side only).
407
+ *
408
+ * @param tag HTML tag name
409
+ * @param state State config object
410
+ * @param precomputedHash Optional pre-computed hash dari `inject_state_hash()` Rust transform.
411
+ * Kalau ada, skip runtime `hashState()` sepenuhnya → zero hashing overhead.
428
412
  */
429
- declare function processState(tag: string, state: StateConfig): StateEngineResult;
413
+ declare function processState(tag: string, state: StateConfig, precomputedHash?: string): StateEngineResult;
430
414
  /**
431
415
  * Generate SSR-safe CSS string for a state config.
432
416
  * Used by SSR to inject styles into <head>.