@eluan/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.
package/dist/index.js ADDED
@@ -0,0 +1,568 @@
1
+ // Eluan Design System - Token Exports
2
+ // Three-layer architecture: Primitives → Modes → Themes
3
+ // For CSS variable usage, import "@eluan/tokens/css"
4
+ // ============================================
5
+ // Available Modes
6
+ // ============================================
7
+ export const modes = ["light", "dim", "dark"];
8
+ // ============================================
9
+ // Available Themes
10
+ // ============================================
11
+ export const themes = [
12
+ "industrial-retro",
13
+ "minimal",
14
+ ];
15
+ // ============================================
16
+ // Available Spacing Scales
17
+ // ============================================
18
+ export const spacingScales = ["compact", "standard", "wide"];
19
+ // ============================================
20
+ // Available Curve Scales
21
+ // ============================================
22
+ export const curveScales = ["sharp", "slight", "sweeping"];
23
+ // ============================================
24
+ // Color Palette Names
25
+ // ============================================
26
+ export const colorPalettes = [
27
+ "blazeorange",
28
+ "bluechill",
29
+ "blueribbon",
30
+ "bostonblue",
31
+ "cerise",
32
+ "crimson",
33
+ "electriclime",
34
+ "electricviolet",
35
+ "forestgreen",
36
+ "gossamer",
37
+ "lochmara",
38
+ "maitai",
39
+ "mono",
40
+ "purpleheart",
41
+ "redviolet",
42
+ "rockspray",
43
+ "seagreen",
44
+ "teak",
45
+ "torchred",
46
+ "violeteggplant",
47
+ ];
48
+ // ============================================
49
+ // Color Shade Scale
50
+ // ============================================
51
+ export const colorShades = [
52
+ "50",
53
+ "100",
54
+ "200",
55
+ "300",
56
+ "400",
57
+ "500",
58
+ "600",
59
+ "700",
60
+ "800",
61
+ "900",
62
+ "950",
63
+ ];
64
+ // Mono has an extra "0" shade for pure white
65
+ export const monoShades = ["0", ...colorShades];
66
+ // ============================================
67
+ // Primitive Color Values (Layer 1)
68
+ // Hex values for cross-platform usage (native, etc.)
69
+ // ============================================
70
+ export const primitiveColors = {
71
+ blazeorange: {
72
+ 50: "#fff6ed",
73
+ 100: "#ffead3",
74
+ 200: "#ffd1a7",
75
+ 300: "#ffaf69",
76
+ 400: "#ff7900",
77
+ 500: "#ff5100",
78
+ 600: "#fd2900",
79
+ 700: "#d11600",
80
+ 800: "#a61a00",
81
+ 900: "#842007",
82
+ 950: "#470d04",
83
+ },
84
+ bluechill: {
85
+ 50: "#edfefd",
86
+ 100: "#cbfbfa",
87
+ 200: "#99f6f5",
88
+ 300: "#3decef",
89
+ 400: "#00d6e0",
90
+ 500: "#00bbc9",
91
+ 600: "#0096a9",
92
+ 700: "#007888",
93
+ 800: "#00606e",
94
+ 900: "#00505c",
95
+ 950: "#00333d",
96
+ },
97
+ blueribbon: {
98
+ 50: "#eff6ff",
99
+ 100: "#dbeaff",
100
+ 200: "#bedaff",
101
+ 300: "#8dc4ff",
102
+ 400: "#529fff",
103
+ 500: "#317aff",
104
+ 600: "#2355ff",
105
+ 700: "#213eef",
106
+ 800: "#2135bf",
107
+ 900: "#1f3593",
108
+ 950: "#182258",
109
+ },
110
+ bostonblue: {
111
+ 50: "#ecfdff",
112
+ 100: "#d2f8ff",
113
+ 200: "#a6f0ff",
114
+ 300: "#57e4ff",
115
+ 400: "#00cdfa",
116
+ 500: "#00b4e5",
117
+ 600: "#008fc2",
118
+ 700: "#00729c",
119
+ 800: "#005d7e",
120
+ 900: "#0a4d69",
121
+ 950: "#043247",
122
+ },
123
+ cerise: {
124
+ 50: "#fdf2f6",
125
+ 100: "#fce7ef",
126
+ 200: "#fbcfe0",
127
+ 300: "#fba7c7",
128
+ 400: "#f76da2",
129
+ 500: "#f14285",
130
+ 600: "#df2066",
131
+ 700: "#bf1751",
132
+ 800: "#9d1945",
133
+ 900: "#821d3e",
134
+ 950: "#4d0c20",
135
+ },
136
+ crimson: {
137
+ 50: "#fdf2f2",
138
+ 100: "#fde3e4",
139
+ 200: "#fcccce",
140
+ 300: "#fca5a9",
141
+ 400: "#f96c74",
142
+ 500: "#f33f4b",
143
+ 600: "#df1d30",
144
+ 700: "#bb1727",
145
+ 800: "#9a1b26",
146
+ 900: "#7f1f27",
147
+ 950: "#450c10",
148
+ },
149
+ electriclime: {
150
+ 50: "#f9fee2",
151
+ 100: "#f1fcbf",
152
+ 200: "#e2f87e",
153
+ 300: "#ccf100",
154
+ 400: "#b3e200",
155
+ 500: "#98cb00",
156
+ 600: "#79a200",
157
+ 700: "#5e7a00",
158
+ 800: "#4d6100",
159
+ 900: "#425100",
160
+ 950: "#222d00",
161
+ },
162
+ electricviolet: {
163
+ 50: "#f9f5ff",
164
+ 100: "#f2e8fe",
165
+ 200: "#e7d5ff",
166
+ 300: "#d7b4ff",
167
+ 400: "#bd7fff",
168
+ 500: "#a750ff",
169
+ 600: "#9329f4",
170
+ 700: "#7d1ad5",
171
+ 800: "#6a1eac",
172
+ 900: "#561d88",
173
+ 950: "#390b63",
174
+ },
175
+ forestgreen: {
176
+ 50: "#eeffec",
177
+ 100: "#d6ffd5",
178
+ 200: "#adffad",
179
+ 300: "#60fd6a",
180
+ 400: "#00ed00",
181
+ 500: "#00d500",
182
+ 600: "#00ae00",
183
+ 700: "#008700",
184
+ 800: "#006a00",
185
+ 900: "#005806",
186
+ 950: "#003102",
187
+ },
188
+ gossamer: {
189
+ 50: "#effefa",
190
+ 100: "#c5fdf1",
191
+ 200: "#87fae4",
192
+ 300: "#00f0d5",
193
+ 400: "#00d9be",
194
+ 500: "#00bea8",
195
+ 600: "#00998a",
196
+ 700: "#007a70",
197
+ 800: "#00615b",
198
+ 900: "#00504b",
199
+ 950: "#00302f",
200
+ },
201
+ lochmara: {
202
+ 50: "#f0f9ff",
203
+ 100: "#def1ff",
204
+ 200: "#b8e5ff",
205
+ 300: "#77d2ff",
206
+ 400: "#00b8ff",
207
+ 500: "#00a0fb",
208
+ 600: "#007fdb",
209
+ 700: "#0066b4",
210
+ 800: "#005693",
211
+ 900: "#014877",
212
+ 950: "#072d4d",
213
+ },
214
+ maitai: {
215
+ 50: "#fefaef",
216
+ 100: "#fdf1d4",
217
+ 200: "#fbe1a6",
218
+ 300: "#f9cd75",
219
+ 400: "#f4b24b",
220
+ 500: "#ef973f",
221
+ 600: "#d57634",
222
+ 700: "#ae562c",
223
+ 800: "#8c4426",
224
+ 900: "#713923",
225
+ 950: "#3f1d0f",
226
+ },
227
+ mono: {
228
+ 0: "#ffffff",
229
+ 50: "#fafafa",
230
+ 100: "#f5f5f5",
231
+ 200: "#e5e5e5",
232
+ 300: "#d4d4d4",
233
+ 400: "#a1a1a1",
234
+ 500: "#737373",
235
+ 600: "#525252",
236
+ 700: "#404040",
237
+ 800: "#262626",
238
+ 900: "#171717",
239
+ 950: "#0a0a0a",
240
+ },
241
+ purpleheart: {
242
+ 50: "#f0f2ff",
243
+ 100: "#e4e7ff",
244
+ 200: "#ced2ff",
245
+ 300: "#aeb3ff",
246
+ 400: "#8b85ff",
247
+ 500: "#715aff",
248
+ 600: "#6032f9",
249
+ 700: "#5225dc",
250
+ 800: "#4324b2",
251
+ 900: "#3a278b",
252
+ 950: "#231854",
253
+ },
254
+ redviolet: {
255
+ 50: "#fcf4fe",
256
+ 100: "#fae8f6",
257
+ 200: "#f7d0ee",
258
+ 300: "#f5aae2",
259
+ 400: "#f06fcc",
260
+ 500: "#e944b7",
261
+ 600: "#d62098",
262
+ 700: "#b7177b",
263
+ 800: "#971965",
264
+ 900: "#7c1d55",
265
+ 950: "#4d0b32",
266
+ },
267
+ rockspray: {
268
+ 50: "#fff6ef",
269
+ 100: "#feebda",
270
+ 200: "#fdd584",
271
+ 300: "#fdb782",
272
+ 400: "#f88b4a",
273
+ 500: "#f66e31",
274
+ 600: "#e65527",
275
+ 700: "#bd4122",
276
+ 800: "#963621",
277
+ 900: "#78301f",
278
+ 950: "#40160e",
279
+ },
280
+ seagreen: {
281
+ 50: "#eafef4",
282
+ 100: "#ccfbe3",
283
+ 200: "#9cf6cd",
284
+ 300: "#44ecb2",
285
+ 400: "#00d88d",
286
+ 500: "#00c078",
287
+ 600: "#009b62",
288
+ 700: "#007c53",
289
+ 800: "#006243",
290
+ 900: "#00503a",
291
+ 950: "#002d22",
292
+ },
293
+ teak: {
294
+ 50: "#fcfbf3",
295
+ 100: "#f9f7e0",
296
+ 200: "#f6ecc2",
297
+ 300: "#eedda2",
298
+ 400: "#e0c787",
299
+ 500: "#ceaf78",
300
+ 600: "#ac8b5f",
301
+ 700: "#876747",
302
+ 800: "#6d503a",
303
+ 900: "#5a4231",
304
+ 950: "#332319",
305
+ },
306
+ torchred: {
307
+ 50: "#fff1f1",
308
+ 100: "#ffe0e0",
309
+ 200: "#ffc5c5",
310
+ 300: "#ff999a",
311
+ 400: "#ff4855",
312
+ 500: "#ff0000",
313
+ 600: "#fd0000",
314
+ 700: "#d30000",
315
+ 800: "#ad0000",
316
+ 900: "#8e0002",
317
+ 950: "#4d0000",
318
+ },
319
+ violeteggplant: {
320
+ 50: "#fcf4fe",
321
+ 100: "#f9e9fd",
322
+ 200: "#f3d2fa",
323
+ 300: "#eeadf9",
324
+ 400: "#e578f5",
325
+ 500: "#d84aec",
326
+ 600: "#bf2bd0",
327
+ 700: "#a024ac",
328
+ 800: "#84218b",
329
+ 900: "#6d2271",
330
+ 950: "#470d4a",
331
+ },
332
+ };
333
+ // ============================================
334
+ // Radius Tokens (Layer 1)
335
+ // ============================================
336
+ export const radius = {
337
+ none: "0rem",
338
+ 1: "0.0625rem",
339
+ 2: "0.125rem",
340
+ 4: "0.25rem",
341
+ 8: "0.5rem",
342
+ 12: "0.75rem",
343
+ 16: "1rem",
344
+ 20: "1.25rem",
345
+ 24: "1.5rem",
346
+ 32: "2rem",
347
+ 40: "2.5rem",
348
+ 80: "5rem",
349
+ full: "62.4375rem",
350
+ };
351
+ // ============================================
352
+ // Sizing Tokens (Layer 1)
353
+ // ============================================
354
+ export const sizing = {
355
+ none: "0rem",
356
+ xxs: "0.5rem",
357
+ xs: "1rem",
358
+ s: "1.5rem",
359
+ m: "2rem",
360
+ l: "2.5rem",
361
+ xl: "3rem",
362
+ xxl: "5rem",
363
+ xxxl: "10rem",
364
+ };
365
+ // ============================================
366
+ // Spacing Tokens (Layer 1)
367
+ // ============================================
368
+ export const spacing = {
369
+ 0: "0rem",
370
+ 2: "0.125rem",
371
+ 4: "0.25rem",
372
+ 8: "0.5rem",
373
+ 12: "0.75rem",
374
+ 16: "1rem",
375
+ 20: "1.25rem",
376
+ 24: "1.5rem",
377
+ 32: "2rem",
378
+ 40: "2.5rem",
379
+ 48: "3rem",
380
+ 56: "3.5rem",
381
+ 64: "4rem",
382
+ 72: "4.5rem",
383
+ 80: "5rem",
384
+ 88: "5.5rem",
385
+ 96: "6rem",
386
+ 104: "6.5rem",
387
+ 112: "7rem",
388
+ 120: "7.5rem",
389
+ 144: "9rem",
390
+ 160: "10rem",
391
+ 240: "15rem",
392
+ 320: "20rem",
393
+ };
394
+ // ============================================
395
+ // Viewport Tokens (Layer 1)
396
+ // ============================================
397
+ export const viewports = {
398
+ xxs: "20rem",
399
+ xs: "25.875rem",
400
+ s: "30rem",
401
+ m: "46.75rem",
402
+ l: "64rem",
403
+ xl: "80rem",
404
+ "2xl": "90rem",
405
+ "3xl": "120rem",
406
+ "4xl": "161.25rem",
407
+ };
408
+ // ============================================
409
+ // Typography Tokens
410
+ // ============================================
411
+ export const fontSizes = {
412
+ xs: 12,
413
+ sm: 14,
414
+ base: 16,
415
+ lg: 18,
416
+ xl: 20,
417
+ "2xl": 24,
418
+ "3xl": 30,
419
+ "4xl": 36,
420
+ "5xl": 48,
421
+ "6xl": 60,
422
+ "7xl": 72,
423
+ "8xl": 96,
424
+ "9xl": 128,
425
+ };
426
+ export const fontWeights = {
427
+ thin: "100",
428
+ extralight: "200",
429
+ light: "300",
430
+ normal: "400",
431
+ medium: "500",
432
+ semibold: "600",
433
+ bold: "700",
434
+ extrabold: "800",
435
+ black: "900",
436
+ };
437
+ export const lineHeights = {
438
+ none: 1,
439
+ tight: 1.25,
440
+ snug: 1.375,
441
+ normal: 1.5,
442
+ relaxed: 1.625,
443
+ loose: 2,
444
+ };
445
+ export const letterSpacing = {
446
+ tighter: -0.8,
447
+ tight: -0.4,
448
+ normal: 0,
449
+ wide: 0.4,
450
+ wider: 0.8,
451
+ widest: 1.6,
452
+ };
453
+ export const fontFamilies = {
454
+ heading: "var(--font-heading)",
455
+ body: "var(--font-body)",
456
+ mono: "var(--font-mono)",
457
+ };
458
+ // ============================================
459
+ // Theme → Font Mapping (Google Fonts via @fontsource)
460
+ // ============================================
461
+ export const themeFonts = {
462
+ "industrial-retro": {
463
+ heading: "Geist",
464
+ body: "Geist",
465
+ },
466
+ "minimal": {
467
+ heading: "Inter",
468
+ body: "Inter",
469
+ },
470
+ };
471
+ // ============================================
472
+ // Dynamic Font Loader
473
+ // ============================================
474
+ // Loads theme-specific font CSS on demand via <link> injection.
475
+ // The consumer's bundler must resolve @eluan/tokens/fonts/* CSS.
476
+ //
477
+ // Usage (React example):
478
+ // useEffect(() => { loadThemeFonts(theme) }, [theme])
479
+ //
480
+ // Usage (vanilla):
481
+ // loadThemeFonts('bold')
482
+ const _loadedFonts = new Set();
483
+ /**
484
+ * Dynamically load the font CSS for a given theme.
485
+ * Fonts are loaded once and cached — switching back to a previously
486
+ * loaded theme is instant.
487
+ *
488
+ * Importing is handled via dynamic import() so the consumer's bundler
489
+ * (Vite, webpack, etc.) can code-split each theme's fonts into a
490
+ * separate chunk.
491
+ */
492
+ export async function loadThemeFonts(theme) {
493
+ if (_loadedFonts.has(theme))
494
+ return;
495
+ switch (theme) {
496
+ case "industrial-retro":
497
+ await import("@fontsource/geist/400.css");
498
+ await import("@fontsource/geist/500.css");
499
+ break;
500
+ case "minimal":
501
+ await import("@fontsource/inter/400.css");
502
+ await import("@fontsource/inter/500.css");
503
+ break;
504
+ }
505
+ _loadedFonts.add(theme);
506
+ }
507
+ // ============================================
508
+ // Shadow Tokens
509
+ // ============================================
510
+ export const shadows = {
511
+ sm: "0 1px 2px 0 rgb(0 0 0 / 0.05)",
512
+ default: "0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)",
513
+ md: "0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)",
514
+ lg: "0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)",
515
+ xl: "0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)",
516
+ "2xl": "0 25px 50px -12px rgb(0 0 0 / 0.25)",
517
+ inner: "inset 0 2px 4px 0 rgb(0 0 0 / 0.05)",
518
+ none: "0 0 #0000",
519
+ };
520
+ // ============================================
521
+ // Animation Tokens
522
+ // ============================================
523
+ export const durations = {
524
+ fastest: 50,
525
+ faster: 100,
526
+ fast: 150,
527
+ normal: 200,
528
+ slow: 300,
529
+ slower: 400,
530
+ slowest: 500,
531
+ };
532
+ export const easings = {
533
+ linear: "linear",
534
+ easeIn: "cubic-bezier(0.4, 0, 1, 1)",
535
+ easeOut: "cubic-bezier(0, 0, 0.2, 1)",
536
+ easeInOut: "cubic-bezier(0.4, 0, 0.2, 1)",
537
+ };
538
+ // ============================================
539
+ // Z-Index Tokens
540
+ // ============================================
541
+ export const zIndices = {
542
+ hide: -1,
543
+ base: 0,
544
+ docked: 10,
545
+ dropdown: 1000,
546
+ sticky: 1100,
547
+ banner: 1200,
548
+ overlay: 1300,
549
+ modal: 1400,
550
+ popover: 1500,
551
+ skipLink: 1600,
552
+ toast: 1700,
553
+ tooltip: 1800,
554
+ };
555
+ // ============================================
556
+ // Breakpoints (maps to viewport tokens)
557
+ // ============================================
558
+ export const breakpoints = {
559
+ xxs: 320,
560
+ xs: 414,
561
+ s: 480,
562
+ m: 748,
563
+ l: 1024,
564
+ xl: 1280,
565
+ "2xl": 1440,
566
+ "3xl": 1920,
567
+ "4xl": 2580,
568
+ };