tailwind-styled-v4 5.0.8 → 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.
Files changed (140) hide show
  1. package/CHANGELOG.md +204 -416
  2. package/README.md +45 -15
  3. package/dist/{analyzeWorkspace-DuJKh7Ty.d.mts → analyzeWorkspace-BS5O4rhC.d.mts} +47 -2
  4. package/dist/{analyzeWorkspace-Ct_NTAWt.d.ts → analyzeWorkspace-DDOQdzzI.d.ts} +47 -2
  5. package/dist/analyzer.d.mts +5 -3
  6. package/dist/analyzer.d.ts +5 -3
  7. package/dist/analyzer.js +563 -468
  8. package/dist/analyzer.js.map +1 -1
  9. package/dist/analyzer.mjs +562 -467
  10. package/dist/analyzer.mjs.map +1 -1
  11. package/dist/animate.d.mts +4 -7
  12. package/dist/animate.d.ts +4 -7
  13. package/dist/animate.js +171 -265
  14. package/dist/animate.js.map +1 -1
  15. package/dist/animate.mjs +165 -264
  16. package/dist/animate.mjs.map +1 -1
  17. package/dist/atomic.d.mts +22 -1
  18. package/dist/atomic.d.ts +22 -1
  19. package/dist/atomic.js +221 -165
  20. package/dist/atomic.js.map +1 -1
  21. package/dist/atomic.mjs +200 -165
  22. package/dist/atomic.mjs.map +1 -1
  23. package/dist/cli.d.mts +60 -1
  24. package/dist/cli.d.ts +60 -1
  25. package/dist/cli.js +1261 -1517
  26. package/dist/cli.js.map +1 -1
  27. package/dist/cli.mjs +1238 -1513
  28. package/dist/cli.mjs.map +1 -1
  29. package/dist/compiler.d.mts +38 -7
  30. package/dist/compiler.d.ts +38 -7
  31. package/dist/compiler.js +174 -197
  32. package/dist/compiler.js.map +1 -1
  33. package/dist/compiler.mjs +151 -194
  34. package/dist/compiler.mjs.map +1 -1
  35. package/dist/devtools.js +7 -31
  36. package/dist/devtools.js.map +1 -1
  37. package/dist/devtools.mjs +7 -31
  38. package/dist/devtools.mjs.map +1 -1
  39. package/dist/engine.d.mts +134 -63
  40. package/dist/engine.d.ts +134 -63
  41. package/dist/engine.js +2863 -2482
  42. package/dist/engine.js.map +1 -1
  43. package/dist/engine.mjs +2852 -2485
  44. package/dist/engine.mjs.map +1 -1
  45. package/dist/{index-eWAocnD2.d.mts → index-NDINUhLN.d.mts} +3 -1
  46. package/dist/{index-eWAocnD2.d.ts → index-NDINUhLN.d.ts} +3 -1
  47. package/dist/index.d.mts +63 -32
  48. package/dist/index.d.ts +63 -32
  49. package/dist/index.js +335 -169
  50. package/dist/index.js.map +1 -1
  51. package/dist/index.mjs +315 -169
  52. package/dist/index.mjs.map +1 -1
  53. package/dist/{liveTokenEngine-DSUk88P6.d.ts → liveTokenEngine-CN9ian1R.d.ts} +1 -1
  54. package/dist/{liveTokenEngine-CX5_0c4q.d.mts → liveTokenEngine-DKoWRtqH.d.mts} +1 -1
  55. package/dist/next.d.mts +10 -4
  56. package/dist/next.d.ts +10 -4
  57. package/dist/next.js +32 -45
  58. package/dist/next.js.map +1 -1
  59. package/dist/next.mjs +30 -43
  60. package/dist/next.mjs.map +1 -1
  61. package/dist/plugin-api.d.mts +8 -2
  62. package/dist/plugin-api.d.ts +8 -2
  63. package/dist/plugin-api.js +14 -2
  64. package/dist/plugin-api.js.map +1 -1
  65. package/dist/plugin-api.mjs +14 -3
  66. package/dist/plugin-api.mjs.map +1 -1
  67. package/dist/plugin-registry.js +51 -11
  68. package/dist/plugin-registry.js.map +1 -1
  69. package/dist/plugin-registry.mjs +51 -11
  70. package/dist/plugin-registry.mjs.map +1 -1
  71. package/dist/plugin.d.mts +5 -7
  72. package/dist/plugin.d.ts +5 -7
  73. package/dist/plugin.js +16 -15
  74. package/dist/plugin.js.map +1 -1
  75. package/dist/plugin.mjs +16 -16
  76. package/dist/plugin.mjs.map +1 -1
  77. package/dist/rspack.js +17 -38
  78. package/dist/rspack.js.map +1 -1
  79. package/dist/rspack.mjs +15 -36
  80. package/dist/rspack.mjs.map +1 -1
  81. package/dist/runtime.d.mts +2 -2
  82. package/dist/runtime.d.ts +2 -2
  83. package/dist/scanner.d.mts +10 -1
  84. package/dist/scanner.d.ts +10 -1
  85. package/dist/scanner.js +298 -124
  86. package/dist/scanner.js.map +1 -1
  87. package/dist/scanner.mjs +296 -124
  88. package/dist/scanner.mjs.map +1 -1
  89. package/dist/shared.d.mts +1 -1
  90. package/dist/shared.d.ts +1 -1
  91. package/dist/shared.js +104 -176
  92. package/dist/shared.js.map +1 -1
  93. package/dist/shared.mjs +85 -176
  94. package/dist/shared.mjs.map +1 -1
  95. package/dist/storybook-addon.d.mts +1 -1
  96. package/dist/storybook-addon.d.ts +1 -1
  97. package/dist/svelte.d.mts +1 -1
  98. package/dist/svelte.d.ts +1 -1
  99. package/dist/svelte.js +166 -3
  100. package/dist/svelte.js.map +1 -1
  101. package/dist/svelte.mjs +143 -1
  102. package/dist/svelte.mjs.map +1 -1
  103. package/dist/syntax.js +21 -21
  104. package/dist/syntax.js.map +1 -1
  105. package/dist/syntax.mjs +21 -21
  106. package/dist/syntax.mjs.map +1 -1
  107. package/dist/testing.js +9 -1
  108. package/dist/testing.js.map +1 -1
  109. package/dist/testing.mjs +9 -1
  110. package/dist/testing.mjs.map +1 -1
  111. package/dist/theme.d.mts +2 -2
  112. package/dist/theme.d.ts +2 -2
  113. package/dist/theme.js +40 -112
  114. package/dist/theme.js.map +1 -1
  115. package/dist/theme.mjs +37 -110
  116. package/dist/theme.mjs.map +1 -1
  117. package/dist/turbopackLoader.js +84 -126
  118. package/dist/turbopackLoader.js.map +1 -1
  119. package/dist/turbopackLoader.mjs +68 -124
  120. package/dist/turbopackLoader.mjs.map +1 -1
  121. package/dist/tw.js +1256 -1517
  122. package/dist/tw.js.map +1 -1
  123. package/dist/tw.mjs +1236 -1513
  124. package/dist/tw.mjs.map +1 -1
  125. package/dist/vite.js +1783 -823
  126. package/dist/vite.js.map +1 -1
  127. package/dist/vite.mjs +1767 -821
  128. package/dist/vite.mjs.map +1 -1
  129. package/dist/vue.d.mts +1 -1
  130. package/dist/vue.d.ts +1 -1
  131. package/dist/vue.js +165 -4
  132. package/dist/vue.js.map +1 -1
  133. package/dist/vue.mjs +141 -1
  134. package/dist/vue.mjs.map +1 -1
  135. package/dist/webpackLoader.js +69 -108
  136. package/dist/webpackLoader.js.map +1 -1
  137. package/dist/webpackLoader.mjs +49 -104
  138. package/dist/webpackLoader.mjs.map +1 -1
  139. package/native/tailwind-styled-native.node +0 -0
  140. package/package.json +22 -24
@@ -63,10 +63,12 @@ interface LoadNativeBindingResult<T> {
63
63
  }
64
64
  declare function loadNativeBinding<T>(options: LoadNativeBindingOptions<T>): LoadNativeBindingResult<T>;
65
65
  interface ResolveCandidatesOptions {
66
- runtimeDir: string;
66
+ runtimeDir?: string;
67
67
  envVarNames?: string[];
68
68
  includeDefaultCandidates?: boolean;
69
69
  enforceNodeExtensionForEnvPath?: boolean;
70
+ /** @deprecated — ignored, kept for backward compat */
71
+ packageName?: string;
70
72
  }
71
73
  declare function resolveNativeBindingCandidates(options: ResolveCandidatesOptions): string[];
72
74
  declare function resolveRuntimeDir(dir: string | undefined, importMetaUrl: string): string;
@@ -63,10 +63,12 @@ interface LoadNativeBindingResult<T> {
63
63
  }
64
64
  declare function loadNativeBinding<T>(options: LoadNativeBindingOptions<T>): LoadNativeBindingResult<T>;
65
65
  interface ResolveCandidatesOptions {
66
- runtimeDir: string;
66
+ runtimeDir?: string;
67
67
  envVarNames?: string[];
68
68
  includeDefaultCandidates?: boolean;
69
69
  enforceNodeExtensionForEnvPath?: boolean;
70
+ /** @deprecated — ignored, kept for backward compat */
71
+ packageName?: string;
70
72
  }
71
73
  declare function resolveNativeBindingCandidates(options: ResolveCandidatesOptions): string[];
72
74
  declare function resolveRuntimeDir(dir: string | undefined, importMetaUrl: string): string;
package/dist/index.d.mts CHANGED
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
2
  import { a as AnimateOptions } from './types-DXr2PmGP.mjs';
3
- import { H as HtmlTagName } from './index-eWAocnD2.mjs';
4
- export { T as TokenMap } from './index-eWAocnD2.mjs';
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-CX5_0c4q.mjs';
3
+ import { H as HtmlTagName } from './index-NDINUhLN.mjs';
4
+ export { T as TokenMap } from './index-NDINUhLN.mjs';
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
6
 
7
7
  /**
8
8
  * tailwind-styled-v4 — Core Types
@@ -26,7 +26,12 @@ interface ComponentConfig {
26
26
  state?: Record<string, Record<string, string>>;
27
27
  container?: Record<string, string>;
28
28
  containerName?: string;
29
+ /** Sub-component definitions — keys di-infer otomatis oleh TypeScript */
30
+ sub?: Record<string, string>;
29
31
  }
32
+ type InferSubFromConfig<C extends ComponentConfig> = C extends {
33
+ sub: Record<infer K extends string, string>;
34
+ } ? K : never;
30
35
  interface ContainerConfig {
31
36
  base?: string;
32
37
  queries?: Record<string, string>;
@@ -61,7 +66,7 @@ type TrimRight<S extends string> = S extends `${infer L} ` | `${infer L}
61
66
  ` | `${infer L} ` | `${infer L}
62
67
  ` ? TrimRight<L> : S;
63
68
  type Trim<S extends string> = TrimLeft<TrimRight<S>>;
64
- type ExtractSubNames<T extends string> = T extends `${infer _}[${infer Name}]${infer Rest}` ? (Trim<Name> extends string ? Trim<Name> : never) | ExtractSubNames<Rest> : never;
69
+ type ExtractSubNames<T extends string> = T extends `${string}[${infer Name}]${string}{${string}}${infer Rest}` ? Trim<Name> | ExtractSubNames<Rest> : T extends `${string}\n${infer Name}{${string}}${infer Rest}` ? (Trim<Name> extends "" ? never : Trim<Name>) | ExtractSubNames<Rest> : never;
65
70
  type SubComponentKeys<S extends string> = string extends S ? {
66
71
  [key: string]: TwSubComponentAccessor;
67
72
  } : {
@@ -80,7 +85,20 @@ type TwStyledComponent<Config extends ComponentConfig = ComponentConfig, S exten
80
85
  }): TwStyledComponent<Config, S>;
81
86
  };
82
87
  withVariants: (config: Partial<Config>) => TwStyledComponent<Config, S>;
83
- withSub<NewS extends string>(): TwStyledComponent<Config, S | NewS>;
88
+ /**
89
+ * Declare sub-component names secara eksplisit untuk autocomplete + type safety.
90
+ *
91
+ * @example
92
+ * export const Button = tw.button`
93
+ * flex h-12 ...
94
+ * icon { flex h-4 }
95
+ * `.withSub<"icon" | "footer">()
96
+ *
97
+ * Button.icon // ✅ autocomplete
98
+ * Button.footer // ✅ autocomplete
99
+ * Button.xyz // ❌ TypeScript error
100
+ */
101
+ withSub<NewS extends string>(): TwStyledComponent<Config, NewS>;
84
102
  animate: (opts: AnimateOptions) => Promise<TwStyledComponent<Config, S>>;
85
103
  } & SubComponentKeys<S>;
86
104
  interface TwSubComponent<P = unknown> {
@@ -88,9 +106,9 @@ interface TwSubComponent<P = unknown> {
88
106
  displayName?: string;
89
107
  }
90
108
  interface TwTemplateFactory<Config extends ComponentConfig = ComponentConfig> {
91
- <const T extends string>(strings: readonly [T, ...unknown[]], ...exprs: unknown[]): TwStyledComponent<Config, ExtractSubNames<T>>;
109
+ <const T extends string>(strings: readonly [T], ...exprs: []): TwStyledComponent<Config, ExtractSubNames<T>>;
92
110
  (strings: TemplateStringsArray, ...exprs: unknown[]): TwStyledComponent<Config, string>;
93
- <C extends ComponentConfig>(config: C): TwStyledComponent<C, string>;
111
+ <C extends ComponentConfig>(config: C): TwStyledComponent<C, InferSubFromConfig<C>>;
94
112
  }
95
113
  type TwTagFactory = {
96
114
  [K in HtmlTagName]: TwTemplateFactory;
@@ -155,6 +173,12 @@ interface ContainerQueryResult {
155
173
  hasContainer: true;
156
174
  }
157
175
  declare function processContainer(tag: string, container: ContainerConfig, containerName?: string): ContainerQueryResult;
176
+ /**
177
+ * Generate @container CSS rules dari breakpoint config.
178
+ *
179
+ * Native-first: Rust string building tanpa intermediate allocations.
180
+ * JS fallback: `buildContainerRules()` loop.
181
+ */
158
182
  declare function generateContainerCss(tag: string, container: ContainerConfig, containerName?: string): string;
159
183
  declare function getContainerRegistry(): Map<string, ContainerEntry>;
160
184
 
@@ -163,13 +187,13 @@ declare function createComponent<P extends object = Record<string, unknown>>(tag
163
187
  /**
164
188
  * tailwind-styled-v4 — cv()
165
189
  *
166
- * Runtime: pure JS, browser-safe, zero fs/native.
190
+ * Runtime: native-first with fallback to generated variant tables.
167
191
  *
168
192
  * Dua mode:
169
193
  * 1. GENERATED (optimal) — import dari variants.generated.ts hasil `npx tw compile-variants`
170
194
  * → O(1) lookup, static, zero runtime computation
171
- * 2. RUNTIME (fallback) — compute on-the-fly, pure JS
172
- * → Tetap browser-safe, tidak ada native binding
195
+ * 2. RUNTIME (fallback) — compute on-the-fly via native binding
196
+ * → Requires native Rust binding for variant resolution
173
197
  */
174
198
 
175
199
  declare function cv<C extends ComponentConfig>(config: C, componentId?: string): CvFn<C>;
@@ -177,39 +201,32 @@ declare function cv<C extends ComponentConfig>(config: C, componentId?: string):
177
201
  /**
178
202
  * tailwind-styled-v4 v2 — cx / cn
179
203
  *
180
- * FIX #09: Rename for clarity — behavior was confusing with two near-identical utils.
181
- *
182
- * BEFORE:
183
- * cx() simple join, no conflict resolution → cx("p-4", "p-8") = "p-4 p-8" (WRONG)
184
- * cxm() → twMerge, correct — but obscure name
185
- *
186
- * AFTER:
187
- * cn() → simple join (for cases where you know there's no conflict)
188
- * cx() → twMerge-powered, conflict-aware (recommended for most use cases)
189
- * cxm() → kept as alias for cx() for backward compat
204
+ * Native-first:
205
+ * cn() → simple join (no conflict resolution) — delegates ke Rust `resolve_class_names`
206
+ * cx() → conflict-aware merge — delegates ke Rust `tw_merge` (required)
207
+ * cxm() alias cx() untuk backward compat
190
208
  */
191
209
  type ClassValue = string | undefined | null | false | 0;
192
210
  /**
193
211
  * cn — simple class name joiner (no conflict resolution).
194
- * Use when you know classes don't conflict.
195
- *
196
- * FIX #09: Previously named `cx`. Renamed to `cn` for clarity.
212
+ * Native-first: delegates ke Rust `resolve_class_names` yang filter+join
213
+ * dalam satu pass tanpa intermediate allocations.
197
214
  *
198
215
  * @example cn("p-4", isActive && "opacity-100") → "p-4 opacity-100"
199
216
  */
200
- declare function cn(...inputs: ClassValue[]): string;
217
+ declare function cn(...inputs: (ClassValue | ClassValue[])[]): string;
201
218
  /**
202
- * cx — conflict-aware class merger using tailwind-merge.
203
- * Recommended for combining Tailwind classes where conflicts are possible.
219
+ * cx — conflict-aware class merger.
220
+ * Native-first: delegates ke Rust `tw_merge` (required).
221
+ * Mendukung array inputs — flatten sebelum di-pass ke native.
204
222
  *
205
- * FIX #09: Previously named `cxm`. Renamed to `cx` as the primary utility.
206
- *
207
- * @example cx("p-4 p-8") "p-8" (conflict resolved, last wins)
208
- * @example cx("bg-red-500", "bg-blue-500") → "bg-blue-500"
223
+ * @example cx("p-4 p-8") → "p-8"
224
+ * @example cx("bg-red-500", "bg-blue-500") → "bg-blue-500"
225
+ * @example cx(["flex", "items-center"], "px-4") "flex items-center px-4"
209
226
  */
210
- declare function cx(...inputs: ClassValue[]): string;
227
+ declare function cx(...inputs: (ClassValue | ClassValue[])[]): string;
211
228
  /**
212
- * cxm — alias for cx(), kept for backward compatibility.
229
+ * cxm — alias untuk cx(), kept for backward compatibility.
213
230
  * @deprecated Use cx() instead.
214
231
  */
215
232
  declare const cxm: typeof cx;
@@ -223,11 +240,25 @@ interface ThemeConfig$1 {
223
240
  raw: Record<string, string>;
224
241
  }
225
242
 
243
+ /**
244
+ * tailwind-styled-v4 — createTwMerge()
245
+ *
246
+ * Native-only: uses Rust `tw_merge_many`; requires native binding.
247
+ * No JS fallback — tailwind-merge removed from bundle.
248
+ */
249
+
226
250
  interface MergeOptions {
227
251
  prefix?: string;
228
252
  separator?: string;
229
253
  theme?: ThemeConfig$1;
230
254
  }
255
+ /**
256
+ * createTwMerge — returns a conflict-aware merge function.
257
+ * Native-only: uses Rust `tw_merge_many`; throws if native binding unavailable.
258
+ *
259
+ * Note: `prefix` and `separator` options are not supported in native mode
260
+ * (Tailwind v3/v4 defaults are used).
261
+ */
231
262
  declare function createTwMerge(_options?: MergeOptions): (...classLists: Array<string | undefined | null | false>) => string;
232
263
  declare const twMerge: (...classLists: Array<string | undefined | null | false>) => string;
233
264
  declare function mergeWithRules(rules: Record<string, (classes: string[]) => string>, ...classLists: string[]): string;
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
2
  import { a as AnimateOptions } from './types-DXr2PmGP.js';
3
- import { H as HtmlTagName } from './index-eWAocnD2.js';
4
- export { T as TokenMap } from './index-eWAocnD2.js';
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-DSUk88P6.js';
3
+ import { H as HtmlTagName } from './index-NDINUhLN.js';
4
+ export { T as TokenMap } from './index-NDINUhLN.js';
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
6
 
7
7
  /**
8
8
  * tailwind-styled-v4 — Core Types
@@ -26,7 +26,12 @@ interface ComponentConfig {
26
26
  state?: Record<string, Record<string, string>>;
27
27
  container?: Record<string, string>;
28
28
  containerName?: string;
29
+ /** Sub-component definitions — keys di-infer otomatis oleh TypeScript */
30
+ sub?: Record<string, string>;
29
31
  }
32
+ type InferSubFromConfig<C extends ComponentConfig> = C extends {
33
+ sub: Record<infer K extends string, string>;
34
+ } ? K : never;
30
35
  interface ContainerConfig {
31
36
  base?: string;
32
37
  queries?: Record<string, string>;
@@ -61,7 +66,7 @@ type TrimRight<S extends string> = S extends `${infer L} ` | `${infer L}
61
66
  ` | `${infer L} ` | `${infer L}
62
67
  ` ? TrimRight<L> : S;
63
68
  type Trim<S extends string> = TrimLeft<TrimRight<S>>;
64
- type ExtractSubNames<T extends string> = T extends `${infer _}[${infer Name}]${infer Rest}` ? (Trim<Name> extends string ? Trim<Name> : never) | ExtractSubNames<Rest> : never;
69
+ type ExtractSubNames<T extends string> = T extends `${string}[${infer Name}]${string}{${string}}${infer Rest}` ? Trim<Name> | ExtractSubNames<Rest> : T extends `${string}\n${infer Name}{${string}}${infer Rest}` ? (Trim<Name> extends "" ? never : Trim<Name>) | ExtractSubNames<Rest> : never;
65
70
  type SubComponentKeys<S extends string> = string extends S ? {
66
71
  [key: string]: TwSubComponentAccessor;
67
72
  } : {
@@ -80,7 +85,20 @@ type TwStyledComponent<Config extends ComponentConfig = ComponentConfig, S exten
80
85
  }): TwStyledComponent<Config, S>;
81
86
  };
82
87
  withVariants: (config: Partial<Config>) => TwStyledComponent<Config, S>;
83
- withSub<NewS extends string>(): TwStyledComponent<Config, S | NewS>;
88
+ /**
89
+ * Declare sub-component names secara eksplisit untuk autocomplete + type safety.
90
+ *
91
+ * @example
92
+ * export const Button = tw.button`
93
+ * flex h-12 ...
94
+ * icon { flex h-4 }
95
+ * `.withSub<"icon" | "footer">()
96
+ *
97
+ * Button.icon // ✅ autocomplete
98
+ * Button.footer // ✅ autocomplete
99
+ * Button.xyz // ❌ TypeScript error
100
+ */
101
+ withSub<NewS extends string>(): TwStyledComponent<Config, NewS>;
84
102
  animate: (opts: AnimateOptions) => Promise<TwStyledComponent<Config, S>>;
85
103
  } & SubComponentKeys<S>;
86
104
  interface TwSubComponent<P = unknown> {
@@ -88,9 +106,9 @@ interface TwSubComponent<P = unknown> {
88
106
  displayName?: string;
89
107
  }
90
108
  interface TwTemplateFactory<Config extends ComponentConfig = ComponentConfig> {
91
- <const T extends string>(strings: readonly [T, ...unknown[]], ...exprs: unknown[]): TwStyledComponent<Config, ExtractSubNames<T>>;
109
+ <const T extends string>(strings: readonly [T], ...exprs: []): TwStyledComponent<Config, ExtractSubNames<T>>;
92
110
  (strings: TemplateStringsArray, ...exprs: unknown[]): TwStyledComponent<Config, string>;
93
- <C extends ComponentConfig>(config: C): TwStyledComponent<C, string>;
111
+ <C extends ComponentConfig>(config: C): TwStyledComponent<C, InferSubFromConfig<C>>;
94
112
  }
95
113
  type TwTagFactory = {
96
114
  [K in HtmlTagName]: TwTemplateFactory;
@@ -155,6 +173,12 @@ interface ContainerQueryResult {
155
173
  hasContainer: true;
156
174
  }
157
175
  declare function processContainer(tag: string, container: ContainerConfig, containerName?: string): ContainerQueryResult;
176
+ /**
177
+ * Generate @container CSS rules dari breakpoint config.
178
+ *
179
+ * Native-first: Rust string building tanpa intermediate allocations.
180
+ * JS fallback: `buildContainerRules()` loop.
181
+ */
158
182
  declare function generateContainerCss(tag: string, container: ContainerConfig, containerName?: string): string;
159
183
  declare function getContainerRegistry(): Map<string, ContainerEntry>;
160
184
 
@@ -163,13 +187,13 @@ declare function createComponent<P extends object = Record<string, unknown>>(tag
163
187
  /**
164
188
  * tailwind-styled-v4 — cv()
165
189
  *
166
- * Runtime: pure JS, browser-safe, zero fs/native.
190
+ * Runtime: native-first with fallback to generated variant tables.
167
191
  *
168
192
  * Dua mode:
169
193
  * 1. GENERATED (optimal) — import dari variants.generated.ts hasil `npx tw compile-variants`
170
194
  * → O(1) lookup, static, zero runtime computation
171
- * 2. RUNTIME (fallback) — compute on-the-fly, pure JS
172
- * → Tetap browser-safe, tidak ada native binding
195
+ * 2. RUNTIME (fallback) — compute on-the-fly via native binding
196
+ * → Requires native Rust binding for variant resolution
173
197
  */
174
198
 
175
199
  declare function cv<C extends ComponentConfig>(config: C, componentId?: string): CvFn<C>;
@@ -177,39 +201,32 @@ declare function cv<C extends ComponentConfig>(config: C, componentId?: string):
177
201
  /**
178
202
  * tailwind-styled-v4 v2 — cx / cn
179
203
  *
180
- * FIX #09: Rename for clarity — behavior was confusing with two near-identical utils.
181
- *
182
- * BEFORE:
183
- * cx() simple join, no conflict resolution → cx("p-4", "p-8") = "p-4 p-8" (WRONG)
184
- * cxm() → twMerge, correct — but obscure name
185
- *
186
- * AFTER:
187
- * cn() → simple join (for cases where you know there's no conflict)
188
- * cx() → twMerge-powered, conflict-aware (recommended for most use cases)
189
- * cxm() → kept as alias for cx() for backward compat
204
+ * Native-first:
205
+ * cn() → simple join (no conflict resolution) — delegates ke Rust `resolve_class_names`
206
+ * cx() → conflict-aware merge — delegates ke Rust `tw_merge` (required)
207
+ * cxm() alias cx() untuk backward compat
190
208
  */
191
209
  type ClassValue = string | undefined | null | false | 0;
192
210
  /**
193
211
  * cn — simple class name joiner (no conflict resolution).
194
- * Use when you know classes don't conflict.
195
- *
196
- * FIX #09: Previously named `cx`. Renamed to `cn` for clarity.
212
+ * Native-first: delegates ke Rust `resolve_class_names` yang filter+join
213
+ * dalam satu pass tanpa intermediate allocations.
197
214
  *
198
215
  * @example cn("p-4", isActive && "opacity-100") → "p-4 opacity-100"
199
216
  */
200
- declare function cn(...inputs: ClassValue[]): string;
217
+ declare function cn(...inputs: (ClassValue | ClassValue[])[]): string;
201
218
  /**
202
- * cx — conflict-aware class merger using tailwind-merge.
203
- * Recommended for combining Tailwind classes where conflicts are possible.
219
+ * cx — conflict-aware class merger.
220
+ * Native-first: delegates ke Rust `tw_merge` (required).
221
+ * Mendukung array inputs — flatten sebelum di-pass ke native.
204
222
  *
205
- * FIX #09: Previously named `cxm`. Renamed to `cx` as the primary utility.
206
- *
207
- * @example cx("p-4 p-8") "p-8" (conflict resolved, last wins)
208
- * @example cx("bg-red-500", "bg-blue-500") → "bg-blue-500"
223
+ * @example cx("p-4 p-8") → "p-8"
224
+ * @example cx("bg-red-500", "bg-blue-500") → "bg-blue-500"
225
+ * @example cx(["flex", "items-center"], "px-4") "flex items-center px-4"
209
226
  */
210
- declare function cx(...inputs: ClassValue[]): string;
227
+ declare function cx(...inputs: (ClassValue | ClassValue[])[]): string;
211
228
  /**
212
- * cxm — alias for cx(), kept for backward compatibility.
229
+ * cxm — alias untuk cx(), kept for backward compatibility.
213
230
  * @deprecated Use cx() instead.
214
231
  */
215
232
  declare const cxm: typeof cx;
@@ -223,11 +240,25 @@ interface ThemeConfig$1 {
223
240
  raw: Record<string, string>;
224
241
  }
225
242
 
243
+ /**
244
+ * tailwind-styled-v4 — createTwMerge()
245
+ *
246
+ * Native-only: uses Rust `tw_merge_many`; requires native binding.
247
+ * No JS fallback — tailwind-merge removed from bundle.
248
+ */
249
+
226
250
  interface MergeOptions {
227
251
  prefix?: string;
228
252
  separator?: string;
229
253
  theme?: ThemeConfig$1;
230
254
  }
255
+ /**
256
+ * createTwMerge — returns a conflict-aware merge function.
257
+ * Native-only: uses Rust `tw_merge_many`; throws if native binding unavailable.
258
+ *
259
+ * Note: `prefix` and `separator` options are not supported in native mode
260
+ * (Tailwind v3/v4 defaults are used).
261
+ */
231
262
  declare function createTwMerge(_options?: MergeOptions): (...classLists: Array<string | undefined | null | false>) => string;
232
263
  declare const twMerge: (...classLists: Array<string | undefined | null | false>) => string;
233
264
  declare function mergeWithRules(rules: Record<string, (classes: string[]) => string>, ...classLists: string[]): string;