@xex/tokens 0.1.0 → 0.2.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 (2) hide show
  1. package/dist/styles.css +126 -247
  2. package/package.json +2 -2
package/dist/styles.css CHANGED
@@ -1,19 +1,17 @@
1
1
  /* Generated by scripts/gen-css.mjs — do not edit. Compiled to dist/styles.css at build time. */
2
2
 
3
3
  /* ------------------------------------------------------------------ *
4
- * Brand overrides (runtime theming)
4
+ * Tokens
5
5
  *
6
- * Tailwind compiles bg-brand-600 etc. at build time; relying on the
7
- * compiled output to repaint when --brand-* changes is not reliable
8
- * across every build setup. These plain-CSS rules use !important to
9
- * re-declare the brand utilities we use as direct var() lookups, so a
10
- * theme switch repaints immediately wherever this file is loaded.
11
- * Only add a utility here if you use it. (Opacity modifiers such as
12
- * bg-brand-600/50 are not supported by var() colors.)
6
+ * --brand-* is written onto <html> at runtime by <ThemeProvider> (the fallback below is Classic,
7
+ * so the first paint is never unstyled).
8
+ * --gray-* the Tailwind gray scale is remapped to these (see @xex/tailwind-preset), so every
9
+ * gray-* utility flips automatically in dark mode.
10
+ * the rest semantic names used by components: surface, canvas, accent*, and the status tones
11
+ * danger / success / warning / info / purple (solid, -soft, -line, -ink).
13
12
  * ------------------------------------------------------------------ */
14
13
 
15
14
  :root {
16
- /* Fallback = Classic, so the first paint is never unstyled. */
17
15
  --brand-50: #eff6ff;
18
16
  --brand-100: #dbeafe;
19
17
  --brand-200: #bfdbfe;
@@ -25,8 +23,101 @@
25
23
  --brand-800: #1e40af;
26
24
  --brand-900: #1e3a8a;
27
25
  --font-sans: Inter, ui-sans-serif, system-ui, sans-serif;
26
+ --gray-50: #f9fafb;
27
+ --gray-100: #f3f4f6;
28
+ --gray-200: #e5e7eb;
29
+ --gray-300: #d1d5db;
30
+ --gray-400: #9ca3af;
31
+ --gray-500: #6b7280;
32
+ --gray-600: #4b5563;
33
+ --gray-700: #374151;
34
+ --gray-800: #1f2937;
35
+ --gray-900: #111827;
36
+ --canvas: var(--gray-50);
37
+ --surface: #ffffff;
38
+ --accent: var(--brand-700);
39
+ /* text and icons in the brand colour (AA on accent-soft/softer in every theme) */
40
+ --accent-strong: var(--brand-800);
41
+ --accent-soft: var(--brand-50);
42
+ /* tinted backgrounds */
43
+ --accent-softer: var(--brand-100);
44
+ --accent-line: var(--brand-200);
45
+ /* tinted borders and rings */
46
+ --danger: #ef4444;
47
+ --danger-soft: #fee2e2;
48
+ --danger-line: #fecaca;
49
+ --danger-ink: #b91c1c;
50
+ --success: #10b981;
51
+ --success-soft: #d1fae5;
52
+ --success-line: #a7f3d0;
53
+ --success-ink: #047857;
54
+ --warning: #f59e0b;
55
+ --warning-soft: #fef3c7;
56
+ --warning-line: #fde68a;
57
+ --warning-ink: #b45309;
58
+ --info: #0ea5e9;
59
+ --info-soft: #e0f2fe;
60
+ --info-line: #bae6fd;
61
+ --info-ink: #0369a1;
62
+ --purple: #a855f7;
63
+ --purple-soft: #f3e8ff;
64
+ --purple-line: #e9d5ff;
65
+ --purple-ink: #7e22ce;
66
+ --ring-track: #e5e7eb;
67
+ --overlay: rgb(255 255 255 / 0.65);
68
+ }
69
+
70
+ html[data-mode='dark'] {
71
+ color-scheme: dark;
72
+ --gray-50: #1a2138;
73
+ --gray-100: #222a45;
74
+ --gray-200: #2c3454;
75
+ --gray-300: #3a4468;
76
+ --gray-400: #7d88a8;
77
+ --gray-500: #8d97b3;
78
+ --gray-600: #b4bcd0;
79
+ --gray-700: #cbd2e1;
80
+ --gray-800: #e5e7eb;
81
+ --gray-900: #f3f4f6;
82
+ --canvas: #0b1020;
83
+ --surface: #141a2e;
84
+ --accent: var(--brand-300);
85
+ --accent-strong: var(--brand-200);
86
+ --accent-soft: color-mix(in srgb, var(--brand-500) 16%, #0b1020);
87
+ --accent-softer: color-mix(in srgb, var(--brand-500) 26%, #0b1020);
88
+ --accent-line: color-mix(in srgb, var(--brand-500) 40%, #0b1020);
89
+ --danger-soft: #4a1a22;
90
+ --danger-line: #7f1d1d;
91
+ --danger-ink: #fca5a5;
92
+ --success-soft: #0c3a2c;
93
+ --success-line: #14532d;
94
+ --success-ink: #6ee7b7;
95
+ --warning-soft: #4a3410;
96
+ --warning-line: #78350f;
97
+ --warning-ink: #fcd34d;
98
+ --info-soft: #0c3350;
99
+ --info-line: #075985;
100
+ --info-ink: #7dd3fc;
101
+ --purple-soft: #3a1f5a;
102
+ --purple-line: #581c87;
103
+ --purple-ink: #d8b4fe;
104
+ --ring-track: #2a3352;
105
+ --overlay: rgb(20 26 46 / 0.65);
28
106
  }
29
107
 
108
+ /* ------------------------------------------------------------------ *
109
+ * Brand overrides (runtime theming)
110
+ *
111
+ * Tailwind compiles bg-brand-600 etc. at build time; relying on the
112
+ * compiled output to repaint when --brand-* changes is not reliable
113
+ * across every build setup. These plain-CSS rules use !important to
114
+ * re-declare the brand utilities we use as direct var() lookups, so a
115
+ * theme switch repaints immediately wherever this file is loaded.
116
+ * They are the SOLID brand colours: for tinted backgrounds, accent text
117
+ * and borders that must adapt to dark mode use the accent-* tokens.
118
+ * (Opacity modifiers such as bg-brand-600/50 are not supported by var() colors.)
119
+ * ------------------------------------------------------------------ */
120
+
30
121
  .bg-brand-50 {
31
122
  background-color: var(--brand-50) !important;
32
123
  }
@@ -208,18 +299,11 @@
208
299
  * ------------------------------------------------------------------ */
209
300
 
210
301
  body {
211
- --tw-bg-opacity: 1;
212
- background-color: rgb(249 250 251 / var(--tw-bg-opacity, 1));
213
302
  font-family: var(--font-sans), Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, sans-serif;
214
- --tw-text-opacity: 1;
215
- color: rgb(17 24 39 / var(--tw-text-opacity, 1));
216
303
  -webkit-font-smoothing: antialiased;
217
304
  -moz-osx-font-smoothing: grayscale;
218
- }
219
-
220
- html[data-mode='dark'] body {
221
- background-color: #1a2138;
222
- color: #f3f4f6;
305
+ background-color: var(--canvas);
306
+ color: var(--gray-900);
223
307
  }
224
308
 
225
309
  input[type='checkbox'], input[type='radio'], input[type='range'] {
@@ -241,20 +325,13 @@ input[type='checkbox'], input[type='radio'], input[type='range'] {
241
325
  .card {
242
326
  border-radius: 0.75rem;
243
327
  border-width: 1px;
244
- --tw-border-opacity: 1;
245
- border-color: rgb(229 231 235 / var(--tw-border-opacity, 1));
246
- --tw-bg-opacity: 1;
247
- background-color: rgb(255 255 255 / var(--tw-bg-opacity, 1));
328
+ border-color: var(--gray-200);
329
+ background-color: var(--surface);
248
330
  --tw-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
249
331
  --tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);
250
332
  box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
251
333
  }
252
334
 
253
- html[data-mode='dark'] .card {
254
- background-color: #141a2e;
255
- border-color: #2a3352;
256
- }
257
-
258
335
  .nav-item-active {
259
336
  display: flex;
260
337
  align-items: center;
@@ -284,61 +361,50 @@ html[data-mode='dark'] .card {
284
361
  font-size: 0.875rem;
285
362
  line-height: 1.25rem;
286
363
  font-weight: 500;
287
- --tw-text-opacity: 1;
288
- color: rgb(75 85 99 / var(--tw-text-opacity, 1));
364
+ color: var(--gray-600);
289
365
  transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;
290
366
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
291
367
  transition-duration: 150ms;
292
368
  }
293
369
 
294
- html[data-mode='dark'] .nav-item-inactive:hover {
295
- background-color: #222a45;
296
- }
297
-
298
- html[data-mode='dark'] .nav-item-inactive {
299
- color: #cbd2e1;
300
- }
301
-
302
370
  .nav-item-inactive:hover {
303
- --tw-bg-opacity: 1;
304
- background-color: rgb(243 244 246 / var(--tw-bg-opacity, 1));
305
- --tw-text-opacity: 1;
306
- color: rgb(17 24 39 / var(--tw-text-opacity, 1));
371
+ background-color: var(--gray-100);
372
+ color: var(--gray-900);
307
373
  }
308
374
 
309
375
  .stat-indigo {
310
376
  border-width: 1px;
311
- background-color: var(--brand-50);
312
- color: var(--brand-700);
313
- border-color: var(--brand-200);
377
+ background-color: var(--accent-soft);
378
+ color: var(--accent);
379
+ border-color: var(--accent-line);
314
380
  }
315
381
 
316
382
  .stat-emerald {
317
383
  border-width: 1px;
318
- background-color: #ecfdf5;
319
- color: #047857;
320
- border-color: #a7f3d0;
384
+ background-color: var(--success-soft);
385
+ color: var(--success-ink);
386
+ border-color: var(--success-line);
321
387
  }
322
388
 
323
389
  .stat-amber {
324
390
  border-width: 1px;
325
- background-color: #fffbeb;
326
- color: #b45309;
327
- border-color: #fde68a;
391
+ background-color: var(--warning-soft);
392
+ color: var(--warning-ink);
393
+ border-color: var(--warning-line);
328
394
  }
329
395
 
330
396
  .stat-rose {
331
397
  border-width: 1px;
332
- background-color: #fff1f2;
333
- color: #be123c;
334
- border-color: #fecdd3;
398
+ background-color: var(--danger-soft);
399
+ color: var(--danger-ink);
400
+ border-color: var(--danger-line);
335
401
  }
336
402
 
337
403
  .stat-sky {
338
404
  border-width: 1px;
339
- background-color: #f0f9ff;
340
- color: #0369a1;
341
- border-color: #bae6fd;
405
+ background-color: var(--info-soft);
406
+ color: var(--info-ink);
407
+ border-color: var(--info-line);
342
408
  }
343
409
 
344
410
  .weight-pill {
@@ -347,8 +413,7 @@ html[data-mode='dark'] .card {
347
413
  align-items: center;
348
414
  justify-content: center;
349
415
  border-radius: 0.375rem;
350
- --tw-bg-opacity: 1;
351
- background-color: rgb(243 244 246 / var(--tw-bg-opacity, 1));
416
+ background-color: var(--gray-100);
352
417
  padding-left: 0.375rem;
353
418
  padding-right: 0.375rem;
354
419
  padding-top: 0.125rem;
@@ -358,13 +423,7 @@ html[data-mode='dark'] .card {
358
423
  font-weight: 600;
359
424
  --tw-numeric-spacing: tabular-nums;
360
425
  font-variant-numeric: var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction);
361
- --tw-text-opacity: 1;
362
- color: rgb(55 65 81 / var(--tw-text-opacity, 1));
363
- }
364
-
365
- html[data-mode='dark'] .weight-pill {
366
- background-color: #222a45;
367
- color: #cbd2e1;
426
+ color: var(--gray-700);
368
427
  }
369
428
 
370
429
  /* LoadingDots */
@@ -420,11 +479,11 @@ html[data-mode='dark'] .weight-pill {
420
479
  }
421
480
 
422
481
  .xex-ring-track {
423
- stroke: #e5e7eb;
482
+ stroke: var(--ring-track);
424
483
  }
425
484
 
426
485
  .xex-overlay {
427
- background-color: rgb(255 255 255 / 0.65);
486
+ background-color: var(--overlay);
428
487
  }
429
488
 
430
489
  @media (prefers-reduced-motion: reduce) {
@@ -440,183 +499,3 @@ html[data-mode='dark'] .weight-pill {
440
499
  opacity: 0.5;
441
500
  }
442
501
  }
443
-
444
- /* ------------------------------------------------------------------ *
445
- * Dark mode (per theme): remap neutral surfaces + soften brand tints.
446
- * Driven by <html data-mode="dark">, set by ThemeProvider.
447
- * ------------------------------------------------------------------ */
448
-
449
- html[data-mode='dark'] body {
450
- background-color: #0b1020;
451
- color: #e5e7eb;
452
- }
453
-
454
- html[data-mode='dark'] .bg-white {
455
- background-color: #141a2e !important;
456
- }
457
-
458
- html[data-mode='dark'] .xex-ring-track {
459
- stroke: #2a3352;
460
- }
461
-
462
- html[data-mode='dark'] .xex-overlay {
463
- background-color: rgb(20 26 46 / 0.65);
464
- }
465
-
466
- html[data-mode='dark'] .group:focus-visible .group-focus-visible\:ring-offset-white {
467
- --tw-ring-offset-color: #141a2e;
468
- }
469
-
470
- html[data-mode='dark'] .bg-gray-50, html[data-mode='dark'] .hover\:bg-gray-50:hover {
471
- background-color: #1a2138 !important;
472
- }
473
-
474
- html[data-mode='dark'] .bg-gray-100, html[data-mode='dark'] .hover\:bg-gray-100:hover, html[data-mode='dark'] .weight-pill {
475
- background-color: #222a45 !important;
476
- }
477
-
478
- html[data-mode='dark'] .bg-gray-200 {
479
- background-color: #323b5c !important;
480
- }
481
-
482
- html[data-mode='dark'] .border-gray-100 {
483
- border-color: #1f2740 !important;
484
- }
485
-
486
- html[data-mode='dark'] .border-gray-200 {
487
- border-color: #2a3352 !important;
488
- }
489
-
490
- html[data-mode='dark'] .border-gray-300 {
491
- border-color: #3a4468 !important;
492
- }
493
-
494
- html[data-mode='dark'] .text-gray-900, html[data-mode='dark'] .text-gray-800 {
495
- color: #f3f4f6 !important;
496
- }
497
-
498
- html[data-mode='dark'] .text-gray-700, html[data-mode='dark'] .text-gray-600, html[data-mode='dark'] .weight-pill {
499
- color: #cbd2e1 !important;
500
- }
501
-
502
- html[data-mode='dark'] .text-gray-500, html[data-mode='dark'] .text-gray-400 {
503
- color: #8d97b3 !important;
504
- }
505
-
506
- html[data-mode='dark'] .bg-brand-50, html[data-mode='dark'] .hover\:bg-brand-50:hover {
507
- background-color: color-mix(in srgb, var(--brand-500) 16%, #0b1020) !important;
508
- }
509
-
510
- html[data-mode='dark'] .bg-brand-100 {
511
- background-color: color-mix(in srgb, var(--brand-500) 26%, #0b1020) !important;
512
- }
513
-
514
- html[data-mode='dark'] .text-brand-600, html[data-mode='dark'] .text-brand-700, html[data-mode='dark'] .text-brand-800 {
515
- color: var(--brand-300) !important;
516
- }
517
-
518
- html[data-mode='dark'] .border-brand-200 {
519
- border-color: color-mix(in srgb, var(--brand-500) 40%, #0b1020) !important;
520
- }
521
-
522
- html[data-mode='dark'] .from-brand-50 {
523
- --tw-gradient-from: color-mix(in srgb, var(--brand-500) 16%, #0b1020) !important;
524
- }
525
-
526
- html[data-mode='dark'] .from-brand-100 {
527
- --tw-gradient-from: color-mix(in srgb, var(--brand-500) 26%, #0b1020) !important;
528
- }
529
-
530
- html[data-mode='dark'] .to-brand-100 {
531
- --tw-gradient-to: color-mix(in srgb, var(--brand-500) 30%, #0b1020) !important;
532
- }
533
-
534
- html[data-mode='dark'] .ring-brand-200 {
535
- --tw-ring-color: color-mix(in srgb, var(--brand-500) 40%, #0b1020) !important;
536
- }
537
-
538
- html[data-mode='dark'] .stat-indigo {
539
- background-color: color-mix(in srgb, var(--brand-500) 16%, #0b1020);
540
- color: var(--brand-300);
541
- border-color: color-mix(in srgb, var(--brand-500) 40%, #0b1020);
542
- }
543
-
544
- html[data-mode='dark'] .bg-red-50 {
545
- background-color: #3a1620 !important;
546
- }
547
-
548
- html[data-mode='dark'] .border-red-200 {
549
- border-color: #7f1d1d !important;
550
- }
551
-
552
- html[data-mode='dark'] .text-red-600, html[data-mode='dark'] .text-red-700, html[data-mode='dark'] .text-red-800 {
553
- color: #fca5a5 !important;
554
- }
555
-
556
- html[data-mode='dark'] .bg-emerald-100 {
557
- background-color: #0c3a2c !important;
558
- }
559
-
560
- html[data-mode='dark'] .text-emerald-700 {
561
- color: #6ee7b7 !important;
562
- }
563
-
564
- html[data-mode='dark'] .bg-amber-100 {
565
- background-color: #4a3410 !important;
566
- }
567
-
568
- html[data-mode='dark'] .text-amber-700 {
569
- color: #fcd34d !important;
570
- }
571
-
572
- html[data-mode='dark'] .bg-red-100 {
573
- background-color: #4a1a22 !important;
574
- }
575
-
576
- html[data-mode='dark'] .bg-sky-100 {
577
- background-color: #0c3350 !important;
578
- }
579
-
580
- html[data-mode='dark'] .text-sky-700 {
581
- color: #7dd3fc !important;
582
- }
583
-
584
- html[data-mode='dark'] .bg-purple-100 {
585
- background-color: #3a1f5a !important;
586
- }
587
-
588
- html[data-mode='dark'] .text-purple-700 {
589
- color: #d8b4fe !important;
590
- }
591
-
592
- html[data-mode='dark'] .stat-emerald {
593
- background-color: #0c2f25;
594
- color: #6ee7b7;
595
- border-color: #14532d;
596
- }
597
-
598
- html[data-mode='dark'] .stat-amber {
599
- background-color: #3a2a0c;
600
- color: #fcd34d;
601
- border-color: #78350f;
602
- }
603
-
604
- html[data-mode='dark'] .stat-rose {
605
- background-color: #3a1420;
606
- color: #fda4af;
607
- border-color: #881337;
608
- }
609
-
610
- html[data-mode='dark'] .stat-sky {
611
- background-color: #0c2a40;
612
- color: #7dd3fc;
613
- border-color: #075985;
614
- }
615
-
616
- html[data-mode='dark'] input::-moz-placeholder, html[data-mode='dark'] textarea::-moz-placeholder {
617
- color: #6b7592;
618
- }
619
-
620
- html[data-mode='dark'] input::placeholder, html[data-mode='dark'] textarea::placeholder {
621
- color: #6b7592;
622
- }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xex/tokens",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "XeX design tokens: colour themes, font helpers and the shared stylesheet.",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -48,7 +48,7 @@
48
48
  "typecheck": "tsc --noEmit"
49
49
  },
50
50
  "devDependencies": {
51
- "@xex/tailwind-preset": "^0.1.0",
51
+ "@xex/tailwind-preset": "^0.2.0",
52
52
  "tailwindcss": "^3.4.17",
53
53
  "tsup": "^8.3.5",
54
54
  "typescript": "^5.7.2"