@openpresentation/opf 0.10.0 → 0.11.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.
Files changed (85) hide show
  1. package/dist/{catalogs-HCTav5Wv.d.ts → catalogs-atkOF4Vy.d.ts} +7 -7
  2. package/dist/catalogs.d.ts +2 -2
  3. package/dist/catalogs.js +1 -1
  4. package/dist/{chunk-TWMRZ43O.js → chunk-6FU2KICU.js} +365 -327
  5. package/dist/{chunk-GCB6LGJM.js → chunk-CHKJ4QHQ.js} +225 -73
  6. package/dist/{chunk-NPOKUFEX.js → chunk-EQHZ3ZO4.js} +3 -3
  7. package/dist/{chunk-BAWLYSUN.js → chunk-FTWNWFIV.js} +180 -6
  8. package/dist/{chunk-TK3QHM3U.js → chunk-FWA5XB45.js} +54 -21
  9. package/dist/{chunk-GQSK3T7X.js → chunk-GN52EE3P.js} +146 -16
  10. package/dist/{chunk-OZULJBSG.js → chunk-RS5GZ5RW.js} +14 -0
  11. package/dist/composition-Tv9Wm3Oh.d.ts +691 -0
  12. package/dist/composition.d.ts +1 -624
  13. package/dist/composition.js +1 -1
  14. package/dist/docs.js +59 -11
  15. package/dist/examples.d.ts +1 -1
  16. package/dist/index.d.ts +65 -4
  17. package/dist/index.js +205 -7
  18. package/dist/lint.d.ts +3 -3
  19. package/dist/lint.js +5 -5
  20. package/dist/pagination.d.ts +4 -2
  21. package/dist/pagination.js +5 -5
  22. package/dist/{presentation-BMTdX6O1.d.ts → presentation-Ct42Mitb.d.ts} +51 -8
  23. package/dist/repo-readme.js +1 -1
  24. package/dist/{schemas-BYe5y8-i.d.ts → schemas-CiVmUT2p.d.ts} +6 -0
  25. package/dist/schemas.d.ts +1 -1
  26. package/dist/schemas.js +1 -1
  27. package/dist/spec/catalogs/layouts/extract/canonical.json +45 -21
  28. package/dist/spec/catalogs/layouts/index.json +10 -0
  29. package/dist/spec/catalogs/layouts/number-1x.json +1 -1
  30. package/dist/spec/catalogs/layouts/number-2x.json +2 -2
  31. package/dist/spec/catalogs/layouts/number-3x.json +3 -3
  32. package/dist/spec/catalogs/layouts/number-4x.json +4 -4
  33. package/dist/spec/catalogs/layouts/number-5x.json +5 -5
  34. package/dist/spec/catalogs/layouts/number-6x.json +6 -6
  35. package/dist/spec/catalogs/layouts/quote-1x.json +13 -0
  36. package/dist/spec/catalogs/layouts/timeline-1x.json +13 -0
  37. package/dist/spec/catalogs/narratives/board-meeting.json +21 -21
  38. package/dist/spec/catalogs/narratives/business-narrative.json +8 -8
  39. package/dist/spec/catalogs/narratives/business-review.json +12 -12
  40. package/dist/spec/catalogs/narratives/capacity-planning.json +8 -8
  41. package/dist/spec/catalogs/narratives/challenge-resolution.json +7 -7
  42. package/dist/spec/catalogs/narratives/classic-story.json +7 -7
  43. package/dist/spec/catalogs/narratives/company-intro.json +9 -9
  44. package/dist/spec/catalogs/narratives/conference-talk.json +1 -1
  45. package/dist/spec/catalogs/narratives/early-startup-pitch.json +12 -12
  46. package/dist/spec/catalogs/narratives/educate.json +9 -9
  47. package/dist/spec/catalogs/narratives/employee-review.json +8 -8
  48. package/dist/spec/catalogs/narratives/failure-analysis.json +10 -10
  49. package/dist/spec/catalogs/narratives/focus.json +12 -12
  50. package/dist/spec/catalogs/narratives/golden-circle.json +1 -1
  51. package/dist/spec/catalogs/narratives/innovation.json +9 -9
  52. package/dist/spec/catalogs/narratives/justice.json +11 -11
  53. package/dist/spec/catalogs/narratives/marketing-strategy.json +11 -11
  54. package/dist/spec/catalogs/narratives/performance-improvement-plan.json +8 -8
  55. package/dist/spec/catalogs/narratives/performance-review.json +11 -11
  56. package/dist/spec/catalogs/narratives/persuade.json +7 -7
  57. package/dist/spec/catalogs/narratives/persuasive-sales.json +8 -8
  58. package/dist/spec/catalogs/narratives/pitch-deck.json +3 -3
  59. package/dist/spec/catalogs/narratives/problem-solution.json +2 -2
  60. package/dist/spec/catalogs/narratives/product-launch.json +10 -10
  61. package/dist/spec/catalogs/narratives/project-proposal.json +10 -10
  62. package/dist/spec/catalogs/narratives/qbr.json +3 -3
  63. package/dist/spec/catalogs/narratives/rags-to-riches.json +7 -7
  64. package/dist/spec/catalogs/narratives/reveal.json +8 -8
  65. package/dist/spec/catalogs/narratives/scqa.json +1 -1
  66. package/dist/spec/catalogs/narratives/status-update.json +6 -6
  67. package/dist/spec/catalogs/narratives/strategic-advisory.json +7 -7
  68. package/dist/spec/catalogs/narratives/strategic-narrative.json +1 -1
  69. package/dist/spec/catalogs/narratives/survey-analysis.json +10 -10
  70. package/dist/spec/catalogs/narratives/survival-story.json +10 -10
  71. package/dist/spec/catalogs/narratives/transformation-arc.json +1 -1
  72. package/dist/spec/catalogs/narratives/trend-analysis.json +7 -7
  73. package/dist/spec/catalogs/narratives/underdog-victory.json +8 -8
  74. package/dist/spec/catalogs/narratives/venture-pitch.json +12 -12
  75. package/dist/spec/catalogs/narratives/weekly-progress.json +10 -10
  76. package/dist/spec/openapi.yaml +5 -0
  77. package/dist/spec/schemas/layout.schema.json +12 -3
  78. package/dist/spec/schemas/narrative.schema.json +1 -1
  79. package/dist/spec/schemas/opf.schema.json +83 -12
  80. package/dist/spec-files.d.ts +1 -1
  81. package/dist/spec-files.js +1 -1
  82. package/dist/types.d.ts +3 -3
  83. package/dist/validator.d.ts +7 -4
  84. package/dist/validator.js +4 -4
  85. package/package.json +1 -1
@@ -0,0 +1,691 @@
1
+ /** Canonical table grid. No renderer, fonts, DOM or network dependencies. */
2
+ interface TableBorder {
3
+ color: string;
4
+ width: number;
5
+ dash?: 'solid' | 'dash' | 'dot';
6
+ }
7
+ interface TableCellStyle {
8
+ fill?: string;
9
+ color?: string;
10
+ align?: 'left' | 'center' | 'right';
11
+ verticalAlign?: 'top' | 'middle' | 'bottom';
12
+ padding?: Partial<Record<'top' | 'right' | 'bottom' | 'left', number>>;
13
+ borders?: Partial<Record<'top' | 'right' | 'bottom' | 'left', TableBorder>>;
14
+ }
15
+ interface TableGridCell {
16
+ input: unknown;
17
+ value: unknown;
18
+ style: TableCellStyle;
19
+ row: number;
20
+ column: number;
21
+ rowSpan: number;
22
+ colSpan: number;
23
+ header: boolean;
24
+ path: string;
25
+ valuePath: string;
26
+ }
27
+ interface TableGridIssue {
28
+ path: string;
29
+ message: string;
30
+ }
31
+ interface TableGrid {
32
+ rows: TableGridCell[][];
33
+ columnCount: number;
34
+ rowCount: number;
35
+ hasHeaders: boolean;
36
+ /** Anchor at each covered position; covered positions are not additional cells. */
37
+ owners: (TableGridCell | undefined)[][];
38
+ issues: TableGridIssue[];
39
+ }
40
+ declare function tableGrid(value: unknown, path?: string): TableGrid;
41
+ /** Row boundaries that preserve every vertical merge, used by pagination. */
42
+ declare function tableRowBoundaries(value: unknown): number[];
43
+
44
+ /** Normalize a literal hex color to uppercase #RRGGBB. */
45
+ declare function normalizeHexColor(value: unknown): string | undefined;
46
+ type ResolveColorRefRoles = Partial<Record<'primary' | 'secondary' | 'accent' | 'background' | 'surface' | 'text' | 'textSecondary', string>>;
47
+ interface ResolveColorRefOptions {
48
+ /** Effective color scheme after design resolution (OOXML slots plus optional role hex overrides). */
49
+ colorScheme: Record<string, unknown>;
50
+ /** Optional resolved chrome colors (e.g. renderer `design.colors` with `textSecondary` mapped to `mutedText`). */
51
+ roles?: ResolveColorRefRoles;
52
+ /** Top-level presentation `variables` map. */
53
+ variables?: Record<string, unknown>;
54
+ /** Theme text color returned when a reference cannot be resolved. */
55
+ fallback: string;
56
+ }
57
+ /** Resolve a ColorRef or TextRun.color string to a literal hex color. */
58
+ declare function resolveColorRef(reference: string, options: ResolveColorRefOptions): string;
59
+ declare function colorContrast(foreground: string, background: string): number | undefined;
60
+ /** Keep an inherited text color at >=4.5:1; otherwise select black or white.
61
+ * Callers must preserve explicit text-color overrides before using this fallback.
62
+ * An unresolved/translucent fill preserves the preferred color, without a contrast claim.
63
+ */
64
+ declare function textColorForFill(fill: string, preferred: string): string;
65
+ /** Keep an inherited chart mark at >=3:1 against its opaque panel. Otherwise
66
+ * mix toward black or white in bounded 1/255 steps, choosing the first passing
67
+ * step (higher contrast breaks a tie). This retains a recognizable palette;
68
+ * it does not establish distinction between adjacent series or colorblind safety.
69
+ * Explicit mark overrides belong to the caller; unresolved alpha is preserved.
70
+ */
71
+ declare function chartColorForFill(fill: string, preferred: string): string;
72
+
73
+ /** Portable layout geometry. No fonts, DOM, renderer, or network dependencies. */
74
+ interface Composition {
75
+ mode?: "auto" | "grid" | "row" | "column";
76
+ columns?: number;
77
+ gap?: number;
78
+ padding?: number;
79
+ weights?: number[];
80
+ minFontSize?: number;
81
+ overflow?: "warn" | "error";
82
+ }
83
+ declare const MAX_COMPOSITION_DEPTH = 32;
84
+ interface LayoutBox {
85
+ x: number;
86
+ y: number;
87
+ width: number;
88
+ height: number;
89
+ }
90
+ interface LayoutDiagnostic {
91
+ code: "text-overflow" | "small-cell" | "unresolved-content";
92
+ path: string;
93
+ message: string;
94
+ }
95
+ /** Physical legacy-family selection supplied by a font provider, independently of its numeric weight. */
96
+ interface FontFaceSelection {
97
+ family: string;
98
+ bold: boolean;
99
+ italic: boolean;
100
+ }
101
+ interface TextStyle {
102
+ fontFamily: string;
103
+ fontWeight: number;
104
+ italic?: boolean;
105
+ path?: string;
106
+ fontFace?: FontFaceSelection;
107
+ }
108
+ interface FontFamilies {
109
+ heading: string;
110
+ body: string;
111
+ code: string;
112
+ }
113
+ declare function resolveFontFamilies(input: unknown): FontFamilies;
114
+ interface TextMeasurement {
115
+ measure: (text: string, fontSize: number, style: TextStyle) => number;
116
+ resolveStyle?: (style: TextStyle) => TextStyle;
117
+ /** Shaped vector ink relative to the left baseline origin (positive y down).
118
+ * Null means no outline. These are not hinted/antialiased raster bounds. */
119
+ outlineBounds?: (text: string, fontSize: number, style: TextStyle) => LayoutBox | null;
120
+ }
121
+ type MeasureTextWidth = (text: string, fontSize: number) => number;
122
+ declare function resolveTextStyle(style: TextStyle, measurement?: TextMeasurement): TextStyle;
123
+ declare function textWidthMeasurer(style: TextStyle, measurement?: TextMeasurement): MeasureTextWidth;
124
+ /** Validate an optional host outline measurement without inventing raster coverage. */
125
+ declare function measureTextOutline(text: string, fontSize: number, style: TextStyle, measurement?: TextMeasurement): LayoutBox | null | undefined;
126
+ interface TextLineInk {
127
+ width: number;
128
+ y: number;
129
+ baseline: number;
130
+ height: number;
131
+ outline: LayoutBox | null;
132
+ }
133
+ interface TextPlacementLine {
134
+ x: number;
135
+ y: number;
136
+ baseline: number;
137
+ height: number;
138
+ width: number;
139
+ outline: LayoutBox | null;
140
+ }
141
+ interface TextPlacement {
142
+ alignment: 'left' | 'center' | 'right';
143
+ /** Reference-pixel clearance around vector outlines; not a universal raster guarantee. */
144
+ rasterPadding: number;
145
+ lines: TextPlacementLine[];
146
+ height: number;
147
+ overflow: boolean;
148
+ }
149
+ interface TextFit {
150
+ lines: string[];
151
+ fontSize: number;
152
+ lineHeight: number;
153
+ overflow: boolean;
154
+ placement?: TextPlacement;
155
+ }
156
+ /** Place complete measured lines, preserving alignment where it leaves room for ink.
157
+ * Move following baselines together when outlines need more vertical separation. */
158
+ declare function placeTextLines(lines: readonly TextLineInk[], box: LayoutBox, alignment?: TextPlacement['alignment'], rasterPadding?: number): TextPlacement;
159
+ interface ComposedItem {
160
+ path: string;
161
+ field: string;
162
+ type: string;
163
+ value: unknown;
164
+ payload: Record<string, unknown>;
165
+ box: LayoutBox;
166
+ /** Optional visible card allocation; box and all accepted internals occupy its padded interior. */
167
+ frameBox?: LayoutBox;
168
+ text?: TextFit | RichTextFit | ListFit | CodeTextFit;
169
+ textStyle?: TextStyle;
170
+ /** Complete accepted quote internals; consumers must reuse these fits and styles. */
171
+ quoteLayout?: QuoteLayout;
172
+ /** Complete accepted code internals, including source lines and literal tab positions. */
173
+ codeLayout?: CodeLayout;
174
+ /** Complete shared metric geometry, including its unit, label and metadata. */
175
+ metricLayout?: MetricLayout;
176
+ /** Complete timeline fields, markers and connector accepted by composition. */
177
+ timelineLayout?: TimelineLayout;
178
+ /** Effective container settings, including inherited readability constraints. */
179
+ composition: Composition;
180
+ }
181
+ interface ComposedGroup {
182
+ path: string;
183
+ box: LayoutBox;
184
+ contentBox: LayoutBox;
185
+ composition: Composition;
186
+ }
187
+ interface CompositionTrack {
188
+ offset: number;
189
+ size: number;
190
+ }
191
+ /** Resolved flow geometry, including empty reserved slots. Promoted regions are not flows. */
192
+ interface ComposedFlow {
193
+ path: string;
194
+ box: LayoutBox;
195
+ composition: Composition;
196
+ columns: CompositionTrack[];
197
+ rows: CompositionTrack[];
198
+ gap: number;
199
+ itemCount: number;
200
+ slotCount: number;
201
+ }
202
+ /** Additive penalties in grid-score-v9; lower is preferred. These are not quality percentages. */
203
+ interface CompositionPenalties {
204
+ cellProportions: number;
205
+ fontReduction: number;
206
+ textOverflow: number;
207
+ tableOverflow: number;
208
+ smallCells: number;
209
+ emptySlots: number;
210
+ }
211
+ interface CompositionCandidate {
212
+ columns: number;
213
+ rows: number;
214
+ score: number;
215
+ penalties: CompositionPenalties;
216
+ }
217
+ interface CompositionDecision {
218
+ path: string;
219
+ mode: NonNullable<Composition['mode']> | 'regions';
220
+ reason: 'lowest-score' | 'configured-mode' | 'promoted-regions';
221
+ selectedColumns?: number;
222
+ /** Only candidates actually evaluated by automatic selection, in tie-break order. */
223
+ candidates: CompositionCandidate[];
224
+ }
225
+ interface CompositionExplanation {
226
+ algorithm: 'grid-score-v9';
227
+ /** Provided widths do not establish shaping, glyph coverage or native fidelity. */
228
+ textMeasurement: 'estimated' | 'provided';
229
+ /** Optional vector coverage for headings and scalar/rich text, not every payload. */
230
+ textOutlines: 'provided' | 'unavailable';
231
+ /** Effective body-text reference pixels; furniture reports its own placement padding. Not a universal raster tolerance. */
232
+ textRasterPadding: number;
233
+ decisions: CompositionDecision[];
234
+ /** Payloads whose complete internal fit is not covered by this scoring model. */
235
+ unmeasuredPayloads: string[];
236
+ }
237
+ interface SlideComposition {
238
+ width: number;
239
+ height: number;
240
+ contentBox: LayoutBox;
241
+ items: ComposedItem[];
242
+ groups: ComposedGroup[];
243
+ flows: ComposedFlow[];
244
+ diagnostics: LayoutDiagnostic[];
245
+ composition: Composition;
246
+ /** Repeated furniture is measured separately from body pagination leaves. */
247
+ furniture?: FurnitureLayout;
248
+ explanation?: CompositionExplanation;
249
+ }
250
+ interface ComposeSlideOptions {
251
+ /** Context for inherited furniture and generated organization names. */
252
+ presentation?: {
253
+ design?: {
254
+ header?: unknown;
255
+ footer?: unknown;
256
+ };
257
+ organization?: unknown;
258
+ };
259
+ /** One-based displayed number; source paths still use slideIndex. */
260
+ slideNumber?: number;
261
+ fonts?: Partial<FontFamilies>;
262
+ /** Host-resolved alignment for shared content; slide design can override it. */
263
+ contentAlignment?: 'left' | 'center' | 'right';
264
+ titleAlignment?: 'left' | 'center' | 'right';
265
+ /** Unscaled reference pixels around provided vector outlines; defaults to 1 for body text and 2 for furniture. Explicit values apply to both. */
266
+ textRasterPadding?: number;
267
+ /** Host-resolved body cards. A slide's explicit design.contentBox overrides this value. */
268
+ contentBox?: boolean;
269
+ textMeasurement?: TextMeasurement;
270
+ width?: number;
271
+ height?: number;
272
+ slideIndex?: number;
273
+ layout?: Record<string, unknown>;
274
+ /** Return candidate scores and coverage without changing the selected geometry. */
275
+ explain?: boolean;
276
+ }
277
+ declare class OPFCompositionError extends Error {
278
+ readonly diagnostics: LayoutDiagnostic[];
279
+ readonly code = "layout-overflow";
280
+ readonly explanation?: CompositionExplanation;
281
+ constructor(diagnostics: LayoutDiagnostic[], explanation?: CompositionExplanation);
282
+ }
283
+ interface FurniturePartBase {
284
+ kind: 'header' | 'footer';
285
+ zone: 'left' | 'center' | 'right';
286
+ field: 'text' | 'image' | 'organization' | 'section' | 'slideNumber' | 'date';
287
+ /** Literal field or controlling flag, with the actual inherited/local path. */
288
+ path: string;
289
+ /** String/asset source, when different from a generated field's flag. */
290
+ sourcePath?: string;
291
+ generated: boolean;
292
+ box: LayoutBox;
293
+ alignment: 'left' | 'center' | 'right';
294
+ }
295
+ interface FurnitureTextPart extends FurniturePartBase {
296
+ type: 'text';
297
+ text: string;
298
+ style: TextStyle;
299
+ requestedFontSize: number;
300
+ minFontSize: number;
301
+ fit: SourceTextFit;
302
+ }
303
+ interface FurnitureImagePart extends FurniturePartBase {
304
+ type: 'image';
305
+ image: unknown;
306
+ }
307
+ type FurniturePart = FurnitureTextPart | FurnitureImagePart;
308
+ interface FurnitureLayout {
309
+ algorithm: 'furniture-flow-v2';
310
+ /** Includes explicitly empty definitions, which override inherited furniture. */
311
+ configured: boolean;
312
+ textMeasurement: 'estimated' | 'provided';
313
+ textOutlines: 'provided' | 'unavailable';
314
+ parts: FurniturePart[];
315
+ /** Outer occupied edges; composeSlide adds its normal content gap. */
316
+ headerBottom: number;
317
+ footerTop: number;
318
+ diagnostics: LayoutDiagnostic[];
319
+ overflow: boolean;
320
+ }
321
+ /** Resolve and measure repeated fields without mutating metadata or consulting a clock. */
322
+ declare function layoutFurniture(input: unknown, options?: ComposeSlideOptions): FurnitureLayout;
323
+ /** Deterministic estimate, not a font shaping engine. Preserves explicit line breaks. */
324
+ declare function measureText(text: string, fontSize: number): number;
325
+ declare function wrapText(text: string, width: number, fontSize: number, measure?: MeasureTextWidth): string[];
326
+ declare function fitText(text: string, box: LayoutBox, requestedSize?: number, minFontSize?: number, measure?: MeasureTextWidth): SourceTextFit;
327
+ interface QuoteContent {
328
+ text: string;
329
+ attribution?: string;
330
+ source?: string;
331
+ }
332
+ /** Source and displayed-text ranges are half-open UTF-16 offsets. Added punctuation has no source range. */
333
+ interface QuoteTextSource {
334
+ path: string;
335
+ start: number;
336
+ end: number;
337
+ outputStart: number;
338
+ outputEnd: number;
339
+ }
340
+ interface QuoteTextPart {
341
+ role: 'body' | 'footer';
342
+ path: string;
343
+ text: string;
344
+ sources: QuoteTextSource[];
345
+ /** Available space, before fitting. Invalid dimensions remain visible in failed results. */
346
+ box: LayoutBox;
347
+ requestedFontSize: number;
348
+ minFontSize: number;
349
+ requestedStyle: TextStyle;
350
+ style: TextStyle;
351
+ /** Absent when the available box is invalid; never fit against an invented one-pixel box. */
352
+ fit?: TextFit;
353
+ }
354
+ interface QuoteLayoutDiagnostic extends LayoutDiagnostic {
355
+ reason: 'invalid-part-box' | 'part-outside-cell' | 'text-fit' | 'part-overlap';
356
+ parts: QuoteTextPart['role'][];
357
+ }
358
+ interface QuoteLayout {
359
+ algorithm: 'quote-flow-v1';
360
+ textMeasurement: 'estimated' | 'provided';
361
+ parts: QuoteTextPart[];
362
+ diagnostics: QuoteLayoutDiagnostic[];
363
+ overflow: boolean;
364
+ }
365
+ interface QuoteLayoutOptions {
366
+ /** Canvas short edge divided by 720. Insets retain the current 18 reference-pixel contract. */
367
+ scale?: number;
368
+ fonts?: Partial<FontFamilies>;
369
+ /** Readability floor in reference pixels, before canvas scaling. */
370
+ minFontSize?: number;
371
+ overflow?: Composition['overflow'];
372
+ path?: string;
373
+ textMeasurement?: TextMeasurement;
374
+ }
375
+ /**
376
+ * Allocate and measure quote body/footer space for composition, rendering and export. Callers must
377
+ * check overflow before accepting the parts. Line boxes are not shaped glyph or native raster bounds.
378
+ */
379
+ declare function layoutQuote(value: string | QuoteContent, box: LayoutBox, options?: QuoteLayoutOptions): QuoteLayout;
380
+ interface MetricContent {
381
+ value: string | number;
382
+ label?: string;
383
+ description?: string;
384
+ unit?: string;
385
+ delta?: string | number;
386
+ trend?: 'up' | 'down' | 'flat';
387
+ }
388
+ /** Ranges address String(sourceValue), not the numeric token spelling in serialized JSON. */
389
+ interface MetricTextSource {
390
+ path: string;
391
+ value: string | number;
392
+ start: number;
393
+ end: number;
394
+ }
395
+ interface MetricTextPart {
396
+ role: keyof MetricContent;
397
+ path: string;
398
+ text: string;
399
+ sources: MetricTextSource[];
400
+ /** Empty optional fields retain their source mapping but occupy no visible space. */
401
+ visible: boolean;
402
+ /** Accepted absolute origin/baseline for each fit.sourceLines entry, including blank lines. */
403
+ linePositions: {
404
+ x: number;
405
+ baseline: number;
406
+ }[];
407
+ box: LayoutBox;
408
+ requestedFontSize: number;
409
+ minFontSize: number;
410
+ requestedStyle: TextStyle;
411
+ style: TextStyle;
412
+ /** Source-preserving line/segment representation shared with code, with proportional fonts. */
413
+ fit?: CodeTextFit;
414
+ }
415
+ interface MetricLayoutDiagnostic extends LayoutDiagnostic {
416
+ reason: 'invalid-part-box' | 'part-outside-cell' | 'text-fit' | 'part-overlap';
417
+ parts: MetricTextPart['role'][];
418
+ }
419
+ interface MetricLayout {
420
+ algorithm: 'metric-flow-v1';
421
+ alignment: 'left' | 'center' | 'right';
422
+ textMeasurement: 'estimated' | 'provided';
423
+ arrangement: 'inline-unit' | 'stacked';
424
+ /** At most 48 arrangements; value fitting is bounded by 77 reference-size trials per arrangement. */
425
+ attempts: number;
426
+ parts: MetricTextPart[];
427
+ diagnostics: MetricLayoutDiagnostic[];
428
+ overflow: boolean;
429
+ }
430
+ interface MetricLayoutOptions extends QuoteLayoutOptions {
431
+ align?: 'left' | 'center' | 'right';
432
+ /** Unscaled clearance around available vector outlines; defaults to one reference pixel. */
433
+ textRasterPadding?: number;
434
+ }
435
+ /**
436
+ * Measure every metric field before accepting geometry. Short single-line values and units can
437
+ * share a baseline; longer values or units stack. No locale formatting, trend icons or rewritten
438
+ * source text are invented. Consumers must reuse these accepted parts and source ranges.
439
+ */
440
+ declare function layoutMetric(value: string | number | MetricContent, box: LayoutBox, options?: MetricLayoutOptions): MetricLayout;
441
+ interface TimelineEvent {
442
+ when?: string;
443
+ what: string;
444
+ description?: string;
445
+ }
446
+ interface TimelineContent {
447
+ name?: string;
448
+ description?: string;
449
+ events: TimelineEvent[];
450
+ }
451
+ interface TimelineTextPart {
452
+ role: 'name' | 'description' | 'when' | 'what' | 'event-description';
453
+ eventIndex?: number;
454
+ path: string;
455
+ text: string;
456
+ sources: {
457
+ path: string;
458
+ start: number;
459
+ end: number;
460
+ }[];
461
+ box: LayoutBox;
462
+ alignment: 'left' | 'center';
463
+ requestedFontSize: number;
464
+ minFontSize: number;
465
+ requestedStyle: TextStyle;
466
+ style: TextStyle;
467
+ fit?: SourceTextFit;
468
+ }
469
+ interface TimelineLayoutDiagnostic extends LayoutDiagnostic {
470
+ reason: 'text-fit' | 'part-outside-cell' | 'event-space';
471
+ }
472
+ interface TimelineLayout {
473
+ algorithm: 'timeline-flow-v1';
474
+ arrangement: 'alternating' | 'vertical';
475
+ attempts: number;
476
+ textMeasurement: 'provided' | 'estimated';
477
+ textOutlines: 'provided' | 'unavailable';
478
+ parts: TimelineTextPart[];
479
+ markers: {
480
+ path: string;
481
+ eventIndex: number;
482
+ x: number;
483
+ y: number;
484
+ radius: number;
485
+ }[];
486
+ connector: {
487
+ x1: number;
488
+ y1: number;
489
+ x2: number;
490
+ y2: number;
491
+ };
492
+ diagnostics: TimelineLayoutDiagnostic[];
493
+ overflow: boolean;
494
+ }
495
+ interface TimelineLayoutOptions extends QuoteLayoutOptions {
496
+ textRasterPadding?: number;
497
+ }
498
+ /** Preserve event order and field boundaries while trying at most 50 readable arrangements. */
499
+ declare function layoutTimeline(value: readonly TimelineEvent[] | TimelineContent, box: LayoutBox, options?: TimelineLayoutOptions): TimelineLayout;
500
+ interface CodeContent {
501
+ source: string;
502
+ language?: string;
503
+ filename?: string;
504
+ }
505
+ interface TextLineSegment {
506
+ kind: 'text' | 'tab';
507
+ start: number;
508
+ end: number;
509
+ /** Measured position relative to this displayed line's origin, in reference pixels. */
510
+ x: number;
511
+ width: number;
512
+ }
513
+ /** Exact half-open UTF-16 offsets into the part text, including consumed hard line breaks. */
514
+ interface TextLineSource {
515
+ start: number;
516
+ end: number;
517
+ nextStart: number;
518
+ boundary: 'soft' | 'hard' | 'end';
519
+ width: number;
520
+ /** Explicit tab placement is required in SVG; CSS tab-size alone does not implement it. */
521
+ segments: TextLineSegment[];
522
+ }
523
+ interface SourceTextFit extends TextFit {
524
+ sourceLines: TextLineSource[];
525
+ /** Tabs advance to the next multiple of four measured spaces from each displayed line's origin. */
526
+ tabSize: 4;
527
+ tabWidth: number;
528
+ }
529
+ /** Compatibility names for the shared source-preserving line contract. */
530
+ type CodeLineSegment = TextLineSegment;
531
+ type CodeLineSource = TextLineSource;
532
+ interface CodeTextFit extends SourceTextFit {
533
+ }
534
+ interface CodeTextPart {
535
+ role: 'filename' | 'language' | 'body';
536
+ path: string;
537
+ /** Original text, without case conversion, whitespace normalization or discarded newlines. */
538
+ text: string;
539
+ sources: {
540
+ path: string;
541
+ start: number;
542
+ end: number;
543
+ }[];
544
+ generated: boolean;
545
+ box: LayoutBox;
546
+ requestedFontSize: number;
547
+ minFontSize: number;
548
+ requestedStyle: TextStyle;
549
+ style: TextStyle;
550
+ fit?: CodeTextFit;
551
+ }
552
+ interface CodeLayoutDiagnostic extends LayoutDiagnostic {
553
+ reason: 'invalid-part-box' | 'part-outside-cell' | 'text-fit' | 'part-overlap';
554
+ parts: CodeTextPart['role'][];
555
+ }
556
+ interface CodeLayout {
557
+ algorithm: 'code-flow-v1';
558
+ textMeasurement: 'estimated' | 'provided';
559
+ parts: CodeTextPart[];
560
+ diagnostics: CodeLayoutDiagnostic[];
561
+ overflow: boolean;
562
+ }
563
+ interface CodeLayoutOptions extends QuoteLayoutOptions {
564
+ }
565
+ /** Shared filename/language/body allocation. Consumers must reuse the accepted fits and styles. */
566
+ declare function layoutCode(value: string | CodeContent, box: LayoutBox, options?: CodeLayoutOptions): CodeLayout;
567
+ interface RichTextRun {
568
+ text: string;
569
+ bold?: boolean;
570
+ italic?: boolean;
571
+ underline?: boolean;
572
+ strikethrough?: boolean;
573
+ color?: string;
574
+ fontSize?: number;
575
+ fontFamily?: string;
576
+ link?: string;
577
+ superscript?: boolean;
578
+ subscript?: boolean;
579
+ }
580
+ interface RichTextFragment {
581
+ text: string;
582
+ runIndex: number;
583
+ start: number;
584
+ end: number;
585
+ x: number;
586
+ width: number;
587
+ fontSize: number;
588
+ baselineShift: number;
589
+ style: TextStyle;
590
+ run: RichTextRun;
591
+ }
592
+ interface RichTextLine {
593
+ fragments: RichTextFragment[];
594
+ width: number;
595
+ y: number;
596
+ baseline: number;
597
+ height: number;
598
+ }
599
+ interface RichTextFit extends TextFit {
600
+ richLines: RichTextLine[];
601
+ height: number;
602
+ }
603
+ interface RichTextOptions {
604
+ style: TextStyle;
605
+ textMeasurement?: TextMeasurement;
606
+ /** Use one measured line advance for every line, as native table cells do. */
607
+ uniformLineHeight?: boolean;
608
+ }
609
+ /** Fit mixed styles without flattening font metrics. Run fontSize is in points. */
610
+ declare function fitRichText(input: readonly (string | RichTextRun)[], box: LayoutBox, requestedSize?: number, minFontSize?: number, options?: RichTextOptions): RichTextFit;
611
+ type ListText = string | readonly (string | RichTextRun)[];
612
+ type ListValue = ListText | {
613
+ text: ListText;
614
+ description?: ListText;
615
+ level?: number;
616
+ };
617
+ interface ListEntryLayout {
618
+ index: number;
619
+ level: number;
620
+ textPath?: string;
621
+ descriptionPath?: string;
622
+ value: ListText;
623
+ descriptionValue?: ListText;
624
+ text: RichTextFit;
625
+ description?: RichTextFit;
626
+ textBox: LayoutBox;
627
+ descriptionBox?: LayoutBox;
628
+ marker: {
629
+ text: string;
630
+ x: number;
631
+ y: number;
632
+ fontSize: number;
633
+ style: TextStyle;
634
+ indent: number;
635
+ };
636
+ }
637
+ interface ListFit extends TextFit {
638
+ listEntries: ListEntryLayout[];
639
+ height: number;
640
+ }
641
+ /** Shared hanging indents, mixed-run fitting and description spacing for list payloads. */
642
+ declare function fitList(input: readonly ListValue[], box: LayoutBox, requestedSize?: number, minFontSize?: number, options?: RichTextOptions): ListFit;
643
+ interface TableLayoutOptions {
644
+ scale?: number;
645
+ minFontSize?: number;
646
+ fontFamily?: string;
647
+ textMeasurement?: TextMeasurement;
648
+ path?: string;
649
+ }
650
+ interface TableCellLayout {
651
+ value: unknown;
652
+ input: unknown;
653
+ sourcePath: string;
654
+ style: TableCellStyle;
655
+ row: number;
656
+ column: number;
657
+ rowSpan: number;
658
+ colSpan: number;
659
+ path: string;
660
+ header: boolean;
661
+ rich: boolean;
662
+ box: LayoutBox;
663
+ textBox: LayoutBox;
664
+ textStyle: TextStyle;
665
+ fit: TextFit | RichTextFit;
666
+ }
667
+ interface TableRowLayout {
668
+ box: LayoutBox;
669
+ cells: TableCellLayout[];
670
+ }
671
+ interface TableLayout {
672
+ rows: TableRowLayout[];
673
+ columnCount: number;
674
+ height: number;
675
+ overflow: boolean;
676
+ }
677
+ /** Shared cell geometry and font fitting for SVG, native PPTX and pagination.
678
+ * Short rows retain their 54px preferred height. Multiline rows use the space
679
+ * their text needs; constrained tables consume row padding before readable text.
680
+ * All dimensions are canvas pixels; minFontSize is an unscaled canvas size.
681
+ */
682
+ declare function layoutTable(value: unknown, box: LayoutBox, options?: TableLayoutOptions): TableLayout;
683
+ /** Compose a validated Slide. Layout resolution remains the caller's responsibility. */
684
+ declare function composeSlide(input: unknown, options?: ComposeSlideOptions): SlideComposition;
685
+ /** Canonical physical slide size, converted to reference pixels at 96 pixels/inch. */
686
+ declare function resolveCanvasDimensions(input: unknown): {
687
+ width: number;
688
+ height: number;
689
+ };
690
+
691
+ export { type TextFit as $, type ListValue as A, type MeasureTextWidth as B, type CodeContent as C, type MetricContent as D, type MetricLayout as E, type FontFamilies as F, type MetricLayoutDiagnostic as G, type MetricLayoutOptions as H, type MetricTextPart as I, type MetricTextSource as J, type QuoteLayout as K, type LayoutBox as L, MAX_COMPOSITION_DEPTH as M, type QuoteLayoutDiagnostic as N, OPFCompositionError as O, type QuoteLayoutOptions as P, type QuoteContent as Q, type QuoteTextPart as R, type QuoteTextSource as S, type ResolveColorRefOptions as T, type ResolveColorRefRoles as U, type RichTextFit as V, type RichTextFragment as W, type RichTextLine as X, type RichTextOptions as Y, type RichTextRun as Z, type SlideComposition as _, type CodeLayout as a, type TextLineInk as a0, type TextMeasurement as a1, type TextPlacement as a2, type TextPlacementLine as a3, type TextStyle as a4, type TimelineContent as a5, type TimelineEvent as a6, type TimelineLayout as a7, type TimelineLayoutDiagnostic as a8, type TimelineLayoutOptions as a9, type TableCellLayout as aA, type TableCellStyle as aB, type TableGrid as aC, type TableGridCell as aD, type TableGridIssue as aE, type TableLayout as aF, type TableLayoutOptions as aG, type TableRowLayout as aH, type TextLineSegment as aI, type TextLineSource as aJ, layoutTable as aK, tableGrid as aL, tableRowBoundaries as aM, type TimelineTextPart as aa, chartColorForFill as ab, colorContrast as ac, composeSlide as ad, fitList as ae, fitRichText as af, fitText as ag, layoutCode as ah, layoutFurniture as ai, layoutMetric as aj, layoutQuote as ak, layoutTimeline as al, measureText as am, measureTextOutline as an, normalizeHexColor as ao, placeTextLines as ap, resolveCanvasDimensions as aq, resolveColorRef as ar, resolveFontFamilies as as, resolveTextStyle as at, textColorForFill as au, textWidthMeasurer as av, wrapText as aw, type FontFaceSelection as ax, type SourceTextFit as ay, type TableBorder as az, type CodeLayoutDiagnostic as b, type CodeLayoutOptions as c, type CodeLineSegment as d, type CodeLineSource as e, type CodeTextFit as f, type CodeTextPart as g, type ComposeSlideOptions as h, type ComposedFlow as i, type ComposedGroup as j, type ComposedItem as k, type Composition as l, type CompositionCandidate as m, type CompositionDecision as n, type CompositionExplanation as o, type CompositionPenalties as p, type CompositionTrack as q, type FurnitureImagePart as r, type FurnitureLayout as s, type FurniturePart as t, type FurniturePartBase as u, type FurnitureTextPart as v, type LayoutDiagnostic as w, type ListEntryLayout as x, type ListFit as y, type ListText as z };