@vectoriox/iox-ui 5.20.0 → 5.21.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/package.json
CHANGED
package/src/design-core/fonts.ts
CHANGED
|
@@ -422,6 +422,13 @@ export interface FontsForTokensOptions {
|
|
|
422
422
|
* would otherwise download a monospace face for a site with no code on it.
|
|
423
423
|
*/
|
|
424
424
|
usedCss?: string;
|
|
425
|
+
/**
|
|
426
|
+
* The families the org UPLOADED. An uploaded family renders from the org's own files, so it is
|
|
427
|
+
* never fetched from Google — even when the catalog has a family of that name (an org that uploads
|
|
428
|
+
* Inter's variable file means THAT Inter: linking Google's too put its static cuts beside the
|
|
429
|
+
* upload, and the browser picked Google's — DS5.1).
|
|
430
|
+
*/
|
|
431
|
+
uploaded?: ReadonlyArray<string>;
|
|
425
432
|
}
|
|
426
433
|
|
|
427
434
|
/**
|
|
@@ -437,14 +444,21 @@ export function fontsForTokens(
|
|
|
437
444
|
const monoRead = MONO_REFERENCE.test(opts.usedCss ?? '')
|
|
438
445
|
|| rows.some(t => t.name !== MONO_ROLE && MONO_REFERENCE.test(`${t.value ?? ''} ${t.values?.dark ?? ''}`));
|
|
439
446
|
const roles = monoRead ? FONT_FAMILY_TOKENS : ALWAYS_LOADED_ROLES;
|
|
447
|
+
const uploaded = new Set((opts.uploaded ?? []).map(fontFamilyKey));
|
|
440
448
|
const seen = new Set<string>();
|
|
441
449
|
const ids: string[] = [];
|
|
442
450
|
for (const role of roles) {
|
|
443
451
|
const row = rows.find(t => t.name === role);
|
|
444
|
-
// The role's FIRST
|
|
445
|
-
//
|
|
446
|
-
//
|
|
447
|
-
|
|
452
|
+
// The role's FIRST family that renders decides: an uploaded one needs nothing from Google; the
|
|
453
|
+
// first catalog one is linked (it renders, or stands in for an uploaded family that is missing
|
|
454
|
+
// — `userFontStack` puts the look's font right after the author's). Nothing further down is
|
|
455
|
+
// ever reached, so nothing further down is loaded.
|
|
456
|
+
let id: string | null = null;
|
|
457
|
+
for (const family of parseFontFamilies(row?.value ?? '')) {
|
|
458
|
+
if (uploaded.has(fontFamilyKey(family))) break;
|
|
459
|
+
id = catalogFontId(family);
|
|
460
|
+
if (id) break;
|
|
461
|
+
}
|
|
448
462
|
if (id && !seen.has(id)) {
|
|
449
463
|
seen.add(id);
|
|
450
464
|
ids.push(id);
|