@cdx-ui/styles 0.0.1-beta.9 → 0.0.1-beta.90
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 +116 -20
- package/css/theme.css +201 -85
- package/css/vanilla.css +124 -54
- package/lib/commonjs/applyThemeOverride.js +154 -0
- package/lib/commonjs/applyThemeOverride.js.map +1 -0
- package/lib/commonjs/index.js +82 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/palette.js +262 -0
- package/lib/commonjs/palette.js.map +1 -0
- package/lib/commonjs/theming.js +255 -0
- package/lib/commonjs/theming.js.map +1 -0
- package/lib/commonjs/types.js +75 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/commonjs/useCdxFonts.js +4 -231
- package/lib/commonjs/useCdxFonts.js.map +1 -1
- package/lib/commonjs/useForgeFonts.js +237 -0
- package/lib/commonjs/useForgeFonts.js.map +1 -0
- package/lib/module/applyThemeOverride.js +149 -0
- package/lib/module/applyThemeOverride.js.map +1 -0
- package/lib/module/index.js +11 -20
- package/lib/module/index.js.map +1 -1
- package/lib/module/palette.js +257 -0
- package/lib/module/palette.js.map +1 -0
- package/lib/module/theming.js +239 -0
- package/lib/module/theming.js.map +1 -0
- package/lib/module/types.js +71 -0
- package/lib/module/types.js.map +1 -0
- package/lib/module/useCdxFonts.js +3 -219
- package/lib/module/useCdxFonts.js.map +1 -1
- package/lib/module/useForgeFonts.js +223 -0
- package/lib/module/useForgeFonts.js.map +1 -0
- package/lib/runtime/prestige-vs-default.json +1 -0
- package/lib/runtime/pulse-vs-default.json +1 -0
- package/lib/runtime/token-to-css-var.json +672 -0
- package/lib/typescript/applyThemeOverride.d.ts +26 -0
- package/lib/typescript/applyThemeOverride.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +8 -57
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/palette.d.ts +60 -0
- package/lib/typescript/palette.d.ts.map +1 -0
- package/lib/typescript/theming.d.ts +40 -0
- package/lib/typescript/theming.d.ts.map +1 -0
- package/lib/typescript/types.d.ts +90 -0
- package/lib/typescript/types.d.ts.map +1 -0
- package/lib/typescript/useCdxFonts.d.ts +3 -11
- package/lib/typescript/useCdxFonts.d.ts.map +1 -1
- package/lib/typescript/useForgeFonts.d.ts +12 -0
- package/lib/typescript/useForgeFonts.d.ts.map +1 -0
- package/package.json +27 -8
- package/runtime/prestige-vs-default.json +1 -0
- package/runtime/pulse-vs-default.json +1 -0
- package/runtime/token-to-css-var.json +672 -0
- package/src/__tests__/applyThemeOverride.test.ts +552 -0
- package/src/__tests__/generateColorScale.test.ts +296 -0
- package/src/__tests__/presetJson.test.ts +120 -0
- package/src/__tests__/sd.config.test.ts +856 -0
- package/src/__tests__/theming.test.ts +647 -0
- package/src/__tests__/types.test.ts +72 -0
- package/src/__tests__/useCdxFonts.test.ts +27 -0
- package/src/__tests__/useForgeFonts.test.ts +226 -0
- package/src/applyThemeOverride.ts +139 -0
- package/src/index.ts +36 -60
- package/src/palette.ts +307 -0
- package/src/theming.ts +268 -0
- package/src/types.ts +112 -0
- package/src/useCdxFonts.ts +3 -229
- package/src/useForgeFonts.ts +230 -0
- package/tokens/presets/.manifest.json +3 -3
- package/tokens/presets/poise.json +319 -39
- package/tokens/presets/prestige.json +1 -1
- package/tokens/presets/pulse.json +1 -1
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { generatePalettesFromInputs } from './palette';
|
|
4
|
+
import { INPUT_TOKEN_MAP, SUPPORTED_OVERRIDE_SCHEMA_VERSIONS } from './types';
|
|
5
|
+
|
|
6
|
+
// ---------------------------------------------------------------------------
|
|
7
|
+
// Re-export orchestrator
|
|
8
|
+
// ---------------------------------------------------------------------------
|
|
9
|
+
|
|
10
|
+
export { applyThemeOverride, DEFAULT_PRESET } from './applyThemeOverride';
|
|
11
|
+
|
|
12
|
+
// ---------------------------------------------------------------------------
|
|
13
|
+
// Types
|
|
14
|
+
// ---------------------------------------------------------------------------
|
|
15
|
+
|
|
16
|
+
/** Per-mode CSS variable maps ready for `Uniwind.updateCSSVariables`. */
|
|
17
|
+
|
|
18
|
+
/** Runtime map: token dot-paths → CSS custom property names. */
|
|
19
|
+
|
|
20
|
+
// ---------------------------------------------------------------------------
|
|
21
|
+
// Schema version gate
|
|
22
|
+
// ---------------------------------------------------------------------------
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Check whether a `ThemeOverride`'s schema version is supported by the current
|
|
26
|
+
* build of `@cdx-ui/styles`.
|
|
27
|
+
*/
|
|
28
|
+
export function isSchemaVersionSupported(override) {
|
|
29
|
+
const version = override.$extensions['com.forge.ui.themeOverride'].schemaVersion;
|
|
30
|
+
return SUPPORTED_OVERRIDE_SCHEMA_VERSIONS.includes(version);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// ---------------------------------------------------------------------------
|
|
34
|
+
// DTCG tree walker
|
|
35
|
+
// ---------------------------------------------------------------------------
|
|
36
|
+
|
|
37
|
+
function isTokenValue(node) {
|
|
38
|
+
return typeof node === 'object' && node !== null && '$value' in node && '$type' in node;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Recursively walk a nested DTCG object and collect all `$value` leaves with
|
|
43
|
+
* their full dot-path.
|
|
44
|
+
*/
|
|
45
|
+
function flattenDtcg(node, prefix, result) {
|
|
46
|
+
for (const key of Object.keys(node)) {
|
|
47
|
+
if (key.startsWith('$')) continue;
|
|
48
|
+
const child = node[key];
|
|
49
|
+
const path = prefix ? `${prefix}.${key}` : key;
|
|
50
|
+
if (isTokenValue(child)) {
|
|
51
|
+
result[path] = child.$value;
|
|
52
|
+
} else if (typeof child === 'object' && child !== null) {
|
|
53
|
+
flattenDtcg(child, path, result);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// ---------------------------------------------------------------------------
|
|
59
|
+
// Shared mode-bucketing
|
|
60
|
+
// ---------------------------------------------------------------------------
|
|
61
|
+
|
|
62
|
+
function bucketByMode(flatTokens, runtimeMap, runtimePlatform) {
|
|
63
|
+
const light = {};
|
|
64
|
+
const dark = {};
|
|
65
|
+
for (const [dotPath, value] of Object.entries(flatTokens)) {
|
|
66
|
+
const strValue = String(value);
|
|
67
|
+
if (dotPath.startsWith('modes.light.')) {
|
|
68
|
+
const cssVar = runtimeMap[dotPath];
|
|
69
|
+
if (cssVar) light[cssVar] = strValue;
|
|
70
|
+
} else if (dotPath.startsWith('modes.dark.')) {
|
|
71
|
+
const cssVar = runtimeMap[dotPath];
|
|
72
|
+
if (cssVar) dark[cssVar] = strValue;
|
|
73
|
+
} else if (dotPath.startsWith('platform.')) {
|
|
74
|
+
const segments = dotPath.split('.');
|
|
75
|
+
const platform = segments[1];
|
|
76
|
+
if (platform !== runtimePlatform) continue;
|
|
77
|
+
const cssVar = runtimeMap[dotPath];
|
|
78
|
+
if (cssVar) {
|
|
79
|
+
light[cssVar] = strValue;
|
|
80
|
+
dark[cssVar] = strValue;
|
|
81
|
+
}
|
|
82
|
+
} else {
|
|
83
|
+
const cssVar = runtimeMap[dotPath];
|
|
84
|
+
if (cssVar) {
|
|
85
|
+
light[cssVar] = strValue;
|
|
86
|
+
dark[cssVar] = strValue;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return {
|
|
91
|
+
light,
|
|
92
|
+
dark
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// ---------------------------------------------------------------------------
|
|
97
|
+
// Preset patch → Uniwind maps
|
|
98
|
+
// ---------------------------------------------------------------------------
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Convert a nested DTCG preset patch (sparse, `$type`/`$value` leaves) into
|
|
102
|
+
* per-mode CSS variable maps suitable for `Uniwind.updateCSSVariables`.
|
|
103
|
+
*
|
|
104
|
+
* @param patch - A sparse DTCG token object (preset patch).
|
|
105
|
+
* @param runtimeMap - The generated token-to-CSS-var mapping.
|
|
106
|
+
* @param runtimePlatform - Current platform (`'web' | 'ios' | 'android'`).
|
|
107
|
+
*/
|
|
108
|
+
export function presetPatchToUniwindMaps(patch, runtimeMap, runtimePlatform) {
|
|
109
|
+
const flat = {};
|
|
110
|
+
flattenDtcg(patch, '', flat);
|
|
111
|
+
return bucketByMode(flat, runtimeMap, runtimePlatform);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// ---------------------------------------------------------------------------
|
|
115
|
+
// FI override → Uniwind maps
|
|
116
|
+
// ---------------------------------------------------------------------------
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Non-color input keys from INPUT_TOKEN_MAP whose token path does NOT start
|
|
120
|
+
* with `color.`. These are handled separately from palette generation.
|
|
121
|
+
*/
|
|
122
|
+
const FONT_INPUT_ENTRIES = Object.entries(INPUT_TOKEN_MAP).filter(([, tokenPath]) => !tokenPath.startsWith('color.'));
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Matches a token-reference alias value such as `{color.brand.700}` and
|
|
126
|
+
* captures the referenced token dot-path.
|
|
127
|
+
*/
|
|
128
|
+
const TOKEN_ALIAS_REGEX = /^\{([^}]+)\}$/;
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Resolve an `overrides.{mode}` value into the string written to the CSS
|
|
132
|
+
* variable map.
|
|
133
|
+
*
|
|
134
|
+
* - **Token-reference alias** (`{color.brand.700}`) → resolves the referenced
|
|
135
|
+
* token path via the runtime map and returns a CSS `var()` reference
|
|
136
|
+
* (`var(--color-brand-700)`), so the override tracks its source through the
|
|
137
|
+
* cascade — the same mechanism the base theme uses for its semantic tokens.
|
|
138
|
+
* Returns `null` when the referenced path is absent from the runtime map
|
|
139
|
+
* (e.g. a non-primitive target), so the caller skips it; this enforces the
|
|
140
|
+
* primitive-only alias constraint at the resolution layer.
|
|
141
|
+
* - **Literal value** (`#F5F7F6`, `8`) → returned as-is (stringified).
|
|
142
|
+
*
|
|
143
|
+
* @see docs/internal/token-architecture/16-override-structure.md — Token-reference aliases vs. literal values
|
|
144
|
+
*/
|
|
145
|
+
function resolveOverrideValue(value, runtimeMap) {
|
|
146
|
+
if (typeof value === 'string') {
|
|
147
|
+
const aliasMatch = TOKEN_ALIAS_REGEX.exec(value);
|
|
148
|
+
if (aliasMatch) {
|
|
149
|
+
const referencedPath = aliasMatch[1].trim();
|
|
150
|
+
const targetCssVar = runtimeMap[referencedPath];
|
|
151
|
+
return targetCssVar ? `var(${targetCssVar})` : null;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
return String(value);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Convert a hybrid FI override (`ThemeOverride`) into per-mode CSS variable
|
|
159
|
+
* maps suitable for `Uniwind.updateCSSVariables`.
|
|
160
|
+
*
|
|
161
|
+
* Processing:
|
|
162
|
+
* 1. Generate palettes from color `inputs` (via S4).
|
|
163
|
+
* 2. Map font inputs to token paths.
|
|
164
|
+
* 3. For each mode, merge palette + fonts + explicit `overrides.{mode}` entries.
|
|
165
|
+
* 4. Map all token dot-paths to CSS variable names via runtime map.
|
|
166
|
+
*
|
|
167
|
+
* @param override - A `ThemeOverride` object.
|
|
168
|
+
* @param runtimeMap - The generated token-to-CSS-var mapping.
|
|
169
|
+
* @param runtimePlatform - Current platform (`'web' | 'ios' | 'android'`).
|
|
170
|
+
*/
|
|
171
|
+
export function themeOverrideToUniwindMaps(override, runtimeMap
|
|
172
|
+
// runtimePlatform: Platform,
|
|
173
|
+
) {
|
|
174
|
+
const light = {};
|
|
175
|
+
const dark = {};
|
|
176
|
+
const inputs = override.inputs;
|
|
177
|
+
const overrides = override.overrides;
|
|
178
|
+
if (!inputs && !overrides) {
|
|
179
|
+
return {
|
|
180
|
+
light,
|
|
181
|
+
dark
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// --- Palette generation from colour inputs ---
|
|
186
|
+
let paletteTokens = {};
|
|
187
|
+
if (inputs) {
|
|
188
|
+
paletteTokens = generatePalettesFromInputs(inputs);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// --- Font input mapping ---
|
|
192
|
+
const fontTokens = {};
|
|
193
|
+
if (inputs) {
|
|
194
|
+
for (const [inputKey, tokenPath] of FONT_INPUT_ENTRIES) {
|
|
195
|
+
const value = inputs[inputKey];
|
|
196
|
+
if (value !== undefined) {
|
|
197
|
+
fontTokens[tokenPath] = String(value);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// --- Merge per mode ---
|
|
203
|
+
const modes = ['light', 'dark'];
|
|
204
|
+
for (const mode of modes) {
|
|
205
|
+
const bucket = mode === 'light' ? light : dark;
|
|
206
|
+
|
|
207
|
+
// 1. Palette-generated primitives (mode-independent → both buckets)
|
|
208
|
+
for (const [dotPath, hexValue] of Object.entries(paletteTokens)) {
|
|
209
|
+
const cssVar = runtimeMap[dotPath];
|
|
210
|
+
if (cssVar) bucket[cssVar] = hexValue;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
// 2. Font input mappings (mode-independent → both buckets)
|
|
214
|
+
for (const [tokenPath, value] of Object.entries(fontTokens)) {
|
|
215
|
+
const modePrefixed = `modes.${mode}.${tokenPath}`;
|
|
216
|
+
const cssVar = runtimeMap[modePrefixed] ?? runtimeMap[tokenPath];
|
|
217
|
+
if (cssVar) bucket[cssVar] = value;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
// 3. Explicit per-mode overrides (wins on collision). Values may be
|
|
221
|
+
// token-reference aliases (resolved to a CSS var() reference) or
|
|
222
|
+
// literals; see resolveOverrideValue.
|
|
223
|
+
const modeOverrides = overrides?.[mode];
|
|
224
|
+
if (modeOverrides) {
|
|
225
|
+
for (const [dotPath, value] of Object.entries(modeOverrides)) {
|
|
226
|
+
const modePrefixed = `modes.${mode}.${dotPath}`;
|
|
227
|
+
const cssVar = runtimeMap[modePrefixed] ?? runtimeMap[dotPath];
|
|
228
|
+
if (!cssVar) continue;
|
|
229
|
+
const resolved = resolveOverrideValue(value, runtimeMap);
|
|
230
|
+
if (resolved !== null) bucket[cssVar] = resolved;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
return {
|
|
235
|
+
light,
|
|
236
|
+
dark
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
//# sourceMappingURL=theming.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["generatePalettesFromInputs","INPUT_TOKEN_MAP","SUPPORTED_OVERRIDE_SCHEMA_VERSIONS","applyThemeOverride","DEFAULT_PRESET","isSchemaVersionSupported","override","version","$extensions","schemaVersion","includes","isTokenValue","node","flattenDtcg","prefix","result","key","Object","keys","startsWith","child","path","$value","bucketByMode","flatTokens","runtimeMap","runtimePlatform","light","dark","dotPath","value","entries","strValue","String","cssVar","segments","split","platform","presetPatchToUniwindMaps","patch","flat","FONT_INPUT_ENTRIES","filter","tokenPath","TOKEN_ALIAS_REGEX","resolveOverrideValue","aliasMatch","exec","referencedPath","trim","targetCssVar","themeOverrideToUniwindMaps","inputs","overrides","paletteTokens","fontTokens","inputKey","undefined","modes","mode","bucket","hexValue","modePrefixed","modeOverrides","resolved"],"sourceRoot":"../../src","sources":["theming.ts"],"mappings":";;AAAA,SAASA,0BAA0B,QAAQ,WAAW;AACtD,SACEC,eAAe,EACfC,kCAAkC,QAM7B,SAAS;;AAEhB;AACA;AACA;;AAEA,SAASC,kBAAkB,EAAEC,cAAc,QAAQ,sBAAsB;;AAGzE;AACA;AACA;;AAEA;;AAMA;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASC,wBAAwBA,CAACC,QAAuB,EAAW;EACzE,MAAMC,OAAO,GAAGD,QAAQ,CAACE,WAAW,CAAC,4BAA4B,CAAC,CAACC,aAAa;EAChF,OAAOP,kCAAkC,CAACQ,QAAQ,CAACH,OAAO,CAA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AAEC,KAAK,CAAC,IAAIb,MAAM,CAACc,OAAO,CAACgC,aAAa,CAAC,EAAE;QAC5D,MAAMD,YAAY,GAAG,SAASH,IAAI,IAAI9B,OAAO,EAAE;QAC/C,MAAMK,MAAM,GAAGT,UAAU,CAACqC,YAAY,CAAC,IAAIrC,UAAU,CAACI,OAAO,CAAC;QAC9D,IAAI,CAACK,MAAM,EAAE;QAEb,MAAM8B,QAAQ,GAAGnB,oBAAoB,CAACf,KAAK,EAAEL,UAAU,CAAC;QACxD,IAAIuC,QAAQ,KAAK,IAAI,EAAEJ,MAAM,CAAC1B,MAAM,CAAC,GAAG8B,QAAQ;MAClD;IACF;EACF;EAEA,OAAO;IAAErC,KAAK;IAAEC;EAAK,CAAC;AACxB","ignoreList":[]}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// ---------------------------------------------------------------------------
|
|
4
|
+
// Types
|
|
5
|
+
// ---------------------------------------------------------------------------
|
|
6
|
+
|
|
7
|
+
/** A DTCG token leaf node. */
|
|
8
|
+
|
|
9
|
+
/** Recursive token group — every non-leaf node in a theme object. */
|
|
10
|
+
|
|
11
|
+
/** The three built-in Forge UI theme presets. */
|
|
12
|
+
|
|
13
|
+
/** Theme metadata stored under `$extensions.com.forge.ui.theme`. */
|
|
14
|
+
|
|
15
|
+
/** Override metadata stored under `$extensions.com.forge.ui.themeOverride`. */
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* A complete Forge UI theme object (DTCG-compatible).
|
|
19
|
+
*
|
|
20
|
+
* Presets (Poise, Prestige, Pulse) are full theme objects. At runtime the
|
|
21
|
+
* build-time default preset is augmented by FI overrides via
|
|
22
|
+
* `applyThemeOverrides`.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* A theme override using the hybrid input + semantic structure.
|
|
27
|
+
*
|
|
28
|
+
* - `inputs` — flat map of abstract FI-selected brand values (e.g.
|
|
29
|
+
* `brandPrimary`, `displayFont`). Palette generation expands these into
|
|
30
|
+
* full token scales at runtime.
|
|
31
|
+
* - `overrides` — per-mode flat maps of token dot-paths to resolved values
|
|
32
|
+
* for direct semantic token overrides beyond what inputs generate.
|
|
33
|
+
* - `$extensions` — required metadata including base preset and schema version.
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
// ---------------------------------------------------------------------------
|
|
37
|
+
// Constants
|
|
38
|
+
// ---------------------------------------------------------------------------
|
|
39
|
+
|
|
40
|
+
/** Current override schema version. Consuming apps gate compatibility on this. */
|
|
41
|
+
export const OVERRIDE_SCHEMA_VERSION = '1.0.0';
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Schema versions that consuming apps accept. Includes the current version and
|
|
45
|
+
* may include the immediately prior version during transition windows.
|
|
46
|
+
* @see docs/internal/token-architecture/16-override-structure.md § 4
|
|
47
|
+
*/
|
|
48
|
+
export const SUPPORTED_OVERRIDE_SCHEMA_VERSIONS = ['1.0.0'];
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Schema-level mapping from known input keys to the token path pattern each
|
|
52
|
+
* affects. Used by override application (S5) to route inputs to the correct
|
|
53
|
+
* palette/token namespace. Distinct from the full runtime map (S3).
|
|
54
|
+
*/
|
|
55
|
+
export const INPUT_TOKEN_MAP = {
|
|
56
|
+
brandPrimary: 'color.brand',
|
|
57
|
+
accentPrimary: 'color.accent',
|
|
58
|
+
basePrimary: 'color.base',
|
|
59
|
+
displayFont: 'font.display'
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Allowed display font families per preset, consumed by the theme editor for
|
|
64
|
+
* font selection and by consuming apps for validation.
|
|
65
|
+
*/
|
|
66
|
+
export const presetFonts = {
|
|
67
|
+
poise: ['Crimson Pro', 'Bitter', 'DM Sans'],
|
|
68
|
+
prestige: ['Libre Caslon Text', 'Cormorant', 'Libre Franklin'],
|
|
69
|
+
pulse: ['Outfit', 'Manrope', 'Public Sans']
|
|
70
|
+
};
|
|
71
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["OVERRIDE_SCHEMA_VERSION","SUPPORTED_OVERRIDE_SCHEMA_VERSIONS","INPUT_TOKEN_MAP","brandPrimary","accentPrimary","basePrimary","displayFont","presetFonts","poise","prestige","pulse"],"sourceRoot":"../../src","sources":["types.ts"],"mappings":";;AAAA;AACA;AACA;;AAEA;;AAOA;;AAKA;;AAGA;;AAOA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;;AAiBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAaA;AACA;AACA;;AAEA;AACA,OAAO,MAAMA,uBAAuB,GAAG,OAAgB;;AAEvD;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,kCAAqD,GAAG,CAAC,OAAO,CAAU;;AAEvF;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,eAAe,GAAG;EAC7BC,YAAY,EAAE,aAAa;EAC3BC,aAAa,EAAE,cAAc;EAC7BC,WAAW,EAAE,YAAY;EACzBC,WAAW,EAAE;AACf,CAA2C;;AAE3C;AACA;AACA;AACA;AACA,OAAO,MAAMC,WAA8C,GAAG;EAC5DC,KAAK,EAAE,CAAC,aAAa,EAAE,QAAQ,EAAE,SAAS,CAAC;EAC3CC,QAAQ,EAAE,CAAC,mBAAmB,EAAE,WAAW,EAAE,gBAAgB,CAAC;EAC9DC,KAAK,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,aAAa;AAC5C,CAAU","ignoreList":[]}
|
|
@@ -1,223 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import { useFonts } from 'expo-font';
|
|
5
|
-
// Crimson Pro
|
|
6
|
-
import { CrimsonPro_400Regular } from '@expo-google-fonts/crimson-pro/400Regular';
|
|
7
|
-
import { CrimsonPro_500Medium } from '@expo-google-fonts/crimson-pro/500Medium';
|
|
8
|
-
import { CrimsonPro_600SemiBold } from '@expo-google-fonts/crimson-pro/600SemiBold';
|
|
9
|
-
import { CrimsonPro_700Bold } from '@expo-google-fonts/crimson-pro/700Bold';
|
|
10
|
-
import { CrimsonPro_400Regular_Italic } from '@expo-google-fonts/crimson-pro/400Regular_Italic';
|
|
11
|
-
import { CrimsonPro_500Medium_Italic } from '@expo-google-fonts/crimson-pro/500Medium_Italic';
|
|
12
|
-
import { CrimsonPro_600SemiBold_Italic } from '@expo-google-fonts/crimson-pro/600SemiBold_Italic';
|
|
13
|
-
import { CrimsonPro_700Bold_Italic } from '@expo-google-fonts/crimson-pro/700Bold_Italic';
|
|
14
|
-
// Bitter
|
|
15
|
-
import { Bitter_400Regular } from '@expo-google-fonts/bitter/400Regular';
|
|
16
|
-
import { Bitter_500Medium } from '@expo-google-fonts/bitter/500Medium';
|
|
17
|
-
import { Bitter_600SemiBold } from '@expo-google-fonts/bitter/600SemiBold';
|
|
18
|
-
import { Bitter_700Bold } from '@expo-google-fonts/bitter/700Bold';
|
|
19
|
-
import { Bitter_400Regular_Italic } from '@expo-google-fonts/bitter/400Regular_Italic';
|
|
20
|
-
import { Bitter_500Medium_Italic } from '@expo-google-fonts/bitter/500Medium_Italic';
|
|
21
|
-
import { Bitter_600SemiBold_Italic } from '@expo-google-fonts/bitter/600SemiBold_Italic';
|
|
22
|
-
import { Bitter_700Bold_Italic } from '@expo-google-fonts/bitter/700Bold_Italic';
|
|
23
|
-
// DM Sans
|
|
24
|
-
import { DMSans_400Regular } from '@expo-google-fonts/dm-sans/400Regular';
|
|
25
|
-
import { DMSans_500Medium } from '@expo-google-fonts/dm-sans/500Medium';
|
|
26
|
-
import { DMSans_600SemiBold } from '@expo-google-fonts/dm-sans/600SemiBold';
|
|
27
|
-
import { DMSans_700Bold } from '@expo-google-fonts/dm-sans/700Bold';
|
|
28
|
-
import { DMSans_400Regular_Italic } from '@expo-google-fonts/dm-sans/400Regular_Italic';
|
|
29
|
-
import { DMSans_500Medium_Italic } from '@expo-google-fonts/dm-sans/500Medium_Italic';
|
|
30
|
-
import { DMSans_600SemiBold_Italic } from '@expo-google-fonts/dm-sans/600SemiBold_Italic';
|
|
31
|
-
import { DMSans_700Bold_Italic } from '@expo-google-fonts/dm-sans/700Bold_Italic';
|
|
32
|
-
// Libre Caslon Text — weights 400 + 700 only; italic at 400 only
|
|
33
|
-
import { LibreCaslonText_400Regular } from '@expo-google-fonts/libre-caslon-text/400Regular';
|
|
34
|
-
import { LibreCaslonText_700Bold } from '@expo-google-fonts/libre-caslon-text/700Bold';
|
|
35
|
-
import { LibreCaslonText_400Regular_Italic } from '@expo-google-fonts/libre-caslon-text/400Regular_Italic';
|
|
36
|
-
// Cormorant
|
|
37
|
-
import { Cormorant_400Regular } from '@expo-google-fonts/cormorant/400Regular';
|
|
38
|
-
import { Cormorant_500Medium } from '@expo-google-fonts/cormorant/500Medium';
|
|
39
|
-
import { Cormorant_600SemiBold } from '@expo-google-fonts/cormorant/600SemiBold';
|
|
40
|
-
import { Cormorant_700Bold } from '@expo-google-fonts/cormorant/700Bold';
|
|
41
|
-
import { Cormorant_400Regular_Italic } from '@expo-google-fonts/cormorant/400Regular_Italic';
|
|
42
|
-
import { Cormorant_500Medium_Italic } from '@expo-google-fonts/cormorant/500Medium_Italic';
|
|
43
|
-
import { Cormorant_600SemiBold_Italic } from '@expo-google-fonts/cormorant/600SemiBold_Italic';
|
|
44
|
-
import { Cormorant_700Bold_Italic } from '@expo-google-fonts/cormorant/700Bold_Italic';
|
|
45
|
-
// Libre Franklin
|
|
46
|
-
import { LibreFranklin_400Regular } from '@expo-google-fonts/libre-franklin/400Regular';
|
|
47
|
-
import { LibreFranklin_500Medium } from '@expo-google-fonts/libre-franklin/500Medium';
|
|
48
|
-
import { LibreFranklin_600SemiBold } from '@expo-google-fonts/libre-franklin/600SemiBold';
|
|
49
|
-
import { LibreFranklin_700Bold } from '@expo-google-fonts/libre-franklin/700Bold';
|
|
50
|
-
import { LibreFranklin_400Regular_Italic } from '@expo-google-fonts/libre-franklin/400Regular_Italic';
|
|
51
|
-
import { LibreFranklin_500Medium_Italic } from '@expo-google-fonts/libre-franklin/500Medium_Italic';
|
|
52
|
-
import { LibreFranklin_600SemiBold_Italic } from '@expo-google-fonts/libre-franklin/600SemiBold_Italic';
|
|
53
|
-
import { LibreFranklin_700Bold_Italic } from '@expo-google-fonts/libre-franklin/700Bold_Italic';
|
|
54
|
-
// Outfit — no italic files available
|
|
55
|
-
import { Outfit_400Regular } from '@expo-google-fonts/outfit/400Regular';
|
|
56
|
-
import { Outfit_500Medium } from '@expo-google-fonts/outfit/500Medium';
|
|
57
|
-
import { Outfit_600SemiBold } from '@expo-google-fonts/outfit/600SemiBold';
|
|
58
|
-
import { Outfit_700Bold } from '@expo-google-fonts/outfit/700Bold';
|
|
59
|
-
// Manrope — no italic files available
|
|
60
|
-
import { Manrope_400Regular } from '@expo-google-fonts/manrope/400Regular';
|
|
61
|
-
import { Manrope_500Medium } from '@expo-google-fonts/manrope/500Medium';
|
|
62
|
-
import { Manrope_600SemiBold } from '@expo-google-fonts/manrope/600SemiBold';
|
|
63
|
-
import { Manrope_700Bold } from '@expo-google-fonts/manrope/700Bold';
|
|
64
|
-
// Public Sans
|
|
65
|
-
import { PublicSans_400Regular } from '@expo-google-fonts/public-sans/400Regular';
|
|
66
|
-
import { PublicSans_500Medium } from '@expo-google-fonts/public-sans/500Medium';
|
|
67
|
-
import { PublicSans_600SemiBold } from '@expo-google-fonts/public-sans/600SemiBold';
|
|
68
|
-
import { PublicSans_700Bold } from '@expo-google-fonts/public-sans/700Bold';
|
|
69
|
-
import { PublicSans_400Regular_Italic } from '@expo-google-fonts/public-sans/400Regular_Italic';
|
|
70
|
-
import { PublicSans_500Medium_Italic } from '@expo-google-fonts/public-sans/500Medium_Italic';
|
|
71
|
-
import { PublicSans_600SemiBold_Italic } from '@expo-google-fonts/public-sans/600SemiBold_Italic';
|
|
72
|
-
import { PublicSans_700Bold_Italic } from '@expo-google-fonts/public-sans/700Bold_Italic';
|
|
73
|
-
// Inter (web platform font)
|
|
74
|
-
import { Inter_400Regular } from '@expo-google-fonts/inter/400Regular';
|
|
75
|
-
import { Inter_500Medium } from '@expo-google-fonts/inter/500Medium';
|
|
76
|
-
import { Inter_600SemiBold } from '@expo-google-fonts/inter/600SemiBold';
|
|
77
|
-
import { Inter_700Bold } from '@expo-google-fonts/inter/700Bold';
|
|
78
|
-
import { Inter_400Regular_Italic } from '@expo-google-fonts/inter/400Regular_Italic';
|
|
79
|
-
import { Inter_500Medium_Italic } from '@expo-google-fonts/inter/500Medium_Italic';
|
|
80
|
-
import { Inter_600SemiBold_Italic } from '@expo-google-fonts/inter/600SemiBold_Italic';
|
|
81
|
-
import { Inter_700Bold_Italic } from '@expo-google-fonts/inter/700Bold_Italic';
|
|
82
|
-
// IBM Plex Mono (web platform font)
|
|
83
|
-
import { IBMPlexMono_400Regular } from '@expo-google-fonts/ibm-plex-mono/400Regular';
|
|
84
|
-
import { IBMPlexMono_500Medium } from '@expo-google-fonts/ibm-plex-mono/500Medium';
|
|
85
|
-
import { IBMPlexMono_600SemiBold } from '@expo-google-fonts/ibm-plex-mono/600SemiBold';
|
|
86
|
-
import { IBMPlexMono_700Bold } from '@expo-google-fonts/ibm-plex-mono/700Bold';
|
|
87
|
-
import { IBMPlexMono_400Regular_Italic } from '@expo-google-fonts/ibm-plex-mono/400Regular_Italic';
|
|
88
|
-
import { IBMPlexMono_500Medium_Italic } from '@expo-google-fonts/ibm-plex-mono/500Medium_Italic';
|
|
89
|
-
import { IBMPlexMono_600SemiBold_Italic } from '@expo-google-fonts/ibm-plex-mono/600SemiBold_Italic';
|
|
90
|
-
import { IBMPlexMono_700Bold_Italic } from '@expo-google-fonts/ibm-plex-mono/700Bold_Italic';
|
|
3
|
+
import { useForgeFonts } from './useForgeFonts';
|
|
91
4
|
|
|
92
|
-
/**
|
|
93
|
-
|
|
94
|
-
* Keys are token-matching registered names so CSS variable values resolve
|
|
95
|
-
* to loaded font files on all platforms.
|
|
96
|
-
*/
|
|
97
|
-
const displayFonts = {
|
|
98
|
-
// Crimson Pro (Poise)
|
|
99
|
-
'Crimson Pro': CrimsonPro_400Regular,
|
|
100
|
-
'Crimson Pro Medium': CrimsonPro_500Medium,
|
|
101
|
-
'Crimson Pro SemiBold': CrimsonPro_600SemiBold,
|
|
102
|
-
'Crimson Pro Bold': CrimsonPro_700Bold,
|
|
103
|
-
'Crimson Pro Italic': CrimsonPro_400Regular_Italic,
|
|
104
|
-
'Crimson Pro Medium Italic': CrimsonPro_500Medium_Italic,
|
|
105
|
-
'Crimson Pro SemiBold Italic': CrimsonPro_600SemiBold_Italic,
|
|
106
|
-
'Crimson Pro Bold Italic': CrimsonPro_700Bold_Italic,
|
|
107
|
-
// Bitter (Poise)
|
|
108
|
-
Bitter: Bitter_400Regular,
|
|
109
|
-
'Bitter Medium': Bitter_500Medium,
|
|
110
|
-
'Bitter SemiBold': Bitter_600SemiBold,
|
|
111
|
-
'Bitter Bold': Bitter_700Bold,
|
|
112
|
-
'Bitter Italic': Bitter_400Regular_Italic,
|
|
113
|
-
'Bitter Medium Italic': Bitter_500Medium_Italic,
|
|
114
|
-
'Bitter SemiBold Italic': Bitter_600SemiBold_Italic,
|
|
115
|
-
'Bitter Bold Italic': Bitter_700Bold_Italic,
|
|
116
|
-
// DM Sans (Poise)
|
|
117
|
-
'DM Sans': DMSans_400Regular,
|
|
118
|
-
'DM Sans Medium': DMSans_500Medium,
|
|
119
|
-
'DM Sans SemiBold': DMSans_600SemiBold,
|
|
120
|
-
'DM Sans Bold': DMSans_700Bold,
|
|
121
|
-
'DM Sans Italic': DMSans_400Regular_Italic,
|
|
122
|
-
'DM Sans Medium Italic': DMSans_500Medium_Italic,
|
|
123
|
-
'DM Sans SemiBold Italic': DMSans_600SemiBold_Italic,
|
|
124
|
-
'DM Sans Bold Italic': DMSans_700Bold_Italic,
|
|
125
|
-
// Libre Caslon Text (Prestige) — 500/600 unavailable, mapped to 400;
|
|
126
|
-
// italic only at 400, all other italic keys map to 400 italic
|
|
127
|
-
'Libre Caslon Text': LibreCaslonText_400Regular,
|
|
128
|
-
'Libre Caslon Text Medium': LibreCaslonText_400Regular,
|
|
129
|
-
'Libre Caslon Text SemiBold': LibreCaslonText_400Regular,
|
|
130
|
-
'Libre Caslon Text Bold': LibreCaslonText_700Bold,
|
|
131
|
-
'Libre Caslon Text Italic': LibreCaslonText_400Regular_Italic,
|
|
132
|
-
'Libre Caslon Text Medium Italic': LibreCaslonText_400Regular_Italic,
|
|
133
|
-
'Libre Caslon Text SemiBold Italic': LibreCaslonText_400Regular_Italic,
|
|
134
|
-
'Libre Caslon Text Bold Italic': LibreCaslonText_400Regular_Italic,
|
|
135
|
-
// Cormorant (Prestige)
|
|
136
|
-
Cormorant: Cormorant_400Regular,
|
|
137
|
-
'Cormorant Medium': Cormorant_500Medium,
|
|
138
|
-
'Cormorant SemiBold': Cormorant_600SemiBold,
|
|
139
|
-
'Cormorant Bold': Cormorant_700Bold,
|
|
140
|
-
'Cormorant Italic': Cormorant_400Regular_Italic,
|
|
141
|
-
'Cormorant Medium Italic': Cormorant_500Medium_Italic,
|
|
142
|
-
'Cormorant SemiBold Italic': Cormorant_600SemiBold_Italic,
|
|
143
|
-
'Cormorant Bold Italic': Cormorant_700Bold_Italic,
|
|
144
|
-
// Libre Franklin (Prestige)
|
|
145
|
-
'Libre Franklin': LibreFranklin_400Regular,
|
|
146
|
-
'Libre Franklin Medium': LibreFranklin_500Medium,
|
|
147
|
-
'Libre Franklin SemiBold': LibreFranklin_600SemiBold,
|
|
148
|
-
'Libre Franklin Bold': LibreFranklin_700Bold,
|
|
149
|
-
'Libre Franklin Italic': LibreFranklin_400Regular_Italic,
|
|
150
|
-
'Libre Franklin Medium Italic': LibreFranklin_500Medium_Italic,
|
|
151
|
-
'Libre Franklin SemiBold Italic': LibreFranklin_600SemiBold_Italic,
|
|
152
|
-
'Libre Franklin Bold Italic': LibreFranklin_700Bold_Italic,
|
|
153
|
-
// Outfit (Pulse) — no italic files; italic keys map to regular variants
|
|
154
|
-
Outfit: Outfit_400Regular,
|
|
155
|
-
'Outfit Medium': Outfit_500Medium,
|
|
156
|
-
'Outfit SemiBold': Outfit_600SemiBold,
|
|
157
|
-
'Outfit Bold': Outfit_700Bold,
|
|
158
|
-
'Outfit Italic': Outfit_400Regular,
|
|
159
|
-
'Outfit Medium Italic': Outfit_500Medium,
|
|
160
|
-
'Outfit SemiBold Italic': Outfit_600SemiBold,
|
|
161
|
-
'Outfit Bold Italic': Outfit_700Bold,
|
|
162
|
-
// Manrope (Pulse) — no italic files; italic keys map to regular variants
|
|
163
|
-
Manrope: Manrope_400Regular,
|
|
164
|
-
'Manrope Medium': Manrope_500Medium,
|
|
165
|
-
'Manrope SemiBold': Manrope_600SemiBold,
|
|
166
|
-
'Manrope Bold': Manrope_700Bold,
|
|
167
|
-
'Manrope Italic': Manrope_400Regular,
|
|
168
|
-
'Manrope Medium Italic': Manrope_500Medium,
|
|
169
|
-
'Manrope SemiBold Italic': Manrope_600SemiBold,
|
|
170
|
-
'Manrope Bold Italic': Manrope_700Bold,
|
|
171
|
-
// Public Sans (Pulse)
|
|
172
|
-
'Public Sans': PublicSans_400Regular,
|
|
173
|
-
'Public Sans Medium': PublicSans_500Medium,
|
|
174
|
-
'Public Sans SemiBold': PublicSans_600SemiBold,
|
|
175
|
-
'Public Sans Bold': PublicSans_700Bold,
|
|
176
|
-
'Public Sans Italic': PublicSans_400Regular_Italic,
|
|
177
|
-
'Public Sans Medium Italic': PublicSans_500Medium_Italic,
|
|
178
|
-
'Public Sans SemiBold Italic': PublicSans_600SemiBold_Italic,
|
|
179
|
-
'Public Sans Bold Italic': PublicSans_700Bold_Italic
|
|
180
|
-
};
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* Web platform fonts — only included when running on web.
|
|
184
|
-
* Imports remain top-level so Metro statically bundles the font files;
|
|
185
|
-
* the conditional controls whether useFonts receives them.
|
|
186
|
-
*/
|
|
187
|
-
const webFonts = Platform.OS === 'web' ? {
|
|
188
|
-
Inter: Inter_400Regular,
|
|
189
|
-
'Inter Medium': Inter_500Medium,
|
|
190
|
-
'Inter SemiBold': Inter_600SemiBold,
|
|
191
|
-
'Inter Bold': Inter_700Bold,
|
|
192
|
-
'Inter Italic': Inter_400Regular_Italic,
|
|
193
|
-
'Inter Medium Italic': Inter_500Medium_Italic,
|
|
194
|
-
'Inter SemiBold Italic': Inter_600SemiBold_Italic,
|
|
195
|
-
'Inter Bold Italic': Inter_700Bold_Italic,
|
|
196
|
-
'IBM Plex Mono': IBMPlexMono_400Regular,
|
|
197
|
-
'IBM Plex Mono Medium': IBMPlexMono_500Medium,
|
|
198
|
-
'IBM Plex Mono SemiBold': IBMPlexMono_600SemiBold,
|
|
199
|
-
'IBM Plex Mono Bold': IBMPlexMono_700Bold,
|
|
200
|
-
'IBM Plex Mono Italic': IBMPlexMono_400Regular_Italic,
|
|
201
|
-
'IBM Plex Mono Medium Italic': IBMPlexMono_500Medium_Italic,
|
|
202
|
-
'IBM Plex Mono SemiBold Italic': IBMPlexMono_600SemiBold_Italic,
|
|
203
|
-
'IBM Plex Mono Bold Italic': IBMPlexMono_700Bold_Italic
|
|
204
|
-
} : {};
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* Loads all CDX UI fonts — 9 display fonts (3 per preset) with weight/italic
|
|
208
|
-
* variants, plus web platform fonts (Inter, IBM Plex Mono) on web.
|
|
209
|
-
*
|
|
210
|
-
* This is a pure font loader with no preset or FI config awareness. Font
|
|
211
|
-
* selection is handled by the CSS variable layer via theme tokens.
|
|
212
|
-
*/
|
|
213
|
-
export function useCdxFonts() {
|
|
214
|
-
const [loaded, error] = useFonts({
|
|
215
|
-
...displayFonts,
|
|
216
|
-
...webFonts
|
|
217
|
-
});
|
|
218
|
-
return {
|
|
219
|
-
loaded,
|
|
220
|
-
error
|
|
221
|
-
};
|
|
222
|
-
}
|
|
5
|
+
/** @deprecated Use `useForgeFonts` instead. Will be removed in a future major release. */
|
|
6
|
+
export const useCdxFonts = useForgeFonts;
|
|
223
7
|
//# sourceMappingURL=useCdxFonts.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["useForgeFonts","useCdxFonts"],"sourceRoot":"../../src","sources":["useCdxFonts.ts"],"mappings":";;AAAA,SAASA,aAAa,QAAQ,iBAAiB;;AAE/C;AACA,OAAO,MAAMC,WAAW,GAAGD,aAAa","ignoreList":[]}
|