@betteroffice/docx 0.4.2 → 0.5.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 (124) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +108 -598
  3. package/dist/chunk-25WGDXBF.mjs +1 -0
  4. package/dist/chunk-2CCPNW44.mjs +1 -0
  5. package/dist/chunk-32A4I3T4.mjs +1 -0
  6. package/dist/chunk-4LO3PSLZ.mjs +2 -0
  7. package/dist/chunk-67MGRMP3.mjs +1 -0
  8. package/dist/chunk-6AUR4AA2.mjs +1 -0
  9. package/dist/chunk-6WT6HKAY.mjs +1 -0
  10. package/dist/chunk-77ZWGQZN.mjs +1 -0
  11. package/dist/chunk-7C3Y7LIH.mjs +1 -0
  12. package/dist/chunk-7WIUNGQW.mjs +1 -0
  13. package/dist/chunk-7WWFGMMF.mjs +1 -0
  14. package/dist/chunk-AK2NG7PT.mjs +1 -0
  15. package/dist/chunk-BR5BFOHF.mjs +1 -0
  16. package/dist/chunk-CDNWHQH2.mjs +1 -0
  17. package/dist/chunk-CRTTEHZN.mjs +1 -0
  18. package/dist/chunk-ETDMQ5GE.mjs +1 -0
  19. package/dist/{wasm-QXYYV7LU.mjs → chunk-GBOHQ3CJ.mjs} +1 -1
  20. package/dist/chunk-H7K4SJKK.mjs +1 -0
  21. package/dist/chunk-ICJH7QUY.mjs +1 -0
  22. package/dist/chunk-IHETKRDA.mjs +1 -0
  23. package/dist/chunk-ISBZLVIF.mjs +1 -0
  24. package/dist/chunk-JSYH6HNV.mjs +2 -0
  25. package/dist/chunk-KICHSQFN.mjs +1 -0
  26. package/dist/chunk-KXIGXLFA.mjs +5 -0
  27. package/dist/chunk-KXLTK7AT.mjs +57 -0
  28. package/dist/chunk-L3JRNJ34.mjs +1 -0
  29. package/dist/chunk-LKDHP22R.mjs +1 -0
  30. package/dist/chunk-LPOEM5WH.mjs +1 -0
  31. package/dist/chunk-M44BABH2.mjs +1 -0
  32. package/dist/chunk-MAYPJU23.mjs +1 -0
  33. package/dist/chunk-N5RE2S3U.mjs +2 -0
  34. package/dist/chunk-NLYHFVF5.mjs +1 -0
  35. package/dist/chunk-ONYCW7VV.mjs +4 -0
  36. package/dist/chunk-QGZ2AB3M.mjs +1 -0
  37. package/dist/chunk-QWHU7YIW.mjs +2 -0
  38. package/dist/{chunk-VH7P4734.mjs → chunk-QX2CDKPG.mjs} +1 -1
  39. package/dist/chunk-RGDE6YQB.mjs +1 -0
  40. package/dist/chunk-TE3AU2JK.mjs +1 -0
  41. package/dist/chunk-UDVEZ722.mjs +1 -0
  42. package/dist/chunk-UQSVFDRV.mjs +2 -0
  43. package/dist/chunk-VHOOSS4D.mjs +1 -0
  44. package/dist/chunk-WIDM4EMT.mjs +1 -0
  45. package/dist/chunk-YITJ4QAO.mjs +1 -0
  46. package/dist/collaboration/index.d.mts +111 -11
  47. package/dist/collaboration/index.mjs +1 -1
  48. package/dist/{content-DSb-6a9T.d.mts → content-DVT06V_6.d.mts} +24 -3
  49. package/dist/core.d.mts +9 -9
  50. package/dist/core.mjs +1 -1
  51. package/dist/displayListQueries-6XjS7B5e.d.mts +1473 -0
  52. package/dist/docx/index.d.mts +8 -7
  53. package/dist/docx/index.mjs +1 -2
  54. package/dist/docxWorker.mjs +1 -0
  55. package/dist/editor/index.d.mts +14 -12
  56. package/dist/editor/index.mjs +1 -1
  57. package/dist/{fontLoader-BNSs0E8K.d.mts → fontLoader-CBkmh4ps.d.mts} +1 -1
  58. package/dist/{formatting-gqLFeJ9X.d.mts → formatting-p5MneNuy.d.mts} +32 -1
  59. package/dist/generated/edit/docx_edit_bg.wasm +0 -0
  60. package/dist/generated/layout/docx_layout_bg.wasm +0 -0
  61. package/dist/generated/opc/ooxml_opc_bg.wasm +0 -0
  62. package/dist/generated/parse/docx_parse_bg.wasm +0 -0
  63. package/dist/index-C-KKULi5.d.mts +5596 -0
  64. package/dist/layout/index.d.mts +4 -4
  65. package/dist/layout/index.mjs +1 -1
  66. package/dist/layout/pagination/index.d.mts +4 -4
  67. package/dist/layout/render/index.d.mts +37 -53
  68. package/dist/layout/render/index.mjs +3 -1
  69. package/dist/{pagedExport-BmSlEhoP.d.mts → pagedExport-DDgA5O7E.d.mts} +92 -9
  70. package/dist/plugin-api/RenderedDomContext.d.mts +5 -7
  71. package/dist/plugin-api/index.d.mts +3 -3
  72. package/dist/plugin-api/resolveItemPositions.d.mts +3 -3
  73. package/dist/{rezip-Bxiq4Z_R.d.mts → rezip-CfwAYdV4.d.mts} +7 -1
  74. package/dist/styles/index.d.mts +3 -3
  75. package/dist/styles/index.mjs +1 -1
  76. package/dist/{styles-AryxLAhx.d.mts → styles-DZZz2oRy.d.mts} +2 -2
  77. package/dist/types/content.d.mts +2 -2
  78. package/dist/types/document.d.mts +6 -6
  79. package/dist/{types-Cz7S77Ut.d.mts → types-bvPg3KsF.d.mts} +16 -3
  80. package/dist/utils/comments.d.mts +2 -2
  81. package/dist/utils/findReplace.mjs +1 -2
  82. package/dist/utils/index.d.mts +5 -5
  83. package/dist/utils/index.mjs +1 -1
  84. package/dist/utils/listState.d.mts +2 -5
  85. package/dist/utils/stylePreview.d.mts +2 -2
  86. package/dist/utils/stylePreview.mjs +1 -1
  87. package/dist/wasm-edit.d.mts +233 -48
  88. package/dist/wasm-edit.mjs +1 -1
  89. package/dist/wasm-layout.d.mts +7 -1
  90. package/dist/wasm-layout.mjs +1 -1
  91. package/dist/wasm-opc.mjs +1 -1
  92. package/dist/wasm-parse.d.mts +7 -1
  93. package/dist/wasm-parse.mjs +1 -1
  94. package/dist/worker.d.mts +60 -0
  95. package/dist/worker.mjs +1 -0
  96. package/dist/yrs/docxWorker.d.mts +20 -0
  97. package/dist/yrs/docxWorker.mjs +3 -0
  98. package/dist/yrs/index.d.mts +12 -7
  99. package/dist/yrs/index.mjs +1 -1
  100. package/package.json +14 -4
  101. package/dist/chunk-47Q2FMFF.mjs +0 -1
  102. package/dist/chunk-4PRCO6EC.mjs +0 -1
  103. package/dist/chunk-5Z22FORG.mjs +0 -1
  104. package/dist/chunk-7SUVUKWT.mjs +0 -1
  105. package/dist/chunk-7ZV6P6NZ.mjs +0 -57
  106. package/dist/chunk-AXFMDV66.mjs +0 -1
  107. package/dist/chunk-EBYC3CX7.mjs +0 -1
  108. package/dist/chunk-GKWXOZZH.mjs +0 -1
  109. package/dist/chunk-LIOWZSE7.mjs +0 -1
  110. package/dist/chunk-ML6E23W2.mjs +0 -1
  111. package/dist/chunk-MLEMGJP7.mjs +0 -1
  112. package/dist/chunk-QBMNRD5V.mjs +0 -2
  113. package/dist/chunk-RNNTXPXC.mjs +0 -1
  114. package/dist/compareDocx-CWOYEBCE.mjs +0 -1
  115. package/dist/computeLayout-ZTO6TBWX.mjs +0 -1
  116. package/dist/displayListQueries-BVBDVXoP.d.mts +0 -306
  117. package/dist/frameDelta-CLeO7K5z.d.mts +0 -807
  118. package/dist/index-DzZVJC8-.d.mts +0 -2467
  119. package/dist/parseWasm-BESKFFA3.mjs +0 -1
  120. package/dist/rustDisplayList-B7uPoItK.d.mts +0 -315
  121. package/dist/wasm-GFT55YT6.mjs +0 -1
  122. package/dist/wasm-QI7MWC5D.mjs +0 -1
  123. package/dist/yrs/residentEngineWorker.d.mts +0 -2
  124. package/dist/yrs/residentEngineWorker.mjs +0 -1
@@ -1,807 +0,0 @@
1
- import { T as TextModernEffects } from './formatting-gqLFeJ9X.mjs';
2
- import { D as DrawingScene, c as ShapeTextBodyProperties } from './content-DSb-6a9T.mjs';
3
-
4
- interface DisplayList {
5
- /** Contract version. Undefined reads as legacy version 0. */
6
- contractVersion?: number;
7
- pages: DisplayPage[];
8
- }
9
- /**
10
- * Modern (`w14:*`) run text-effect payload carried on text/glyph primitives.
11
- * Same shape as the document model's `TextModernEffects` — px distances,
12
- * degree directions, 0..1 opacities, resolved `#rrggbb` colors.
13
- */
14
- type DisplayTextModernEffects = TextModernEffects;
15
- interface DisplayPage {
16
- pageIndex: number;
17
- width: number;
18
- height: number;
19
- /** Authored body content box (page-local px), derived from page margins. */
20
- contentBounds?: DisplayBounds;
21
- /** Authored body column boxes in reading order (page-local px). */
22
- columnBounds?: DisplayBounds[];
23
- /** Stable section identity for this page. Undefined = legacy/global section. */
24
- sectionId?: string;
25
- /** Zero-based section ordinal. */
26
- sectionIndex?: number;
27
- /** Zero-based page ordinal within the section. */
28
- sectionPageIndex?: number;
29
- /** Effective page number within the section, after any restart. */
30
- sectionPageNumber?: number;
31
- /** Formatted PAGE label (for example, "vii"). */
32
- pageLabel?: string;
33
- primitives: DisplayPrimitive[];
34
- /** Leading primitives painted beneath the header and footer. */
35
- watermarkPrimitiveCount?: number;
36
- /** Resolved page background. Undefined = transparent/host white. */
37
- background?: string;
38
- pageBorders?: PageBorderPrimitive[];
39
- header?: HfRegion;
40
- footer?: HfRegion;
41
- /** Footnote/endnote regions in page coordinates. Undefined = none. */
42
- noteAreas?: NoteRegion[];
43
- /** Geometry only: the page's content is built when the host asks for it. */
44
- unbuilt?: boolean;
45
- /** For an unbuilt page, the lowest and highest body position its layout places. */
46
- positionSpan?: [number, number];
47
- }
48
- /** A page-local rectangle emitted as display-list metadata. */
49
- interface DisplayBounds {
50
- x: number;
51
- y: number;
52
- width: number;
53
- height: number;
54
- }
55
- /** Page note region; primitives retain normal doc/a11y metadata. */
56
- interface NoteRegion {
57
- kind?: 'footnote' | 'endnote';
58
- sectionId?: string;
59
- y?: number;
60
- height?: number;
61
- columns?: number;
62
- separatorPrimitives?: DisplayPrimitive[];
63
- primitives?: DisplayPrimitive[];
64
- noteIds?: number[];
65
- /**
66
- * Per-note backlink metadata (W17): the body-doc range of each note's
67
- * reference mark plus its formatted label, so the a11y mirror can wire
68
- * note ↔ reference associations (doc-noteref / doc-backlink). Parallel to
69
- * `noteIds`; undefined = legacy region without backlink data.
70
- */
71
- notes?: NoteRegionNote[];
72
- }
73
- /** Backlink metadata for one note in a NoteRegion. */
74
- interface NoteRegionNote {
75
- id?: number;
76
- /** Body-doc range of the reference mark anchoring this note. */
77
- anchorDocStart?: number;
78
- anchorDocEnd?: number;
79
- /** Formatted reference label (display number / custom mark). File-derived. */
80
- label?: string;
81
- }
82
- interface HfRegion {
83
- rId: string;
84
- kind: 'header' | 'footer';
85
- y: number;
86
- height: number;
87
- primitives: DisplayPrimitive[];
88
- }
89
- type DisplayPrimitive = TextRunPrimitive | GlyphRunPrimitive | RectPrimitive | LinePrimitive | ImagePrimitive | ShapePrimitive | DecorationPrimitive;
90
- interface TableCellRef {
91
- row: number;
92
- col: number;
93
- rowSpan: number;
94
- colSpan: number;
95
- continuation?: boolean;
96
- /** Stable semantic cell identity. */
97
- cellId?: string;
98
- /** Cell participates as a row/column header. */
99
- isHeader?: boolean;
100
- /** Header cell was repeated on a continuation page. */
101
- repeatedHeader?: boolean;
102
- /** Word `w:noWrap` cell behavior. */
103
- noWrap?: boolean;
104
- /** IDs of header cells that label this data cell. */
105
- headerIds?: string[];
106
- /** Collapsed-border ownership retained for exact fragment replay. */
107
- ownsTopBorder?: boolean;
108
- ownsRightBorder?: boolean;
109
- ownsBottomBorder?: boolean;
110
- ownsLeftBorder?: boolean;
111
- }
112
- /** Table-fragment semantics shared by every primitive emitted for that fragment. */
113
- interface DisplayTableMetadata {
114
- tableId?: string;
115
- rowStart?: number;
116
- rowEnd?: number;
117
- rowCount?: number;
118
- columnCount?: number;
119
- headerRowCount?: number;
120
- caption?: string;
121
- description?: string;
122
- parentTableId?: string;
123
- }
124
- /** Resolved review presentation for the primitive's `commentIds`. */
125
- interface DisplayCommentMetadata {
126
- status?: 'active' | 'resolved';
127
- authorId?: string;
128
- paletteIndex?: number;
129
- color?: string;
130
- selected?: boolean;
131
- /** Reviewer display name (file-derived, attacker-controlled). */
132
- authorName?: string;
133
- /** Comment date string, passed through verbatim. */
134
- date?: string;
135
- /** Plain-text comment body excerpt (builder-capped, file-derived). */
136
- text?: string;
137
- /** Number of replies in the thread. */
138
- replyCount?: number;
139
- /** Reply summaries in thread order (builder-capped). */
140
- replies?: DisplayCommentReply[];
141
- }
142
- /** One reply summary inside DisplayCommentMetadata. */
143
- interface DisplayCommentReply {
144
- authorName?: string;
145
- date?: string;
146
- text?: string;
147
- }
148
- /**
149
- * Inert field identity for a11y announcement. `instruction` is the raw Word
150
- * field instruction, carried for announcement/inspection ONLY — it is never
151
- * parsed into behavior or executed by any consumer (see the repo security guidelines security).
152
- */
153
- interface DisplayFieldMetadata {
154
- /** Painter-resolved category (PAGE, NUMPAGES, DATE, TIME, OTHER). */
155
- category?: string;
156
- /** Raw Word field type token (e.g. TOC, PAGEREF, REF). */
157
- type?: string;
158
- /** Raw field instruction text (announce-only, builder-capped). */
159
- instruction?: string;
160
- }
161
- /** Footnote/endnote reference identity on the body reference-mark primitive. */
162
- interface DisplayNoteRef {
163
- kind?: 'footnote' | 'endnote';
164
- id?: number;
165
- }
166
- /** Scoped clip/group membership emitted by the Rust compiler. */
167
- interface DisplayClipGroupMetadata {
168
- id?: string;
169
- clip?: {
170
- x?: number;
171
- y?: number;
172
- w?: number;
173
- h?: number;
174
- };
175
- opacity?: number;
176
- }
177
- /** Horizontal paint slot for text laid out with guessed metrics. */
178
- interface DisplayPaintClip {
179
- x: number;
180
- w: number;
181
- }
182
- interface StructuralRevision {
183
- scope: 'pmark' | 'table' | 'row' | 'cell';
184
- author: string;
185
- date?: string;
186
- revisionId: string;
187
- kind: 'ins' | 'del' | 'merge';
188
- rowIndex?: number;
189
- colIndex?: number;
190
- }
191
- interface SdtAttrs {
192
- groupId: string;
193
- sdtType: string;
194
- depth?: number;
195
- tag?: string;
196
- alias?: string;
197
- lock?: string;
198
- checked?: boolean;
199
- bound?: boolean;
200
- repeatingItem?: boolean;
201
- }
202
- interface InlineSdtWidgetAttrs {
203
- kind: 'checkbox';
204
- /** Rich control kind. Undefined = legacy checkbox. */
205
- controlKind?: 'checkbox' | 'dropDownList' | 'comboBox' | 'date' | 'picture' | 'repeatingSection';
206
- groupId: string;
207
- pos: number;
208
- tag?: string;
209
- alias?: string;
210
- checked?: boolean;
211
- controlId?: number;
212
- value?: string;
213
- selectedIndex?: number;
214
- listItems?: Array<{
215
- displayText?: string;
216
- value?: string;
217
- }>;
218
- dateFormat?: string;
219
- dateLanguage?: string;
220
- locked?: boolean;
221
- }
222
- interface ChartA11yAttrs {
223
- label: string;
224
- }
225
- interface DocAttrs {
226
- docStart?: number;
227
- docEnd?: number;
228
- blockId?: number;
229
- blockKey?: string;
230
- fragmentDocStart?: number;
231
- fragmentDocEnd?: number;
232
- paraId?: string;
233
- fromLine?: number;
234
- toLine?: number;
235
- /** Resolved line index within the owning paragraph. */
236
- lineIndex?: number;
237
- /**
238
- * Table cell the primitive paints inside, when any. The a11y mirror builds
239
- * real ARIA table semantics (role table/row/cell, aria-row/colindex) from
240
- * this — without it a table block reads as a flat run of text.
241
- */
242
- cell?: TableCellRef;
243
- /** Sanitized hyperlink target when this primitive paints linked content. */
244
- href?: string;
245
- /** Optional hyperlink tooltip/title for popup UI. */
246
- tooltip?: string;
247
- /** ScreenTip exposed as DOM `title`; undefined falls back to `tooltip`. */
248
- linkTitle?: string;
249
- /** Safe hyperlink target frame. */
250
- linkTarget?: string;
251
- /** Link history bit. Undefined = host-unmanaged. */
252
- linkHistory?: boolean;
253
- /** Location within the target document. */
254
- linkDocLocation?: string;
255
- commentIds?: string[];
256
- /**
257
- * Inert field identity when this primitive paints a field result. The a11y
258
- * mirror announces it (data-field-* + aria-description); nothing executes it.
259
- */
260
- field?: DisplayFieldMetadata;
261
- /**
262
- * Footnote/endnote reference identity when this primitive is the body
263
- * reference mark — the mirror renders it as a doc-noteref link to the
264
- * note's mirror element (W17 backlinks).
265
- */
266
- noteRef?: DisplayNoteRef;
267
- revision?: {
268
- author: string;
269
- date: string;
270
- revisionId: string;
271
- kind: 'ins' | 'del';
272
- };
273
- /** Synthetic numbering glyph for the first line of a list paragraph. */
274
- listMarker?: boolean;
275
- /** Pending suggestion paint for a synthetic numbering glyph. */
276
- listMarkerRevision?: 'ins' | 'del';
277
- structuralRevision?: StructuralRevision;
278
- /** Innermost block-level content-control identity for this primitive. */
279
- sdt?: SdtAttrs;
280
- /** Full outer-to-inner content-control ancestry. */
281
- sdtPath?: SdtAttrs[];
282
- /** Inline content-control widget metadata when this text run is its glyph. */
283
- inlineSdtWidget?: InlineSdtWidgetAttrs;
284
- /** Accessibility summary for primitives that compose one chart block. */
285
- chart?: ChartA11yAttrs;
286
- /** Logical/source order, independent of visual bidi paint order. */
287
- logicalOrder?: number;
288
- /** Resolved bidi embedding level. */
289
- bidiLevel?: number;
290
- /** BCP-47 language for a11y/font fallback. */
291
- lang?: string;
292
- /** Decorative content is omitted from the accessibility mirror. */
293
- decorative?: boolean;
294
- /** Authored accessibility name. */
295
- ariaLabel?: string;
296
- /** Authored accessibility description. */
297
- ariaDescription?: string;
298
- /** Hidden authored object. Undefined = visible. */
299
- hiddenObject?: boolean;
300
- /** Stable logical scene/group identity. */
301
- groupId?: string;
302
- /** Review presentation for comment-associated primitives. */
303
- comment?: DisplayCommentMetadata;
304
- /** Scoped clip/group membership. Undefined = ungrouped. */
305
- clipGroup?: DisplayClipGroupMetadata;
306
- /** Enclosing table-fragment identity and accessibility semantics. */
307
- table?: DisplayTableMetadata;
308
- /** Inline native-shape atom; true only for paragraph-inline shapes. */
309
- inlineShapeAtom?: boolean;
310
- }
311
- interface TextRunPrimitive extends DocAttrs {
312
- kind: 'text';
313
- text: string;
314
- x: number;
315
- baselineY: number;
316
- width: number;
317
- paintClip?: DisplayPaintClip;
318
- font: string;
319
- color: string;
320
- letterSpacing?: number;
321
- wordSpacing?: number;
322
- rtl?: boolean;
323
- /** 0..1 alpha applied only to this run. Absent = opaque. */
324
- opacity?: number;
325
- /** Degrees clockwise around the primitive's geometry center. Absent = 0. */
326
- rotationDeg?: number;
327
- /** Horizontal text scale as a percentage (100 = normal). Absent = 100. */
328
- horizontalScale?: number;
329
- /** Render glyphs uppercase without changing the accessible source text. */
330
- allCaps?: boolean;
331
- /** Render lowercase glyphs as small uppercase. */
332
- smallCaps?: boolean;
333
- /** Hidden run shown in editing view as dimmed/dotted, matching the DOM painter. */
334
- hidden?: boolean;
335
- /** CSS-like shadow effect from run formatting. */
336
- textShadow?: 'shadow' | 'emboss' | 'imprint';
337
- /** Outlined / hollow text. */
338
- textOutline?: boolean;
339
- /** CJK emphasis mark. */
340
- emphasisMark?: 'dot' | 'comma' | 'circle' | 'underDot';
341
- /** Legacy text-effect class hook for the a11y mirror. */
342
- textEffect?: 'blinkBackground' | 'lights' | 'antsBlack' | 'antsRed' | 'shimmer' | 'sparkle';
343
- /** Modern w14 text effects (glow/shadow/reflection/textFill/textOutline). */
344
- modernEffects?: DisplayTextModernEffects;
345
- /** Shaped tab/TOC leader metadata. Undefined = ordinary text. */
346
- leaderGlyphs?: Omit<LeaderGlyphPrimitive, 'kind'>;
347
- }
348
- interface PositionedGlyph {
349
- id: number;
350
- x: number;
351
- y: number;
352
- cluster: number;
353
- advance?: number;
354
- /** Logical cluster order before bidi reordering. */
355
- logicalOrder?: number;
356
- /** Bidi embedding level for this cluster. */
357
- bidiLevel?: number;
358
- }
359
- /** Shaped glyph run with source text for accessibility. */
360
- interface GlyphRunPrimitive extends DocAttrs {
361
- kind: 'glyphRun';
362
- fontId: number;
363
- size: number;
364
- color: string;
365
- text: string;
366
- glyphs: PositionedGlyph[];
367
- paintClip?: DisplayPaintClip;
368
- fallbackFont?: string;
369
- wordSpacing?: number;
370
- rtl?: boolean;
371
- /** 0..1 alpha applied only to this run. Absent = opaque. */
372
- opacity?: number;
373
- /** Degrees clockwise around the primitive's geometry center. Absent = 0. */
374
- rotationDeg?: number;
375
- /** Horizontal text scale as a percentage (100 = normal). Absent = 100. */
376
- horizontalScale?: number;
377
- /** Render glyphs uppercase without changing the accessible source text. */
378
- allCaps?: boolean;
379
- /** Render lowercase glyphs as small uppercase. */
380
- smallCaps?: boolean;
381
- /** Hidden run shown in editing view as dimmed/dotted, matching the DOM painter. */
382
- hidden?: boolean;
383
- /** CSS-like shadow effect from run formatting. */
384
- textShadow?: 'shadow' | 'emboss' | 'imprint';
385
- /** Outlined / hollow text. */
386
- textOutline?: boolean;
387
- /** CJK emphasis mark. */
388
- emphasisMark?: 'dot' | 'comma' | 'circle' | 'underDot';
389
- /** Legacy text-effect class hook for the a11y mirror. */
390
- textEffect?: 'blinkBackground' | 'lights' | 'antsBlack' | 'antsRed' | 'shimmer' | 'sparkle';
391
- /** Modern w14 text effects (glow/shadow/reflection/textFill/textOutline). */
392
- modernEffects?: DisplayTextModernEffects;
393
- /** Shaped tab/TOC leader metadata. Undefined = ordinary glyph run. */
394
- leaderGlyphs?: Omit<LeaderGlyphPrimitive, 'kind'>;
395
- }
396
- interface RectPrimitive extends DocAttrs {
397
- kind: 'rect';
398
- x: number;
399
- y: number;
400
- w: number;
401
- h: number;
402
- fill: string;
403
- /** Alpha multiplier. Undefined = 1. */
404
- opacity?: number;
405
- }
406
- /** Word/CSS line recipe retained instead of flattening to a solid stroke. */
407
- type DisplayBorderStyle = 'solid' | 'double' | 'dotted' | 'dashed' | 'dashDot' | 'dashDotDot' | 'triple' | 'thinThick' | 'thickThin' | 'wave' | 'doubleWave' | 'groove' | 'ridge' | 'inset' | 'outset';
408
- interface LinePrimitive extends DocAttrs {
409
- kind: 'line';
410
- x1: number;
411
- y1: number;
412
- x2: number;
413
- y2: number;
414
- strokeWidth: number;
415
- color: string;
416
- dash?: number[];
417
- role?: 'border' | 'table-border' | 'table-cut' | 'separator';
418
- /** Full border recipe. Undefined = infer solid/dash from `dash`. */
419
- borderStyle?: DisplayBorderStyle;
420
- /** Secondary color for 3-D/multi-stroke recipes. */
421
- secondaryColor?: string;
422
- /** Alpha multiplier. Undefined = 1. */
423
- opacity?: number;
424
- /** Owner of the retained Word border recipe. */
425
- borderOwner?: 'cell' | 'fragment' | 'paragraph' | 'textBox';
426
- }
427
- interface PageBorderSide {
428
- width: number;
429
- color: string;
430
- style: 'solid' | 'double' | 'dotted' | 'dashed' | 'groove' | 'ridge' | 'inset' | 'outset';
431
- }
432
- interface PageBorderPrimitive {
433
- kind: 'pageBorder';
434
- x: number;
435
- y: number;
436
- w: number;
437
- h: number;
438
- zOrder?: 'front' | 'back';
439
- top?: PageBorderSide;
440
- right?: PageBorderSide;
441
- bottom?: PageBorderSide;
442
- left?: PageBorderSide;
443
- }
444
- interface ImagePrimitive extends DocAttrs {
445
- kind: 'image';
446
- shapeType?: string;
447
- relId: string;
448
- x: number;
449
- y: number;
450
- w: number;
451
- h: number;
452
- rotationDeg?: number;
453
- /** 0..1 alpha applied only to this image. Absent = opaque. */
454
- opacity?: number;
455
- /** Flip about the content-frame center. Undefined = false. */
456
- flipH?: boolean;
457
- /** Flip about the content-frame center. Undefined = false. */
458
- flipV?: boolean;
459
- /** Original image frame when w/h are a transformed layout bbox. */
460
- contentFrame?: {
461
- x?: number;
462
- y?: number;
463
- w?: number;
464
- h?: number;
465
- };
466
- /** Canvas/CSS filter string for renderer-owned effects, e.g. watermark washout. */
467
- filter?: string;
468
- /** True for decorative/non-content images such as picture watermarks. */
469
- decorative?: boolean;
470
- crop?: {
471
- top: number;
472
- right: number;
473
- bottom: number;
474
- left: number;
475
- };
476
- altText?: string;
477
- /** Ordered image effects. Undefined = use legacy `filter` only. */
478
- effects?: Array<{
479
- kind?: string;
480
- amount?: number;
481
- threshold?: number;
482
- colors?: string[];
483
- rawName?: string;
484
- }>;
485
- /** Picture border recipe. Undefined = none. */
486
- border?: {
487
- width?: number;
488
- color?: string;
489
- style?: string;
490
- dash?: number[];
491
- };
492
- }
493
- type ShapePathCommand = {
494
- type: 'move';
495
- x: number;
496
- y: number;
497
- } | {
498
- type: 'line';
499
- x: number;
500
- y: number;
501
- } | {
502
- type: 'quad';
503
- cpx: number;
504
- cpy: number;
505
- x: number;
506
- y: number;
507
- } | {
508
- type: 'cubic';
509
- cp1x: number;
510
- cp1y: number;
511
- cp2x: number;
512
- cp2y: number;
513
- x: number;
514
- y: number;
515
- } | {
516
- type: 'close';
517
- };
518
- interface ShapePrimitive extends DocAttrs {
519
- kind: 'shape';
520
- x: number;
521
- y: number;
522
- w: number;
523
- h: number;
524
- /** Page-local path commands scaled from the shape's normalized geometry. */
525
- geometryPath: ShapePathCommand[];
526
- fill?: string;
527
- stroke?: {
528
- color: string;
529
- width: number;
530
- /** DrawingML/CSS dash style token. */
531
- dash?: string;
532
- };
533
- transform?: {
534
- rotation?: number;
535
- flipH?: boolean;
536
- flipV?: boolean;
537
- };
538
- /** True when the shape carries no accessible inner text. */
539
- decorative?: boolean;
540
- /** Alpha multiplier. Undefined = 1. */
541
- opacity?: number;
542
- /** Lossless paint server; undefined = legacy `fill`. */
543
- fillPaint?: {
544
- kind?: 'none' | 'solid' | 'gradient' | 'pattern' | 'picture' | 'theme';
545
- color?: string;
546
- angle?: number;
547
- gradientType?: string;
548
- stops?: Array<{
549
- position?: number;
550
- color?: string;
551
- }>;
552
- patternPreset?: string;
553
- foregroundColor?: string;
554
- backgroundColor?: string;
555
- pictureRelId?: string;
556
- /**
557
- * Resolved SAFE embedded source for a picture fill (`blob:`/`data:` only —
558
- * external-mode blip relationships are never resolved, so opening a file
559
- * cannot trigger a network fetch). The canvas image resolver rejects any
560
- * other scheme as defense in depth. Absent = unresolvable, paint the
561
- * legacy `fill`/`color` instead.
562
- */
563
- pictureSrc?: string;
564
- /** Picture source crop fractions (`a:srcRect`, 0..1; negative = outset). */
565
- pictureSrcRect?: {
566
- left?: number;
567
- top?: number;
568
- right?: number;
569
- bottom?: number;
570
- };
571
- /** Picture fill mode. Absent = 'stretch' (`a:stretch`). */
572
- pictureFillMode?: 'stretch' | 'tile';
573
- /** Tile parameters when `pictureFillMode` = 'tile'. Offsets px, scales fractions. */
574
- pictureTile?: {
575
- offsetX?: number;
576
- offsetY?: number;
577
- scaleX?: number;
578
- scaleY?: number;
579
- alignment?: string;
580
- flip?: 'none' | 'x' | 'y' | 'xy';
581
- };
582
- /** Stretch target rect fractions of the shape box (`a:fillRect`, 0..1). */
583
- pictureStretchRect?: {
584
- left?: number;
585
- top?: number;
586
- right?: number;
587
- bottom?: number;
588
- };
589
- /** Picture alpha 0..1 (`a:alphaModFix`). Absent = opaque. */
590
- pictureOpacity?: number;
591
- themeRefIndex?: number;
592
- };
593
- /** Lossless DrawingML stroke details beyond the legacy `stroke` triple. */
594
- strokePaint?: {
595
- color?: string;
596
- width?: number;
597
- dash?: string;
598
- customDash?: number[];
599
- compound?: 'single' | 'double' | 'thickThin' | 'thinThick' | 'triple';
600
- alignment?: 'center' | 'inset';
601
- cap?: 'flat' | 'round' | 'square';
602
- join?: 'bevel' | 'miter' | 'round';
603
- miterLimit?: number;
604
- headEnd?: {
605
- type?: string;
606
- width?: string;
607
- length?: string;
608
- };
609
- tailEnd?: {
610
- type?: string;
611
- width?: string;
612
- length?: string;
613
- };
614
- };
615
- /** Ordered 2-D effects. Undefined = none. */
616
- effects?: Array<{
617
- kind?: string;
618
- color?: string;
619
- opacity?: number;
620
- blurRadius?: number;
621
- distance?: number;
622
- direction?: number;
623
- size?: number;
624
- rawName?: string;
625
- }>;
626
- /** Effect extents in page px. Undefined = zero. */
627
- effectExtent?: {
628
- top?: number;
629
- right?: number;
630
- bottom?: number;
631
- left?: number;
632
- };
633
- /** Versioned heterogeneous DrawingML group/canvas scene. */
634
- drawingScene?: DrawingScene;
635
- /** Full DrawingML `a:bodyPr` projection for shape text. */
636
- textBodyProperties?: ShapeTextBodyProperties;
637
- }
638
- interface DecorationPrimitive extends DocAttrs {
639
- kind: 'decoration';
640
- deco: 'underline' | 'strike' | 'highlight' | 'comment-range' | 'spell';
641
- x: number;
642
- y: number;
643
- w: number;
644
- h: number;
645
- color: string;
646
- dashed?: boolean;
647
- dotted?: boolean;
648
- /** Exact highlight font-box/source slice. Undefined = legacy rect. */
649
- highlightSlice?: {
650
- sourceStart?: number;
651
- sourceEnd?: number;
652
- ascent?: number;
653
- descent?: number;
654
- includesTrailingWhitespace?: boolean;
655
- };
656
- /** Full border/decoration recipe. Undefined = solid/dashed/dotted flags. */
657
- style?: DisplayBorderStyle;
658
- }
659
- /** Shaped tab/TOC leader glyphs; absent metrics mean no painted leader. */
660
- interface LeaderGlyphPrimitive extends DocAttrs {
661
- /** Primitive tag. Undefined when embedded as run metadata. */
662
- kind?: 'leaderGlyphs';
663
- glyph?: string;
664
- count?: number;
665
- x?: number;
666
- baselineY?: number;
667
- advance?: number;
668
- width?: number;
669
- font?: string;
670
- fontId?: number;
671
- size?: number;
672
- color?: string;
673
- rtl?: boolean;
674
- }
675
-
676
- declare const FRAME_DELTA_VERSION = 1;
677
- declare const FRAME_DELTA_HEADER_BYTES = 80;
678
- declare const FRAME_DELTA_PAGE_OP_BYTES = 48;
679
- type FrameDeltaErrorCode = 'invalid-frame' | 'unsupported-version' | 'stale-frame' | 'base-mismatch';
680
- declare class FrameDeltaError extends Error {
681
- readonly code: FrameDeltaErrorCode;
682
- constructor(code: FrameDeltaErrorCode, message: string);
683
- }
684
- interface FramePageUpsert {
685
- readonly kind: 'upsert';
686
- readonly pageIndex: number;
687
- readonly pageId: bigint;
688
- readonly fingerprint: bigint;
689
- /** Zero-copy view into {@link DecodedFrameDelta.bytes}. */
690
- readonly primitiveIds: BigUint64Array;
691
- readonly page: DisplayPage;
692
- }
693
- interface FramePageRemove {
694
- readonly kind: 'remove';
695
- readonly pageIndex: number;
696
- readonly pageId: bigint;
697
- }
698
- interface FramePageMove {
699
- readonly kind: 'move';
700
- readonly pageIndex: number;
701
- readonly pageId: bigint;
702
- readonly fingerprint: bigint;
703
- }
704
- interface FramePrimitivePositionPatch {
705
- readonly primitiveId: bigint;
706
- readonly docStart?: number | null;
707
- readonly docEnd?: number | null;
708
- readonly fragmentDocStart?: number | null;
709
- readonly fragmentDocEnd?: number | null;
710
- readonly inlineWidgetPos?: number | null;
711
- }
712
- interface FramePagePositionPatch {
713
- readonly kind: 'patch-positions';
714
- readonly pageIndex: number;
715
- readonly pageId: bigint;
716
- readonly fingerprint: bigint;
717
- readonly patches: readonly FramePrimitivePositionPatch[];
718
- }
719
- interface FramePositionShiftRun {
720
- readonly start: number;
721
- readonly count: number;
722
- readonly changedMask: number;
723
- readonly delta: number;
724
- }
725
- /** A note region note's new backlink anchor; null clears the field. */
726
- interface FrameNoteAnchor {
727
- readonly area: number;
728
- readonly note: number;
729
- readonly start: number | null;
730
- readonly end: number | null;
731
- }
732
- interface FramePagePositionShift {
733
- readonly kind: 'shift-positions';
734
- readonly pageIndex: number;
735
- readonly pageId: bigint;
736
- readonly fingerprint: bigint;
737
- readonly runs: readonly FramePositionShiftRun[];
738
- readonly anchors: readonly FrameNoteAnchor[];
739
- readonly spanDelta?: number;
740
- }
741
- type FramePageOperation = FramePageUpsert | FramePageRemove | FramePageMove | FramePagePositionPatch | FramePagePositionShift;
742
- interface DecodedFrameDelta {
743
- readonly protocolVersion: typeof FRAME_DELTA_VERSION;
744
- readonly full: boolean;
745
- readonly docEpoch: number;
746
- readonly layoutEpoch: number;
747
- readonly frameEpoch: number;
748
- readonly baseFrameEpoch: number;
749
- readonly pageCount: number;
750
- readonly contractVersion?: number;
751
- readonly operations: readonly FramePageOperation[];
752
- /** Complete binary frame; safe to transfer when the caller owns its buffer. */
753
- readonly bytes: Uint8Array;
754
- }
755
- interface RetainedFramePage {
756
- readonly pageIndex: number;
757
- readonly pageId: bigint;
758
- readonly fingerprint: bigint;
759
- readonly primitiveIds: BigUint64Array;
760
- readonly page: DisplayPage;
761
- }
762
- interface RetainedFrame {
763
- readonly protocolVersion: typeof FRAME_DELTA_VERSION;
764
- readonly docEpoch: number;
765
- readonly layoutEpoch: number;
766
- readonly frameEpoch: number;
767
- readonly contractVersion?: number;
768
- readonly pages: readonly RetainedFramePage[];
769
- /** IDs whose canvas/mirror/interactive projections must be replaced. */
770
- readonly damagedPageIds: ReadonlySet<bigint>;
771
- /** Removed surfaces, retained separately because they are absent from pages. */
772
- readonly removedPageIds: ReadonlySet<bigint>;
773
- readonly displayList: DisplayList;
774
- }
775
- /**
776
- * Decode and fully validate one binary FrameDelta v1 without mutating retained
777
- * browser state. Page payloads are typed values, not embedded JSON strings.
778
- */
779
- declare function decodeFrameDelta(input: Uint8Array | ArrayBuffer): DecodedFrameDelta;
780
- /** @internal Decode in resumable slices without publishing partial state. */
781
- declare function decodeFrameDeltaSteps(input: Uint8Array | ArrayBuffer): Generator<void, DecodedFrameDelta>;
782
- /** Apply one already-validated frame atomically, rejecting stale generations. */
783
- declare function applyFrameDelta(previous: RetainedFrame | null, delta: DecodedFrameDelta): RetainedFrame;
784
- /**
785
- * Apply a frame while reusing position-only page arenas owned exclusively by
786
- * the caller. Worker/main resident-engine hot paths replace their outer frame
787
- * atomically and have no concurrent readers; avoiding deep suffix clones keeps
788
- * geometry shifts from creating periodic multi-megabyte GC stalls.
789
- */
790
- declare function applyFrameDeltaOwned(previous: RetainedFrame | null, delta: DecodedFrameDelta): RetainedFrame;
791
- /**
792
- * Hidden in-place mutation counter for one display page. The owned delta path
793
- * (`applyFrameDeltaOwned`) patches primitive positions through the SAME page
794
- * object, so page identity alone cannot prove content equality; identity-based
795
- * consumers (query-facade handle adoption) must compare this revision too. The
796
- * property is non-enumerable, so serialization and structural reads never see
797
- * it.
798
- */
799
- declare function displayPageRevision(page: DisplayPage): number;
800
- /**
801
- * Counts the owned shifts that moved this page's note anchors in place, for
802
- * consumers that render the anchors (the accessibility mirror) and otherwise
803
- * key on page identity.
804
- */
805
- declare function displayPageNoteAnchorRevision(page: DisplayPage): number;
806
-
807
- export { type DisplayList as D, FRAME_DELTA_HEADER_BYTES as F, type GlyphRunPrimitive as G, type HfRegion as H, type ImagePrimitive as I, type LinePrimitive as L, type PositionedGlyph as P, type RetainedFrame as R, type TextRunPrimitive as T, type DisplayPage as a, type DisplayPrimitive as b, type DecodedFrameDelta as c, type DecorationPrimitive as d, type DisplayBounds as e, type DocAttrs as f, FRAME_DELTA_PAGE_OP_BYTES as g, FRAME_DELTA_VERSION as h, FrameDeltaError as i, type FrameDeltaErrorCode as j, type FramePageOperation as k, type RectPrimitive as l, type RetainedFramePage as m, type TableCellRef as n, applyFrameDelta as o, applyFrameDeltaOwned as p, decodeFrameDelta as q, decodeFrameDeltaSteps as r, displayPageNoteAnchorRevision as s, displayPageRevision as t };