@phcdevworks/spectre-tokens 2.2.0 → 2.4.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 +196 -23
- package/dist/index.cjs +68 -236
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +19 -25
- package/dist/index.d.cts +11 -1
- package/dist/index.d.ts +11 -1
- package/dist/index.js +68 -236
- package/dist/index.js.map +1 -1
- package/package.json +18 -11
- package/tokens/components.json +23 -17
- package/tokens/modes.json +20 -20
- package/tokens/primitives.json +3 -3
- package/tokens/typography.json +2 -1
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ var coreTokens = {
|
|
|
3
3
|
"component": {
|
|
4
4
|
"card": {
|
|
5
5
|
"text": "{colors.neutral.900}",
|
|
6
|
-
"textMuted": "{colors.neutral.
|
|
6
|
+
"textMuted": "{colors.neutral.600}"
|
|
7
7
|
},
|
|
8
8
|
"input": {
|
|
9
9
|
"text": "{colors.neutral.900}",
|
|
@@ -44,8 +44,8 @@ var coreTokens = {
|
|
|
44
44
|
"border": "{colors.neutral.200}",
|
|
45
45
|
"text": "{colors.neutral.700}",
|
|
46
46
|
"authorName": "{colors.neutral.900}",
|
|
47
|
-
"authorTitle": "{colors.neutral.
|
|
48
|
-
"quoteMark": "{colors.neutral.
|
|
47
|
+
"authorTitle": "{colors.neutral.600}",
|
|
48
|
+
"quoteMark": "{colors.neutral.600}"
|
|
49
49
|
},
|
|
50
50
|
"pricingCard": {
|
|
51
51
|
"bg": "{colors.white}",
|
|
@@ -56,7 +56,7 @@ var coreTokens = {
|
|
|
56
56
|
"featuredBadgeBg": "{colors.warning.500}",
|
|
57
57
|
"featuredBadgeText": "{colors.neutral.900}",
|
|
58
58
|
"price": "{colors.neutral.900}",
|
|
59
|
-
"priceDescription": "{colors.neutral.
|
|
59
|
+
"priceDescription": "{colors.neutral.600}"
|
|
60
60
|
},
|
|
61
61
|
"rating": {
|
|
62
62
|
"starFilled": "{colors.warning.500}",
|
|
@@ -73,7 +73,7 @@ var coreTokens = {
|
|
|
73
73
|
"text": "{colors.white}",
|
|
74
74
|
"textDisabled": "{colors.neutral.400}",
|
|
75
75
|
"focusRing": "{colors.info.500} / 0.4",
|
|
76
|
-
"focusVisible": "{
|
|
76
|
+
"focusVisible": "{colors.info.500} / 0.4"
|
|
77
77
|
},
|
|
78
78
|
"secondary": {
|
|
79
79
|
"bg": "{colors.white}",
|
|
@@ -85,7 +85,7 @@ var coreTokens = {
|
|
|
85
85
|
"border": "{colors.info.700}",
|
|
86
86
|
"borderDisabled": "{colors.neutral.200}",
|
|
87
87
|
"focusRing": "{colors.info.500} / 0.4",
|
|
88
|
-
"focusVisible": "{
|
|
88
|
+
"focusVisible": "{colors.info.500} / 0.4"
|
|
89
89
|
},
|
|
90
90
|
"ghost": {
|
|
91
91
|
"bg": "transparent",
|
|
@@ -95,7 +95,7 @@ var coreTokens = {
|
|
|
95
95
|
"text": "{colors.info.700}",
|
|
96
96
|
"textDisabled": "{colors.neutral.400}",
|
|
97
97
|
"focusRing": "{colors.info.500} / 0.4",
|
|
98
|
-
"focusVisible": "{
|
|
98
|
+
"focusVisible": "{colors.info.500} / 0.4"
|
|
99
99
|
},
|
|
100
100
|
"danger": {
|
|
101
101
|
"bg": "{colors.error.600}",
|
|
@@ -133,7 +133,7 @@ var coreTokens = {
|
|
|
133
133
|
"text": "{colors.white}",
|
|
134
134
|
"textDisabled": "{colors.neutral.400}",
|
|
135
135
|
"focusRing": "{colors.accent.500} / 0.4",
|
|
136
|
-
"focusVisible": "{
|
|
136
|
+
"focusVisible": "{colors.accent.500} / 0.4"
|
|
137
137
|
}
|
|
138
138
|
},
|
|
139
139
|
"forms": {
|
|
@@ -151,8 +151,8 @@ var coreTokens = {
|
|
|
151
151
|
"ring": "{colors.info.500}"
|
|
152
152
|
},
|
|
153
153
|
"focusVisible": {
|
|
154
|
-
"border": "{
|
|
155
|
-
"ring": "{
|
|
154
|
+
"border": "{colors.info.500}",
|
|
155
|
+
"ring": "{colors.info.500}"
|
|
156
156
|
},
|
|
157
157
|
"valid": {
|
|
158
158
|
"border": "{colors.success.500}",
|
|
@@ -237,8 +237,8 @@ var coreTokens = {
|
|
|
237
237
|
"border": "{colors.neutral.200}",
|
|
238
238
|
"text": "{colors.neutral.700}",
|
|
239
239
|
"authorName": "{colors.neutral.900}",
|
|
240
|
-
"authorTitle": "{colors.neutral.
|
|
241
|
-
"quoteMark": "{colors.neutral.
|
|
240
|
+
"authorTitle": "{colors.neutral.600}",
|
|
241
|
+
"quoteMark": "{colors.neutral.600}"
|
|
242
242
|
},
|
|
243
243
|
"pricingCard": {
|
|
244
244
|
"bg": "{colors.white}",
|
|
@@ -249,7 +249,7 @@ var coreTokens = {
|
|
|
249
249
|
"featuredBadgeBg": "{colors.warning.500}",
|
|
250
250
|
"featuredBadgeText": "{colors.neutral.900}",
|
|
251
251
|
"price": "{colors.neutral.900}",
|
|
252
|
-
"priceDescription": "{colors.neutral.
|
|
252
|
+
"priceDescription": "{colors.neutral.600}"
|
|
253
253
|
},
|
|
254
254
|
"rating": {
|
|
255
255
|
"starFilled": "{colors.warning.500}",
|
|
@@ -263,9 +263,9 @@ var coreTokens = {
|
|
|
263
263
|
"page": "{colors.neutral.900}",
|
|
264
264
|
"card": "{colors.neutral.800}",
|
|
265
265
|
"input": "{colors.neutral.700}",
|
|
266
|
-
"overlay": "{colors.
|
|
266
|
+
"overlay": "{colors.black} / 0.6",
|
|
267
267
|
"alternate": "{colors.neutral.800}",
|
|
268
|
-
"hero": "linear-gradient(135deg, {colors.accent.
|
|
268
|
+
"hero": "linear-gradient(135deg, {colors.accent.700} 0%, {colors.accent.900} 100%)"
|
|
269
269
|
},
|
|
270
270
|
"text": {
|
|
271
271
|
"onPage": {
|
|
@@ -327,8 +327,8 @@ var coreTokens = {
|
|
|
327
327
|
"border": "{colors.neutral.700}",
|
|
328
328
|
"text": "{colors.neutral.200}",
|
|
329
329
|
"authorName": "{colors.neutral.100}",
|
|
330
|
-
"authorTitle": "{colors.neutral.
|
|
331
|
-
"quoteMark": "{colors.neutral.
|
|
330
|
+
"authorTitle": "{colors.neutral.300}",
|
|
331
|
+
"quoteMark": "{colors.neutral.300}"
|
|
332
332
|
},
|
|
333
333
|
"pricingCard": {
|
|
334
334
|
"bg": "{colors.neutral.800}",
|
|
@@ -339,7 +339,7 @@ var coreTokens = {
|
|
|
339
339
|
"featuredBadgeBg": "{colors.warning.500}",
|
|
340
340
|
"featuredBadgeText": "{colors.neutral.900}",
|
|
341
341
|
"price": "{colors.neutral.100}",
|
|
342
|
-
"priceDescription": "{colors.neutral.
|
|
342
|
+
"priceDescription": "{colors.neutral.300}"
|
|
343
343
|
},
|
|
344
344
|
"rating": {
|
|
345
345
|
"starFilled": "{colors.warning.400}",
|
|
@@ -474,9 +474,9 @@ var coreTokens = {
|
|
|
474
474
|
},
|
|
475
475
|
"shadows": {
|
|
476
476
|
"none": "none",
|
|
477
|
-
"sm": "0 1px 2px 0 {colors.
|
|
478
|
-
"md": "0 2px 6px -1px {colors.
|
|
479
|
-
"lg": "0 6px 16px -4px {colors.
|
|
477
|
+
"sm": "0 1px 2px 0 {colors.black} / 0.06",
|
|
478
|
+
"md": "0 2px 6px -1px {colors.black} / 0.08",
|
|
479
|
+
"lg": "0 6px 16px -4px {colors.black} / 0.12"
|
|
480
480
|
},
|
|
481
481
|
"breakpoints": {
|
|
482
482
|
"sm": "640px",
|
|
@@ -649,7 +649,8 @@ var coreTokens = {
|
|
|
649
649
|
"xs": {
|
|
650
650
|
"size": "0.75rem",
|
|
651
651
|
"lineHeight": "1.25rem",
|
|
652
|
-
"weight": 400
|
|
652
|
+
"weight": 400,
|
|
653
|
+
"letterSpacing": "0.02em"
|
|
653
654
|
},
|
|
654
655
|
"sm": {
|
|
655
656
|
"size": "0.875rem",
|
|
@@ -833,6 +834,10 @@ var createCssVariableMap = (tokens2, options = {}) => {
|
|
|
833
834
|
map[name] = resolveValue(tokens2, value);
|
|
834
835
|
};
|
|
835
836
|
Object.entries(baseTokens.colors).forEach(([group, scale]) => {
|
|
837
|
+
if (typeof scale === "string" || typeof scale === "number") {
|
|
838
|
+
assign(toVariableName(prefix, "color", group), scale);
|
|
839
|
+
return;
|
|
840
|
+
}
|
|
836
841
|
Object.entries(scale).forEach(([step, value]) => {
|
|
837
842
|
assign(toVariableName(prefix, "color", group, step), value);
|
|
838
843
|
});
|
|
@@ -990,229 +995,56 @@ var generateCssVariables = (tokens2, options = {}) => {
|
|
|
990
995
|
const surfaceAliases = tokens2.surface ?? {};
|
|
991
996
|
const textAliases = tokens2.text ?? {};
|
|
992
997
|
const componentAliases = tokens2.component ?? {};
|
|
998
|
+
const semanticEntries = [
|
|
999
|
+
{ varParts: ["surface", "page"], modePath: ["surface", "page"], aliasSrc: surfaceAliases, aliasPath: ["page"] },
|
|
1000
|
+
{ varParts: ["surface", "card"], modePath: ["surface", "card"], aliasSrc: surfaceAliases, aliasPath: ["card"] },
|
|
1001
|
+
{ varParts: ["surface", "input"], modePath: ["surface", "input"], aliasSrc: surfaceAliases, aliasPath: ["input"] },
|
|
1002
|
+
{ varParts: ["surface", "overlay"], modePath: ["surface", "overlay"], aliasSrc: surfaceAliases, aliasPath: ["overlay"] },
|
|
1003
|
+
{ varParts: ["surface", "alternate"], modePath: ["surface", "alternate"] },
|
|
1004
|
+
{ varParts: ["surface", "hero"], modePath: ["surface", "hero"], aliasSrc: surfaceAliases, aliasPath: ["hero"] },
|
|
1005
|
+
{ varParts: ["text", "on", "page", "default"], modePath: ["text", "onPage", "default"], aliasSrc: textAliases, aliasPath: ["onPage", "default"] },
|
|
1006
|
+
{ varParts: ["text", "on", "page", "muted"], modePath: ["text", "onPage", "muted"], aliasSrc: textAliases, aliasPath: ["onPage", "muted"] },
|
|
1007
|
+
{ varParts: ["text", "on", "page", "subtle"], modePath: ["text", "onPage", "subtle"], aliasSrc: textAliases, aliasPath: ["onPage", "subtle"] },
|
|
1008
|
+
{ varParts: ["text", "on", "page", "meta"], modePath: ["text", "onPage", "meta"], aliasSrc: textAliases, aliasPath: ["onPage", "meta"] },
|
|
1009
|
+
{ varParts: ["text", "on", "page", "brand"], modePath: ["text", "onPage", "brand"], aliasSrc: textAliases, aliasPath: ["onPage", "brand"] },
|
|
1010
|
+
{ varParts: ["text", "on", "surface", "default"], modePath: ["text", "onSurface", "default"], aliasSrc: textAliases, aliasPath: ["onSurface", "default"] },
|
|
1011
|
+
{ varParts: ["text", "on", "surface", "muted"], modePath: ["text", "onSurface", "muted"], aliasSrc: textAliases, aliasPath: ["onSurface", "muted"] },
|
|
1012
|
+
{ varParts: ["text", "on", "surface", "subtle"], modePath: ["text", "onSurface", "subtle"], aliasSrc: textAliases, aliasPath: ["onSurface", "subtle"] },
|
|
1013
|
+
{ varParts: ["text", "on", "surface", "meta"], modePath: ["text", "onSurface", "meta"], aliasSrc: textAliases, aliasPath: ["onSurface", "meta"] },
|
|
1014
|
+
{ varParts: ["text", "on", "surface", "brand"], modePath: ["text", "onSurface", "brand"], aliasSrc: textAliases, aliasPath: ["onSurface", "brand"] },
|
|
1015
|
+
{ varParts: ["component", "card", "text"], modePath: ["component", "card", "text"], aliasSrc: componentAliases, aliasPath: ["card", "text"] },
|
|
1016
|
+
{ varParts: ["component", "card", "text-muted"], modePath: ["component", "card", "textMuted"], aliasSrc: componentAliases, aliasPath: ["card", "textMuted"] },
|
|
1017
|
+
{ varParts: ["component", "input", "text"], modePath: ["component", "input", "text"], aliasSrc: componentAliases, aliasPath: ["input", "text"] },
|
|
1018
|
+
{ varParts: ["component", "input", "placeholder"], modePath: ["component", "input", "placeholder"], aliasSrc: componentAliases, aliasPath: ["input", "placeholder"] },
|
|
1019
|
+
{ varParts: ["button", "text", "default"], modePath: ["component", "button", "textDefault"], aliasSrc: componentAliases, aliasPath: ["button", "textDefault"] },
|
|
1020
|
+
{ varParts: ["button", "text", "on", "primary"], modePath: ["component", "button", "textOnPrimary"], aliasSrc: componentAliases, aliasPath: ["button", "textOnPrimary"] },
|
|
1021
|
+
...BADGE_VARIANTS.flatMap(({ variant, bgKey, textKey }) => [
|
|
1022
|
+
{ varParts: ["badge", variant, "bg"], modePath: ["component", "badge", bgKey], aliasSrc: componentAliases, aliasPath: ["badge", bgKey] },
|
|
1023
|
+
{ varParts: ["badge", variant, "text"], modePath: ["component", "badge", textKey], aliasSrc: componentAliases, aliasPath: ["badge", textKey] }
|
|
1024
|
+
]),
|
|
1025
|
+
...ICON_BOX_FIELDS.map(({ name, tokenKey }) => ({
|
|
1026
|
+
varParts: ["icon-box", name],
|
|
1027
|
+
modePath: ["component", "iconBox", tokenKey],
|
|
1028
|
+
aliasSrc: componentAliases,
|
|
1029
|
+
aliasPath: ["iconBox", tokenKey]
|
|
1030
|
+
}))
|
|
1031
|
+
];
|
|
993
1032
|
const baseLines = [];
|
|
1033
|
+
const darkLines = [];
|
|
994
1034
|
const addBase = (name, value) => {
|
|
995
1035
|
if (value !== void 0) baseLines.push(` ${name}: ${value};`);
|
|
996
1036
|
};
|
|
997
|
-
addBase(toVariableName(prefix, "surface", "page"), pickSemantic(tokens2, getPath(defaultMode, ["surface", "page"]), getPath(surfaceAliases, ["page"])));
|
|
998
|
-
addBase(toVariableName(prefix, "surface", "card"), pickSemantic(tokens2, getPath(defaultMode, ["surface", "card"]), getPath(surfaceAliases, ["card"])));
|
|
999
|
-
addBase(toVariableName(prefix, "surface", "input"), pickSemantic(tokens2, getPath(defaultMode, ["surface", "input"]), getPath(surfaceAliases, ["input"])));
|
|
1000
|
-
addBase(toVariableName(prefix, "surface", "overlay"), pickSemantic(tokens2, getPath(defaultMode, ["surface", "overlay"]), getPath(surfaceAliases, ["overlay"])));
|
|
1001
|
-
addBase(toVariableName(prefix, "surface", "hero"), pickSemantic(tokens2, getPath(defaultMode, ["surface", "hero"]), getPath(surfaceAliases, ["hero"])));
|
|
1002
|
-
addBase(toVariableName(prefix, "text", "on", "page", "default"), pickSemantic(tokens2, getPath(defaultMode, ["text", "onPage", "default"]), getPath(textAliases, ["onPage", "default"])));
|
|
1003
|
-
addBase(toVariableName(prefix, "text", "on", "page", "muted"), pickSemantic(tokens2, getPath(defaultMode, ["text", "onPage", "muted"]), getPath(textAliases, ["onPage", "muted"])));
|
|
1004
|
-
addBase(toVariableName(prefix, "text", "on", "page", "subtle"), pickSemantic(tokens2, getPath(defaultMode, ["text", "onPage", "subtle"]), getPath(textAliases, ["onPage", "subtle"])));
|
|
1005
|
-
addBase(toVariableName(prefix, "text", "on", "page", "meta"), pickSemantic(tokens2, getPath(defaultMode, ["text", "onPage", "meta"]), getPath(textAliases, ["onPage", "meta"])));
|
|
1006
|
-
addBase(toVariableName(prefix, "text", "on", "surface", "default"), pickSemantic(tokens2, getPath(defaultMode, ["text", "onSurface", "default"]), getPath(textAliases, ["onSurface", "default"])));
|
|
1007
|
-
addBase(toVariableName(prefix, "text", "on", "surface", "muted"), pickSemantic(tokens2, getPath(defaultMode, ["text", "onSurface", "muted"]), getPath(textAliases, ["onSurface", "muted"])));
|
|
1008
|
-
addBase(toVariableName(prefix, "text", "on", "surface", "subtle"), pickSemantic(tokens2, getPath(defaultMode, ["text", "onSurface", "subtle"]), getPath(textAliases, ["onSurface", "subtle"])));
|
|
1009
|
-
addBase(toVariableName(prefix, "text", "on", "surface", "meta"), pickSemantic(tokens2, getPath(defaultMode, ["text", "onSurface", "meta"]), getPath(textAliases, ["onSurface", "meta"])));
|
|
1010
|
-
addBase(toVariableName(prefix, "component", "card", "text"), pickSemantic(tokens2, getPath(defaultMode, ["component", "card", "text"]), getPath(componentAliases, ["card", "text"])));
|
|
1011
|
-
addBase(toVariableName(prefix, "component", "card", "text-muted"), pickSemantic(tokens2, getPath(defaultMode, ["component", "card", "textMuted"]), getPath(componentAliases, ["card", "textMuted"])));
|
|
1012
|
-
addBase(toVariableName(prefix, "component", "input", "text"), pickSemantic(tokens2, getPath(defaultMode, ["component", "input", "text"]), getPath(componentAliases, ["input", "text"])));
|
|
1013
|
-
addBase(toVariableName(prefix, "component", "input", "placeholder"), pickSemantic(tokens2, getPath(defaultMode, ["component", "input", "placeholder"]), getPath(componentAliases, ["input", "placeholder"])));
|
|
1014
|
-
addBase(toVariableName(prefix, "button", "text", "default"), pickSemantic(tokens2, getPath(defaultMode, ["component", "button", "textDefault"]), getPath(componentAliases, ["button", "textDefault"])));
|
|
1015
|
-
addBase(toVariableName(prefix, "button", "text", "on", "primary"), pickSemantic(tokens2, getPath(defaultMode, ["component", "button", "textOnPrimary"]), getPath(componentAliases, ["button", "textOnPrimary"])));
|
|
1016
|
-
BADGE_VARIANTS.forEach(({ variant, bgKey, textKey }) => {
|
|
1017
|
-
addBase(
|
|
1018
|
-
toVariableName(prefix, "badge", variant, "bg"),
|
|
1019
|
-
pickSemantic(tokens2, getPath(defaultMode, ["component", "badge", bgKey]), getPath(componentAliases, ["badge", bgKey]))
|
|
1020
|
-
);
|
|
1021
|
-
addBase(
|
|
1022
|
-
toVariableName(prefix, "badge", variant, "text"),
|
|
1023
|
-
pickSemantic(tokens2, getPath(defaultMode, ["component", "badge", textKey]), getPath(componentAliases, ["badge", textKey]))
|
|
1024
|
-
);
|
|
1025
|
-
});
|
|
1026
|
-
ICON_BOX_FIELDS.forEach(({ name, tokenKey }) => {
|
|
1027
|
-
addBase(
|
|
1028
|
-
toVariableName(prefix, "icon-box", name),
|
|
1029
|
-
pickSemantic(tokens2, getPath(defaultMode, ["component", "iconBox", tokenKey]), getPath(componentAliases, ["iconBox", tokenKey]))
|
|
1030
|
-
);
|
|
1031
|
-
});
|
|
1032
|
-
const rootLines = [...baseLines, ...mapLines];
|
|
1033
|
-
const darkLines = [];
|
|
1034
1037
|
const addDark = (name, value) => {
|
|
1035
1038
|
if (value !== void 0) darkLines.push(` ${name}: ${value};`);
|
|
1036
1039
|
};
|
|
1037
|
-
|
|
1038
|
-
toVariableName(prefix,
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
toVariableName(prefix, "surface", "card"),
|
|
1043
|
-
pickSemantic(tokens2, getPath(darkMode, ["surface", "card"]), getPath(defaultMode, ["surface", "card"]), getPath(surfaceAliases, ["card"]))
|
|
1044
|
-
);
|
|
1045
|
-
addDark(
|
|
1046
|
-
toVariableName(prefix, "surface", "input"),
|
|
1047
|
-
pickSemantic(tokens2, getPath(darkMode, ["surface", "input"]), getPath(defaultMode, ["surface", "input"]), getPath(surfaceAliases, ["input"]))
|
|
1048
|
-
);
|
|
1049
|
-
addDark(
|
|
1050
|
-
toVariableName(prefix, "surface", "overlay"),
|
|
1051
|
-
pickSemantic(tokens2, getPath(darkMode, ["surface", "overlay"]), getPath(defaultMode, ["surface", "overlay"]), getPath(surfaceAliases, ["overlay"]))
|
|
1052
|
-
);
|
|
1053
|
-
addDark(
|
|
1054
|
-
toVariableName(prefix, "surface", "hero"),
|
|
1055
|
-
pickSemantic(tokens2, getPath(darkMode, ["surface", "hero"]), getPath(defaultMode, ["surface", "hero"]), getPath(surfaceAliases, ["hero"]))
|
|
1056
|
-
);
|
|
1057
|
-
addDark(
|
|
1058
|
-
toVariableName(prefix, "text", "on", "page", "default"),
|
|
1059
|
-
pickSemantic(
|
|
1060
|
-
tokens2,
|
|
1061
|
-
getPath(darkMode, ["text", "onPage", "default"]),
|
|
1062
|
-
getPath(defaultMode, ["text", "onPage", "default"]),
|
|
1063
|
-
getPath(textAliases, ["onPage", "default"])
|
|
1064
|
-
)
|
|
1065
|
-
);
|
|
1066
|
-
addDark(
|
|
1067
|
-
toVariableName(prefix, "text", "on", "page", "muted"),
|
|
1068
|
-
pickSemantic(
|
|
1069
|
-
tokens2,
|
|
1070
|
-
getPath(darkMode, ["text", "onPage", "muted"]),
|
|
1071
|
-
getPath(defaultMode, ["text", "onPage", "muted"]),
|
|
1072
|
-
getPath(textAliases, ["onPage", "muted"])
|
|
1073
|
-
)
|
|
1074
|
-
);
|
|
1075
|
-
addDark(
|
|
1076
|
-
toVariableName(prefix, "text", "on", "page", "subtle"),
|
|
1077
|
-
pickSemantic(
|
|
1078
|
-
tokens2,
|
|
1079
|
-
getPath(darkMode, ["text", "onPage", "subtle"]),
|
|
1080
|
-
getPath(defaultMode, ["text", "onPage", "subtle"]),
|
|
1081
|
-
getPath(textAliases, ["onPage", "subtle"])
|
|
1082
|
-
)
|
|
1083
|
-
);
|
|
1084
|
-
addDark(
|
|
1085
|
-
toVariableName(prefix, "text", "on", "page", "meta"),
|
|
1086
|
-
pickSemantic(
|
|
1087
|
-
tokens2,
|
|
1088
|
-
getPath(darkMode, ["text", "onPage", "meta"]),
|
|
1089
|
-
getPath(defaultMode, ["text", "onPage", "meta"]),
|
|
1090
|
-
getPath(textAliases, ["onPage", "meta"])
|
|
1091
|
-
)
|
|
1092
|
-
);
|
|
1093
|
-
addDark(
|
|
1094
|
-
toVariableName(prefix, "text", "on", "surface", "default"),
|
|
1095
|
-
pickSemantic(
|
|
1096
|
-
tokens2,
|
|
1097
|
-
getPath(darkMode, ["text", "onSurface", "default"]),
|
|
1098
|
-
getPath(defaultMode, ["text", "onSurface", "default"]),
|
|
1099
|
-
getPath(textAliases, ["onSurface", "default"])
|
|
1100
|
-
)
|
|
1101
|
-
);
|
|
1102
|
-
addDark(
|
|
1103
|
-
toVariableName(prefix, "text", "on", "surface", "muted"),
|
|
1104
|
-
pickSemantic(
|
|
1105
|
-
tokens2,
|
|
1106
|
-
getPath(darkMode, ["text", "onSurface", "muted"]),
|
|
1107
|
-
getPath(defaultMode, ["text", "onSurface", "muted"]),
|
|
1108
|
-
getPath(textAliases, ["onSurface", "muted"])
|
|
1109
|
-
)
|
|
1110
|
-
);
|
|
1111
|
-
addDark(
|
|
1112
|
-
toVariableName(prefix, "text", "on", "surface", "subtle"),
|
|
1113
|
-
pickSemantic(
|
|
1114
|
-
tokens2,
|
|
1115
|
-
getPath(darkMode, ["text", "onSurface", "subtle"]),
|
|
1116
|
-
getPath(defaultMode, ["text", "onSurface", "subtle"]),
|
|
1117
|
-
getPath(textAliases, ["onSurface", "subtle"])
|
|
1118
|
-
)
|
|
1119
|
-
);
|
|
1120
|
-
addDark(
|
|
1121
|
-
toVariableName(prefix, "text", "on", "surface", "meta"),
|
|
1122
|
-
pickSemantic(
|
|
1123
|
-
tokens2,
|
|
1124
|
-
getPath(darkMode, ["text", "onSurface", "meta"]),
|
|
1125
|
-
getPath(defaultMode, ["text", "onSurface", "meta"]),
|
|
1126
|
-
getPath(textAliases, ["onSurface", "meta"])
|
|
1127
|
-
)
|
|
1128
|
-
);
|
|
1129
|
-
addDark(
|
|
1130
|
-
toVariableName(prefix, "component", "card", "text"),
|
|
1131
|
-
pickSemantic(
|
|
1132
|
-
tokens2,
|
|
1133
|
-
getPath(darkMode, ["component", "card", "text"]),
|
|
1134
|
-
getPath(defaultMode, ["component", "card", "text"]),
|
|
1135
|
-
getPath(componentAliases, ["card", "text"])
|
|
1136
|
-
)
|
|
1137
|
-
);
|
|
1138
|
-
addDark(
|
|
1139
|
-
toVariableName(prefix, "component", "card", "text-muted"),
|
|
1140
|
-
pickSemantic(
|
|
1141
|
-
tokens2,
|
|
1142
|
-
getPath(darkMode, ["component", "card", "textMuted"]),
|
|
1143
|
-
getPath(defaultMode, ["component", "card", "textMuted"]),
|
|
1144
|
-
getPath(componentAliases, ["card", "textMuted"])
|
|
1145
|
-
)
|
|
1146
|
-
);
|
|
1147
|
-
addDark(
|
|
1148
|
-
toVariableName(prefix, "component", "input", "text"),
|
|
1149
|
-
pickSemantic(
|
|
1150
|
-
tokens2,
|
|
1151
|
-
getPath(darkMode, ["component", "input", "text"]),
|
|
1152
|
-
getPath(defaultMode, ["component", "input", "text"]),
|
|
1153
|
-
getPath(componentAliases, ["input", "text"])
|
|
1154
|
-
)
|
|
1155
|
-
);
|
|
1156
|
-
addDark(
|
|
1157
|
-
toVariableName(prefix, "component", "input", "placeholder"),
|
|
1158
|
-
pickSemantic(
|
|
1159
|
-
tokens2,
|
|
1160
|
-
getPath(darkMode, ["component", "input", "placeholder"]),
|
|
1161
|
-
getPath(defaultMode, ["component", "input", "placeholder"]),
|
|
1162
|
-
getPath(componentAliases, ["input", "placeholder"])
|
|
1163
|
-
)
|
|
1164
|
-
);
|
|
1165
|
-
addDark(
|
|
1166
|
-
toVariableName(prefix, "button", "text", "default"),
|
|
1167
|
-
pickSemantic(
|
|
1168
|
-
tokens2,
|
|
1169
|
-
getPath(darkMode, ["component", "button", "textDefault"]),
|
|
1170
|
-
getPath(defaultMode, ["component", "button", "textDefault"]),
|
|
1171
|
-
getPath(componentAliases, ["button", "textDefault"])
|
|
1172
|
-
)
|
|
1173
|
-
);
|
|
1174
|
-
addDark(
|
|
1175
|
-
toVariableName(prefix, "button", "text", "on", "primary"),
|
|
1176
|
-
pickSemantic(
|
|
1177
|
-
tokens2,
|
|
1178
|
-
getPath(darkMode, ["component", "button", "textOnPrimary"]),
|
|
1179
|
-
getPath(defaultMode, ["component", "button", "textOnPrimary"]),
|
|
1180
|
-
getPath(componentAliases, ["button", "textOnPrimary"])
|
|
1181
|
-
)
|
|
1182
|
-
);
|
|
1183
|
-
BADGE_VARIANTS.forEach(({ variant, bgKey, textKey }) => {
|
|
1184
|
-
addDark(
|
|
1185
|
-
toVariableName(prefix, "badge", variant, "bg"),
|
|
1186
|
-
pickSemantic(
|
|
1187
|
-
tokens2,
|
|
1188
|
-
getPath(darkMode, ["component", "badge", bgKey]),
|
|
1189
|
-
getPath(defaultMode, ["component", "badge", bgKey]),
|
|
1190
|
-
getPath(componentAliases, ["badge", bgKey])
|
|
1191
|
-
)
|
|
1192
|
-
);
|
|
1193
|
-
addDark(
|
|
1194
|
-
toVariableName(prefix, "badge", variant, "text"),
|
|
1195
|
-
pickSemantic(
|
|
1196
|
-
tokens2,
|
|
1197
|
-
getPath(darkMode, ["component", "badge", textKey]),
|
|
1198
|
-
getPath(defaultMode, ["component", "badge", textKey]),
|
|
1199
|
-
getPath(componentAliases, ["badge", textKey])
|
|
1200
|
-
)
|
|
1201
|
-
);
|
|
1202
|
-
});
|
|
1203
|
-
ICON_BOX_FIELDS.forEach(({ name, tokenKey }) => {
|
|
1204
|
-
addDark(
|
|
1205
|
-
toVariableName(prefix, "icon-box", name),
|
|
1206
|
-
pickSemantic(
|
|
1207
|
-
tokens2,
|
|
1208
|
-
getPath(darkMode, ["component", "iconBox", tokenKey]),
|
|
1209
|
-
getPath(defaultMode, ["component", "iconBox", tokenKey]),
|
|
1210
|
-
getPath(componentAliases, ["iconBox", tokenKey])
|
|
1211
|
-
)
|
|
1212
|
-
);
|
|
1040
|
+
semanticEntries.forEach(({ varParts, modePath, aliasSrc, aliasPath }) => {
|
|
1041
|
+
const varName = toVariableName(prefix, ...varParts);
|
|
1042
|
+
const aliasCandidate = aliasSrc && aliasPath ? [getPath(aliasSrc, aliasPath)] : [];
|
|
1043
|
+
addBase(varName, pickSemantic(tokens2, getPath(defaultMode, modePath), ...aliasCandidate));
|
|
1044
|
+
addDark(varName, pickSemantic(tokens2, getPath(darkMode, modePath), getPath(defaultMode, modePath), ...aliasCandidate));
|
|
1213
1045
|
});
|
|
1214
1046
|
const rootBlock = `${selector} {
|
|
1215
|
-
${
|
|
1047
|
+
${[...baseLines, ...mapLines].join("\n")}
|
|
1216
1048
|
}`;
|
|
1217
1049
|
const darkBlock = `${selector}[data-spectre-theme="dark"] {
|
|
1218
1050
|
${darkLines.join("\n")}
|