@phcdevworks/spectre-tokens 4.15.0 → 4.17.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/README.md +50 -2
- package/dist/index.cjs +162 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +131 -54
- package/dist/index.d.cts +106 -0
- package/dist/index.d.ts +106 -0
- package/dist/index.js +162 -23
- package/dist/index.js.map +1 -1
- package/dist/tokens.dtcg.json +331 -14
- package/package.json +11 -11
- package/tokens/modes.json +60 -0
- package/tokens/palette.json +26 -0
- package/tokens/primitives.json +2 -1
- package/tokens/semantic-roles.json +53 -0
- package/tokens/typography.json +17 -15
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ contracts for specific frameworks and runtimes.
|
|
|
17
17
|
| Project team | `project-design` |
|
|
18
18
|
| Repository role | Spectre L1 design-token contract |
|
|
19
19
|
| Package/artifact | `@phcdevworks/spectre-tokens` |
|
|
20
|
-
| Current version/status | 4.
|
|
20
|
+
| Current version/status | 4.17.0 |
|
|
21
21
|
|
|
22
22
|
## Standard Workflow
|
|
23
23
|
|
|
@@ -413,6 +413,52 @@ and need no breakpoint of their own.
|
|
|
413
413
|
Weights and families do not change. Each size keeps the line height of its
|
|
414
414
|
scale step.
|
|
415
415
|
|
|
416
|
+
### Font families
|
|
417
|
+
|
|
418
|
+
Spectre ships system font stacks. Two role families sit on top of them:
|
|
419
|
+
`typography.families.heading` (every heading and display role) and
|
|
420
|
+
`typography.families.body` (body and lead). Both default to
|
|
421
|
+
`typography.families.sans`. In CSS each role's `-family` variable is a
|
|
422
|
+
`var()` reference to one of them, so a site picks its faces by setting two
|
|
423
|
+
variables on `:root`. Sizes, weights, and spacing stay Spectre's.
|
|
424
|
+
|
|
425
|
+
```css
|
|
426
|
+
:root {
|
|
427
|
+
--sp-font-family-heading: 'Bricolage Grotesque Variable', var(--sp-font-family-sans);
|
|
428
|
+
--sp-font-family-body: 'Inter Variable', var(--sp-font-family-sans);
|
|
429
|
+
}
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
These two are the only `--sp-*` variables a consumer sets. Set them on
|
|
433
|
+
`:root`: the role variables resolve there, so setting them on a nested
|
|
434
|
+
element has no effect. Loading the font files stays with the site. A
|
|
435
|
+
wordmark or other non-heading element that wants the heading face reads
|
|
436
|
+
`var(--sp-font-family-heading)`.
|
|
437
|
+
|
|
438
|
+
### Decorative layer
|
|
439
|
+
|
|
440
|
+
The `decorative` namespace holds values for textures, fades, and ambient
|
|
441
|
+
effects such as hero dot grids and shimmering text. The `spectre-ui` pattern
|
|
442
|
+
layer consumes it. Its CSS variables drop the namespace.
|
|
443
|
+
|
|
444
|
+
| Token | CSS variable | Values |
|
|
445
|
+
| --- | --- | --- |
|
|
446
|
+
| `decorative.pattern.cell.{sm,md,lg,xl}` | `--sp-pattern-cell-*` | 12, 20, 32, 48px (`space` steps) |
|
|
447
|
+
| `decorative.pattern.dotRadius.{sm,md,lg}` | `--sp-pattern-dot-radius-*` | 1, 2, 4px (`space` steps) |
|
|
448
|
+
| `decorative.pattern.lineWeight.{sm,md,lg}` | `--sp-pattern-line-weight-*` | 1, 2, 4px (`space` steps) |
|
|
449
|
+
| `decorative.pattern.opacity.{subtle,muted,strong}` | `--sp-pattern-opacity-*` | 0.25, 0.5, 0.75 |
|
|
450
|
+
| `decorative.fade.{edge,corner,radial}.{solid,clear}` | `--sp-fade-*` | mask stops: edge 0–100%, corner 0–50%, radial 25–75% |
|
|
451
|
+
| `decorative.shimmer.band.{start,peak,end}` | `--sp-shimmer-band-*` | 35%, 50%, 65% |
|
|
452
|
+
| `decorative.shimmer.travel` | `--sp-shimmer-travel` | 60% of the cycle spent sweeping, then rest |
|
|
453
|
+
| `decorative.gradient.action` | `--sp-gradient-action` | `action` ramp 500→700 at 135° |
|
|
454
|
+
|
|
455
|
+
`--sp-gradient-action` reads the action ramp, so it follows
|
|
456
|
+
`data-spectre-action`. It is mode-aware: dark mode lifts it to 300→500 and
|
|
457
|
+
high-contrast mode drops it to 700→900. Ambient effects run on
|
|
458
|
+
`--sp-duration-ambient` (7000ms), the one duration meant for decoration
|
|
459
|
+
rather than UI feedback. Under `prefers-reduced-motion` they should stop,
|
|
460
|
+
not just speed up.
|
|
461
|
+
|
|
416
462
|
### Action colour
|
|
417
463
|
|
|
418
464
|
`action` is the theme's own action colour: the one a site uses for its main
|
|
@@ -501,7 +547,8 @@ light footer.
|
|
|
501
547
|
|
|
502
548
|
`colors.palette` holds the full extended colour ramps (`red` through `stone`,
|
|
503
549
|
`slate`, `zinc`, the `mauve`/`olive`/`mist`/`taupe` neutrals, and the named
|
|
504
|
-
brand and integration colours
|
|
550
|
+
brand and integration colours, including `phcdevworks-*` and
|
|
551
|
+
`bradpotts-teal`/`bradpotts-ink`), emitted as `--sp-color-palette-<name>-<step>`.
|
|
505
552
|
Like `colors`, it is raw palette: use it for data visualisation or a brand
|
|
506
553
|
colour that has no semantic role, not for normal UI.
|
|
507
554
|
|
|
@@ -565,6 +612,7 @@ The generated token object includes these namespaces:
|
|
|
565
612
|
- `control`
|
|
566
613
|
- `elevation`
|
|
567
614
|
- `action`
|
|
615
|
+
- `decorative`
|
|
568
616
|
|
|
569
617
|
The exported runtime token object is a flattened string-based tree generated
|
|
570
618
|
from `tokens/`. Source-only wrapper fields such as `value` and `metadata` are
|
package/dist/index.cjs
CHANGED
|
@@ -1955,6 +1955,11 @@ var coreTokens = {
|
|
|
1955
1955
|
}
|
|
1956
1956
|
},
|
|
1957
1957
|
"dark": {
|
|
1958
|
+
"decorative": {
|
|
1959
|
+
"gradient": {
|
|
1960
|
+
"action": "linear-gradient(135deg, {colors.brand.300} 0%, {colors.brand.500} 100%)"
|
|
1961
|
+
}
|
|
1962
|
+
},
|
|
1958
1963
|
"action": {
|
|
1959
1964
|
"onPage": "{colors.brand.400}",
|
|
1960
1965
|
"onSurface": "{colors.brand.400}",
|
|
@@ -2828,9 +2833,28 @@ var coreTokens = {
|
|
|
2828
2833
|
"visited": "{colors.accent.300}",
|
|
2829
2834
|
"underline": "{colors.brand.400} / 0.4",
|
|
2830
2835
|
"underlineHover": "{colors.brand.300}"
|
|
2836
|
+
},
|
|
2837
|
+
"buttons": {
|
|
2838
|
+
"secondary": {
|
|
2839
|
+
"bg": "transparent",
|
|
2840
|
+
"bgHover": "{colors.neutral.800}",
|
|
2841
|
+
"bgActive": "{colors.neutral.700}",
|
|
2842
|
+
"bgDisabled": "transparent",
|
|
2843
|
+
"text": "{colors.info.300}",
|
|
2844
|
+
"textDisabled": "{colors.neutral.500}",
|
|
2845
|
+
"border": "{colors.info.400}",
|
|
2846
|
+
"borderDisabled": "{colors.neutral.700}",
|
|
2847
|
+
"focusRing": "{colors.info.500} / 0.4",
|
|
2848
|
+
"focusVisible": "{colors.info.500} / 0.4"
|
|
2849
|
+
}
|
|
2831
2850
|
}
|
|
2832
2851
|
},
|
|
2833
2852
|
"highContrast": {
|
|
2853
|
+
"decorative": {
|
|
2854
|
+
"gradient": {
|
|
2855
|
+
"action": "linear-gradient(135deg, {colors.brand.700} 0%, {colors.brand.900} 100%)"
|
|
2856
|
+
}
|
|
2857
|
+
},
|
|
2834
2858
|
"action": {
|
|
2835
2859
|
"bg": "{colors.brand.800}",
|
|
2836
2860
|
"bgHover": "{colors.brand.900}",
|
|
@@ -4388,6 +4412,32 @@ var coreTokens = {
|
|
|
4388
4412
|
"800": "#2b251b",
|
|
4389
4413
|
"900": "#1f190e",
|
|
4390
4414
|
"950": "#0e0a05"
|
|
4415
|
+
},
|
|
4416
|
+
"bradpotts-teal": {
|
|
4417
|
+
"50": "#f1fdfc",
|
|
4418
|
+
"100": "#cef9f7",
|
|
4419
|
+
"200": "#9cf4f0",
|
|
4420
|
+
"300": "#5ae8e5",
|
|
4421
|
+
"400": "#34d1cf",
|
|
4422
|
+
"500": "#2db7b6",
|
|
4423
|
+
"600": "#249394",
|
|
4424
|
+
"700": "#1c7578",
|
|
4425
|
+
"800": "#165d61",
|
|
4426
|
+
"900": "#174d50",
|
|
4427
|
+
"950": "#092e31"
|
|
4428
|
+
},
|
|
4429
|
+
"bradpotts-ink": {
|
|
4430
|
+
"50": "#f7fafb",
|
|
4431
|
+
"100": "#f0f6f8",
|
|
4432
|
+
"200": "#dfe9ee",
|
|
4433
|
+
"300": "#c6d7df",
|
|
4434
|
+
"400": "#85a5b3",
|
|
4435
|
+
"500": "#557987",
|
|
4436
|
+
"600": "#395966",
|
|
4437
|
+
"700": "#244552",
|
|
4438
|
+
"800": "#0f2d38",
|
|
4439
|
+
"900": "#001b25",
|
|
4440
|
+
"950": "#00090f"
|
|
4391
4441
|
}
|
|
4392
4442
|
}
|
|
4393
4443
|
},
|
|
@@ -4473,7 +4523,8 @@ var coreTokens = {
|
|
|
4473
4523
|
"slow": "500ms",
|
|
4474
4524
|
"slower": "700ms",
|
|
4475
4525
|
"long": "1000ms",
|
|
4476
|
-
"slowest": "1200ms"
|
|
4526
|
+
"slowest": "1200ms",
|
|
4527
|
+
"ambient": "7000ms"
|
|
4477
4528
|
},
|
|
4478
4529
|
"easing": {
|
|
4479
4530
|
"linear": "linear",
|
|
@@ -4856,6 +4907,56 @@ var coreTokens = {
|
|
|
4856
4907
|
"zIndex": "{zIndex.modal}"
|
|
4857
4908
|
}
|
|
4858
4909
|
},
|
|
4910
|
+
"decorative": {
|
|
4911
|
+
"pattern": {
|
|
4912
|
+
"cell": {
|
|
4913
|
+
"sm": "{space.12}",
|
|
4914
|
+
"md": "{space.20}",
|
|
4915
|
+
"lg": "{space.32}",
|
|
4916
|
+
"xl": "{space.48}"
|
|
4917
|
+
},
|
|
4918
|
+
"dotRadius": {
|
|
4919
|
+
"sm": "{space.1}",
|
|
4920
|
+
"md": "{space.2}",
|
|
4921
|
+
"lg": "{space.4}"
|
|
4922
|
+
},
|
|
4923
|
+
"lineWeight": {
|
|
4924
|
+
"sm": "{space.1}",
|
|
4925
|
+
"md": "{space.2}",
|
|
4926
|
+
"lg": "{space.4}"
|
|
4927
|
+
},
|
|
4928
|
+
"opacity": {
|
|
4929
|
+
"subtle": "0.25",
|
|
4930
|
+
"muted": "0.5",
|
|
4931
|
+
"strong": "0.75"
|
|
4932
|
+
}
|
|
4933
|
+
},
|
|
4934
|
+
"fade": {
|
|
4935
|
+
"edge": {
|
|
4936
|
+
"solid": "0%",
|
|
4937
|
+
"clear": "100%"
|
|
4938
|
+
},
|
|
4939
|
+
"corner": {
|
|
4940
|
+
"solid": "0%",
|
|
4941
|
+
"clear": "50%"
|
|
4942
|
+
},
|
|
4943
|
+
"radial": {
|
|
4944
|
+
"solid": "25%",
|
|
4945
|
+
"clear": "75%"
|
|
4946
|
+
}
|
|
4947
|
+
},
|
|
4948
|
+
"shimmer": {
|
|
4949
|
+
"band": {
|
|
4950
|
+
"start": "35%",
|
|
4951
|
+
"peak": "50%",
|
|
4952
|
+
"end": "65%"
|
|
4953
|
+
},
|
|
4954
|
+
"travel": "60%"
|
|
4955
|
+
},
|
|
4956
|
+
"gradient": {
|
|
4957
|
+
"action": "linear-gradient(135deg, {colors.brand.500} 0%, {colors.brand.700} 100%)"
|
|
4958
|
+
}
|
|
4959
|
+
},
|
|
4859
4960
|
"font": {
|
|
4860
4961
|
"xs": {
|
|
4861
4962
|
"size": "0.75rem",
|
|
@@ -4940,7 +5041,9 @@ var coreTokens = {
|
|
|
4940
5041
|
"families": {
|
|
4941
5042
|
"sans": "system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif",
|
|
4942
5043
|
"serif": "'Times New Roman', Times, serif",
|
|
4943
|
-
"mono": "'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace"
|
|
5044
|
+
"mono": "'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace",
|
|
5045
|
+
"heading": "{typography.families.sans}",
|
|
5046
|
+
"body": "{typography.families.sans}"
|
|
4944
5047
|
},
|
|
4945
5048
|
"scale": {
|
|
4946
5049
|
"xs": {
|
|
@@ -5024,42 +5127,42 @@ var coreTokens = {
|
|
|
5024
5127
|
},
|
|
5025
5128
|
"heading": {
|
|
5026
5129
|
"h1": {
|
|
5027
|
-
"fontFamily": "{typography.families.
|
|
5130
|
+
"fontFamily": "{typography.families.heading}",
|
|
5028
5131
|
"fontSize": "{typography.scale.4xl.fontSize}",
|
|
5029
5132
|
"lineHeight": "{typography.scale.4xl.lineHeight}",
|
|
5030
5133
|
"fontWeight": 800,
|
|
5031
5134
|
"letterSpacing": "{typography.scale.4xl.letterSpacing}"
|
|
5032
5135
|
},
|
|
5033
5136
|
"h2": {
|
|
5034
|
-
"fontFamily": "{typography.families.
|
|
5137
|
+
"fontFamily": "{typography.families.heading}",
|
|
5035
5138
|
"fontSize": "{typography.scale.3xl.fontSize}",
|
|
5036
5139
|
"lineHeight": "{typography.scale.3xl.lineHeight}",
|
|
5037
5140
|
"fontWeight": 700,
|
|
5038
5141
|
"letterSpacing": "{typography.scale.3xl.letterSpacing}"
|
|
5039
5142
|
},
|
|
5040
5143
|
"h3": {
|
|
5041
|
-
"fontFamily": "{typography.families.
|
|
5144
|
+
"fontFamily": "{typography.families.heading}",
|
|
5042
5145
|
"fontSize": "{typography.scale.2xl.fontSize}",
|
|
5043
5146
|
"lineHeight": "{typography.scale.2xl.lineHeight}",
|
|
5044
5147
|
"fontWeight": 700,
|
|
5045
5148
|
"letterSpacing": "{typography.scale.2xl.letterSpacing}"
|
|
5046
5149
|
},
|
|
5047
5150
|
"h4": {
|
|
5048
|
-
"fontFamily": "{typography.families.
|
|
5151
|
+
"fontFamily": "{typography.families.heading}",
|
|
5049
5152
|
"fontSize": "{typography.scale.xl.fontSize}",
|
|
5050
5153
|
"lineHeight": "{typography.scale.xl.lineHeight}",
|
|
5051
5154
|
"fontWeight": 600,
|
|
5052
5155
|
"letterSpacing": "{typography.scale.xl.letterSpacing}"
|
|
5053
5156
|
},
|
|
5054
5157
|
"h5": {
|
|
5055
|
-
"fontFamily": "{typography.families.
|
|
5158
|
+
"fontFamily": "{typography.families.heading}",
|
|
5056
5159
|
"fontSize": "{typography.scale.xl.fontSize}",
|
|
5057
5160
|
"lineHeight": "{typography.scale.xl.lineHeight}",
|
|
5058
5161
|
"fontWeight": 600,
|
|
5059
5162
|
"letterSpacing": "{typography.scale.xl.letterSpacing}"
|
|
5060
5163
|
},
|
|
5061
5164
|
"h6": {
|
|
5062
|
-
"fontFamily": "{typography.families.
|
|
5165
|
+
"fontFamily": "{typography.families.heading}",
|
|
5063
5166
|
"fontSize": "{typography.scale.xl.fontSize}",
|
|
5064
5167
|
"lineHeight": "{typography.scale.xl.lineHeight}",
|
|
5065
5168
|
"fontWeight": 600,
|
|
@@ -5067,7 +5170,7 @@ var coreTokens = {
|
|
|
5067
5170
|
}
|
|
5068
5171
|
},
|
|
5069
5172
|
"body": {
|
|
5070
|
-
"fontFamily": "{typography.families.
|
|
5173
|
+
"fontFamily": "{typography.families.body}",
|
|
5071
5174
|
"fontSize": "{typography.scale.md.fontSize}",
|
|
5072
5175
|
"lineHeight": "{typography.scale.md.lineHeight}",
|
|
5073
5176
|
"fontWeight": 400,
|
|
@@ -5075,42 +5178,42 @@ var coreTokens = {
|
|
|
5075
5178
|
},
|
|
5076
5179
|
"display": {
|
|
5077
5180
|
"1": {
|
|
5078
|
-
"fontFamily": "{typography.families.
|
|
5181
|
+
"fontFamily": "{typography.families.heading}",
|
|
5079
5182
|
"fontSize": "{typography.scale.4xl.fontSize}",
|
|
5080
5183
|
"lineHeight": "{typography.scale.4xl.lineHeight}",
|
|
5081
5184
|
"fontWeight": 800,
|
|
5082
5185
|
"letterSpacing": "{typography.scale.4xl.letterSpacing}"
|
|
5083
5186
|
},
|
|
5084
5187
|
"2": {
|
|
5085
|
-
"fontFamily": "{typography.families.
|
|
5188
|
+
"fontFamily": "{typography.families.heading}",
|
|
5086
5189
|
"fontSize": "{typography.scale.4xl.fontSize}",
|
|
5087
5190
|
"lineHeight": "{typography.scale.4xl.lineHeight}",
|
|
5088
5191
|
"fontWeight": 800,
|
|
5089
5192
|
"letterSpacing": "{typography.scale.4xl.letterSpacing}"
|
|
5090
5193
|
},
|
|
5091
5194
|
"3": {
|
|
5092
|
-
"fontFamily": "{typography.families.
|
|
5195
|
+
"fontFamily": "{typography.families.heading}",
|
|
5093
5196
|
"fontSize": "{typography.scale.4xl.fontSize}",
|
|
5094
5197
|
"lineHeight": "{typography.scale.4xl.lineHeight}",
|
|
5095
5198
|
"fontWeight": 700,
|
|
5096
5199
|
"letterSpacing": "{typography.scale.4xl.letterSpacing}"
|
|
5097
5200
|
},
|
|
5098
5201
|
"4": {
|
|
5099
|
-
"fontFamily": "{typography.families.
|
|
5202
|
+
"fontFamily": "{typography.families.heading}",
|
|
5100
5203
|
"fontSize": "{typography.scale.4xl.fontSize}",
|
|
5101
5204
|
"lineHeight": "{typography.scale.4xl.lineHeight}",
|
|
5102
5205
|
"fontWeight": 700,
|
|
5103
5206
|
"letterSpacing": "{typography.scale.4xl.letterSpacing}"
|
|
5104
5207
|
},
|
|
5105
5208
|
"5": {
|
|
5106
|
-
"fontFamily": "{typography.families.
|
|
5209
|
+
"fontFamily": "{typography.families.heading}",
|
|
5107
5210
|
"fontSize": "{typography.scale.3xl.fontSize}",
|
|
5108
5211
|
"lineHeight": "{typography.scale.3xl.lineHeight}",
|
|
5109
5212
|
"fontWeight": 600,
|
|
5110
5213
|
"letterSpacing": "{typography.scale.3xl.letterSpacing}"
|
|
5111
5214
|
},
|
|
5112
5215
|
"6": {
|
|
5113
|
-
"fontFamily": "{typography.families.
|
|
5216
|
+
"fontFamily": "{typography.families.heading}",
|
|
5114
5217
|
"fontSize": "{typography.scale.2xl.fontSize}",
|
|
5115
5218
|
"lineHeight": "{typography.scale.2xl.lineHeight}",
|
|
5116
5219
|
"fontWeight": 600,
|
|
@@ -5118,7 +5221,7 @@ var coreTokens = {
|
|
|
5118
5221
|
}
|
|
5119
5222
|
},
|
|
5120
5223
|
"lead": {
|
|
5121
|
-
"fontFamily": "{typography.families.
|
|
5224
|
+
"fontFamily": "{typography.families.body}",
|
|
5122
5225
|
"fontSize": "{typography.scale.xl.fontSize}",
|
|
5123
5226
|
"lineHeight": "{typography.scale.xl.lineHeight}",
|
|
5124
5227
|
"fontWeight": 400,
|
|
@@ -5450,8 +5553,12 @@ var createCssVariableMap = (tokens2, options = {}) => {
|
|
|
5450
5553
|
assign(toVariableName(prefix, "aspect-ratio", key), value);
|
|
5451
5554
|
});
|
|
5452
5555
|
}
|
|
5556
|
+
const familyReference = (value) => {
|
|
5557
|
+
const key = typeof value === "string" ? value.match(/^\{typography\.families\.([^}]+)\}$/)?.[1] : void 0;
|
|
5558
|
+
return key === void 0 ? void 0 : `var(${toVariableName(prefix, "font-family", key)})`;
|
|
5559
|
+
};
|
|
5453
5560
|
Object.entries(baseTokens.typography.families).forEach(([key, value]) => {
|
|
5454
|
-
assign(toVariableName(prefix, "font-family", key), value);
|
|
5561
|
+
assign(toVariableName(prefix, "font-family", key), familyReference(value) ?? value);
|
|
5455
5562
|
});
|
|
5456
5563
|
const typographyScale = baseTokens.typography?.scale ?? {};
|
|
5457
5564
|
const fontScale = baseTokens.font;
|
|
@@ -5474,7 +5581,8 @@ var createCssVariableMap = (tokens2, options = {}) => {
|
|
|
5474
5581
|
});
|
|
5475
5582
|
const assignRole = (rolePrefixParts, entry) => {
|
|
5476
5583
|
Object.entries(ROLE_FIELD_SUFFIXES).forEach(([field, suffix]) => {
|
|
5477
|
-
|
|
5584
|
+
const value = entry[field];
|
|
5585
|
+
assign(toVariableName(prefix, ...rolePrefixParts, suffix), field === "fontFamily" && familyReference(value) || value);
|
|
5478
5586
|
});
|
|
5479
5587
|
};
|
|
5480
5588
|
const heading = baseTokens.typography?.heading;
|
|
@@ -5524,6 +5632,17 @@ var createCssVariableMap = (tokens2, options = {}) => {
|
|
|
5524
5632
|
Object.entries(baseTokens.opacity).forEach(([key, value]) => {
|
|
5525
5633
|
assign(toVariableName(prefix, "opacity", key), value);
|
|
5526
5634
|
});
|
|
5635
|
+
const decorative = baseTokens.decorative;
|
|
5636
|
+
if (isPlainObject(decorative)) {
|
|
5637
|
+
const assignDecorative = (node, parts) => {
|
|
5638
|
+
if (!isPlainObject(node)) {
|
|
5639
|
+
assign(toVariableName(prefix, ...parts.map(kebabCase)), node);
|
|
5640
|
+
return;
|
|
5641
|
+
}
|
|
5642
|
+
Object.entries(node).forEach(([key, nested]) => assignDecorative(nested, [...parts, key]));
|
|
5643
|
+
};
|
|
5644
|
+
Object.entries(decorative).filter(([group]) => group !== "gradient").forEach(([group, node]) => assignDecorative(node, [group]));
|
|
5645
|
+
}
|
|
5527
5646
|
assign(toVariableName(prefix, "focus-ring-width"), baseTokens.accessibility.focusRing.width);
|
|
5528
5647
|
assign(toVariableName(prefix, "focus-ring-offset"), baseTokens.accessibility.focusRing.offset);
|
|
5529
5648
|
assign(toVariableName(prefix, "focus-ring-style"), baseTokens.accessibility.focusRing.style);
|
|
@@ -5669,14 +5788,34 @@ var generateCssVariables = (tokens2, options = {}) => {
|
|
|
5669
5788
|
addDark(varName, actionValue(getPath(darkAction, [key]) ?? value));
|
|
5670
5789
|
addHighContrast(varName, actionValue(getPath(highContrastAction, [key]) ?? value));
|
|
5671
5790
|
});
|
|
5672
|
-
const
|
|
5673
|
-
|
|
5674
|
-
|
|
5791
|
+
const gradientValue = (value) => {
|
|
5792
|
+
const raw = isPlainObject(value) && "value" in value ? value.value : value;
|
|
5793
|
+
if (typeof raw !== "string") return pickSemantic(tokens2, value);
|
|
5794
|
+
return resolveValue(
|
|
5795
|
+
tokens2,
|
|
5796
|
+
raw.replace(/\{colors\.brand\.([^}]+)\}/g, (_, step) => `var(${toVariableName(prefix, "action", step)})`)
|
|
5797
|
+
);
|
|
5798
|
+
};
|
|
5799
|
+
const decorativeGradients = getPath(tokens2, ["decorative", "gradient"]);
|
|
5800
|
+
const darkGradients = getPath(darkMode, ["decorative", "gradient"]);
|
|
5801
|
+
const highContrastGradients = getPath(highContrastMode, ["decorative", "gradient"]);
|
|
5802
|
+
Object.entries(isPlainObject(decorativeGradients) ? decorativeGradients : {}).forEach(([key, value]) => {
|
|
5803
|
+
const varName = toVariableName(prefix, "gradient", kebabPathSegment(key));
|
|
5804
|
+
addBase(varName, gradientValue(value));
|
|
5805
|
+
addDark(varName, gradientValue(getPath(darkGradients, [key]) ?? value));
|
|
5806
|
+
addHighContrast(varName, gradientValue(getPath(highContrastGradients, [key]) ?? value));
|
|
5807
|
+
});
|
|
5808
|
+
const addButtonOverrides = (mode, add) => {
|
|
5809
|
+
const buttons = getPath(mode, ["buttons"]);
|
|
5810
|
+
if (!isPlainObject(buttons)) return;
|
|
5811
|
+
Object.entries(buttons).forEach(([variant, states]) => {
|
|
5675
5812
|
Object.entries(states).forEach(([state, value]) => {
|
|
5676
|
-
|
|
5813
|
+
add(toVariableName(prefix, "button", variant, state), pickSemantic(tokens2, value));
|
|
5677
5814
|
});
|
|
5678
5815
|
});
|
|
5679
|
-
}
|
|
5816
|
+
};
|
|
5817
|
+
addButtonOverrides(darkMode, addDark);
|
|
5818
|
+
addButtonOverrides(highContrastMode, addHighContrast);
|
|
5680
5819
|
const mapLines = Object.entries(declarations).filter(([name]) => !modeScopedNames.has(name)).map(([name, value]) => ` ${name}: ${value};`);
|
|
5681
5820
|
const rootBlock = `${selector} {
|
|
5682
5821
|
${[...baseLines, ...mapLines].join("\n")}
|