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
@@ -1,231 +0,0 @@
1
- /**
2
- * tailwind-styled-v4 — Official Plugins
3
- *
4
- * 3 plugin resmi sebagai reference implementasi ecosystem.
5
- * Bisa dipakai langsung atau dijadikan template buat community plugins.
6
- *
7
- * Usage:
8
- * import { pluginAnimation, pluginTokens, pluginTypography } from "tailwind-styled-v4/plugins"
9
- *
10
- * withTailwindStyled({
11
- * plugins: [
12
- * pluginAnimation(),
13
- * pluginTokens({ primary: "#3b82f6", secondary: "#6366f1" }),
14
- * pluginTypography(),
15
- * ]
16
- * })(nextConfig)
17
- *
18
- * Atau standalone:
19
- * import { use } from "tailwind-styled-v4/plugin"
20
- * use(pluginAnimation())
21
- */
22
-
23
- interface AnimationPluginOptions {
24
- /** Prefix untuk generated animation classes. Default: "tw-anim" */
25
- prefix?: string;
26
- /** Tambahkan reduced-motion safe variants. Default: true */
27
- reducedMotion?: boolean;
28
- }
29
- /**
30
- * Official animation plugin.
31
- *
32
- * Adds:
33
- * - `enter` variant → apply on mount animation
34
- * - `exit` variant → apply on unmount animation
35
- * - `motion-safe:` → only animate if prefers-reduced-motion: no-preference
36
- * - Preset utility classes: `animate-fade-in`, `animate-slide-up`, etc.
37
- *
38
- * @example
39
- * use(pluginAnimation())
40
- *
41
- * const Card = tw.div`p-4 animate-fade-in`
42
- * const Modal = tw.div`animate-scale-in fixed inset-0`
43
- */
44
- declare function pluginAnimation(opts?: AnimationPluginOptions): TwPlugin;
45
- interface TokensPluginOptions {
46
- /** Color tokens */
47
- colors?: Record<string, string>;
48
- /** Spacing tokens (mapped to --spacing-*) */
49
- spacing?: Record<string, string>;
50
- /** Typography tokens */
51
- fonts?: Record<string, string>;
52
- /** Border radius tokens */
53
- radii?: Record<string, string>;
54
- /** Shadow tokens */
55
- shadows?: Record<string, string>;
56
- /** Custom tokens (any group) */
57
- custom?: Record<string, Record<string, string>>;
58
- /** Generate utility classes. Default: true */
59
- generateUtilities?: boolean;
60
- }
61
- /**
62
- * Official design token plugin.
63
- *
64
- * Generates CSS variables from your token map + optional utility classes.
65
- *
66
- * @example
67
- * use(pluginTokens({
68
- * colors: {
69
- * primary: "#3b82f6",
70
- * secondary: "#6366f1",
71
- * danger: "#ef4444",
72
- * },
73
- * fonts: {
74
- * sans: "InterVariable, system-ui, sans-serif",
75
- * },
76
- * }))
77
- *
78
- * // Then use in components:
79
- * const Button = tw.button`bg-primary text-white hover:bg-primary-hover`
80
- * // → bg-[var(--color-primary)] etc.
81
- */
82
- declare function pluginTokens(opts?: TokensPluginOptions): TwPlugin;
83
- interface TypographyPluginOptions {
84
- /** Default prose text color. Default: "inherit" */
85
- color?: string;
86
- /** Default prose font family. Default: "inherit" */
87
- fontFamily?: string;
88
- /** Max width for prose container. Default: "65ch" */
89
- maxWidth?: string;
90
- }
91
- /**
92
- * Official typography plugin.
93
- *
94
- * Adds `prose` utility class for rich text content (like @tailwindcss/typography).
95
- * Zero external dependency.
96
- *
97
- * @example
98
- * use(pluginTypography())
99
- *
100
- * const Article = tw.article`prose prose-invert max-w-3xl mx-auto`
101
- */
102
- declare function pluginTypography(opts?: TypographyPluginOptions): TwPlugin;
103
-
104
- /**
105
- * tailwind-styled-v4 — Plugin System
106
- *
107
- * Fondasi ecosystem library. Plugin bisa extend compiler pipeline
108
- * di berbagai tahap: variant, utility, token, transform, CSS.
109
- *
110
- * Usage:
111
- * import { createTw } from "tailwind-styled-v4/plugin"
112
- * const tw = createTw({
113
- * plugins: [
114
- * presetAnimation(),
115
- * presetTokens({ primary: "#3b82f6" }),
116
- * ]
117
- * })
118
- *
119
- * Buat plugin sendiri:
120
- * const myPlugin: TwPlugin = {
121
- * name: "my-plugin",
122
- * setup(ctx) {
123
- * ctx.addVariant("print", sel => `@media print { ${sel} }`)
124
- * ctx.addUtility("glow", { "box-shadow": "0 0 20px currentColor" })
125
- * ctx.addToken("brand", "#ff4d6d")
126
- * }
127
- * }
128
- */
129
- type VariantResolver = (selector: string) => string;
130
- interface UtilityDefinition {
131
- [property: string]: string;
132
- }
133
- type TransformFn = (node: any, ctx: TwContext) => any;
134
- type CssHook = (css: string) => string;
135
- interface TwContext {
136
- /** Add a new variant (e.g. "group-hover", "print", "rtl") */
137
- addVariant(name: string, resolver: VariantResolver): void;
138
- /** Add a new utility class */
139
- addUtility(name: string, styles: UtilityDefinition): void;
140
- /** Add a design token (becomes CSS custom property) */
141
- addToken(name: string, value: string): void;
142
- /** Add a compiler AST transform hook */
143
- addTransform(fn: TransformFn): void;
144
- /** Hook into CSS generation phase */
145
- onGenerateCSS(hook: CssHook): void;
146
- /** Hook into build end */
147
- onBuildEnd(hook: () => void | Promise<void>): void;
148
- /** Read current plugin config */
149
- readonly config: Record<string, any>;
150
- }
151
- interface TwPlugin {
152
- name: string;
153
- setup(ctx: TwContext): void;
154
- }
155
- interface PluginRegistry {
156
- variants: Map<string, VariantResolver>;
157
- utilities: Map<string, UtilityDefinition>;
158
- tokens: Map<string, string>;
159
- transforms: TransformFn[];
160
- cssHooks: CssHook[];
161
- buildHooks: Array<() => void | Promise<void>>;
162
- plugins: Set<string>;
163
- }
164
- declare function getGlobalRegistry(): PluginRegistry;
165
- declare function resetGlobalRegistry(): void;
166
- /**
167
- * Register a plugin globally.
168
- *
169
- * @example
170
- * import { use } from "tailwind-styled-v4/plugin"
171
- * import { presetAnimation } from "tw-plugin-animation"
172
- *
173
- * use(presetAnimation())
174
- */
175
- declare function use(plugin: TwPlugin, config?: Record<string, any>): void;
176
- interface CreateTwOptions {
177
- plugins?: TwPlugin[];
178
- config?: Record<string, any>;
179
- }
180
- /**
181
- * Create a scoped tw instance with its own plugin registry.
182
- * Useful for libraries or sub-applications that need isolation.
183
- *
184
- * @example
185
- * const { tw, registry } = createTw({
186
- * plugins: [presetAnimation(), presetTokens()]
187
- * })
188
- */
189
- declare function createTw(opts?: CreateTwOptions): {
190
- registry: PluginRegistry;
191
- use: (plugin: TwPlugin) => void;
192
- };
193
- /**
194
- * Generate :root CSS variables from registered tokens.
195
- */
196
- declare function generateTokenCss(registry: PluginRegistry): string;
197
- /**
198
- * Generate CSS for registered utilities.
199
- */
200
- declare function generateUtilityCss(registry: PluginRegistry): string;
201
- /**
202
- * Apply all CSS hooks to a CSS string.
203
- */
204
- declare function applyCssHooks(css: string, registry: PluginRegistry): string;
205
- /**
206
- * Run all build end hooks.
207
- */
208
- declare function runBuildHooks(registry: PluginRegistry): Promise<void>;
209
- /**
210
- * preset: common group variants
211
- *
212
- * Adds: group-hover, group-focus, peer-checked, rtl, ltr, print
213
- */
214
- declare function presetVariants(): TwPlugin;
215
- /**
216
- * preset: scrollbar utilities
217
- */
218
- declare function presetScrollbar(): TwPlugin;
219
- /**
220
- * preset: design tokens from a color palette
221
- *
222
- * @example
223
- * use(presetTokens({
224
- * primary: "#3b82f6",
225
- * secondary: "#6366f1",
226
- * accent: "#f59e0b",
227
- * }))
228
- */
229
- declare function presetTokens(tokens: Record<string, string>): TwPlugin;
230
-
231
- export { type AnimationPluginOptions, type CreateTwOptions, type CssHook, type PluginRegistry, type TokensPluginOptions, type TransformFn, type TwContext, type TwPlugin, type TypographyPluginOptions, type UtilityDefinition, type VariantResolver, applyCssHooks, createTw, generateTokenCss, generateUtilityCss, getGlobalRegistry, pluginAnimation, pluginTokens, pluginTypography, presetScrollbar, presetTokens, presetVariants, resetGlobalRegistry, runBuildHooks, use };
package/dist/plugins.d.ts DELETED
@@ -1,231 +0,0 @@
1
- /**
2
- * tailwind-styled-v4 — Official Plugins
3
- *
4
- * 3 plugin resmi sebagai reference implementasi ecosystem.
5
- * Bisa dipakai langsung atau dijadikan template buat community plugins.
6
- *
7
- * Usage:
8
- * import { pluginAnimation, pluginTokens, pluginTypography } from "tailwind-styled-v4/plugins"
9
- *
10
- * withTailwindStyled({
11
- * plugins: [
12
- * pluginAnimation(),
13
- * pluginTokens({ primary: "#3b82f6", secondary: "#6366f1" }),
14
- * pluginTypography(),
15
- * ]
16
- * })(nextConfig)
17
- *
18
- * Atau standalone:
19
- * import { use } from "tailwind-styled-v4/plugin"
20
- * use(pluginAnimation())
21
- */
22
-
23
- interface AnimationPluginOptions {
24
- /** Prefix untuk generated animation classes. Default: "tw-anim" */
25
- prefix?: string;
26
- /** Tambahkan reduced-motion safe variants. Default: true */
27
- reducedMotion?: boolean;
28
- }
29
- /**
30
- * Official animation plugin.
31
- *
32
- * Adds:
33
- * - `enter` variant → apply on mount animation
34
- * - `exit` variant → apply on unmount animation
35
- * - `motion-safe:` → only animate if prefers-reduced-motion: no-preference
36
- * - Preset utility classes: `animate-fade-in`, `animate-slide-up`, etc.
37
- *
38
- * @example
39
- * use(pluginAnimation())
40
- *
41
- * const Card = tw.div`p-4 animate-fade-in`
42
- * const Modal = tw.div`animate-scale-in fixed inset-0`
43
- */
44
- declare function pluginAnimation(opts?: AnimationPluginOptions): TwPlugin;
45
- interface TokensPluginOptions {
46
- /** Color tokens */
47
- colors?: Record<string, string>;
48
- /** Spacing tokens (mapped to --spacing-*) */
49
- spacing?: Record<string, string>;
50
- /** Typography tokens */
51
- fonts?: Record<string, string>;
52
- /** Border radius tokens */
53
- radii?: Record<string, string>;
54
- /** Shadow tokens */
55
- shadows?: Record<string, string>;
56
- /** Custom tokens (any group) */
57
- custom?: Record<string, Record<string, string>>;
58
- /** Generate utility classes. Default: true */
59
- generateUtilities?: boolean;
60
- }
61
- /**
62
- * Official design token plugin.
63
- *
64
- * Generates CSS variables from your token map + optional utility classes.
65
- *
66
- * @example
67
- * use(pluginTokens({
68
- * colors: {
69
- * primary: "#3b82f6",
70
- * secondary: "#6366f1",
71
- * danger: "#ef4444",
72
- * },
73
- * fonts: {
74
- * sans: "InterVariable, system-ui, sans-serif",
75
- * },
76
- * }))
77
- *
78
- * // Then use in components:
79
- * const Button = tw.button`bg-primary text-white hover:bg-primary-hover`
80
- * // → bg-[var(--color-primary)] etc.
81
- */
82
- declare function pluginTokens(opts?: TokensPluginOptions): TwPlugin;
83
- interface TypographyPluginOptions {
84
- /** Default prose text color. Default: "inherit" */
85
- color?: string;
86
- /** Default prose font family. Default: "inherit" */
87
- fontFamily?: string;
88
- /** Max width for prose container. Default: "65ch" */
89
- maxWidth?: string;
90
- }
91
- /**
92
- * Official typography plugin.
93
- *
94
- * Adds `prose` utility class for rich text content (like @tailwindcss/typography).
95
- * Zero external dependency.
96
- *
97
- * @example
98
- * use(pluginTypography())
99
- *
100
- * const Article = tw.article`prose prose-invert max-w-3xl mx-auto`
101
- */
102
- declare function pluginTypography(opts?: TypographyPluginOptions): TwPlugin;
103
-
104
- /**
105
- * tailwind-styled-v4 — Plugin System
106
- *
107
- * Fondasi ecosystem library. Plugin bisa extend compiler pipeline
108
- * di berbagai tahap: variant, utility, token, transform, CSS.
109
- *
110
- * Usage:
111
- * import { createTw } from "tailwind-styled-v4/plugin"
112
- * const tw = createTw({
113
- * plugins: [
114
- * presetAnimation(),
115
- * presetTokens({ primary: "#3b82f6" }),
116
- * ]
117
- * })
118
- *
119
- * Buat plugin sendiri:
120
- * const myPlugin: TwPlugin = {
121
- * name: "my-plugin",
122
- * setup(ctx) {
123
- * ctx.addVariant("print", sel => `@media print { ${sel} }`)
124
- * ctx.addUtility("glow", { "box-shadow": "0 0 20px currentColor" })
125
- * ctx.addToken("brand", "#ff4d6d")
126
- * }
127
- * }
128
- */
129
- type VariantResolver = (selector: string) => string;
130
- interface UtilityDefinition {
131
- [property: string]: string;
132
- }
133
- type TransformFn = (node: any, ctx: TwContext) => any;
134
- type CssHook = (css: string) => string;
135
- interface TwContext {
136
- /** Add a new variant (e.g. "group-hover", "print", "rtl") */
137
- addVariant(name: string, resolver: VariantResolver): void;
138
- /** Add a new utility class */
139
- addUtility(name: string, styles: UtilityDefinition): void;
140
- /** Add a design token (becomes CSS custom property) */
141
- addToken(name: string, value: string): void;
142
- /** Add a compiler AST transform hook */
143
- addTransform(fn: TransformFn): void;
144
- /** Hook into CSS generation phase */
145
- onGenerateCSS(hook: CssHook): void;
146
- /** Hook into build end */
147
- onBuildEnd(hook: () => void | Promise<void>): void;
148
- /** Read current plugin config */
149
- readonly config: Record<string, any>;
150
- }
151
- interface TwPlugin {
152
- name: string;
153
- setup(ctx: TwContext): void;
154
- }
155
- interface PluginRegistry {
156
- variants: Map<string, VariantResolver>;
157
- utilities: Map<string, UtilityDefinition>;
158
- tokens: Map<string, string>;
159
- transforms: TransformFn[];
160
- cssHooks: CssHook[];
161
- buildHooks: Array<() => void | Promise<void>>;
162
- plugins: Set<string>;
163
- }
164
- declare function getGlobalRegistry(): PluginRegistry;
165
- declare function resetGlobalRegistry(): void;
166
- /**
167
- * Register a plugin globally.
168
- *
169
- * @example
170
- * import { use } from "tailwind-styled-v4/plugin"
171
- * import { presetAnimation } from "tw-plugin-animation"
172
- *
173
- * use(presetAnimation())
174
- */
175
- declare function use(plugin: TwPlugin, config?: Record<string, any>): void;
176
- interface CreateTwOptions {
177
- plugins?: TwPlugin[];
178
- config?: Record<string, any>;
179
- }
180
- /**
181
- * Create a scoped tw instance with its own plugin registry.
182
- * Useful for libraries or sub-applications that need isolation.
183
- *
184
- * @example
185
- * const { tw, registry } = createTw({
186
- * plugins: [presetAnimation(), presetTokens()]
187
- * })
188
- */
189
- declare function createTw(opts?: CreateTwOptions): {
190
- registry: PluginRegistry;
191
- use: (plugin: TwPlugin) => void;
192
- };
193
- /**
194
- * Generate :root CSS variables from registered tokens.
195
- */
196
- declare function generateTokenCss(registry: PluginRegistry): string;
197
- /**
198
- * Generate CSS for registered utilities.
199
- */
200
- declare function generateUtilityCss(registry: PluginRegistry): string;
201
- /**
202
- * Apply all CSS hooks to a CSS string.
203
- */
204
- declare function applyCssHooks(css: string, registry: PluginRegistry): string;
205
- /**
206
- * Run all build end hooks.
207
- */
208
- declare function runBuildHooks(registry: PluginRegistry): Promise<void>;
209
- /**
210
- * preset: common group variants
211
- *
212
- * Adds: group-hover, group-focus, peer-checked, rtl, ltr, print
213
- */
214
- declare function presetVariants(): TwPlugin;
215
- /**
216
- * preset: scrollbar utilities
217
- */
218
- declare function presetScrollbar(): TwPlugin;
219
- /**
220
- * preset: design tokens from a color palette
221
- *
222
- * @example
223
- * use(presetTokens({
224
- * primary: "#3b82f6",
225
- * secondary: "#6366f1",
226
- * accent: "#f59e0b",
227
- * }))
228
- */
229
- declare function presetTokens(tokens: Record<string, string>): TwPlugin;
230
-
231
- export { type AnimationPluginOptions, type CreateTwOptions, type CssHook, type PluginRegistry, type TokensPluginOptions, type TransformFn, type TwContext, type TwPlugin, type TypographyPluginOptions, type UtilityDefinition, type VariantResolver, applyCssHooks, createTw, generateTokenCss, generateUtilityCss, getGlobalRegistry, pluginAnimation, pluginTokens, pluginTypography, presetScrollbar, presetTokens, presetVariants, resetGlobalRegistry, runBuildHooks, use };