@betteroffice/docx 0.0.1

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 (190) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +41 -0
  3. package/dist/Subscribable-DOz6Ohoo.d.mts +33 -0
  4. package/dist/agent/index.d.mts +531 -0
  5. package/dist/agent/index.mjs +1 -0
  6. package/dist/chunk-34K66SY4.mjs +1 -0
  7. package/dist/chunk-3UBMCDME.mjs +1 -0
  8. package/dist/chunk-4RCISPPE.mjs +1 -0
  9. package/dist/chunk-4UD54UM5.mjs +1 -0
  10. package/dist/chunk-52GB3Y42.mjs +1 -0
  11. package/dist/chunk-6NEKRDXF.mjs +1 -0
  12. package/dist/chunk-6PW4CWUG.mjs +1 -0
  13. package/dist/chunk-7DEIW7FL.mjs +1 -0
  14. package/dist/chunk-7PCO5I2O.mjs +1 -0
  15. package/dist/chunk-BI3B33LI.mjs +1 -0
  16. package/dist/chunk-BIQWVK5P.mjs +2 -0
  17. package/dist/chunk-CIRN3LZA.mjs +1 -0
  18. package/dist/chunk-DXKG3HQ5.mjs +16 -0
  19. package/dist/chunk-EUUIJVM6.mjs +0 -0
  20. package/dist/chunk-FPZBTOD6.mjs +1 -0
  21. package/dist/chunk-FZIA7OFY.mjs +1 -0
  22. package/dist/chunk-GWKJ2Y4Y.mjs +1 -0
  23. package/dist/chunk-H3JCIGWK.mjs +1 -0
  24. package/dist/chunk-HJGAQIU7.mjs +2 -0
  25. package/dist/chunk-I6KKMUUC.mjs +1 -0
  26. package/dist/chunk-IL5JZJT7.mjs +1 -0
  27. package/dist/chunk-JY6ILTNS.mjs +1 -0
  28. package/dist/chunk-KEE52TT5.mjs +1 -0
  29. package/dist/chunk-KVKLLTDP.mjs +58 -0
  30. package/dist/chunk-KXNZFTTK.mjs +1 -0
  31. package/dist/chunk-L5ISVQ3W.mjs +1 -0
  32. package/dist/chunk-LDUWIM7M.mjs +1 -0
  33. package/dist/chunk-N5Q3YN64.mjs +1 -0
  34. package/dist/chunk-NEWOMDTX.mjs +1 -0
  35. package/dist/chunk-O2QSE2I7.mjs +1 -0
  36. package/dist/chunk-OBQGPMPQ.mjs +1 -0
  37. package/dist/chunk-OJOHXQNQ.mjs +1 -0
  38. package/dist/chunk-OMR3TWCD.mjs +2 -0
  39. package/dist/chunk-P3KDV4M2.mjs +1 -0
  40. package/dist/chunk-Q7PO7V73.mjs +1 -0
  41. package/dist/chunk-QOUFE3VX.mjs +1 -0
  42. package/dist/chunk-SINEY6ZF.mjs +1 -0
  43. package/dist/chunk-T4EZMUXM.mjs +1 -0
  44. package/dist/chunk-TTRUPDAB.mjs +1 -0
  45. package/dist/chunk-TYHI7RAD.mjs +1 -0
  46. package/dist/chunk-UIEJWORW.mjs +1 -0
  47. package/dist/chunk-VAOUFAUH.mjs +1 -0
  48. package/dist/chunk-VBOTMRXV.mjs +1 -0
  49. package/dist/chunk-VCER63GQ.mjs +1 -0
  50. package/dist/chunk-WAUF2UC7.mjs +2 -0
  51. package/dist/chunk-WRWRCBLK.mjs +1 -0
  52. package/dist/chunk-X4XDO3LZ.mjs +1 -0
  53. package/dist/chunk-XQBCCJBO.mjs +9 -0
  54. package/dist/chunk-XWUOLYRQ.mjs +2 -0
  55. package/dist/chunk-XYH6XWP3.mjs +10 -0
  56. package/dist/chunk-YBIM6UJV.mjs +8 -0
  57. package/dist/chunk-YCIH2Q3E.mjs +1 -0
  58. package/dist/chunk-YUOKI2HB.mjs +1 -0
  59. package/dist/chunk-ZOV5KL7C.mjs +1 -0
  60. package/dist/colorResolver-n0o7H7ep.d.mts +290 -0
  61. package/dist/content-sSHuWw49.d.mts +2202 -0
  62. package/dist/core-plugins.d.mts +37 -0
  63. package/dist/core-plugins.mjs +1 -0
  64. package/dist/core.d.mts +451 -0
  65. package/dist/core.mjs +1 -0
  66. package/dist/displayListQueries-p-ijSzdh.d.mts +222 -0
  67. package/dist/docx/index.d.mts +618 -0
  68. package/dist/docx/index.mjs +2 -0
  69. package/dist/docx/parser.d.mts +41 -0
  70. package/dist/docx/parser.mjs +1 -0
  71. package/dist/docx/rezip.d.mts +148 -0
  72. package/dist/docx/rezip.mjs +1 -0
  73. package/dist/docx/serializer/index.d.mts +42 -0
  74. package/dist/docx/serializer/index.mjs +1 -0
  75. package/dist/docx/wrapTypes.d.mts +19 -0
  76. package/dist/docx/wrapTypes.mjs +1 -0
  77. package/dist/docxInput-DTbCa48g.d.mts +21 -0
  78. package/dist/editor/index.d.mts +170 -0
  79. package/dist/editor/index.mjs +1 -0
  80. package/dist/editorTree-DO5PyDK8.d.mts +37 -0
  81. package/dist/executor-7O2RBJ2B.mjs +1 -0
  82. package/dist/fontLoader-Bx6DK6-2.d.mts +327 -0
  83. package/dist/formatting-DoL7KBSL.d.mts +823 -0
  84. package/dist/generated/edit/docx_edit_bg.wasm +0 -0
  85. package/dist/generated/layout/docx_layout_bg.wasm +0 -0
  86. package/dist/generated/opc/ooxml_opc_bg.wasm +0 -0
  87. package/dist/generated/parse/docx_parse_bg.wasm +0 -0
  88. package/dist/headerFooterLayout-0zPT64Qc.d.mts +316 -0
  89. package/dist/headless.d.mts +69 -0
  90. package/dist/headless.mjs +1 -0
  91. package/dist/layout/flow/index.d.mts +149 -0
  92. package/dist/layout/flow/index.mjs +1 -0
  93. package/dist/layout/index.d.mts +307 -0
  94. package/dist/layout/index.mjs +1 -0
  95. package/dist/layout/measure/index.d.mts +324 -0
  96. package/dist/layout/measure/index.mjs +1 -0
  97. package/dist/layout/pagination/index.d.mts +60 -0
  98. package/dist/layout/pagination/index.mjs +1 -0
  99. package/dist/layout/pagination/types.d.mts +4 -0
  100. package/dist/layout/pagination/types.mjs +1 -0
  101. package/dist/layout/render/index.d.mts +733 -0
  102. package/dist/layout/render/index.mjs +1 -0
  103. package/dist/loadWasmAsset-CMvnVkfA.d.mts +3 -0
  104. package/dist/managers/AutoSaveManager.d.mts +81 -0
  105. package/dist/managers/AutoSaveManager.mjs +1 -0
  106. package/dist/managers/TableSelectionManager.d.mts +74 -0
  107. package/dist/managers/TableSelectionManager.mjs +1 -0
  108. package/dist/managers/types.d.mts +113 -0
  109. package/dist/managers/types.mjs +0 -0
  110. package/dist/mcp-cli.mjs +142 -0
  111. package/dist/mcp.d.mts +162 -0
  112. package/dist/mcp.mjs +16 -0
  113. package/dist/measureBlocksPipeline-Df0Bbrwy.d.mts +109 -0
  114. package/dist/measuredBlock-DZwz8zhD.d.mts +26 -0
  115. package/dist/plugin-api/RenderedDomContext.d.mts +114 -0
  116. package/dist/plugin-api/RenderedDomContext.mjs +1 -0
  117. package/dist/plugin-api/index.d.mts +7 -0
  118. package/dist/plugin-api/index.mjs +0 -0
  119. package/dist/plugin-api/resolveItemPositions.d.mts +39 -0
  120. package/dist/plugin-api/resolveItemPositions.mjs +1 -0
  121. package/dist/plugin-api/types.d.mts +193 -0
  122. package/dist/plugin-api/types.mjs +0 -0
  123. package/dist/processTemplate-HDUIZFJ5.mjs +1 -0
  124. package/dist/registry-DMM5VTdT.d.mts +165 -0
  125. package/dist/rustDisplayList-dqunvwxH.d.mts +1036 -0
  126. package/dist/rustPagination-Bj2hq013.d.mts +106 -0
  127. package/dist/sectionConfigs-DW3J8q0X.d.mts +55 -0
  128. package/dist/selectionContext-Buc9BCU1.d.mts +570 -0
  129. package/dist/selectiveSave-oFBJ1n71.d.mts +16 -0
  130. package/dist/selectiveXmlPatch-ypkxlTD_.d.mts +23 -0
  131. package/dist/settingsParser-CcGvtmCK.d.mts +33 -0
  132. package/dist/styles/index.d.mts +162 -0
  133. package/dist/styles/index.mjs +1 -0
  134. package/dist/styles-VxNcXLdi.d.mts +189 -0
  135. package/dist/types/agentApi.d.mts +456 -0
  136. package/dist/types/agentApi.mjs +1 -0
  137. package/dist/types/content.d.mts +3 -0
  138. package/dist/types/content.mjs +1 -0
  139. package/dist/types/document.d.mts +117 -0
  140. package/dist/types/document.mjs +1 -0
  141. package/dist/types-DNrYr6yQ.d.mts +1754 -0
  142. package/dist/types-dYdjUZMo.d.mts +311 -0
  143. package/dist/units-O5Y02RKQ.d.mts +34 -0
  144. package/dist/utils/autoScroll.d.mts +24 -0
  145. package/dist/utils/autoScroll.mjs +1 -0
  146. package/dist/utils/cardStyles.d.mts +22 -0
  147. package/dist/utils/cardStyles.mjs +1 -0
  148. package/dist/utils/comments.d.mts +120 -0
  149. package/dist/utils/comments.mjs +4 -0
  150. package/dist/utils/findReplace.d.mts +114 -0
  151. package/dist/utils/findReplace.mjs +2 -0
  152. package/dist/utils/findVerticalScrollParent.d.mts +25 -0
  153. package/dist/utils/findVerticalScrollParent.mjs +1 -0
  154. package/dist/utils/fontOptions.d.mts +21 -0
  155. package/dist/utils/fontOptions.mjs +1 -0
  156. package/dist/utils/headingCollector.d.mts +28 -0
  157. package/dist/utils/headingCollector.mjs +1 -0
  158. package/dist/utils/highlightColors.d.mts +14 -0
  159. package/dist/utils/highlightColors.mjs +1 -0
  160. package/dist/utils/index.d.mts +956 -0
  161. package/dist/utils/index.mjs +84 -0
  162. package/dist/utils/listState.d.mts +27 -0
  163. package/dist/utils/listState.mjs +1 -0
  164. package/dist/utils/reportIssue.d.mts +23 -0
  165. package/dist/utils/reportIssue.mjs +2 -0
  166. package/dist/utils/sidebarConstants.d.mts +10 -0
  167. package/dist/utils/sidebarConstants.mjs +1 -0
  168. package/dist/utils/stylePreview.d.mts +70 -0
  169. package/dist/utils/stylePreview.mjs +1 -0
  170. package/dist/utils/textSelection.d.mts +92 -0
  171. package/dist/utils/textSelection.mjs +1 -0
  172. package/dist/utils/units.d.mts +78 -0
  173. package/dist/utils/units.mjs +1 -0
  174. package/dist/variableDetector-Borj29SF.d.mts +115 -0
  175. package/dist/wasm-FZQ5XB2Y.mjs +1 -0
  176. package/dist/wasm-SA237OSP.mjs +1 -0
  177. package/dist/wasm-edit.d.mts +473 -0
  178. package/dist/wasm-edit.mjs +1 -0
  179. package/dist/wasm-layout.d.mts +112 -0
  180. package/dist/wasm-layout.mjs +1 -0
  181. package/dist/wasm-opc.d.mts +16 -0
  182. package/dist/wasm-opc.mjs +1 -0
  183. package/dist/wasm-parse.d.mts +18 -0
  184. package/dist/wasm-parse.mjs +1 -0
  185. package/dist/watermarkApi-DCxjutkg.d.mts +38 -0
  186. package/dist/yrs/index.d.mts +882 -0
  187. package/dist/yrs/index.mjs +1 -0
  188. package/dist/yrs/residentEngineWorker.d.mts +2 -0
  189. package/dist/yrs/residentEngineWorker.mjs +1 -0
  190. package/package.json +365 -0
@@ -0,0 +1,733 @@
1
+ import { b as DisplayPage, c as DisplayPrimitive, D as DisplayList, G as GlyphRunPrimitive, L as LinePrimitive, T as TextRunPrimitive } from '../../rustDisplayList-dqunvwxH.mjs';
2
+ export { d as DecodedFrameDelta, e as DecorationPrimitive, f as DisplayBounds, g as DisplayListBuildInputs, a as DisplayListHeadersFooters, h as DisplayListHfVariant, i as DisplayListPictureWatermark, j as DisplayListTextWatermark, k as DisplayListWatermark, l as DocAttrs, F as FRAME_DELTA_HEADER_BYTES, m as FRAME_DELTA_PAGE_OP_BYTES, n as FRAME_DELTA_VERSION, o as FrameDeltaError, p as FrameDeltaErrorCode, q as FramePageOperation, H as HfRegion, I as ImagePrimitive, P as PositionedGlyph, r as RectPrimitive, s as RetainedFrame, t as RetainedFramePage, u as RustDisplayFrameResult, v as RustDisplayListEngine, R as RustDisplayListQueryEngine, w as RustDisplayListSourceError, x as RustDisplayListSourceErrorStage, y as TableCellRef, z as applyFrameDelta, A as applyFrameDeltaOwned, B as buildRustDisplayFrame, C as buildRustDisplayList, E as decodeFrameDelta, J as encodeDisplayListFrameExtras, K as loadRustDisplayListQueryEngine } from '../../rustDisplayList-dqunvwxH.mjs';
3
+ import { a as DisplayListQueries, b as DisplayListRegionHit, D as DisplayListRect } from '../../displayListQueries-p-ijSzdh.mjs';
4
+ export { c as DisplayListHitRegion, d as DisplayListImageGeometry, e as DisplayListImageRegion, f as DisplayListParagraphGeometry, g as DisplayListQuerySourceState, h as DisplayListVisualLine, L as LocatedImagePrimitive, R as ResidentDisplayListQueryEngine, i as captureInlinePositionEmuFromDisplayList, j as createDisplayListQueries, k as findImagePrimitiveAtPoint, l as findImagePrimitiveByDocPos } from '../../displayListQueries-p-ijSzdh.mjs';
5
+ import { YrsLoc, YrsSession, YrsRevisionInfo } from '../../yrs/index.mjs';
6
+ import { TrackedChangeEntry } from '../../utils/comments.mjs';
7
+ import '../../types-DNrYr6yQ.mjs';
8
+ import '../../content-sSHuWw49.mjs';
9
+ import '../../formatting-DoL7KBSL.mjs';
10
+ import '../../docx/wrapTypes.mjs';
11
+ import '../../measuredBlock-DZwz8zhD.mjs';
12
+ import '../../types/document.mjs';
13
+ import '../../styles-VxNcXLdi.mjs';
14
+ import '../../settingsParser-CcGvtmCK.mjs';
15
+
16
+ /** a cached glyph: its outline path (font units) plus the font's units-per-em. */
17
+ interface GlyphOutline {
18
+ /**
19
+ * the glyph contours as a Path2D in font units, or `null` when the glyph has
20
+ * no visible contours (space/whitespace) — the backend skips null paths.
21
+ */
22
+ path: Path2D | null;
23
+ /** the font's units-per-em; the backend scales the path by `size`/upem. */
24
+ upem: number;
25
+ }
26
+ /** fetch a glyph's outline as JSON — `outlineGlyphJson` in production, a fake in tests. */
27
+ type GlyphOutlineProvider = (fontId: number, glyphId: number) => string;
28
+ interface GlyphCacheOptions {
29
+ /** outline source; throws/invalid JSON propagate to the caller (fallback). */
30
+ provider: GlyphOutlineProvider;
31
+ /** max cached glyphs before LRU eviction (default 4096). */
32
+ maxEntries?: number;
33
+ /**
34
+ * Path2D factory — injectable so tests (and non-DOM environments) can supply
35
+ * a recording double. Defaults to the browser `Path2D` constructor.
36
+ */
37
+ createPath?: () => Path2D;
38
+ }
39
+ /**
40
+ * LRU cache keyed `(fontId, glyphId)` → `GlyphOutline`. `Map` preserves
41
+ * insertion order, so the oldest key is `keys().next()` and touching an entry
42
+ * is delete-then-set (reinsert at the tail).
43
+ */
44
+ declare class GlyphCache {
45
+ private readonly provider;
46
+ private readonly maxEntries;
47
+ private readonly createPath;
48
+ private readonly entries;
49
+ constructor(options: GlyphCacheOptions);
50
+ /** number of cached glyphs (for tests / eviction assertions). */
51
+ get size(): number;
52
+ /**
53
+ * Outline for one glyph, building and caching it on first request. Throws if
54
+ * the provider throws or returns unparseable JSON — the caller falls back.
55
+ */
56
+ get(fontId: number, glyphId: number): GlyphOutline;
57
+ private build;
58
+ }
59
+
60
+ /**
61
+ * Lazy accessor for the embedded wasm glyph-outline provider — the production
62
+ * source a canvas host feeds to {@link GlyphCache}.
63
+ *
64
+ * Reached through the SAME dynamic `import('../wasm/index')` specifier the
65
+ * display-list builder (`buildRustDisplayList`) and the measure engine
66
+ * (`getRustTextEngine`) use, so all three resolve to ONE wasm module instance —
67
+ * i.e. one measurement `FontStore`. That shared identity is load-bearing:
68
+ * `outlineGlyphJson(fontId, glyphId)` must read glyph outlines from the very
69
+ * store `registerMeasureFont` populated during measurement, otherwise the ids
70
+ * in a GlyphRun would resolve against an empty store and every glyph would
71
+ * rasterize as `.notdef`. Keeping the import dynamic also keeps the ~800KB
72
+ * inlined wasm out of the default bundle (see `layout/wasm/index.ts`).
73
+ *
74
+ * @experimental part of the rust-canvas-engine glyph pipeline; shape may evolve.
75
+ */
76
+
77
+ /**
78
+ * Resolve the wasm-backed {@link GlyphOutlineProvider} (`outlineGlyphJson`).
79
+ * The returned function is synchronous and initializes the wasm instance on
80
+ * first call; it throws when the embedded module lacks the `outline_glyph_json`
81
+ * export, which the canvas backend catches and repaints the run via `fillText`
82
+ * so text is never invisible. Shares the module promise with the display-list
83
+ * builder, so on the canvas path the wasm is already resolved by the time the
84
+ * first display list lands.
85
+ */
86
+ declare function loadGlyphOutlineProvider(): Promise<GlyphOutlineProvider>;
87
+
88
+ declare const MIRROR_CLASS_NAMES: {
89
+ page: string;
90
+ content: string;
91
+ header: string;
92
+ footer: string;
93
+ block: string;
94
+ table: string;
95
+ tableRow: string;
96
+ tableCell: string;
97
+ text: string;
98
+ rect: string;
99
+ image: string;
100
+ shape: string;
101
+ chart: string;
102
+ decoration: string;
103
+ line: string;
104
+ pageBorder: string;
105
+ tableCut: string;
106
+ blockSdt: string;
107
+ inlineSdtWidget: string;
108
+ revisionPmark: string;
109
+ revisionPmarkGlyph: string;
110
+ revisionPmarkIns: string;
111
+ revisionPmarkDel: string;
112
+ listMarker: string;
113
+ revisionTable: string;
114
+ revisionRow: string;
115
+ revisionCell: string;
116
+ revisionIns: string;
117
+ revisionDel: string;
118
+ revisionMerge: string;
119
+ notes: string;
120
+ note: string;
121
+ noteBacklink: string;
122
+ };
123
+ /**
124
+ * screen-reader labels for the mirror's structural wrappers. all strings are
125
+ * user-facing — hosts pass localized values (React adapter: `t('a11y.*')`);
126
+ * core deliberately ships no English defaults so no locale bypasses i18n.
127
+ */
128
+ interface MirrorLabels {
129
+ /** page container label, e.g. "Page 3" */
130
+ page?: string;
131
+ /** header band label, e.g. "Page header" */
132
+ header?: string;
133
+ /** footer band label, e.g. "Page footer" */
134
+ footer?: string;
135
+ /**
136
+ * note→reference backlink label, e.g. "Back to reference". Optional: without
137
+ * it the backlink anchor falls back to the note's own label (a number, not
138
+ * hardcoded English), so no locale bypasses i18n.
139
+ */
140
+ noteBacklink?: string;
141
+ }
142
+ interface BuildMirrorPageOptions {
143
+ /** document to create elements in (default: global document) */
144
+ document?: Document;
145
+ /** localized aria-labels for page/header/footer wrappers */
146
+ labels?: MirrorLabels;
147
+ }
148
+ /**
149
+ * build the mirror DOM for one display page: an invisible (opacity 0,
150
+ * pointer-events none) absolutely-positioned tree whose elements sit at the
151
+ * exact page-local coordinates of their display primitives, carry the painter
152
+ * dataset contract, and expose real text nodes in reading order for
153
+ * accessibility. primitives sharing a blockId group under one block wrapper
154
+ * (role=paragraph, or role=table with row/cell structure when primitives
155
+ * carry `cell` grid coordinates) stamped with the union of the children's doc
156
+ * range; blockless primitives (table borders, separators) attach directly to
157
+ * `.layout-page-content`.
158
+ *
159
+ * header/footer regions mirror the painter's structural classes: each HfRegion
160
+ * becomes a `.layout-page-header` / `.layout-page-footer` wrapper at the band's
161
+ * page-local y, and all of the region's primitives (including their block
162
+ * wrappers and doc-range attrs, which refer to the HF PM doc identified by
163
+ * `data-hf-rid`) stay scoped inside it — never under `.layout-page-content`.
164
+ *
165
+ * data-from-line/to-line ride on paragraph fragment primitives (body, HF, text
166
+ * box) and land on the paragraph wrapper; data-vmerge-continuation comes from
167
+ * the cell's `continuation` flag and lands on the ARIA cell. still not derivable
168
+ * from the v0 display list and therefore not emitted: data-carried-from-prev/
169
+ * to-next (display-list contract gap — see openspec/changes/rust-canvas-engine).
170
+ */
171
+ declare function buildMirrorPage(page: DisplayPage, options?: BuildMirrorPageOptions): HTMLElement;
172
+
173
+ /**
174
+ * Framework-neutral interactive overlay for canvas-rendered content controls.
175
+ *
176
+ * The accessibility mirror must remain invisible and pointer-inert. This module
177
+ * therefore derives a separate, visible DOM layer from the same display-list
178
+ * metadata. React and Vue mount the returned element above a canvas page and
179
+ * keep their existing delegated `.layout-sdt-widget` / repeat handlers.
180
+ *
181
+ * Security: every DOCX-derived string is assigned through `textContent`,
182
+ * `dataset`, or `setAttribute`; no HTML strings are parsed.
183
+ */
184
+
185
+ interface InteractiveOverlayLabels {
186
+ /** Accessible name for a repeating-section add button. */
187
+ addRepeatingItem?: string;
188
+ /** Accessible name for a repeating-section remove button. */
189
+ removeRepeatingItem?: string;
190
+ /** Accessible name used when a control has no authored alias or tag. */
191
+ control?: string;
192
+ }
193
+ interface BuildInteractiveOverlayOptions {
194
+ /** Document used to create elements (default: global `document`). */
195
+ document?: Document;
196
+ /** Host-localized button names. */
197
+ labels?: InteractiveOverlayLabels;
198
+ }
199
+ /** Apply PM-derived content-control focus to the interactive overlay boxes. */
200
+ declare function applyInteractiveSdtFocus(root: ParentNode, focusedGroupIds: ReadonlySet<string>): void;
201
+ /**
202
+ * Build the visible/pointer-active overlay for one page.
203
+ *
204
+ * Coordinates remain page-local CSS pixels. The caller applies the same zoom
205
+ * transform as the canvas and mirror. Boundary boxes themselves never receive
206
+ * pointer events; only real buttons are interactive/focusable.
207
+ */
208
+ declare function buildInteractiveOverlayPage(page: DisplayPage, options?: BuildInteractiveOverlayOptions): HTMLElement;
209
+
210
+ /**
211
+ * Resolves an image relationship id to a drawable source. Media decode stays
212
+ * in the host (browser decoders, object URLs, ImageBitmap caches) — the
213
+ * backend only replays the resolved source at the primitive's rect. Return
214
+ * null (or resolve to null) to skip the image.
215
+ */
216
+ type ImageResolver = (relId: string) => CanvasImageSource | Promise<CanvasImageSource | null> | null;
217
+ interface DrawPageOptions {
218
+ resolveImage?: ImageResolver;
219
+ /**
220
+ * Glyph-outline cache for `glyphRun` primitives (phase-2 shaped text). When
221
+ * absent, or when an outline cannot be resolved, the run is painted with
222
+ * `fillText` so text is never invisible. Owned by the host and reused across
223
+ * pages/renders.
224
+ */
225
+ glyphCache?: GlyphCache;
226
+ }
227
+ /**
228
+ * Minimal structural view of a canvas element for DPR sizing. Matches
229
+ * HTMLCanvasElement without requiring one, so hosts and tests can pass
230
+ * lookalikes.
231
+ */
232
+ interface PageCanvasLike {
233
+ width: number;
234
+ height: number;
235
+ style: {
236
+ width: string;
237
+ height: string;
238
+ };
239
+ }
240
+ type PageCanvasBuffer = HTMLCanvasElement | OffscreenCanvas;
241
+ /**
242
+ * Raster a complete page into a detached backing surface. Callers can prepare
243
+ * every damaged page concurrently, then present the finished buffers in one
244
+ * synchronous pass without ever exposing the renderer's initial clear.
245
+ */
246
+ declare function rasterizeDisplayPageToBackBuffer(canvas: PageCanvasBuffer, page: DisplayPage, options?: DrawPageOptions, devicePixelRatio?: number, zoom?: number): Promise<PageCanvasBuffer>;
247
+ /** Atomically replace one visible canvas with a fully rastered page buffer. */
248
+ declare function presentDisplayPageBackBuffer(canvas: PageCanvasBuffer, buffer: PageCanvasBuffer, page: DisplayPage, zoom?: number): void;
249
+ /** Zero-copy atomic presentation for a worker-owned transferred canvas. */
250
+ declare function presentOffscreenPageBackBuffer(canvas: OffscreenCanvas, buffer: OffscreenCanvas): void;
251
+ /**
252
+ * DPR- and zoom-aware canvas sizing: the bitmap is the page's logical px size
253
+ * times `devicePixelRatio * zoom`, the CSS box is the page size times `zoom`
254
+ * (so the page physically grows with the zoom control, mirroring the DOM
255
+ * painter's `transform: scale`), and the context is scaled by the same factor
256
+ * so all drawing keeps using page-local px coordinates. Rastering at
257
+ * `zoom * DPR` — rather than CSS-scaling a `zoom=1` bitmap — is what keeps text
258
+ * and vector outlines crisp when zoomed: glyph `Path2D` fills re-rasterize at
259
+ * the higher backing resolution instead of being upsampled. `zoom` defaults to
260
+ * 1, so the un-zoomed path is byte-identical to before.
261
+ *
262
+ * Setting canvas.width resets the context state, so call this before drawing
263
+ * (and re-call after any resize/zoom change) — the scale applies to the fresh
264
+ * transform.
265
+ */
266
+ declare function sizeCanvasForPage(canvas: PageCanvasLike, ctx: CanvasRenderingContext2D, page: Pick<DisplayPage, 'width' | 'height'>, devicePixelRatio: number, zoom?: number): void;
267
+ /** Raster every display page without requiring a mounted renderer surface. */
268
+ declare function rasterizeDisplayListPages(list: DisplayList, options?: DrawPageOptions, devicePixelRatio?: number): Promise<HTMLCanvasElement[]>;
269
+ /**
270
+ * Replays one DisplayPage onto a 2D context, honoring primitive paint order.
271
+ * Header/footer bands replay after the body, mirroring the DOM painter's
272
+ * append order in renderPage (content, then header, then footer); their
273
+ * primitives are already in page coordinates so they go through the same
274
+ * replay path. Async only because image sources may resolve lazily; each
275
+ * image is awaited in sequence so later primitives still paint above it.
276
+ * Every primitive sets the full context state it depends on, so no
277
+ * save/restore per primitive is needed (images use save/restore for their
278
+ * rotation transform only).
279
+ */
280
+ declare function drawDisplayPage(ctx: CanvasRenderingContext2D, page: DisplayPage, options?: DrawPageOptions): Promise<void>;
281
+ /** Replays a single primitive; exported for hosts that paint incrementally. */
282
+ declare function drawPrimitive(ctx: CanvasRenderingContext2D, primitive: DisplayPrimitive, options?: DrawPageOptions): Promise<void>;
283
+
284
+ /**
285
+ * Renderer-neutral geometry helpers for display-list primitives.
286
+ *
287
+ * These helpers are shared by canvas replay, interaction queries, the a11y
288
+ * mirror, and the temporary painter/display-list differential harness. They
289
+ * must not depend on DOM layout: every returned rectangle is page-local px.
290
+ */
291
+
292
+ interface GeoRect {
293
+ x: number;
294
+ y: number;
295
+ w: number;
296
+ h: number;
297
+ }
298
+ /** Parse the px size from a CSS font shorthand, with Word's 11pt default. */
299
+ declare function fontSizePxFromShorthand(font: string): number;
300
+ /** Canonical page-local box for a text-run primitive. */
301
+ declare function textRunRect(p: Pick<TextRunPrimitive, 'x' | 'baselineY' | 'width' | 'font'>): GeoRect;
302
+ /** Canonical page-local box for a shaped glyph-run primitive. */
303
+ declare function glyphRunRect(p: Pick<GlyphRunPrimitive, 'glyphs' | 'size'>): GeoRect;
304
+ /** Canonical stroke-expanded page-local box for a line primitive. */
305
+ declare function lineRect(p: Pick<LinePrimitive, 'x1' | 'y1' | 'x2' | 'y2' | 'strokeWidth'>): GeoRect;
306
+
307
+ /**
308
+ * Layout constants + vertical page math for the experimental canvas pages
309
+ * hosts (React `CanvasPagesView` / Vue `CanvasPagesView.vue`): a flex column
310
+ * of one <canvas> per page. Shared by the views themselves and by the
311
+ * display-list consumers that need scroll-container Y coordinates (sidebar
312
+ * anchor positions) so the two can never drift.
313
+ *
314
+ * @experimental part of the rust-canvas-engine change; shape may evolve.
315
+ */
316
+
317
+ /** vertical gap between canvas pages (flex `gap`) */
318
+ declare const CANVAS_PAGE_GAP_PX = 16;
319
+ /** padding around the canvas pages column */
320
+ declare const CANVAS_PAGES_PADDING_PX = 24;
321
+ /**
322
+ * Top Y of each canvas page inside the `.canvas-pages` host, derived from the
323
+ * display list's own page heights. `tops[i] + pageLocalY` converts a
324
+ * display-list rect into host coordinates.
325
+ */
326
+ declare function canvasPageTops(queries: DisplayListQueries): number[];
327
+
328
+ /**
329
+ * Client-coordinate → display-list resolution for the canvas renderer's
330
+ * pointer path. Framework-free: both the React and the Vue adapter route
331
+ * their pointer events through this resolver.
332
+ *
333
+ * The pointer hooks map the client point onto one of the
334
+ * `<canvas data-page-index>` pages, convert it to page-local px (the
335
+ * display list's unit space), and ask the Rust `hit_test_regions` query for
336
+ * the region + doc position.
337
+ *
338
+ * @experimental part of the rust-canvas-engine change; shape may evolve.
339
+ */
340
+
341
+ interface CanvasPointHit {
342
+ pageIndex: number;
343
+ /** page-local px, the display list's unit space */
344
+ x: number;
345
+ y: number;
346
+ /** region-aware hit from the Rust query (null when the engine isn't ready) */
347
+ hit: DisplayListRegionHit | null;
348
+ }
349
+ interface DisplayPageHostOptions {
350
+ /** Vertical space between page shells when the host has no live canvases. */
351
+ pageGap?: number;
352
+ /** Space before the first page when the host has no live canvases. */
353
+ paddingTop?: number;
354
+ }
355
+ interface DisplayPageClientRect {
356
+ left: number;
357
+ top: number;
358
+ right: number;
359
+ bottom: number;
360
+ width: number;
361
+ height: number;
362
+ }
363
+ /**
364
+ * Resolve the client-space shell for one display-list page. A mounted canvas
365
+ * is the preferred projection host. During the Phase-2 transition the DOM
366
+ * painter may still be the visible renderer, so its *container* is used as a
367
+ * page-stack projection host without inspecting any painted page/text/table
368
+ * node. Page sizes remain display-list-owned.
369
+ */
370
+ declare function resolveDisplayPageClientRect(host: HTMLElement, queries: DisplayListQueries, pageIndex: number, options?: DisplayPageHostOptions): DisplayPageClientRect | null;
371
+ /**
372
+ * Resolve a client point against the canvas pages.
373
+ *
374
+ * Containment picks the page; with `clampToNearestPage` (drag-selection) a
375
+ * point outside every page snaps to the vertically nearest one and clamps
376
+ * into its bounds, so drags keep extending past page edges — the analogue of
377
+ * the DOM path's nearest-span snapping. Coordinates convert through the
378
+ * page's CSS rect vs its display-list size, so any ancestor scale transform
379
+ * is factored out.
380
+ */
381
+ declare function resolveCanvasPoint(host: HTMLElement, queries: DisplayListQueries, clientX: number, clientY: number, options?: {
382
+ clampToNearestPage?: boolean;
383
+ pageGap?: number;
384
+ paddingTop?: number;
385
+ }): CanvasPointHit | null;
386
+
387
+ /**
388
+ * Image resolver for the canvas replay backend, shared by both adapters.
389
+ *
390
+ * v0 display lists carry the flow-block image `src` as the primitive's
391
+ * relId — for embedded media that is a blob:/data: URL minted by the parser.
392
+ * Shape picture fills resolve through the same gate via
393
+ * `fillPaint.pictureSrc`. Only those schemes are decoded; anything else
394
+ * (notably remote http urls from external-mode relationships, or a raw
395
+ * unresolved `rId`) resolves to null so opening a document never triggers a
396
+ * network fetch (the no-zero-click-external-fetch security contract). Decode
397
+ * results are cached per source so repaints reuse the same HTMLImageElement.
398
+ *
399
+ * @experimental part of the rust-canvas-engine change; shape may evolve.
400
+ */
401
+
402
+ declare function createCanvasImageResolver(): ImageResolver;
403
+
404
+ /**
405
+ * Selection → live-region announcement derivation for the canvas renderer's
406
+ * accessibility layer. Framework-free: the React `CanvasA11yLiveRegion` and
407
+ * the Vue `CanvasA11yLiveRegion.vue` both derive their announcements here so
408
+ * assistive-tech behavior cannot drift between adapters.
409
+ *
410
+ * The hidden textarea stays the focused editing surface in canvas mode, so
411
+ * character/word echo while the caret moves comes from native input. The live
412
+ * region only announces state *transitions* the visual layer would otherwise
413
+ * communicate silently: a selection appearing or collapsing, the caret
414
+ * entering commented / tracked-change / list content. Edge-triggered on the
415
+ * selection context, so plain typing and uniform caret movement stay silent.
416
+ *
417
+ * @experimental part of the rust-canvas-engine change; shape may evolve.
418
+ */
419
+ interface A11ySelectionContext {
420
+ hasSelection: boolean;
421
+ inInsertion: boolean;
422
+ inDeletion: boolean;
423
+ inList: boolean;
424
+ listLevel?: number;
425
+ activeCommentIds: number[];
426
+ }
427
+ /** The slice of selection context the announcer reacts to. */
428
+ interface A11ySelectionSnapshot {
429
+ hasSelection: boolean;
430
+ inInsertion: boolean;
431
+ inDeletion: boolean;
432
+ hasComment: boolean;
433
+ inList: boolean;
434
+ listLevel: number;
435
+ /** display name of the active comment thread's author, when the host knows it */
436
+ commentAuthor?: string;
437
+ /** reply count of the active comment thread, when the host knows it */
438
+ commentReplyCount?: number;
439
+ }
440
+ /**
441
+ * host-supplied details of the comment thread(s) under the caret, resolved
442
+ * from the same parsed comment model the sidebar uses. All strings are
443
+ * file-derived — the live region renders them as text, never markup.
444
+ */
445
+ interface A11yCommentThreadDetails {
446
+ authorName?: string;
447
+ replyCount?: number;
448
+ }
449
+ declare function snapshotFromSelectionContext(ctx: A11ySelectionContext,
450
+ /** optional lookup so the `commentedText` announcement can carry author/reply vars */
451
+ lookupCommentThread?: (commentIds: number[]) => A11yCommentThreadDetails | undefined): A11ySelectionSnapshot;
452
+ /** i18n key under `a11y.*` plus interpolation vars */
453
+ interface A11yAnnouncement {
454
+ key: 'selected' | 'selectionCleared' | 'commentedText' | 'trackedInsertion' | 'trackedDeletion' | 'listItem';
455
+ vars?: Record<string, string | number>;
456
+ }
457
+ /**
458
+ * announcements for one selection-state transition, in speaking order.
459
+ * `prev === null` (first observation) announces nothing — there is no
460
+ * transition to describe.
461
+ */
462
+ declare function computeA11yAnnouncements(prev: A11ySelectionSnapshot | null, next: A11ySelectionSnapshot): A11yAnnouncement[];
463
+
464
+ /** A yrs location projected into the PM-shaped position space used by the display list. */
465
+ interface YrsSidebarDisplayPoint {
466
+ story: string;
467
+ position: number;
468
+ /** Header/footer relationship id; absent for body and nested body stories. */
469
+ hfRid?: string;
470
+ }
471
+ /** Read-only converter used by the yrs-backed sidebar data sources. */
472
+ interface YrsSidebarProjection {
473
+ locToDisplayPoint(loc: YrsLoc): YrsSidebarDisplayPoint | null;
474
+ storyOffsetToDisplayPoint(story: string, offset: number): YrsSidebarDisplayPoint | null;
475
+ }
476
+ /**
477
+ * Convert a string yrs identity into the numeric id used by the existing
478
+ * layout/sidebar contract. This is the same UTF-8 FNV-1a projection used by
479
+ * the yrs render and Document bridges; numeric OOXML ids pass through.
480
+ */
481
+ declare function yrsIdToNumericId(value: string): number;
482
+ /**
483
+ * Build a lazy PM-free projection from live yrs stories to display positions.
484
+ * The canonical yrs segment stream supplies paragraph/atom units; table-cell
485
+ * and block-SDT stories are recursively sized so container tokens are included.
486
+ */
487
+ declare function createYrsSidebarProjection(session: YrsSession): YrsSidebarProjection;
488
+
489
+ /**
490
+ * Comment / tracked-change anchor derivation over the display list, shared
491
+ * by both adapters' sidebar plumbing on the canvas-renderer path.
492
+ *
493
+ * `visitAnchorKeys` walks the PM doc and reports every comment /
494
+ * tracked-change anchor as `(key, pos)` — shared between each adapter's
495
+ * layout-math derivation (DOM painter path) and the display-list derivation
496
+ * here, so both register identical keys in identical order.
497
+ *
498
+ * @experimental part of the rust-canvas-engine change; shape may evolve.
499
+ */
500
+
501
+ /** Structural view shape used only by the legacy display-list anchor walker. */
502
+ interface AnchorEditorView {
503
+ readonly state: {
504
+ readonly doc: {
505
+ descendants(callback: (node: any, pos: number) => boolean | void): void;
506
+ };
507
+ readonly schema: {
508
+ readonly marks: Record<string, any>;
509
+ };
510
+ };
511
+ }
512
+ /**
513
+ * Walk the PM doc and report every comment / tracked-change anchor as
514
+ * `(key, pos)`. `register` is called once per occurrence; callers dedupe.
515
+ */
516
+ declare function visitAnchorKeys(pmView: AnchorEditorView, register: (key: string, pos: number) => void): void;
517
+ /**
518
+ * Display-list variant of the adapters' layout-based anchor derivation for
519
+ * the experimental canvas renderer: anchor Ys come from Rust `range_rects`
520
+ * queries over the display list (page-local px) plus the canvas page stack
521
+ * math, instead of layout-fragment scans in the DOM viewport's coordinate
522
+ * space. Returns `.canvas-pages`-host Y offsets keyed by
523
+ * `comment-{id}` / `revision-{revisionId}`.
524
+ */
525
+ declare function computeAnchorPositionsFromDisplayList(pmView: AnchorEditorView | null, queries: DisplayListQueries, projectY?: (rect: DisplayListRect) => number | null): Map<string, number>;
526
+ interface YrsHeaderFooterRegions {
527
+ get(rId: string): 'header' | 'footer' | undefined;
528
+ }
529
+ /**
530
+ * yrs-authoritative sidebar anchors. Comment coverage comes from sticky yrs
531
+ * side-map positions and tracked-change anchors come from `listRevisions()`;
532
+ * neither path reads an EditorView or ProseMirror document.
533
+ */
534
+ declare function computeAnchorPositionsFromYrs(session: YrsSession, commentIds: Iterable<string | number>, revisions: readonly YrsRevisionInfo[], projection: YrsSidebarProjection, queries: DisplayListQueries, hfRegions?: YrsHeaderFooterRegions, projectY?: (rect: DisplayListRect) => number | null): Map<string, number>;
535
+ interface DisplayListHfAnchorSource {
536
+ region: 'header' | 'footer';
537
+ rId: string;
538
+ view: AnchorEditorView;
539
+ }
540
+ /** Merge header/footer comment and revision anchors into an existing map. */
541
+ declare function mergeHfAnchorPositionsFromDisplayList(sources: Iterable<DisplayListHfAnchorSource>, queries: DisplayListQueries, positions: Map<string, number>, projectY?: (rect: DisplayListRect) => number | null): Map<string, number>;
542
+
543
+ /** Tracked-change sidebar data derived from the authoritative Yrs session. */
544
+ interface TrackedChangesResult {
545
+ entries: TrackedChangeEntry[];
546
+ commentToRevision: Map<number, number>;
547
+ }
548
+ /** Project Yrs revisions onto the display-position sidebar contract. */
549
+ declare function extractTrackedChangesFromYrs(revisions: readonly YrsRevisionInfo[], projection: YrsSidebarProjection): TrackedChangesResult;
550
+
551
+ /**
552
+ * Derive table-resize handle geometry from a built DisplayList.
553
+ *
554
+ * On the canvas path the DOM painter's `.layout-table-*-handle` elements are
555
+ * parked/hidden, so the canvas table-resize overlay must place its column / row
556
+ * / edge handles from the display list instead. This module walks the list and
557
+ * returns, per painted table fragment, the geometry an adapter needs to mount
558
+ * handles over the visible canvas:
559
+ *
560
+ * - `originX` / `originY` — the fragment's page-local top-left. `originX` is
561
+ * taken from an EXACT edge source (an outer vertical table-border line)
562
+ * whenever one exists, so column handles land on the true column boundary
563
+ * rather than inset by cell padding. Only a fully borderless table falls back
564
+ * to the content bbox minus an estimated inset (documented, approximate).
565
+ * - `bottomY` — the fragment's bottom edge (exact when a bottom border exists,
566
+ * else content bbox bottom).
567
+ * - `rowBands` — per anchor-row content band `{ rowIndex, top, bottom }`,
568
+ * grouped by the `cell.row` carried on every in-cell primitive. Row-boundary
569
+ * handles sit in the gap between consecutive bands, and the `rowIndex` maps
570
+ * straight to `commitRowResize` (robust to vmerge, which suppresses interior
571
+ * border lines but keeps the anchor row on every primitive).
572
+ * - `tableKey` — the caller-supplied identity of the enclosing table; also the
573
+ * handle key the adapter resolves back to the table node.
574
+ *
575
+ * Grouping key: cell content primitives carry each cell-paragraph's block id,
576
+ * NOT the table's, so grouping by block id would split a table into one fragment
577
+ * per cell. The adapter therefore supplies `tableKeyOf`, mapping an in-cell doc
578
+ * position to a stable per-table key (in the React adapter: the enclosing table
579
+ * node's PM `before` position, resolved against the live doc). Primitives whose
580
+ * position doesn't resolve to a table are skipped.
581
+ *
582
+ * Column-boundary x's and the right edge are intentionally NOT computed here:
583
+ * they come from the PM doc's `columnWidths` (twips) anchored at `originX`,
584
+ * which is exact and robust to horizontally-merged cells (colspan suppresses
585
+ * the interior border line the display list would otherwise expose).
586
+ *
587
+ * Body region only. The HF caret + selection on canvas are now sourced from the
588
+ * region-aware `hfRangeRects` / `hfCaretRects` queries (see
589
+ * `CanvasHfSelectionOverlay`), but HF *table* resize handles remain a documented
590
+ * gap: this walker takes `page.primitives` (body), and the overlay's
591
+ * `tableKeyOf` / commit path resolves against the body PM doc. Closing it needs
592
+ * (1) an optional region parameter here to walk `page.header|footer.primitives`,
593
+ * (2) a `tableKeyOf` bound to the active HF EditorView, and (3) the same
594
+ * nearest-viewport page pick the HF caret uses (the part paints on every page).
595
+ * HF tables are rare, so this is deferred.
596
+ *
597
+ * @experimental part of the rust-canvas-engine change; shape may evolve.
598
+ */
599
+
600
+ interface TableRowBand {
601
+ /** 0-based anchor-row index (from `cell.row`) */
602
+ rowIndex: number;
603
+ top: number;
604
+ bottom: number;
605
+ }
606
+ interface DisplayListTableFragment {
607
+ pageIndex: number;
608
+ /** caller-supplied identity of the enclosing table (also the handle key) */
609
+ tableKey: string;
610
+ /** smallest in-cell `docStart` seen for this table on this page */
611
+ docStartSample: number;
612
+ /** page-local left edge (exact when a border exposes it, else approximate) */
613
+ originX: number;
614
+ /** page-local top edge of the fragment's content */
615
+ originY: number;
616
+ /** page-local bottom edge of the fragment's content */
617
+ bottomY: number;
618
+ /** true when `originX` came from an exact edge source (border line) */
619
+ originExact: boolean;
620
+ /** per anchor-row content bands, ascending by `rowIndex` */
621
+ rowBands: TableRowBand[];
622
+ }
623
+ /** Resolve an in-cell doc position to its enclosing table's stable key, or null. */
624
+ type TableKeyResolver = (docStart: number | undefined) => string | null;
625
+ type DisplayListTableRegion = {
626
+ kind?: 'body';
627
+ rId?: undefined;
628
+ } | {
629
+ kind: 'header' | 'footer';
630
+ rId?: string | null;
631
+ };
632
+ interface DisplayListSelectedCellSpec {
633
+ /** caller-supplied identity of the enclosing table */
634
+ tableKey: string;
635
+ row: number;
636
+ col: number;
637
+ rowSpan: number;
638
+ colSpan: number;
639
+ }
640
+ interface DisplayListSelectedCellRect {
641
+ pageIndex: number;
642
+ tableKey: string;
643
+ row: number;
644
+ col: number;
645
+ rowSpan: number;
646
+ colSpan: number;
647
+ x: number;
648
+ y: number;
649
+ w: number;
650
+ h: number;
651
+ exact: boolean;
652
+ region: 'body' | 'header' | 'footer';
653
+ rId?: string;
654
+ }
655
+ interface DisplayListTableInsertHoverInput {
656
+ list: DisplayList;
657
+ pageIndex: number;
658
+ /** Page-local pointer x/y in display-list px. */
659
+ x: number;
660
+ y: number;
661
+ /** Client-space canvas rect for `pageIndex`, used to return DOM-path anchors. */
662
+ canvasRect: Pick<DOMRect, 'left' | 'top' | 'width' | 'height'>;
663
+ /** Display-list page size for `pageIndex`. */
664
+ pageSize: {
665
+ width: number;
666
+ height: number;
667
+ };
668
+ tableKeyOf: TableKeyResolver;
669
+ /** Resolve a table grid cell to its PM cell-start position. */
670
+ cellPmPosOf: (tableKey: string, row: number, col: number) => number | null;
671
+ region?: DisplayListTableRegion;
672
+ edgeProximity?: number;
673
+ }
674
+ interface DisplayListTableInsertHoverHit {
675
+ type: 'row' | 'column';
676
+ clientX: number;
677
+ clientY: number;
678
+ cellPmPos: number;
679
+ }
680
+ declare const DISPLAY_LIST_TABLE_INSERT_HIDE_DELAY_MS = 200;
681
+ /**
682
+ * All body table fragments across every page of the display list, each with the
683
+ * geometry an adapter needs to mount canvas resize handles. `tableKeyOf` maps an
684
+ * in-cell doc position to its enclosing table's stable key (see module docs).
685
+ */
686
+ declare function deriveDisplayListTableFragments(list: DisplayList, tableKeyOf: TableKeyResolver): DisplayListTableFragment[];
687
+ /**
688
+ * Full selected-cell boxes for canvas overlays.
689
+ *
690
+ * The DOM painter highlights `.layout-table-cell` elements directly; in canvas
691
+ * mode those cells are parked, so adapters pass the live PM CellSelection as
692
+ * grid coordinates and this helper resolves visible page-local boxes from the
693
+ * display-list table geometry. Border lines provide exact grid edges when
694
+ * present; borderless fragments fall back to the selected cell's content bbox
695
+ * padded by the same conservative inset used by table-resize geometry.
696
+ */
697
+ declare function deriveDisplayListSelectedCellRects(list: DisplayList, selectedCells: DisplayListSelectedCellSpec[], tableKeyOf: TableKeyResolver, region?: DisplayListTableRegion): DisplayListSelectedCellRect[];
698
+ /**
699
+ * Canvas/display-list version of the table insert "+" hover detector.
700
+ *
701
+ * Mirrors `detectTableInsertHover`'s edge threshold and button offsets, but
702
+ * reads table/cell boxes from display-list geometry because the painter DOM is
703
+ * parked while canvas is active.
704
+ */
705
+ declare function detectDisplayListTableInsertHover(input: DisplayListTableInsertHoverInput): DisplayListTableInsertHoverHit | null;
706
+
707
+ interface DisplayListHyperlinkHit {
708
+ pageIndex: number;
709
+ region: 'body' | 'header' | 'footer';
710
+ rId?: string;
711
+ href: string;
712
+ tooltip?: string;
713
+ displayText: string;
714
+ rect: GeoRect;
715
+ }
716
+ declare function findDisplayListHyperlinkAtPoint(list: DisplayList, pageIndex: number, x: number, y: number, region?: DisplayListTableRegion): DisplayListHyperlinkHit | null;
717
+
718
+ /**
719
+ * Display-list rendering surface: the renderer-agnostic contract between
720
+ * layout output and every backend, plus the web canvas replay backend.
721
+ *
722
+ * @experimental The display-list pipeline is under active development
723
+ * (rust-canvas-engine change); shape may evolve while the Rust builder lands.
724
+ */
725
+
726
+ /**
727
+ * Demo display list used as the default provider value until the Rust
728
+ * display-list builder plugs in. One page, one paragraph of two runs with a
729
+ * highlight and underline, a table border line, and an image reference.
730
+ */
731
+ declare const demoDisplayList: DisplayList;
732
+
733
+ export { type A11yAnnouncement, type A11yCommentThreadDetails, type A11ySelectionSnapshot, type AnchorEditorView, type BuildInteractiveOverlayOptions, type BuildMirrorPageOptions, CANVAS_PAGES_PADDING_PX, CANVAS_PAGE_GAP_PX, type CanvasPointHit, DISPLAY_LIST_TABLE_INSERT_HIDE_DELAY_MS, DisplayList, type DisplayListHfAnchorSource, type DisplayListHyperlinkHit, DisplayListQueries, DisplayListRect, DisplayListRegionHit, type DisplayListSelectedCellRect, type DisplayListSelectedCellSpec, type DisplayListTableFragment, type DisplayListTableInsertHoverHit, type DisplayListTableInsertHoverInput, type DisplayListTableRegion, DisplayPage, type DisplayPageClientRect, type DisplayPageHostOptions, DisplayPrimitive, type DrawPageOptions, type GeoRect, GlyphCache, type GlyphCacheOptions, type GlyphOutline, type GlyphOutlineProvider, GlyphRunPrimitive, type ImageResolver, type InteractiveOverlayLabels, LinePrimitive, MIRROR_CLASS_NAMES, type MirrorLabels, type PageCanvasBuffer, type PageCanvasLike, type TableKeyResolver, type TableRowBand, TextRunPrimitive, type TrackedChangesResult, type YrsHeaderFooterRegions, type YrsSidebarDisplayPoint, type YrsSidebarProjection, applyInteractiveSdtFocus, buildInteractiveOverlayPage, buildMirrorPage, canvasPageTops, computeA11yAnnouncements, computeAnchorPositionsFromDisplayList, computeAnchorPositionsFromYrs, createCanvasImageResolver, createYrsSidebarProjection, demoDisplayList, deriveDisplayListSelectedCellRects, deriveDisplayListTableFragments, detectDisplayListTableInsertHover, drawDisplayPage, drawPrimitive, extractTrackedChangesFromYrs, findDisplayListHyperlinkAtPoint, fontSizePxFromShorthand, glyphRunRect, lineRect, loadGlyphOutlineProvider, mergeHfAnchorPositionsFromDisplayList, presentDisplayPageBackBuffer, presentOffscreenPageBackBuffer, rasterizeDisplayListPages, rasterizeDisplayPageToBackBuffer, resolveCanvasPoint, resolveDisplayPageClientRect, sizeCanvasForPage, snapshotFromSelectionContext, textRunRect, visitAnchorKeys, yrsIdToNumericId };