tailwind-styled-v4 5.0.37 → 5.0.38

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 (119) hide show
  1. package/dist/analyzer.js +213 -161
  2. package/dist/analyzer.js.map +1 -1
  3. package/dist/analyzer.mjs +118 -82
  4. package/dist/analyzer.mjs.map +1 -1
  5. package/dist/animate.js +131 -87
  6. package/dist/animate.js.map +1 -1
  7. package/dist/animate.mjs +28 -14
  8. package/dist/animate.mjs.map +1 -1
  9. package/dist/atomic.js +105 -68
  10. package/dist/atomic.js.map +1 -1
  11. package/dist/atomic.mjs +40 -13
  12. package/dist/atomic.mjs.map +1 -1
  13. package/dist/cli.js +577 -426
  14. package/dist/cli.js.map +1 -1
  15. package/dist/cli.mjs +466 -304
  16. package/dist/cli.mjs.map +1 -1
  17. package/dist/compiler.js +826 -508
  18. package/dist/compiler.js.map +1 -1
  19. package/dist/compiler.mjs +287 -29
  20. package/dist/compiler.mjs.map +1 -1
  21. package/dist/dashboard.js +71 -41
  22. package/dist/dashboard.js.map +1 -1
  23. package/dist/dashboard.mjs +12 -6
  24. package/dist/dashboard.mjs.map +1 -1
  25. package/dist/devtools.js +333 -289
  26. package/dist/devtools.js.map +1 -1
  27. package/dist/devtools.mjs +26 -11
  28. package/dist/devtools.mjs.map +1 -1
  29. package/dist/engine.js +679 -502
  30. package/dist/engine.js.map +1 -1
  31. package/dist/engine.mjs +467 -307
  32. package/dist/engine.mjs.map +1 -1
  33. package/dist/index.d.mts +145 -319
  34. package/dist/index.d.ts +145 -319
  35. package/dist/index.js +1329 -7441
  36. package/dist/index.js.map +1 -1
  37. package/dist/index.mjs +1266 -7385
  38. package/dist/index.mjs.map +1 -1
  39. package/dist/next.js +318 -243
  40. package/dist/next.js.map +1 -1
  41. package/dist/next.mjs +256 -181
  42. package/dist/next.mjs.map +1 -1
  43. package/dist/plugin-api.js +93 -49
  44. package/dist/plugin-api.js.map +1 -1
  45. package/dist/plugin-api.mjs +26 -6
  46. package/dist/plugin-api.mjs.map +1 -1
  47. package/dist/plugin-registry.js +67 -40
  48. package/dist/plugin-registry.js.map +1 -1
  49. package/dist/plugin-registry.mjs +14 -10
  50. package/dist/plugin-registry.mjs.map +1 -1
  51. package/dist/plugin.js +101 -53
  52. package/dist/plugin.js.map +1 -1
  53. package/dist/plugin.mjs +30 -6
  54. package/dist/plugin.mjs.map +1 -1
  55. package/dist/preset.js +47 -15
  56. package/dist/preset.js.map +1 -1
  57. package/dist/preset.mjs +13 -5
  58. package/dist/preset.mjs.map +1 -1
  59. package/dist/rspack.js +82 -50
  60. package/dist/rspack.js.map +1 -1
  61. package/dist/rspack.mjs +20 -12
  62. package/dist/rspack.mjs.map +1 -1
  63. package/dist/runtime-css.js +62 -24
  64. package/dist/runtime-css.js.map +1 -1
  65. package/dist/runtime-css.mjs +15 -7
  66. package/dist/runtime-css.mjs.map +1 -1
  67. package/dist/runtime.js +97 -44
  68. package/dist/runtime.js.map +1 -1
  69. package/dist/runtime.mjs +31 -8
  70. package/dist/runtime.mjs.map +1 -1
  71. package/dist/scanner.js +163 -120
  72. package/dist/scanner.js.map +1 -1
  73. package/dist/scanner.mjs +67 -39
  74. package/dist/scanner.mjs.map +1 -1
  75. package/dist/shared.js +441 -295
  76. package/dist/shared.js.map +1 -1
  77. package/dist/shared.mjs +253 -122
  78. package/dist/shared.mjs.map +1 -1
  79. package/dist/storybook-addon.js +39 -10
  80. package/dist/storybook-addon.js.map +1 -1
  81. package/dist/storybook-addon.mjs +8 -3
  82. package/dist/storybook-addon.mjs.map +1 -1
  83. package/dist/svelte.js +88 -64
  84. package/dist/svelte.js.map +1 -1
  85. package/dist/svelte.mjs +28 -13
  86. package/dist/svelte.mjs.map +1 -1
  87. package/dist/syntax.js +68 -37
  88. package/dist/syntax.js.map +1 -1
  89. package/dist/syntax.mjs +8 -7
  90. package/dist/syntax.mjs.map +1 -1
  91. package/dist/testing.js +55 -18
  92. package/dist/testing.js.map +1 -1
  93. package/dist/testing.mjs +16 -3
  94. package/dist/testing.mjs.map +1 -1
  95. package/dist/theme.js +131 -74
  96. package/dist/theme.js.map +1 -1
  97. package/dist/theme.mjs +42 -13
  98. package/dist/theme.mjs.map +1 -1
  99. package/dist/turbopackLoader.js +150 -116
  100. package/dist/turbopackLoader.js.map +1 -1
  101. package/dist/turbopackLoader.mjs +124 -81
  102. package/dist/turbopackLoader.mjs.map +1 -1
  103. package/dist/tw.js +560 -421
  104. package/dist/tw.js.map +1 -1
  105. package/dist/tw.mjs +460 -302
  106. package/dist/tw.mjs.map +1 -1
  107. package/dist/vite.js +561 -446
  108. package/dist/vite.js.map +1 -1
  109. package/dist/vite.mjs +433 -321
  110. package/dist/vite.mjs.map +1 -1
  111. package/dist/vue.js +95 -70
  112. package/dist/vue.js.map +1 -1
  113. package/dist/vue.mjs +30 -14
  114. package/dist/vue.mjs.map +1 -1
  115. package/dist/webpackLoader.js +110 -78
  116. package/dist/webpackLoader.js.map +1 -1
  117. package/dist/webpackLoader.mjs +45 -17
  118. package/dist/webpackLoader.mjs.map +1 -1
  119. package/package.json +3 -1
package/dist/index.d.mts CHANGED
@@ -1,5 +1,4 @@
1
1
  import React from 'react';
2
- import { z } from 'zod';
3
2
 
4
3
  type CSSFillMode = "none" | "forwards" | "backwards" | "both";
5
4
  type CSSDirection = "normal" | "reverse" | "alternate" | "alternate-reverse";
@@ -220,63 +219,18 @@ type TwObject = TwComponentFactory & TwTagFactory & {
220
219
  };
221
220
 
222
221
  /**
223
- * tailwind-styled-v4 — Container Query Engine
224
- *
225
- * Generates @container rules from a simple breakpoint config.
226
- *
227
- * Usage:
228
- * const Card = tw.div({
229
- * base: "p-4",
230
- * container: {
231
- * sm: "flex-col", // @container (min-width: 320px)
232
- * md: "flex-row", // @container (min-width: 640px)
233
- * lg: "grid-cols-3", // @container (min-width: 1024px)
234
- * },
235
- * containerName: "card",
236
- * })
237
- *
238
- * // Wrap with container context:
239
- * const CardWrapper = tw.div`@container`
240
- *
241
- * Named containers:
242
- * const SidebarCard = tw.div({
243
- * base: "p-2",
244
- * container: { lg: "text-sm" },
245
- * containerName: "sidebar",
246
- * })
247
- * // Generates: @container sidebar (min-width: 1024px) { ... }
248
- */
249
-
250
- interface ContainerEntry {
251
- id: string;
252
- tag: string;
253
- containerName?: string;
254
- breakpoints: Array<{
255
- minWidth: string;
256
- classes: string;
257
- }>;
258
- cssInjected: boolean;
259
- }
260
- declare const containerRegistry: Map<string, ContainerEntry>;
261
- declare global {
262
- interface Window {
263
- __TW_CONTAINER_REGISTRY__?: typeof containerRegistry;
264
- }
265
- }
266
- interface ContainerQueryResult {
267
- containerClass: string;
268
- hasContainer: true;
269
- }
270
- declare function processContainer(tag: string, container: ContainerConfig, containerName?: string): ContainerQueryResult;
271
- /**
272
- * Generate @container CSS rules dari breakpoint config.
222
+ * tailwind-styled-v4 v2 tw
273
223
  *
274
- * Native-only: Rust string building tanpa intermediate allocations.
224
+ * API:
225
+ * tw.div`p-4 bg-zinc-900`
226
+ * tw.button`px-4 [icon] { h-4 w-4 }` ← sub-components inline
227
+ * tw.button({ base: "px-4", variants: { size: { sm: "text-sm" } } })
228
+ * tw(Link)`underline text-blue-400`
229
+ * tw.server.div`p-4` ← server-only, compiler enforced + runtime dev warning
275
230
  */
276
- declare function generateContainerCss(tag: string, container: ContainerConfig, containerName?: string): string;
277
- declare function getContainerRegistry(): Map<string, ContainerEntry>;
278
231
 
279
- declare function createComponent<TConfig extends ComponentConfig>(tag: React.ElementType, config: TConfig | string): TwStyledComponent<TConfig, InferSubFromConfig<TConfig>>;
232
+ declare const server: TwServerObject;
233
+ declare const tw: TwObject;
280
234
 
281
235
  /**
282
236
  * tailwind-styled-v4 — cv()
@@ -290,6 +244,11 @@ declare function createComponent<TConfig extends ComponentConfig>(tag: React.Ele
290
244
  * → Requires native Rust binding for variant resolution
291
245
  */
292
246
 
247
+ /**
248
+ * Register pre-computed variant table dari generated file.
249
+ * Dipanggil otomatis saat import variants.generated.ts
250
+ */
251
+ declare function registerVariantTable(componentId: string, table: Record<string, string>): void;
293
252
  declare function cv<C extends ComponentConfig>(config: C, componentId?: string): CvFn<C>;
294
253
 
295
254
  /**
@@ -316,39 +275,7 @@ declare function cx(...inputs: (ClassValue | ClassValue[])[]): string;
316
275
  /** @deprecated Use cx() instead. */
317
276
  declare const cxm: typeof cx;
318
277
 
319
- type TokenSubscriber = (tokens: TokenMap) => void;
320
- interface LiveTokenSet {
321
- vars: Record<string, string>;
322
- get(name: string): string | undefined;
323
- set(name: string, value: string): void;
324
- setAll(tokens: TokenMap): void;
325
- snapshot(): TokenMap;
326
- }
327
- interface LiveTokenEngineBridge {
328
- getToken(name: string): string | undefined;
329
- getTokens(): TokenMap;
330
- setToken(name: string, value: string): void;
331
- setTokens(tokens: TokenMap): void;
332
- applyTokenSet(tokens: TokenMap): void;
333
- subscribeTokens(fn: TokenSubscriber): () => void;
334
- subscribe?(fn: TokenSubscriber): () => void;
335
- }
336
- declare function tokenVar(name: string): string;
337
- declare function tokenRef(name: string): string;
338
- declare function liveToken(tokens: TokenMap): LiveTokenSet;
339
- declare function setToken(name: string, value: string): void;
340
- declare function setTokens(tokens: TokenMap): void;
341
- declare function applyTokenSet(tokens: TokenMap): void;
342
- declare function getToken(name: string): string | undefined;
343
- declare function getTokens(): TokenMap;
344
- declare function subscribeTokens(fn: TokenSubscriber): () => void;
345
- declare function generateTokenCssString(): string;
346
- declare function createUseTokens(): () => TokenMap;
347
- declare global {
348
- interface Window {
349
- __TW_TOKEN_ENGINE__?: LiveTokenEngineBridge;
350
- }
351
- }
278
+ declare function createComponent<TConfig extends ComponentConfig>(tag: React.ElementType, config: TConfig | string): TwStyledComponent<TConfig, InferSubFromConfig<TConfig>>;
352
279
 
353
280
  interface ThemeConfig$1 {
354
281
  colors: Record<string, string>;
@@ -373,45 +300,6 @@ declare function createTwMerge(_options?: MergeOptions): (...classLists: Array<s
373
300
  declare const twMerge: (...classLists: Array<string | undefined | null | false>) => string;
374
301
  declare function mergeWithRules(rules: Record<string, (classes: string[]) => string>, ...classLists: string[]): string;
375
302
 
376
- /**
377
- * tailwind-styled-v5 — Native Rust Bindings
378
- *
379
- * All functions require native Rust bindings.
380
- * Uses @tailwind-styled/shared for native resolution.
381
- */
382
- interface ParsedClassModifier {
383
- type: "opacity" | "arbitrary";
384
- value: string;
385
- }
386
- interface ParsedClass {
387
- raw: string;
388
- base: string;
389
- variants: string[];
390
- modifier?: ParsedClassModifier;
391
- }
392
- interface ThemeConfig {
393
- colors: Record<string, string>;
394
- spacing: Record<string, string>;
395
- fonts: Record<string, string>;
396
- breakpoints: Record<string, string>;
397
- animations: Record<string, string>;
398
- raw: Record<string, string>;
399
- }
400
-
401
- interface SubComponentProps {
402
- children?: React.ReactNode;
403
- className?: string;
404
- }
405
- interface SubComponentEntry {
406
- name: string;
407
- component: React.FC<SubComponentProps>;
408
- defaultClasses?: string;
409
- }
410
- declare function registerSubComponent(entry: SubComponentEntry): void;
411
- declare function getSubComponent(name: string): SubComponentEntry | undefined;
412
- declare function getAllSubComponents(): SubComponentEntry[];
413
- declare function withSubComponents<T extends object>(Component: T, subComponentNames: string[]): T & Record<string, React.FC<SubComponentProps>>;
414
-
415
303
  /**
416
304
  * tailwind-styled-v4 — Reactive State Engine
417
305
  *
@@ -470,20 +358,62 @@ declare function generateStateCss(tag: string, state: StateConfig): string;
470
358
  */
471
359
  declare function getStateRegistry(): Map<string, StateComponentEntry>;
472
360
 
473
- interface StyledOptions {
474
- base?: string;
475
- variants?: Record<string, Record<string, string>>;
476
- defaultVariants?: Record<string, string>;
477
- compoundVariants?: Array<{
478
- variants: Record<string, string>;
479
- className: string;
361
+ /**
362
+ * tailwind-styled-v4 — Container Query Engine
363
+ *
364
+ * Generates @container rules from a simple breakpoint config.
365
+ *
366
+ * Usage:
367
+ * const Card = tw.div({
368
+ * base: "p-4",
369
+ * container: {
370
+ * sm: "flex-col", // @container (min-width: 320px)
371
+ * md: "flex-row", // @container (min-width: 640px)
372
+ * lg: "grid-cols-3", // @container (min-width: 1024px)
373
+ * },
374
+ * containerName: "card",
375
+ * })
376
+ *
377
+ * // Wrap with container context:
378
+ * const CardWrapper = tw.div`@container`
379
+ *
380
+ * Named containers:
381
+ * const SidebarCard = tw.div({
382
+ * base: "p-2",
383
+ * container: { lg: "text-sm" },
384
+ * containerName: "sidebar",
385
+ * })
386
+ * // Generates: @container sidebar (min-width: 1024px) { ... }
387
+ */
388
+
389
+ interface ContainerEntry {
390
+ id: string;
391
+ tag: string;
392
+ containerName?: string;
393
+ breakpoints: Array<{
394
+ minWidth: string;
395
+ classes: string;
480
396
  }>;
397
+ cssInjected: boolean;
481
398
  }
482
- type StyledProps = {
483
- className?: string;
484
- } & Record<string, string | number | boolean | undefined>;
485
- declare function resolveStyledClassName(options: StyledOptions, props?: StyledProps): string;
486
- declare function styled(options: StyledOptions): (props?: StyledProps) => string;
399
+ declare const containerRegistry: Map<string, ContainerEntry>;
400
+ declare global {
401
+ interface Window {
402
+ __TW_CONTAINER_REGISTRY__?: typeof containerRegistry;
403
+ }
404
+ }
405
+ interface ContainerQueryResult {
406
+ containerClass: string;
407
+ hasContainer: true;
408
+ }
409
+ declare function processContainer(tag: string, container: ContainerConfig, containerName?: string): ContainerQueryResult;
410
+ /**
411
+ * Generate @container CSS rules dari breakpoint config.
412
+ *
413
+ * Native-only: Rust string building tanpa intermediate allocations.
414
+ */
415
+ declare function generateContainerCss(tag: string, container: ContainerConfig, containerName?: string): string;
416
+ declare function getContainerRegistry(): Map<string, ContainerEntry>;
487
417
 
488
418
  /**
489
419
  * tailwind-styled-v4 — createStyledSystem()
@@ -576,19 +506,20 @@ type StyledSystemInstance<T extends SystemTokenMap, C extends Record<string, Sys
576
506
  };
577
507
  declare function createStyledSystem<T extends SystemTokenMap = SystemTokenMap, C extends Record<string, SystemComponentConfig> = Record<string, SystemComponentConfig>>(config: StyledSystemConfig<T, C>): StyledSystemInstance<T, C>;
578
508
 
579
- /**
580
- * tailwind-styled-v4 v2 — tw
581
- *
582
- * API:
583
- * tw.div`p-4 bg-zinc-900`
584
- * tw.button`px-4 [icon] { h-4 w-4 }` ← sub-components inline
585
- * tw.button({ base: "px-4", variants: { size: { sm: "text-sm" } } })
586
- * tw(Link)`underline text-blue-400`
587
- * tw.server.div`p-4` ← server-only, compiler enforced + runtime dev warning
588
- */
589
-
590
- declare const server: TwServerObject;
591
- declare const tw: TwObject;
509
+ interface StyledOptions {
510
+ base?: string;
511
+ variants?: Record<string, Record<string, string>>;
512
+ defaultVariants?: Record<string, string>;
513
+ compoundVariants?: Array<{
514
+ variants: Record<string, string>;
515
+ className: string;
516
+ }>;
517
+ }
518
+ type StyledProps = {
519
+ className?: string;
520
+ } & Record<string, string | number | boolean | undefined>;
521
+ declare function resolveStyledClassName(options: StyledOptions, props?: StyledProps): string;
522
+ declare function styled(options: StyledOptions): (props?: StyledProps) => string;
592
523
 
593
524
  /**
594
525
  * tailwind-styled-v4 v2 — twTheme
@@ -724,182 +655,77 @@ declare const v4Tokens: {
724
655
  readonly fontMono: string;
725
656
  };
726
657
 
727
- declare const ScanWorkspaceOptionsSchema: z.ZodObject<{
728
- includeExtensions: z.ZodOptional<z.ZodArray<z.ZodString>>;
729
- ignoreDirectories: z.ZodOptional<z.ZodArray<z.ZodString>>;
730
- useCache: z.ZodOptional<z.ZodBoolean>;
731
- cacheDir: z.ZodOptional<z.ZodString>;
732
- smartInvalidation: z.ZodOptional<z.ZodBoolean>;
733
- }, z.core.$strip>;
734
- type ScanWorkspaceOptions = z.infer<typeof ScanWorkspaceOptionsSchema>;
735
- declare const ScanWorkspaceResultSchema: z.ZodObject<{
736
- files: z.ZodArray<z.ZodObject<{
737
- file: z.ZodString;
738
- classes: z.ZodArray<z.ZodString>;
739
- hash: z.ZodOptional<z.ZodString>;
740
- }, z.core.$strip>>;
741
- totalFiles: z.ZodNumber;
742
- uniqueClasses: z.ZodArray<z.ZodString>;
743
- }, z.core.$strip>;
744
- type ScanWorkspaceResult = z.infer<typeof ScanWorkspaceResultSchema>;
745
-
746
- /**
747
- * Public type contracts for @tailwind-styled/analyzer.
748
- * Keep this file aligned with the runtime report shape exposed by src/index.ts.
749
- */
750
-
751
- interface ClassUsage {
752
- readonly name: string;
753
- readonly count: number;
754
- readonly isUnused?: boolean;
755
- readonly isConflict?: boolean;
756
- }
757
- interface ClassConflict {
758
- readonly className: string;
759
- readonly variants: readonly string[];
760
- readonly classes: readonly string[];
761
- readonly message: string;
762
- }
763
- interface AnalyzerClassStats {
764
- readonly all: readonly ClassUsage[];
765
- readonly top: readonly ClassUsage[];
766
- readonly frequent: readonly ClassUsage[];
767
- readonly unique: readonly ClassUsage[];
768
- readonly distribution: Readonly<Record<string, number>>;
769
- }
770
- interface TailwindConfigSummary {
771
- readonly path: string;
772
- readonly loaded: boolean;
773
- readonly safelistCount: number;
774
- readonly customUtilityCount: number;
775
- readonly warning?: string;
776
- }
777
- interface AnalyzerSemanticReport {
778
- readonly unusedClasses: readonly ClassUsage[];
779
- readonly unknownClasses: readonly ClassUsage[];
780
- readonly conflicts: readonly ClassConflict[];
781
- readonly tailwindConfig?: TailwindConfigSummary;
782
- }
783
- interface AnalyzerReport {
784
- readonly root: string;
785
- readonly totalFiles: number;
786
- readonly uniqueClassCount: number;
787
- readonly totalClassOccurrences: number;
788
- readonly classStats: AnalyzerClassStats;
789
- /** Alias for classStats.top — backward compat & test contract */
790
- readonly topClasses: readonly ClassUsage[];
791
- readonly safelist: readonly string[];
792
- readonly semantic?: AnalyzerSemanticReport;
658
+ type TokenSubscriber = (tokens: TokenMap) => void;
659
+ interface LiveTokenSet {
660
+ vars: Record<string, string>;
661
+ get(name: string): string | undefined;
662
+ set(name: string, value: string): void;
663
+ setAll(tokens: TokenMap): void;
664
+ snapshot(): TokenMap;
793
665
  }
794
- interface AnalyzerOptions {
795
- readonly scanner?: ScanWorkspaceOptions;
796
- readonly classStats?: {
797
- readonly top?: number;
798
- readonly frequentThreshold?: number;
799
- };
800
- readonly includeClass?: (className: string) => boolean;
801
- readonly semantic?: boolean | {
802
- readonly tailwindConfigPath?: string;
803
- };
666
+ interface LiveTokenEngineBridge {
667
+ getToken(name: string): string | undefined;
668
+ getTokens(): TokenMap;
669
+ setToken(name: string, value: string): void;
670
+ setTokens(tokens: TokenMap): void;
671
+ applyTokenSet(tokens: TokenMap): void;
672
+ subscribeTokens(fn: TokenSubscriber): () => void;
673
+ subscribe?(fn: TokenSubscriber): () => void;
804
674
  }
805
-
806
- /**
807
- * Analyze Tailwind class usage in a workspace and return usage statistics.
808
- * Set `semantic.tailwindConfigPath` to override Tailwind config lookup.
809
- * @example
810
- * const report = await analyzeWorkspace("./src", {
811
- * classStats: { top: 20, frequentThreshold: 2 },
812
- * semantic: { tailwindConfigPath: "tailwind.config.js" },
813
- * })
814
- */
815
- declare function analyzeWorkspace(root: string, options?: AnalyzerOptions): Promise<AnalyzerReport>;
816
-
817
- interface EngineMetricsSnapshot {
818
- eventsReceived: number;
819
- eventsProcessed: number;
820
- batchesProcessed: number;
821
- incrementalUpdates: number;
822
- fullRescans: number;
823
- skippedLargeFiles: number;
824
- queueMaxSize: number;
825
- lastBuildMs: number;
826
- avgBuildMs: number;
675
+ declare function tokenVar(name: string): string;
676
+ declare function tokenRef(name: string): string;
677
+ declare function liveToken(tokens: TokenMap): LiveTokenSet;
678
+ declare function setToken(name: string, value: string): void;
679
+ declare function setTokens(tokens: TokenMap): void;
680
+ declare function applyTokenSet(tokens: TokenMap): void;
681
+ declare function getToken(name: string): string | undefined;
682
+ declare function getTokens(): TokenMap;
683
+ declare function subscribeTokens(fn: TokenSubscriber): () => void;
684
+ declare function generateTokenCssString(): string;
685
+ declare function createUseTokens(): () => TokenMap;
686
+ declare global {
687
+ interface Window {
688
+ __TW_TOKEN_ENGINE__?: LiveTokenEngineBridge;
689
+ }
827
690
  }
828
691
 
829
- interface EnginePluginContext {
830
- root: string;
831
- timestamp: number;
832
- }
833
- interface EngineWatchContext {
834
- root: string;
835
- timestamp: number;
692
+ interface SubComponentProps {
693
+ children?: React.ReactNode;
694
+ className?: string;
836
695
  }
837
- interface EnginePlugin {
696
+ interface SubComponentEntry {
838
697
  name: string;
839
- beforeScan?(context: EnginePluginContext): void | Promise<void>;
840
- afterScan?(scan: ScanWorkspaceResult, context: EnginePluginContext): ScanWorkspaceResult | undefined | Promise<ScanWorkspaceResult | undefined>;
841
- transformClasses?(classes: string[], context: EnginePluginContext): string[] | undefined | Promise<string[] | undefined>;
842
- beforeBuild?(scan: ScanWorkspaceResult, context: EnginePluginContext): void | Promise<void>;
843
- afterBuild?(result: BuildResult, context: EnginePluginContext): BuildResult | undefined | Promise<BuildResult | undefined>;
844
- onError?(error: Error, context: EnginePluginContext): void | Promise<void>;
845
- beforeWatch?(context: EngineWatchContext): void | Promise<void>;
846
- afterWatch?(context: EngineWatchContext): void | Promise<void>;
698
+ component: React.FC<SubComponentProps>;
699
+ defaultClasses?: string;
847
700
  }
701
+ declare function registerSubComponent(entry: SubComponentEntry): void;
702
+ declare function getSubComponent(name: string): SubComponentEntry | undefined;
703
+ declare function getAllSubComponents(): SubComponentEntry[];
704
+ declare function withSubComponents<T extends object>(Component: T, subComponentNames: string[]): T & Record<string, React.FC<SubComponentProps>>;
848
705
 
849
- interface EngineOptions {
850
- root?: string;
851
- scanner?: ScanWorkspaceOptions;
852
- compileCss?: boolean;
853
- tailwindConfigPath?: string;
854
- plugins?: EnginePlugin[];
855
- /** Enable analyzer integration - provides semantic report (unused classes, conflicts). Default: false */
856
- analyze?: boolean;
857
- }
858
- interface EngineWatchOptions {
859
- debounceMs?: number;
860
- maxEventsPerFlush?: number;
861
- largeFileThreshold?: number;
706
+ /**
707
+ * tailwind-styled-v5 — Native Rust Bindings
708
+ *
709
+ * All functions require native Rust bindings.
710
+ * Uses @tailwind-styled/shared for native resolution.
711
+ */
712
+ interface ParsedClassModifier {
713
+ type: "opacity" | "arbitrary";
714
+ value: string;
862
715
  }
863
- interface BuildResult {
864
- scan: ScanWorkspaceResult;
865
- mergedClassList: string;
866
- css: string;
867
- /** Analyzer semantic report - present when analyze: true in options */
868
- analysis?: {
869
- unusedClasses: string[];
870
- classConflicts: Array<{
871
- className: string;
872
- files: string[];
873
- classes?: string[];
874
- message?: string;
875
- }>;
876
- classUsage: Record<string, number>;
877
- semantic?: AnalyzerSemanticReport;
878
- report: AnalyzerReport;
879
- };
716
+ interface ParsedClass {
717
+ raw: string;
718
+ base: string;
719
+ variants: string[];
720
+ modifier?: ParsedClassModifier;
880
721
  }
881
- type EngineBuildWatchEventType = "initial" | "change" | "unlink" | "full-rescan";
882
- type EngineWatchEvent = {
883
- type: EngineBuildWatchEventType;
884
- filePath?: string;
885
- result: BuildResult;
886
- metrics?: EngineMetricsSnapshot;
887
- } | {
888
- type: "error";
889
- filePath?: string;
890
- error: string;
891
- metrics?: EngineMetricsSnapshot;
892
- };
893
- interface TailwindStyledEngine {
894
- scan(): Promise<ScanWorkspaceResult>;
895
- scanWorkspace(): Promise<ScanWorkspaceResult>;
896
- analyzeWorkspace(): Promise<Awaited<ReturnType<typeof analyzeWorkspace>>>;
897
- generateSafelist(): Promise<string[]>;
898
- build(): Promise<BuildResult>;
899
- watch(onEvent: (event: EngineWatchEvent) => void, options?: EngineWatchOptions): Promise<{
900
- close(): void;
901
- }>;
722
+ interface ThemeConfig {
723
+ colors: Record<string, string>;
724
+ spacing: Record<string, string>;
725
+ fonts: Record<string, string>;
726
+ breakpoints: Record<string, string>;
727
+ animations: Record<string, string>;
728
+ raw: Record<string, string>;
902
729
  }
903
- declare function createEngine(rawOptions?: EngineOptions): Promise<TailwindStyledEngine>;
904
730
 
905
- export { type ComponentConfig, type ContainerConfig, type ContainerEntry, type CvFn, type HtmlTagName, type InferVariantProps, type LiveTokenSet, type MergeOptions, type ParsedClass, type ParsedClassModifier, type ResolvedThemeTokens, type StateComponentEntry, type StateConfig, type StyledComponentProps, type StyledOptions, type StyledProps, type StyledSystemConfig, type StyledSystemInstance, type SubComponentEntry, type SubComponentMap, type SubComponentProps, type SystemComponentConfig, type SystemComponentFactory, type SystemTokenMap, type ThemeConfig, type ThemeTokenMap, type TokenMap, type TokenSubscriber, type TwComponentFactory, type TwObject, type TwStyledComponent, type TwSubComponent, type TwTagFactory, type TwTagFactoryAny, type VariantLiterals, applyTokenSet, cn, tokenRef as containerRef, createComponent, createEngine, createStyledSystem, createTheme, createTwMerge, createUseTokens, cssVar, cv, cx, cxm, generateContainerCss, generateStateCss, generateTokenCssString, getAllSubComponents, getContainerRegistry, getStateRegistry, getSubComponent, getToken, getTokens, liveToken, mergeWithRules, processContainer, processState, registerSubComponent, resolveStyledClassName, server, setToken, setTokens, styled, subscribeTokens, t, tokenRef, tokenVar, tw, twMerge, twVar, v4Tokens, withSubComponents };
731
+ export { type ComponentConfig, type ContainerConfig, type ContainerEntry, type CvFn, type HtmlTagName, type InferVariantProps, type LiveTokenSet, type MergeOptions, type ParsedClass, type ParsedClassModifier, type ResolvedThemeTokens, type StateComponentEntry, type StateConfig, type StyledComponentProps, type StyledOptions, type StyledProps, type StyledSystemConfig, type StyledSystemInstance, type SubComponentEntry, type SubComponentMap, type SubComponentProps, type SystemComponentConfig, type SystemComponentFactory, type SystemTokenMap, type ThemeConfig, type ThemeTokenMap, type TokenMap, type TokenSubscriber, type TwComponentFactory, type TwObject, type TwStyledComponent, type TwSubComponent, type TwTagFactory, type TwTagFactoryAny, type VariantLiterals, applyTokenSet, cn, tokenRef as containerRef, createComponent, createStyledSystem, createTheme, createTwMerge, createUseTokens, cssVar, cv, cx, cxm, generateContainerCss, generateStateCss, generateTokenCssString, getAllSubComponents, getContainerRegistry, getStateRegistry, getSubComponent, getToken, getTokens, liveToken, mergeWithRules, processContainer, processState, registerSubComponent, registerVariantTable, resolveStyledClassName, server, setToken, setTokens, styled, subscribeTokens, t, tokenRef, tokenVar, tw, twMerge, twVar, v4Tokens, withSubComponents };