@vyaz/core 0.0.16 → 0.3.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 (53) hide show
  1. package/README.md +35 -0
  2. package/bin/vyaz.js +27 -0
  3. package/dist/cli/check.d.ts +12 -0
  4. package/dist/cli/check.d.ts.map +1 -0
  5. package/dist/cli/check.js +4077 -0
  6. package/dist/compile/ParagraphCompiler.d.ts +84 -0
  7. package/dist/compile/ParagraphCompiler.d.ts.map +1 -0
  8. package/dist/debug/lines-to-yaml.d.ts +14 -0
  9. package/dist/debug/lines-to-yaml.d.ts.map +1 -0
  10. package/dist/debug.d.ts +11 -0
  11. package/dist/debug.d.ts.map +1 -0
  12. package/dist/debug.js +4 -0
  13. package/dist/index.browser.d.ts +11 -4
  14. package/dist/index.browser.d.ts.map +1 -1
  15. package/dist/index.browser.js +3244 -4669
  16. package/dist/index.d.ts +15 -11
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js +5133 -811
  19. package/dist/layout/AutoFitEngine.d.ts.map +1 -1
  20. package/dist/layout/LineBoxValidator.d.ts +5 -10
  21. package/dist/layout/LineBoxValidator.d.ts.map +1 -1
  22. package/dist/layout/ParagraphLayoutEngine.d.ts +13 -8
  23. package/dist/layout/ParagraphLayoutEngine.d.ts.map +1 -1
  24. package/dist/layout/PositioningEngine.d.ts +1 -1
  25. package/dist/layout/PositioningEngine.d.ts.map +1 -1
  26. package/dist/layout/TableLayoutEngine.d.ts +174 -0
  27. package/dist/layout/TableLayoutEngine.d.ts.map +1 -0
  28. package/dist/layout/TextFrameLayoutEngine.d.ts +115 -16
  29. package/dist/layout/TextFrameLayoutEngine.d.ts.map +1 -1
  30. package/dist/layout/create-engine.d.ts +32 -0
  31. package/dist/layout/create-engine.d.ts.map +1 -0
  32. package/dist/layout/resolve-font.d.ts +25 -0
  33. package/dist/layout/resolve-font.d.ts.map +1 -0
  34. package/dist/measure/FontEngine.d.ts +44 -1
  35. package/dist/measure/FontEngine.d.ts.map +1 -1
  36. package/dist/measure/FontMetricsProvider.d.ts +3 -10
  37. package/dist/measure/FontMetricsProvider.d.ts.map +1 -1
  38. package/dist/measure/FontkitMeasureContext.d.ts +109 -0
  39. package/dist/measure/FontkitMeasureContext.d.ts.map +1 -0
  40. package/dist/measure/canvas-polyfill.d.ts.map +1 -1
  41. package/dist/types/Document.d.ts +73 -28
  42. package/dist/types/Document.d.ts.map +1 -1
  43. package/dist/types/FontTypes.d.ts +1 -1
  44. package/dist/types/FontTypes.d.ts.map +1 -1
  45. package/dist/types/LayoutTypes.d.ts +19 -2
  46. package/dist/types/LayoutTypes.d.ts.map +1 -1
  47. package/dist/types/TableTypes.d.ts +198 -0
  48. package/dist/types/TableTypes.d.ts.map +1 -0
  49. package/dist/utils/sides.d.ts +26 -0
  50. package/dist/utils/sides.d.ts.map +1 -0
  51. package/dist/utils/widths.d.ts +16 -0
  52. package/dist/utils/widths.d.ts.map +1 -0
  53. package/package.json +25 -4
@@ -0,0 +1,109 @@
1
+ /**
2
+ * FontkitMeasureContext.ts — the measurement seam for vendored pretext.
3
+ *
4
+ * `src/vendor/pretext/measurement.js` calls `getMeasureContext()` from this
5
+ * module instead of reaching for a canvas 2d context. That is the whole
6
+ * integration: pretext only ever uses two members of the object it gets back —
7
+ * `ctx.font = "..."` and `ctx.measureText(s).width` — so the contract is tiny.
8
+ * It draws nothing, and it reads no other property (letter-spacing is pretext's
9
+ * own arithmetic, not the canvas attribute).
10
+ *
11
+ * Backends:
12
+ *
13
+ * - fontkit (the default; installed by `ParagraphLayoutEngine` at module load
14
+ * via `setMeasureContext(createFontkitMeasureContext(...))`) — measures from
15
+ * the font tables. Same per-code-point advances and missing-glyph policy as
16
+ * glyph positioning, so line breaking and positioning agree.
17
+ * - canvas (`createCanvasMeasureContext`) — pretext's original behaviour, kept
18
+ * only as a browser-only escape hatch via `setMeasureContext(null)`. It
19
+ * needs a real `OffscreenCanvas`/`document`; in Node/Bun it now throws
20
+ * rather than pulling a canvas polyfill.
21
+ *
22
+ * Shaping (kerning, ligatures via `font.layout()`) is a separate, later change.
23
+ * Landing it at the same time would make the snapshot delta unreadable.
24
+ */
25
+ import type { FontFace } from './FontEngine.js';
26
+ /**
27
+ * The slice of `CanvasRenderingContext2D` that pretext actually consumes.
28
+ */
29
+ export interface MeasureContextLike {
30
+ font: string;
31
+ measureText(text: string): {
32
+ width: number;
33
+ };
34
+ }
35
+ /**
36
+ * Font lookup, structurally satisfied by `FontMetricsProvider`.
37
+ * Kept minimal so this module does not depend on the provider.
38
+ */
39
+ export interface FontResolver {
40
+ getFont(family: string, weight?: string, style?: string): FontFace | undefined;
41
+ }
42
+ /**
43
+ * How widths are computed from the font tables.
44
+ *
45
+ * - `'advance'` (default) — Σ per-code-point `advanceWidth`. Fast, and
46
+ * shaping-invariant, but ignores kerning and ligatures, so it drifts from
47
+ * what a browser paints (up to a few px per word on a kerned Latin font).
48
+ * - `'shape'` — fontkit `layout()` advance: GPOS kerning + GSUB (`liga`,
49
+ * `clig`, `calt`, `ccmp`), i.e. browser-default behaviour. Use for the SVG
50
+ * `browser` preset when on-screen width has to match the layout.
51
+ */
52
+ export interface MeasureProfile {
53
+ engine: 'advance' | 'shape';
54
+ /** `'shape'` only — OpenType feature overrides, e.g. `{ liga: false }`. */
55
+ features?: Record<string, boolean>;
56
+ }
57
+ /**
58
+ * Register a callback fired whenever {@link setMeasureProfile} changes the
59
+ * profile — used to drop pretext's per-segment width cache, which is keyed by
60
+ * text only and would otherwise serve `advance` widths to a `shape` layout.
61
+ */
62
+ export declare function setProfileChangeHook(fn: (() => void) | null): void;
63
+ /** Install the measurement profile used by every fontkit-backed measure path. */
64
+ export declare function setMeasureProfile(next: MeasureProfile): void;
65
+ /** The active measurement profile. */
66
+ export declare function getMeasureProfile(): MeasureProfile;
67
+ /**
68
+ * Install the measure context pretext will use.
69
+ *
70
+ * Pass `null` to fall back to canvas. Takes effect on the next measurement —
71
+ * unlike upstream, nothing is latched, so this is safe to flip in tests.
72
+ */
73
+ export declare function setMeasureContext(ctx: MeasureContextLike | null): void;
74
+ /** The currently installed context, or `null` when on the canvas fallback. */
75
+ export declare function getInstalledMeasureContext(): MeasureContextLike | null;
76
+ /**
77
+ * Called by vendored pretext on every measurement.
78
+ *
79
+ * Resolution is lazy and per-call rather than latched at module init, so there
80
+ * is no installation order to get wrong and no window in which a worker thread
81
+ * measures through the wrong backend.
82
+ */
83
+ export declare function getMeasureContext(): MeasureContextLike;
84
+ /**
85
+ * Reproduces pretext's original `getMeasureContext()`. Browser-only: needs a
86
+ * real `OffscreenCanvas` or `document`. Only reached after an explicit
87
+ * `setMeasureContext(null)`; the fontkit backend is the default everywhere.
88
+ */
89
+ export declare function createCanvasMeasureContext(): MeasureContextLike;
90
+ /**
91
+ * Build a measure context backed by the font tables.
92
+ *
93
+ * @param resolver - font lookup, normally the shared `fontMetricsProvider`
94
+ */
95
+ /**
96
+ * Pixel width of `text` under `profile`. Shared by the pretext measure context
97
+ * and `ParagraphLayoutEngine`'s fragment measurement so line breaking and
98
+ * positioning never disagree.
99
+ *
100
+ * - `advance` — Σ per-code-point `advanceWidth`, surrogate-aware, with the
101
+ * `MISSING_GLYPH_FACTOR · fontSize` estimate for absent glyphs.
102
+ * - `shape` — fontkit `layout()` advance (kerning + ligatures). Missing
103
+ * glyphs there fall back to the same per-code-point estimate for the
104
+ * stretch that produced no advance, so the two profiles agree on
105
+ * un-shapeable text.
106
+ */
107
+ export declare function measurePx(raw: any, scale: number, fontSize: number, text: string, prof?: MeasureProfile): number;
108
+ export declare function createFontkitMeasureContext(resolver: FontResolver): MeasureContextLike;
109
+ //# sourceMappingURL=FontkitMeasureContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FontkitMeasureContext.d.ts","sourceRoot":"","sources":["../../src/measure/FontkitMeasureContext.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,M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GAC7B,MAAM,CA8BR;AAED,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,YAAY,GAAG,kBAAkB,CA+CtF"}
@@ -1 +1 @@
1
- {"version":3,"file":"canvas-polyfill.d.ts","sourceRoot":"","sources":["../../src/measure/canvas-polyfill.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAkNH;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAUzE;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CASzE;AAED;;GAEG;AACH,wBAAgB,wBAAwB,IAAI,IAAI,CAS/C"}
1
+ {"version":3,"file":"canvas-polyfill.d.ts","sourceRoot":"","sources":["../../src/measure/canvas-polyfill.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAwNH;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAUzE;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CASzE;AAED;;GAEG;AACH,wBAAgB,wBAAwB,IAAI,IAAI,CAS/C"}
@@ -18,17 +18,29 @@
18
18
  *
19
19
  * Determines how lines stack relative to each other:
20
20
  * - `horizontal-tb`: lines flow horizontally top-to-bottom (Latin, Cyrillic, default).
21
- * - `vertical-rl`: lines flow vertically right-to-left (traditional CJK).
21
+ * - `vertical-rl`: lines flow vertically right-to-left (traditional CJK, per-glyph
22
+ * upright/rotated via {@link TextOrientation}).
22
23
  * - `vertical-lr`: lines flow vertically left-to-right (Mongolian, some UI scenarios).
24
+ * - `sideways-rl`: the whole text block is laid out horizontally, then rotated
25
+ * 90° **clockwise** as a rigid unit; wrapped lines stack right-to-left. A single
26
+ * line reads top-to-bottom. Matches PowerPoint `bodyPr vert="vert"`.
27
+ * - `sideways-lr`: same, rotated 90° **counter-clockwise**; wrapped lines stack
28
+ * left-to-right, a line reads bottom-to-top. Matches PowerPoint `vert="vert270"`.
23
29
  *
24
30
  * **Layout impact:**
25
31
  * Under `horizontal-tb`, `wrap` clips by **width**, `autofit` shrinks by **height**.
26
- * Under `vertical-*`, `wrap` clips by **height**, `autofit` shrinks by **width**
27
- * (width and height swap roles).
32
+ * Under `vertical-*` / `sideways-*`, `wrap` clips by **height**, `autofit` shrinks
33
+ * by **width** (width and height swap roles).
28
34
  *
29
- * @see {@link https://www.w3.org/TR/css-writing-modes-3/#block-flow | CSS Writing Modes: block flow}
35
+ * **Implementation status:** `sideways-rl` / `sideways-lr` are implemented as a
36
+ * post-layout affine transform (the engine reports it on
37
+ * `TextFrameLayoutResult.transform`; the renderer applies it). `vertical-rl` /
38
+ * `vertical-lr` with per-glyph orientation are **not yet implemented** — they are
39
+ * accepted by the type but currently laid out as `horizontal-tb`.
40
+ *
41
+ * @see {@link https://www.w3.org/TR/css-writing-modes-4/#block-flow | CSS Writing Modes: block flow}
30
42
  */
31
- export type WritingMode = 'horizontal-tb' | 'vertical-rl' | 'vertical-lr';
43
+ export type WritingMode = 'horizontal-tb' | 'vertical-rl' | 'vertical-lr' | 'sideways-rl' | 'sideways-lr';
32
44
  /**
33
45
  * Character orientation inside a vertical line.
34
46
  *
@@ -50,35 +62,35 @@ export type TextAlignment = 'left' | 'center' | 'right' | 'justify';
50
62
  * Alignment of the **last** line in a justified paragraph.
51
63
  *
52
64
  * @see {@link https://www.w3.org/TR/css-text-3/#text-align-last-property | CSS Text: text-align-last}
53
- * @todo Not yet implemented in the layout engine.
65
+ * @experimental Accepted in the type but ignored by the layout engine (no-op until implemented).
54
66
  */
55
67
  export type TextAlignLast = 'auto' | 'start' | 'end' | 'left' | 'right' | 'center' | 'justify';
56
68
  /**
57
69
  * Word-break rules (how to break lines within words).
58
70
  *
59
71
  * @see {@link https://www.w3.org/TR/css-text-3/#word-break-property | CSS Text: word-break}
60
- * @todo Not yet implemented in the layout engine.
72
+ * @experimental Accepted in the type but ignored by the layout engine (no-op until implemented).
61
73
  */
62
74
  export type WordBreak = 'normal' | 'break-all' | 'keep-all' | 'break-word';
63
75
  /**
64
76
  * Strictness of line-break rules (mainly for CJK).
65
77
  *
66
78
  * @see {@link https://www.w3.org/TR/css-text-3/#line-break-property | CSS Text: line-break}
67
- * @todo Not yet implemented in the layout engine.
79
+ * @experimental Accepted in the type but ignored by the layout engine (no-op until implemented).
68
80
  */
69
81
  export type LineBreak = 'auto' | 'loose' | 'normal' | 'strict' | 'anywhere';
70
82
  /**
71
83
  * Overflow wrap behavior (whether long words can break).
72
84
  *
73
85
  * @see {@link https://www.w3.org/TR/css-text-3/#overflow-wrap-property | CSS Text: overflow-wrap}
74
- * @todo Not yet implemented in the layout engine.
86
+ * @experimental Accepted in the type but ignored by the layout engine (no-op until implemented).
75
87
  */
76
88
  export type OverflowWrap = 'normal' | 'break-word' | 'anywhere';
77
89
  /**
78
90
  * Text decoration line style.
79
91
  *
80
92
  * @see {@link https://www.w3.org/TR/css-text-decor-3/#text-decoration-style-property | CSS Text Decoration: text-decoration-style}
81
- * @todo Not yet implemented in the layout engine.
93
+ * @experimental Accepted in the type but ignored by the layout engine (no-op until implemented).
82
94
  */
83
95
  export type TextDecorationStyle = 'solid' | 'double' | 'dotted' | 'dashed' | 'wavy';
84
96
  /**
@@ -91,14 +103,14 @@ export type TextTransform = 'none' | 'uppercase' | 'lowercase' | 'capitalize';
91
103
  * Dominant baseline used for vertical alignment within a line.
92
104
  *
93
105
  * @see {@link https://www.w3.org/TR/css-inline-3/#dominant-baseline-property | CSS Inline Layout: dominant-baseline}
94
- * @todo Not yet implemented in the layout engine.
106
+ * @experimental Accepted in the type but ignored by the layout engine (no-op until implemented).
95
107
  */
96
108
  export type DominantBaseline = 'auto' | 'text-bottom' | 'alphabetic' | 'ideographic' | 'middle' | 'central' | 'mathematical' | 'hanging' | 'text-top';
97
109
  /**
98
110
  * Edge used to measure the line box height (font metric edge).
99
111
  *
100
112
  * @see {@link https://www.w3.org/TR/css-inline-3/#line-fit-edge | CSS Inline Layout: line-fit-edge}
101
- * @todo Not yet implemented in the layout engine.
113
+ * @experimental Accepted in the type but ignored by the layout engine (no-op until implemented).
102
114
  */
103
115
  export type LineFitEdge = 'leading' | 'text' | 'cap' | 'ex' | 'ideographic' | 'ideographic-ink' | 'alphabetic';
104
116
  /**
@@ -226,8 +238,13 @@ export interface TextRun {
226
238
  * inside the text flow.
227
239
  */
228
240
  inlineWidget?: InlineWidget;
229
- /** Font family name (e.g. `"Arial"`, `"Times New Roman"`). */
230
- fontFamily: string;
241
+ /**
242
+ * Font family name, or a CSS-style fallback list tried in order
243
+ * (e.g. `"Arial"` or `["Inter", "Arial", "sans-serif"]`). The layout result
244
+ * always reports the concrete family that was used; see
245
+ * `LayoutOptions.onMissingFont`.
246
+ */
247
+ fontFamily: string | string[];
231
248
  /** Font size in px. */
232
249
  fontSize: number;
233
250
  /** Font weight: `'normal'`, `'bold'`, or a numeric CSS weight (100–900). */
@@ -246,19 +263,27 @@ export interface TextRun {
246
263
  underline?: boolean;
247
264
  /** Strikethrough decoration. */
248
265
  strikethrough?: boolean;
249
- /** Overline decoration. @todo Not yet implemented. */
266
+ /** Overline decoration. @experimental Accepted in the type but ignored by the layout engine (no-op until implemented). */
250
267
  overline?: boolean;
251
- /** Underline / overline / strikethrough line style. @todo Not yet implemented. */
268
+ /** Underline / overline / strikethrough line style. @experimental Accepted in the type but ignored by the layout engine (no-op until implemented). */
252
269
  textDecorationStyle?: TextDecorationStyle;
253
- /** Underline / overline / strikethrough line color. @todo Not yet implemented. */
270
+ /** Underline / overline / strikethrough line color. @experimental Accepted in the type but ignored by the layout engine (no-op until implemented). */
254
271
  textDecorationColor?: string;
255
272
  /** Case transform (uppercase, lowercase, capitalize). */
256
273
  textTransform?: TextTransform;
257
- /** Force full-width characters (CJK). @todo Not yet implemented. */
274
+ /** Force full-width characters (CJK). @experimental Accepted in the type but ignored by the layout engine (no-op until implemented). */
258
275
  fullWidth?: boolean;
259
- /** Convert small kana to full-size kana. @todo Not yet implemented. */
276
+ /** Convert small kana to full-size kana. @experimental Accepted in the type but ignored by the layout engine (no-op until implemented). */
260
277
  fullSizeKana?: boolean;
261
278
  }
279
+ /**
280
+ * A `TextRun` after the layout engine has resolved its `fontFamily` fallback
281
+ * list down to one concrete registered family. This is what `Span.style` and
282
+ * the compiled items carry — never a `string[]`.
283
+ */
284
+ export type ResolvedTextRun = Omit<TextRun, 'fontFamily'> & {
285
+ fontFamily: string;
286
+ };
262
287
  /**
263
288
  * Data for an inline widget (embedded object inside text flow).
264
289
  *
@@ -282,6 +307,12 @@ export interface InlineWidget {
282
307
  * Negative = widget ascends above the baseline.
283
308
  */
284
309
  baselineOffset?: number;
310
+ /**
311
+ * Opaque key a renderer can use to look up the widget's actual content
312
+ * (e.g. `renderToSVG`'s `inlineBoxes[id]` SVG fragment). The layout engine
313
+ * only reserves the `width` × `height` box; it never reads this.
314
+ */
315
+ id?: string;
285
316
  }
286
317
  /**
287
318
  * Configuration for list markers (bullet or numbered).
@@ -379,34 +410,34 @@ export interface ParagraphStyle {
379
410
  * Indentation of the first line in px.
380
411
  * If set, overrides the generic `indent` for the first line.
381
412
  *
382
- * @todo Not yet implemented in the layout engine.
413
+ * @experimental Accepted in the type but ignored by the layout engine (no-op until implemented).
383
414
  */
384
415
  textIndent?: number;
385
416
  /** Letter-spacing (tracking) for the whole paragraph in px. */
386
417
  letterSpacing?: number;
387
418
  /**
388
419
  * Alignment of the **last** line of a justified paragraph.
389
- * @todo Not yet implemented.
420
+ * @experimental Accepted in the type but ignored by the layout engine (no-op until implemented).
390
421
  */
391
422
  textAlignLast?: TextAlignLast;
392
423
  /**
393
424
  * Word-break rules (CJK / non-CJK).
394
- * @todo Not yet implemented.
425
+ * @experimental Accepted in the type but ignored by the layout engine (no-op until implemented).
395
426
  */
396
427
  wordBreak?: WordBreak;
397
428
  /**
398
429
  * Line-break strictness (CJK).
399
- * @todo Not yet implemented.
430
+ * @experimental Accepted in the type but ignored by the layout engine (no-op until implemented).
400
431
  */
401
432
  lineBreak?: LineBreak;
402
433
  /**
403
434
  * Overflow-wrap / word-wrap behaviour.
404
- * @todo Not yet implemented.
435
+ * @experimental Accepted in the type but ignored by the layout engine (no-op until implemented).
405
436
  */
406
437
  overflowWrap?: OverflowWrap;
407
438
  /**
408
439
  * Whether hyphenation is allowed.
409
- * @todo Not yet implemented.
440
+ * @experimental Accepted in the type but ignored by the layout engine (no-op until implemented).
410
441
  */
411
442
  hyphens?: boolean;
412
443
  /**
@@ -543,6 +574,20 @@ export interface TextFrame {
543
574
  * Ignored when `writingMode === 'horizontal-tb'`.
544
575
  */
545
576
  textOrientation?: TextOrientation;
577
+ /**
578
+ * Rigid clockwise rotation of the **whole** text block, in degrees, applied
579
+ * after layout as an affine transform about the frame-box centre. This does
580
+ * **not** affect line breaking, measurement or positioning — only the final
581
+ * render transform. Mirrors PowerPoint's shape rotation (`<a:xfrm rot>`).
582
+ *
583
+ * Composes with `writingMode: 'sideways-*'` (which contributes its own ±90°).
584
+ * `0`, `90`, `180`, `270` are the exercised values; other angles are accepted
585
+ * and rotate about the centre without expanding the canvas bounding box.
586
+ *
587
+ * The engine folds this together with the writing-mode rotation and reports
588
+ * the result on `TextFrameLayoutResult.transform`.
589
+ */
590
+ rotation?: number;
546
591
  /**
547
592
  * Base text direction (important for bidi).
548
593
  * `'ltr'` = left-to-right, `'rtl'` = right-to-left.
@@ -552,12 +597,12 @@ export interface TextFrame {
552
597
  verticalAlignment?: VerticalAlignment;
553
598
  /**
554
599
  * Dominant baseline for inline alignment.
555
- * @todo Not yet implemented.
600
+ * @experimental Accepted in the type but ignored by the layout engine (no-op until implemented).
556
601
  */
557
602
  dominantBaseline?: DominantBaseline;
558
603
  /**
559
604
  * Font metric edge used for line box height.
560
- * @todo Not yet implemented.
605
+ * @experimental Accepted in the type but ignored by the layout engine (no-op until implemented).
561
606
  */
562
607
  lineFitEdge?: LineFitEdge;
563
608
  /**
@@ -577,7 +622,7 @@ export interface TextFrame {
577
622
  /**
578
623
  * Multi-column layout configuration.
579
624
  * When set, paragraphs are automatically broken into columns.
580
- * @todo Not yet implemented.
625
+ * @experimental Accepted in the type but ignored by the layout engine (no-op until implemented).
581
626
  */
582
627
  columns?: MultiColumnConfig;
583
628
  /** Paragraphs forming the text content. */
@@ -1 +1 @@
1
- {"version":3,"file":"Document.d.ts","sourceRoot":"","sources":["../../src/types/Document.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,WAAW,GAAG,eAAe,GAAG,aAAa,GAAG,aAAa,CAAC;AAE1E;;;;;;;;;GASG;AACH,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,SAAS,GAAG,UAAU,CAAC;AAE/D;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,CAAC;AAEpE;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,CAAC;AAE/F;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,WAAW,GAAG,UAAU,GAAG,YAAY,CAAC;AAE3E;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU,CAAC;AAE5E;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,YAAY,GAAG,UAAU,CAAC;AAEhE;;;;;GAKG;AACH,MAAM,MAAM,mBAAmB,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,M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ACH,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B;;;OAGG;IACH,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,SAAS,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;IAC1B,gEAAgE;IAChE,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC;;;OAGG;IACH,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC;;;OAGG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B;;;OAGG;IACH,OAAO,CAAC,EAAE;QACR,yBAAyB;QACzB,GAAG,EAAE,MAAM,CAAC;QACZ,2BAA2B;QAC3B,KAAK,EAAE,MAAM,CAAC;QACd,4BAA4B;QAC5B,MAAM,EAAE,MAAM,CAAC;QACf,0BAA0B;QAC1B,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF;;;;OAIG;IACH,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B,2CAA2C;IAC3C,UAAU,EAAE,SAAS,EAAE,CAAC;IACxB;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,cAAc,CAAC,CAAC,CAAC;CACzE;AAID;;GAEG;AACH,eAAO,MAAM,uBAAuB,EAAE,cAMpC,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,OAAO,CAAC,OAAO,CAM9C,CAAC"}
@@ -51,7 +51,7 @@ export interface IFontMetricsProvider {
51
51
  /**
52
52
  * Get metrics for a given family and size.
53
53
  */
54
- getMetrics(fontFamily: string, fontSize: number, weight?: string, style?: string): FontMetrics;
54
+ getMetrics(fontFamily: string, fontSize: number, weight?: string, style?: string, mode?: 'browser' | 'office'): FontMetrics;
55
55
  }
56
56
  /** Glyph-level data for a single glyph (per-character tracking/highlighting) */
57
57
  export interface GlyphData {
@@ -1 +1 @@
1
- {"version":3,"file":"FontTypes.d.ts","sourceRoot":"","sources":["../../src/types/FontTypes.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,6DAA6D;AAC7D,MAAM,WAAW,WAAW;IAC1B,0BAA0B;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,gDAAgD;IAChD,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,wCAAwC;IACxC,UAAU,EAAE,MAAM,CAAC;IACnB;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,QAAQ,GAAG,UAAU,CAAC;CACvD;AAED,8CAA8C;AAC9C,MAAM,WAAW,oBAAoB;IACnC;;;;OAIG;IACH,OAAO,CAAC,IAAI,EAAE,SAAS,GAAG,QAAQ,GAAG,IAAI,CAAC;IAE1C;;OAEG;IACH,OAAO,IAAI,SAAS,GAAG,QAAQ,CAAC;IAEhC;;;;;OAKG;IACH,YAAY,CACV,MAAM,EAAE,MAAM,EACd,OAAO,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,EAC5C,MAAM,EAAE,MAAM,GAAG,MAAM,EACvB,UAAU,CAAC,EAAE,MAAM,GAClB,IAAI,CAAC;IAER;;OAEG;IACH,UAAU,CACR,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,MAAM,CAAC,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,MAAM,GACb,WAAW,CAAC;CAChB;AAED,gFAAgF;AAChF,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,CAAC,EAAE,MAAM,CAAC;CACX"}
1
+ {"version":3,"file":"FontTypes.d.ts","sourceRoot":"","sources":["../../src/types/FontTypes.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,6DAA6D;AAC7D,MAAM,WAAW,WAAW;IAC1B,0BAA0B;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,gDAAgD;IAChD,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,wCAAwC;IACxC,UAAU,EAAE,MAAM,CAAC;IACnB;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,QAAQ,GAAG,UAAU,CAAC;CACvD;AAED,8CAA8C;AAC9C,MAAM,WAAW,oBAAoB;IACnC;;;;OAIG;IACH,OAAO,CAAC,IAAI,EAAE,SAAS,GAAG,QAAQ,GAAG,IAAI,CAAC;IAE1C;;OAEG;IACH,OAAO,IAAI,SAAS,GAAG,QAAQ,CAAC;IAEhC;;;;;OAKG;IACH,YAAY,CACV,MAAM,EAAE,MAAM,EACd,OAAO,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,EAC5C,MAAM,EAAE,MAAM,GAAG,MAAM,EACvB,UAAU,CAAC,EAAE,MAAM,GAClB,IAAI,CAAC;IAER;;OAEG;IACH,UAAU,CACR,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,MAAM,CAAC,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,MAAM,EACd,IAAI,CAAC,EAAE,SAAS,GAAG,QAAQ,GAC1B,WAAW,CAAC;CAChB;AAED,gFAAgF;AAChF,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,CAAC,EAAE,MAAM,CAAC;CACX"}
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * Based on plan.md §2.5 (Output — Physical Box Model / Layout Tree)
8
8
  */
9
- import type { TextRun, InlineWidget, TextAlignment } from './Document.js';
9
+ import type { ResolvedTextRun, InlineWidget, TextAlignment } from './Document.js';
10
10
  export interface Span {
11
11
  /** Offset from Line.x */
12
12
  x: number;
@@ -26,7 +26,7 @@ export interface Span {
26
26
  * A snapshot of the source run's style at layout time.
27
27
  * Copied from the corresponding `TextRun` in the paragraph's `children` array.
28
28
  */
29
- style: TextRun;
29
+ style: ResolvedTextRun;
30
30
  /** InlineWidget data (if span is an inline-box) */
31
31
  inlineWidget?: InlineWidget;
32
32
  /** Per-character advance widths (for selection/tracking) */
@@ -113,6 +113,23 @@ export interface ParagraphLayoutResult {
113
113
  contentWidth: number;
114
114
  /** Actual content height (text bbox) */
115
115
  contentHeight: number;
116
+ /** Non-fatal issues (e.g. font fallback/substitution). */
117
+ warnings?: LayoutWarning[];
118
+ }
119
+ /** A non-fatal issue found while laying out. */
120
+ export interface LayoutWarning {
121
+ /**
122
+ * - `font-fallback` — a later entry in a `fontFamily` fallback list was used.
123
+ * - `font-missing` — no requested family was registered; a substitute was
124
+ * used (only under `onMissingFont: 'substitute'`).
125
+ */
126
+ type: 'font-fallback' | 'font-missing';
127
+ /** The first (preferred) family the run asked for. */
128
+ requested: string;
129
+ /** The family actually used. */
130
+ used: string;
131
+ /** Index of the source run in its paragraph's `children`. */
132
+ runIndex: number;
116
133
  }
117
134
  /** Semantic span for snapshots (without physical metrics) */
118
135
  export interface SemanticFragment {
@@ -1 +1 @@
1
- {"version":3,"file":"LayoutTypes.d.ts","sourceRoot":"","sources":["../../src/types/LayoutTypes.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAI1E,MAAM,WAAW,IAAI;IACnB,yBAAyB;IACzB,CAAC,EAAE,MAAM,CAAC;IACV,0BAA0B;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,4CAA4C;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,mEAAmE;IACnE,SAAS,EAAE,MAAM,CAAC;IAClB,iFAAiF;IACjF,IAAI,EAAE,MAAM,CAAC;IACb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