@phcdevworks/spectre-tokens 2.8.0 → 2.9.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 CHANGED
@@ -62,6 +62,61 @@ var coreTokens = {
62
62
  "starFilled": "{colors.warning.500}",
63
63
  "starEmpty": "{colors.neutral.200}",
64
64
  "text": "{colors.neutral.500}"
65
+ },
66
+ "nav": {
67
+ "bg": "{colors.white}",
68
+ "text": "{colors.neutral.900}",
69
+ "link": "{colors.neutral.700}",
70
+ "linkHover": "{colors.brand.600}",
71
+ "linkActive": "{colors.brand.700}",
72
+ "border": "{colors.neutral.200}"
73
+ },
74
+ "modal": {
75
+ "bg": "{colors.white}",
76
+ "shadow": "0 20px 48px -12px {colors.black} / 0.20",
77
+ "border": "{colors.neutral.200}",
78
+ "overlay": "{colors.black} / 0.6"
79
+ },
80
+ "toast": {
81
+ "success": {
82
+ "bg": "{colors.success.50}",
83
+ "text": "{colors.success.800}",
84
+ "border": "{colors.success.200}",
85
+ "icon": "{colors.success.600}"
86
+ },
87
+ "warning": {
88
+ "bg": "{colors.warning.50}",
89
+ "text": "{colors.warning.800}",
90
+ "border": "{colors.warning.200}",
91
+ "icon": "{colors.warning.600}"
92
+ },
93
+ "danger": {
94
+ "bg": "{colors.error.50}",
95
+ "text": "{colors.error.800}",
96
+ "border": "{colors.error.200}",
97
+ "icon": "{colors.error.600}"
98
+ },
99
+ "info": {
100
+ "bg": "{colors.info.50}",
101
+ "text": "{colors.info.800}",
102
+ "border": "{colors.info.200}",
103
+ "icon": "{colors.info.600}"
104
+ }
105
+ },
106
+ "tooltip": {
107
+ "bg": "{colors.neutral.900}",
108
+ "text": "{colors.white}",
109
+ "border": "{colors.neutral.700}"
110
+ },
111
+ "dropdown": {
112
+ "bg": "{colors.white}",
113
+ "border": "{colors.neutral.200}",
114
+ "item": {
115
+ "default": "transparent",
116
+ "hover": "{colors.neutral.100}",
117
+ "active": "{colors.info.50}",
118
+ "text": "{colors.neutral.900}"
119
+ }
65
120
  }
66
121
  },
67
122
  "buttons": {
@@ -180,7 +235,11 @@ var coreTokens = {
180
235
  "input": "{colors.white}",
181
236
  "overlay": "{colors.black} / 0.6",
182
237
  "alternate": "{colors.neutral.100}",
183
- "hero": "linear-gradient(135deg, {colors.indigo.500} 0%, {colors.violet.600} 100%)"
238
+ "hero": "linear-gradient(135deg, {colors.indigo.500} 0%, {colors.violet.600} 100%)",
239
+ "hover": "{colors.neutral.100}",
240
+ "selected": "{colors.info.50}",
241
+ "active": "{colors.neutral.200}",
242
+ "divider": "{colors.neutral.200}"
184
243
  },
185
244
  "text": {
186
245
  "onPage": {
@@ -257,6 +316,61 @@ var coreTokens = {
257
316
  "starFilled": "{colors.warning.500}",
258
317
  "starEmpty": "{colors.neutral.200}",
259
318
  "text": "{colors.neutral.500}"
319
+ },
320
+ "nav": {
321
+ "bg": "{colors.white}",
322
+ "text": "{colors.neutral.900}",
323
+ "link": "{colors.neutral.700}",
324
+ "linkHover": "{colors.brand.600}",
325
+ "linkActive": "{colors.brand.700}",
326
+ "border": "{colors.neutral.200}"
327
+ },
328
+ "modal": {
329
+ "bg": "{colors.white}",
330
+ "shadow": "0 20px 48px -12px {colors.black} / 0.20",
331
+ "border": "{colors.neutral.200}",
332
+ "overlay": "{colors.black} / 0.6"
333
+ },
334
+ "toast": {
335
+ "success": {
336
+ "bg": "{colors.success.50}",
337
+ "text": "{colors.success.800}",
338
+ "border": "{colors.success.200}",
339
+ "icon": "{colors.success.600}"
340
+ },
341
+ "warning": {
342
+ "bg": "{colors.warning.50}",
343
+ "text": "{colors.warning.800}",
344
+ "border": "{colors.warning.200}",
345
+ "icon": "{colors.warning.600}"
346
+ },
347
+ "danger": {
348
+ "bg": "{colors.error.50}",
349
+ "text": "{colors.error.800}",
350
+ "border": "{colors.error.200}",
351
+ "icon": "{colors.error.600}"
352
+ },
353
+ "info": {
354
+ "bg": "{colors.info.50}",
355
+ "text": "{colors.info.800}",
356
+ "border": "{colors.info.200}",
357
+ "icon": "{colors.info.600}"
358
+ }
359
+ },
360
+ "tooltip": {
361
+ "bg": "{colors.neutral.900}",
362
+ "text": "{colors.white}",
363
+ "border": "{colors.neutral.700}"
364
+ },
365
+ "dropdown": {
366
+ "bg": "{colors.white}",
367
+ "border": "{colors.neutral.200}",
368
+ "item": {
369
+ "default": "transparent",
370
+ "hover": "{colors.neutral.100}",
371
+ "active": "{colors.info.50}",
372
+ "text": "{colors.neutral.900}"
373
+ }
260
374
  }
261
375
  }
262
376
  },
@@ -267,7 +381,11 @@ var coreTokens = {
267
381
  "input": "{colors.neutral.700}",
268
382
  "overlay": "{colors.black} / 0.6",
269
383
  "alternate": "{colors.neutral.800}",
270
- "hero": "linear-gradient(135deg, {colors.accent.700} 0%, {colors.accent.900} 100%)"
384
+ "hero": "linear-gradient(135deg, {colors.accent.700} 0%, {colors.accent.900} 100%)",
385
+ "hover": "{colors.neutral.700}",
386
+ "selected": "{colors.info.900}",
387
+ "active": "{colors.neutral.600}",
388
+ "divider": "{colors.neutral.700}"
271
389
  },
272
390
  "text": {
273
391
  "onPage": {
@@ -347,6 +465,61 @@ var coreTokens = {
347
465
  "starFilled": "{colors.warning.400}",
348
466
  "starEmpty": "{colors.neutral.700}",
349
467
  "text": "{colors.neutral.400}"
468
+ },
469
+ "nav": {
470
+ "bg": "{colors.neutral.900}",
471
+ "text": "{colors.neutral.50}",
472
+ "link": "{colors.neutral.300}",
473
+ "linkHover": "{colors.brand.400}",
474
+ "linkActive": "{colors.brand.300}",
475
+ "border": "{colors.neutral.700}"
476
+ },
477
+ "modal": {
478
+ "bg": "{colors.neutral.800}",
479
+ "shadow": "0 20px 48px -12px {colors.black} / 0.20",
480
+ "border": "{colors.neutral.700}",
481
+ "overlay": "{colors.black} / 0.6"
482
+ },
483
+ "toast": {
484
+ "success": {
485
+ "bg": "{colors.success.900}",
486
+ "text": "{colors.success.100}",
487
+ "border": "{colors.success.700}",
488
+ "icon": "{colors.success.400}"
489
+ },
490
+ "warning": {
491
+ "bg": "{colors.warning.900}",
492
+ "text": "{colors.warning.100}",
493
+ "border": "{colors.warning.700}",
494
+ "icon": "{colors.warning.400}"
495
+ },
496
+ "danger": {
497
+ "bg": "{colors.error.900}",
498
+ "text": "{colors.error.100}",
499
+ "border": "{colors.error.700}",
500
+ "icon": "{colors.error.400}"
501
+ },
502
+ "info": {
503
+ "bg": "{colors.info.900}",
504
+ "text": "{colors.info.100}",
505
+ "border": "{colors.info.700}",
506
+ "icon": "{colors.info.400}"
507
+ }
508
+ },
509
+ "tooltip": {
510
+ "bg": "{colors.neutral.50}",
511
+ "text": "{colors.neutral.900}",
512
+ "border": "{colors.neutral.300}"
513
+ },
514
+ "dropdown": {
515
+ "bg": "{colors.neutral.800}",
516
+ "border": "{colors.neutral.700}",
517
+ "item": {
518
+ "default": "transparent",
519
+ "hover": "{colors.neutral.700}",
520
+ "active": "{colors.info.900}",
521
+ "text": "{colors.neutral.100}"
522
+ }
350
523
  }
351
524
  }
352
525
  }
@@ -513,6 +686,7 @@ var coreTokens = {
513
686
  },
514
687
  "transitions": {
515
688
  "duration": {
689
+ "reduced": "0.01ms",
516
690
  "instant": "75ms",
517
691
  "fast": "150ms",
518
692
  "base": "200ms",
@@ -572,6 +746,48 @@ var coreTokens = {
572
746
  "duration": "{transitions.duration.slowest}",
573
747
  "easing": "{transitions.easing.spring}",
574
748
  "keyframes": "pulse"
749
+ },
750
+ "reducedMotion": {
751
+ "fadeIn": {
752
+ "duration": "{transitions.duration.reduced}",
753
+ "easing": "{transitions.easing.linear}",
754
+ "keyframes": "fade-in"
755
+ },
756
+ "fadeOut": {
757
+ "duration": "{transitions.duration.reduced}",
758
+ "easing": "{transitions.easing.linear}",
759
+ "keyframes": "fade-out"
760
+ },
761
+ "slideUp": {
762
+ "duration": "{transitions.duration.reduced}",
763
+ "easing": "{transitions.easing.linear}",
764
+ "keyframes": "slide-up"
765
+ },
766
+ "slideDown": {
767
+ "duration": "{transitions.duration.reduced}",
768
+ "easing": "{transitions.easing.linear}",
769
+ "keyframes": "slide-down"
770
+ },
771
+ "scaleIn": {
772
+ "duration": "{transitions.duration.reduced}",
773
+ "easing": "{transitions.easing.linear}",
774
+ "keyframes": "scale-in"
775
+ },
776
+ "bounce": {
777
+ "duration": "{transitions.duration.reduced}",
778
+ "easing": "{transitions.easing.linear}",
779
+ "keyframes": "bounce"
780
+ },
781
+ "shake": {
782
+ "duration": "{transitions.duration.reduced}",
783
+ "easing": "{transitions.easing.linear}",
784
+ "keyframes": "shake"
785
+ },
786
+ "pulse": {
787
+ "duration": "{transitions.duration.reduced}",
788
+ "easing": "{transitions.easing.linear}",
789
+ "keyframes": "pulse"
790
+ }
575
791
  }
576
792
  },
577
793
  "opacity": {
@@ -607,6 +823,8 @@ var coreTokens = {
607
823
  "offset": "2px",
608
824
  "style": "solid"
609
825
  },
826
+ "reducedMotion": "{transitions.duration.reduced}",
827
+ "forcedColors": "auto",
610
828
  "minTouchTarget": "44px",
611
829
  "minTextSize": "16px"
612
830
  },
@@ -627,7 +845,17 @@ var coreTokens = {
627
845
  "page": "{colors.neutral.50}",
628
846
  "card": "{colors.white}",
629
847
  "input": "{colors.white}",
630
- "overlay": "{colors.black} / 0.6"
848
+ "overlay": "{colors.black} / 0.6",
849
+ "hover": "{colors.neutral.100}",
850
+ "selected": "{colors.info.50}",
851
+ "active": "{colors.neutral.200}",
852
+ "divider": "{colors.neutral.200}"
853
+ },
854
+ "link": {
855
+ "default": "{colors.brand.600}",
856
+ "hover": "{colors.brand.700}",
857
+ "active": "{colors.brand.800}",
858
+ "visited": "{colors.accent.700}"
631
859
  },
632
860
  "text": {
633
861
  "onPage": {
@@ -830,6 +1058,42 @@ var ICON_BOX_FIELDS = [
830
1058
  { name: "icon-warning", tokenKey: "iconWarning" },
831
1059
  { name: "icon-danger", tokenKey: "iconDanger" }
832
1060
  ];
1061
+ var NAV_FIELDS = [
1062
+ { name: "bg", tokenKey: "bg" },
1063
+ { name: "text", tokenKey: "text" },
1064
+ { name: "link", tokenKey: "link" },
1065
+ { name: "link-hover", tokenKey: "linkHover" },
1066
+ { name: "link-active", tokenKey: "linkActive" },
1067
+ { name: "border", tokenKey: "border" }
1068
+ ];
1069
+ var MODAL_FIELDS = [
1070
+ { name: "bg", tokenKey: "bg" },
1071
+ { name: "shadow", tokenKey: "shadow" },
1072
+ { name: "border", tokenKey: "border" },
1073
+ { name: "overlay", tokenKey: "overlay" }
1074
+ ];
1075
+ var TOAST_VARIANTS = ["success", "warning", "danger", "info"].map((variant) => ({
1076
+ variant,
1077
+ fields: [
1078
+ { name: "bg", tokenKey: "bg" },
1079
+ { name: "text", tokenKey: "text" },
1080
+ { name: "border", tokenKey: "border" },
1081
+ { name: "icon", tokenKey: "icon" }
1082
+ ]
1083
+ }));
1084
+ var TOOLTIP_FIELDS = [
1085
+ { name: "bg", tokenKey: "bg" },
1086
+ { name: "text", tokenKey: "text" },
1087
+ { name: "border", tokenKey: "border" }
1088
+ ];
1089
+ var DROPDOWN_FIELDS = [
1090
+ { name: "bg", modePath: ["bg"], aliasPath: ["bg"] },
1091
+ { name: "border", modePath: ["border"], aliasPath: ["border"] },
1092
+ { name: "item-default", modePath: ["item", "default"], aliasPath: ["item", "default"] },
1093
+ { name: "item-hover", modePath: ["item", "hover"], aliasPath: ["item", "hover"] },
1094
+ { name: "item-active", modePath: ["item", "active"], aliasPath: ["item", "active"] },
1095
+ { name: "item-text", modePath: ["item", "text"], aliasPath: ["item", "text"] }
1096
+ ];
833
1097
  var resolveTokenReference = (tokens2, reference) => {
834
1098
  const path = reference.slice(1, -1).split(".");
835
1099
  let current = tokens2;
@@ -997,6 +1261,7 @@ var createCssVariableMap = (tokens2, options = {}) => {
997
1261
  assign(toVariableName(prefix, "focus-ring-style"), baseTokens.accessibility.focusRing.style);
998
1262
  assign(toVariableName(prefix, "min-touch-target"), baseTokens.accessibility.minTouchTarget);
999
1263
  assign(toVariableName(prefix, "min-text-size"), baseTokens.accessibility.minTextSize);
1264
+ assign(toVariableName(prefix, "reduced-motion"), baseTokens.accessibility.reducedMotion);
1000
1265
  Object.entries(baseTokens.buttons).forEach(([variant, states]) => {
1001
1266
  Object.entries(states).forEach(([state, value]) => {
1002
1267
  assign(toVariableName(prefix, "button", variant, state), value);
@@ -1008,11 +1273,22 @@ var createCssVariableMap = (tokens2, options = {}) => {
1008
1273
  });
1009
1274
  });
1010
1275
  if (baseTokens.animations) {
1011
- Object.entries(baseTokens.animations).forEach(([name, animation]) => {
1012
- assign(toVariableName(prefix, "animation", name, "duration"), animation.duration);
1013
- assign(toVariableName(prefix, "animation", name, "easing"), animation.easing);
1014
- assign(toVariableName(prefix, "animation", name, "keyframes"), animation.keyframes);
1015
- });
1276
+ Object.entries(baseTokens.animations).forEach(
1277
+ ([name, animation]) => {
1278
+ if (name === "reducedMotion") {
1279
+ Object.entries(animation).forEach(([subName, subAnimation]) => {
1280
+ assign(toVariableName(prefix, "animation", "reduced-motion", subName, "duration"), subAnimation.duration);
1281
+ assign(toVariableName(prefix, "animation", "reduced-motion", subName, "easing"), subAnimation.easing);
1282
+ assign(toVariableName(prefix, "animation", "reduced-motion", subName, "keyframes"), subAnimation.keyframes);
1283
+ });
1284
+ } else {
1285
+ const entry = animation;
1286
+ assign(toVariableName(prefix, "animation", name, "duration"), entry.duration);
1287
+ assign(toVariableName(prefix, "animation", name, "easing"), entry.easing);
1288
+ assign(toVariableName(prefix, "animation", name, "keyframes"), entry.keyframes);
1289
+ }
1290
+ }
1291
+ );
1016
1292
  }
1017
1293
  return map;
1018
1294
  };
@@ -1058,6 +1334,36 @@ var generateCssVariables = (tokens2, options = {}) => {
1058
1334
  modePath: ["component", "iconBox", tokenKey],
1059
1335
  aliasSrc: componentAliases,
1060
1336
  aliasPath: ["iconBox", tokenKey]
1337
+ })),
1338
+ ...NAV_FIELDS.map(({ name, tokenKey }) => ({
1339
+ varParts: ["nav", name],
1340
+ modePath: ["component", "nav", tokenKey],
1341
+ aliasSrc: componentAliases,
1342
+ aliasPath: ["nav", tokenKey]
1343
+ })),
1344
+ ...MODAL_FIELDS.map(({ name, tokenKey }) => ({
1345
+ varParts: ["modal", name],
1346
+ modePath: ["component", "modal", tokenKey],
1347
+ aliasSrc: componentAliases,
1348
+ aliasPath: ["modal", tokenKey]
1349
+ })),
1350
+ ...TOAST_VARIANTS.flatMap(({ variant, fields }) => fields.map(({ name, tokenKey }) => ({
1351
+ varParts: ["toast", variant, name],
1352
+ modePath: ["component", "toast", variant, tokenKey],
1353
+ aliasSrc: componentAliases,
1354
+ aliasPath: ["toast", variant, tokenKey]
1355
+ }))),
1356
+ ...TOOLTIP_FIELDS.map(({ name, tokenKey }) => ({
1357
+ varParts: ["tooltip", name],
1358
+ modePath: ["component", "tooltip", tokenKey],
1359
+ aliasSrc: componentAliases,
1360
+ aliasPath: ["tooltip", tokenKey]
1361
+ })),
1362
+ ...DROPDOWN_FIELDS.map(({ name, modePath, aliasPath }) => ({
1363
+ varParts: ["dropdown", name],
1364
+ modePath: ["component", "dropdown", ...modePath],
1365
+ aliasSrc: componentAliases,
1366
+ aliasPath: ["dropdown", ...aliasPath]
1061
1367
  }))
1062
1368
  ];
1063
1369
  const baseLines = [];