@tac-ui/tokens 0.1.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.
@@ -0,0 +1,946 @@
1
+ 'use strict';
2
+
3
+ // src/semantic.ts
4
+ var semanticTokens = {
5
+ light: {
6
+ // ── Canvas & Surface (Off-white paper base) ──
7
+ background: "#FAFAFA",
8
+ // Off-white base
9
+ backgroundSubtle: "#F4F4F5",
10
+ // Slightly darker gray
11
+ surface: "#FCFCFC",
12
+ // Just faintly off-white surface
13
+ surfaceHover: "#F4F4F5",
14
+ surfaceBase: "#FAFAFA",
15
+ surfaceElevatedLow: "#FCFCFC",
16
+ surfaceElevatedMid: "#FCFCFC",
17
+ surfaceElevatedHigh: "#FCFCFC",
18
+ card: "#FCFCFC",
19
+ cardForeground: "#121212",
20
+ // Barely off-black
21
+ // ── Text ──
22
+ foreground: "#121212",
23
+ muted: "#F4F4F5",
24
+ mutedForeground: "#71717A",
25
+ // ── Brand ──
26
+ primary: "#1E232D",
27
+ // Iron Navy
28
+ primaryHover: "#2A303D",
29
+ // Slightly lighter for hover
30
+ primaryForeground: "#FAFAFA",
31
+ secondary: "#E4E4E7",
32
+ // Darkened from F4F4F5 for better visibility
33
+ secondaryForeground: "#1E232D",
34
+ ring: "#1E232D",
35
+ // ── Point / Accent (Steel Navy) ──
36
+ point: "#323944",
37
+ pointHover: "#4A5361",
38
+ pointForeground: "#FAFAFA",
39
+ pointSubtle: "rgba(30, 35, 45, 0.08)",
40
+ // ── Border ──
41
+ border: "#E4E4E7",
42
+ input: "#E4E4E7",
43
+ // ── Gray Scale ──
44
+ gray50: "#FAFAFA",
45
+ gray100: "#F4F4F5",
46
+ gray200: "#E4E4E7",
47
+ gray300: "#D4D4D8",
48
+ gray400: "#A1A1AA",
49
+ gray500: "#71717A",
50
+ gray600: "#52525B",
51
+ gray700: "#3F3F46",
52
+ gray800: "#27272A",
53
+ gray900: "#18181B",
54
+ // ── Glass & Effects ──
55
+ glassBg: "rgba(252, 252, 252, 0.85)",
56
+ glassBorder: "rgba(18, 18, 18, 0.04)",
57
+ glassInset: "inset 0 1px 0 rgba(250, 250, 250, 0.6)",
58
+ glassPanelShadow: "0 12px 40px rgba(18, 18, 18, 0.04), 0 1px 3px rgba(18, 18, 18, 0.02)",
59
+ accentGlow: "0 0 0 transparent",
60
+ // ── Gradients ──
61
+ gradientBrand: "none",
62
+ gradientBrandHover: "none",
63
+ gradientSubtle: "none",
64
+ gradientAccent: "none",
65
+ gradientAccentVivid: "none",
66
+ gradientGlow: "none",
67
+ gradientMesh: "none",
68
+ gradientSurface: "none",
69
+ gradientGlowShadow: "none",
70
+ // ── Shadow ──
71
+ shadowColor: "rgba(18, 18, 18, 0.05)",
72
+ // ── Status ──
73
+ success: "#1A4331",
74
+ successBg: "#EAF1EC",
75
+ successForeground: "#1A4331",
76
+ warning: "#8A6D3B",
77
+ warningBg: "#F7F3EA",
78
+ warningForeground: "#8A6D3B",
79
+ error: "#7C2128",
80
+ errorBg: "#F4EAEB",
81
+ errorForeground: "#7C2128",
82
+ info: "#121212",
83
+ infoBg: "#FAFAFA",
84
+ infoForeground: "#121212",
85
+ // ── Interaction States ──
86
+ interactiveHover: "rgba(18, 18, 18, 0.04)",
87
+ interactivePressed: "rgba(18, 18, 18, 0.08)",
88
+ interactiveFocus: "#121212",
89
+ interactiveSurfaceTint: "rgba(18, 18, 18, 0.02)",
90
+ interactiveHoverTint: "rgba(18, 18, 18, 0.04)",
91
+ focusGlow: "0 0 0 2px #E4E4E7",
92
+ pointGlow: "0 0 0 2px rgba(18, 18, 18, 0.15)",
93
+ // ── Components ──
94
+ btnPrimarySurface: "#1E232D",
95
+ btnPrimaryHover: "#2A303D",
96
+ btnPrimaryEnergy: "0 4px 12px rgba(30, 35, 45, 0.16)",
97
+ btnPrimaryInset: "none",
98
+ btnSecondarySurface: "#E4E4E7",
99
+ btnSecondaryHover: "#D4D4D8",
100
+ btnOutlineBorder: "#E4E4E7",
101
+ btnOutlineBorderHover: "#D4D4D8",
102
+ btnOutlineHoverBg: "#F4F4F5",
103
+ btnGhostHover: "#F4F4F5",
104
+ btnPointSurface: "#323944",
105
+ btnPointBorder: "transparent",
106
+ btnPointHoverSurface: "#4A5361",
107
+ btnPointHoverBorder: "transparent",
108
+ btnPointEnergy: "0 4px 12px rgba(50, 57, 68, 0.2)",
109
+ btnDestructiveSurface: "#7C2128",
110
+ btnDestructiveHover: "#5B171D",
111
+ inputBg: "#FCFCFC",
112
+ inputBorderRest: "#E4E4E7",
113
+ inputBorderHover: "#A1A1AA",
114
+ inputHoverGlow: "0 0 0 2px #F4F4F5",
115
+ inputFocusGlow: "0 0 0 2px #E4E4E7",
116
+ inputErrorGlow: "0 0 0 2px #F4EAEB",
117
+ dropdownBg: "#FCFCFC",
118
+ dropdownShadow: "0 20px 25px -5px rgba(18, 18, 18, 0.08), 0 0 0 1px rgba(18, 18, 18, 0.03)",
119
+ dropdownItemHover: "#F4F4F5",
120
+ cardAccentBorder: "#E4E4E7",
121
+ cardAccentGlow: "none",
122
+ cardAccentHoverBorder: "#D4D4D8",
123
+ cardAccentHoverGlow: "0 8px 24px rgba(18, 18, 18, 0.06)"
124
+ },
125
+ dark: {
126
+ // ── Canvas & Surface (High-Contrast Charcoal Base) ──
127
+ background: "#121214",
128
+ // Off-black charcoal
129
+ backgroundSubtle: "#18181A",
130
+ // Zinc 900
131
+ surface: "#27272A",
132
+ // Zinc 800 - distinct from subtle background
133
+ surfaceHover: "#3F3F46",
134
+ // Zinc 700
135
+ surfaceBase: "#121214",
136
+ surfaceElevatedLow: "#18181A",
137
+ surfaceElevatedMid: "#27272A",
138
+ surfaceElevatedHigh: "#3F3F46",
139
+ card: "#18181A",
140
+ // Zinc 900
141
+ cardForeground: "#F4F4F5",
142
+ // Off-white
143
+ // ── Text ──
144
+ foreground: "#F4F4F5",
145
+ // Off-white
146
+ muted: "#27272A",
147
+ // Zinc 800
148
+ mutedForeground: "#A1A1AA",
149
+ // Zinc 400
150
+ // ── Brand (Iron Navy Light / Cold Steel Blue-Gray) ──
151
+ primary: "#B8C4D9",
152
+ primaryHover: "#D1DBE8",
153
+ primaryForeground: "#1E232D",
154
+ // Deep Iron Navy text
155
+ secondary: "#27272A",
156
+ secondaryForeground: "#B8C4D9",
157
+ ring: "#B8C4D9",
158
+ // ── Point / Accent (Lighter Steel Blue-Gray) ──
159
+ point: "#D1DBE8",
160
+ pointHover: "#E6ECEF",
161
+ pointForeground: "#1E232D",
162
+ pointSubtle: "rgba(209, 219, 232, 0.12)",
163
+ // ── Border (Highly Visible) ──
164
+ border: "#3F3F46",
165
+ // Zinc 700
166
+ input: "#3F3F46",
167
+ // ── Gray Scale (Zinc) ──
168
+ gray50: "#121214",
169
+ gray100: "#18181A",
170
+ gray200: "#27272A",
171
+ gray300: "#3F3F46",
172
+ gray400: "#52525B",
173
+ gray500: "#71717A",
174
+ gray600: "#A1A1AA",
175
+ gray700: "#D4D4D8",
176
+ gray800: "#E4E4E7",
177
+ gray900: "#FAFAFA",
178
+ // ── Glass & Effects ──
179
+ glassBg: "rgba(18, 18, 20, 0.85)",
180
+ glassBorder: "rgba(250, 250, 250, 0.1)",
181
+ glassInset: "inset 0 1px 0 rgba(250, 250, 250, 0.05)",
182
+ glassPanelShadow: "0 20px 40px rgba(0, 0, 0, 0.8)",
183
+ accentGlow: "none",
184
+ // ── Gradients ──
185
+ gradientBrand: "none",
186
+ gradientBrandHover: "none",
187
+ gradientSubtle: "none",
188
+ gradientAccent: "none",
189
+ gradientAccentVivid: "none",
190
+ gradientGlow: "none",
191
+ gradientMesh: "none",
192
+ gradientSurface: "none",
193
+ gradientGlowShadow: "none",
194
+ // ── Shadow ──
195
+ shadowColor: "rgba(0, 0, 0, 0.9)",
196
+ // ── Status (Deep & Clear) ──
197
+ success: "#34D399",
198
+ successBg: "rgba(52, 211, 153, 0.15)",
199
+ successForeground: "#34D399",
200
+ warning: "#FBBF24",
201
+ warningBg: "rgba(251, 191, 36, 0.15)",
202
+ warningForeground: "#FBBF24",
203
+ error: "#F87171",
204
+ errorBg: "rgba(248, 113, 113, 0.15)",
205
+ errorForeground: "#F87171",
206
+ info: "#FAFAFA",
207
+ infoBg: "rgba(250, 250, 250, 0.15)",
208
+ infoForeground: "#FAFAFA",
209
+ // ── Interaction States ──
210
+ interactiveHover: "rgba(250, 250, 250, 0.08)",
211
+ interactivePressed: "rgba(250, 250, 250, 0.12)",
212
+ interactiveFocus: "#FAFAFA",
213
+ interactiveSurfaceTint: "rgba(250, 250, 250, 0.04)",
214
+ interactiveHoverTint: "rgba(250, 250, 250, 0.08)",
215
+ focusGlow: "0 0 0 2px #3F3F46",
216
+ pointGlow: "0 0 0 2px rgba(250, 250, 250, 0.3)",
217
+ // ── Components ──
218
+ btnPrimarySurface: "#B8C4D9",
219
+ btnPrimaryHover: "#D1DBE8",
220
+ btnPrimaryEnergy: "0 4px 16px rgba(184, 196, 217, 0.25)",
221
+ btnPrimaryInset: "none",
222
+ btnSecondarySurface: "#27272A",
223
+ btnSecondaryHover: "#3F3F46",
224
+ btnOutlineBorder: "#3F3F46",
225
+ btnOutlineBorderHover: "#52525B",
226
+ btnOutlineHoverBg: "#27272A",
227
+ btnGhostHover: "#27272A",
228
+ btnPointSurface: "#D1DBE8",
229
+ btnPointBorder: "transparent",
230
+ btnPointHoverSurface: "#E6ECEF",
231
+ btnPointHoverBorder: "transparent",
232
+ btnPointEnergy: "0 4px 16px rgba(209, 219, 232, 0.25)",
233
+ btnDestructiveSurface: "#7C2128",
234
+ btnDestructiveHover: "#9A2A32",
235
+ inputBg: "#18181A",
236
+ inputBorderRest: "#3F3F46",
237
+ inputBorderHover: "#52525B",
238
+ inputHoverGlow: "0 0 0 2px #27272A",
239
+ inputFocusGlow: "0 0 0 2px #3F3F46",
240
+ inputErrorGlow: "0 0 0 2px #3E1014",
241
+ dropdownBg: "#18181A",
242
+ dropdownShadow: "0 20px 25px -5px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(250,250,250,0.1)",
243
+ dropdownItemHover: "#27272A",
244
+ cardAccentBorder: "#3F3F46",
245
+ cardAccentGlow: "none",
246
+ cardAccentHoverBorder: "#52525B",
247
+ cardAccentHoverGlow: "0 8px 24px rgba(0, 0, 0, 0.8)"
248
+ }
249
+ };
250
+
251
+ // src/chart.ts
252
+ var chart = {
253
+ light: {
254
+ colors: [
255
+ "#1E232D",
256
+ // chart-1: Iron Navy (Primary)
257
+ "#323944",
258
+ // chart-2: Steel Navy (Secondary)
259
+ "#4A5361",
260
+ // chart-3: Slate Navy (Tertiary)
261
+ "#71717A",
262
+ // chart-4: Zinc 500 (Accent 1)
263
+ "#A1A1AA",
264
+ // chart-5: Zinc 400 (Accent 2)
265
+ "#D4D4D8",
266
+ // chart-6: Zinc 300 (Fill)
267
+ "#0F172A",
268
+ // chart-7: Deep Slate 900 (Deep Fill)
269
+ "#E4E4E7"
270
+ // chart-8: Zinc 200 (Light Fill)
271
+ ],
272
+ grid: "rgba(30, 35, 45, 0.04)",
273
+ axis: "rgba(30, 35, 45, 0.08)",
274
+ label: "#71717A",
275
+ // Zinc 500
276
+ tooltipBg: "#FFFFFF"
277
+ },
278
+ dark: {
279
+ colors: [
280
+ "#B8C4D9",
281
+ // chart-1: Bright Ice Navy (Primary)
282
+ "#D1DBE8",
283
+ // chart-2: Ice Steel (Secondary)
284
+ "#E6ECEF",
285
+ // chart-3: Pale Silver (Tertiary)
286
+ "#A1A1AA",
287
+ // chart-4: Zinc 400 (Accent 1)
288
+ "#71717A",
289
+ // chart-5: Zinc 500 (Accent 2)
290
+ "#808B9D",
291
+ // chart-6: Cold Steel (Fill)
292
+ "#FFFFFF",
293
+ // chart-7: Pure White (Highlight)
294
+ "#52525B"
295
+ // chart-8: Zinc 600 (Deep Fill)
296
+ ],
297
+ grid: "rgba(255, 255, 255, 0.04)",
298
+ axis: "rgba(255, 255, 255, 0.06)",
299
+ label: "#A1A1AA",
300
+ // Zinc 400
301
+ tooltipBg: "#18181A"
302
+ // Off-black chart tooltip matches dropdowns
303
+ },
304
+ lineWidth: 1.5,
305
+ dotSize: 2.5,
306
+ barRadius: 4,
307
+ areaOpacity: 0.08
308
+ };
309
+
310
+ // src/spacing.ts
311
+ var spacing = {
312
+ "2xs": 2,
313
+ xs: 4,
314
+ sm: 8,
315
+ m: 16,
316
+ lg: 24,
317
+ xl: 40,
318
+ "2xl": 56,
319
+ "3xl": 80
320
+ };
321
+ var radius = {
322
+ none: 0,
323
+ xs: 4,
324
+ sm: 6,
325
+ m: 10,
326
+ lg: 14,
327
+ xl: 20,
328
+ "2xl": 24,
329
+ pill: 9999
330
+ };
331
+
332
+ // src/elevation.ts
333
+ var elevation = {
334
+ light: {
335
+ sm: "0 1px 2px rgba(94,94,94,0.04), 0 1px 3px rgba(94,94,94,0.02)",
336
+ m: "0 2px 4px rgba(94,94,94,0.04), 0 8px 16px rgba(94,94,94,0.04)",
337
+ lg: "0 4px 8px rgba(94,94,94,0.05), 0 16px 32px rgba(94,94,94,0.06)",
338
+ xl: "0 8px 16px rgba(94,94,94,0.06), 0 24px 48px rgba(94,94,94,0.08)",
339
+ glass: "0 4px 24px rgba(94,94,94,0.05), 0 1px 2px rgba(94,94,94,0.02)",
340
+ glassLg: "0 8px 32px rgba(94,94,94,0.08), 0 2px 4px rgba(94,94,94,0.03)"
341
+ },
342
+ dark: {
343
+ sm: "0 1px 2px rgba(0,0,0,0.20), 0 1px 3px rgba(0,0,0,0.14)",
344
+ m: "0 1px 4px rgba(0,0,0,0.20), 0 4px 12px rgba(0,0,0,0.16)",
345
+ lg: "0 2px 8px rgba(0,0,0,0.20), 0 8px 24px rgba(0,0,0,0.18)",
346
+ xl: "0 4px 12px rgba(0,0,0,0.22), 0 12px 32px rgba(0,0,0,0.20)",
347
+ glass: "0 2px 12px rgba(0,0,0,0.18), 0 1px 2px rgba(0,0,0,0.12), 0 0 0 0.5px rgba(255,255,255,0.06)",
348
+ glassLg: "0 4px 20px rgba(0,0,0,0.20), 0 2px 4px rgba(0,0,0,0.12), 0 0 16px rgba(138,163,184,0.03)"
349
+ }
350
+ };
351
+ var zIndex = {
352
+ dropdown: 1e3,
353
+ sticky: 1100,
354
+ overlay: 1200,
355
+ modal: 1300,
356
+ popover: 1400,
357
+ tooltip: 1500,
358
+ toast: 1600
359
+ };
360
+ var motion = {
361
+ duration: {
362
+ instant: 80,
363
+ fast: 150,
364
+ normal: 220,
365
+ slow: 320,
366
+ complex: 450
367
+ },
368
+ easing: {
369
+ /** Dia's signature curve — slight overshoot with smooth natural deceleration. */
370
+ standard: "cubic-bezier(0.22, 1, 0.36, 1)",
371
+ /** Exit easing — fast acceleration, abrupt departure. */
372
+ easeIn: "cubic-bezier(0.55, 0, 1, 0.45)",
373
+ /** Entrance easing — gentle deceleration without overshoot. */
374
+ easeOut: "cubic-bezier(0, 0.55, 0.45, 1)",
375
+ /** Symmetric ease — smooth in both directions. */
376
+ easeInOut: "cubic-bezier(0.65, 0, 0.35, 1)",
377
+ /** Playful overshoot — for toggles, switches, confirmatory feedback. */
378
+ bounce: "cubic-bezier(0.34, 1.56, 0.64, 1)",
379
+ /** Stronger spring feel — deliberate physical presence. */
380
+ spring: "cubic-bezier(0.22, 1.2, 0.36, 1)",
381
+ /** Subtle rubber-band — elastic resistance with quick snap back. */
382
+ elastic: "cubic-bezier(0.68, -0.2, 0.265, 1.2)"
383
+ },
384
+ /** Standard animation keyframe presets for reuse across components. */
385
+ keyframes: {
386
+ fadeIn: { from: { opacity: "0" }, to: { opacity: "1" } },
387
+ fadeOut: { from: { opacity: "1" }, to: { opacity: "0" } },
388
+ /** Blur entrance — element fades in from blurry with subtle upward spring motion. */
389
+ blurFadeIn: {
390
+ from: { opacity: "0", filter: "blur(4px)", transform: "translateY(4px)" },
391
+ to: { opacity: "1", filter: "blur(0px)", transform: "translateY(0)" }
392
+ },
393
+ /** Blur scale entrance — deblurs while gently scaling up from slight compression. */
394
+ blurScaleIn: {
395
+ from: { opacity: "0", filter: "blur(3px)", transform: "scale(0.98)" },
396
+ to: { opacity: "1", filter: "blur(0px)", transform: "scale(1)" }
397
+ },
398
+ /** Slide entrance from below — element springs up from offset position. */
399
+ slideInUp: { from: { opacity: "0", transform: "translateY(5px)" }, to: { opacity: "1", transform: "translateY(0)" } },
400
+ /** Slide entrance from above — element springs down from offset position. */
401
+ slideInDown: { from: { opacity: "0", transform: "translateY(-5px)" }, to: { opacity: "1", transform: "translateY(0)" } },
402
+ /** Slide entrance from left — element springs in from offset. */
403
+ slideInLeft: { from: { opacity: "0", transform: "translateX(-5px)" }, to: { opacity: "1", transform: "translateX(0)" } },
404
+ /** Slide entrance from right — element springs in from offset. */
405
+ slideInRight: { from: { opacity: "0", transform: "translateX(5px)" }, to: { opacity: "1", transform: "translateX(0)" } },
406
+ /** Scale entrance — element inflates from slight compression. */
407
+ scaleIn: { from: { opacity: "0", transform: "scale(0.98)" }, to: { opacity: "1", transform: "scale(1)" } },
408
+ scaleOut: { from: { opacity: "1", transform: "scale(1)" }, to: { opacity: "0", transform: "scale(0.98)" } },
409
+ /** Zoom entrance — element arrives from meaningful distance, not just nearby. */
410
+ zoomIn: { from: { opacity: "0", transform: "scale(0.92)" }, to: { opacity: "1", transform: "scale(1)" } },
411
+ /** Press feedback — subtle scale to confirm tap/click with physical weight. */
412
+ pressDown: { from: { transform: "scale(1)" }, to: { transform: "scale(0.98)" } },
413
+ /** Press keyframes — clean squish held at destination. */
414
+ elasticPress: {
415
+ "0%": { transform: "scale(1)" },
416
+ "50%": { transform: "scale(0.98)" },
417
+ "100%": { transform: "scale(0.98)" }
418
+ },
419
+ /** Release keyframes — spring overshoots slightly then resolves to rest. */
420
+ elasticRelease: {
421
+ "0%": { transform: "scale(0.98)" },
422
+ "50%": { transform: "scale(1.005)" },
423
+ "100%": { transform: "scale(1)" }
424
+ },
425
+ /** Lift — subtle elevation shift on hover, element has mass. */
426
+ liftUp: { from: { transform: "translateY(0)" }, to: { transform: "translateY(-1px)" } },
427
+ /** Glow pulse — ambient glow to indicate active state. */
428
+ glowPulse: {
429
+ "0%, 100%": { boxShadow: "0 0 0 0 color-mix(in srgb, var(--point) 0%, transparent)" },
430
+ "50%": { boxShadow: "0 0 12px 2px color-mix(in srgb, var(--point) 20%, transparent)" }
431
+ },
432
+ shimmer: {
433
+ "0%": { backgroundPosition: "-200% 0" },
434
+ "100%": { backgroundPosition: "200% 0" }
435
+ },
436
+ gradientShimmer: {
437
+ "0%": { backgroundPosition: "0% 50%" },
438
+ "50%": { backgroundPosition: "100% 50%" },
439
+ "100%": { backgroundPosition: "0% 50%" }
440
+ },
441
+ /** Gradient glow — soft glow for decorative emphasis. */
442
+ gradientGlow: {
443
+ "0%, 100%": { boxShadow: "0 0 0 0 color-mix(in srgb, var(--point) 0%, transparent)" },
444
+ "50%": { boxShadow: "0 0 16px 3px color-mix(in srgb, var(--point) 15%, transparent)" }
445
+ },
446
+ /** Spotlight pulse — radial glow that breathes gently. */
447
+ spotlightPulse: {
448
+ "0%, 100%": { opacity: "0" },
449
+ "50%": { opacity: "1" }
450
+ },
451
+ spin: { from: { transform: "rotate(0deg)" }, to: { transform: "rotate(360deg)" } },
452
+ pulse: { "0%, 100%": { opacity: "1" }, "50%": { opacity: "0.5" } },
453
+ bounce: { "0%, 100%": { transform: "translateY(0)" }, "50%": { transform: "translateY(-2px)" } },
454
+ /** Float — gentle hovering motion with spring-like rhythm. */
455
+ float: {
456
+ "0%, 100%": { transform: "translateY(0)" },
457
+ "50%": { transform: "translateY(-2px)" }
458
+ }
459
+ }};
460
+
461
+ // src/typography.ts
462
+ var typography = {
463
+ fontFamily: {
464
+ primary: "Pretendard",
465
+ secondary: "Pretendard",
466
+ display: "Pretendard"
467
+ }};
468
+
469
+ // src/component.ts
470
+ var component = {
471
+ button: {
472
+ sm: { height: 34, paddingX: 18, fontSize: 12, borderRadius: 8},
473
+ md: { height: 42, paddingX: 28, fontSize: 13, borderRadius: 10, iconSize: 18 },
474
+ lg: { height: 50, paddingX: 36, fontSize: 15, borderRadius: 14}
475
+ },
476
+ input: {
477
+ height: 42,
478
+ paddingX: 18,
479
+ paddingY: 12,
480
+ fontSize: 14,
481
+ borderRadius: 10,
482
+ iconSize: 18,
483
+ iconPadding: 42
484
+ },
485
+ card: {
486
+ padding: 28,
487
+ gap: 20,
488
+ borderRadius: 16,
489
+ titleSize: 17,
490
+ bodySize: 14
491
+ },
492
+ badge: {
493
+ paddingX: 12,
494
+ paddingY: 6,
495
+ fontSize: 12,
496
+ borderRadius: 9999
497
+ },
498
+ checkbox: {
499
+ gap: 12,
500
+ size: 20,
501
+ borderRadius: 6,
502
+ borderWidth: 2,
503
+ iconSize: 14,
504
+ labelSize: 14
505
+ },
506
+ radio: {
507
+ gap: 12,
508
+ size: 20,
509
+ borderWidth: 2,
510
+ checkedBorderWidth: 6,
511
+ labelSize: 14
512
+ },
513
+ switch: {
514
+ width: 52,
515
+ height: 32,
516
+ thumbSize: 24,
517
+ thumbOffset: 4,
518
+ thumbTranslateOn: 24,
519
+ thumbTranslateOff: 4
520
+ },
521
+ chip: {
522
+ paddingX: 16,
523
+ paddingY: 8,
524
+ fontSize: 13,
525
+ borderRadius: 9999,
526
+ iconSize: 14},
527
+ tabs: {
528
+ primary: {
529
+ paddingX: 20,
530
+ paddingY: 12,
531
+ fontSize: 14,
532
+ indicatorHeight: 2
533
+ },
534
+ secondary: {
535
+ paddingX: 20,
536
+ paddingY: 8,
537
+ fontSize: 13,
538
+ containerPadding: 4,
539
+ containerRadius: 14,
540
+ itemRadius: 10
541
+ }
542
+ },
543
+ slider: {
544
+ trackHeight: 6,
545
+ thumbSize: 20,
546
+ thumbBorderWidth: 2
547
+ },
548
+ tooltip: {
549
+ simple: { paddingX: 14, paddingY: 8, fontSize: 13, borderRadius: 10 },
550
+ rich: { paddingX: 16, paddingY: 10, maxWidth: 240, borderRadius: 10 }},
551
+ avatar: {
552
+ sm: { size: 28},
553
+ md: { size: 36},
554
+ lg: { size: 48},
555
+ xl: { size: 64},
556
+ statusDot: 10,
557
+ statusBorder: 2
558
+ },
559
+ divider: {
560
+ thickness: 1,
561
+ thickThickness: 8,
562
+ insetMargin: 64,
563
+ labelSize: 12
564
+ },
565
+ progress: {
566
+ linear: { height: 8, borderRadius: 9999 },
567
+ circular: { strokeWidth: 4, textSize: 14 }
568
+ },
569
+ snackbar: {
570
+ borderRadius: 14,
571
+ gap: 12,
572
+ iconSize: 18,
573
+ messageSize: 14,
574
+ actionPaddingX: 14,
575
+ actionPaddingY: 6,
576
+ actionRadius: 8,
577
+ actionSize: 13
578
+ },
579
+ dialog: {
580
+ width: 380,
581
+ borderRadius: 20,
582
+ headerPaddingX: 28,
583
+ headerPaddingY: 24,
584
+ footerPaddingX: 28,
585
+ footerPaddingY: 20,
586
+ titleSize: 17,
587
+ descSize: 14,
588
+ footerGap: 14
589
+ },
590
+ animatedToggle: {
591
+ size: 40,
592
+ borderRadius: 10,
593
+ iconSize: 20
594
+ }
595
+ };
596
+
597
+ // src/web/unit-utils.ts
598
+ function rem(v) {
599
+ return `${v / 16}rem`;
600
+ }
601
+ function px(v) {
602
+ return `${v}px`;
603
+ }
604
+ function ms(v) {
605
+ return `${v}ms`;
606
+ }
607
+ function unitless(v) {
608
+ return `${v}`;
609
+ }
610
+
611
+ // src/web/css-variables.ts
612
+ function generateCSSVariables(mode) {
613
+ const colors = semanticTokens[mode];
614
+ const chartTokens = chart[mode];
615
+ const elevationMode = elevation[mode];
616
+ return {
617
+ // Font
618
+ "--font-primary": `'${typography.fontFamily.primary}', -apple-system, BlinkMacSystemFont, system-ui, sans-serif`,
619
+ "--font-secondary": `'${typography.fontFamily.secondary}', sans-serif`,
620
+ "--font-display": `'${typography.fontFamily.display}', '${typography.fontFamily.primary}', sans-serif`,
621
+ // Colors
622
+ "--background": colors.background,
623
+ "--background-subtle": colors.backgroundSubtle,
624
+ "--foreground": colors.foreground,
625
+ "--surface": colors.surface,
626
+ "--surface-hover": colors.surfaceHover,
627
+ "--primary": colors.primary,
628
+ "--primary-hover": colors.primaryHover,
629
+ "--primary-foreground": colors.primaryForeground,
630
+ "--secondary": colors.secondary,
631
+ "--secondary-foreground": colors.secondaryForeground,
632
+ "--muted": colors.muted,
633
+ "--muted-foreground": colors.mutedForeground,
634
+ "--card": colors.card,
635
+ "--card-foreground": colors.cardForeground,
636
+ "--border": colors.border,
637
+ "--input": colors.input,
638
+ "--ring": colors.ring,
639
+ "--point": colors.point,
640
+ "--point-hover": colors.pointHover,
641
+ "--point-foreground": colors.pointForeground,
642
+ "--point-subtle": colors.pointSubtle,
643
+ "--accent-glow": colors.accentGlow,
644
+ // Glass
645
+ "--glass-bg": colors.glassBg,
646
+ "--glass-border": colors.glassBorder,
647
+ // Gradients
648
+ "--gradient-brand": colors.gradientBrand,
649
+ "--gradient-brand-hover": colors.gradientBrandHover,
650
+ "--gradient-subtle": colors.gradientSubtle,
651
+ "--gradient-accent": colors.gradientAccent,
652
+ "--gradient-accent-vivid": colors.gradientAccentVivid,
653
+ "--gradient-glow": colors.gradientGlow,
654
+ "--gradient-mesh": colors.gradientMesh,
655
+ "--gradient-surface": colors.gradientSurface,
656
+ "--gradient-glow-shadow": colors.gradientGlowShadow,
657
+ // Status
658
+ "--success": colors.success,
659
+ "--success-bg": colors.successBg,
660
+ "--success-foreground": colors.successForeground,
661
+ "--warning": colors.warning,
662
+ "--warning-bg": colors.warningBg,
663
+ "--warning-foreground": colors.warningForeground,
664
+ "--error": colors.error,
665
+ "--error-bg": colors.errorBg,
666
+ "--error-foreground": colors.errorForeground,
667
+ "--info": colors.info,
668
+ "--info-bg": colors.infoBg,
669
+ "--info-foreground": colors.infoForeground,
670
+ "--shadow-color": colors.shadowColor,
671
+ // Gray scale
672
+ "--gray-50": colors.gray50,
673
+ "--gray-100": colors.gray100,
674
+ "--gray-200": colors.gray200,
675
+ "--gray-300": colors.gray300,
676
+ "--gray-400": colors.gray400,
677
+ "--gray-500": colors.gray500,
678
+ "--gray-600": colors.gray600,
679
+ "--gray-700": colors.gray700,
680
+ "--gray-800": colors.gray800,
681
+ "--gray-900": colors.gray900,
682
+ // Surface layers
683
+ "--surface-base": colors.surfaceBase,
684
+ "--surface-elevated-low": colors.surfaceElevatedLow,
685
+ "--surface-elevated-mid": colors.surfaceElevatedMid,
686
+ "--surface-elevated-high": colors.surfaceElevatedHigh,
687
+ // Interaction states
688
+ "--interactive-hover": colors.interactiveHover,
689
+ "--interactive-pressed": colors.interactivePressed,
690
+ "--interactive-focus": colors.interactiveFocus,
691
+ // Button tokens
692
+ "--btn-primary-surface": colors.btnPrimarySurface,
693
+ "--btn-primary-hover": colors.btnPrimaryHover,
694
+ "--btn-primary-energy": colors.btnPrimaryEnergy,
695
+ "--btn-primary-inset": colors.btnPrimaryInset,
696
+ "--btn-secondary-surface": colors.btnSecondarySurface,
697
+ "--btn-secondary-hover": colors.btnSecondaryHover,
698
+ "--btn-outline-border": colors.btnOutlineBorder,
699
+ "--btn-outline-border-hover": colors.btnOutlineBorderHover,
700
+ "--btn-outline-hover-bg": colors.btnOutlineHoverBg,
701
+ "--btn-ghost-hover": colors.btnGhostHover,
702
+ "--btn-point-surface": colors.btnPointSurface,
703
+ "--btn-point-border": colors.btnPointBorder,
704
+ "--btn-point-hover-surface": colors.btnPointHoverSurface,
705
+ "--btn-point-hover-border": colors.btnPointHoverBorder,
706
+ "--btn-point-energy": colors.btnPointEnergy,
707
+ "--btn-destructive-surface": colors.btnDestructiveSurface,
708
+ "--btn-destructive-hover": colors.btnDestructiveHover,
709
+ // Shared interactive tokens
710
+ "--interactive-surface-tint": colors.interactiveSurfaceTint,
711
+ "--interactive-hover-tint": colors.interactiveHoverTint,
712
+ "--focus-glow": colors.focusGlow,
713
+ "--point-glow": colors.pointGlow,
714
+ "--glass-inset": colors.glassInset,
715
+ "--glass-panel-shadow": colors.glassPanelShadow,
716
+ // Input tokens
717
+ "--input-bg": colors.inputBg,
718
+ "--input-border-rest": colors.inputBorderRest,
719
+ "--input-border-hover": colors.inputBorderHover,
720
+ "--input-hover-glow": colors.inputHoverGlow,
721
+ "--input-focus-glow": colors.inputFocusGlow,
722
+ "--input-error-glow": colors.inputErrorGlow,
723
+ // Dropdown tokens
724
+ "--dropdown-bg": colors.dropdownBg,
725
+ "--dropdown-shadow": colors.dropdownShadow,
726
+ "--dropdown-item-hover": colors.dropdownItemHover,
727
+ // Card accent tokens
728
+ "--card-accent-border": colors.cardAccentBorder,
729
+ "--card-accent-glow": colors.cardAccentGlow,
730
+ "--card-accent-hover-border": colors.cardAccentHoverBorder,
731
+ "--card-accent-hover-glow": colors.cardAccentHoverGlow,
732
+ // Spacing
733
+ "--spacing-2xs": rem(spacing["2xs"]),
734
+ "--spacing-xs": rem(spacing.xs),
735
+ "--spacing-sm": rem(spacing.sm),
736
+ "--spacing-m": rem(spacing.m),
737
+ "--spacing-lg": rem(spacing.lg),
738
+ "--spacing-xl": rem(spacing.xl),
739
+ "--spacing-2xl": rem(spacing["2xl"]),
740
+ "--spacing-3xl": rem(spacing["3xl"]),
741
+ // Radius
742
+ "--radius-none": unitless(radius.none),
743
+ "--radius-xs": rem(radius.xs),
744
+ "--radius-sm": rem(radius.sm),
745
+ "--radius-m": rem(radius.m),
746
+ "--radius-lg": rem(radius.lg),
747
+ "--radius-xl": rem(radius.xl),
748
+ "--radius-2xl": rem(radius["2xl"]),
749
+ "--radius-pill": px(radius.pill),
750
+ // Elevation
751
+ "--shadow-sm": elevationMode.sm,
752
+ "--shadow-m": elevationMode.m,
753
+ "--shadow-lg": elevationMode.lg,
754
+ "--shadow-xl": elevationMode.xl,
755
+ "--shadow-glass": elevationMode.glass,
756
+ "--shadow-glass-lg": elevationMode.glassLg,
757
+ // Motion
758
+ "--duration-instant": ms(motion.duration.instant),
759
+ "--duration-fast": ms(motion.duration.fast),
760
+ "--duration-normal": ms(motion.duration.normal),
761
+ "--duration-slow": ms(motion.duration.slow),
762
+ "--duration-complex": ms(motion.duration.complex),
763
+ "--ease-standard": motion.easing.standard,
764
+ "--ease-in": motion.easing.easeIn,
765
+ "--ease-out": motion.easing.easeOut,
766
+ "--ease-in-out": motion.easing.easeInOut,
767
+ "--ease-bounce": motion.easing.bounce,
768
+ "--ease-spring": motion.easing.spring,
769
+ "--ease-elastic": motion.easing.elastic,
770
+ // Chart
771
+ "--chart-1": chartTokens.colors[0],
772
+ "--chart-2": chartTokens.colors[1],
773
+ "--chart-3": chartTokens.colors[2],
774
+ "--chart-4": chartTokens.colors[3],
775
+ "--chart-5": chartTokens.colors[4],
776
+ "--chart-6": chartTokens.colors[5],
777
+ "--chart-7": chartTokens.colors[6],
778
+ "--chart-8": chartTokens.colors[7],
779
+ "--chart-grid": chartTokens.grid,
780
+ "--chart-axis": chartTokens.axis,
781
+ "--chart-label": chartTokens.label,
782
+ "--chart-tooltip-bg": chartTokens.tooltipBg,
783
+ "--chart-line-width": px(chart.lineWidth),
784
+ "--chart-dot-size": px(chart.dotSize),
785
+ "--chart-bar-radius": px(chart.barRadius),
786
+ "--chart-area-opacity": unitless(chart.areaOpacity),
787
+ // Tooltip
788
+ "--tooltip-delay": ms(motion.duration.fast),
789
+ "--tooltip-padding": rem(16),
790
+ "--tooltip-radius": rem(12),
791
+ // Z-Index
792
+ "--z-dropdown": unitless(zIndex.dropdown),
793
+ "--z-sticky": unitless(zIndex.sticky),
794
+ "--z-overlay": unitless(zIndex.overlay),
795
+ "--z-modal": unitless(zIndex.modal),
796
+ "--z-popover": unitless(zIndex.popover),
797
+ "--z-tooltip": unitless(zIndex.tooltip),
798
+ "--z-toast": unitless(zIndex.toast),
799
+ // Component: Button
800
+ "--btn-sm-height": rem(component.button.sm.height),
801
+ "--btn-sm-px": rem(component.button.sm.paddingX),
802
+ "--btn-sm-font-size": rem(component.button.sm.fontSize),
803
+ "--btn-sm-radius": px(component.button.sm.borderRadius),
804
+ "--btn-md-height": rem(component.button.md.height),
805
+ "--btn-md-px": rem(component.button.md.paddingX),
806
+ "--btn-md-font-size": rem(component.button.md.fontSize),
807
+ "--btn-md-radius": px(component.button.md.borderRadius),
808
+ "--btn-lg-height": rem(component.button.lg.height),
809
+ "--btn-lg-px": rem(component.button.lg.paddingX),
810
+ "--btn-lg-font-size": rem(component.button.lg.fontSize),
811
+ "--btn-lg-radius": px(component.button.lg.borderRadius),
812
+ "--btn-icon-size": px(component.button.md.iconSize),
813
+ // Component: Input
814
+ "--input-height": rem(component.input.height),
815
+ "--input-px": rem(component.input.paddingX),
816
+ "--input-py": rem(component.input.paddingY),
817
+ "--input-font-size": rem(component.input.fontSize),
818
+ "--input-radius": px(component.input.borderRadius),
819
+ "--input-icon-size": px(component.input.iconSize),
820
+ "--input-icon-padding": rem(component.input.iconPadding),
821
+ // Component: Card
822
+ "--card-padding": rem(component.card.padding),
823
+ "--card-gap": rem(component.card.gap),
824
+ "--card-radius": px(component.card.borderRadius),
825
+ "--card-title-size": rem(component.card.titleSize),
826
+ "--card-body-size": rem(component.card.bodySize),
827
+ // Component: Badge
828
+ "--badge-px": rem(component.badge.paddingX),
829
+ "--badge-py": rem(component.badge.paddingY),
830
+ "--badge-font-size": rem(component.badge.fontSize),
831
+ "--badge-radius": px(component.badge.borderRadius),
832
+ // Component: Checkbox
833
+ "--checkbox-size": px(component.checkbox.size),
834
+ "--checkbox-radius": px(component.checkbox.borderRadius),
835
+ "--checkbox-border-width": px(component.checkbox.borderWidth),
836
+ "--checkbox-icon-size": px(component.checkbox.iconSize),
837
+ "--checkbox-gap": rem(component.checkbox.gap),
838
+ "--checkbox-label-size": rem(component.checkbox.labelSize),
839
+ // Component: Radio
840
+ "--radio-size": px(component.radio.size),
841
+ "--radio-border-width": px(component.radio.borderWidth),
842
+ "--radio-checked-border-width": px(component.radio.checkedBorderWidth),
843
+ "--radio-gap": rem(component.radio.gap),
844
+ "--radio-label-size": rem(component.radio.labelSize),
845
+ // Component: Switch
846
+ "--switch-width": px(component.switch.width),
847
+ "--switch-height": px(component.switch.height),
848
+ "--switch-thumb-size": px(component.switch.thumbSize),
849
+ "--switch-thumb-offset": px(component.switch.thumbOffset),
850
+ "--switch-thumb-translate-on": px(component.switch.thumbTranslateOn),
851
+ "--switch-thumb-translate-off": px(component.switch.thumbTranslateOff),
852
+ // Component: Chip
853
+ "--chip-px": rem(component.chip.paddingX),
854
+ "--chip-py": rem(component.chip.paddingY),
855
+ "--chip-font-size": rem(component.chip.fontSize),
856
+ "--chip-radius": px(component.chip.borderRadius),
857
+ "--chip-icon-size": px(component.chip.iconSize),
858
+ // Component: Tabs
859
+ "--tab-primary-px": rem(component.tabs.primary.paddingX),
860
+ "--tab-primary-py": rem(component.tabs.primary.paddingY),
861
+ "--tab-primary-font-size": rem(component.tabs.primary.fontSize),
862
+ "--tab-primary-indicator": px(component.tabs.primary.indicatorHeight),
863
+ "--tab-secondary-px": rem(component.tabs.secondary.paddingX),
864
+ "--tab-secondary-py": rem(component.tabs.secondary.paddingY),
865
+ "--tab-secondary-font-size": rem(component.tabs.secondary.fontSize),
866
+ "--tab-secondary-container-padding": px(component.tabs.secondary.containerPadding),
867
+ "--tab-secondary-container-radius": px(component.tabs.secondary.containerRadius),
868
+ "--tab-secondary-item-radius": px(component.tabs.secondary.itemRadius),
869
+ // Component: Slider
870
+ "--slider-track-height": px(component.slider.trackHeight),
871
+ "--slider-thumb-size": px(component.slider.thumbSize),
872
+ "--slider-thumb-border": px(component.slider.thumbBorderWidth),
873
+ // Component: Tooltip
874
+ "--tooltip-simple-px": rem(component.tooltip.simple.paddingX),
875
+ "--tooltip-simple-py": rem(component.tooltip.simple.paddingY),
876
+ "--tooltip-simple-font-size": rem(component.tooltip.simple.fontSize),
877
+ "--tooltip-simple-radius": px(component.tooltip.simple.borderRadius),
878
+ "--tooltip-rich-px": rem(component.tooltip.rich.paddingX),
879
+ "--tooltip-rich-py": rem(component.tooltip.rich.paddingY),
880
+ "--tooltip-rich-max-width": px(component.tooltip.rich.maxWidth),
881
+ "--tooltip-rich-radius": px(component.tooltip.rich.borderRadius),
882
+ // Component: Avatar
883
+ "--avatar-sm": px(component.avatar.sm.size),
884
+ "--avatar-md": px(component.avatar.md.size),
885
+ "--avatar-lg": px(component.avatar.lg.size),
886
+ "--avatar-xl": px(component.avatar.xl.size),
887
+ "--avatar-status-dot": px(component.avatar.statusDot),
888
+ "--avatar-status-border": px(component.avatar.statusBorder),
889
+ // Component: Divider
890
+ "--divider-thickness": px(component.divider.thickness),
891
+ "--divider-thick": px(component.divider.thickThickness),
892
+ "--divider-inset-margin": px(component.divider.insetMargin),
893
+ "--divider-label-size": rem(component.divider.labelSize),
894
+ // Component: Progress
895
+ "--progress-height": px(component.progress.linear.height),
896
+ "--progress-radius": px(component.progress.linear.borderRadius),
897
+ "--progress-circular-stroke": px(component.progress.circular.strokeWidth),
898
+ "--progress-circular-text": rem(component.progress.circular.textSize),
899
+ // Component: Snackbar
900
+ "--snackbar-radius": px(component.snackbar.borderRadius),
901
+ "--snackbar-gap": rem(component.snackbar.gap),
902
+ "--snackbar-icon-size": px(component.snackbar.iconSize),
903
+ "--snackbar-message-size": rem(component.snackbar.messageSize),
904
+ "--snackbar-action-px": rem(component.snackbar.actionPaddingX),
905
+ "--snackbar-action-py": rem(component.snackbar.actionPaddingY),
906
+ "--snackbar-action-radius": px(component.snackbar.actionRadius),
907
+ "--snackbar-action-size": rem(component.snackbar.actionSize),
908
+ // Component: Dialog
909
+ "--dialog-width": px(component.dialog.width),
910
+ "--dialog-radius": px(component.dialog.borderRadius),
911
+ "--dialog-header-px": rem(component.dialog.headerPaddingX),
912
+ "--dialog-header-py": rem(component.dialog.headerPaddingY),
913
+ "--dialog-footer-px": rem(component.dialog.footerPaddingX),
914
+ "--dialog-footer-py": rem(component.dialog.footerPaddingY),
915
+ "--dialog-title-size": rem(component.dialog.titleSize),
916
+ "--dialog-desc-size": rem(component.dialog.descSize),
917
+ "--dialog-footer-gap": rem(component.dialog.footerGap),
918
+ // Component: AnimatedToggle
919
+ "--toggle-size": px(component.animatedToggle.size),
920
+ "--toggle-radius": px(component.animatedToggle.borderRadius),
921
+ "--toggle-icon-size": px(component.animatedToggle.iconSize)
922
+ };
923
+ }
924
+ function generateCSSBlock(mode) {
925
+ const vars = generateCSSVariables(mode);
926
+ return Object.entries(vars).map(([key, value]) => ` ${key}: ${value};`).join("\n");
927
+ }
928
+ function generateKeyframes() {
929
+ const { keyframes } = motion;
930
+ return Object.entries(keyframes).map(([name, frames]) => {
931
+ const kebab = name.replace(/([A-Z])/g, "-$1").toLowerCase();
932
+ const body = Object.entries(frames).map(([key, props]) => {
933
+ const cssProps = Object.entries(props).map(([p, v]) => ` ${p.replace(/([A-Z])/g, "-$1").toLowerCase()}: ${v};`).join("\n");
934
+ return ` ${key} {
935
+ ${cssProps}
936
+ }`;
937
+ }).join("\n");
938
+ return `@keyframes ${kebab} {
939
+ ${body}
940
+ }`;
941
+ }).join("\n\n");
942
+ }
943
+
944
+ exports.generateCSSBlock = generateCSSBlock;
945
+ exports.generateCSSVariables = generateCSSVariables;
946
+ exports.generateKeyframes = generateKeyframes;