@loworbitstudio/visor-theme-engine 0.4.2 → 0.5.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/adapters/index.js
CHANGED
|
@@ -116,6 +116,21 @@ function lookupGoogleFont(family) {
|
|
|
116
116
|
return catalogMap.get(family.toLowerCase());
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
+
// src/fonts/font-aliases.ts
|
|
120
|
+
var FONT_WEIGHT_ALIASES = {
|
|
121
|
+
"PP Model Mono": {
|
|
122
|
+
400: "Book",
|
|
123
|
+
800: "Super"
|
|
124
|
+
},
|
|
125
|
+
"PP Model Plastic": {
|
|
126
|
+
400: "Book",
|
|
127
|
+
800: "Super"
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
function lookupFontWeightAlias(family, weight) {
|
|
131
|
+
return FONT_WEIGHT_ALIASES[family]?.[weight] ?? null;
|
|
132
|
+
}
|
|
133
|
+
|
|
119
134
|
// src/fonts/resolve.ts
|
|
120
135
|
var DEFAULT_WEIGHTS = [400, 700];
|
|
121
136
|
var DEFAULT_DISPLAY = "swap";
|
|
@@ -156,7 +171,7 @@ var WEIGHT_NAMES = {
|
|
|
156
171
|
function buildVisorFontUrl(org, family, weight) {
|
|
157
172
|
const slug = buildFamilySlug(family);
|
|
158
173
|
const prefix = buildFamilyPrefix(family);
|
|
159
|
-
const weightName = WEIGHT_NAMES[weight] ?? `W${weight}`;
|
|
174
|
+
const weightName = lookupFontWeightAlias(family, weight) ?? WEIGHT_NAMES[weight] ?? `W${weight}`;
|
|
160
175
|
return `${VISOR_FONTS_CDN}/${org}/${slug}/${prefix}-${weightName}.woff2`;
|
|
161
176
|
}
|
|
162
177
|
function resolveFont(family, options = {}) {
|
|
@@ -1392,6 +1407,8 @@ var MATERIAL_TEXT_SLOTS = [
|
|
|
1392
1407
|
export {
|
|
1393
1408
|
googleFontsCatalog,
|
|
1394
1409
|
lookupGoogleFont,
|
|
1410
|
+
FONT_WEIGHT_ALIASES,
|
|
1411
|
+
lookupFontWeightAlias,
|
|
1395
1412
|
VISOR_FONTS_CDN,
|
|
1396
1413
|
buildVisorFontUrl,
|
|
1397
1414
|
resolveFont,
|
package/dist/index.d.ts
CHANGED
|
@@ -28,6 +28,22 @@ declare function buildVisorFontUrl(org: string, family: string, weight: number):
|
|
|
28
28
|
*/
|
|
29
29
|
declare function resolveFont(family: string, options?: FontResolveOptions): FontResolution;
|
|
30
30
|
|
|
31
|
+
/**
|
|
32
|
+
* Font weight-name alias registry for the Visor Fonts CDN URL builder.
|
|
33
|
+
*
|
|
34
|
+
* Standard PostScript naming (Light/Regular/Medium/Bold/ExtraBold/Black)
|
|
35
|
+
* is handled by the WEIGHT_NAMES table in resolve.ts. Foundries that use
|
|
36
|
+
* non-standard names (e.g. Pangram Pangram's `Book` and `Super`) register
|
|
37
|
+
* per-family overrides here so theme authors can keep writing standard
|
|
38
|
+
* weight numbers in their .visor.yaml files.
|
|
39
|
+
*
|
|
40
|
+
* Family keys are exact-match (case-sensitive); weight keys are the numeric
|
|
41
|
+
* weight (300, 400, 500, …) as in WEIGHT_NAMES. The mapped string is the
|
|
42
|
+
* PostScript-style suffix that follows `{Family}-` in the bucket filename.
|
|
43
|
+
*/
|
|
44
|
+
declare const FONT_WEIGHT_ALIASES: Record<string, Record<number, string>>;
|
|
45
|
+
declare function lookupFontWeightAlias(family: string, weight: number): string | null;
|
|
46
|
+
|
|
31
47
|
/**
|
|
32
48
|
* Preload hint generation for font loading performance.
|
|
33
49
|
*
|
|
@@ -912,4 +928,4 @@ declare function cleanFontValue(val: string): string;
|
|
|
912
928
|
*/
|
|
913
929
|
declare function extractFromCSS(files: CSSFile[], name?: string): ExtractionResult;
|
|
914
930
|
|
|
915
|
-
export { type CSSFile, ColorRole, type Confidence, type ExtractedToken, type ExtractionResult, FontDisplayStrategy, type FontFaceDeclaration, FontResolution, FontResolveOptions, FullShadeScale, GeneratedPrimitives, GoogleFontEntry, OKLCH, ParsedColor, RGB, ResolvedThemeConfig, SEMANTIC_MAP, SelectiveShadeScale, SemanticTokens, ShadeStep, TAILWIND_GRAY, ThemeData, ThemeFontResult, ThemeOutput, type ThemeValidationResult, VISOR_FONTS_CDN, type ValidationIssue, type ValidationSeverity, VisorThemeConfig, VisorTypography, applyOverrides, assignSemanticTokens, buildVisorFontUrl, clampToSrgb, cleanFontValue, compositeOverBackground, exportTheme, extractFromCSS, generateDarkCss, generateFullBundleCss, generateLightCss, generatePreloadLinks, generatePrimitives, generatePrimitivesCss, generateSemanticCss, generateShadeScale, generateStylesheetLinks, generateTheme, generateThemeData, generateThemeDataFromConfig, generateThemeFromConfig, getContrastRatio, googleFontsCatalog, hexToOklch, hexToRgb, isValidColor, isValidHex, isVisorThemeConfig, lookupGoogleFont, normalizeHex, oklchToHex, parseCSSDeclarations, parseColor, parseConfig, parseFontFaceDeclarations, parseHex, parseHsla, parseOklch, parseRgba, resolveConfig, resolveFont, resolveThemeFonts, rgbToHex, serializeColor, validate, validateConfig, visorTheme_schema as visorThemeSchema };
|
|
931
|
+
export { type CSSFile, ColorRole, type Confidence, type ExtractedToken, type ExtractionResult, FONT_WEIGHT_ALIASES, FontDisplayStrategy, type FontFaceDeclaration, FontResolution, FontResolveOptions, FullShadeScale, GeneratedPrimitives, GoogleFontEntry, OKLCH, ParsedColor, RGB, ResolvedThemeConfig, SEMANTIC_MAP, SelectiveShadeScale, SemanticTokens, ShadeStep, TAILWIND_GRAY, ThemeData, ThemeFontResult, ThemeOutput, type ThemeValidationResult, VISOR_FONTS_CDN, type ValidationIssue, type ValidationSeverity, VisorThemeConfig, VisorTypography, applyOverrides, assignSemanticTokens, buildVisorFontUrl, clampToSrgb, cleanFontValue, compositeOverBackground, exportTheme, extractFromCSS, generateDarkCss, generateFullBundleCss, generateLightCss, generatePreloadLinks, generatePrimitives, generatePrimitivesCss, generateSemanticCss, generateShadeScale, generateStylesheetLinks, generateTheme, generateThemeData, generateThemeDataFromConfig, generateThemeFromConfig, getContrastRatio, googleFontsCatalog, hexToOklch, hexToRgb, isValidColor, isValidHex, isVisorThemeConfig, lookupFontWeightAlias, lookupGoogleFont, normalizeHex, oklchToHex, parseCSSDeclarations, parseColor, parseConfig, parseFontFaceDeclarations, parseHex, parseHsla, parseOklch, parseRgba, resolveConfig, resolveFont, resolveThemeFonts, rgbToHex, serializeColor, validate, validateConfig, visorTheme_schema as visorThemeSchema };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
FONT_WEIGHT_ALIASES,
|
|
2
3
|
MATERIAL_TEXT_SLOTS,
|
|
3
4
|
TAILWIND_GRAY,
|
|
4
5
|
VISOR_FONTS_CDN,
|
|
@@ -19,6 +20,7 @@ import {
|
|
|
19
20
|
hexToRgb,
|
|
20
21
|
isValidColor,
|
|
21
22
|
isValidHex,
|
|
23
|
+
lookupFontWeightAlias,
|
|
22
24
|
lookupGoogleFont,
|
|
23
25
|
normalizeHex,
|
|
24
26
|
oklchToHex,
|
|
@@ -32,7 +34,7 @@ import {
|
|
|
32
34
|
rgbToHex,
|
|
33
35
|
rgbToOklch,
|
|
34
36
|
serializeColor
|
|
35
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-U5FXQ5EC.js";
|
|
36
38
|
|
|
37
39
|
// src/pipeline.ts
|
|
38
40
|
import { parse as parseYaml } from "yaml";
|
|
@@ -2626,6 +2628,7 @@ function extractFromCSS(files, name = "extracted-theme") {
|
|
|
2626
2628
|
return { config, tokens, unmapped, warnings };
|
|
2627
2629
|
}
|
|
2628
2630
|
export {
|
|
2631
|
+
FONT_WEIGHT_ALIASES,
|
|
2629
2632
|
SEMANTIC_MAP,
|
|
2630
2633
|
TAILWIND_GRAY,
|
|
2631
2634
|
VISOR_FONTS_CDN,
|
|
@@ -2657,6 +2660,7 @@ export {
|
|
|
2657
2660
|
isValidColor,
|
|
2658
2661
|
isValidHex,
|
|
2659
2662
|
isVisorThemeConfig,
|
|
2663
|
+
lookupFontWeightAlias,
|
|
2660
2664
|
lookupGoogleFont,
|
|
2661
2665
|
normalizeHex,
|
|
2662
2666
|
oklchToHex,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loworbitstudio/visor-theme-engine",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
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",
|