@loworbitstudio/visor-theme-engine 0.8.0 → 0.8.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.
package/dist/adapters/index.js
CHANGED
|
@@ -129,6 +129,11 @@ var FONT_WEIGHT_ALIASES = {
|
|
|
129
129
|
"PP Model Plastic": {
|
|
130
130
|
400: "Book",
|
|
131
131
|
800: "Super"
|
|
132
|
+
},
|
|
133
|
+
// Hoefler's Gotham uses "Book" instead of "Regular" at weight 400.
|
|
134
|
+
// Light (300) and Medium (500) match WEIGHT_NAMES defaults.
|
|
135
|
+
Gotham: {
|
|
136
|
+
400: "Book"
|
|
132
137
|
}
|
|
133
138
|
};
|
|
134
139
|
function lookupFontWeightAlias(family, weight) {
|
package/dist/index.js
CHANGED
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
rgbToHex,
|
|
35
35
|
rgbToOklch,
|
|
36
36
|
serializeColor
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-OJVNL7KN.js";
|
|
38
38
|
|
|
39
39
|
// src/fonts/validate-coverage.ts
|
|
40
40
|
var FONT_VAR_RE = /--font-(heading|display|body|sans|mono)\s*:\s*([^;]+);/g;
|
|
@@ -1624,6 +1624,41 @@ var KNOWN_SEMANTIC_TOKENS = /* @__PURE__ */ new Set([
|
|
|
1624
1624
|
...Object.keys(SEMANTIC_BORDER_MAP).map((k) => `border-${k}`),
|
|
1625
1625
|
...Object.keys(SEMANTIC_INTERACTIVE_MAP).map((k) => `interactive-${k}`)
|
|
1626
1626
|
]);
|
|
1627
|
+
var REQUIRED_OVERRIDE_TOKENS = {
|
|
1628
|
+
text: ["primary", "secondary", "tertiary", "disabled"],
|
|
1629
|
+
surface: [
|
|
1630
|
+
"page",
|
|
1631
|
+
"card",
|
|
1632
|
+
"popover",
|
|
1633
|
+
"subtle",
|
|
1634
|
+
"muted",
|
|
1635
|
+
"interactive-default",
|
|
1636
|
+
"interactive-hover",
|
|
1637
|
+
"interactive-active",
|
|
1638
|
+
"interactive-disabled",
|
|
1639
|
+
"selected",
|
|
1640
|
+
"accent-subtle",
|
|
1641
|
+
"success-subtle",
|
|
1642
|
+
"warning-subtle",
|
|
1643
|
+
"error-subtle",
|
|
1644
|
+
"info-subtle",
|
|
1645
|
+
"elev-0",
|
|
1646
|
+
"elev-1",
|
|
1647
|
+
"elev-2",
|
|
1648
|
+
"elev-3",
|
|
1649
|
+
"elev-4"
|
|
1650
|
+
],
|
|
1651
|
+
border: ["default", "muted", "strong", "disabled"],
|
|
1652
|
+
interactive: [
|
|
1653
|
+
"secondary-bg",
|
|
1654
|
+
"secondary-bg-hover",
|
|
1655
|
+
"secondary-bg-active",
|
|
1656
|
+
"secondary-text",
|
|
1657
|
+
"secondary-border",
|
|
1658
|
+
"ghost-bg",
|
|
1659
|
+
"ghost-bg-hover"
|
|
1660
|
+
]
|
|
1661
|
+
};
|
|
1627
1662
|
function issue(severity, code, message, path) {
|
|
1628
1663
|
const result = { severity, code, message };
|
|
1629
1664
|
if (path !== void 0) {
|
|
@@ -1966,6 +2001,30 @@ function checkOverrides(config, issues) {
|
|
|
1966
2001
|
}
|
|
1967
2002
|
}
|
|
1968
2003
|
}
|
|
2004
|
+
function checkOverrideCompleteness(config, issues) {
|
|
2005
|
+
const lightOverrides = config.overrides?.light;
|
|
2006
|
+
if (!lightOverrides) return;
|
|
2007
|
+
const presentKeys = Object.keys(lightOverrides);
|
|
2008
|
+
if (presentKeys.length === 0) return;
|
|
2009
|
+
const hasTriggerKey = "surface-page" in lightOverrides || "surface-card" in lightOverrides;
|
|
2010
|
+
if (!hasTriggerKey) return;
|
|
2011
|
+
const present = new Set(presentKeys);
|
|
2012
|
+
for (const [family, tokens] of Object.entries(REQUIRED_OVERRIDE_TOKENS)) {
|
|
2013
|
+
for (const token of tokens) {
|
|
2014
|
+
const fullKey = `${family}-${token}`;
|
|
2015
|
+
if (!present.has(fullKey)) {
|
|
2016
|
+
issues.push(
|
|
2017
|
+
issue(
|
|
2018
|
+
"warning",
|
|
2019
|
+
"INCOMPLETE_OVERRIDE",
|
|
2020
|
+
`'overrides.light' inverts the light-mode surface (overrides 'surface-page' or 'surface-card') but is missing '${fullKey}'. The engine's light-mode default for this token may leak (bright/light-natural values on inverted always-dark themes like Blackout).`,
|
|
2021
|
+
`overrides.light.${fullKey}`
|
|
2022
|
+
)
|
|
2023
|
+
);
|
|
2024
|
+
}
|
|
2025
|
+
}
|
|
2026
|
+
}
|
|
2027
|
+
}
|
|
1969
2028
|
function checkResolvedCompleteness(resolved, issues) {
|
|
1970
2029
|
const requiredColors = [
|
|
1971
2030
|
"primary",
|
|
@@ -2282,6 +2341,7 @@ function validate(config) {
|
|
|
2282
2341
|
for (const iss of overrideIssues) {
|
|
2283
2342
|
(iss.severity === "error" ? errors : warnings).push(iss);
|
|
2284
2343
|
}
|
|
2344
|
+
checkOverrideCompleteness(typedConfig, warnings);
|
|
2285
2345
|
if (errors.length === 0) {
|
|
2286
2346
|
const resolved = resolveConfig(typedConfig);
|
|
2287
2347
|
checkResolvedCompleteness(resolved, errors);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loworbitstudio/visor-theme-engine",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.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",
|