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