@phcdevworks/spectre-tokens 0.0.3 → 0.1.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 +22 -0
- package/dist/index.cjs +589 -45
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +66 -6
- package/dist/index.d.cts +136 -5
- package/dist/index.d.ts +136 -5
- package/dist/index.js +589 -45
- package/dist/index.js.map +1 -1
- package/package.json +5 -6
- package/tokens/core.json +274 -18
package/dist/index.js
CHANGED
|
@@ -93,56 +93,280 @@ var core_default = {
|
|
|
93
93
|
},
|
|
94
94
|
surface: {
|
|
95
95
|
page: {
|
|
96
|
-
value: "#
|
|
96
|
+
value: "#f8fafc",
|
|
97
97
|
description: "primary app background"
|
|
98
98
|
},
|
|
99
99
|
card: {
|
|
100
|
-
value: "#
|
|
100
|
+
value: "#ffffff",
|
|
101
101
|
description: "containers and tiles"
|
|
102
102
|
},
|
|
103
103
|
input: {
|
|
104
|
-
value: "#
|
|
104
|
+
value: "#ffffff",
|
|
105
105
|
description: "form inputs, textareas"
|
|
106
106
|
},
|
|
107
107
|
overlay: {
|
|
108
|
-
value: "
|
|
108
|
+
value: "rgba(15,23,42,0.6)",
|
|
109
109
|
description: "modals, dropdowns, flyouts"
|
|
110
110
|
}
|
|
111
111
|
},
|
|
112
112
|
text: {
|
|
113
113
|
onPage: {
|
|
114
|
-
default: "#
|
|
115
|
-
muted: "#
|
|
116
|
-
subtle: "#94a3b8"
|
|
114
|
+
default: "#0f172a",
|
|
115
|
+
muted: "#475569",
|
|
116
|
+
subtle: "#94a3b8",
|
|
117
|
+
meta: "#94a3b8"
|
|
117
118
|
},
|
|
118
119
|
onSurface: {
|
|
119
|
-
default: "#
|
|
120
|
-
muted: "#
|
|
121
|
-
subtle: "#94a3b8"
|
|
120
|
+
default: "#0f172a",
|
|
121
|
+
muted: "#6b7280",
|
|
122
|
+
subtle: "#94a3b8",
|
|
123
|
+
meta: "#94a3b8"
|
|
122
124
|
}
|
|
123
125
|
},
|
|
124
126
|
component: {
|
|
125
127
|
card: {
|
|
126
|
-
text: "#
|
|
127
|
-
textMuted: "#
|
|
128
|
+
text: "#0f172a",
|
|
129
|
+
textMuted: "#6b7280"
|
|
128
130
|
},
|
|
129
131
|
input: {
|
|
130
|
-
text: "#
|
|
132
|
+
text: "#0f172a",
|
|
131
133
|
placeholder: "#94a3b8"
|
|
132
134
|
},
|
|
133
135
|
button: {
|
|
134
|
-
textDefault: "#
|
|
136
|
+
textDefault: "#0f172a",
|
|
135
137
|
textOnPrimary: "#ffffff"
|
|
138
|
+
},
|
|
139
|
+
badge: {
|
|
140
|
+
primary: {
|
|
141
|
+
bg: "#8652ff",
|
|
142
|
+
text: "#0f172a"
|
|
143
|
+
},
|
|
144
|
+
success: {
|
|
145
|
+
bg: "#22c55e",
|
|
146
|
+
text: "#0f172a"
|
|
147
|
+
},
|
|
148
|
+
warning: {
|
|
149
|
+
bg: "#f59e0b",
|
|
150
|
+
text: "#0f172a"
|
|
151
|
+
},
|
|
152
|
+
danger: {
|
|
153
|
+
bg: "#ef4444",
|
|
154
|
+
text: "#0f172a"
|
|
155
|
+
}
|
|
136
156
|
}
|
|
137
157
|
},
|
|
138
158
|
modes: {
|
|
139
159
|
default: {
|
|
140
|
-
surface: {
|
|
141
|
-
|
|
160
|
+
surface: {
|
|
161
|
+
page: {
|
|
162
|
+
value: "#f8fafc"
|
|
163
|
+
},
|
|
164
|
+
card: {
|
|
165
|
+
value: "#ffffff"
|
|
166
|
+
},
|
|
167
|
+
input: {
|
|
168
|
+
value: "#ffffff"
|
|
169
|
+
},
|
|
170
|
+
overlay: {
|
|
171
|
+
value: "rgba(15,23,42,0.6)"
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
text: {
|
|
175
|
+
onPage: {
|
|
176
|
+
default: {
|
|
177
|
+
value: "#0f172a"
|
|
178
|
+
},
|
|
179
|
+
muted: {
|
|
180
|
+
value: "#475569"
|
|
181
|
+
},
|
|
182
|
+
subtle: {
|
|
183
|
+
value: "#94a3b8"
|
|
184
|
+
},
|
|
185
|
+
meta: {
|
|
186
|
+
value: "#94a3b8"
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
onSurface: {
|
|
190
|
+
default: {
|
|
191
|
+
value: "#0f172a"
|
|
192
|
+
},
|
|
193
|
+
muted: {
|
|
194
|
+
value: "#6b7280"
|
|
195
|
+
},
|
|
196
|
+
subtle: {
|
|
197
|
+
value: "#94a3b8"
|
|
198
|
+
},
|
|
199
|
+
meta: {
|
|
200
|
+
value: "#94a3b8"
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
component: {
|
|
205
|
+
card: {
|
|
206
|
+
text: {
|
|
207
|
+
value: "#0f172a"
|
|
208
|
+
},
|
|
209
|
+
textMuted: {
|
|
210
|
+
value: "#6b7280"
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
input: {
|
|
214
|
+
text: {
|
|
215
|
+
value: "#0f172a"
|
|
216
|
+
},
|
|
217
|
+
placeholder: {
|
|
218
|
+
value: "#94a3b8"
|
|
219
|
+
}
|
|
220
|
+
},
|
|
221
|
+
button: {
|
|
222
|
+
textDefault: {
|
|
223
|
+
value: "#0f172a"
|
|
224
|
+
},
|
|
225
|
+
textOnPrimary: {
|
|
226
|
+
value: "#ffffff"
|
|
227
|
+
}
|
|
228
|
+
},
|
|
229
|
+
badge: {
|
|
230
|
+
primary: {
|
|
231
|
+
bg: {
|
|
232
|
+
value: "#8652ff"
|
|
233
|
+
},
|
|
234
|
+
text: {
|
|
235
|
+
value: "#0f172a"
|
|
236
|
+
}
|
|
237
|
+
},
|
|
238
|
+
success: {
|
|
239
|
+
bg: {
|
|
240
|
+
value: "#22c55e"
|
|
241
|
+
},
|
|
242
|
+
text: {
|
|
243
|
+
value: "#0f172a"
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
warning: {
|
|
247
|
+
bg: {
|
|
248
|
+
value: "#f59e0b"
|
|
249
|
+
},
|
|
250
|
+
text: {
|
|
251
|
+
value: "#0f172a"
|
|
252
|
+
}
|
|
253
|
+
},
|
|
254
|
+
danger: {
|
|
255
|
+
bg: {
|
|
256
|
+
value: "#ef4444"
|
|
257
|
+
},
|
|
258
|
+
text: {
|
|
259
|
+
value: "#0f172a"
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
}
|
|
142
264
|
},
|
|
143
265
|
dark: {
|
|
144
|
-
surface: {
|
|
145
|
-
|
|
266
|
+
surface: {
|
|
267
|
+
page: {
|
|
268
|
+
value: "#0f172a"
|
|
269
|
+
},
|
|
270
|
+
card: {
|
|
271
|
+
value: "#1e293b"
|
|
272
|
+
},
|
|
273
|
+
input: {
|
|
274
|
+
value: "#334155"
|
|
275
|
+
},
|
|
276
|
+
overlay: {
|
|
277
|
+
value: "#1e293b"
|
|
278
|
+
}
|
|
279
|
+
},
|
|
280
|
+
text: {
|
|
281
|
+
onPage: {
|
|
282
|
+
default: {
|
|
283
|
+
value: "#f8fafc"
|
|
284
|
+
},
|
|
285
|
+
muted: {
|
|
286
|
+
value: "#cbd5f5"
|
|
287
|
+
},
|
|
288
|
+
subtle: {
|
|
289
|
+
value: "#94a3b8"
|
|
290
|
+
},
|
|
291
|
+
meta: {
|
|
292
|
+
value: "#94a3b8"
|
|
293
|
+
}
|
|
294
|
+
},
|
|
295
|
+
onSurface: {
|
|
296
|
+
default: {
|
|
297
|
+
value: "#f1f5f9"
|
|
298
|
+
},
|
|
299
|
+
muted: {
|
|
300
|
+
value: "#cbd5f5"
|
|
301
|
+
},
|
|
302
|
+
subtle: {
|
|
303
|
+
value: "#94a3b8"
|
|
304
|
+
},
|
|
305
|
+
meta: {
|
|
306
|
+
value: "#94a3b8"
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
},
|
|
310
|
+
component: {
|
|
311
|
+
card: {
|
|
312
|
+
text: {
|
|
313
|
+
value: "#f1f5f9"
|
|
314
|
+
},
|
|
315
|
+
textMuted: {
|
|
316
|
+
value: "#cbd5f5"
|
|
317
|
+
}
|
|
318
|
+
},
|
|
319
|
+
input: {
|
|
320
|
+
text: {
|
|
321
|
+
value: "#f1f5f9"
|
|
322
|
+
},
|
|
323
|
+
placeholder: {
|
|
324
|
+
value: "#94a3b8"
|
|
325
|
+
}
|
|
326
|
+
},
|
|
327
|
+
button: {
|
|
328
|
+
textDefault: {
|
|
329
|
+
value: "#f1f5f9"
|
|
330
|
+
},
|
|
331
|
+
textOnPrimary: {
|
|
332
|
+
value: "#ffffff"
|
|
333
|
+
}
|
|
334
|
+
},
|
|
335
|
+
badge: {
|
|
336
|
+
primary: {
|
|
337
|
+
bg: {
|
|
338
|
+
value: "#8652ff"
|
|
339
|
+
},
|
|
340
|
+
text: {
|
|
341
|
+
value: "#f1f5f9"
|
|
342
|
+
}
|
|
343
|
+
},
|
|
344
|
+
success: {
|
|
345
|
+
bg: {
|
|
346
|
+
value: "#22c55e"
|
|
347
|
+
},
|
|
348
|
+
text: {
|
|
349
|
+
value: "#f1f5f9"
|
|
350
|
+
}
|
|
351
|
+
},
|
|
352
|
+
warning: {
|
|
353
|
+
bg: {
|
|
354
|
+
value: "#f59e0b"
|
|
355
|
+
},
|
|
356
|
+
text: {
|
|
357
|
+
value: "#f1f5f9"
|
|
358
|
+
}
|
|
359
|
+
},
|
|
360
|
+
danger: {
|
|
361
|
+
bg: {
|
|
362
|
+
value: "#ef4444"
|
|
363
|
+
},
|
|
364
|
+
text: {
|
|
365
|
+
value: "#f1f5f9"
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
}
|
|
146
370
|
}
|
|
147
371
|
},
|
|
148
372
|
opacity: {
|
|
@@ -259,6 +483,38 @@ var core_default = {
|
|
|
259
483
|
card: "#334155",
|
|
260
484
|
input: "#cbd5f5"
|
|
261
485
|
},
|
|
486
|
+
font: {
|
|
487
|
+
xs: {
|
|
488
|
+
size: "0.75rem",
|
|
489
|
+
lineHeight: "1.25rem",
|
|
490
|
+
weight: 400
|
|
491
|
+
},
|
|
492
|
+
sm: {
|
|
493
|
+
size: "0.875rem",
|
|
494
|
+
lineHeight: "1.5rem",
|
|
495
|
+
weight: 400
|
|
496
|
+
},
|
|
497
|
+
md: {
|
|
498
|
+
size: "1rem",
|
|
499
|
+
lineHeight: "1.75rem",
|
|
500
|
+
weight: 500
|
|
501
|
+
},
|
|
502
|
+
lg: {
|
|
503
|
+
size: "1.25rem",
|
|
504
|
+
lineHeight: "2rem",
|
|
505
|
+
weight: 500
|
|
506
|
+
},
|
|
507
|
+
xl: {
|
|
508
|
+
size: "1.5rem",
|
|
509
|
+
lineHeight: "2.125rem",
|
|
510
|
+
weight: 600
|
|
511
|
+
},
|
|
512
|
+
"2xl": {
|
|
513
|
+
size: "1.875rem",
|
|
514
|
+
lineHeight: "2.5rem",
|
|
515
|
+
weight: 600
|
|
516
|
+
}
|
|
517
|
+
},
|
|
262
518
|
typography: {
|
|
263
519
|
families: {
|
|
264
520
|
sans: "'Inter', 'Helvetica Neue', Arial, sans-serif",
|
|
@@ -399,77 +655,365 @@ var toVariableName = (prefix, ...parts) => {
|
|
|
399
655
|
var createCssVariableMap = (tokens2, options = {}) => {
|
|
400
656
|
const prefix = options.prefix ?? DEFAULT_PREFIX;
|
|
401
657
|
const map = {};
|
|
658
|
+
const baseTokens = tokens2;
|
|
402
659
|
const assign = (name, value) => {
|
|
403
660
|
if (value === void 0) return;
|
|
404
661
|
map[name] = String(value);
|
|
405
662
|
};
|
|
406
|
-
Object.entries(
|
|
663
|
+
Object.entries(baseTokens.colors).forEach(([group, scale]) => {
|
|
407
664
|
Object.entries(scale).forEach(([step, value]) => {
|
|
408
665
|
assign(toVariableName(prefix, "color", group, step), value);
|
|
409
666
|
});
|
|
410
667
|
});
|
|
411
|
-
Object.entries(
|
|
668
|
+
Object.entries(baseTokens.spacing).forEach(([key, value]) => {
|
|
412
669
|
assign(toVariableName(prefix, "space", key), value);
|
|
413
670
|
});
|
|
414
|
-
Object.entries(
|
|
671
|
+
Object.entries(baseTokens.radii).forEach(([key, value]) => {
|
|
415
672
|
assign(toVariableName(prefix, "radius", key), value);
|
|
416
673
|
});
|
|
417
|
-
Object.entries(
|
|
674
|
+
Object.entries(baseTokens.typography.families).forEach(([key, value]) => {
|
|
418
675
|
assign(toVariableName(prefix, "font-family", key), value);
|
|
419
676
|
});
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
677
|
+
const typographyScale = baseTokens.typography?.scale ?? {};
|
|
678
|
+
const fontScale = baseTokens.font;
|
|
679
|
+
if (fontScale && Object.keys(fontScale).length > 0) {
|
|
680
|
+
Object.entries(fontScale).forEach(([key, entry]) => {
|
|
681
|
+
assign(toVariableName(prefix, "font", key, "size"), entry.size);
|
|
682
|
+
assign(toVariableName(prefix, "font", key, "line-height"), entry.lineHeight);
|
|
683
|
+
assign(toVariableName(prefix, "font", key, "weight"), entry.weight);
|
|
684
|
+
});
|
|
685
|
+
} else {
|
|
686
|
+
Object.entries(typographyScale).forEach(([key, entry]) => {
|
|
687
|
+
assign(toVariableName(prefix, "font", key, "size"), entry.fontSize);
|
|
688
|
+
assign(toVariableName(prefix, "font", key, "line-height"), entry.lineHeight);
|
|
689
|
+
assign(toVariableName(prefix, "font", key, "weight"), entry.fontWeight);
|
|
690
|
+
});
|
|
691
|
+
}
|
|
692
|
+
Object.entries(typographyScale).forEach(([key, entry]) => {
|
|
424
693
|
assign(toVariableName(prefix, "font", key, "letter-spacing"), entry.letterSpacing);
|
|
425
694
|
});
|
|
426
|
-
|
|
695
|
+
assign(toVariableName(prefix, "text", "on", "page", "default"), tokens2.text.onPage.default);
|
|
696
|
+
assign(toVariableName(prefix, "text", "on", "page", "muted"), tokens2.text.onPage.muted);
|
|
697
|
+
assign(toVariableName(prefix, "text", "on", "surface", "default"), tokens2.text.onSurface.default);
|
|
698
|
+
assign(toVariableName(prefix, "text", "on", "surface", "muted"), tokens2.text.onSurface.muted);
|
|
699
|
+
assign(toVariableName(prefix, "text", "on", "surface", "meta"), tokens2.text.onSurface.meta);
|
|
700
|
+
const badge = tokens2.component?.badge;
|
|
701
|
+
if (badge) {
|
|
702
|
+
assign(toVariableName(prefix, "badge", "primary", "bg"), badge.primary.bg);
|
|
703
|
+
assign(toVariableName(prefix, "badge", "primary", "text"), badge.primary.text);
|
|
704
|
+
assign(toVariableName(prefix, "badge", "success", "bg"), badge.success.bg);
|
|
705
|
+
assign(toVariableName(prefix, "badge", "success", "text"), badge.success.text);
|
|
706
|
+
assign(toVariableName(prefix, "badge", "warning", "bg"), badge.warning.bg);
|
|
707
|
+
assign(toVariableName(prefix, "badge", "warning", "text"), badge.warning.text);
|
|
708
|
+
assign(toVariableName(prefix, "badge", "danger", "bg"), badge.danger.bg);
|
|
709
|
+
assign(toVariableName(prefix, "badge", "danger", "text"), badge.danger.text);
|
|
710
|
+
}
|
|
711
|
+
Object.entries(baseTokens.shadows).forEach(([key, value]) => {
|
|
427
712
|
assign(toVariableName(prefix, "shadow", key), value);
|
|
428
713
|
});
|
|
429
|
-
Object.entries(
|
|
714
|
+
Object.entries(baseTokens.breakpoints).forEach(([key, value]) => {
|
|
430
715
|
assign(toVariableName(prefix, "breakpoint", key), value);
|
|
431
716
|
});
|
|
432
|
-
Object.entries(
|
|
717
|
+
Object.entries(baseTokens.zIndex).forEach(([key, value]) => {
|
|
433
718
|
assign(toVariableName(prefix, "z-index", key), value);
|
|
434
719
|
});
|
|
435
|
-
Object.entries(
|
|
720
|
+
Object.entries(baseTokens.transitions.duration).forEach(([key, value]) => {
|
|
436
721
|
assign(toVariableName(prefix, "duration", key), value);
|
|
437
722
|
});
|
|
438
|
-
Object.entries(
|
|
723
|
+
Object.entries(baseTokens.transitions.easing).forEach(([key, value]) => {
|
|
439
724
|
assign(toVariableName(prefix, "easing", key), value);
|
|
440
725
|
});
|
|
441
|
-
Object.entries(
|
|
726
|
+
Object.entries(baseTokens.opacity).forEach(([key, value]) => {
|
|
442
727
|
assign(toVariableName(prefix, "opacity", key), value);
|
|
443
728
|
});
|
|
444
|
-
assign(toVariableName(prefix, "focus-ring-width"),
|
|
445
|
-
assign(toVariableName(prefix, "focus-ring-offset"),
|
|
446
|
-
assign(toVariableName(prefix, "focus-ring-style"),
|
|
447
|
-
assign(toVariableName(prefix, "min-touch-target"),
|
|
448
|
-
assign(toVariableName(prefix, "min-text-size"),
|
|
449
|
-
Object.entries(
|
|
729
|
+
assign(toVariableName(prefix, "focus-ring-width"), baseTokens.accessibility.focusRing.width);
|
|
730
|
+
assign(toVariableName(prefix, "focus-ring-offset"), baseTokens.accessibility.focusRing.offset);
|
|
731
|
+
assign(toVariableName(prefix, "focus-ring-style"), baseTokens.accessibility.focusRing.style);
|
|
732
|
+
assign(toVariableName(prefix, "min-touch-target"), baseTokens.accessibility.minTouchTarget);
|
|
733
|
+
assign(toVariableName(prefix, "min-text-size"), baseTokens.accessibility.minTextSize);
|
|
734
|
+
Object.entries(baseTokens.buttons).forEach(([variant, states]) => {
|
|
450
735
|
Object.entries(states).forEach(([state, value]) => {
|
|
451
736
|
assign(toVariableName(prefix, "button", variant, state), value);
|
|
452
737
|
});
|
|
453
738
|
});
|
|
454
|
-
Object.entries(
|
|
739
|
+
Object.entries(baseTokens.forms).forEach(([state, properties]) => {
|
|
455
740
|
Object.entries(properties).forEach(([prop, value]) => {
|
|
456
741
|
if (value) assign(toVariableName(prefix, "form", state, prop), value);
|
|
457
742
|
});
|
|
458
743
|
});
|
|
459
|
-
Object.entries(
|
|
744
|
+
Object.entries(baseTokens.animations).forEach(([name, animation]) => {
|
|
460
745
|
assign(toVariableName(prefix, "animation", name, "duration"), animation.duration);
|
|
461
746
|
assign(toVariableName(prefix, "animation", name, "easing"), animation.easing);
|
|
462
747
|
assign(toVariableName(prefix, "animation", name, "keyframes"), animation.keyframes);
|
|
463
748
|
});
|
|
464
749
|
return map;
|
|
465
750
|
};
|
|
751
|
+
var resolveSemanticValue = (value) => {
|
|
752
|
+
if (typeof value === "string" || typeof value === "number") return String(value);
|
|
753
|
+
if (value && typeof value === "object" && "value" in value) {
|
|
754
|
+
return String(value.value);
|
|
755
|
+
}
|
|
756
|
+
return void 0;
|
|
757
|
+
};
|
|
758
|
+
var getPath = (source, path) => path.reduce((acc, key) => acc && typeof acc === "object" ? acc[key] : void 0, source);
|
|
759
|
+
var pickSemantic = (...candidates) => {
|
|
760
|
+
for (const candidate of candidates) {
|
|
761
|
+
const resolved = resolveSemanticValue(candidate);
|
|
762
|
+
if (resolved !== void 0) return resolved;
|
|
763
|
+
}
|
|
764
|
+
return void 0;
|
|
765
|
+
};
|
|
466
766
|
var generateCssVariables = (tokens2, options = {}) => {
|
|
467
767
|
const selector = options.selector ?? DEFAULT_SELECTOR;
|
|
468
|
-
const
|
|
469
|
-
const
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
}
|
|
768
|
+
const prefix = options.prefix ?? DEFAULT_PREFIX;
|
|
769
|
+
const declarations = createCssVariableMap(tokens2, { ...options, prefix });
|
|
770
|
+
const mapLines = Object.entries(declarations).map(([name, value]) => ` ${name}: ${value};`);
|
|
771
|
+
const defaultMode = tokens2.modes?.default ?? {};
|
|
772
|
+
const darkMode = tokens2.modes?.dark ?? {};
|
|
773
|
+
const surfaceAliases = tokens2.surface ?? {};
|
|
774
|
+
const textAliases = tokens2.text ?? {};
|
|
775
|
+
const componentAliases = tokens2.component ?? {};
|
|
776
|
+
const baseLines = [];
|
|
777
|
+
const addBase = (name, value) => {
|
|
778
|
+
if (value !== void 0) baseLines.push(` ${name}: ${value};`);
|
|
779
|
+
};
|
|
780
|
+
addBase(toVariableName(prefix, "surface", "page"), pickSemantic(getPath(defaultMode, ["surface", "page"]), getPath(surfaceAliases, ["page"])));
|
|
781
|
+
addBase(toVariableName(prefix, "surface", "card"), pickSemantic(getPath(defaultMode, ["surface", "card"]), getPath(surfaceAliases, ["card"])));
|
|
782
|
+
addBase(toVariableName(prefix, "surface", "input"), pickSemantic(getPath(defaultMode, ["surface", "input"]), getPath(surfaceAliases, ["input"])));
|
|
783
|
+
addBase(toVariableName(prefix, "surface", "overlay"), pickSemantic(getPath(defaultMode, ["surface", "overlay"]), getPath(surfaceAliases, ["overlay"])));
|
|
784
|
+
addBase(toVariableName(prefix, "text", "on", "page", "default"), pickSemantic(getPath(defaultMode, ["text", "onPage", "default"]), getPath(textAliases, ["onPage", "default"])));
|
|
785
|
+
addBase(toVariableName(prefix, "text", "on", "page", "muted"), pickSemantic(getPath(defaultMode, ["text", "onPage", "muted"]), getPath(textAliases, ["onPage", "muted"])));
|
|
786
|
+
addBase(toVariableName(prefix, "text", "on", "page", "meta"), pickSemantic(getPath(defaultMode, ["text", "onPage", "meta"]), getPath(textAliases, ["onPage", "meta"])));
|
|
787
|
+
addBase(toVariableName(prefix, "text", "on", "surface", "default"), pickSemantic(getPath(defaultMode, ["text", "onSurface", "default"]), getPath(textAliases, ["onSurface", "default"])));
|
|
788
|
+
addBase(toVariableName(prefix, "text", "on", "surface", "muted"), pickSemantic(getPath(defaultMode, ["text", "onSurface", "muted"]), getPath(textAliases, ["onSurface", "muted"])));
|
|
789
|
+
addBase(toVariableName(prefix, "text", "on", "surface", "meta"), pickSemantic(getPath(defaultMode, ["text", "onSurface", "meta"]), getPath(textAliases, ["onSurface", "meta"])));
|
|
790
|
+
addBase(toVariableName(prefix, "component", "card", "text"), pickSemantic(getPath(defaultMode, ["component", "card", "text"]), getPath(componentAliases, ["card", "text"])));
|
|
791
|
+
addBase(toVariableName(prefix, "component", "card", "text-muted"), pickSemantic(getPath(defaultMode, ["component", "card", "textMuted"]), getPath(componentAliases, ["card", "textMuted"])));
|
|
792
|
+
addBase(toVariableName(prefix, "component", "input", "text"), pickSemantic(getPath(defaultMode, ["component", "input", "text"]), getPath(componentAliases, ["input", "text"])));
|
|
793
|
+
addBase(toVariableName(prefix, "component", "input", "placeholder"), pickSemantic(getPath(defaultMode, ["component", "input", "placeholder"]), getPath(componentAliases, ["input", "placeholder"])));
|
|
794
|
+
addBase(toVariableName(prefix, "button", "text", "default"), pickSemantic(getPath(defaultMode, ["component", "button", "textDefault"]), getPath(componentAliases, ["button", "textDefault"])));
|
|
795
|
+
addBase(toVariableName(prefix, "button", "text", "on", "primary"), pickSemantic(getPath(defaultMode, ["component", "button", "textOnPrimary"]), getPath(componentAliases, ["button", "textOnPrimary"])));
|
|
796
|
+
addBase(
|
|
797
|
+
toVariableName(prefix, "badge", "primary", "bg"),
|
|
798
|
+
pickSemantic(getPath(defaultMode, ["component", "badge", "primary", "bg"]), getPath(componentAliases, ["badge", "primary", "bg"]))
|
|
799
|
+
);
|
|
800
|
+
addBase(
|
|
801
|
+
toVariableName(prefix, "badge", "primary", "text"),
|
|
802
|
+
pickSemantic(getPath(defaultMode, ["component", "badge", "primary", "text"]), getPath(componentAliases, ["badge", "primary", "text"]))
|
|
803
|
+
);
|
|
804
|
+
addBase(
|
|
805
|
+
toVariableName(prefix, "badge", "success", "bg"),
|
|
806
|
+
pickSemantic(getPath(defaultMode, ["component", "badge", "success", "bg"]), getPath(componentAliases, ["badge", "success", "bg"]))
|
|
807
|
+
);
|
|
808
|
+
addBase(
|
|
809
|
+
toVariableName(prefix, "badge", "success", "text"),
|
|
810
|
+
pickSemantic(getPath(defaultMode, ["component", "badge", "success", "text"]), getPath(componentAliases, ["badge", "success", "text"]))
|
|
811
|
+
);
|
|
812
|
+
addBase(
|
|
813
|
+
toVariableName(prefix, "badge", "warning", "bg"),
|
|
814
|
+
pickSemantic(getPath(defaultMode, ["component", "badge", "warning", "bg"]), getPath(componentAliases, ["badge", "warning", "bg"]))
|
|
815
|
+
);
|
|
816
|
+
addBase(
|
|
817
|
+
toVariableName(prefix, "badge", "warning", "text"),
|
|
818
|
+
pickSemantic(getPath(defaultMode, ["component", "badge", "warning", "text"]), getPath(componentAliases, ["badge", "warning", "text"]))
|
|
819
|
+
);
|
|
820
|
+
addBase(
|
|
821
|
+
toVariableName(prefix, "badge", "danger", "bg"),
|
|
822
|
+
pickSemantic(getPath(defaultMode, ["component", "badge", "danger", "bg"]), getPath(componentAliases, ["badge", "danger", "bg"]))
|
|
823
|
+
);
|
|
824
|
+
addBase(
|
|
825
|
+
toVariableName(prefix, "badge", "danger", "text"),
|
|
826
|
+
pickSemantic(getPath(defaultMode, ["component", "badge", "danger", "text"]), getPath(componentAliases, ["badge", "danger", "text"]))
|
|
827
|
+
);
|
|
828
|
+
const rootLines = [...baseLines, ...mapLines];
|
|
829
|
+
const darkLines = [];
|
|
830
|
+
const addDark = (name, value) => {
|
|
831
|
+
if (value !== void 0) darkLines.push(` ${name}: ${value};`);
|
|
832
|
+
};
|
|
833
|
+
addDark(
|
|
834
|
+
toVariableName(prefix, "surface", "page"),
|
|
835
|
+
pickSemantic(getPath(darkMode, ["surface", "page"]), getPath(defaultMode, ["surface", "page"]), getPath(surfaceAliases, ["page"]))
|
|
836
|
+
);
|
|
837
|
+
addDark(
|
|
838
|
+
toVariableName(prefix, "surface", "card"),
|
|
839
|
+
pickSemantic(getPath(darkMode, ["surface", "card"]), getPath(defaultMode, ["surface", "card"]), getPath(surfaceAliases, ["card"]))
|
|
840
|
+
);
|
|
841
|
+
addDark(
|
|
842
|
+
toVariableName(prefix, "surface", "input"),
|
|
843
|
+
pickSemantic(getPath(darkMode, ["surface", "input"]), getPath(defaultMode, ["surface", "input"]), getPath(surfaceAliases, ["input"]))
|
|
844
|
+
);
|
|
845
|
+
addDark(
|
|
846
|
+
toVariableName(prefix, "surface", "overlay"),
|
|
847
|
+
pickSemantic(getPath(darkMode, ["surface", "overlay"]), getPath(defaultMode, ["surface", "overlay"]), getPath(surfaceAliases, ["overlay"]))
|
|
848
|
+
);
|
|
849
|
+
addDark(
|
|
850
|
+
toVariableName(prefix, "text", "on", "page", "default"),
|
|
851
|
+
pickSemantic(
|
|
852
|
+
getPath(darkMode, ["text", "onPage", "default"]),
|
|
853
|
+
getPath(defaultMode, ["text", "onPage", "default"]),
|
|
854
|
+
getPath(textAliases, ["onPage", "default"])
|
|
855
|
+
)
|
|
856
|
+
);
|
|
857
|
+
addDark(
|
|
858
|
+
toVariableName(prefix, "text", "on", "page", "muted"),
|
|
859
|
+
pickSemantic(
|
|
860
|
+
getPath(darkMode, ["text", "onPage", "muted"]),
|
|
861
|
+
getPath(defaultMode, ["text", "onPage", "muted"]),
|
|
862
|
+
getPath(textAliases, ["onPage", "muted"])
|
|
863
|
+
)
|
|
864
|
+
);
|
|
865
|
+
addDark(
|
|
866
|
+
toVariableName(prefix, "text", "on", "page", "meta"),
|
|
867
|
+
pickSemantic(
|
|
868
|
+
getPath(darkMode, ["text", "onPage", "meta"]),
|
|
869
|
+
getPath(defaultMode, ["text", "onPage", "meta"]),
|
|
870
|
+
getPath(textAliases, ["onPage", "meta"])
|
|
871
|
+
)
|
|
872
|
+
);
|
|
873
|
+
addDark(
|
|
874
|
+
toVariableName(prefix, "text", "on", "surface", "default"),
|
|
875
|
+
pickSemantic(
|
|
876
|
+
getPath(darkMode, ["text", "onSurface", "default"]),
|
|
877
|
+
getPath(defaultMode, ["text", "onSurface", "default"]),
|
|
878
|
+
getPath(textAliases, ["onSurface", "default"])
|
|
879
|
+
)
|
|
880
|
+
);
|
|
881
|
+
addDark(
|
|
882
|
+
toVariableName(prefix, "text", "on", "surface", "muted"),
|
|
883
|
+
pickSemantic(
|
|
884
|
+
getPath(darkMode, ["text", "onSurface", "muted"]),
|
|
885
|
+
getPath(defaultMode, ["text", "onSurface", "muted"]),
|
|
886
|
+
getPath(textAliases, ["onSurface", "muted"])
|
|
887
|
+
)
|
|
888
|
+
);
|
|
889
|
+
addDark(
|
|
890
|
+
toVariableName(prefix, "text", "on", "surface", "meta"),
|
|
891
|
+
pickSemantic(
|
|
892
|
+
getPath(darkMode, ["text", "onSurface", "meta"]),
|
|
893
|
+
getPath(defaultMode, ["text", "onSurface", "meta"]),
|
|
894
|
+
getPath(textAliases, ["onSurface", "meta"])
|
|
895
|
+
)
|
|
896
|
+
);
|
|
897
|
+
addDark(
|
|
898
|
+
toVariableName(prefix, "component", "card", "text"),
|
|
899
|
+
pickSemantic(
|
|
900
|
+
getPath(darkMode, ["component", "card", "text"]),
|
|
901
|
+
getPath(defaultMode, ["component", "card", "text"]),
|
|
902
|
+
getPath(componentAliases, ["card", "text"])
|
|
903
|
+
)
|
|
904
|
+
);
|
|
905
|
+
addDark(
|
|
906
|
+
toVariableName(prefix, "component", "card", "text-muted"),
|
|
907
|
+
pickSemantic(
|
|
908
|
+
getPath(darkMode, ["component", "card", "textMuted"]),
|
|
909
|
+
getPath(defaultMode, ["component", "card", "textMuted"]),
|
|
910
|
+
getPath(componentAliases, ["card", "textMuted"])
|
|
911
|
+
)
|
|
912
|
+
);
|
|
913
|
+
addDark(
|
|
914
|
+
toVariableName(prefix, "component", "input", "text"),
|
|
915
|
+
pickSemantic(
|
|
916
|
+
getPath(darkMode, ["component", "input", "text"]),
|
|
917
|
+
getPath(defaultMode, ["component", "input", "text"]),
|
|
918
|
+
getPath(componentAliases, ["input", "text"])
|
|
919
|
+
)
|
|
920
|
+
);
|
|
921
|
+
addDark(
|
|
922
|
+
toVariableName(prefix, "component", "input", "placeholder"),
|
|
923
|
+
pickSemantic(
|
|
924
|
+
getPath(darkMode, ["component", "input", "placeholder"]),
|
|
925
|
+
getPath(defaultMode, ["component", "input", "placeholder"]),
|
|
926
|
+
getPath(componentAliases, ["input", "placeholder"])
|
|
927
|
+
)
|
|
928
|
+
);
|
|
929
|
+
addDark(
|
|
930
|
+
toVariableName(prefix, "button", "text", "default"),
|
|
931
|
+
pickSemantic(
|
|
932
|
+
getPath(darkMode, ["component", "button", "textDefault"]),
|
|
933
|
+
getPath(defaultMode, ["component", "button", "textDefault"]),
|
|
934
|
+
getPath(componentAliases, ["button", "textDefault"])
|
|
935
|
+
)
|
|
936
|
+
);
|
|
937
|
+
addDark(
|
|
938
|
+
toVariableName(prefix, "button", "text", "on", "primary"),
|
|
939
|
+
pickSemantic(
|
|
940
|
+
getPath(darkMode, ["component", "button", "textOnPrimary"]),
|
|
941
|
+
getPath(defaultMode, ["component", "button", "textOnPrimary"]),
|
|
942
|
+
getPath(componentAliases, ["button", "textOnPrimary"])
|
|
943
|
+
)
|
|
944
|
+
);
|
|
945
|
+
addDark(
|
|
946
|
+
toVariableName(prefix, "badge", "primary", "bg"),
|
|
947
|
+
pickSemantic(
|
|
948
|
+
getPath(darkMode, ["component", "badge", "primary", "bg"]),
|
|
949
|
+
getPath(defaultMode, ["component", "badge", "primary", "bg"]),
|
|
950
|
+
getPath(componentAliases, ["badge", "primary", "bg"])
|
|
951
|
+
)
|
|
952
|
+
);
|
|
953
|
+
addDark(
|
|
954
|
+
toVariableName(prefix, "badge", "primary", "text"),
|
|
955
|
+
pickSemantic(
|
|
956
|
+
getPath(darkMode, ["component", "badge", "primary", "text"]),
|
|
957
|
+
getPath(defaultMode, ["component", "badge", "primary", "text"]),
|
|
958
|
+
getPath(componentAliases, ["badge", "primary", "text"])
|
|
959
|
+
)
|
|
960
|
+
);
|
|
961
|
+
addDark(
|
|
962
|
+
toVariableName(prefix, "badge", "success", "bg"),
|
|
963
|
+
pickSemantic(
|
|
964
|
+
getPath(darkMode, ["component", "badge", "success", "bg"]),
|
|
965
|
+
getPath(defaultMode, ["component", "badge", "success", "bg"]),
|
|
966
|
+
getPath(componentAliases, ["badge", "success", "bg"])
|
|
967
|
+
)
|
|
968
|
+
);
|
|
969
|
+
addDark(
|
|
970
|
+
toVariableName(prefix, "badge", "success", "text"),
|
|
971
|
+
pickSemantic(
|
|
972
|
+
getPath(darkMode, ["component", "badge", "success", "text"]),
|
|
973
|
+
getPath(defaultMode, ["component", "badge", "success", "text"]),
|
|
974
|
+
getPath(componentAliases, ["badge", "success", "text"])
|
|
975
|
+
)
|
|
976
|
+
);
|
|
977
|
+
addDark(
|
|
978
|
+
toVariableName(prefix, "badge", "warning", "bg"),
|
|
979
|
+
pickSemantic(
|
|
980
|
+
getPath(darkMode, ["component", "badge", "warning", "bg"]),
|
|
981
|
+
getPath(defaultMode, ["component", "badge", "warning", "bg"]),
|
|
982
|
+
getPath(componentAliases, ["badge", "warning", "bg"])
|
|
983
|
+
)
|
|
984
|
+
);
|
|
985
|
+
addDark(
|
|
986
|
+
toVariableName(prefix, "badge", "warning", "text"),
|
|
987
|
+
pickSemantic(
|
|
988
|
+
getPath(darkMode, ["component", "badge", "warning", "text"]),
|
|
989
|
+
getPath(defaultMode, ["component", "badge", "warning", "text"]),
|
|
990
|
+
getPath(componentAliases, ["badge", "warning", "text"])
|
|
991
|
+
)
|
|
992
|
+
);
|
|
993
|
+
addDark(
|
|
994
|
+
toVariableName(prefix, "badge", "danger", "bg"),
|
|
995
|
+
pickSemantic(
|
|
996
|
+
getPath(darkMode, ["component", "badge", "danger", "bg"]),
|
|
997
|
+
getPath(defaultMode, ["component", "badge", "danger", "bg"]),
|
|
998
|
+
getPath(componentAliases, ["badge", "danger", "bg"])
|
|
999
|
+
)
|
|
1000
|
+
);
|
|
1001
|
+
addDark(
|
|
1002
|
+
toVariableName(prefix, "badge", "danger", "text"),
|
|
1003
|
+
pickSemantic(
|
|
1004
|
+
getPath(darkMode, ["component", "badge", "danger", "text"]),
|
|
1005
|
+
getPath(defaultMode, ["component", "badge", "danger", "text"]),
|
|
1006
|
+
getPath(componentAliases, ["badge", "danger", "text"])
|
|
1007
|
+
)
|
|
1008
|
+
);
|
|
1009
|
+
const rootBlock = `${selector} {
|
|
1010
|
+
${rootLines.join("\n")}
|
|
1011
|
+
}`;
|
|
1012
|
+
const darkBlock = `${selector}[data-spectre-theme="dark"] {
|
|
1013
|
+
${darkLines.join("\n")}
|
|
1014
|
+
}`;
|
|
1015
|
+
return `${rootBlock}
|
|
1016
|
+
${darkBlock}
|
|
473
1017
|
`;
|
|
474
1018
|
};
|
|
475
1019
|
|