@phcdevworks/spectre-tokens 3.3.0 → 3.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 +12 -2
- package/dist/index.cjs +77 -201
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +79 -0
- package/dist/index.d.cts +8 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +77 -201
- package/dist/index.js.map +1 -1
- package/dist/tokens.dtcg.json +200 -80
- package/package.json +18 -13
package/dist/index.css
CHANGED
|
@@ -26,8 +26,10 @@
|
|
|
26
26
|
--sp-button-text-default: #141b24;
|
|
27
27
|
--sp-button-text-on-primary: #ffffff;
|
|
28
28
|
--sp-badge-neutral-bg: #eef1f6;
|
|
29
|
+
--sp-badge-neutral-bg-hover: #d9dfeb;
|
|
29
30
|
--sp-badge-neutral-text: #374253;
|
|
30
31
|
--sp-badge-info-bg: #e0f2fe;
|
|
32
|
+
--sp-badge-info-bg-hover: #bae6fd;
|
|
31
33
|
--sp-badge-info-text: #075985;
|
|
32
34
|
--sp-badge-success-bg: #dcfce7;
|
|
33
35
|
--sp-badge-success-text: #15803d;
|
|
@@ -41,6 +43,25 @@
|
|
|
41
43
|
--sp-icon-box-icon-success: #16a34a;
|
|
42
44
|
--sp-icon-box-icon-warning: #d48806;
|
|
43
45
|
--sp-icon-box-icon-danger: #dc2626;
|
|
46
|
+
--sp-testimonial-bg: #ffffff;
|
|
47
|
+
--sp-testimonial-bg-hover: #f7f8fb;
|
|
48
|
+
--sp-testimonial-border: #d9dfeb;
|
|
49
|
+
--sp-testimonial-text: #374253;
|
|
50
|
+
--sp-testimonial-author-name: #141b24;
|
|
51
|
+
--sp-testimonial-author-title: #4b576a;
|
|
52
|
+
--sp-testimonial-quote-mark: #4b576a;
|
|
53
|
+
--sp-pricing-card-bg: #ffffff;
|
|
54
|
+
--sp-pricing-card-bg-hover: #f7f8fb;
|
|
55
|
+
--sp-pricing-card-border: #d9dfeb;
|
|
56
|
+
--sp-pricing-card-featured-bg: #0369a1;
|
|
57
|
+
--sp-pricing-card-featured-text: #ffffff;
|
|
58
|
+
--sp-pricing-card-featured-badge-bg: #f5ad00;
|
|
59
|
+
--sp-pricing-card-featured-badge-text: #141b24;
|
|
60
|
+
--sp-pricing-card-price: #141b24;
|
|
61
|
+
--sp-pricing-card-price-description: #4b576a;
|
|
62
|
+
--sp-rating-star-filled: #f5ad00;
|
|
63
|
+
--sp-rating-star-empty: #d9dfeb;
|
|
64
|
+
--sp-rating-text: #657287;
|
|
44
65
|
--sp-nav-bg: #ffffff;
|
|
45
66
|
--sp-nav-text: #141b24;
|
|
46
67
|
--sp-nav-link: #374253;
|
|
@@ -109,6 +130,17 @@
|
|
|
109
130
|
--sp-label-text: #141b24;
|
|
110
131
|
--sp-label-disabled-text: #8a96ad;
|
|
111
132
|
--sp-label-required-indicator-text: #dc2626;
|
|
133
|
+
--sp-badge-success-bg-hover: #bbf7d0;
|
|
134
|
+
--sp-badge-warning-bg-hover: #ffe08a;
|
|
135
|
+
--sp-badge-danger-bg-hover: #fecaca;
|
|
136
|
+
--sp-select-border-invalid: #ef4444;
|
|
137
|
+
--sp-select-bg-invalid: #fef2f2;
|
|
138
|
+
--sp-select-border-success: #22c55e;
|
|
139
|
+
--sp-select-bg-success: #f0fdf4;
|
|
140
|
+
--sp-textarea-border-invalid: #ef4444;
|
|
141
|
+
--sp-textarea-bg-invalid: #fef2f2;
|
|
142
|
+
--sp-textarea-border-success: #22c55e;
|
|
143
|
+
--sp-textarea-bg-success: #f0fdf4;
|
|
112
144
|
--sp-link-default: #1f57db;
|
|
113
145
|
--sp-link-hover: #1946b4;
|
|
114
146
|
--sp-link-active: #173b8f;
|
|
@@ -243,6 +275,20 @@
|
|
|
243
275
|
--sp-radius-3xl: 24px;
|
|
244
276
|
--sp-radius-4xl: 32px;
|
|
245
277
|
--sp-radius-pill: 999px;
|
|
278
|
+
--sp-icon-xs: 12px;
|
|
279
|
+
--sp-icon-sm: 16px;
|
|
280
|
+
--sp-icon-md: 20px;
|
|
281
|
+
--sp-icon-lg: 24px;
|
|
282
|
+
--sp-icon-xl: 32px;
|
|
283
|
+
--sp-icon-2xl: 40px;
|
|
284
|
+
--sp-icon-3xl: 48px;
|
|
285
|
+
--sp-aspect-ratio-square: 1/1;
|
|
286
|
+
--sp-aspect-ratio-video: 16/9;
|
|
287
|
+
--sp-aspect-ratio-classic: 3/2;
|
|
288
|
+
--sp-aspect-ratio-portrait: 3/4;
|
|
289
|
+
--sp-aspect-ratio-landscape: 4/3;
|
|
290
|
+
--sp-aspect-ratio-ultrawide: 21/9;
|
|
291
|
+
--sp-aspect-ratio-hero: 2/1;
|
|
246
292
|
--sp-font-family-sans: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
|
|
247
293
|
--sp-font-family-serif: 'Times New Roman', Times, serif;
|
|
248
294
|
--sp-font-family-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
|
|
@@ -335,6 +381,7 @@
|
|
|
335
381
|
--sp-min-touch-target: 44px;
|
|
336
382
|
--sp-min-text-size: 16px;
|
|
337
383
|
--sp-reduced-motion: 0.01ms;
|
|
384
|
+
--sp-forced-colors: auto;
|
|
338
385
|
--sp-button-primary-bg: #0369a1;
|
|
339
386
|
--sp-button-primary-bghover: #075985;
|
|
340
387
|
--sp-button-primary-bgactive: #0c4a6e;
|
|
@@ -488,8 +535,10 @@
|
|
|
488
535
|
--sp-button-text-default: #eef1f6;
|
|
489
536
|
--sp-button-text-on-primary: #ffffff;
|
|
490
537
|
--sp-badge-neutral-bg: #374253;
|
|
538
|
+
--sp-badge-neutral-bg-hover: #4b576a;
|
|
491
539
|
--sp-badge-neutral-text: #f7f8fb;
|
|
492
540
|
--sp-badge-info-bg: #0c4a6e;
|
|
541
|
+
--sp-badge-info-bg-hover: #075985;
|
|
493
542
|
--sp-badge-info-text: #e0f2fe;
|
|
494
543
|
--sp-badge-success-bg: #166534;
|
|
495
544
|
--sp-badge-success-text: #dcfce7;
|
|
@@ -503,6 +552,25 @@
|
|
|
503
552
|
--sp-icon-box-icon-success: #4ade80;
|
|
504
553
|
--sp-icon-box-icon-warning: #ffc21a;
|
|
505
554
|
--sp-icon-box-icon-danger: #f87171;
|
|
555
|
+
--sp-testimonial-bg: #222b38;
|
|
556
|
+
--sp-testimonial-bg-hover: #374253;
|
|
557
|
+
--sp-testimonial-border: #374253;
|
|
558
|
+
--sp-testimonial-text: #d9dfeb;
|
|
559
|
+
--sp-testimonial-author-name: #eef1f6;
|
|
560
|
+
--sp-testimonial-author-title: #b7c1d4;
|
|
561
|
+
--sp-testimonial-quote-mark: #b7c1d4;
|
|
562
|
+
--sp-pricing-card-bg: #222b38;
|
|
563
|
+
--sp-pricing-card-bg-hover: #374253;
|
|
564
|
+
--sp-pricing-card-border: #374253;
|
|
565
|
+
--sp-pricing-card-featured-bg: #0369a1;
|
|
566
|
+
--sp-pricing-card-featured-text: #ffffff;
|
|
567
|
+
--sp-pricing-card-featured-badge-bg: #f5ad00;
|
|
568
|
+
--sp-pricing-card-featured-badge-text: #141b24;
|
|
569
|
+
--sp-pricing-card-price: #eef1f6;
|
|
570
|
+
--sp-pricing-card-price-description: #b7c1d4;
|
|
571
|
+
--sp-rating-star-filled: #ffc21a;
|
|
572
|
+
--sp-rating-star-empty: #374253;
|
|
573
|
+
--sp-rating-text: #8a96ad;
|
|
506
574
|
--sp-nav-bg: #141b24;
|
|
507
575
|
--sp-nav-text: #f7f8fb;
|
|
508
576
|
--sp-nav-link: #b7c1d4;
|
|
@@ -571,6 +639,17 @@
|
|
|
571
639
|
--sp-label-text: #f7f8fb;
|
|
572
640
|
--sp-label-disabled-text: #4b576a;
|
|
573
641
|
--sp-label-required-indicator-text: #f87171;
|
|
642
|
+
--sp-badge-success-bg-hover: #15803d;
|
|
643
|
+
--sp-badge-warning-bg-hover: #8f5200;
|
|
644
|
+
--sp-badge-danger-bg-hover: #b91c1c;
|
|
645
|
+
--sp-select-border-invalid: #ef4444;
|
|
646
|
+
--sp-select-bg-invalid: #fef2f2;
|
|
647
|
+
--sp-select-border-success: #22c55e;
|
|
648
|
+
--sp-select-bg-success: #f0fdf4;
|
|
649
|
+
--sp-textarea-border-invalid: #ef4444;
|
|
650
|
+
--sp-textarea-bg-invalid: #fef2f2;
|
|
651
|
+
--sp-textarea-border-success: #22c55e;
|
|
652
|
+
--sp-textarea-bg-success: #f0fdf4;
|
|
574
653
|
--sp-link-default: #1f57db;
|
|
575
654
|
--sp-link-hover: #1946b4;
|
|
576
655
|
--sp-link-active: #173b8f;
|
package/dist/index.d.cts
CHANGED
|
@@ -1339,6 +1339,10 @@ interface ComponentSelectTokens<Value = string> {
|
|
|
1339
1339
|
disabledBg: Value;
|
|
1340
1340
|
disabledBorder: Value;
|
|
1341
1341
|
focusBorder: Value;
|
|
1342
|
+
borderInvalid: Value;
|
|
1343
|
+
bgInvalid: Value;
|
|
1344
|
+
borderSuccess: Value;
|
|
1345
|
+
bgSuccess: Value;
|
|
1342
1346
|
}
|
|
1343
1347
|
interface ComponentTextareaTokens<Value = string> {
|
|
1344
1348
|
bg: Value;
|
|
@@ -1348,6 +1352,10 @@ interface ComponentTextareaTokens<Value = string> {
|
|
|
1348
1352
|
disabledBg: Value;
|
|
1349
1353
|
disabledBorder: Value;
|
|
1350
1354
|
focusBorder: Value;
|
|
1355
|
+
borderInvalid: Value;
|
|
1356
|
+
bgInvalid: Value;
|
|
1357
|
+
borderSuccess: Value;
|
|
1358
|
+
bgSuccess: Value;
|
|
1351
1359
|
}
|
|
1352
1360
|
interface ComponentFieldsetTokens<Value = string> {
|
|
1353
1361
|
border: Value;
|
package/dist/index.d.ts
CHANGED
|
@@ -1339,6 +1339,10 @@ interface ComponentSelectTokens<Value = string> {
|
|
|
1339
1339
|
disabledBg: Value;
|
|
1340
1340
|
disabledBorder: Value;
|
|
1341
1341
|
focusBorder: Value;
|
|
1342
|
+
borderInvalid: Value;
|
|
1343
|
+
bgInvalid: Value;
|
|
1344
|
+
borderSuccess: Value;
|
|
1345
|
+
bgSuccess: Value;
|
|
1342
1346
|
}
|
|
1343
1347
|
interface ComponentTextareaTokens<Value = string> {
|
|
1344
1348
|
bg: Value;
|
|
@@ -1348,6 +1352,10 @@ interface ComponentTextareaTokens<Value = string> {
|
|
|
1348
1352
|
disabledBg: Value;
|
|
1349
1353
|
disabledBorder: Value;
|
|
1350
1354
|
focusBorder: Value;
|
|
1355
|
+
borderInvalid: Value;
|
|
1356
|
+
bgInvalid: Value;
|
|
1357
|
+
borderSuccess: Value;
|
|
1358
|
+
bgSuccess: Value;
|
|
1351
1359
|
}
|
|
1352
1360
|
interface ComponentFieldsetTokens<Value = string> {
|
|
1353
1361
|
border: Value;
|
package/dist/index.js
CHANGED
|
@@ -1185,98 +1185,13 @@ var coreTokens = {
|
|
|
1185
1185
|
// src/css.ts
|
|
1186
1186
|
var DEFAULT_PREFIX = "sp";
|
|
1187
1187
|
var DEFAULT_SELECTOR = ":root";
|
|
1188
|
+
var LEGACY_COMPONENT_PREFIX_GROUPS = /* @__PURE__ */ new Set(["card", "input"]);
|
|
1188
1189
|
var formatKey = (segment) => segment.replace(/[^a-z0-9]+/gi, "-").replace(/^-+|-+$/g, "").toLowerCase();
|
|
1189
1190
|
var toVariableName = (prefix, ...parts) => {
|
|
1190
1191
|
const filtered = parts.filter(Boolean).map(formatKey);
|
|
1191
1192
|
return `--${prefix}-${filtered.join("-")}`;
|
|
1192
1193
|
};
|
|
1193
|
-
var
|
|
1194
|
-
{ variant: "neutral", bgKey: "neutralBg", textKey: "neutralText" },
|
|
1195
|
-
{ variant: "info", bgKey: "infoBg", textKey: "infoText" },
|
|
1196
|
-
{ variant: "success", bgKey: "successBg", textKey: "successText" },
|
|
1197
|
-
{ variant: "warning", bgKey: "warningBg", textKey: "warningText" },
|
|
1198
|
-
{ variant: "danger", bgKey: "dangerBg", textKey: "dangerText" }
|
|
1199
|
-
];
|
|
1200
|
-
var ICON_BOX_FIELDS = [
|
|
1201
|
-
{ name: "bg", tokenKey: "bg" },
|
|
1202
|
-
{ name: "border", tokenKey: "border" },
|
|
1203
|
-
{ name: "icon-default", tokenKey: "iconDefault" },
|
|
1204
|
-
{ name: "icon-success", tokenKey: "iconSuccess" },
|
|
1205
|
-
{ name: "icon-warning", tokenKey: "iconWarning" },
|
|
1206
|
-
{ name: "icon-danger", tokenKey: "iconDanger" }
|
|
1207
|
-
];
|
|
1208
|
-
var NAV_FIELDS = [
|
|
1209
|
-
{ name: "bg", tokenKey: "bg" },
|
|
1210
|
-
{ name: "text", tokenKey: "text" },
|
|
1211
|
-
{ name: "link", tokenKey: "link" },
|
|
1212
|
-
{ name: "link-hover", tokenKey: "linkHover" },
|
|
1213
|
-
{ name: "link-active", tokenKey: "linkActive" },
|
|
1214
|
-
{ name: "border", tokenKey: "border" }
|
|
1215
|
-
];
|
|
1216
|
-
var MODAL_FIELDS = [
|
|
1217
|
-
{ name: "bg", tokenKey: "bg" },
|
|
1218
|
-
{ name: "shadow", tokenKey: "shadow" },
|
|
1219
|
-
{ name: "border", tokenKey: "border" },
|
|
1220
|
-
{ name: "overlay", tokenKey: "overlay" }
|
|
1221
|
-
];
|
|
1222
|
-
var TOAST_VARIANTS = ["success", "warning", "danger", "info"].map((variant) => ({
|
|
1223
|
-
variant,
|
|
1224
|
-
fields: [
|
|
1225
|
-
{ name: "bg", tokenKey: "bg" },
|
|
1226
|
-
{ name: "text", tokenKey: "text" },
|
|
1227
|
-
{ name: "border", tokenKey: "border" },
|
|
1228
|
-
{ name: "icon", tokenKey: "icon" }
|
|
1229
|
-
]
|
|
1230
|
-
}));
|
|
1231
|
-
var TOOLTIP_FIELDS = [
|
|
1232
|
-
{ name: "bg", tokenKey: "bg" },
|
|
1233
|
-
{ name: "text", tokenKey: "text" },
|
|
1234
|
-
{ name: "border", tokenKey: "border" }
|
|
1235
|
-
];
|
|
1236
|
-
var DROPDOWN_FIELDS = [
|
|
1237
|
-
{ name: "bg", modePath: ["bg"], aliasPath: ["bg"] },
|
|
1238
|
-
{ name: "border", modePath: ["border"], aliasPath: ["border"] },
|
|
1239
|
-
{ name: "item-default", modePath: ["item", "default"], aliasPath: ["item", "default"] },
|
|
1240
|
-
{ name: "item-hover", modePath: ["item", "hover"], aliasPath: ["item", "hover"] },
|
|
1241
|
-
{ name: "item-active", modePath: ["item", "active"], aliasPath: ["item", "active"] },
|
|
1242
|
-
{ name: "item-text", modePath: ["item", "text"], aliasPath: ["item", "text"] }
|
|
1243
|
-
];
|
|
1244
|
-
var SELECTION_CONTROL_FIELDS = [
|
|
1245
|
-
{ name: "bg", tokenKey: "bg" },
|
|
1246
|
-
{ name: "border", tokenKey: "border" },
|
|
1247
|
-
{ name: "checked-bg", tokenKey: "checkedBg" },
|
|
1248
|
-
{ name: "checked-border", tokenKey: "checkedBorder" },
|
|
1249
|
-
{ name: "text", tokenKey: "text" },
|
|
1250
|
-
{ name: "disabled-bg", tokenKey: "disabledBg" },
|
|
1251
|
-
{ name: "disabled-border", tokenKey: "disabledBorder" }
|
|
1252
|
-
];
|
|
1253
|
-
var SELECT_FIELDS = [
|
|
1254
|
-
{ name: "bg", tokenKey: "bg" },
|
|
1255
|
-
{ name: "border", tokenKey: "border" },
|
|
1256
|
-
{ name: "text", tokenKey: "text" },
|
|
1257
|
-
{ name: "placeholder-text", tokenKey: "placeholderText" },
|
|
1258
|
-
{ name: "disabled-bg", tokenKey: "disabledBg" },
|
|
1259
|
-
{ name: "disabled-border", tokenKey: "disabledBorder" },
|
|
1260
|
-
{ name: "focus-border", tokenKey: "focusBorder" }
|
|
1261
|
-
];
|
|
1262
|
-
var TEXTAREA_FIELDS = [
|
|
1263
|
-
{ name: "bg", tokenKey: "bg" },
|
|
1264
|
-
{ name: "border", tokenKey: "border" },
|
|
1265
|
-
{ name: "text", tokenKey: "text" },
|
|
1266
|
-
{ name: "placeholder", tokenKey: "placeholder" },
|
|
1267
|
-
{ name: "disabled-bg", tokenKey: "disabledBg" },
|
|
1268
|
-
{ name: "disabled-border", tokenKey: "disabledBorder" },
|
|
1269
|
-
{ name: "focus-border", tokenKey: "focusBorder" }
|
|
1270
|
-
];
|
|
1271
|
-
var FIELDSET_FIELDS = [
|
|
1272
|
-
{ name: "border", tokenKey: "border" },
|
|
1273
|
-
{ name: "legend-text", tokenKey: "legendText" }
|
|
1274
|
-
];
|
|
1275
|
-
var LABEL_FIELDS = [
|
|
1276
|
-
{ name: "text", tokenKey: "text" },
|
|
1277
|
-
{ name: "disabled-text", tokenKey: "disabledText" },
|
|
1278
|
-
{ name: "required-indicator-text", tokenKey: "requiredIndicatorText" }
|
|
1279
|
-
];
|
|
1194
|
+
var isPlainObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1280
1195
|
var resolveTokenReference = (tokens2, reference) => {
|
|
1281
1196
|
const path = reference.slice(1, -1).split(".");
|
|
1282
1197
|
let current = tokens2;
|
|
@@ -1314,14 +1229,21 @@ var resolveValue = (tokens2, value) => {
|
|
|
1314
1229
|
str = str.replace(opacityRegex, (match, hex, opacity) => hexToRgba(hex, opacity));
|
|
1315
1230
|
return str;
|
|
1316
1231
|
};
|
|
1317
|
-
var resolveSemanticValue = (value, tokens2) => {
|
|
1232
|
+
var resolveSemanticValue = (value, tokens2, path) => {
|
|
1233
|
+
if (value === void 0) return void 0;
|
|
1318
1234
|
if (typeof value === "string" || typeof value === "number") {
|
|
1319
1235
|
return resolveValue(tokens2, value);
|
|
1320
1236
|
}
|
|
1321
|
-
if (value
|
|
1322
|
-
|
|
1237
|
+
if (isPlainObject(value)) {
|
|
1238
|
+
if ("value" in value) {
|
|
1239
|
+
return resolveValue(tokens2, value.value);
|
|
1240
|
+
}
|
|
1241
|
+
if ("metadata" in value || "description" in value) {
|
|
1242
|
+
throw new Error(`Unsupported token value shape at "${path ?? "(unknown path)"}": expected a string, number, or { value } wrapper.`);
|
|
1243
|
+
}
|
|
1244
|
+
return void 0;
|
|
1323
1245
|
}
|
|
1324
|
-
|
|
1246
|
+
throw new Error(`Unsupported token value shape at "${path ?? "(unknown path)"}": ${JSON.stringify(value)}`);
|
|
1325
1247
|
};
|
|
1326
1248
|
var getPath = (source, path) => path.reduce((acc, key) => acc && typeof acc === "object" ? acc[key] : void 0, source);
|
|
1327
1249
|
var pickSemantic = (tokens2, ...candidates) => {
|
|
@@ -1406,6 +1328,18 @@ var createCssVariableMap = (tokens2, options = {}) => {
|
|
|
1406
1328
|
Object.entries(baseTokens.radii).forEach(([key, value]) => {
|
|
1407
1329
|
assign(toVariableName(prefix, "radius", key), value);
|
|
1408
1330
|
});
|
|
1331
|
+
const icons = baseTokens.icons;
|
|
1332
|
+
if (icons) {
|
|
1333
|
+
Object.entries(icons).forEach(([key, value]) => {
|
|
1334
|
+
assign(toVariableName(prefix, "icon", key), value);
|
|
1335
|
+
});
|
|
1336
|
+
}
|
|
1337
|
+
const aspectRatios = baseTokens.aspectRatios;
|
|
1338
|
+
if (aspectRatios) {
|
|
1339
|
+
Object.entries(aspectRatios).forEach(([key, value]) => {
|
|
1340
|
+
assign(toVariableName(prefix, "aspect-ratio", key), value);
|
|
1341
|
+
});
|
|
1342
|
+
}
|
|
1409
1343
|
Object.entries(baseTokens.typography.families).forEach(([key, value]) => {
|
|
1410
1344
|
assign(toVariableName(prefix, "font-family", key), value);
|
|
1411
1345
|
});
|
|
@@ -1452,6 +1386,7 @@ var createCssVariableMap = (tokens2, options = {}) => {
|
|
|
1452
1386
|
assign(toVariableName(prefix, "min-touch-target"), baseTokens.accessibility.minTouchTarget);
|
|
1453
1387
|
assign(toVariableName(prefix, "min-text-size"), baseTokens.accessibility.minTextSize);
|
|
1454
1388
|
assign(toVariableName(prefix, "reduced-motion"), baseTokens.accessibility.reducedMotion);
|
|
1389
|
+
assign(toVariableName(prefix, "forced-colors"), baseTokens.accessibility.forcedColors);
|
|
1455
1390
|
Object.entries(baseTokens.buttons).forEach(([variant, states]) => {
|
|
1456
1391
|
Object.entries(states).forEach(([state, value]) => {
|
|
1457
1392
|
assign(toVariableName(prefix, "button", variant, state), value);
|
|
@@ -1493,110 +1428,7 @@ var generateCssVariables = (tokens2, options = {}) => {
|
|
|
1493
1428
|
const textAliases = tokens2.text ?? {};
|
|
1494
1429
|
const componentAliases = tokens2.component ?? {};
|
|
1495
1430
|
const linkTokens = tokens2.link ?? {};
|
|
1496
|
-
const
|
|
1497
|
-
{ varParts: ["surface", "page"], modePath: ["surface", "page"], aliasSrc: surfaceAliases, aliasPath: ["page"] },
|
|
1498
|
-
{ varParts: ["surface", "card"], modePath: ["surface", "card"], aliasSrc: surfaceAliases, aliasPath: ["card"] },
|
|
1499
|
-
{ varParts: ["surface", "input"], modePath: ["surface", "input"], aliasSrc: surfaceAliases, aliasPath: ["input"] },
|
|
1500
|
-
{ varParts: ["surface", "overlay"], modePath: ["surface", "overlay"], aliasSrc: surfaceAliases, aliasPath: ["overlay"] },
|
|
1501
|
-
{ varParts: ["surface", "subtle"], modePath: ["surface", "subtle"] },
|
|
1502
|
-
{ varParts: ["surface", "hero"], modePath: ["surface", "hero"], aliasSrc: surfaceAliases, aliasPath: ["hero"] },
|
|
1503
|
-
{ varParts: ["surface", "hover"], modePath: ["surface", "hover"], aliasSrc: surfaceAliases, aliasPath: ["hover"] },
|
|
1504
|
-
{ varParts: ["surface", "selected"], modePath: ["surface", "selected"], aliasSrc: surfaceAliases, aliasPath: ["selected"] },
|
|
1505
|
-
{ varParts: ["surface", "active"], modePath: ["surface", "active"], aliasSrc: surfaceAliases, aliasPath: ["active"] },
|
|
1506
|
-
{ varParts: ["surface", "divider"], modePath: ["surface", "divider"], aliasSrc: surfaceAliases, aliasPath: ["divider"] },
|
|
1507
|
-
{ varParts: ["text", "on", "page", "default"], modePath: ["text", "onPage", "default"], aliasSrc: textAliases, aliasPath: ["onPage", "default"] },
|
|
1508
|
-
{ varParts: ["text", "on", "page", "muted"], modePath: ["text", "onPage", "muted"], aliasSrc: textAliases, aliasPath: ["onPage", "muted"] },
|
|
1509
|
-
{ varParts: ["text", "on", "page", "subtle"], modePath: ["text", "onPage", "subtle"], aliasSrc: textAliases, aliasPath: ["onPage", "subtle"] },
|
|
1510
|
-
{ varParts: ["text", "on", "page", "meta"], modePath: ["text", "onPage", "meta"], aliasSrc: textAliases, aliasPath: ["onPage", "meta"] },
|
|
1511
|
-
{ varParts: ["text", "on", "page", "brand"], modePath: ["text", "onPage", "brand"], aliasSrc: textAliases, aliasPath: ["onPage", "brand"] },
|
|
1512
|
-
{ varParts: ["text", "on", "surface", "default"], modePath: ["text", "onSurface", "default"], aliasSrc: textAliases, aliasPath: ["onSurface", "default"] },
|
|
1513
|
-
{ varParts: ["text", "on", "surface", "muted"], modePath: ["text", "onSurface", "muted"], aliasSrc: textAliases, aliasPath: ["onSurface", "muted"] },
|
|
1514
|
-
{ varParts: ["text", "on", "surface", "subtle"], modePath: ["text", "onSurface", "subtle"], aliasSrc: textAliases, aliasPath: ["onSurface", "subtle"] },
|
|
1515
|
-
{ varParts: ["text", "on", "surface", "meta"], modePath: ["text", "onSurface", "meta"], aliasSrc: textAliases, aliasPath: ["onSurface", "meta"] },
|
|
1516
|
-
{ varParts: ["text", "on", "surface", "brand"], modePath: ["text", "onSurface", "brand"], aliasSrc: textAliases, aliasPath: ["onSurface", "brand"] },
|
|
1517
|
-
{ varParts: ["component", "card", "text"], modePath: ["component", "card", "text"], aliasSrc: componentAliases, aliasPath: ["card", "text"] },
|
|
1518
|
-
{ varParts: ["component", "card", "text-muted"], modePath: ["component", "card", "textMuted"], aliasSrc: componentAliases, aliasPath: ["card", "textMuted"] },
|
|
1519
|
-
{ varParts: ["component", "input", "text"], modePath: ["component", "input", "text"], aliasSrc: componentAliases, aliasPath: ["input", "text"] },
|
|
1520
|
-
{ varParts: ["component", "input", "placeholder"], modePath: ["component", "input", "placeholder"], aliasSrc: componentAliases, aliasPath: ["input", "placeholder"] },
|
|
1521
|
-
{ varParts: ["button", "text", "default"], modePath: ["component", "button", "textDefault"], aliasSrc: componentAliases, aliasPath: ["button", "textDefault"] },
|
|
1522
|
-
{ varParts: ["button", "text", "on", "primary"], modePath: ["component", "button", "textOnPrimary"], aliasSrc: componentAliases, aliasPath: ["button", "textOnPrimary"] },
|
|
1523
|
-
...BADGE_VARIANTS.flatMap(({ variant, bgKey, textKey }) => [
|
|
1524
|
-
{ varParts: ["badge", variant, "bg"], modePath: ["component", "badge", bgKey], aliasSrc: componentAliases, aliasPath: ["badge", bgKey] },
|
|
1525
|
-
{ varParts: ["badge", variant, "text"], modePath: ["component", "badge", textKey], aliasSrc: componentAliases, aliasPath: ["badge", textKey] }
|
|
1526
|
-
]),
|
|
1527
|
-
...ICON_BOX_FIELDS.map(({ name, tokenKey }) => ({
|
|
1528
|
-
varParts: ["icon-box", name],
|
|
1529
|
-
modePath: ["component", "iconBox", tokenKey],
|
|
1530
|
-
aliasSrc: componentAliases,
|
|
1531
|
-
aliasPath: ["iconBox", tokenKey]
|
|
1532
|
-
})),
|
|
1533
|
-
...NAV_FIELDS.map(({ name, tokenKey }) => ({
|
|
1534
|
-
varParts: ["nav", name],
|
|
1535
|
-
modePath: ["component", "nav", tokenKey],
|
|
1536
|
-
aliasSrc: componentAliases,
|
|
1537
|
-
aliasPath: ["nav", tokenKey]
|
|
1538
|
-
})),
|
|
1539
|
-
...MODAL_FIELDS.map(({ name, tokenKey }) => ({
|
|
1540
|
-
varParts: ["modal", name],
|
|
1541
|
-
modePath: ["component", "modal", tokenKey],
|
|
1542
|
-
aliasSrc: componentAliases,
|
|
1543
|
-
aliasPath: ["modal", tokenKey]
|
|
1544
|
-
})),
|
|
1545
|
-
...TOAST_VARIANTS.flatMap(({ variant, fields }) => fields.map(({ name, tokenKey }) => ({
|
|
1546
|
-
varParts: ["toast", variant, name],
|
|
1547
|
-
modePath: ["component", "toast", variant, tokenKey],
|
|
1548
|
-
aliasSrc: componentAliases,
|
|
1549
|
-
aliasPath: ["toast", variant, tokenKey]
|
|
1550
|
-
}))),
|
|
1551
|
-
...TOOLTIP_FIELDS.map(({ name, tokenKey }) => ({
|
|
1552
|
-
varParts: ["tooltip", name],
|
|
1553
|
-
modePath: ["component", "tooltip", tokenKey],
|
|
1554
|
-
aliasSrc: componentAliases,
|
|
1555
|
-
aliasPath: ["tooltip", tokenKey]
|
|
1556
|
-
})),
|
|
1557
|
-
...DROPDOWN_FIELDS.map(({ name, modePath, aliasPath }) => ({
|
|
1558
|
-
varParts: ["dropdown", name],
|
|
1559
|
-
modePath: ["component", "dropdown", ...modePath],
|
|
1560
|
-
aliasSrc: componentAliases,
|
|
1561
|
-
aliasPath: ["dropdown", ...aliasPath]
|
|
1562
|
-
})),
|
|
1563
|
-
...SELECTION_CONTROL_FIELDS.map(({ name, tokenKey }) => ({
|
|
1564
|
-
varParts: ["checkbox", name],
|
|
1565
|
-
modePath: ["component", "checkbox", tokenKey],
|
|
1566
|
-
aliasSrc: componentAliases,
|
|
1567
|
-
aliasPath: ["checkbox", tokenKey]
|
|
1568
|
-
})),
|
|
1569
|
-
...SELECTION_CONTROL_FIELDS.map(({ name, tokenKey }) => ({
|
|
1570
|
-
varParts: ["radio", name],
|
|
1571
|
-
modePath: ["component", "radio", tokenKey],
|
|
1572
|
-
aliasSrc: componentAliases,
|
|
1573
|
-
aliasPath: ["radio", tokenKey]
|
|
1574
|
-
})),
|
|
1575
|
-
...SELECT_FIELDS.map(({ name, tokenKey }) => ({
|
|
1576
|
-
varParts: ["select", name],
|
|
1577
|
-
modePath: ["component", "select", tokenKey],
|
|
1578
|
-
aliasSrc: componentAliases,
|
|
1579
|
-
aliasPath: ["select", tokenKey]
|
|
1580
|
-
})),
|
|
1581
|
-
...TEXTAREA_FIELDS.map(({ name, tokenKey }) => ({
|
|
1582
|
-
varParts: ["textarea", name],
|
|
1583
|
-
modePath: ["component", "textarea", tokenKey],
|
|
1584
|
-
aliasSrc: componentAliases,
|
|
1585
|
-
aliasPath: ["textarea", tokenKey]
|
|
1586
|
-
})),
|
|
1587
|
-
...FIELDSET_FIELDS.map(({ name, tokenKey }) => ({
|
|
1588
|
-
varParts: ["fieldset", name],
|
|
1589
|
-
modePath: ["component", "fieldset", tokenKey],
|
|
1590
|
-
aliasSrc: componentAliases,
|
|
1591
|
-
aliasPath: ["fieldset", tokenKey]
|
|
1592
|
-
})),
|
|
1593
|
-
...LABEL_FIELDS.map(({ name, tokenKey }) => ({
|
|
1594
|
-
varParts: ["label", name],
|
|
1595
|
-
modePath: ["component", "label", tokenKey],
|
|
1596
|
-
aliasSrc: componentAliases,
|
|
1597
|
-
aliasPath: ["label", tokenKey]
|
|
1598
|
-
}))
|
|
1599
|
-
];
|
|
1431
|
+
const componentVarParts = (group, kebabGroup, path) => LEGACY_COMPONENT_PREFIX_GROUPS.has(group) ? ["component", kebabGroup, ...path] : [kebabGroup, ...path];
|
|
1600
1432
|
const baseLines = [];
|
|
1601
1433
|
const darkLines = [];
|
|
1602
1434
|
const addBase = (name, value) => {
|
|
@@ -1605,12 +1437,56 @@ var generateCssVariables = (tokens2, options = {}) => {
|
|
|
1605
1437
|
const addDark = (name, value) => {
|
|
1606
1438
|
if (value !== void 0) darkLines.push(` ${name}: ${value};`);
|
|
1607
1439
|
};
|
|
1608
|
-
|
|
1609
|
-
const
|
|
1610
|
-
const
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1440
|
+
const walkSemanticGroup = (namespace, varPartsFor, aliasSrc) => {
|
|
1441
|
+
const defaultNode = defaultMode[namespace];
|
|
1442
|
+
const darkNode = darkMode[namespace];
|
|
1443
|
+
const paths = /* @__PURE__ */ new Set();
|
|
1444
|
+
const collectPaths = (node, path) => {
|
|
1445
|
+
if (node === void 0) return;
|
|
1446
|
+
const leaf = resolveSemanticValue(node, tokens2, [namespace, ...path].join("."));
|
|
1447
|
+
if (leaf !== void 0) {
|
|
1448
|
+
paths.add(path.join("."));
|
|
1449
|
+
return;
|
|
1450
|
+
}
|
|
1451
|
+
if (isPlainObject(node)) {
|
|
1452
|
+
Object.keys(node).forEach((key) => collectPaths(node[key], [...path, key]));
|
|
1453
|
+
}
|
|
1454
|
+
};
|
|
1455
|
+
collectPaths(defaultNode, []);
|
|
1456
|
+
collectPaths(darkNode, []);
|
|
1457
|
+
collectPaths(aliasSrc, []);
|
|
1458
|
+
paths.forEach((joinedPath) => {
|
|
1459
|
+
const path = joinedPath.split(".");
|
|
1460
|
+
const varName = toVariableName(prefix, ...varPartsFor(path));
|
|
1461
|
+
const aliasCandidate = getPath(aliasSrc, path);
|
|
1462
|
+
const baseValue = pickSemantic(tokens2, getPath(defaultNode, path), aliasCandidate);
|
|
1463
|
+
const darkValue = pickSemantic(tokens2, getPath(darkNode, path), getPath(defaultNode, path), aliasCandidate);
|
|
1464
|
+
addBase(varName, baseValue);
|
|
1465
|
+
addDark(varName, darkValue);
|
|
1466
|
+
});
|
|
1467
|
+
};
|
|
1468
|
+
const kebabPathSegment = (segment) => formatKey(segment.replace(/([a-z0-9])([A-Z])/g, "$1-$2"));
|
|
1469
|
+
walkSemanticGroup(
|
|
1470
|
+
"surface",
|
|
1471
|
+
(path) => ["surface", ...path.map(kebabPathSegment)],
|
|
1472
|
+
surfaceAliases
|
|
1473
|
+
);
|
|
1474
|
+
walkSemanticGroup(
|
|
1475
|
+
"text",
|
|
1476
|
+
(path) => {
|
|
1477
|
+
const [scope, ...rest] = path;
|
|
1478
|
+
return ["text", ...kebabPathSegment(scope).split("-"), ...rest.map(kebabPathSegment)];
|
|
1479
|
+
},
|
|
1480
|
+
textAliases
|
|
1481
|
+
);
|
|
1482
|
+
walkSemanticGroup(
|
|
1483
|
+
"component",
|
|
1484
|
+
(path) => {
|
|
1485
|
+
const [group, ...rest] = path;
|
|
1486
|
+
return componentVarParts(group, kebabPathSegment(group), rest.map(kebabPathSegment));
|
|
1487
|
+
},
|
|
1488
|
+
componentAliases
|
|
1489
|
+
);
|
|
1614
1490
|
Object.entries(linkTokens).forEach(([key, value]) => {
|
|
1615
1491
|
const varName = toVariableName(prefix, "link", key);
|
|
1616
1492
|
const resolved = pickSemantic(tokens2, value);
|