tailwind-styled-v4 4.0.0 → 5.0.0

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 (77) hide show
  1. package/dist/animate.cjs +754 -235
  2. package/dist/animate.cjs.map +1 -1
  3. package/dist/animate.d.cts +55 -99
  4. package/dist/animate.d.ts +55 -99
  5. package/dist/animate.js +742 -235
  6. package/dist/animate.js.map +1 -1
  7. package/dist/chunk-VZEJV27B.js +11 -0
  8. package/dist/chunk-VZEJV27B.js.map +1 -0
  9. package/dist/chunk-Y5D3E72P.cjs +13 -0
  10. package/dist/chunk-Y5D3E72P.cjs.map +1 -0
  11. package/dist/css.cjs +61 -11
  12. package/dist/css.cjs.map +1 -1
  13. package/dist/css.d.cts +3 -18
  14. package/dist/css.d.ts +3 -18
  15. package/dist/css.js +61 -11
  16. package/dist/css.js.map +1 -1
  17. package/dist/devtools.cjs +200 -88
  18. package/dist/devtools.cjs.map +1 -1
  19. package/dist/devtools.js +200 -88
  20. package/dist/devtools.js.map +1 -1
  21. package/dist/index.cjs +430 -135
  22. package/dist/index.cjs.map +1 -1
  23. package/dist/index.d.cts +74 -3
  24. package/dist/index.d.ts +74 -3
  25. package/dist/index.js +415 -132
  26. package/dist/index.js.map +1 -1
  27. package/dist/next.cjs +118 -138
  28. package/dist/next.cjs.map +1 -1
  29. package/dist/next.d.cts +28 -19
  30. package/dist/next.d.ts +28 -19
  31. package/dist/next.js +111 -131
  32. package/dist/next.js.map +1 -1
  33. package/dist/preset.cjs +312 -18
  34. package/dist/preset.cjs.map +1 -1
  35. package/dist/preset.d.cts +29 -2
  36. package/dist/preset.d.ts +29 -2
  37. package/dist/preset.js +311 -19
  38. package/dist/preset.js.map +1 -1
  39. package/dist/turbopackLoader.cjs +24 -2676
  40. package/dist/turbopackLoader.cjs.map +1 -1
  41. package/dist/turbopackLoader.d.cts +3 -13
  42. package/dist/turbopackLoader.d.ts +3 -13
  43. package/dist/turbopackLoader.js +24 -2670
  44. package/dist/turbopackLoader.js.map +1 -1
  45. package/dist/vite.cjs +90 -57
  46. package/dist/vite.cjs.map +1 -1
  47. package/dist/vite.d.cts +35 -6
  48. package/dist/vite.d.ts +35 -6
  49. package/dist/vite.js +90 -58
  50. package/dist/vite.js.map +1 -1
  51. package/dist/webpackLoader.cjs +27 -2646
  52. package/dist/webpackLoader.cjs.map +1 -1
  53. package/dist/webpackLoader.d.cts +3 -10
  54. package/dist/webpackLoader.d.ts +3 -10
  55. package/dist/webpackLoader.js +27 -2640
  56. package/dist/webpackLoader.js.map +1 -1
  57. package/package.json +31 -28
  58. package/dist/astTransform-ua-eapqs.d.cts +0 -41
  59. package/dist/astTransform-ua-eapqs.d.ts +0 -41
  60. package/dist/compiler.cjs +0 -3594
  61. package/dist/compiler.cjs.map +0 -1
  62. package/dist/compiler.d.cts +0 -716
  63. package/dist/compiler.d.ts +0 -716
  64. package/dist/compiler.js +0 -3535
  65. package/dist/compiler.js.map +0 -1
  66. package/dist/plugins.cjs +0 -396
  67. package/dist/plugins.cjs.map +0 -1
  68. package/dist/plugins.d.cts +0 -231
  69. package/dist/plugins.d.ts +0 -231
  70. package/dist/plugins.js +0 -381
  71. package/dist/plugins.js.map +0 -1
  72. package/dist/theme.cjs +0 -154
  73. package/dist/theme.cjs.map +0 -1
  74. package/dist/theme.d.cts +0 -181
  75. package/dist/theme.d.ts +0 -181
  76. package/dist/theme.js +0 -148
  77. package/dist/theme.js.map +0 -1
package/dist/index.d.cts CHANGED
@@ -39,8 +39,8 @@ type StyledComponentProps<P extends object, C extends ComponentConfig = Componen
39
39
  interface TwStyledComponent<P extends object = Record<string, any>> extends React.ForwardRefExoticComponent<P & React.RefAttributes<any>> {
40
40
  extend(strings: TemplateStringsArray, ...exprs: any[]): TwStyledComponent<P>;
41
41
  withVariants(config: Partial<ComponentConfig>): TwStyledComponent<P>;
42
- /** Attach a CSS animation. Requires @tailwind-styled/animate. */
43
- animate(opts: _tailwind_styled_animate.AnimateOptions): TwStyledComponent<P>;
42
+ /** Attach a CSS animation. Requires @tailwind-styled/animate v5 async API. */
43
+ animate(opts: _tailwind_styled_animate.AnimateOptions): Promise<TwStyledComponent<P>>;
44
44
  }
45
45
  type CvFn<C extends ComponentConfig> = (props?: InferVariantProps<C> & {
46
46
  className?: string;
@@ -190,6 +190,28 @@ declare function cx(...inputs: ClassValue[]): string;
190
190
  */
191
191
  declare const cxm: typeof cx;
192
192
 
193
+ interface ThemeConfig {
194
+ colors: Record<string, string>;
195
+ spacing: Record<string, string>;
196
+ fonts: Record<string, string>;
197
+ breakpoints: Record<string, string>;
198
+ animations: Record<string, string>;
199
+ raw: Record<string, string>;
200
+ }
201
+ declare function resolveThemeValue(key: string, theme: ThemeConfig, visited?: Set<string>): string;
202
+ declare function extractThemeFromCSS(cssContent: string): ThemeConfig;
203
+ declare function generateTypeDefinitions(theme: ThemeConfig): string;
204
+ declare function clearThemeReaderCache(): void;
205
+
206
+ interface MergeOptions {
207
+ prefix?: string;
208
+ separator?: string;
209
+ theme?: ThemeConfig;
210
+ }
211
+ declare function createTwMerge(_options?: MergeOptions): (...classLists: Array<string | undefined | null | false>) => string;
212
+ declare const twMerge: (...classLists: Array<string | undefined | null | false>) => string;
213
+ declare function mergeWithRules(rules: Record<string, (classes: string[]) => string>, ...classLists: string[]): string;
214
+
193
215
  /**
194
216
  * tailwind-styled-v4 — Live Token Engine
195
217
  *
@@ -434,6 +456,21 @@ type StyledSystemInstance<T extends SystemTokenMap, C extends Record<string, Sys
434
456
  };
435
457
  declare function createStyledSystem<T extends SystemTokenMap = SystemTokenMap, C extends Record<string, SystemComponentConfig> = Record<string, SystemComponentConfig>>(config: StyledSystemConfig<T, C>): StyledSystemInstance<T, C>;
436
458
 
459
+ interface StyledOptions {
460
+ base?: string;
461
+ variants?: Record<string, Record<string, string>>;
462
+ defaultVariants?: Record<string, string>;
463
+ compoundVariants?: Array<{
464
+ variants: Record<string, string>;
465
+ className: string;
466
+ }>;
467
+ }
468
+ type StyledProps = {
469
+ className?: string;
470
+ } & Record<string, string | number | boolean | undefined>;
471
+ declare function resolveStyledClassName(options: StyledOptions, props?: StyledProps): string;
472
+ declare function styled(options: StyledOptions): (props?: StyledProps) => string;
473
+
437
474
  /**
438
475
  * tailwind-styled-v4 v2 — tw
439
476
  *
@@ -581,4 +618,38 @@ declare const v4Tokens: {
581
618
  readonly fontMono: string;
582
619
  };
583
620
 
584
- export { type ComponentConfig, type ContainerConfig, type ContainerEntry, type CvFn, type HtmlTagName, type InferVariantProps, type LiveTokenSet, type ResolvedThemeTokens, type StateComponentEntry, type StateConfig, type StyledComponentProps, type StyledSystemConfig, type StyledSystemInstance, type SystemComponentConfig, type SystemComponentFactory, type SystemTokenMap, type ThemeTokenMap, type TokenMap, type TokenSubscriber, type TwComponentFactory, type TwObject, type TwStyledComponent, type TwTagFactory, type VariantLiterals, applyTokenSet, cn, tokenRef as containerRef, createComponent, createStyledSystem, createTheme, createUseTokens, cssVar, cv, cx, cxm, generateContainerCss, generateStateCss, generateTokenCssString, getContainerRegistry, getStateRegistry, getToken, getTokens, liveToken, processContainer, processState, server, setToken, setTokens, subscribeTokens, t, tokenRef, tokenVar, tw, twVar, v4Tokens };
621
+ /**
622
+ * tailwind-styled-v4 — Class parser
623
+ *
624
+ * Tries the Rust native binding first (parse_classes via napi),
625
+ * falls back to the JS implementation when the binding is unavailable.
626
+ *
627
+ * Public API is unchanged — same types and functions as before.
628
+ */
629
+ interface ParsedClassModifier {
630
+ type: "opacity" | "arbitrary";
631
+ value: string;
632
+ }
633
+ interface ParsedClass {
634
+ raw: string;
635
+ base: string;
636
+ variants: string[];
637
+ modifier?: ParsedClassModifier;
638
+ }
639
+ /**
640
+ * Split a Tailwind class string, preserving bracket/parenthesis expressions.
641
+ * Uses Rust napi when available, JS fallback otherwise.
642
+ */
643
+ declare function splitClassList(input: string): string[];
644
+ /**
645
+ * Parse a single Tailwind class token into variants + base + modifier metadata.
646
+ * Uses Rust napi when available, JS fallback otherwise.
647
+ */
648
+ declare function parseClassToken(rawToken: string): ParsedClass;
649
+ /**
650
+ * Parse all Tailwind classes in a space-separated string.
651
+ * Uses Rust napi for bulk parsing when available.
652
+ */
653
+ declare function parseTailwindClasses(input: string): ParsedClass[];
654
+
655
+ 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 SystemComponentConfig, type SystemComponentFactory, type SystemTokenMap, type ThemeConfig, type ThemeTokenMap, type TokenMap, type TokenSubscriber, type TwComponentFactory, type TwObject, type TwStyledComponent, type TwTagFactory, type VariantLiterals, applyTokenSet, clearThemeReaderCache, cn, tokenRef as containerRef, createComponent, createStyledSystem, createTheme, createTwMerge, createUseTokens, cssVar, cv, cx, cxm, extractThemeFromCSS, generateContainerCss, generateStateCss, generateTokenCssString, generateTypeDefinitions, getContainerRegistry, getStateRegistry, getToken, getTokens, liveToken, mergeWithRules, parseClassToken, parseTailwindClasses, processContainer, processState, resolveStyledClassName, resolveThemeValue, server, setToken, setTokens, splitClassList, styled, subscribeTokens, t, tokenRef, tokenVar, tw, twMerge, twVar, v4Tokens };
package/dist/index.d.ts CHANGED
@@ -39,8 +39,8 @@ type StyledComponentProps<P extends object, C extends ComponentConfig = Componen
39
39
  interface TwStyledComponent<P extends object = Record<string, any>> extends React.ForwardRefExoticComponent<P & React.RefAttributes<any>> {
40
40
  extend(strings: TemplateStringsArray, ...exprs: any[]): TwStyledComponent<P>;
41
41
  withVariants(config: Partial<ComponentConfig>): TwStyledComponent<P>;
42
- /** Attach a CSS animation. Requires @tailwind-styled/animate. */
43
- animate(opts: _tailwind_styled_animate.AnimateOptions): TwStyledComponent<P>;
42
+ /** Attach a CSS animation. Requires @tailwind-styled/animate v5 async API. */
43
+ animate(opts: _tailwind_styled_animate.AnimateOptions): Promise<TwStyledComponent<P>>;
44
44
  }
45
45
  type CvFn<C extends ComponentConfig> = (props?: InferVariantProps<C> & {
46
46
  className?: string;
@@ -190,6 +190,28 @@ declare function cx(...inputs: ClassValue[]): string;
190
190
  */
191
191
  declare const cxm: typeof cx;
192
192
 
193
+ interface ThemeConfig {
194
+ colors: Record<string, string>;
195
+ spacing: Record<string, string>;
196
+ fonts: Record<string, string>;
197
+ breakpoints: Record<string, string>;
198
+ animations: Record<string, string>;
199
+ raw: Record<string, string>;
200
+ }
201
+ declare function resolveThemeValue(key: string, theme: ThemeConfig, visited?: Set<string>): string;
202
+ declare function extractThemeFromCSS(cssContent: string): ThemeConfig;
203
+ declare function generateTypeDefinitions(theme: ThemeConfig): string;
204
+ declare function clearThemeReaderCache(): void;
205
+
206
+ interface MergeOptions {
207
+ prefix?: string;
208
+ separator?: string;
209
+ theme?: ThemeConfig;
210
+ }
211
+ declare function createTwMerge(_options?: MergeOptions): (...classLists: Array<string | undefined | null | false>) => string;
212
+ declare const twMerge: (...classLists: Array<string | undefined | null | false>) => string;
213
+ declare function mergeWithRules(rules: Record<string, (classes: string[]) => string>, ...classLists: string[]): string;
214
+
193
215
  /**
194
216
  * tailwind-styled-v4 — Live Token Engine
195
217
  *
@@ -434,6 +456,21 @@ type StyledSystemInstance<T extends SystemTokenMap, C extends Record<string, Sys
434
456
  };
435
457
  declare function createStyledSystem<T extends SystemTokenMap = SystemTokenMap, C extends Record<string, SystemComponentConfig> = Record<string, SystemComponentConfig>>(config: StyledSystemConfig<T, C>): StyledSystemInstance<T, C>;
436
458
 
459
+ interface StyledOptions {
460
+ base?: string;
461
+ variants?: Record<string, Record<string, string>>;
462
+ defaultVariants?: Record<string, string>;
463
+ compoundVariants?: Array<{
464
+ variants: Record<string, string>;
465
+ className: string;
466
+ }>;
467
+ }
468
+ type StyledProps = {
469
+ className?: string;
470
+ } & Record<string, string | number | boolean | undefined>;
471
+ declare function resolveStyledClassName(options: StyledOptions, props?: StyledProps): string;
472
+ declare function styled(options: StyledOptions): (props?: StyledProps) => string;
473
+
437
474
  /**
438
475
  * tailwind-styled-v4 v2 — tw
439
476
  *
@@ -581,4 +618,38 @@ declare const v4Tokens: {
581
618
  readonly fontMono: string;
582
619
  };
583
620
 
584
- export { type ComponentConfig, type ContainerConfig, type ContainerEntry, type CvFn, type HtmlTagName, type InferVariantProps, type LiveTokenSet, type ResolvedThemeTokens, type StateComponentEntry, type StateConfig, type StyledComponentProps, type StyledSystemConfig, type StyledSystemInstance, type SystemComponentConfig, type SystemComponentFactory, type SystemTokenMap, type ThemeTokenMap, type TokenMap, type TokenSubscriber, type TwComponentFactory, type TwObject, type TwStyledComponent, type TwTagFactory, type VariantLiterals, applyTokenSet, cn, tokenRef as containerRef, createComponent, createStyledSystem, createTheme, createUseTokens, cssVar, cv, cx, cxm, generateContainerCss, generateStateCss, generateTokenCssString, getContainerRegistry, getStateRegistry, getToken, getTokens, liveToken, processContainer, processState, server, setToken, setTokens, subscribeTokens, t, tokenRef, tokenVar, tw, twVar, v4Tokens };
621
+ /**
622
+ * tailwind-styled-v4 — Class parser
623
+ *
624
+ * Tries the Rust native binding first (parse_classes via napi),
625
+ * falls back to the JS implementation when the binding is unavailable.
626
+ *
627
+ * Public API is unchanged — same types and functions as before.
628
+ */
629
+ interface ParsedClassModifier {
630
+ type: "opacity" | "arbitrary";
631
+ value: string;
632
+ }
633
+ interface ParsedClass {
634
+ raw: string;
635
+ base: string;
636
+ variants: string[];
637
+ modifier?: ParsedClassModifier;
638
+ }
639
+ /**
640
+ * Split a Tailwind class string, preserving bracket/parenthesis expressions.
641
+ * Uses Rust napi when available, JS fallback otherwise.
642
+ */
643
+ declare function splitClassList(input: string): string[];
644
+ /**
645
+ * Parse a single Tailwind class token into variants + base + modifier metadata.
646
+ * Uses Rust napi when available, JS fallback otherwise.
647
+ */
648
+ declare function parseClassToken(rawToken: string): ParsedClass;
649
+ /**
650
+ * Parse all Tailwind classes in a space-separated string.
651
+ * Uses Rust napi for bulk parsing when available.
652
+ */
653
+ declare function parseTailwindClasses(input: string): ParsedClass[];
654
+
655
+ 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 SystemComponentConfig, type SystemComponentFactory, type SystemTokenMap, type ThemeConfig, type ThemeTokenMap, type TokenMap, type TokenSubscriber, type TwComponentFactory, type TwObject, type TwStyledComponent, type TwTagFactory, type VariantLiterals, applyTokenSet, clearThemeReaderCache, cn, tokenRef as containerRef, createComponent, createStyledSystem, createTheme, createTwMerge, createUseTokens, cssVar, cv, cx, cxm, extractThemeFromCSS, generateContainerCss, generateStateCss, generateTokenCssString, generateTypeDefinitions, getContainerRegistry, getStateRegistry, getToken, getTokens, liveToken, mergeWithRules, parseClassToken, parseTailwindClasses, processContainer, processState, resolveStyledClassName, resolveThemeValue, server, setToken, setTokens, splitClassList, styled, subscribeTokens, t, tokenRef, tokenVar, tw, twMerge, twVar, v4Tokens };