@phcdevworks/spectre-tokens 2.8.0 → 3.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.
package/dist/index.cjs CHANGED
@@ -92,6 +92,61 @@ var coreTokens = {
92
92
  "starFilled": "{colors.warning.500}",
93
93
  "starEmpty": "{colors.neutral.200}",
94
94
  "text": "{colors.neutral.500}"
95
+ },
96
+ "nav": {
97
+ "bg": "{colors.white}",
98
+ "text": "{colors.neutral.900}",
99
+ "link": "{colors.neutral.700}",
100
+ "linkHover": "{colors.brand.600}",
101
+ "linkActive": "{colors.brand.700}",
102
+ "border": "{colors.neutral.200}"
103
+ },
104
+ "modal": {
105
+ "bg": "{colors.white}",
106
+ "shadow": "0 20px 48px -12px {colors.black} / 0.20",
107
+ "border": "{colors.neutral.200}",
108
+ "overlay": "{colors.black} / 0.6"
109
+ },
110
+ "toast": {
111
+ "success": {
112
+ "bg": "{colors.success.50}",
113
+ "text": "{colors.success.800}",
114
+ "border": "{colors.success.200}",
115
+ "icon": "{colors.success.600}"
116
+ },
117
+ "warning": {
118
+ "bg": "{colors.warning.50}",
119
+ "text": "{colors.warning.800}",
120
+ "border": "{colors.warning.200}",
121
+ "icon": "{colors.warning.600}"
122
+ },
123
+ "danger": {
124
+ "bg": "{colors.error.50}",
125
+ "text": "{colors.error.800}",
126
+ "border": "{colors.error.200}",
127
+ "icon": "{colors.error.600}"
128
+ },
129
+ "info": {
130
+ "bg": "{colors.info.50}",
131
+ "text": "{colors.info.800}",
132
+ "border": "{colors.info.200}",
133
+ "icon": "{colors.info.600}"
134
+ }
135
+ },
136
+ "tooltip": {
137
+ "bg": "{colors.neutral.900}",
138
+ "text": "{colors.white}",
139
+ "border": "{colors.neutral.700}"
140
+ },
141
+ "dropdown": {
142
+ "bg": "{colors.white}",
143
+ "border": "{colors.neutral.200}",
144
+ "item": {
145
+ "default": "transparent",
146
+ "hover": "{colors.neutral.100}",
147
+ "active": "{colors.info.50}",
148
+ "text": "{colors.neutral.900}"
149
+ }
95
150
  }
96
151
  },
97
152
  "buttons": {
@@ -209,8 +264,12 @@ var coreTokens = {
209
264
  "card": "{colors.white}",
210
265
  "input": "{colors.white}",
211
266
  "overlay": "{colors.black} / 0.6",
212
- "alternate": "{colors.neutral.100}",
213
- "hero": "linear-gradient(135deg, {colors.indigo.500} 0%, {colors.violet.600} 100%)"
267
+ "subtle": "{colors.neutral.100}",
268
+ "hero": "linear-gradient(135deg, {colors.indigo.500} 0%, {colors.violet.600} 100%)",
269
+ "hover": "{colors.neutral.100}",
270
+ "selected": "{colors.info.50}",
271
+ "active": "{colors.neutral.200}",
272
+ "divider": "{colors.neutral.200}"
214
273
  },
215
274
  "text": {
216
275
  "onPage": {
@@ -287,6 +346,61 @@ var coreTokens = {
287
346
  "starFilled": "{colors.warning.500}",
288
347
  "starEmpty": "{colors.neutral.200}",
289
348
  "text": "{colors.neutral.500}"
349
+ },
350
+ "nav": {
351
+ "bg": "{colors.white}",
352
+ "text": "{colors.neutral.900}",
353
+ "link": "{colors.neutral.700}",
354
+ "linkHover": "{colors.brand.600}",
355
+ "linkActive": "{colors.brand.700}",
356
+ "border": "{colors.neutral.200}"
357
+ },
358
+ "modal": {
359
+ "bg": "{colors.white}",
360
+ "shadow": "0 20px 48px -12px {colors.black} / 0.20",
361
+ "border": "{colors.neutral.200}",
362
+ "overlay": "{colors.black} / 0.6"
363
+ },
364
+ "toast": {
365
+ "success": {
366
+ "bg": "{colors.success.50}",
367
+ "text": "{colors.success.800}",
368
+ "border": "{colors.success.200}",
369
+ "icon": "{colors.success.600}"
370
+ },
371
+ "warning": {
372
+ "bg": "{colors.warning.50}",
373
+ "text": "{colors.warning.800}",
374
+ "border": "{colors.warning.200}",
375
+ "icon": "{colors.warning.600}"
376
+ },
377
+ "danger": {
378
+ "bg": "{colors.error.50}",
379
+ "text": "{colors.error.800}",
380
+ "border": "{colors.error.200}",
381
+ "icon": "{colors.error.600}"
382
+ },
383
+ "info": {
384
+ "bg": "{colors.info.50}",
385
+ "text": "{colors.info.800}",
386
+ "border": "{colors.info.200}",
387
+ "icon": "{colors.info.600}"
388
+ }
389
+ },
390
+ "tooltip": {
391
+ "bg": "{colors.neutral.900}",
392
+ "text": "{colors.white}",
393
+ "border": "{colors.neutral.700}"
394
+ },
395
+ "dropdown": {
396
+ "bg": "{colors.white}",
397
+ "border": "{colors.neutral.200}",
398
+ "item": {
399
+ "default": "transparent",
400
+ "hover": "{colors.neutral.100}",
401
+ "active": "{colors.info.50}",
402
+ "text": "{colors.neutral.900}"
403
+ }
290
404
  }
291
405
  }
292
406
  },
@@ -296,8 +410,12 @@ var coreTokens = {
296
410
  "card": "{colors.neutral.800}",
297
411
  "input": "{colors.neutral.700}",
298
412
  "overlay": "{colors.black} / 0.6",
299
- "alternate": "{colors.neutral.800}",
300
- "hero": "linear-gradient(135deg, {colors.accent.700} 0%, {colors.accent.900} 100%)"
413
+ "subtle": "{colors.neutral.800}",
414
+ "hero": "linear-gradient(135deg, {colors.accent.700} 0%, {colors.accent.900} 100%)",
415
+ "hover": "{colors.neutral.700}",
416
+ "selected": "{colors.info.900}",
417
+ "active": "{colors.neutral.600}",
418
+ "divider": "{colors.neutral.700}"
301
419
  },
302
420
  "text": {
303
421
  "onPage": {
@@ -377,6 +495,61 @@ var coreTokens = {
377
495
  "starFilled": "{colors.warning.400}",
378
496
  "starEmpty": "{colors.neutral.700}",
379
497
  "text": "{colors.neutral.400}"
498
+ },
499
+ "nav": {
500
+ "bg": "{colors.neutral.900}",
501
+ "text": "{colors.neutral.50}",
502
+ "link": "{colors.neutral.300}",
503
+ "linkHover": "{colors.brand.400}",
504
+ "linkActive": "{colors.brand.300}",
505
+ "border": "{colors.neutral.700}"
506
+ },
507
+ "modal": {
508
+ "bg": "{colors.neutral.800}",
509
+ "shadow": "0 20px 48px -12px {colors.black} / 0.20",
510
+ "border": "{colors.neutral.700}",
511
+ "overlay": "{colors.black} / 0.6"
512
+ },
513
+ "toast": {
514
+ "success": {
515
+ "bg": "{colors.success.900}",
516
+ "text": "{colors.success.100}",
517
+ "border": "{colors.success.700}",
518
+ "icon": "{colors.success.400}"
519
+ },
520
+ "warning": {
521
+ "bg": "{colors.warning.900}",
522
+ "text": "{colors.warning.100}",
523
+ "border": "{colors.warning.700}",
524
+ "icon": "{colors.warning.400}"
525
+ },
526
+ "danger": {
527
+ "bg": "{colors.error.900}",
528
+ "text": "{colors.error.100}",
529
+ "border": "{colors.error.700}",
530
+ "icon": "{colors.error.400}"
531
+ },
532
+ "info": {
533
+ "bg": "{colors.info.900}",
534
+ "text": "{colors.info.100}",
535
+ "border": "{colors.info.700}",
536
+ "icon": "{colors.info.400}"
537
+ }
538
+ },
539
+ "tooltip": {
540
+ "bg": "{colors.neutral.50}",
541
+ "text": "{colors.neutral.900}",
542
+ "border": "{colors.neutral.300}"
543
+ },
544
+ "dropdown": {
545
+ "bg": "{colors.neutral.800}",
546
+ "border": "{colors.neutral.700}",
547
+ "item": {
548
+ "default": "transparent",
549
+ "hover": "{colors.neutral.700}",
550
+ "active": "{colors.info.900}",
551
+ "text": "{colors.neutral.100}"
552
+ }
380
553
  }
381
554
  }
382
555
  }
@@ -543,6 +716,7 @@ var coreTokens = {
543
716
  },
544
717
  "transitions": {
545
718
  "duration": {
719
+ "reduced": "0.01ms",
546
720
  "instant": "75ms",
547
721
  "fast": "150ms",
548
722
  "base": "200ms",
@@ -602,6 +776,48 @@ var coreTokens = {
602
776
  "duration": "{transitions.duration.slowest}",
603
777
  "easing": "{transitions.easing.spring}",
604
778
  "keyframes": "pulse"
779
+ },
780
+ "reducedMotion": {
781
+ "fadeIn": {
782
+ "duration": "{transitions.duration.reduced}",
783
+ "easing": "{transitions.easing.linear}",
784
+ "keyframes": "fade-in"
785
+ },
786
+ "fadeOut": {
787
+ "duration": "{transitions.duration.reduced}",
788
+ "easing": "{transitions.easing.linear}",
789
+ "keyframes": "fade-out"
790
+ },
791
+ "slideUp": {
792
+ "duration": "{transitions.duration.reduced}",
793
+ "easing": "{transitions.easing.linear}",
794
+ "keyframes": "slide-up"
795
+ },
796
+ "slideDown": {
797
+ "duration": "{transitions.duration.reduced}",
798
+ "easing": "{transitions.easing.linear}",
799
+ "keyframes": "slide-down"
800
+ },
801
+ "scaleIn": {
802
+ "duration": "{transitions.duration.reduced}",
803
+ "easing": "{transitions.easing.linear}",
804
+ "keyframes": "scale-in"
805
+ },
806
+ "bounce": {
807
+ "duration": "{transitions.duration.reduced}",
808
+ "easing": "{transitions.easing.linear}",
809
+ "keyframes": "bounce"
810
+ },
811
+ "shake": {
812
+ "duration": "{transitions.duration.reduced}",
813
+ "easing": "{transitions.easing.linear}",
814
+ "keyframes": "shake"
815
+ },
816
+ "pulse": {
817
+ "duration": "{transitions.duration.reduced}",
818
+ "easing": "{transitions.easing.linear}",
819
+ "keyframes": "pulse"
820
+ }
605
821
  }
606
822
  },
607
823
  "opacity": {
@@ -637,6 +853,8 @@ var coreTokens = {
637
853
  "offset": "2px",
638
854
  "style": "solid"
639
855
  },
856
+ "reducedMotion": "{transitions.duration.reduced}",
857
+ "forcedColors": "auto",
640
858
  "minTouchTarget": "44px",
641
859
  "minTextSize": "16px"
642
860
  },
@@ -657,7 +875,17 @@ var coreTokens = {
657
875
  "page": "{colors.neutral.50}",
658
876
  "card": "{colors.white}",
659
877
  "input": "{colors.white}",
660
- "overlay": "{colors.black} / 0.6"
878
+ "overlay": "{colors.black} / 0.6",
879
+ "hover": "{colors.neutral.100}",
880
+ "selected": "{colors.info.50}",
881
+ "active": "{colors.neutral.200}",
882
+ "divider": "{colors.neutral.200}"
883
+ },
884
+ "link": {
885
+ "default": "{colors.brand.600}",
886
+ "hover": "{colors.brand.700}",
887
+ "active": "{colors.brand.800}",
888
+ "visited": "{colors.accent.700}"
661
889
  },
662
890
  "text": {
663
891
  "onPage": {
@@ -860,6 +1088,42 @@ var ICON_BOX_FIELDS = [
860
1088
  { name: "icon-warning", tokenKey: "iconWarning" },
861
1089
  { name: "icon-danger", tokenKey: "iconDanger" }
862
1090
  ];
1091
+ var NAV_FIELDS = [
1092
+ { name: "bg", tokenKey: "bg" },
1093
+ { name: "text", tokenKey: "text" },
1094
+ { name: "link", tokenKey: "link" },
1095
+ { name: "link-hover", tokenKey: "linkHover" },
1096
+ { name: "link-active", tokenKey: "linkActive" },
1097
+ { name: "border", tokenKey: "border" }
1098
+ ];
1099
+ var MODAL_FIELDS = [
1100
+ { name: "bg", tokenKey: "bg" },
1101
+ { name: "shadow", tokenKey: "shadow" },
1102
+ { name: "border", tokenKey: "border" },
1103
+ { name: "overlay", tokenKey: "overlay" }
1104
+ ];
1105
+ var TOAST_VARIANTS = ["success", "warning", "danger", "info"].map((variant) => ({
1106
+ variant,
1107
+ fields: [
1108
+ { name: "bg", tokenKey: "bg" },
1109
+ { name: "text", tokenKey: "text" },
1110
+ { name: "border", tokenKey: "border" },
1111
+ { name: "icon", tokenKey: "icon" }
1112
+ ]
1113
+ }));
1114
+ var TOOLTIP_FIELDS = [
1115
+ { name: "bg", tokenKey: "bg" },
1116
+ { name: "text", tokenKey: "text" },
1117
+ { name: "border", tokenKey: "border" }
1118
+ ];
1119
+ var DROPDOWN_FIELDS = [
1120
+ { name: "bg", modePath: ["bg"], aliasPath: ["bg"] },
1121
+ { name: "border", modePath: ["border"], aliasPath: ["border"] },
1122
+ { name: "item-default", modePath: ["item", "default"], aliasPath: ["item", "default"] },
1123
+ { name: "item-hover", modePath: ["item", "hover"], aliasPath: ["item", "hover"] },
1124
+ { name: "item-active", modePath: ["item", "active"], aliasPath: ["item", "active"] },
1125
+ { name: "item-text", modePath: ["item", "text"], aliasPath: ["item", "text"] }
1126
+ ];
863
1127
  var resolveTokenReference = (tokens2, reference) => {
864
1128
  const path = reference.slice(1, -1).split(".");
865
1129
  let current = tokens2;
@@ -1027,6 +1291,7 @@ var createCssVariableMap = (tokens2, options = {}) => {
1027
1291
  assign(toVariableName(prefix, "focus-ring-style"), baseTokens.accessibility.focusRing.style);
1028
1292
  assign(toVariableName(prefix, "min-touch-target"), baseTokens.accessibility.minTouchTarget);
1029
1293
  assign(toVariableName(prefix, "min-text-size"), baseTokens.accessibility.minTextSize);
1294
+ assign(toVariableName(prefix, "reduced-motion"), baseTokens.accessibility.reducedMotion);
1030
1295
  Object.entries(baseTokens.buttons).forEach(([variant, states]) => {
1031
1296
  Object.entries(states).forEach(([state, value]) => {
1032
1297
  assign(toVariableName(prefix, "button", variant, state), value);
@@ -1038,11 +1303,22 @@ var createCssVariableMap = (tokens2, options = {}) => {
1038
1303
  });
1039
1304
  });
1040
1305
  if (baseTokens.animations) {
1041
- Object.entries(baseTokens.animations).forEach(([name, animation]) => {
1042
- assign(toVariableName(prefix, "animation", name, "duration"), animation.duration);
1043
- assign(toVariableName(prefix, "animation", name, "easing"), animation.easing);
1044
- assign(toVariableName(prefix, "animation", name, "keyframes"), animation.keyframes);
1045
- });
1306
+ Object.entries(baseTokens.animations).forEach(
1307
+ ([name, animation]) => {
1308
+ if (name === "reducedMotion") {
1309
+ Object.entries(animation).forEach(([subName, subAnimation]) => {
1310
+ assign(toVariableName(prefix, "animation", "reduced-motion", subName, "duration"), subAnimation.duration);
1311
+ assign(toVariableName(prefix, "animation", "reduced-motion", subName, "easing"), subAnimation.easing);
1312
+ assign(toVariableName(prefix, "animation", "reduced-motion", subName, "keyframes"), subAnimation.keyframes);
1313
+ });
1314
+ } else {
1315
+ const entry = animation;
1316
+ assign(toVariableName(prefix, "animation", name, "duration"), entry.duration);
1317
+ assign(toVariableName(prefix, "animation", name, "easing"), entry.easing);
1318
+ assign(toVariableName(prefix, "animation", name, "keyframes"), entry.keyframes);
1319
+ }
1320
+ }
1321
+ );
1046
1322
  }
1047
1323
  return map;
1048
1324
  };
@@ -1061,7 +1337,7 @@ var generateCssVariables = (tokens2, options = {}) => {
1061
1337
  { varParts: ["surface", "card"], modePath: ["surface", "card"], aliasSrc: surfaceAliases, aliasPath: ["card"] },
1062
1338
  { varParts: ["surface", "input"], modePath: ["surface", "input"], aliasSrc: surfaceAliases, aliasPath: ["input"] },
1063
1339
  { varParts: ["surface", "overlay"], modePath: ["surface", "overlay"], aliasSrc: surfaceAliases, aliasPath: ["overlay"] },
1064
- { varParts: ["surface", "alternate"], modePath: ["surface", "alternate"] },
1340
+ { varParts: ["surface", "subtle"], modePath: ["surface", "subtle"] },
1065
1341
  { varParts: ["surface", "hero"], modePath: ["surface", "hero"], aliasSrc: surfaceAliases, aliasPath: ["hero"] },
1066
1342
  { varParts: ["text", "on", "page", "default"], modePath: ["text", "onPage", "default"], aliasSrc: textAliases, aliasPath: ["onPage", "default"] },
1067
1343
  { varParts: ["text", "on", "page", "muted"], modePath: ["text", "onPage", "muted"], aliasSrc: textAliases, aliasPath: ["onPage", "muted"] },
@@ -1088,6 +1364,36 @@ var generateCssVariables = (tokens2, options = {}) => {
1088
1364
  modePath: ["component", "iconBox", tokenKey],
1089
1365
  aliasSrc: componentAliases,
1090
1366
  aliasPath: ["iconBox", tokenKey]
1367
+ })),
1368
+ ...NAV_FIELDS.map(({ name, tokenKey }) => ({
1369
+ varParts: ["nav", name],
1370
+ modePath: ["component", "nav", tokenKey],
1371
+ aliasSrc: componentAliases,
1372
+ aliasPath: ["nav", tokenKey]
1373
+ })),
1374
+ ...MODAL_FIELDS.map(({ name, tokenKey }) => ({
1375
+ varParts: ["modal", name],
1376
+ modePath: ["component", "modal", tokenKey],
1377
+ aliasSrc: componentAliases,
1378
+ aliasPath: ["modal", tokenKey]
1379
+ })),
1380
+ ...TOAST_VARIANTS.flatMap(({ variant, fields }) => fields.map(({ name, tokenKey }) => ({
1381
+ varParts: ["toast", variant, name],
1382
+ modePath: ["component", "toast", variant, tokenKey],
1383
+ aliasSrc: componentAliases,
1384
+ aliasPath: ["toast", variant, tokenKey]
1385
+ }))),
1386
+ ...TOOLTIP_FIELDS.map(({ name, tokenKey }) => ({
1387
+ varParts: ["tooltip", name],
1388
+ modePath: ["component", "tooltip", tokenKey],
1389
+ aliasSrc: componentAliases,
1390
+ aliasPath: ["tooltip", tokenKey]
1391
+ })),
1392
+ ...DROPDOWN_FIELDS.map(({ name, modePath, aliasPath }) => ({
1393
+ varParts: ["dropdown", name],
1394
+ modePath: ["component", "dropdown", ...modePath],
1395
+ aliasSrc: componentAliases,
1396
+ aliasPath: ["dropdown", ...aliasPath]
1091
1397
  }))
1092
1398
  ];
1093
1399
  const baseLines = [];