@phcdevworks/spectre-tokens 4.16.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 +140 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +91 -14
- package/dist/index.d.cts +92 -0
- package/dist/index.d.ts +92 -0
- package/dist/index.js +140 -18
- package/dist/index.js.map +1 -1
- package/dist/tokens.dtcg.json +286 -14
- package/package.json +2 -2
- package/tokens/modes.json +16 -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}",
|
|
@@ -2845,6 +2850,11 @@ var coreTokens = {
|
|
|
2845
2850
|
}
|
|
2846
2851
|
},
|
|
2847
2852
|
"highContrast": {
|
|
2853
|
+
"decorative": {
|
|
2854
|
+
"gradient": {
|
|
2855
|
+
"action": "linear-gradient(135deg, {colors.brand.700} 0%, {colors.brand.900} 100%)"
|
|
2856
|
+
}
|
|
2857
|
+
},
|
|
2848
2858
|
"action": {
|
|
2849
2859
|
"bg": "{colors.brand.800}",
|
|
2850
2860
|
"bgHover": "{colors.brand.900}",
|
|
@@ -4402,6 +4412,32 @@ var coreTokens = {
|
|
|
4402
4412
|
"800": "#2b251b",
|
|
4403
4413
|
"900": "#1f190e",
|
|
4404
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"
|
|
4405
4441
|
}
|
|
4406
4442
|
}
|
|
4407
4443
|
},
|
|
@@ -4487,7 +4523,8 @@ var coreTokens = {
|
|
|
4487
4523
|
"slow": "500ms",
|
|
4488
4524
|
"slower": "700ms",
|
|
4489
4525
|
"long": "1000ms",
|
|
4490
|
-
"slowest": "1200ms"
|
|
4526
|
+
"slowest": "1200ms",
|
|
4527
|
+
"ambient": "7000ms"
|
|
4491
4528
|
},
|
|
4492
4529
|
"easing": {
|
|
4493
4530
|
"linear": "linear",
|
|
@@ -4870,6 +4907,56 @@ var coreTokens = {
|
|
|
4870
4907
|
"zIndex": "{zIndex.modal}"
|
|
4871
4908
|
}
|
|
4872
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
|
+
},
|
|
4873
4960
|
"font": {
|
|
4874
4961
|
"xs": {
|
|
4875
4962
|
"size": "0.75rem",
|
|
@@ -4954,7 +5041,9 @@ var coreTokens = {
|
|
|
4954
5041
|
"families": {
|
|
4955
5042
|
"sans": "system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif",
|
|
4956
5043
|
"serif": "'Times New Roman', Times, serif",
|
|
4957
|
-
"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}"
|
|
4958
5047
|
},
|
|
4959
5048
|
"scale": {
|
|
4960
5049
|
"xs": {
|
|
@@ -5038,42 +5127,42 @@ var coreTokens = {
|
|
|
5038
5127
|
},
|
|
5039
5128
|
"heading": {
|
|
5040
5129
|
"h1": {
|
|
5041
|
-
"fontFamily": "{typography.families.
|
|
5130
|
+
"fontFamily": "{typography.families.heading}",
|
|
5042
5131
|
"fontSize": "{typography.scale.4xl.fontSize}",
|
|
5043
5132
|
"lineHeight": "{typography.scale.4xl.lineHeight}",
|
|
5044
5133
|
"fontWeight": 800,
|
|
5045
5134
|
"letterSpacing": "{typography.scale.4xl.letterSpacing}"
|
|
5046
5135
|
},
|
|
5047
5136
|
"h2": {
|
|
5048
|
-
"fontFamily": "{typography.families.
|
|
5137
|
+
"fontFamily": "{typography.families.heading}",
|
|
5049
5138
|
"fontSize": "{typography.scale.3xl.fontSize}",
|
|
5050
5139
|
"lineHeight": "{typography.scale.3xl.lineHeight}",
|
|
5051
5140
|
"fontWeight": 700,
|
|
5052
5141
|
"letterSpacing": "{typography.scale.3xl.letterSpacing}"
|
|
5053
5142
|
},
|
|
5054
5143
|
"h3": {
|
|
5055
|
-
"fontFamily": "{typography.families.
|
|
5144
|
+
"fontFamily": "{typography.families.heading}",
|
|
5056
5145
|
"fontSize": "{typography.scale.2xl.fontSize}",
|
|
5057
5146
|
"lineHeight": "{typography.scale.2xl.lineHeight}",
|
|
5058
5147
|
"fontWeight": 700,
|
|
5059
5148
|
"letterSpacing": "{typography.scale.2xl.letterSpacing}"
|
|
5060
5149
|
},
|
|
5061
5150
|
"h4": {
|
|
5062
|
-
"fontFamily": "{typography.families.
|
|
5151
|
+
"fontFamily": "{typography.families.heading}",
|
|
5063
5152
|
"fontSize": "{typography.scale.xl.fontSize}",
|
|
5064
5153
|
"lineHeight": "{typography.scale.xl.lineHeight}",
|
|
5065
5154
|
"fontWeight": 600,
|
|
5066
5155
|
"letterSpacing": "{typography.scale.xl.letterSpacing}"
|
|
5067
5156
|
},
|
|
5068
5157
|
"h5": {
|
|
5069
|
-
"fontFamily": "{typography.families.
|
|
5158
|
+
"fontFamily": "{typography.families.heading}",
|
|
5070
5159
|
"fontSize": "{typography.scale.xl.fontSize}",
|
|
5071
5160
|
"lineHeight": "{typography.scale.xl.lineHeight}",
|
|
5072
5161
|
"fontWeight": 600,
|
|
5073
5162
|
"letterSpacing": "{typography.scale.xl.letterSpacing}"
|
|
5074
5163
|
},
|
|
5075
5164
|
"h6": {
|
|
5076
|
-
"fontFamily": "{typography.families.
|
|
5165
|
+
"fontFamily": "{typography.families.heading}",
|
|
5077
5166
|
"fontSize": "{typography.scale.xl.fontSize}",
|
|
5078
5167
|
"lineHeight": "{typography.scale.xl.lineHeight}",
|
|
5079
5168
|
"fontWeight": 600,
|
|
@@ -5081,7 +5170,7 @@ var coreTokens = {
|
|
|
5081
5170
|
}
|
|
5082
5171
|
},
|
|
5083
5172
|
"body": {
|
|
5084
|
-
"fontFamily": "{typography.families.
|
|
5173
|
+
"fontFamily": "{typography.families.body}",
|
|
5085
5174
|
"fontSize": "{typography.scale.md.fontSize}",
|
|
5086
5175
|
"lineHeight": "{typography.scale.md.lineHeight}",
|
|
5087
5176
|
"fontWeight": 400,
|
|
@@ -5089,42 +5178,42 @@ var coreTokens = {
|
|
|
5089
5178
|
},
|
|
5090
5179
|
"display": {
|
|
5091
5180
|
"1": {
|
|
5092
|
-
"fontFamily": "{typography.families.
|
|
5181
|
+
"fontFamily": "{typography.families.heading}",
|
|
5093
5182
|
"fontSize": "{typography.scale.4xl.fontSize}",
|
|
5094
5183
|
"lineHeight": "{typography.scale.4xl.lineHeight}",
|
|
5095
5184
|
"fontWeight": 800,
|
|
5096
5185
|
"letterSpacing": "{typography.scale.4xl.letterSpacing}"
|
|
5097
5186
|
},
|
|
5098
5187
|
"2": {
|
|
5099
|
-
"fontFamily": "{typography.families.
|
|
5188
|
+
"fontFamily": "{typography.families.heading}",
|
|
5100
5189
|
"fontSize": "{typography.scale.4xl.fontSize}",
|
|
5101
5190
|
"lineHeight": "{typography.scale.4xl.lineHeight}",
|
|
5102
5191
|
"fontWeight": 800,
|
|
5103
5192
|
"letterSpacing": "{typography.scale.4xl.letterSpacing}"
|
|
5104
5193
|
},
|
|
5105
5194
|
"3": {
|
|
5106
|
-
"fontFamily": "{typography.families.
|
|
5195
|
+
"fontFamily": "{typography.families.heading}",
|
|
5107
5196
|
"fontSize": "{typography.scale.4xl.fontSize}",
|
|
5108
5197
|
"lineHeight": "{typography.scale.4xl.lineHeight}",
|
|
5109
5198
|
"fontWeight": 700,
|
|
5110
5199
|
"letterSpacing": "{typography.scale.4xl.letterSpacing}"
|
|
5111
5200
|
},
|
|
5112
5201
|
"4": {
|
|
5113
|
-
"fontFamily": "{typography.families.
|
|
5202
|
+
"fontFamily": "{typography.families.heading}",
|
|
5114
5203
|
"fontSize": "{typography.scale.4xl.fontSize}",
|
|
5115
5204
|
"lineHeight": "{typography.scale.4xl.lineHeight}",
|
|
5116
5205
|
"fontWeight": 700,
|
|
5117
5206
|
"letterSpacing": "{typography.scale.4xl.letterSpacing}"
|
|
5118
5207
|
},
|
|
5119
5208
|
"5": {
|
|
5120
|
-
"fontFamily": "{typography.families.
|
|
5209
|
+
"fontFamily": "{typography.families.heading}",
|
|
5121
5210
|
"fontSize": "{typography.scale.3xl.fontSize}",
|
|
5122
5211
|
"lineHeight": "{typography.scale.3xl.lineHeight}",
|
|
5123
5212
|
"fontWeight": 600,
|
|
5124
5213
|
"letterSpacing": "{typography.scale.3xl.letterSpacing}"
|
|
5125
5214
|
},
|
|
5126
5215
|
"6": {
|
|
5127
|
-
"fontFamily": "{typography.families.
|
|
5216
|
+
"fontFamily": "{typography.families.heading}",
|
|
5128
5217
|
"fontSize": "{typography.scale.2xl.fontSize}",
|
|
5129
5218
|
"lineHeight": "{typography.scale.2xl.lineHeight}",
|
|
5130
5219
|
"fontWeight": 600,
|
|
@@ -5132,7 +5221,7 @@ var coreTokens = {
|
|
|
5132
5221
|
}
|
|
5133
5222
|
},
|
|
5134
5223
|
"lead": {
|
|
5135
|
-
"fontFamily": "{typography.families.
|
|
5224
|
+
"fontFamily": "{typography.families.body}",
|
|
5136
5225
|
"fontSize": "{typography.scale.xl.fontSize}",
|
|
5137
5226
|
"lineHeight": "{typography.scale.xl.lineHeight}",
|
|
5138
5227
|
"fontWeight": 400,
|
|
@@ -5464,8 +5553,12 @@ var createCssVariableMap = (tokens2, options = {}) => {
|
|
|
5464
5553
|
assign(toVariableName(prefix, "aspect-ratio", key), value);
|
|
5465
5554
|
});
|
|
5466
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
|
+
};
|
|
5467
5560
|
Object.entries(baseTokens.typography.families).forEach(([key, value]) => {
|
|
5468
|
-
assign(toVariableName(prefix, "font-family", key), value);
|
|
5561
|
+
assign(toVariableName(prefix, "font-family", key), familyReference(value) ?? value);
|
|
5469
5562
|
});
|
|
5470
5563
|
const typographyScale = baseTokens.typography?.scale ?? {};
|
|
5471
5564
|
const fontScale = baseTokens.font;
|
|
@@ -5488,7 +5581,8 @@ var createCssVariableMap = (tokens2, options = {}) => {
|
|
|
5488
5581
|
});
|
|
5489
5582
|
const assignRole = (rolePrefixParts, entry) => {
|
|
5490
5583
|
Object.entries(ROLE_FIELD_SUFFIXES).forEach(([field, suffix]) => {
|
|
5491
|
-
|
|
5584
|
+
const value = entry[field];
|
|
5585
|
+
assign(toVariableName(prefix, ...rolePrefixParts, suffix), field === "fontFamily" && familyReference(value) || value);
|
|
5492
5586
|
});
|
|
5493
5587
|
};
|
|
5494
5588
|
const heading = baseTokens.typography?.heading;
|
|
@@ -5538,6 +5632,17 @@ var createCssVariableMap = (tokens2, options = {}) => {
|
|
|
5538
5632
|
Object.entries(baseTokens.opacity).forEach(([key, value]) => {
|
|
5539
5633
|
assign(toVariableName(prefix, "opacity", key), value);
|
|
5540
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
|
+
}
|
|
5541
5646
|
assign(toVariableName(prefix, "focus-ring-width"), baseTokens.accessibility.focusRing.width);
|
|
5542
5647
|
assign(toVariableName(prefix, "focus-ring-offset"), baseTokens.accessibility.focusRing.offset);
|
|
5543
5648
|
assign(toVariableName(prefix, "focus-ring-style"), baseTokens.accessibility.focusRing.style);
|
|
@@ -5683,6 +5788,23 @@ var generateCssVariables = (tokens2, options = {}) => {
|
|
|
5683
5788
|
addDark(varName, actionValue(getPath(darkAction, [key]) ?? value));
|
|
5684
5789
|
addHighContrast(varName, actionValue(getPath(highContrastAction, [key]) ?? value));
|
|
5685
5790
|
});
|
|
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
|
+
});
|
|
5686
5808
|
const addButtonOverrides = (mode, add) => {
|
|
5687
5809
|
const buttons = getPath(mode, ["buttons"]);
|
|
5688
5810
|
if (!isPlainObject(buttons)) return;
|