@loworbitstudio/visor-theme-engine 0.17.0 → 0.17.1

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.
@@ -1,4 +1,4 @@
1
- import { k as GeneratedPrimitives, r as SemanticTokens, R as ResolvedThemeConfig } from '../types-DqsWwFVZ.js';
1
+ import { k as GeneratedPrimitives, s as SemanticTokens, R as ResolvedThemeConfig } from '../types-Cvm7vFwe.js';
2
2
 
3
3
  /**
4
4
  * Adapter types for the Visor theme engine.
@@ -20,7 +20,7 @@ import {
20
20
  resolveThemeBrand,
21
21
  resolveThemeFonts,
22
22
  sectionComment
23
- } from "../chunk-DQ256PSE.js";
23
+ } from "../chunk-BUWBBUFG.js";
24
24
 
25
25
  // src/adapters/brand-passthrough.ts
26
26
  var SENTINEL_COLOR = "#ff00ff";
@@ -43,7 +43,7 @@ function indentBlock(selector, decls) {
43
43
  if (decls.length === 0) return "";
44
44
  return [selector + " {", ...decls.map((d) => ` ${d}`), "}"].join("\n");
45
45
  }
46
- function generateBrandPassthroughCss(passthrough, selectors) {
46
+ function generateBrandPassthroughCss(passthrough, selectors, colorScheme = "adaptive") {
47
47
  const lightKeys = Object.keys(passthrough.light);
48
48
  const darkKeys = Object.keys(passthrough.dark);
49
49
  if (lightKeys.length === 0 && darkKeys.length === 0) return "";
@@ -53,6 +53,20 @@ function generateBrandPassthroughCss(passthrough, selectors) {
53
53
  const count = lightKeys.length + darkKeys.length;
54
54
  blocks.push(`/* [visor-brand] ${count} passthrough: ${names} */`);
55
55
  }
56
+ if (colorScheme === "dark-only") {
57
+ if (darkKeys.length > 0) {
58
+ const decls = darkKeys.map((k) => declFor(k, passthrough.dark[k]));
59
+ blocks.push(indentBlock(selectors.light, decls));
60
+ }
61
+ return blocks.filter(Boolean).join("\n\n");
62
+ }
63
+ if (colorScheme === "light-only") {
64
+ if (lightKeys.length > 0) {
65
+ const decls = lightKeys.map((k) => declFor(k, passthrough.light[k]));
66
+ blocks.push(indentBlock(selectors.light, decls));
67
+ }
68
+ return blocks.filter(Boolean).join("\n\n");
69
+ }
56
70
  if (lightKeys.length > 0) {
57
71
  const decls = lightKeys.map((k) => declFor(k, passthrough.light[k]));
58
72
  blocks.push(indentBlock(selectors.light, decls));
@@ -86,6 +100,7 @@ function nextjsAdapter(input, options) {
86
100
  const includeFontImports = options?.includeFontImports ?? true;
87
101
  const includeFowt = options?.includeFowt ?? true;
88
102
  const scopePrefix = options?.scopePrefix;
103
+ const colorScheme = input.config["color-scheme"] ?? "adaptive";
89
104
  const lines = [];
90
105
  const slug = toKebabCase(input.config.name);
91
106
  const aliasedFamilies = /* @__PURE__ */ new Map();
@@ -156,7 +171,7 @@ function nextjsAdapter(input, options) {
156
171
  light: scopePrefix ?? ":root",
157
172
  dark: darkSelectors.join(",\n"),
158
173
  prefers: scopePrefix ? `${scopePrefix}:not(.light):not(.theme-light):not([data-theme="light"])` : ':root:not(.light):not(.theme-light):not([data-theme="light"])'
159
- });
174
+ }, colorScheme);
160
175
  if (passthroughCss) {
161
176
  lines.push(wrapInLayer("visor-brand", passthroughCss));
162
177
  lines.push("");
@@ -173,43 +188,60 @@ function nextjsAdapter(input, options) {
173
188
  semanticLines.push(sectionComment("Discrete: Space aliases (--space-N)"));
174
189
  semanticLines.push(block(hostSelector, generateSpaceAliasDecls(input.config)));
175
190
  semanticLines.push("");
176
- semanticLines.push(sectionComment("Intent aliases (light)"));
177
- semanticLines.push(block(lightModeSelector, generateIntentDecls(input.tokens, "light")));
178
- semanticLines.push("");
179
- semanticLines.push(sectionComment("Hairline aliases (light)"));
180
- semanticLines.push(block(lightModeSelector, generateHairlineDecls(input.tokens, "light")));
181
- semanticLines.push("");
182
- semanticLines.push(sectionComment("Intent aliases (dark) \u2014 manual toggle"));
183
- semanticLines.push(block(darkModeSelector, generateIntentDecls(input.tokens, "dark")));
184
- semanticLines.push("");
185
- semanticLines.push(sectionComment("Hairline aliases (dark) \u2014 manual toggle"));
186
- semanticLines.push(block(darkModeSelector, generateHairlineDecls(input.tokens, "dark")));
187
- semanticLines.push("");
188
- semanticLines.push(sectionComment("Intent aliases (dark) \u2014 prefers-color-scheme"));
189
- {
190
- const inner = block(prefersSelector, generateIntentDecls(input.tokens, "dark"));
191
- semanticLines.push(`@media (prefers-color-scheme: dark) {
191
+ if (colorScheme === "dark-only") {
192
+ semanticLines.push(sectionComment("Intent aliases (dark) \u2014 host"));
193
+ semanticLines.push(block(hostSelector, generateIntentDecls(input.tokens, "dark")));
194
+ semanticLines.push("");
195
+ semanticLines.push(sectionComment("Hairline aliases (dark) \u2014 host"));
196
+ semanticLines.push(block(hostSelector, generateHairlineDecls(input.tokens, "dark")));
197
+ semanticLines.push("");
198
+ } else if (colorScheme === "light-only") {
199
+ semanticLines.push(sectionComment("Intent aliases (light) \u2014 host"));
200
+ semanticLines.push(block(hostSelector, generateIntentDecls(input.tokens, "light")));
201
+ semanticLines.push("");
202
+ semanticLines.push(sectionComment("Hairline aliases (light) \u2014 host"));
203
+ semanticLines.push(block(hostSelector, generateHairlineDecls(input.tokens, "light")));
204
+ semanticLines.push("");
205
+ } else {
206
+ semanticLines.push(sectionComment("Intent aliases (light)"));
207
+ semanticLines.push(block(lightModeSelector, generateIntentDecls(input.tokens, "light")));
208
+ semanticLines.push("");
209
+ semanticLines.push(sectionComment("Hairline aliases (light)"));
210
+ semanticLines.push(block(lightModeSelector, generateHairlineDecls(input.tokens, "light")));
211
+ semanticLines.push("");
212
+ semanticLines.push(sectionComment("Intent aliases (dark) \u2014 manual toggle"));
213
+ semanticLines.push(block(darkModeSelector, generateIntentDecls(input.tokens, "dark")));
214
+ semanticLines.push("");
215
+ semanticLines.push(sectionComment("Hairline aliases (dark) \u2014 manual toggle"));
216
+ semanticLines.push(block(darkModeSelector, generateHairlineDecls(input.tokens, "dark")));
217
+ semanticLines.push("");
218
+ semanticLines.push(sectionComment("Intent aliases (dark) \u2014 prefers-color-scheme"));
219
+ {
220
+ const inner = block(prefersSelector, generateIntentDecls(input.tokens, "dark"));
221
+ semanticLines.push(`@media (prefers-color-scheme: dark) {
192
222
  ${inner.split("\n").map((l) => ` ${l}`).join("\n")}
193
223
  }`);
194
- }
195
- semanticLines.push("");
196
- semanticLines.push(sectionComment("Hairline aliases (dark) \u2014 prefers-color-scheme"));
197
- {
198
- const inner = block(prefersSelector, generateHairlineDecls(input.tokens, "dark"));
199
- semanticLines.push(`@media (prefers-color-scheme: dark) {
224
+ }
225
+ semanticLines.push("");
226
+ semanticLines.push(sectionComment("Hairline aliases (dark) \u2014 prefers-color-scheme"));
227
+ {
228
+ const inner = block(prefersSelector, generateHairlineDecls(input.tokens, "dark"));
229
+ semanticLines.push(`@media (prefers-color-scheme: dark) {
200
230
  ${inner.split("\n").map((l) => ` ${l}`).join("\n")}
201
231
  }`);
232
+ }
233
+ semanticLines.push("");
202
234
  }
203
- semanticLines.push("");
204
235
  const semanticLayer = wrapInLayer("visor-semantic", semanticLines.join("\n").trim());
205
236
  if (semanticLayer) {
206
237
  lines.push(semanticLayer);
207
238
  lines.push("");
208
239
  }
209
- const lightBody = stripHeader(generateLightCss(input.tokens, { scopePrefix }));
210
- const darkBody = stripHeader(generateDarkCss(input.tokens, { scopePrefix }));
240
+ const lightBody = stripHeader(generateLightCss(input.tokens, { scopePrefix, colorScheme }));
241
+ const darkBody = stripHeader(generateDarkCss(input.tokens, { scopePrefix, colorScheme }));
242
+ const adaptiveBody = [lightBody, darkBody].filter(Boolean).join("\n\n");
211
243
  lines.push(
212
- wrapInLayer("visor-adaptive", lightBody + "\n\n" + darkBody)
244
+ wrapInLayer("visor-adaptive", adaptiveBody)
213
245
  );
214
246
  if (includeFowt) {
215
247
  lines.push("");
@@ -554,6 +586,14 @@ function sectionComment2(label) {
554
586
  function docsAdapter(input, options) {
555
587
  const slug = toKebabCase3(input.config.name);
556
588
  const scopeClass = `.${slug}-theme`;
589
+ const colorScheme = input.config["color-scheme"] ?? "adaptive";
590
+ const singleMode = colorScheme === "dark-only" ? "dark" : colorScheme === "light-only" ? "light" : null;
591
+ const emitDark = colorScheme !== "light-only";
592
+ const emitLight = colorScheme !== "dark-only";
593
+ const emitPrefers = colorScheme === "adaptive";
594
+ const darkSel = singleMode ? scopeClass : `.dark ${scopeClass}`;
595
+ const lightSel = singleMode ? scopeClass : `html:not(.dark) ${scopeClass}`;
596
+ const darkSuffix = singleMode ? " \u2014 host" : " \u2014 manual toggle";
557
597
  const includeFontImports = options?.includeFontImports ?? true;
558
598
  const fontLines = [];
559
599
  const lines = [];
@@ -601,6 +641,8 @@ function docsAdapter(input, options) {
601
641
  const sharedDecls = [
602
642
  "min-height: 100vh;",
603
643
  "font-size: 1rem;",
644
+ // BO-56: pin UA chrome to the brand's single mode (adaptive emits nothing).
645
+ ...singleMode ? [`color-scheme: ${singleMode};`] : [],
604
646
  `background: var(--surface-page, var(--surface-background));`,
605
647
  "color: var(--text-primary);",
606
648
  "font-family: var(--font-sans);"
@@ -650,9 +692,9 @@ function docsAdapter(input, options) {
650
692
  }
651
693
  }
652
694
  }
653
- if (darkPrimitiveOverrides.length > 0) {
695
+ if (darkPrimitiveOverrides.length > 0 && emitDark) {
654
696
  lines.push(sectionComment2("Primitive overrides (dark) \u2014 dark brand color anchors at shade 500"));
655
- lines.push(block2(`.dark ${scopeClass}`, darkPrimitiveOverrides));
697
+ lines.push(block2(darkSel, darkPrimitiveOverrides));
656
698
  lines.push("");
657
699
  }
658
700
  const categories = ["Text", "Surface", "Border", "Interactive"];
@@ -662,10 +704,12 @@ function docsAdapter(input, options) {
662
704
  Object.entries(input.tokens.border).map(([n, v]) => `--border-${n}: ${v.dark};`),
663
705
  Object.entries(input.tokens.interactive).map(([n, v]) => `--interactive-${n}: ${v.dark};`)
664
706
  ];
665
- for (let i = 0; i < categories.length; i++) {
666
- lines.push(sectionComment2(`Adaptive: ${categories[i]} (dark) \u2014 manual toggle`));
667
- lines.push(block2(`.dark ${scopeClass}`, categoryDecls[i]));
668
- lines.push("");
707
+ if (emitDark) {
708
+ for (let i = 0; i < categories.length; i++) {
709
+ lines.push(sectionComment2(`Adaptive: ${categories[i]} (dark)${darkSuffix}`));
710
+ lines.push(block2(darkSel, categoryDecls[i]));
711
+ lines.push("");
712
+ }
669
713
  }
670
714
  const pcsCategories = [
671
715
  { label: "Text", entries: Object.entries(input.tokens.text).map(([n, v]) => `--text-${n}: ${v.dark};`) },
@@ -673,15 +717,17 @@ function docsAdapter(input, options) {
673
717
  { label: "Border", entries: Object.entries(input.tokens.border).map(([n, v]) => `--border-${n}: ${v.dark};`) },
674
718
  { label: "Interactive", entries: Object.entries(input.tokens.interactive).map(([n, v]) => `--interactive-${n}: ${v.dark};`) }
675
719
  ];
676
- for (const cat of pcsCategories) {
677
- lines.push(sectionComment2(`Adaptive: ${cat.label} (dark) \u2014 prefers-color-scheme`));
678
- const inner = block2(`${scopeClass}:not(.light):not(.theme-light):not([data-theme="light"])`, cat.entries);
679
- lines.push(`@media (prefers-color-scheme: dark) {
720
+ if (emitPrefers) {
721
+ for (const cat of pcsCategories) {
722
+ lines.push(sectionComment2(`Adaptive: ${cat.label} (dark) \u2014 prefers-color-scheme`));
723
+ const inner = block2(`${scopeClass}:not(.light):not(.theme-light):not([data-theme="light"])`, cat.entries);
724
+ lines.push(`@media (prefers-color-scheme: dark) {
680
725
  ${inner.split("\n").map((l) => ` ${l}`).join("\n")}
681
726
  }`);
682
- lines.push("");
727
+ lines.push("");
728
+ }
683
729
  }
684
- if (darkPrimitiveOverrides.length > 0) {
730
+ if (darkPrimitiveOverrides.length > 0 && emitPrefers) {
685
731
  lines.push(sectionComment2("Primitive overrides (dark) \u2014 prefers-color-scheme"));
686
732
  const inner = block2(`${scopeClass}:not(.light):not(.theme-light):not([data-theme="light"])`, darkPrimitiveOverrides);
687
733
  lines.push(`@media (prefers-color-scheme: dark) {
@@ -696,17 +742,23 @@ ${inner.split("\n").map((l) => ` ${l}`).join("\n")}
696
742
  { label: "Border", entries: Object.entries(input.tokens.border).map(([n, v]) => `--border-${n}: ${v.light};`) },
697
743
  { label: "Interactive", entries: Object.entries(input.tokens.interactive).map(([n, v]) => `--interactive-${n}: ${v.light};`) }
698
744
  ];
699
- for (const cat of lightCategoryDecls) {
700
- lines.push(sectionComment2(`Adaptive: ${cat.label} (light)`));
701
- lines.push(block2(`html:not(.dark) ${scopeClass}`, cat.entries));
745
+ if (emitLight) {
746
+ for (const cat of lightCategoryDecls) {
747
+ lines.push(sectionComment2(`Adaptive: ${cat.label} (light)`));
748
+ lines.push(block2(lightSel, cat.entries));
749
+ lines.push("");
750
+ }
751
+ }
752
+ if (emitDark) {
753
+ lines.push(sectionComment2("Fumadocs bridge: dark"));
754
+ lines.push(block2(darkSel, generateFumadocsBridgeDecls(input.tokens, "dark")));
755
+ lines.push("");
756
+ }
757
+ if (emitLight) {
758
+ lines.push(sectionComment2("Fumadocs bridge: light"));
759
+ lines.push(block2(lightSel, generateFumadocsBridgeDecls(input.tokens, "light")));
702
760
  lines.push("");
703
761
  }
704
- lines.push(sectionComment2("Fumadocs bridge: dark"));
705
- lines.push(block2(`.dark ${scopeClass}`, generateFumadocsBridgeDecls(input.tokens, "dark")));
706
- lines.push("");
707
- lines.push(sectionComment2("Fumadocs bridge: light"));
708
- lines.push(block2(`html:not(.dark) ${scopeClass}`, generateFumadocsBridgeDecls(input.tokens, "light")));
709
- lines.push("");
710
762
  const semanticLines = [];
711
763
  semanticLines.push("\n/* \u2500\u2500 Layer: Semantic aliases (VI-451) \u2500\u2500 */");
712
764
  semanticLines.push(sectionComment2("Discrete: Text size aliases (--text-N)"));
@@ -715,42 +767,49 @@ ${inner.split("\n").map((l) => ` ${l}`).join("\n")}
715
767
  semanticLines.push(sectionComment2("Discrete: Space aliases (--space-N)"));
716
768
  semanticLines.push(block2(scopeClass, generateSpaceAliasDecls(input.config)));
717
769
  semanticLines.push("");
718
- semanticLines.push(sectionComment2("Intent aliases (light)"));
719
- semanticLines.push(block2(`html:not(.dark) ${scopeClass}`, generateIntentDecls(input.tokens, "light")));
720
- semanticLines.push("");
721
- semanticLines.push(sectionComment2("Hairline aliases (light)"));
722
- semanticLines.push(block2(`html:not(.dark) ${scopeClass}`, generateHairlineDecls(input.tokens, "light")));
723
- semanticLines.push("");
724
- semanticLines.push(sectionComment2("Intent aliases (dark) \u2014 manual toggle"));
725
- semanticLines.push(block2(`.dark ${scopeClass}`, generateIntentDecls(input.tokens, "dark")));
726
- semanticLines.push("");
727
- semanticLines.push(sectionComment2("Hairline aliases (dark) \u2014 manual toggle"));
728
- semanticLines.push(block2(`.dark ${scopeClass}`, generateHairlineDecls(input.tokens, "dark")));
729
- semanticLines.push("");
730
- semanticLines.push(sectionComment2("Intent aliases (dark) \u2014 prefers-color-scheme"));
731
- {
732
- const inner = block2(`${scopeClass}:not(.light):not(.theme-light):not([data-theme="light"])`, generateIntentDecls(input.tokens, "dark"));
733
- semanticLines.push(`@media (prefers-color-scheme: dark) {
770
+ if (emitLight) {
771
+ semanticLines.push(sectionComment2("Intent aliases (light)"));
772
+ semanticLines.push(block2(lightSel, generateIntentDecls(input.tokens, "light")));
773
+ semanticLines.push("");
774
+ semanticLines.push(sectionComment2("Hairline aliases (light)"));
775
+ semanticLines.push(block2(lightSel, generateHairlineDecls(input.tokens, "light")));
776
+ semanticLines.push("");
777
+ }
778
+ if (emitDark) {
779
+ semanticLines.push(sectionComment2(`Intent aliases (dark)${darkSuffix}`));
780
+ semanticLines.push(block2(darkSel, generateIntentDecls(input.tokens, "dark")));
781
+ semanticLines.push("");
782
+ semanticLines.push(sectionComment2(`Hairline aliases (dark)${darkSuffix}`));
783
+ semanticLines.push(block2(darkSel, generateHairlineDecls(input.tokens, "dark")));
784
+ semanticLines.push("");
785
+ }
786
+ if (emitPrefers) {
787
+ semanticLines.push(sectionComment2("Intent aliases (dark) \u2014 prefers-color-scheme"));
788
+ {
789
+ const inner = block2(`${scopeClass}:not(.light):not(.theme-light):not([data-theme="light"])`, generateIntentDecls(input.tokens, "dark"));
790
+ semanticLines.push(`@media (prefers-color-scheme: dark) {
734
791
  ${inner.split("\n").map((l) => ` ${l}`).join("\n")}
735
792
  }`);
736
- }
737
- semanticLines.push("");
738
- semanticLines.push(sectionComment2("Hairline aliases (dark) \u2014 prefers-color-scheme"));
739
- {
740
- const inner = block2(`${scopeClass}:not(.light):not(.theme-light):not([data-theme="light"])`, generateHairlineDecls(input.tokens, "dark"));
741
- semanticLines.push(`@media (prefers-color-scheme: dark) {
793
+ }
794
+ semanticLines.push("");
795
+ semanticLines.push(sectionComment2("Hairline aliases (dark) \u2014 prefers-color-scheme"));
796
+ {
797
+ const inner = block2(`${scopeClass}:not(.light):not(.theme-light):not([data-theme="light"])`, generateHairlineDecls(input.tokens, "dark"));
798
+ semanticLines.push(`@media (prefers-color-scheme: dark) {
742
799
  ${inner.split("\n").map((l) => ` ${l}`).join("\n")}
743
800
  }`);
801
+ }
802
+ semanticLines.push("");
744
803
  }
745
- semanticLines.push("");
746
- const brandResult = resolveThemeBrand(input.config.brand, { scope: scopeClass });
804
+ const brandResult = resolveThemeBrand(input.config.brand, { scope: scopeClass, colorScheme });
747
805
  const passthroughCss = generateBrandPassthroughCss(
748
806
  collectBrandPassthrough(input.tokens, input.config.overrides),
749
807
  {
750
- light: `html:not(.dark) ${scopeClass}`,
751
- dark: `.dark ${scopeClass}`,
808
+ light: lightSel,
809
+ dark: darkSel,
752
810
  prefers: `${scopeClass}:not(.light):not(.theme-light):not([data-theme="light"])`
753
- }
811
+ },
812
+ colorScheme
754
813
  );
755
814
  const adaptiveLayer = wrapInLayer("visor-adaptive", lines.join("\n").trim());
756
815
  const semanticLayer = wrapInLayer("visor-semantic", semanticLines.join("\n").trim());
@@ -829,7 +829,7 @@ function block(selector, decls) {
829
829
  if (decls.length === 0) return "";
830
830
  return [`${selector} {`, ...decls.map((d) => ` ${d}`), "}"].join("\n");
831
831
  }
832
- function generateBrandCSS(resolutions, scope) {
832
+ function generateBrandCSS(resolutions, scope, colorScheme = "adaptive") {
833
833
  if (resolutions.length === 0) return "";
834
834
  const baseSelector = scope ? scope : ":root";
835
835
  const lightSelector = scope ? `html:not(.dark) ${scope}` : ":root";
@@ -840,6 +840,18 @@ function generateBrandCSS(resolutions, scope) {
840
840
  lines.push("/* --- Brand: forced-mode aliases + tokens --- */");
841
841
  lines.push(block(baseSelector, staticDecls));
842
842
  lines.push("");
843
+ if (colorScheme === "dark-only") {
844
+ const darkDecls2 = resolutions.map((r) => modeDecl(r, "dark"));
845
+ lines.push("/* --- Brand: variants (dark) \u2014 host --- */");
846
+ lines.push(block(baseSelector, darkDecls2));
847
+ return lines.join("\n").trim();
848
+ }
849
+ if (colorScheme === "light-only") {
850
+ const lightDecls2 = resolutions.map((r) => modeDecl(r, "light"));
851
+ lines.push("/* --- Brand: variants (light) \u2014 host --- */");
852
+ lines.push(block(baseSelector, lightDecls2));
853
+ return lines.join("\n").trim();
854
+ }
843
855
  const lightDecls = resolutions.map((r) => modeDecl(r, "light"));
844
856
  lines.push("/* --- Brand: variants (light) --- */");
845
857
  lines.push(block(lightSelector, lightDecls));
@@ -860,6 +872,7 @@ ${inner.split("\n").map((l) => ` ${l}`).join("\n")}
860
872
  function resolveThemeBrand(brand, options) {
861
873
  const effective = brand ?? DEFAULT_VISOR_BRAND;
862
874
  const scope = options?.scope ?? "";
875
+ const colorScheme = options?.colorScheme ?? "adaptive";
863
876
  const source = resolveBrandSource(effective);
864
877
  const org = effective.org ?? null;
865
878
  const cdnBase = effective["cdn-overrides"]?.["visor-brands"] ?? null;
@@ -881,7 +894,7 @@ function resolveThemeBrand(brand, options) {
881
894
  if (resolution.guidance) warnings.push(resolution.guidance);
882
895
  }
883
896
  }
884
- const css = generateBrandCSS([...variants, ...custom], scope);
897
+ const css = generateBrandCSS([...variants, ...custom], scope, colorScheme);
885
898
  return { variants, custom, css, warnings };
886
899
  }
887
900
 
@@ -1730,9 +1743,15 @@ function buildAdaptiveDecls(tokens, theme) {
1730
1743
  return { textDecls, surfaceDecls, borderDecls, interactiveDecls, intentDecls, hairlineDecls };
1731
1744
  }
1732
1745
  function generateLightCss(tokens, options) {
1746
+ const colorScheme = options?.colorScheme ?? "adaptive";
1747
+ if (colorScheme === "dark-only") return "";
1733
1748
  const lines = [];
1734
1749
  const { textDecls, surfaceDecls, borderDecls, interactiveDecls, intentDecls, hairlineDecls } = buildAdaptiveDecls(tokens, "light");
1735
1750
  const host = options?.scopePrefix ?? ":root";
1751
+ if (colorScheme === "light-only") {
1752
+ lines.push(sectionComment("Adaptive: color-scheme (light)"));
1753
+ lines.push(block2(host, ["color-scheme: light;"]));
1754
+ }
1736
1755
  lines.push(sectionComment("Adaptive: Text (light)"));
1737
1756
  lines.push(block2(host, textDecls));
1738
1757
  lines.push(sectionComment("Adaptive: Surface (light)"));
@@ -1748,8 +1767,28 @@ function generateLightCss(tokens, options) {
1748
1767
  return header("Visor Theme \u2014 Light") + lines.join("\n");
1749
1768
  }
1750
1769
  function generateDarkCss(tokens, options) {
1770
+ const colorScheme = options?.colorScheme ?? "adaptive";
1771
+ if (colorScheme === "light-only") return "";
1751
1772
  const lines = [];
1752
1773
  const { textDecls, surfaceDecls, borderDecls, interactiveDecls, intentDecls, hairlineDecls } = buildAdaptiveDecls(tokens, "dark");
1774
+ if (colorScheme === "dark-only") {
1775
+ const host = options?.scopePrefix ?? ":root";
1776
+ lines.push(sectionComment("Adaptive: color-scheme (dark)"));
1777
+ lines.push(block2(host, ["color-scheme: dark;"]));
1778
+ lines.push(sectionComment("Adaptive: Text (dark) \u2014 host"));
1779
+ lines.push(block2(host, textDecls));
1780
+ lines.push(sectionComment("Adaptive: Surface (dark) \u2014 host"));
1781
+ lines.push(block2(host, surfaceDecls));
1782
+ lines.push(sectionComment("Adaptive: Border (dark) \u2014 host"));
1783
+ lines.push(block2(host, borderDecls));
1784
+ lines.push(sectionComment("Adaptive: Interactive (dark) \u2014 host"));
1785
+ lines.push(block2(host, interactiveDecls));
1786
+ lines.push(sectionComment("Adaptive: Intent aliases (dark) \u2014 host"));
1787
+ lines.push(block2(host, intentDecls));
1788
+ lines.push(sectionComment("Adaptive: Hairline aliases (dark) \u2014 host"));
1789
+ lines.push(block2(host, hairlineDecls));
1790
+ return header("Visor Theme \u2014 Dark") + lines.join("\n");
1791
+ }
1753
1792
  const prefix = options?.scopePrefix;
1754
1793
  const darkSelectors = prefix ? [`${prefix}.dark`, `${prefix}.theme-dark`, `${prefix}[data-theme="dark"]`] : [".dark", ".theme-dark", '[data-theme="dark"]'];
1755
1794
  const darkSelector = darkSelectors.join(",\n");
@@ -1829,6 +1868,29 @@ function generateFullBundleCss(primitives, tokens, config) {
1829
1868
  );
1830
1869
  const primitivesBody = generatePrimitivesCss(primitives, config).split("\n").slice(6).join("\n");
1831
1870
  lines.push(primitivesBody);
1871
+ const colorScheme = config["color-scheme"] ?? "adaptive";
1872
+ if (colorScheme === "dark-only") {
1873
+ lines.push(
1874
+ "/* ============================================",
1875
+ " Tier 3: Adaptive \u2014 Dark Theme (:root host) + color-scheme: dark",
1876
+ " ============================================ */"
1877
+ );
1878
+ lines.push(
1879
+ generateDarkCss(tokens, { colorScheme }).split("\n").slice(6).join("\n")
1880
+ );
1881
+ return lines.join("\n");
1882
+ }
1883
+ if (colorScheme === "light-only") {
1884
+ lines.push(
1885
+ "/* ============================================",
1886
+ " Tier 3: Adaptive \u2014 Light Theme (:root host) + color-scheme: light",
1887
+ " ============================================ */"
1888
+ );
1889
+ lines.push(
1890
+ generateLightCss(tokens, { colorScheme }).split("\n").slice(6).join("\n")
1891
+ );
1892
+ return lines.join("\n");
1893
+ }
1832
1894
  lines.push(
1833
1895
  "/* ============================================",
1834
1896
  " Tier 3: Adaptive \u2014 Light Theme (:root)",
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { F as FontResolveOptions, a as FontResolution, V as VisorTypography, b as FontDisplayStrategy, T as ThemeFontResult, G as GoogleFontEntry, c as VisorBrand, B as BrandSlot, d as BrandSource, e as BrandResolution, f as ThemeBrandResult, g as BrandStrategy, h as BrandStrategyContext, i as BrandStrategyIssue, j as BrandStrategyValidationResult, S as SerializedBrandStrategy, R as ResolvedThemeConfig, k as GeneratedPrimitives, l as ThemeOutput, m as ThemeData, n as VisorThemeConfig, o as FullShadeScale, C as ColorRole, p as SelectiveShadeScale, q as RGB, P as ParsedColor, O as OKLCH, r as SemanticTokens, s as ShadeStep } from './types-DqsWwFVZ.js';
2
- export { t as BRAND_VARIANTS, u as BRAND_VISIBILITIES, v as BrandAccessibility, w as BrandArchetype, x as BrandBoilerplate, y as BrandColorPairing, z as BrandColorUsage, A as BrandContrastTarget, D as BrandGoverns, E as BrandLexiconEntry, H as BrandMessaging, I as BrandPersonalityTrait, J as BrandPillar, K as BrandPositioning, L as BrandStrategyIssueSeverity, M as BrandToneEntry, N as BrandVariant, Q as BrandVisibility, U as BrandVoice, W as BrandVoiceTrait, X as ColorFormat, Y as DEFAULT_BRAND_STRATEGY_SURFACES, Z as DEFAULT_BRAND_STRATEGY_TONE_STATES, _ as FontSource, $ as GOVERNS_WILDCARD, a0 as RGBA, a1 as SemanticTokenValue } from './types-DqsWwFVZ.js';
1
+ import { F as FontResolveOptions, a as FontResolution, V as VisorTypography, b as FontDisplayStrategy, T as ThemeFontResult, G as GoogleFontEntry, c as VisorBrand, B as BrandSlot, d as BrandSource, e as BrandResolution, C as ColorScheme, f as ThemeBrandResult, g as BrandStrategy, h as BrandStrategyContext, i as BrandStrategyIssue, j as BrandStrategyValidationResult, S as SerializedBrandStrategy, R as ResolvedThemeConfig, k as GeneratedPrimitives, l as ThemeOutput, m as ThemeData, n as VisorThemeConfig, o as FullShadeScale, p as ColorRole, q as SelectiveShadeScale, r as RGB, P as ParsedColor, O as OKLCH, s as SemanticTokens, t as ShadeStep } from './types-Cvm7vFwe.js';
2
+ export { u as BRAND_VARIANTS, v as BRAND_VISIBILITIES, w as BrandAccessibility, x as BrandArchetype, y as BrandBoilerplate, z as BrandColorPairing, A as BrandColorUsage, D as BrandContrastTarget, E as BrandGoverns, H as BrandLexiconEntry, I as BrandMessaging, J as BrandPersonalityTrait, K as BrandPillar, L as BrandPositioning, M as BrandStrategyIssueSeverity, N as BrandToneEntry, Q as BrandVariant, U as BrandVisibility, W as BrandVoice, X as BrandVoiceTrait, Y as ColorFormat, Z as DEFAULT_BRAND_STRATEGY_SURFACES, _ as DEFAULT_BRAND_STRATEGY_TONE_STATES, $ as FontSource, a0 as GOVERNS_WILDCARD, a1 as RGBA, a2 as SemanticTokenValue } from './types-Cvm7vFwe.js';
3
3
 
4
4
  /**
5
5
  * Font resolver — maps font family names to loadable font resources.
@@ -234,6 +234,7 @@ declare function resolveBrandSource(brand: VisorBrand): BrandSource;
234
234
  */
235
235
  declare function resolveThemeBrand(brand: VisorBrand | undefined, options?: {
236
236
  scope?: string;
237
+ colorScheme?: ColorScheme;
237
238
  }): ThemeBrandResult;
238
239
 
239
240
  /**
@@ -390,6 +391,15 @@ var properties = {
390
391
  ],
391
392
  description: "Default color mode when activating this theme. When set, the docs site forces this mode on theme switch (unless the user has a stored mode preference). Optional."
392
393
  },
394
+ "color-scheme": {
395
+ type: "string",
396
+ "enum": [
397
+ "dark-only",
398
+ "light-only",
399
+ "adaptive"
400
+ ],
401
+ description: "Brand constraint declaring which color modes the theme supports. 'dark-only'/'light-only' lock the brand to a single mode; 'adaptive' supports both. Complements 'default-mode' (the runtime default) — 'color-scheme' is authoritative for the brand-lock. Defaults to 'adaptive' when omitted. Optional."
402
+ },
393
403
  colors: {
394
404
  type: "object",
395
405
  description: "Color definitions for light mode. Only primary is required — all others have sensible defaults.",
@@ -1588,6 +1598,7 @@ declare function clampToSrgb(L: number, C: number, H: number): RGB;
1588
1598
  * Convert OKLCH to hex, with gamut clamping.
1589
1599
  */
1590
1600
  declare function oklchToHex(L: number, C: number, H: number): string;
1601
+ declare function getLuminance(r: number, g: number, b: number): number;
1591
1602
  declare function getContrastRatio(color1: string | ParsedColor, color2: string | ParsedColor, compositeBackground?: RGB): number;
1592
1603
  /** Parse a hex color string into a ParsedColor. */
1593
1604
  declare function parseHex(str: string): ParsedColor | null;
@@ -1764,9 +1775,11 @@ declare function generatePrimitivesCss(primitives: GeneratedPrimitives, config:
1764
1775
  declare function generateSemanticCss(tokens: SemanticTokens): string;
1765
1776
  declare function generateLightCss(tokens: SemanticTokens, options?: {
1766
1777
  scopePrefix?: string;
1778
+ colorScheme?: ColorScheme;
1767
1779
  }): string;
1768
1780
  declare function generateDarkCss(tokens: SemanticTokens, options?: {
1769
1781
  scopePrefix?: string;
1782
+ colorScheme?: ColorScheme;
1770
1783
  }): string;
1771
1784
  declare function generateFullBundleCss(primitives: GeneratedPrimitives, tokens: SemanticTokens, config: ResolvedThemeConfig): string;
1772
1785
 
@@ -1845,4 +1858,4 @@ declare function cleanFontValue(val: string): string;
1845
1858
  */
1846
1859
  declare function extractFromCSS(files: CSSFile[], name?: string): ExtractionResult;
1847
1860
 
1848
- export { type BrandPassthrough, BrandResolution, BrandSlot, BrandSource, BrandStrategy, BrandStrategyContext, BrandStrategyIssue, BrandStrategyValidationResult, type CSSFile, ColorRole, type Confidence, DEFAULT_VISOR_BRAND, type ExtractedToken, type ExtractionResult, FONT_WEIGHT_ALIASES, type FontCoverageError, type FontCoverageResult, FontDisplayStrategy, type FontFaceDeclaration, FontResolution, FontResolveOptions, FullShadeScale, GeneratedPrimitives, GoogleFontEntry, OKLCH, ParsedColor, RGB, ResolvedThemeConfig, SEMANTIC_MAP, SelectiveShadeScale, SemanticTokens, SerializedBrandStrategy, ShadeStep, TAILWIND_GRAY, ThemeBrandResult, ThemeData, ThemeFontResult, ThemeOutput, type ThemeValidationResult, VISOR_BRANDS_CDN, VISOR_DEFAULT_BRAND_PATH, VISOR_FONTS_CDN, type ValidateOptions, type ValidationIssue, type ValidationSeverity, VisorBrand, VisorThemeConfig, VisorTypography, applyOverrides, assignSemanticTokens, buildVisorBrandUrl, buildVisorFontUrl, checkBrandStrategyCoherence, checkBrandStrategyStructure, clampToSrgb, cleanFontValue, collectBrandPassthrough, compositeOverBackground, exportTheme, extractFromCSS, formatFontCoverageError, generateDarkCss, generateFullBundleCss, generateLightCss, generatePreloadLinks, generatePrimitives, generatePrimitivesCss, generateSemanticCss, generateShadeScale, generateStylesheetLinks, generateTheme, generateThemeData, generateThemeDataFromConfig, generateThemeFromConfig, getContrastRatio, getKnownTokenRefs, googleFontsCatalog, hasBrandPassthrough, hexToOklch, hexToRgb, isValidColor, isValidHex, isVisorThemeConfig, lookupFontWeightAlias, lookupGoogleFont, normalizeHex, oklchToHex, parseCSSDeclarations, parseColor, parseConfig, parseFontFaceDeclarations, parseHex, parseHsla, parseOklch, parseRgba, resolveBrandSlot, resolveBrandSource, resolveConfig, resolveFont, resolveThemeBrand, resolveThemeFonts, rgbToHex, serializeBrandStrategy, serializeColor, validate, validateBrandStrategy, validateConfig, validateFontCoverage, visorTheme_schema as visorThemeSchema };
1861
+ export { type BrandPassthrough, BrandResolution, BrandSlot, BrandSource, BrandStrategy, BrandStrategyContext, BrandStrategyIssue, BrandStrategyValidationResult, type CSSFile, ColorRole, type Confidence, DEFAULT_VISOR_BRAND, type ExtractedToken, type ExtractionResult, FONT_WEIGHT_ALIASES, type FontCoverageError, type FontCoverageResult, FontDisplayStrategy, type FontFaceDeclaration, FontResolution, FontResolveOptions, FullShadeScale, GeneratedPrimitives, GoogleFontEntry, OKLCH, ParsedColor, RGB, ResolvedThemeConfig, SEMANTIC_MAP, SelectiveShadeScale, SemanticTokens, SerializedBrandStrategy, ShadeStep, TAILWIND_GRAY, ThemeBrandResult, ThemeData, ThemeFontResult, ThemeOutput, type ThemeValidationResult, VISOR_BRANDS_CDN, VISOR_DEFAULT_BRAND_PATH, VISOR_FONTS_CDN, type ValidateOptions, type ValidationIssue, type ValidationSeverity, VisorBrand, VisorThemeConfig, VisorTypography, applyOverrides, assignSemanticTokens, buildVisorBrandUrl, buildVisorFontUrl, checkBrandStrategyCoherence, checkBrandStrategyStructure, clampToSrgb, cleanFontValue, collectBrandPassthrough, compositeOverBackground, exportTheme, extractFromCSS, formatFontCoverageError, generateDarkCss, generateFullBundleCss, generateLightCss, generatePreloadLinks, generatePrimitives, generatePrimitivesCss, generateSemanticCss, generateShadeScale, generateStylesheetLinks, generateTheme, generateThemeData, generateThemeDataFromConfig, generateThemeFromConfig, getContrastRatio, getKnownTokenRefs, getLuminance, googleFontsCatalog, hasBrandPassthrough, hexToOklch, hexToRgb, isValidColor, isValidHex, isVisorThemeConfig, lookupFontWeightAlias, lookupGoogleFont, normalizeHex, oklchToHex, parseCSSDeclarations, parseColor, parseConfig, parseFontFaceDeclarations, parseHex, parseHsla, parseOklch, parseRgba, resolveBrandSlot, resolveBrandSource, resolveConfig, resolveFont, resolveThemeBrand, resolveThemeFonts, rgbToHex, serializeBrandStrategy, serializeColor, validate, validateBrandStrategy, validateConfig, validateFontCoverage, visorTheme_schema as visorThemeSchema };
package/dist/index.js CHANGED
@@ -46,7 +46,7 @@ import {
46
46
  rgbToHex,
47
47
  rgbToOklch,
48
48
  serializeColor
49
- } from "./chunk-DQ256PSE.js";
49
+ } from "./chunk-BUWBBUFG.js";
50
50
 
51
51
  // src/fonts/validate-coverage.ts
52
52
  var FONT_VAR_RE = /--font-(heading|display|body|sans|mono)\s*:\s*([^;]+);/g;
@@ -628,6 +628,11 @@ var visor_theme_schema_default = {
628
628
  enum: ["light", "dark"],
629
629
  description: "Default color mode when activating this theme. When set, the docs site forces this mode on theme switch (unless the user has a stored mode preference). Optional."
630
630
  },
631
+ "color-scheme": {
632
+ type: "string",
633
+ enum: ["dark-only", "light-only", "adaptive"],
634
+ description: "Brand constraint declaring which color modes the theme supports. 'dark-only'/'light-only' lock the brand to a single mode; 'adaptive' supports both. Complements 'default-mode' (the runtime default) \u2014 'color-scheme' is authoritative for the brand-lock. Defaults to 'adaptive' when omitted. Optional."
635
+ },
631
636
  colors: {
632
637
  type: "object",
633
638
  description: "Color definitions for light mode. Only primary is required \u2014 all others have sensible defaults.",
@@ -1294,6 +1299,7 @@ var KNOWN_TOP_LEVEL_KEYS = /* @__PURE__ */ new Set([
1294
1299
  "group",
1295
1300
  "label",
1296
1301
  "default-mode",
1302
+ "color-scheme",
1297
1303
  "colors",
1298
1304
  "colors-dark",
1299
1305
  "typography",
@@ -1574,6 +1580,12 @@ function validateConfig(config) {
1574
1580
  errors.push("'default-mode' must be either 'dark' or 'light'");
1575
1581
  }
1576
1582
  }
1583
+ if (obj["color-scheme"] !== void 0) {
1584
+ const scheme = obj["color-scheme"];
1585
+ if (scheme !== "dark-only" && scheme !== "light-only" && scheme !== "adaptive") {
1586
+ errors.push("'color-scheme' must be one of: dark-only, light-only, adaptive");
1587
+ }
1588
+ }
1577
1589
  if (typeof obj.colors !== "object" || obj.colors === null) {
1578
1590
  errors.push("'colors' is required and must be an object");
1579
1591
  return { valid: false, errors };
@@ -1863,6 +1875,9 @@ function resolveConfig(config) {
1863
1875
  name: config.name,
1864
1876
  ...config.label !== void 0 && { label: config.label },
1865
1877
  ...config["default-mode"] !== void 0 && { "default-mode": config["default-mode"] },
1878
+ // BO-55: always-resolved brand constraint — existing themes (no field) resolve
1879
+ // to 'adaptive', preserving back-compat.
1880
+ "color-scheme": config["color-scheme"] ?? "adaptive",
1866
1881
  version: 1,
1867
1882
  colors: {
1868
1883
  primary: colors.primary,
@@ -2555,8 +2570,8 @@ ${validation.errors.map((e) => ` - ${e}`).join("\n")}`
2555
2570
  const output = {
2556
2571
  primitivesCss: generatePrimitivesCss(primitives, resolved),
2557
2572
  semanticCss: generateSemanticCss(tokens),
2558
- lightCss: generateLightCss(tokens),
2559
- darkCss: generateDarkCss(tokens),
2573
+ lightCss: generateLightCss(tokens, { colorScheme: resolved["color-scheme"] }),
2574
+ darkCss: generateDarkCss(tokens, { colorScheme: resolved["color-scheme"] }),
2560
2575
  fullBundleCss: generateFullBundleCss(primitives, tokens, resolved)
2561
2576
  };
2562
2577
  return { config: resolved, primitives, tokens, output };
@@ -3903,6 +3918,36 @@ function extractBackgroundSurface(declarations) {
3903
3918
  }
3904
3919
  return result;
3905
3920
  }
3921
+ function detectExplicitColorScheme(files) {
3922
+ for (const file of files) {
3923
+ const content = file.content.replace(/\/\*[\s\S]*?\*\//g, "");
3924
+ const re = /(?<![\w-])color-scheme\s*:\s*([^;}]+)/gi;
3925
+ let m;
3926
+ while ((m = re.exec(content)) !== null) {
3927
+ const keywords = m[1].trim().toLowerCase().split(/\s+/).filter((k) => k.length > 0 && k !== "only");
3928
+ const hasDark = keywords.includes("dark");
3929
+ const hasLight = keywords.includes("light");
3930
+ if (hasDark && hasLight) return "adaptive";
3931
+ if (hasDark) return "dark-only";
3932
+ if (hasLight) return "light-only";
3933
+ if (keywords.includes("normal")) return "adaptive";
3934
+ }
3935
+ }
3936
+ return null;
3937
+ }
3938
+ function detectColorScheme(files, bgSurface, warnings) {
3939
+ const explicit = detectExplicitColorScheme(files);
3940
+ const heuristic = bgSurface.dark.background && !bgSurface.light.background ? "dark-only" : "adaptive";
3941
+ if (explicit) {
3942
+ if (heuristic !== "adaptive" && heuristic !== explicit) {
3943
+ warnings.push(
3944
+ `color-scheme ambiguity: source CSS explicitly declares 'color-scheme: ${explicit}' but the background heuristic suggests '${heuristic}'. Using the explicit declaration \u2014 review the source if this is unexpected.`
3945
+ );
3946
+ }
3947
+ return explicit;
3948
+ }
3949
+ return heuristic;
3950
+ }
3906
3951
  function extractFromCSS(files, name = "extracted-theme") {
3907
3952
  const warnings = [];
3908
3953
  const allDeclarations = [];
@@ -3976,6 +4021,7 @@ function extractFromCSS(files, name = "extracted-theme") {
3976
4021
  if (Object.keys(darkColors).length > 0) {
3977
4022
  config["colors-dark"] = darkColors;
3978
4023
  }
4024
+ config["color-scheme"] = detectColorScheme(files, bgSurface, warnings);
3979
4025
  if (typography.heading || typography.display || typography.body || typography.mono) {
3980
4026
  config.typography = {};
3981
4027
  if (typography.heading) config.typography.heading = typography.heading;
@@ -4046,6 +4092,7 @@ export {
4046
4092
  generateThemeFromConfig,
4047
4093
  getContrastRatio,
4048
4094
  getKnownTokenRefs,
4095
+ getLuminance,
4049
4096
  googleFontsCatalog,
4050
4097
  hasBrandPassthrough,
4051
4098
  hexToOklch,
@@ -483,6 +483,11 @@ interface TextSlotOverride {
483
483
  /** Letter spacing in logical pixels (Flutter `TextStyle.letterSpacing`). */
484
484
  "letter-spacing"?: number;
485
485
  }
486
+ /**
487
+ * BO-55/BO-56: brand color-mode constraint. `dark-only`/`light-only` lock the
488
+ * brand to a single mode; `adaptive` supports both (the historical default).
489
+ */
490
+ type ColorScheme = "dark-only" | "light-only" | "adaptive";
486
491
  interface VisorThemeConfig {
487
492
  name: string;
488
493
  version: 1;
@@ -492,6 +497,13 @@ interface VisorThemeConfig {
492
497
  label?: string;
493
498
  /** Default color mode to force when the theme is activated ('dark' or 'light'). If unset, user/system preference applies. */
494
499
  "default-mode"?: "dark" | "light";
500
+ /**
501
+ * BO-55: Brand constraint declaring which color modes the theme supports.
502
+ * 'dark-only'/'light-only' lock the brand to a single mode; 'adaptive' supports both.
503
+ * Complements `default-mode` (the runtime default) — `color-scheme` is authoritative
504
+ * for the brand-lock. Defaults to 'adaptive' when omitted.
505
+ */
506
+ "color-scheme"?: ColorScheme;
495
507
  colors: {
496
508
  primary: string;
497
509
  accent?: string;
@@ -674,6 +686,12 @@ interface ResolvedThemeConfig {
674
686
  label?: string;
675
687
  /** Default color mode forwarded from VisorThemeConfig["default-mode"]. */
676
688
  "default-mode"?: "dark" | "light";
689
+ /**
690
+ * BO-55: Brand constraint for supported color modes. Always resolved (defaults
691
+ * to 'adaptive' when the theme omits it) so downstream readers (engine/extractor/gate)
692
+ * get a guaranteed value.
693
+ */
694
+ "color-scheme": ColorScheme;
677
695
  version: 1;
678
696
  colors: {
679
697
  primary: string;
@@ -836,4 +854,4 @@ interface ThemeData {
836
854
  output: ThemeOutput;
837
855
  }
838
856
 
839
- export { GOVERNS_WILDCARD as $, type BrandContrastTarget as A, type BrandSlot as B, type ColorRole as C, type BrandGoverns as D, type BrandLexiconEntry as E, type FontResolveOptions as F, type GoogleFontEntry as G, type BrandMessaging as H, type BrandPersonalityTrait as I, type BrandPillar as J, type BrandPositioning as K, type BrandStrategyIssueSeverity as L, type BrandToneEntry as M, type BrandVariant as N, type OKLCH as O, type ParsedColor as P, type BrandVisibility as Q, type ResolvedThemeConfig as R, type SerializedBrandStrategy as S, type ThemeFontResult as T, type BrandVoice as U, type VisorTypography as V, type BrandVoiceTrait as W, type ColorFormat as X, DEFAULT_BRAND_STRATEGY_SURFACES as Y, DEFAULT_BRAND_STRATEGY_TONE_STATES as Z, type FontSource as _, type FontResolution as a, type RGBA as a0, type SemanticTokenValue as a1, type FontDisplayStrategy as b, type VisorBrand as c, type BrandSource as d, type BrandResolution as e, type ThemeBrandResult as f, type BrandStrategy as g, type BrandStrategyContext as h, type BrandStrategyIssue as i, type BrandStrategyValidationResult as j, type GeneratedPrimitives as k, type ThemeOutput as l, type ThemeData as m, type VisorThemeConfig as n, type FullShadeScale as o, type SelectiveShadeScale as p, type RGB as q, type SemanticTokens as r, type ShadeStep as s, BRAND_VARIANTS as t, BRAND_VISIBILITIES as u, type BrandAccessibility as v, type BrandArchetype as w, type BrandBoilerplate as x, type BrandColorPairing as y, type BrandColorUsage as z };
857
+ export { type FontSource as $, type BrandColorUsage as A, type BrandSlot as B, type ColorScheme as C, type BrandContrastTarget as D, type BrandGoverns as E, type FontResolveOptions as F, type GoogleFontEntry as G, type BrandLexiconEntry as H, type BrandMessaging as I, type BrandPersonalityTrait as J, type BrandPillar as K, type BrandPositioning as L, type BrandStrategyIssueSeverity as M, type BrandToneEntry as N, type OKLCH as O, type ParsedColor as P, type BrandVariant as Q, type ResolvedThemeConfig as R, type SerializedBrandStrategy as S, type ThemeFontResult as T, type BrandVisibility as U, type VisorTypography as V, type BrandVoice as W, type BrandVoiceTrait as X, type ColorFormat as Y, DEFAULT_BRAND_STRATEGY_SURFACES as Z, DEFAULT_BRAND_STRATEGY_TONE_STATES as _, type FontResolution as a, GOVERNS_WILDCARD as a0, type RGBA as a1, type SemanticTokenValue as a2, type FontDisplayStrategy as b, type VisorBrand as c, type BrandSource as d, type BrandResolution as e, type ThemeBrandResult as f, type BrandStrategy as g, type BrandStrategyContext as h, type BrandStrategyIssue as i, type BrandStrategyValidationResult as j, type GeneratedPrimitives as k, type ThemeOutput as l, type ThemeData as m, type VisorThemeConfig as n, type FullShadeScale as o, type ColorRole as p, type SelectiveShadeScale as q, type RGB as r, type SemanticTokens as s, type ShadeStep as t, BRAND_VARIANTS as u, BRAND_VISIBILITIES as v, type BrandAccessibility as w, type BrandArchetype as x, type BrandBoilerplate as y, type BrandColorPairing as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loworbitstudio/visor-theme-engine",
3
- "version": "0.17.0",
3
+ "version": "0.17.1",
4
4
  "description": "Theme engine for the Visor design system — shade generation, token mapping, font resolution, and import/export for .visor.yaml themes.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -29,6 +29,11 @@
29
29
  "enum": ["light", "dark"],
30
30
  "description": "Default color mode when activating this theme. When set, the docs site forces this mode on theme switch (unless the user has a stored mode preference). Optional."
31
31
  },
32
+ "color-scheme": {
33
+ "type": "string",
34
+ "enum": ["dark-only", "light-only", "adaptive"],
35
+ "description": "Brand constraint declaring which color modes the theme supports. 'dark-only'/'light-only' lock the brand to a single mode; 'adaptive' supports both. Complements 'default-mode' (the runtime default) — 'color-scheme' is authoritative for the brand-lock. Defaults to 'adaptive' when omitted. Optional."
36
+ },
32
37
  "colors": {
33
38
  "type": "object",
34
39
  "description": "Color definitions for light mode. Only primary is required — all others have sensible defaults.",