@json-to-office/shared 0.29.0 → 0.35.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/index.d.ts CHANGED
@@ -1,147 +1,79 @@
1
1
  export { C as ComponentDefinition, a as ComponentSchemaConfig, c as convertToJsonSchema, b as createComponentSchema, d as createComponentSchemaObject, e as exportSchemaToFile, f as fixSchemaReferences } from './schema-utils-CbCi6dEk.js';
2
2
  export { AddWarningFunction, GenerationWarning } from './types/warnings.js';
3
+ import { F as FontRegistryEntry, c as FontRuntimeOpts, R as ResolvedFontSource, b as ResolvedFont } from './types-kcQwhOlf.js';
4
+ export { D as DEFAULT_VISUAL_DPI, d as FontFamilyNameSchema, e as FontRegistryDefinition, f as FontRegistryEntrySchema, g as FontRegistrySchema, h as FontSource, i as FontSourceSchema, H as HighchartsHeaders, j as HighchartsHeadersResolver, k as HighchartsServiceConfig, M as MAX_RASTERIZE_BATCH_SLIDES, l as MAX_RASTERIZE_FONTS, m as MAX_RASTERIZE_FONT_BYTES, n as MAX_VISUAL_DPI, o as MIN_VISUAL_DPI, P as PptxBatchRasterizer, p as PptxRasterizeBatchRequest, q as PptxRasterizeBatchResult, r as PptxRasterizeBatchSlide, s as PptxRasterizeBatchSlideResult, t as PptxRasterizeFailureStage, u as PptxRasterizeRequest, v as PptxRasterizeResult, w as PptxRasterizer, x as PptxServiceConfig, y as PptxServiceHeaders, z as PptxServiceHeadersResolver, a as RasterizeFontFace, S as SAFE_FONTS, A as SafeFontName, B as ServicesConfig, C as clampVisualDpi, E as isSafeFont } from './types-kcQwhOlf.js';
3
5
  export { DEFAULT_ERROR_CONFIG, ERROR_EMOJIS, ErrorFormatterConfig, calculatePosition, clearComponentNamesCache, createErrorConfig, createJsonParseError, extractStandardComponentNames, formatErrorMessage, formatErrorSummary, getLiteralValue, getObjectSchemaPropertyNames, getSchemaMetadata, groupErrorsByPath, isLiteralSchema, isObjectSchema, isUnionSchema, transformValueError, transformValueErrors } from './validation/unified/index.js';
4
6
  export { T as TransformedError, V as ValidationError, a as ValidationResult } from './types-BWFZ7OaO.js';
5
7
  export { ComponentValidationError, ComponentValidationResult, ComponentVersion, ComponentVersionMap, CustomComponent, DuplicateComponentError, PluginValidationOptions, PluginValidationResult, RenderContext, RenderFunction, UnknownPreservedComponentError, createComponent, createVersion, getValidationSummary, isValidationSuccess, resolveComponentVersion, validateCustomComponentProps } from './plugin/index.js';
6
- import { F as FontRegistryEntry, a as FontRuntimeOpts, R as ResolvedFontSource, b as ResolvedFont } from './types-CL0Hbw6x.js';
7
- export { c as FontFamilyNameSchema, d as FontRegistryDefinition, e as FontRegistryEntrySchema, f as FontRegistrySchema, g as FontSource, h as FontSourceSchema, S as SAFE_FONTS, i as SafeFontName, j as isSafeFont } from './types-CL0Hbw6x.js';
8
8
  export { ParsedSemver, compareSemver, isValidSemver, latestVersion, parseSemver } from './utils/semver.js';
9
9
  import '@sinclair/typebox';
10
10
  import '@sinclair/typebox/value';
11
11
 
12
12
  /**
13
- * Service configuration types for external integrations (e.g. Highcharts export server)
14
- */
15
- /** Default raster resolution when a `visual` does not specify one. */
16
- declare const DEFAULT_VISUAL_DPI = 200;
17
- /** Minimum accepted raster resolution. */
18
- declare const MIN_VISUAL_DPI = 36;
19
- /** Maximum accepted raster resolution (bounds bitmap size / DoS surface). */
20
- declare const MAX_VISUAL_DPI = 600;
21
- /** Clamp an arbitrary dpi to [MIN_VISUAL_DPI, MAX_VISUAL_DPI]; non-finite → default. */
22
- declare function clampVisualDpi(dpi: unknown): number;
23
- type HighchartsHeaders = Record<string, string>;
24
- type HighchartsHeadersResolver = (body: unknown) => HighchartsHeaders | Promise<HighchartsHeaders>;
25
- interface HighchartsServiceConfig {
26
- serverUrl?: string;
27
- headers?: HighchartsHeaders | HighchartsHeadersResolver;
28
- }
29
- type PptxServiceHeaders = Record<string, string>;
30
- type PptxServiceHeadersResolver = (body: unknown) => PptxServiceHeaders | Promise<PptxServiceHeaders>;
31
- /**
32
- * Request handed to a pptx rasterizer: a single-slide pptx presentation
33
- * component definition plus the target resolution.
34
- */
35
- interface PptxRasterizeRequest {
36
- /** A pptx presentation component definition ({ name: 'pptx', ... }) with one slide */
37
- presentation: unknown;
38
- /** Target raster resolution in dots-per-inch */
39
- dpi: number;
40
- /**
41
- * Directory that relative asset paths inside the presentation resolve
42
- * against the originating document's own directory. Absent → the
43
- * rasterizer's cwd, the legacy behavior (#142).
44
- */
45
- baseDir?: string;
46
- }
47
- /**
48
- * Result returned by a pptx rasterizer.
49
- */
50
- interface PptxRasterizeResult {
51
- /** Rendered PNG as a base64 data URI (data:image/png;base64,...) */
52
- base64DataUri: string;
53
- /** Natural pixel width of the rendered image */
54
- width: number;
55
- /** Natural pixel height of the rendered image */
56
- height: number;
57
- }
58
- /**
59
- * In-process rasterizer callback. Implementations build the .pptx from the
60
- * presentation JSON and rasterize it to a PNG (e.g. via LibreOffice + poppler).
61
- */
62
- type PptxRasterizer = (request: PptxRasterizeRequest) => Promise<PptxRasterizeResult>;
63
- /**
64
- * Maximum slides accepted in one batch request. Shared by the HTTP surface
65
- * (request validation) and clients (chunk size) so the two cannot drift.
66
- * Bounds per-request work and response size the same way rate limits bound
67
- * request counts.
68
- */
69
- declare const MAX_RASTERIZE_BATCH_SLIDES = 32;
70
- /** One slide in a batch: a single-slide presentation plus its resolution. */
71
- interface PptxRasterizeBatchSlide {
72
- /** A pptx presentation component definition ({ name: 'pptx', ... }) with one slide */
73
- presentation: unknown;
74
- /** Target raster resolution in dots-per-inch (absent → service default) */
75
- dpi?: number;
76
- }
77
- /** Request handed to a batch pptx rasterizer. */
78
- interface PptxRasterizeBatchRequest {
79
- /** Slides to rasterize; results come back index-aligned with this array. */
80
- slides: PptxRasterizeBatchSlide[];
81
- /** Base directory for relative asset paths, shared by every slide (#142). */
82
- baseDir?: string;
83
- }
84
- /**
85
- * Pipeline stage a slide failed in. `build` failures are caused by the
86
- * slide's own JSON (safe to surface verbatim to callers); `convert` and
87
- * `rasterize` failures are environment/tooling errors whose raw messages may
88
- * carry host paths — HTTP surfaces sanitize those.
89
- */
90
- type PptxRasterizeFailureStage = 'build' | 'convert' | 'rasterize';
91
- /**
92
- * Per-slide outcome. A batch response is 200-with-item-errors rather than
93
- * all-or-nothing: one bad visual must not discard its siblings' pixels.
13
+ * Canonical `if/then` restructuring for name-discriminated component unions.
14
+ *
15
+ * The generators export component unions as a flat `anyOf`. Schema-driven
16
+ * editors (Monaco, VS Code — vscode-json-languageservice) resolve a partially
17
+ * typed node against an `anyOf` by picking the single best-matching branch:
18
+ * while typing `{ "name": | }`, every branch requiring `props` fails
19
+ * validation, so its name const never reached autocomplete, and diagnostics
20
+ * reported one arbitrary branch's complaints ("Value must be \"heading\"",
21
+ * "Missing property \"props\"") instead of the real problem.
22
+ *
23
+ * This transform rewrites each such union — at JSON-Schema export time only,
24
+ * the runtime TypeBox validators are untouched — into the standard
25
+ * discriminated-union dispatch:
26
+ *
27
+ * {
28
+ * type: "object",
29
+ * required: ["name"],
30
+ * properties: { name: { anyOf: [{ const, description }, …] } },
31
+ * allOf: [
32
+ * { if: { properties: { name: { const } }, required: ["name"] },
33
+ * then: <branch> },
34
+ * …
35
+ * ]
36
+ * }
37
+ *
38
+ * The accepted set of documents is exactly the same — `properties.name` is
39
+ * the enum the branches already imply, and each `then` is the original
40
+ * branch — but editors now behave deterministically:
41
+ * - completing `name` offers every component, with its description
42
+ * - an empty object reports only `Missing property "name"`
43
+ * - a wrong name reports only `Value is not accepted. Valid values: …`
44
+ * - a valid name activates exactly its branch for keys, props and errors
45
+ *
46
+ * Standard draft-07 keywords only, so ajv and every schema-aware editor
47
+ * agree. Versioned plugin branches share a name; they stay grouped in a
48
+ * small `anyOf` inside their `then`, containing best-match ambiguity to the
49
+ * component's own versions.
94
50
  */
95
- type PptxRasterizeBatchSlideResult = ({
96
- ok: true;
97
- } & PptxRasterizeResult) | {
98
- ok: false;
99
- error: string;
100
- stage?: PptxRasterizeFailureStage;
101
- };
102
- /** Result returned by a batch pptx rasterizer. */
103
- interface PptxRasterizeBatchResult {
104
- /** Index-aligned with the request's `slides` (same length, same order). */
105
- results: PptxRasterizeBatchSlideResult[];
51
+ interface SchemaNode {
52
+ [key: string]: unknown;
106
53
  }
107
54
  /**
108
- * In-process batch rasterizer callback. Batch-level failures (missing
109
- * binaries, bad request) throw; per-slide failures land in `results`.
110
- */
111
- type PptxBatchRasterizer = (request: PptxRasterizeBatchRequest) => Promise<PptxRasterizeBatchResult>;
112
- /**
113
- * Configuration for the pptx rasterization service backing `visual` components.
55
+ * Walk a JSON Schema and restructure every `anyOf` union whose branches are
56
+ * all name-discriminated objects into the `if/then` dispatch shape above.
114
57
  *
115
- * Mirrors {@link HighchartsServiceConfig}: the published packages depend on this
116
- * interface, never on a binary. A host injects either an in-process `render`
117
- * callback or an HTTP `serverUrl`.
118
- */
119
- interface PptxServiceConfig {
120
- /**
121
- * In-process rasterizer. Takes precedence over `serverUrl` when provided.
122
- * Ideal for tests (no binaries) and single-process hosts.
123
- */
124
- render?: PptxRasterizer;
125
- /**
126
- * In-process batch rasterizer. When provided, the docx renderer coalesces a
127
- * document's visuals into batch calls (#153) instead of one `render` call
128
- * per visual. Like `render`, takes precedence over `serverUrl`.
129
- */
130
- renderBatch?: PptxBatchRasterizer;
131
- /**
132
- * HTTP rasterization service URL. The service receives
133
- * `{ presentation, dpi }` and returns a {@link PptxRasterizeResult}.
134
- */
135
- serverUrl?: string;
136
- /** Optional headers (or async resolver) for the HTTP service. */
137
- headers?: PptxServiceHeaders | PptxServiceHeadersResolver;
138
- /** Default DPI applied when a `visual` does not specify one. */
139
- dpi?: number;
140
- }
141
- interface ServicesConfig {
142
- highcharts?: HighchartsServiceConfig;
143
- pptx?: PptxServiceConfig;
144
- }
58
+ * Mutates in place. Conservative by design a union is only restructured
59
+ * when the rewrite is provably equivalent:
60
+ * - every branch is an object with a `name` const that lists `name` as
61
+ * required (unions containing `$ref` or free-form branches are left alone;
62
+ * a `$ref`'s target union is restructured where it is defined)
63
+ * - the node declares no `properties`, `allOf`, `if`, `required`,
64
+ * `additionalProperties` or `type` of its own that the rewrite would have
65
+ * to merge with
66
+ * - at least two distinct names; single-name unions (a versioned plugin's
67
+ * variants) validate and complete fine as a plain anyOf
68
+ */
69
+ declare function restructureNameDiscriminatedUnions(schema: unknown): void;
70
+ /**
71
+ * Iterate the component branches of an exported union, whichever shape it is
72
+ * in — the flat `anyOf` the generators emit, or the `if/then` dispatch this
73
+ * module rewrites it into. For consumers that post-process branch objects
74
+ * (description enhancement, theme-name injection, …).
75
+ */
76
+ declare function unionBranches(schema: unknown): SchemaNode[];
145
77
 
146
78
  /** Scan an arbitrary doc tree (DOCX or PPTX) for every font family referenced. */
147
79
  declare function collectFontNames(doc: unknown): Set<string>;
@@ -150,6 +82,34 @@ declare const collectFontNamesFromDocx: typeof collectFontNames;
150
82
  /** Scan a PPTX presentation tree for every font family name referenced. */
151
83
  declare const collectFontNamesFromPptx: typeof collectFontNames;
152
84
 
85
+ /**
86
+ * Read the document-scoped and theme-scoped font registries and merge them
87
+ * with runtime `fonts.extraEntries`.
88
+ *
89
+ * Precedence (last wins, matching registry.ts's documented resolution rules
90
+ * and FontRuntimeOpts.extraEntries's "merged over the document's
91
+ * fontRegistry"):
92
+ *
93
+ * theme.fontRegistry < document.props.fontRegistry < fonts.extraEntries
94
+ *
95
+ * Merging happens here rather than inside FontRegistry because
96
+ * `validateFontReferences` needs the same merged list, and two merge sites
97
+ * would eventually disagree — which would show up as a font that validates
98
+ * but never renders, or vice versa.
99
+ */
100
+
101
+ /** `document.props.fontRegistry`, defensively (props may be absent/null). */
102
+ declare function documentFontRegistry(document: unknown): FontRegistryEntry[];
103
+ /** `theme.fontRegistry`, defensively. */
104
+ declare function themeFontRegistry(theme: unknown): FontRegistryEntry[];
105
+ /**
106
+ * Merge entry groups in precedence order — later groups win on a collision of
107
+ * `family` OR `id`, case-insensitively, which are the same two keys
108
+ * `FontRegistry.addEntry` indexes on. Returns a flat list safe to hand to both
109
+ * `validateFontReferences` and `new FontRegistry({ opts: { extraEntries } })`.
110
+ */
111
+ declare function mergeFontRegistries(...groups: (FontRegistryEntry[] | undefined)[]): FontRegistryEntry[];
112
+
153
113
  /**
154
114
  * Validate that every font name referenced in a document is either
155
115
  * in SAFE_FONTS or present in the document's fontRegistry / runtime overrides.
@@ -263,6 +223,21 @@ declare function synthesizeFamilyName(family: string, weight: number | undefined
263
223
  */
264
224
  declare function rewriteFontFamilyName(input: Buffer, newFamily: string): Buffer;
265
225
 
226
+ /**
227
+ * Hostname allowlist for font fetchers.
228
+ *
229
+ * `url-fetcher` and `variable-fetcher` can be handed arbitrary URLs via
230
+ * `FontRegistryEntry.sources`, which may originate from document JSON. Without
231
+ * a guard, a malicious doc could point fetchers at internal hosts (SSRF), the
232
+ * filesystem (`file://`), or the IMDS endpoint. Limit downloads to the hosts
233
+ * our catalog + UPSTREAM_OVERRIDES actually target.
234
+ *
235
+ * Keep the list small and HTTPS-only. Expansions should be deliberate code
236
+ * reviews, not config-driven — the cost of a new domain is the code change.
237
+ */
238
+ declare const FONT_URL_ALLOWLIST: readonly string[];
239
+ declare function isAllowedFontUrl(url: string): boolean;
240
+
266
241
  /**
267
242
  * FontRegistry — merges catalog + document registry + runtime entries
268
243
  * and materializes referenced fonts into ResolvedFont records.
@@ -367,7 +342,7 @@ declare function detectFontFormat(buf: Buffer): ResolvedFontSource['format'];
367
342
  * Curated list of popular Google Fonts for picker autocomplete.
368
343
  *
369
344
  * Not exhaustive — the full Google Fonts library has ~1500 families.
370
- * This is ~30 names known to cover most real-world use cases.
345
+ * This is ~37 names known to cover most real-world use cases.
371
346
  */
372
347
  interface PopularGoogleFont {
373
348
  family: string;
@@ -512,6 +487,10 @@ interface ApplyFontSubstitutionResult<T> {
512
487
  * Returns a new tree (structural clone) plus the list of `(from, to)`
513
488
  * swaps made, deduped by source name.
514
489
  *
490
+ * One deliberate exception to the clone: `fontRegistry` subtrees are carried
491
+ * through by reference, since they declare fonts rather than reference them
492
+ * and nothing downstream mutates them.
493
+ *
515
494
  * Families already in SAFE_FONTS are never rewritten (even if a mapping
516
495
  * entry targets them as a key — safe fonts don't need substitution).
517
496
  * Families with no mapping entry are left untouched — callers should
@@ -628,4 +607,4 @@ declare const DEFAULT_CHART_THEME_COLORS: string[];
628
607
  */
629
608
  declare function mergeWithDefaults<T>(userConfig: T, themeDefaults: Partial<T>): T;
630
609
 
631
- export { DEFAULT_CHART_THEME_COLORS, DEFAULT_VISUAL_DPI, type FontIssueCode, FontRegistry, FontRegistryEntry, type FontRegistryInput, type FontResolutionIssue, FontRuntimeOpts, type FontSubstitution, type FontValidationInput, type FontValidationResult, type HighchartsHeaders, type HighchartsHeadersResolver, type HighchartsServiceConfig, MAX_RASTERIZE_BATCH_SLIDES, MAX_VISUAL_DPI, MIN_VISUAL_DPI, POPULAR_GOOGLE_FONTS, type PopularGoogleFont, type PptxBatchRasterizer, type PptxRasterizeBatchRequest, type PptxRasterizeBatchResult, type PptxRasterizeBatchSlide, type PptxRasterizeBatchSlideResult, type PptxRasterizeFailureStage, type PptxRasterizeRequest, type PptxRasterizeResult, type PptxRasterizer, type PptxServiceConfig, type PptxServiceHeaders, type PptxServiceHeadersResolver, ResolvedFont, ResolvedFontSource, type ServicesConfig, type SynthesizedFamily, UPSTREAM_OVERRIDES, type UpstreamOverride, type UpstreamVariant, WEIGHT_LABELS, applyExportMode, applyFontSubstitution, buildDefaultSubstitutionMap, clampVisualDpi, collectFontNamesFromDocx, collectFontNamesFromPptx, defaultSubstituteFor, detectFontFormat, fetchGoogleFontSources, getUpstreamOverride, mergeWithDefaults, rewriteFontFamilyName, scopedThemeName, synthesizeFamilyName, validateFontReferences };
610
+ export { DEFAULT_CHART_THEME_COLORS, FONT_URL_ALLOWLIST, type FontIssueCode, FontRegistry, FontRegistryEntry, type FontRegistryInput, type FontResolutionIssue, FontRuntimeOpts, type FontSubstitution, type FontValidationInput, type FontValidationResult, POPULAR_GOOGLE_FONTS, type PopularGoogleFont, ResolvedFont, ResolvedFontSource, type SynthesizedFamily, UPSTREAM_OVERRIDES, type UpstreamOverride, type UpstreamVariant, WEIGHT_LABELS, applyExportMode, applyFontSubstitution, buildDefaultSubstitutionMap, collectFontNamesFromDocx, collectFontNamesFromPptx, defaultSubstituteFor, detectFontFormat, documentFontRegistry, fetchGoogleFontSources, getUpstreamOverride, isAllowedFontUrl, mergeFontRegistries, mergeWithDefaults, restructureNameDiscriminatedUnions, rewriteFontFamilyName, scopedThemeName, synthesizeFamilyName, themeFontRegistry, unionBranches, validateFontReferences };
package/dist/index.js CHANGED
@@ -1,14 +1,17 @@
1
1
  import {
2
+ FONT_URL_ALLOWLIST,
2
3
  detectFontFormat,
3
4
  isAllowedFontUrl
4
- } from "./chunk-CP2I5NPP.js";
5
+ } from "./chunk-FDSJYZ5W.js";
5
6
  import {
6
7
  convertToJsonSchema,
7
8
  createComponentSchema,
8
9
  createComponentSchemaObject,
9
10
  exportSchemaToFile,
10
- fixSchemaReferences
11
- } from "./chunk-5J43F4XD.js";
11
+ fixSchemaReferences,
12
+ restructureNameDiscriminatedUnions,
13
+ unionBranches
14
+ } from "./chunk-KLWNDWC4.js";
12
15
  import {
13
16
  FontFamilyNameSchema,
14
17
  FontRegistryEntrySchema,
@@ -64,6 +67,8 @@ function clampVisualDpi(dpi) {
64
67
  return DEFAULT_VISUAL_DPI;
65
68
  return Math.min(MAX_VISUAL_DPI, Math.max(MIN_VISUAL_DPI, Math.round(dpi)));
66
69
  }
70
+ var MAX_RASTERIZE_FONTS = 32;
71
+ var MAX_RASTERIZE_FONT_BYTES = 8 * 1024 * 1024;
67
72
  var MAX_RASTERIZE_BATCH_SLIDES = 32;
68
73
 
69
74
  // src/fonts/collect.ts
@@ -77,6 +82,7 @@ var FONT_NAME_KEYS = /* @__PURE__ */ new Set([
77
82
  "valAxisLabelFontFace"
78
83
  ]);
79
84
  var THEME_FONT_KEYS = /* @__PURE__ */ new Set(["heading", "body", "mono", "light"]);
85
+ var FONT_DECLARATION_KEYS = /* @__PURE__ */ new Set(["fontRegistry"]);
80
86
  function collect(node, out, parentKey) {
81
87
  if (node == null) return;
82
88
  if (typeof node === "string") {
@@ -109,6 +115,7 @@ function collect(node, out, parentKey) {
109
115
  }
110
116
  }
111
117
  for (const [k, v] of Object.entries(node)) {
118
+ if (FONT_DECLARATION_KEYS.has(k)) continue;
112
119
  collect(v, out, k);
113
120
  }
114
121
  }
@@ -121,6 +128,41 @@ function collectFontNames(doc) {
121
128
  var collectFontNamesFromDocx = collectFontNames;
122
129
  var collectFontNamesFromPptx = collectFontNames;
123
130
 
131
+ // src/fonts/document-registry.ts
132
+ function isEntry(v) {
133
+ if (!v || typeof v !== "object") return false;
134
+ const e = v;
135
+ return typeof e.id === "string" && typeof e.family === "string" && Array.isArray(e.sources);
136
+ }
137
+ function readAt(node, key) {
138
+ if (!node || typeof node !== "object") return [];
139
+ const raw = node[key];
140
+ return Array.isArray(raw) ? raw.filter(isEntry) : [];
141
+ }
142
+ function documentFontRegistry(document) {
143
+ if (!document || typeof document !== "object") return [];
144
+ return readAt(document.props, "fontRegistry");
145
+ }
146
+ function themeFontRegistry(theme) {
147
+ return readAt(theme, "fontRegistry");
148
+ }
149
+ function mergeFontRegistries(...groups) {
150
+ const out = [];
151
+ for (const group of groups) {
152
+ for (const entry of group ?? []) {
153
+ const family = entry.family.toLowerCase();
154
+ const id = entry.id.toLowerCase();
155
+ for (let i = out.length - 1; i >= 0; i--) {
156
+ if (out[i].family.toLowerCase() === family && out[i].id.toLowerCase() === id) {
157
+ out.splice(i, 1);
158
+ }
159
+ }
160
+ out.push(entry);
161
+ }
162
+ }
163
+ return out;
164
+ }
165
+
124
166
  // src/fonts/validator.ts
125
167
  function buildRegistryIndex(registeredEntries) {
126
168
  const idx = /* @__PURE__ */ new Set();
@@ -1042,6 +1084,24 @@ var POPULAR_GOOGLE_FONTS = [
1042
1084
  weights: [100, 200, 300, 400, 500, 600, 700],
1043
1085
  hasItalic: true
1044
1086
  },
1087
+ {
1088
+ family: "Archivo",
1089
+ category: "sans",
1090
+ weights: [100, 200, 300, 400, 500, 600, 700, 800, 900],
1091
+ hasItalic: true
1092
+ },
1093
+ {
1094
+ family: "Geist",
1095
+ category: "sans",
1096
+ weights: [100, 200, 300, 400, 500, 600, 700, 800, 900],
1097
+ hasItalic: true
1098
+ },
1099
+ {
1100
+ family: "Space Grotesk",
1101
+ category: "sans",
1102
+ weights: [300, 400, 500, 600, 700],
1103
+ hasItalic: false
1104
+ },
1045
1105
  // Serif
1046
1106
  {
1047
1107
  family: "Playfair Display",
@@ -1116,6 +1176,12 @@ var POPULAR_GOOGLE_FONTS = [
1116
1176
  weights: [400, 700],
1117
1177
  hasItalic: true
1118
1178
  },
1179
+ {
1180
+ family: "Geist Mono",
1181
+ category: "mono",
1182
+ weights: [100, 200, 300, 400, 500, 600, 700, 800, 900],
1183
+ hasItalic: true
1184
+ },
1119
1185
  // Display
1120
1186
  {
1121
1187
  family: "Bebas Neue",
@@ -1207,6 +1273,10 @@ function rewrite(node, mapping, seen, parentKey) {
1207
1273
  if (typeof node === "object") {
1208
1274
  const out = {};
1209
1275
  for (const [k, v] of Object.entries(node)) {
1276
+ if (FONT_DECLARATION_KEYS.has(k)) {
1277
+ out[k] = v;
1278
+ continue;
1279
+ }
1210
1280
  if (parentKey === "theme" && k === "fonts" && v && typeof v === "object") {
1211
1281
  const nextFonts = {};
1212
1282
  for (const [fk, fv] of Object.entries(v)) {
@@ -1249,6 +1319,9 @@ var EXPLICIT_OVERRIDES = {
1249
1319
  "Source Sans 3": "Calibri",
1250
1320
  "Source Sans Pro": "Calibri",
1251
1321
  "IBM Plex Sans": "Calibri",
1322
+ Archivo: "Calibri",
1323
+ Geist: "Calibri",
1324
+ "Space Grotesk": "Calibri",
1252
1325
  "Work Sans": "Calibri",
1253
1326
  Manrope: "Calibri",
1254
1327
  Nunito: "Calibri",
@@ -1268,7 +1341,8 @@ var EXPLICIT_OVERRIDES = {
1268
1341
  "Fira Code": "Consolas",
1269
1342
  "IBM Plex Mono": "Consolas",
1270
1343
  "Source Code Pro": "Consolas",
1271
- "Roboto Mono": "Consolas"
1344
+ "Roboto Mono": "Consolas",
1345
+ "Geist Mono": "Consolas"
1272
1346
  };
1273
1347
  var CATEGORY_FALLBACK = {
1274
1348
  sans: "Calibri",
@@ -1398,12 +1472,15 @@ export {
1398
1472
  DEFAULT_VISUAL_DPI,
1399
1473
  DuplicateComponentError,
1400
1474
  ERROR_EMOJIS,
1475
+ FONT_URL_ALLOWLIST,
1401
1476
  FontFamilyNameSchema,
1402
1477
  FontRegistry,
1403
1478
  FontRegistryEntrySchema,
1404
1479
  FontRegistrySchema,
1405
1480
  FontSourceSchema,
1406
1481
  MAX_RASTERIZE_BATCH_SLIDES,
1482
+ MAX_RASTERIZE_FONTS,
1483
+ MAX_RASTERIZE_FONT_BYTES,
1407
1484
  MAX_VISUAL_DPI,
1408
1485
  MIN_VISUAL_DPI,
1409
1486
  POPULAR_GOOGLE_FONTS,
@@ -1429,6 +1506,7 @@ export {
1429
1506
  createVersion,
1430
1507
  defaultSubstituteFor,
1431
1508
  detectFontFormat,
1509
+ documentFontRegistry,
1432
1510
  exportSchemaToFile,
1433
1511
  extractStandardComponentNames,
1434
1512
  fetchGoogleFontSources,
@@ -1441,6 +1519,7 @@ export {
1441
1519
  getUpstreamOverride,
1442
1520
  getValidationSummary,
1443
1521
  groupErrorsByPath,
1522
+ isAllowedFontUrl,
1444
1523
  isLiteralSchema,
1445
1524
  isObjectSchema,
1446
1525
  isSafeFont,
@@ -1448,14 +1527,18 @@ export {
1448
1527
  isValidSemver,
1449
1528
  isValidationSuccess,
1450
1529
  latestVersion,
1530
+ mergeFontRegistries,
1451
1531
  mergeWithDefaults,
1452
1532
  parseSemver,
1453
1533
  resolveComponentVersion,
1534
+ restructureNameDiscriminatedUnions,
1454
1535
  rewriteFontFamilyName,
1455
1536
  scopedThemeName,
1456
1537
  synthesizeFamilyName,
1538
+ themeFontRegistry,
1457
1539
  transformValueError,
1458
1540
  transformValueErrors,
1541
+ unionBranches,
1459
1542
  validateCustomComponentProps,
1460
1543
  validateFontReferences
1461
1544
  };