@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.
@@ -8830,6 +8830,13 @@ interface FontsForTokensOptions {
8830
8830
  * would otherwise download a monospace face for a site with no code on it.
8831
8831
  */
8832
8832
  usedCss?: string;
8833
+ /**
8834
+ * The families the org UPLOADED. An uploaded family renders from the org's own files, so it is
8835
+ * never fetched from Google — even when the catalog has a family of that name (an org that uploads
8836
+ * Inter's variable file means THAT Inter: linking Google's too put its static cuts beside the
8837
+ * upload, and the browser picked Google's — DS5.1).
8838
+ */
8839
+ uploaded?: ReadonlyArray<string>;
8833
8840
  }
8834
8841
  /**
8835
8842
  * The Google css2 ids to load for a token set: every catalog family named by the display / body /
@@ -10816,14 +10816,23 @@ function fontsForTokens(tokens, opts = {}) {
10816
10816
  const monoRead = MONO_REFERENCE.test(opts.usedCss ?? '')
10817
10817
  || rows.some(t => t.name !== MONO_ROLE && MONO_REFERENCE.test(`${t.value ?? ''} ${t.values?.dark ?? ''}`));
10818
10818
  const roles = monoRead ? FONT_FAMILY_TOKENS : ALWAYS_LOADED_ROLES;
10819
+ const uploaded = new Set((opts.uploaded ?? []).map(fontFamilyKey));
10819
10820
  const seen = new Set();
10820
10821
  const ids = [];
10821
10822
  for (const role of roles) {
10822
10823
  const row = rows.find(t => t.name === role);
10823
- // The role's FIRST catalog family is the one that renders (or stands in for an uploaded
10824
- // family that is missing — `userFontStack` puts the look's font right after the author's);
10825
- // a catalog family further down is never reached, so it is never loaded.
10826
- const id = parseFontFamilies(row?.value ?? '').map(catalogFontId).find((x) => !!x);
10824
+ // The role's FIRST family that renders decides: an uploaded one needs nothing from Google; the
10825
+ // first catalog one is linked (it renders, or stands in for an uploaded family that is missing
10826
+ // — `userFontStack` puts the look's font right after the author's). Nothing further down is
10827
+ // ever reached, so nothing further down is loaded.
10828
+ let id = null;
10829
+ for (const family of parseFontFamilies(row?.value ?? '')) {
10830
+ if (uploaded.has(fontFamilyKey(family)))
10831
+ break;
10832
+ id = catalogFontId(family);
10833
+ if (id)
10834
+ break;
10835
+ }
10827
10836
  if (id && !seen.has(id)) {
10828
10837
  seen.add(id);
10829
10838
  ids.push(id);