tailwind-styled-v4 1.0.1 → 4.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 (90) hide show
  1. package/dist/animate.cjs +252 -0
  2. package/dist/animate.cjs.map +1 -0
  3. package/dist/animate.d.cts +117 -0
  4. package/dist/animate.d.ts +117 -0
  5. package/dist/animate.js +245 -0
  6. package/dist/animate.js.map +1 -0
  7. package/dist/astTransform-ua-eapqs.d.cts +41 -0
  8. package/dist/astTransform-ua-eapqs.d.ts +41 -0
  9. package/dist/compiler.cjs +3594 -0
  10. package/dist/compiler.cjs.map +1 -0
  11. package/dist/compiler.d.cts +716 -0
  12. package/dist/compiler.d.ts +716 -0
  13. package/dist/compiler.js +3535 -0
  14. package/dist/compiler.js.map +1 -0
  15. package/dist/css.cjs +71 -0
  16. package/dist/css.cjs.map +1 -0
  17. package/dist/css.d.cts +45 -0
  18. package/dist/css.d.ts +45 -0
  19. package/dist/css.js +62 -0
  20. package/dist/css.js.map +1 -0
  21. package/dist/devtools.cjs +959 -0
  22. package/dist/devtools.cjs.map +1 -0
  23. package/dist/devtools.d.cts +22 -0
  24. package/dist/devtools.d.ts +22 -0
  25. package/dist/devtools.js +952 -0
  26. package/dist/devtools.js.map +1 -0
  27. package/dist/index.cjs +1058 -0
  28. package/dist/index.cjs.map +1 -0
  29. package/dist/index.d.cts +584 -0
  30. package/dist/index.d.ts +449 -980
  31. package/dist/index.js +1021 -3
  32. package/dist/index.js.map +1 -1
  33. package/dist/next.cjs +268 -0
  34. package/dist/next.cjs.map +1 -0
  35. package/dist/next.d.cts +45 -0
  36. package/dist/next.d.ts +45 -0
  37. package/dist/next.js +261 -0
  38. package/dist/next.js.map +1 -0
  39. package/dist/plugins.cjs +396 -0
  40. package/dist/plugins.cjs.map +1 -0
  41. package/dist/plugins.d.cts +231 -0
  42. package/dist/plugins.d.ts +231 -0
  43. package/dist/plugins.js +381 -0
  44. package/dist/plugins.js.map +1 -0
  45. package/dist/preset.cjs +129 -0
  46. package/dist/preset.cjs.map +1 -0
  47. package/dist/preset.d.cts +249 -0
  48. package/dist/preset.d.ts +249 -0
  49. package/dist/preset.js +124 -0
  50. package/dist/preset.js.map +1 -0
  51. package/dist/theme.cjs +154 -0
  52. package/dist/theme.cjs.map +1 -0
  53. package/dist/theme.d.cts +181 -0
  54. package/dist/theme.d.ts +181 -0
  55. package/dist/theme.js +148 -0
  56. package/dist/theme.js.map +1 -0
  57. package/dist/turbopackLoader.cjs +2689 -0
  58. package/dist/turbopackLoader.cjs.map +1 -0
  59. package/dist/turbopackLoader.d.cts +22 -0
  60. package/dist/turbopackLoader.d.ts +22 -0
  61. package/dist/turbopackLoader.js +2681 -0
  62. package/dist/turbopackLoader.js.map +1 -0
  63. package/dist/vite.cjs +105 -0
  64. package/dist/vite.cjs.map +1 -0
  65. package/dist/vite.d.cts +22 -0
  66. package/dist/vite.d.ts +22 -0
  67. package/dist/vite.js +96 -0
  68. package/dist/vite.js.map +1 -0
  69. package/dist/webpackLoader.cjs +2670 -0
  70. package/dist/webpackLoader.cjs.map +1 -0
  71. package/dist/webpackLoader.d.cts +24 -0
  72. package/dist/webpackLoader.d.ts +24 -0
  73. package/dist/webpackLoader.js +2662 -0
  74. package/dist/webpackLoader.js.map +1 -0
  75. package/package.json +62 -32
  76. package/CHANGELOG.md +0 -75
  77. package/LICENSE +0 -21
  78. package/README.md +0 -608
  79. package/dist/cli/init.js +0 -208
  80. package/dist/compiler/index.d.mts +0 -214
  81. package/dist/compiler/index.d.ts +0 -214
  82. package/dist/compiler/index.js +0 -546
  83. package/dist/compiler/index.js.map +0 -1
  84. package/dist/compiler/index.mjs +0 -504
  85. package/dist/compiler/index.mjs.map +0 -1
  86. package/dist/index.d.mts +0 -1115
  87. package/dist/index.mjs +0 -4
  88. package/dist/index.mjs.map +0 -1
  89. package/dist/turbopack-loader.js +0 -232
  90. package/dist/webpack-loader.js +0 -213
@@ -0,0 +1,252 @@
1
+ 'use strict';
2
+
3
+ /* tailwind-styled-v4 v4 | MIT | https://github.com/dictionar32/tailwind-styled-v4 */
4
+
5
+ // ../animate/src/index.ts
6
+ var TW_TO_CSS = {
7
+ // Opacity
8
+ "opacity-0": "opacity: 0",
9
+ "opacity-5": "opacity: 0.05",
10
+ "opacity-10": "opacity: 0.1",
11
+ "opacity-20": "opacity: 0.2",
12
+ "opacity-25": "opacity: 0.25",
13
+ "opacity-30": "opacity: 0.3",
14
+ "opacity-40": "opacity: 0.4",
15
+ "opacity-50": "opacity: 0.5",
16
+ "opacity-60": "opacity: 0.6",
17
+ "opacity-70": "opacity: 0.7",
18
+ "opacity-75": "opacity: 0.75",
19
+ "opacity-80": "opacity: 0.8",
20
+ "opacity-90": "opacity: 0.9",
21
+ "opacity-95": "opacity: 0.95",
22
+ "opacity-100": "opacity: 1",
23
+ // Translate Y
24
+ "translate-y-0": "transform: translateY(0px)",
25
+ "translate-y-0.5": "transform: translateY(0.125rem)",
26
+ "translate-y-1": "transform: translateY(0.25rem)",
27
+ "translate-y-2": "transform: translateY(0.5rem)",
28
+ "translate-y-3": "transform: translateY(0.75rem)",
29
+ "translate-y-4": "transform: translateY(1rem)",
30
+ "translate-y-6": "transform: translateY(1.5rem)",
31
+ "translate-y-8": "transform: translateY(2rem)",
32
+ "-translate-y-1": "transform: translateY(-0.25rem)",
33
+ "-translate-y-2": "transform: translateY(-0.5rem)",
34
+ "-translate-y-4": "transform: translateY(-1rem)",
35
+ "-translate-y-8": "transform: translateY(-2rem)",
36
+ // Translate X
37
+ "translate-x-0": "transform: translateX(0px)",
38
+ "translate-x-1": "transform: translateX(0.25rem)",
39
+ "translate-x-2": "transform: translateX(0.5rem)",
40
+ "translate-x-4": "transform: translateX(1rem)",
41
+ "-translate-x-1": "transform: translateX(-0.25rem)",
42
+ "-translate-x-2": "transform: translateX(-0.5rem)",
43
+ "-translate-x-4": "transform: translateX(-1rem)",
44
+ // Scale
45
+ "scale-0": "transform: scale(0)",
46
+ "scale-50": "transform: scale(0.5)",
47
+ "scale-75": "transform: scale(0.75)",
48
+ "scale-90": "transform: scale(0.9)",
49
+ "scale-95": "transform: scale(0.95)",
50
+ "scale-100": "transform: scale(1)",
51
+ "scale-105": "transform: scale(1.05)",
52
+ "scale-110": "transform: scale(1.1)",
53
+ "scale-125": "transform: scale(1.25)",
54
+ "scale-150": "transform: scale(1.5)",
55
+ // Rotate
56
+ "rotate-0": "transform: rotate(0deg)",
57
+ "rotate-1": "transform: rotate(1deg)",
58
+ "rotate-2": "transform: rotate(2deg)",
59
+ "rotate-3": "transform: rotate(3deg)",
60
+ "rotate-6": "transform: rotate(6deg)",
61
+ "rotate-12": "transform: rotate(12deg)",
62
+ "rotate-45": "transform: rotate(45deg)",
63
+ "rotate-90": "transform: rotate(90deg)",
64
+ "rotate-180": "transform: rotate(180deg)",
65
+ "-rotate-1": "transform: rotate(-1deg)",
66
+ "-rotate-2": "transform: rotate(-2deg)",
67
+ "-rotate-6": "transform: rotate(-6deg)",
68
+ "-rotate-12": "transform: rotate(-12deg)",
69
+ "-rotate-45": "transform: rotate(-45deg)",
70
+ "-rotate-90": "transform: rotate(-90deg)",
71
+ // Blur
72
+ "blur-none": "filter: blur(0)",
73
+ "blur-sm": "filter: blur(4px)",
74
+ blur: "filter: blur(8px)",
75
+ "blur-md": "filter: blur(12px)",
76
+ "blur-lg": "filter: blur(16px)",
77
+ "blur-xl": "filter: blur(24px)",
78
+ "blur-2xl": "filter: blur(40px)",
79
+ "blur-3xl": "filter: blur(64px)"
80
+ };
81
+ function classesToCss(classes) {
82
+ const parts = classes.split(/\s+/).filter(Boolean);
83
+ const transforms = [];
84
+ const others = [];
85
+ for (const cls of parts) {
86
+ const css = TW_TO_CSS[cls];
87
+ if (!css) continue;
88
+ if (css.startsWith("transform:")) {
89
+ transforms.push(css.replace("transform: ", ""));
90
+ } else {
91
+ others.push(css);
92
+ }
93
+ }
94
+ const result = [...others];
95
+ if (transforms.length > 0) {
96
+ result.push(`transform: ${transforms.join(" ")}`);
97
+ }
98
+ return result.join("; ");
99
+ }
100
+ var _animCounter = 0;
101
+ function genAnimId(name) {
102
+ if (name) return `tw-${name.replace(/[^a-zA-Z0-9]/g, "-")}`;
103
+ return `tw-anim-${++_animCounter}`;
104
+ }
105
+ var _animRegistry = /* @__PURE__ */ new Map();
106
+ function getAnimationRegistry() {
107
+ return _animRegistry;
108
+ }
109
+ function compileAnimation(opts) {
110
+ const {
111
+ from,
112
+ to,
113
+ duration = 300,
114
+ easing = "ease-out",
115
+ delay = 0,
116
+ fill = "both",
117
+ iterations = 1,
118
+ direction = "normal",
119
+ name
120
+ } = opts;
121
+ const animId = genAnimId(
122
+ name != null ? name : `${from.replace(/\s+/g, "-")}-${to.replace(/\s+/g, "-")}`.slice(0, 30)
123
+ );
124
+ if (_animRegistry.has(animId)) {
125
+ return _animRegistry.get(animId);
126
+ }
127
+ const fromCss = classesToCss(from);
128
+ const toCss = classesToCss(to);
129
+ const keyframesCss = [
130
+ `@keyframes ${animId} {`,
131
+ fromCss ? ` from { ${fromCss} }` : ` from {}`,
132
+ toCss ? ` to { ${toCss} }` : ` to {}`,
133
+ `}`
134
+ ].join("\n");
135
+ const iterStr = iterations === "infinite" ? "infinite" : String(iterations);
136
+ const animationCss = [
137
+ `animation-name: ${animId}`,
138
+ `animation-duration: ${duration}ms`,
139
+ `animation-timing-function: ${easing}`,
140
+ `animation-delay: ${delay}ms`,
141
+ `animation-fill-mode: ${fill}`,
142
+ `animation-iteration-count: ${iterStr}`,
143
+ `animation-direction: ${direction}`
144
+ ].join("; ");
145
+ const className = animId;
146
+ const compiled = { className, keyframesCss, animationCss };
147
+ _animRegistry.set(animId, compiled);
148
+ return compiled;
149
+ }
150
+ function animate(opts) {
151
+ const compiled = compileAnimation(opts);
152
+ if (typeof document !== "undefined") {
153
+ const styleId = `__tw_anim_${compiled.className}`;
154
+ if (!document.getElementById(styleId)) {
155
+ const style = document.createElement("style");
156
+ style.id = styleId;
157
+ style.textContent = `${compiled.keyframesCss}
158
+ .${compiled.className}{${compiled.animationCss}}`;
159
+ document.head.appendChild(style);
160
+ }
161
+ }
162
+ return compiled.className;
163
+ }
164
+ function keyframes(name, stops) {
165
+ const animId = genAnimId(name);
166
+ if (_animRegistry.has(animId)) {
167
+ return animId;
168
+ }
169
+ const stopLines = Object.entries(stops).map(([stop, classes]) => {
170
+ const css = classesToCss(classes);
171
+ return ` ${stop} { ${css} }`;
172
+ }).join("\n");
173
+ const keyframesCss = `@keyframes ${animId} {
174
+ ${stopLines}
175
+ }`;
176
+ if (typeof document !== "undefined") {
177
+ const styleId = `__tw_kf_${animId}`;
178
+ if (!document.getElementById(styleId)) {
179
+ const style = document.createElement("style");
180
+ style.id = styleId;
181
+ style.textContent = keyframesCss;
182
+ document.head.appendChild(style);
183
+ }
184
+ }
185
+ _animRegistry.set(animId, {
186
+ className: animId,
187
+ keyframesCss,
188
+ animationCss: `animation-name: ${animId}`
189
+ });
190
+ return animId;
191
+ }
192
+ var animations = {
193
+ fadeIn: animate({ from: "opacity-0", to: "opacity-100", duration: 200 }),
194
+ fadeOut: animate({ from: "opacity-100", to: "opacity-0", duration: 200 }),
195
+ slideUp: animate({
196
+ from: "opacity-0 translate-y-4",
197
+ to: "opacity-100 translate-y-0",
198
+ duration: 300
199
+ }),
200
+ slideDown: animate({
201
+ from: "opacity-0 -translate-y-4",
202
+ to: "opacity-100 translate-y-0",
203
+ duration: 300
204
+ }),
205
+ slideLeft: animate({
206
+ from: "opacity-0 translate-x-4",
207
+ to: "opacity-100 translate-x-0",
208
+ duration: 300
209
+ }),
210
+ slideRight: animate({
211
+ from: "opacity-0 -translate-x-4",
212
+ to: "opacity-100 translate-x-0",
213
+ duration: 300
214
+ }),
215
+ scaleIn: animate({
216
+ from: "opacity-0 scale-95",
217
+ to: "opacity-100 scale-100",
218
+ duration: 200,
219
+ easing: "cubic-bezier(0.16,1,0.3,1)"
220
+ }),
221
+ scaleOut: animate({ from: "opacity-100 scale-100", to: "opacity-0 scale-95", duration: 150 }),
222
+ blurIn: animate({ from: "opacity-0 blur-sm", to: "opacity-100 blur-none", duration: 300 }),
223
+ bounceIn: animate({
224
+ from: "opacity-0 scale-50",
225
+ to: "opacity-100 scale-100",
226
+ duration: 400,
227
+ easing: "cubic-bezier(0.34,1.56,0.64,1)"
228
+ }),
229
+ spinIn: animate({
230
+ from: "opacity-0 rotate-180 scale-50",
231
+ to: "opacity-100 rotate-0 scale-100",
232
+ duration: 400,
233
+ easing: "cubic-bezier(0.16,1,0.3,1)"
234
+ })
235
+ };
236
+ function extractAnimationCss() {
237
+ const lines = [];
238
+ for (const [, compiled] of _animRegistry) {
239
+ lines.push(compiled.keyframesCss);
240
+ lines.push(`.${compiled.className} { ${compiled.animationCss} }`);
241
+ }
242
+ return lines.join("\n\n");
243
+ }
244
+
245
+ exports.animate = animate;
246
+ exports.animations = animations;
247
+ exports.compileAnimation = compileAnimation;
248
+ exports.extractAnimationCss = extractAnimationCss;
249
+ exports.getAnimationRegistry = getAnimationRegistry;
250
+ exports.keyframes = keyframes;
251
+ //# sourceMappingURL=animate.cjs.map
252
+ //# sourceMappingURL=animate.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../animate/src/index.ts"],"names":[],"mappings":";;;;;AA6EA,IAAM,SAAA,GAAoC;AAAA;AAAA,EAExC,WAAA,EAAa,YAAA;AAAA,EACb,WAAA,EAAa,eAAA;AAAA,EACb,YAAA,EAAc,cAAA;AAAA,EACd,YAAA,EAAc,cAAA;AAAA,EACd,YAAA,EAAc,eAAA;AAAA,EACd,YAAA,EAAc,cAAA;AAAA,EACd,YAAA,EAAc,cAAA;AAAA,EACd,YAAA,EAAc,cAAA;AAAA,EACd,YAAA,EAAc,cAAA;AAAA,EACd,YAAA,EAAc,cAAA;AAAA,EACd,YAAA,EAAc,eAAA;AAAA,EACd,YAAA,EAAc,cAAA;AAAA,EACd,YAAA,EAAc,cAAA;AAAA,EACd,YAAA,EAAc,eAAA;AAAA,EACd,aAAA,EAAe,YAAA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A,EAAQ,QAAQ,EAAE,IAAA,EAAM,qBAAqB,EAAA,EAAI,uBAAA,EAAyB,QAAA,EAAU,GAAA,EAAK,CAAA;AAAA,EACzF,UAAU,OAAA,CAAQ;AAAA,IAChB,IAAA,EAAM,oBAAA;AAAA,IACN,EAAA,EAAI,uBAAA;AAAA,IACJ,QAAA,EAAU,GAAA;AAAA,IACV,MAAA,EAAQ;AAAA,GACT,CAAA;AAAA,EACD,QAAQ,OAAA,CAAQ;AAAA,IACd,IAAA,EAAM,+BAAA;AAAA,IACN,EAAA,EAAI,gCAAA;AAAA,IACJ,QAAA,EAAU,GAAA;AAAA,IACV,MAAA,EAAQ;AAAA,GACT;AACH;AAUO,SAAS,mBAAA,GAA8B;AAC5C,EAAA,MAAM,QAAkB,EAAC;AACzB,EAAA,KAAA,MAAW,GAAG,QAAQ,CAAA,IAAK,aAAA,EAAe;AACxC,IAAA,KAAA,CAAM,IAAA,CAAK,SAAS,YAAY,CAAA;AAChC,IAAA,KAAA,CAAM,KAAK,CAAA,CAAA,EAAI,QAAA,CAAS,SAAS,CAAA,GAAA,EAAM,QAAA,CAAS,YAAY,CAAA,EAAA,CAAI,CAAA;AAAA,EAClE;AACA,EAAA,OAAO,KAAA,CAAM,KAAK,MAAM,CAAA;AAC1B","file":"animate.cjs","sourcesContent":["/**\n * tailwind-styled-v4 — Animation DSL\n *\n * Compile-time animation system. Define animations dengan Tailwind class,\n * compiler generate @keyframes — nol runtime, nol JS overhead.\n *\n * Usage:\n *\n * // Cara 1: .animate() chaining pada tw component\n * const FadeIn = tw.div.animate({\n * from: \"opacity-0 translate-y-2\",\n * to: \"opacity-100 translate-y-0\",\n * duration: 300,\n * easing: \"ease-out\"\n * })\n *\n * // Cara 2: standalone animate() utility\n * const fadeIn = animate({\n * from: \"opacity-0 scale-95\",\n * to: \"opacity-100 scale-100\",\n * duration: 200,\n * })\n * const Box = tw.div`${fadeIn}`\n *\n * // Cara 3: preset animations\n * const Card = tw.div`${animations.fadeIn} ${animations.slideUp}`\n *\n * // Cara 4: tw.keyframes() custom\n * const spin = tw.keyframes(\"spin\", {\n * \"0%\": \"rotate-0\",\n * \"100%\": \"rotate-180\",\n * })\n */\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Types\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport interface AnimateOptions {\n /** Tailwind classes for animation start state */\n from: string\n /** Tailwind classes for animation end state */\n to: string\n /** Duration in ms. Default: 300 */\n duration?: number\n /** CSS easing. Default: \"ease-out\" */\n easing?: string\n /** Delay in ms. Default: 0 */\n delay?: number\n /** Fill mode. Default: \"both\" */\n fill?: \"none\" | \"forwards\" | \"backwards\" | \"both\"\n /** Iteration count. Default: 1 */\n iterations?: number | \"infinite\"\n /** Direction. Default: \"normal\" */\n direction?: \"normal\" | \"reverse\" | \"alternate\" | \"alternate-reverse\"\n /** Animation name override (auto-generated from from+to if not set) */\n name?: string\n}\n\nexport interface KeyframesDefinition {\n [stop: string]: string // \"0%\": \"opacity-0 translate-y-2\"\n}\n\nexport interface CompiledAnimation {\n /** CSS animation class name to apply */\n className: string\n /** @keyframes CSS to inject */\n keyframesCss: string\n /** animation CSS shorthand */\n animationCss: string\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Tailwind class → CSS property mapping\n// (for compile-time keyframe generation)\n// ─────────────────────────────────────────────────────────────────────────────\n\nconst TW_TO_CSS: Record<string, string> = {\n // Opacity\n \"opacity-0\": \"opacity: 0\",\n \"opacity-5\": \"opacity: 0.05\",\n \"opacity-10\": \"opacity: 0.1\",\n \"opacity-20\": \"opacity: 0.2\",\n \"opacity-25\": \"opacity: 0.25\",\n \"opacity-30\": \"opacity: 0.3\",\n \"opacity-40\": \"opacity: 0.4\",\n \"opacity-50\": \"opacity: 0.5\",\n \"opacity-60\": \"opacity: 0.6\",\n \"opacity-70\": \"opacity: 0.7\",\n \"opacity-75\": \"opacity: 0.75\",\n \"opacity-80\": \"opacity: 0.8\",\n \"opacity-90\": \"opacity: 0.9\",\n \"opacity-95\": \"opacity: 0.95\",\n \"opacity-100\": \"opacity: 1\",\n\n // Translate Y\n \"translate-y-0\": \"transform: translateY(0px)\",\n \"translate-y-0.5\": \"transform: translateY(0.125rem)\",\n \"translate-y-1\": \"transform: translateY(0.25rem)\",\n \"translate-y-2\": \"transform: translateY(0.5rem)\",\n \"translate-y-3\": \"transform: translateY(0.75rem)\",\n \"translate-y-4\": \"transform: translateY(1rem)\",\n \"translate-y-6\": \"transform: translateY(1.5rem)\",\n \"translate-y-8\": \"transform: translateY(2rem)\",\n \"-translate-y-1\": \"transform: translateY(-0.25rem)\",\n \"-translate-y-2\": \"transform: translateY(-0.5rem)\",\n \"-translate-y-4\": \"transform: translateY(-1rem)\",\n \"-translate-y-8\": \"transform: translateY(-2rem)\",\n\n // Translate X\n \"translate-x-0\": \"transform: translateX(0px)\",\n \"translate-x-1\": \"transform: translateX(0.25rem)\",\n \"translate-x-2\": \"transform: translateX(0.5rem)\",\n \"translate-x-4\": \"transform: translateX(1rem)\",\n \"-translate-x-1\": \"transform: translateX(-0.25rem)\",\n \"-translate-x-2\": \"transform: translateX(-0.5rem)\",\n \"-translate-x-4\": \"transform: translateX(-1rem)\",\n\n // Scale\n \"scale-0\": \"transform: scale(0)\",\n \"scale-50\": \"transform: scale(0.5)\",\n \"scale-75\": \"transform: scale(0.75)\",\n \"scale-90\": \"transform: scale(0.9)\",\n \"scale-95\": \"transform: scale(0.95)\",\n \"scale-100\": \"transform: scale(1)\",\n \"scale-105\": \"transform: scale(1.05)\",\n \"scale-110\": \"transform: scale(1.1)\",\n \"scale-125\": \"transform: scale(1.25)\",\n \"scale-150\": \"transform: scale(1.5)\",\n\n // Rotate\n \"rotate-0\": \"transform: rotate(0deg)\",\n \"rotate-1\": \"transform: rotate(1deg)\",\n \"rotate-2\": \"transform: rotate(2deg)\",\n \"rotate-3\": \"transform: rotate(3deg)\",\n \"rotate-6\": \"transform: rotate(6deg)\",\n \"rotate-12\": \"transform: rotate(12deg)\",\n \"rotate-45\": \"transform: rotate(45deg)\",\n \"rotate-90\": \"transform: rotate(90deg)\",\n \"rotate-180\": \"transform: rotate(180deg)\",\n \"-rotate-1\": \"transform: rotate(-1deg)\",\n \"-rotate-2\": \"transform: rotate(-2deg)\",\n \"-rotate-6\": \"transform: rotate(-6deg)\",\n \"-rotate-12\": \"transform: rotate(-12deg)\",\n \"-rotate-45\": \"transform: rotate(-45deg)\",\n \"-rotate-90\": \"transform: rotate(-90deg)\",\n\n // Blur\n \"blur-none\": \"filter: blur(0)\",\n \"blur-sm\": \"filter: blur(4px)\",\n blur: \"filter: blur(8px)\",\n \"blur-md\": \"filter: blur(12px)\",\n \"blur-lg\": \"filter: blur(16px)\",\n \"blur-xl\": \"filter: blur(24px)\",\n \"blur-2xl\": \"filter: blur(40px)\",\n \"blur-3xl\": \"filter: blur(64px)\",\n}\n\n// Multi-transform classes need merging\nfunction classesToCss(classes: string): string {\n const parts = classes.split(/\\s+/).filter(Boolean)\n const transforms: string[] = []\n const others: string[] = []\n\n for (const cls of parts) {\n const css = TW_TO_CSS[cls]\n if (!css) continue\n\n if (css.startsWith(\"transform:\")) {\n transforms.push(css.replace(\"transform: \", \"\"))\n } else {\n others.push(css)\n }\n }\n\n const result = [...others]\n if (transforms.length > 0) {\n result.push(`transform: ${transforms.join(\" \")}`)\n }\n\n return result.join(\"; \")\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Animation ID generator\n// ─────────────────────────────────────────────────────────────────────────────\n\nlet _animCounter = 0\nfunction genAnimId(name?: string): string {\n if (name) return `tw-${name.replace(/[^a-zA-Z0-9]/g, \"-\")}`\n return `tw-anim-${++_animCounter}`\n}\n\n// Global registry of generated animations (for CSS extraction)\nconst _animRegistry = new Map<string, CompiledAnimation>()\n\nexport function getAnimationRegistry(): Map<string, CompiledAnimation> {\n return _animRegistry\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Core: compile animation options → CSS\n// ─────────────────────────────────────────────────────────────────────────────\n\n/**\n * Compile AnimateOptions into CSS animation + @keyframes.\n *\n * Called at build time by the compiler, or at runtime in dev mode.\n */\nexport function compileAnimation(opts: AnimateOptions): CompiledAnimation {\n const {\n from,\n to,\n duration = 300,\n easing = \"ease-out\",\n delay = 0,\n fill = \"both\",\n iterations = 1,\n direction = \"normal\",\n name,\n } = opts\n\n const animId = genAnimId(\n name ?? `${from.replace(/\\s+/g, \"-\")}-${to.replace(/\\s+/g, \"-\")}`.slice(0, 30)\n )\n\n // Already compiled — return cached\n if (_animRegistry.has(animId)) {\n return _animRegistry.get(animId)!\n }\n\n const fromCss = classesToCss(from)\n const toCss = classesToCss(to)\n\n const keyframesCss = [\n `@keyframes ${animId} {`,\n fromCss ? ` from { ${fromCss} }` : ` from {}`,\n toCss ? ` to { ${toCss} }` : ` to {}`,\n `}`,\n ].join(\"\\n\")\n\n const iterStr = iterations === \"infinite\" ? \"infinite\" : String(iterations)\n const animationCss = [\n `animation-name: ${animId}`,\n `animation-duration: ${duration}ms`,\n `animation-timing-function: ${easing}`,\n `animation-delay: ${delay}ms`,\n `animation-fill-mode: ${fill}`,\n `animation-iteration-count: ${iterStr}`,\n `animation-direction: ${direction}`,\n ].join(\"; \")\n\n const className = animId\n\n const compiled: CompiledAnimation = { className, keyframesCss, animationCss }\n _animRegistry.set(animId, compiled)\n\n return compiled\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Public API: animate()\n// ─────────────────────────────────────────────────────────────────────────────\n\n/**\n * Generate an animation class string to use in tw template literals.\n *\n * @example\n * const fadeIn = animate({ from: \"opacity-0\", to: \"opacity-100\", duration: 200 })\n * const Box = tw.div`${fadeIn} p-4 bg-white`\n */\nexport function animate(opts: AnimateOptions): string {\n const compiled = compileAnimation(opts)\n\n // In browser: inject keyframes into <style> if not already present\n if (typeof document !== \"undefined\") {\n const styleId = `__tw_anim_${compiled.className}`\n if (!document.getElementById(styleId)) {\n const style = document.createElement(\"style\")\n style.id = styleId\n style.textContent = `${compiled.keyframesCss}\\n.${compiled.className}{${compiled.animationCss}}`\n document.head.appendChild(style)\n }\n }\n\n return compiled.className\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// tw.keyframes() — custom multi-stop keyframes\n// ─────────────────────────────────────────────────────────────────────────────\n\n/**\n * Define a custom keyframe animation with multiple stops.\n *\n * @example\n * const pulse = tw.keyframes(\"pulse\", {\n * \"0%, 100%\": \"opacity-100 scale-100\",\n * \"50%\": \"opacity-50 scale-95\",\n * })\n * const Dot = tw.div`${pulse} w-4 h-4 rounded-full bg-blue-500`\n */\nexport function keyframes(name: string, stops: KeyframesDefinition): string {\n const animId = genAnimId(name)\n\n if (_animRegistry.has(animId)) {\n return animId\n }\n\n const stopLines = Object.entries(stops)\n .map(([stop, classes]) => {\n const css = classesToCss(classes)\n return ` ${stop} { ${css} }`\n })\n .join(\"\\n\")\n\n const keyframesCss = `@keyframes ${animId} {\\n${stopLines}\\n}`\n\n // Inject in browser\n if (typeof document !== \"undefined\") {\n const styleId = `__tw_kf_${animId}`\n if (!document.getElementById(styleId)) {\n const style = document.createElement(\"style\")\n style.id = styleId\n style.textContent = keyframesCss\n document.head.appendChild(style)\n }\n }\n\n _animRegistry.set(animId, {\n className: animId,\n keyframesCss,\n animationCss: `animation-name: ${animId}`,\n })\n\n return animId\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Preset animations — ready to use\n// ─────────────────────────────────────────────────────────────────────────────\n\n/**\n * Collection of ready-to-use animation class strings.\n *\n * @example\n * const Card = tw.div`${animations.fadeIn} p-4 bg-white`\n * const Modal = tw.div`${animations.scaleIn} fixed inset-0`\n */\nexport const animations = {\n fadeIn: animate({ from: \"opacity-0\", to: \"opacity-100\", duration: 200 }),\n fadeOut: animate({ from: \"opacity-100\", to: \"opacity-0\", duration: 200 }),\n slideUp: animate({\n from: \"opacity-0 translate-y-4\",\n to: \"opacity-100 translate-y-0\",\n duration: 300,\n }),\n slideDown: animate({\n from: \"opacity-0 -translate-y-4\",\n to: \"opacity-100 translate-y-0\",\n duration: 300,\n }),\n slideLeft: animate({\n from: \"opacity-0 translate-x-4\",\n to: \"opacity-100 translate-x-0\",\n duration: 300,\n }),\n slideRight: animate({\n from: \"opacity-0 -translate-x-4\",\n to: \"opacity-100 translate-x-0\",\n duration: 300,\n }),\n scaleIn: animate({\n from: \"opacity-0 scale-95\",\n to: \"opacity-100 scale-100\",\n duration: 200,\n easing: \"cubic-bezier(0.16,1,0.3,1)\",\n }),\n scaleOut: animate({ from: \"opacity-100 scale-100\", to: \"opacity-0 scale-95\", duration: 150 }),\n blurIn: animate({ from: \"opacity-0 blur-sm\", to: \"opacity-100 blur-none\", duration: 300 }),\n bounceIn: animate({\n from: \"opacity-0 scale-50\",\n to: \"opacity-100 scale-100\",\n duration: 400,\n easing: \"cubic-bezier(0.34,1.56,0.64,1)\",\n }),\n spinIn: animate({\n from: \"opacity-0 rotate-180 scale-50\",\n to: \"opacity-100 rotate-0 scale-100\",\n duration: 400,\n easing: \"cubic-bezier(0.16,1,0.3,1)\",\n }),\n} as const\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Extract all animation CSS (for build-time injection)\n// ─────────────────────────────────────────────────────────────────────────────\n\n/**\n * Get all compiled animation CSS to inject into a stylesheet.\n * Called by the CSS extraction engine at build time.\n */\nexport function extractAnimationCss(): string {\n const lines: string[] = []\n for (const [, compiled] of _animRegistry) {\n lines.push(compiled.keyframesCss)\n lines.push(`.${compiled.className} { ${compiled.animationCss} }`)\n }\n return lines.join(\"\\n\\n\")\n}\n"]}
@@ -0,0 +1,117 @@
1
+ /**
2
+ * tailwind-styled-v4 — Animation DSL
3
+ *
4
+ * Compile-time animation system. Define animations dengan Tailwind class,
5
+ * compiler generate @keyframes — nol runtime, nol JS overhead.
6
+ *
7
+ * Usage:
8
+ *
9
+ * // Cara 1: .animate() chaining pada tw component
10
+ * const FadeIn = tw.div.animate({
11
+ * from: "opacity-0 translate-y-2",
12
+ * to: "opacity-100 translate-y-0",
13
+ * duration: 300,
14
+ * easing: "ease-out"
15
+ * })
16
+ *
17
+ * // Cara 2: standalone animate() utility
18
+ * const fadeIn = animate({
19
+ * from: "opacity-0 scale-95",
20
+ * to: "opacity-100 scale-100",
21
+ * duration: 200,
22
+ * })
23
+ * const Box = tw.div`${fadeIn}`
24
+ *
25
+ * // Cara 3: preset animations
26
+ * const Card = tw.div`${animations.fadeIn} ${animations.slideUp}`
27
+ *
28
+ * // Cara 4: tw.keyframes() custom
29
+ * const spin = tw.keyframes("spin", {
30
+ * "0%": "rotate-0",
31
+ * "100%": "rotate-180",
32
+ * })
33
+ */
34
+ interface AnimateOptions {
35
+ /** Tailwind classes for animation start state */
36
+ from: string;
37
+ /** Tailwind classes for animation end state */
38
+ to: string;
39
+ /** Duration in ms. Default: 300 */
40
+ duration?: number;
41
+ /** CSS easing. Default: "ease-out" */
42
+ easing?: string;
43
+ /** Delay in ms. Default: 0 */
44
+ delay?: number;
45
+ /** Fill mode. Default: "both" */
46
+ fill?: "none" | "forwards" | "backwards" | "both";
47
+ /** Iteration count. Default: 1 */
48
+ iterations?: number | "infinite";
49
+ /** Direction. Default: "normal" */
50
+ direction?: "normal" | "reverse" | "alternate" | "alternate-reverse";
51
+ /** Animation name override (auto-generated from from+to if not set) */
52
+ name?: string;
53
+ }
54
+ interface KeyframesDefinition {
55
+ [stop: string]: string;
56
+ }
57
+ interface CompiledAnimation {
58
+ /** CSS animation class name to apply */
59
+ className: string;
60
+ /** @keyframes CSS to inject */
61
+ keyframesCss: string;
62
+ /** animation CSS shorthand */
63
+ animationCss: string;
64
+ }
65
+ declare function getAnimationRegistry(): Map<string, CompiledAnimation>;
66
+ /**
67
+ * Compile AnimateOptions into CSS animation + @keyframes.
68
+ *
69
+ * Called at build time by the compiler, or at runtime in dev mode.
70
+ */
71
+ declare function compileAnimation(opts: AnimateOptions): CompiledAnimation;
72
+ /**
73
+ * Generate an animation class string to use in tw template literals.
74
+ *
75
+ * @example
76
+ * const fadeIn = animate({ from: "opacity-0", to: "opacity-100", duration: 200 })
77
+ * const Box = tw.div`${fadeIn} p-4 bg-white`
78
+ */
79
+ declare function animate(opts: AnimateOptions): string;
80
+ /**
81
+ * Define a custom keyframe animation with multiple stops.
82
+ *
83
+ * @example
84
+ * const pulse = tw.keyframes("pulse", {
85
+ * "0%, 100%": "opacity-100 scale-100",
86
+ * "50%": "opacity-50 scale-95",
87
+ * })
88
+ * const Dot = tw.div`${pulse} w-4 h-4 rounded-full bg-blue-500`
89
+ */
90
+ declare function keyframes(name: string, stops: KeyframesDefinition): string;
91
+ /**
92
+ * Collection of ready-to-use animation class strings.
93
+ *
94
+ * @example
95
+ * const Card = tw.div`${animations.fadeIn} p-4 bg-white`
96
+ * const Modal = tw.div`${animations.scaleIn} fixed inset-0`
97
+ */
98
+ declare const animations: {
99
+ readonly fadeIn: string;
100
+ readonly fadeOut: string;
101
+ readonly slideUp: string;
102
+ readonly slideDown: string;
103
+ readonly slideLeft: string;
104
+ readonly slideRight: string;
105
+ readonly scaleIn: string;
106
+ readonly scaleOut: string;
107
+ readonly blurIn: string;
108
+ readonly bounceIn: string;
109
+ readonly spinIn: string;
110
+ };
111
+ /**
112
+ * Get all compiled animation CSS to inject into a stylesheet.
113
+ * Called by the CSS extraction engine at build time.
114
+ */
115
+ declare function extractAnimationCss(): string;
116
+
117
+ export { type AnimateOptions, type CompiledAnimation, type KeyframesDefinition, animate, animations, compileAnimation, extractAnimationCss, getAnimationRegistry, keyframes };
@@ -0,0 +1,117 @@
1
+ /**
2
+ * tailwind-styled-v4 — Animation DSL
3
+ *
4
+ * Compile-time animation system. Define animations dengan Tailwind class,
5
+ * compiler generate @keyframes — nol runtime, nol JS overhead.
6
+ *
7
+ * Usage:
8
+ *
9
+ * // Cara 1: .animate() chaining pada tw component
10
+ * const FadeIn = tw.div.animate({
11
+ * from: "opacity-0 translate-y-2",
12
+ * to: "opacity-100 translate-y-0",
13
+ * duration: 300,
14
+ * easing: "ease-out"
15
+ * })
16
+ *
17
+ * // Cara 2: standalone animate() utility
18
+ * const fadeIn = animate({
19
+ * from: "opacity-0 scale-95",
20
+ * to: "opacity-100 scale-100",
21
+ * duration: 200,
22
+ * })
23
+ * const Box = tw.div`${fadeIn}`
24
+ *
25
+ * // Cara 3: preset animations
26
+ * const Card = tw.div`${animations.fadeIn} ${animations.slideUp}`
27
+ *
28
+ * // Cara 4: tw.keyframes() custom
29
+ * const spin = tw.keyframes("spin", {
30
+ * "0%": "rotate-0",
31
+ * "100%": "rotate-180",
32
+ * })
33
+ */
34
+ interface AnimateOptions {
35
+ /** Tailwind classes for animation start state */
36
+ from: string;
37
+ /** Tailwind classes for animation end state */
38
+ to: string;
39
+ /** Duration in ms. Default: 300 */
40
+ duration?: number;
41
+ /** CSS easing. Default: "ease-out" */
42
+ easing?: string;
43
+ /** Delay in ms. Default: 0 */
44
+ delay?: number;
45
+ /** Fill mode. Default: "both" */
46
+ fill?: "none" | "forwards" | "backwards" | "both";
47
+ /** Iteration count. Default: 1 */
48
+ iterations?: number | "infinite";
49
+ /** Direction. Default: "normal" */
50
+ direction?: "normal" | "reverse" | "alternate" | "alternate-reverse";
51
+ /** Animation name override (auto-generated from from+to if not set) */
52
+ name?: string;
53
+ }
54
+ interface KeyframesDefinition {
55
+ [stop: string]: string;
56
+ }
57
+ interface CompiledAnimation {
58
+ /** CSS animation class name to apply */
59
+ className: string;
60
+ /** @keyframes CSS to inject */
61
+ keyframesCss: string;
62
+ /** animation CSS shorthand */
63
+ animationCss: string;
64
+ }
65
+ declare function getAnimationRegistry(): Map<string, CompiledAnimation>;
66
+ /**
67
+ * Compile AnimateOptions into CSS animation + @keyframes.
68
+ *
69
+ * Called at build time by the compiler, or at runtime in dev mode.
70
+ */
71
+ declare function compileAnimation(opts: AnimateOptions): CompiledAnimation;
72
+ /**
73
+ * Generate an animation class string to use in tw template literals.
74
+ *
75
+ * @example
76
+ * const fadeIn = animate({ from: "opacity-0", to: "opacity-100", duration: 200 })
77
+ * const Box = tw.div`${fadeIn} p-4 bg-white`
78
+ */
79
+ declare function animate(opts: AnimateOptions): string;
80
+ /**
81
+ * Define a custom keyframe animation with multiple stops.
82
+ *
83
+ * @example
84
+ * const pulse = tw.keyframes("pulse", {
85
+ * "0%, 100%": "opacity-100 scale-100",
86
+ * "50%": "opacity-50 scale-95",
87
+ * })
88
+ * const Dot = tw.div`${pulse} w-4 h-4 rounded-full bg-blue-500`
89
+ */
90
+ declare function keyframes(name: string, stops: KeyframesDefinition): string;
91
+ /**
92
+ * Collection of ready-to-use animation class strings.
93
+ *
94
+ * @example
95
+ * const Card = tw.div`${animations.fadeIn} p-4 bg-white`
96
+ * const Modal = tw.div`${animations.scaleIn} fixed inset-0`
97
+ */
98
+ declare const animations: {
99
+ readonly fadeIn: string;
100
+ readonly fadeOut: string;
101
+ readonly slideUp: string;
102
+ readonly slideDown: string;
103
+ readonly slideLeft: string;
104
+ readonly slideRight: string;
105
+ readonly scaleIn: string;
106
+ readonly scaleOut: string;
107
+ readonly blurIn: string;
108
+ readonly bounceIn: string;
109
+ readonly spinIn: string;
110
+ };
111
+ /**
112
+ * Get all compiled animation CSS to inject into a stylesheet.
113
+ * Called by the CSS extraction engine at build time.
114
+ */
115
+ declare function extractAnimationCss(): string;
116
+
117
+ export { type AnimateOptions, type CompiledAnimation, type KeyframesDefinition, animate, animations, compileAnimation, extractAnimationCss, getAnimationRegistry, keyframes };