@betteroffice/docx 0.0.1 → 0.0.3

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 (165) hide show
  1. package/README.md +19 -0
  2. package/dist/chunk-AEQOEQJ7.mjs +57 -0
  3. package/dist/chunk-AZ52IWB6.mjs +16 -0
  4. package/dist/{chunk-SINEY6ZF.mjs → chunk-B4IR6YP4.mjs} +1 -1
  5. package/dist/chunk-GGEGIQRK.mjs +1 -0
  6. package/dist/chunk-IFT6DUJX.mjs +1 -0
  7. package/dist/chunk-J7LNO6SM.mjs +1 -0
  8. package/dist/{chunk-H3JCIGWK.mjs → chunk-NJHOPXZW.mjs} +1 -1
  9. package/dist/{chunk-KXNZFTTK.mjs → chunk-WBH3SXI6.mjs} +1 -1
  10. package/dist/chunk-WON6K4FY.mjs +1 -0
  11. package/dist/chunk-Y7RUNRU2.mjs +1 -0
  12. package/dist/collaboration/index.d.mts +65 -0
  13. package/dist/collaboration/index.mjs +1 -0
  14. package/dist/{content-sSHuWw49.d.mts → content-MOZ6hKP4.d.mts} +357 -357
  15. package/dist/core.d.mts +148 -341
  16. package/dist/core.mjs +1 -1
  17. package/dist/{displayListQueries-p-ijSzdh.d.mts → displayListQueries-BJlo7Jkz.d.mts} +24 -6
  18. package/dist/docx/index.d.mts +40 -520
  19. package/dist/docx/index.mjs +2 -2
  20. package/dist/editor/index.d.mts +36 -151
  21. package/dist/editor/index.mjs +1 -1
  22. package/dist/{fontLoader-Bx6DK6-2.d.mts → fontLoader-aSewHMKF.d.mts} +65 -63
  23. package/dist/{formatting-DoL7KBSL.d.mts → formatting-D1EPSaJP.d.mts} +1 -1
  24. package/dist/{rustDisplayList-dqunvwxH.d.mts → frameDelta-D965X8yK.d.mts} +3 -274
  25. package/dist/generated/edit/docx_edit_bg.wasm +0 -0
  26. package/dist/generated/layout/docx_layout_bg.wasm +0 -0
  27. package/dist/generated/opc/ooxml_opc_bg.wasm +0 -0
  28. package/dist/generated/parse/docx_parse_bg.wasm +0 -0
  29. package/dist/index-Dx4Z3lkz.d.mts +1010 -0
  30. package/dist/layout/index.d.mts +19 -240
  31. package/dist/layout/index.mjs +1 -1
  32. package/dist/layout/pagination/index.d.mts +10 -58
  33. package/dist/layout/pagination/index.mjs +1 -1
  34. package/dist/layout/render/index.d.mts +11 -11
  35. package/dist/layout/render/index.mjs +1 -1
  36. package/dist/plugin-api/RenderedDomContext.d.mts +9 -9
  37. package/dist/plugin-api/index.d.mts +191 -6
  38. package/dist/plugin-api/resolveItemPositions.d.mts +4 -5
  39. package/dist/rustDisplayList-BRuZBqdL.d.mts +278 -0
  40. package/dist/rustMeasureSource-D1KsQvVC.d.mts +106 -0
  41. package/dist/selectiveSave-CVoajSKE.d.mts +56 -0
  42. package/dist/styles/index.d.mts +4 -39
  43. package/dist/styles/index.mjs +1 -1
  44. package/dist/{styles-VxNcXLdi.d.mts → styles-Dn_o3Vo5.d.mts} +2 -2
  45. package/dist/types/content.d.mts +2 -2
  46. package/dist/types/document.d.mts +40 -14
  47. package/dist/{types-DNrYr6yQ.d.mts → types-BfqUl2h_.d.mts} +3 -71
  48. package/dist/utils/comments.d.mts +2 -2
  49. package/dist/utils/index.d.mts +110 -576
  50. package/dist/utils/index.mjs +1 -84
  51. package/dist/utils/stylePreview.d.mts +2 -2
  52. package/dist/utils/units.d.mts +33 -2
  53. package/dist/wasm-DO3BUV7C.mjs +1 -0
  54. package/dist/wasm-NWXX4H5G.mjs +1 -0
  55. package/dist/wasm-edit.d.mts +14 -5
  56. package/dist/wasm-edit.mjs +1 -1
  57. package/dist/wasm-layout.d.mts +10 -1
  58. package/dist/wasm-layout.mjs +1 -1
  59. package/dist/wasm-opc.mjs +1 -1
  60. package/dist/wasm-parse.mjs +1 -1
  61. package/dist/yrs/index.d.mts +6 -881
  62. package/dist/yrs/index.mjs +1 -1
  63. package/dist/yrs/residentEngineWorker.mjs +1 -1
  64. package/package.json +16 -139
  65. package/dist/Subscribable-DOz6Ohoo.d.mts +0 -33
  66. package/dist/agent/index.d.mts +0 -531
  67. package/dist/agent/index.mjs +0 -1
  68. package/dist/chunk-34K66SY4.mjs +0 -1
  69. package/dist/chunk-4RCISPPE.mjs +0 -1
  70. package/dist/chunk-52GB3Y42.mjs +0 -1
  71. package/dist/chunk-6NEKRDXF.mjs +0 -1
  72. package/dist/chunk-6PW4CWUG.mjs +0 -1
  73. package/dist/chunk-7DEIW7FL.mjs +0 -1
  74. package/dist/chunk-7PCO5I2O.mjs +0 -1
  75. package/dist/chunk-BI3B33LI.mjs +0 -1
  76. package/dist/chunk-BIQWVK5P.mjs +0 -2
  77. package/dist/chunk-CIRN3LZA.mjs +0 -1
  78. package/dist/chunk-DXKG3HQ5.mjs +0 -16
  79. package/dist/chunk-FPZBTOD6.mjs +0 -1
  80. package/dist/chunk-FZIA7OFY.mjs +0 -1
  81. package/dist/chunk-GWKJ2Y4Y.mjs +0 -1
  82. package/dist/chunk-HJGAQIU7.mjs +0 -2
  83. package/dist/chunk-I6KKMUUC.mjs +0 -1
  84. package/dist/chunk-IL5JZJT7.mjs +0 -1
  85. package/dist/chunk-JY6ILTNS.mjs +0 -1
  86. package/dist/chunk-KEE52TT5.mjs +0 -1
  87. package/dist/chunk-KVKLLTDP.mjs +0 -58
  88. package/dist/chunk-L5ISVQ3W.mjs +0 -1
  89. package/dist/chunk-LDUWIM7M.mjs +0 -1
  90. package/dist/chunk-N5Q3YN64.mjs +0 -1
  91. package/dist/chunk-NEWOMDTX.mjs +0 -1
  92. package/dist/chunk-O2QSE2I7.mjs +0 -1
  93. package/dist/chunk-OJOHXQNQ.mjs +0 -1
  94. package/dist/chunk-OMR3TWCD.mjs +0 -2
  95. package/dist/chunk-P3KDV4M2.mjs +0 -1
  96. package/dist/chunk-Q7PO7V73.mjs +0 -1
  97. package/dist/chunk-QOUFE3VX.mjs +0 -1
  98. package/dist/chunk-TYHI7RAD.mjs +0 -1
  99. package/dist/chunk-UIEJWORW.mjs +0 -1
  100. package/dist/chunk-VAOUFAUH.mjs +0 -1
  101. package/dist/chunk-VBOTMRXV.mjs +0 -1
  102. package/dist/chunk-VCER63GQ.mjs +0 -1
  103. package/dist/chunk-WAUF2UC7.mjs +0 -2
  104. package/dist/chunk-X4XDO3LZ.mjs +0 -1
  105. package/dist/chunk-XQBCCJBO.mjs +0 -9
  106. package/dist/chunk-XWUOLYRQ.mjs +0 -2
  107. package/dist/chunk-XYH6XWP3.mjs +0 -10
  108. package/dist/chunk-YBIM6UJV.mjs +0 -8
  109. package/dist/chunk-YCIH2Q3E.mjs +0 -1
  110. package/dist/chunk-ZOV5KL7C.mjs +0 -1
  111. package/dist/colorResolver-n0o7H7ep.d.mts +0 -290
  112. package/dist/core-plugins.d.mts +0 -37
  113. package/dist/core-plugins.mjs +0 -1
  114. package/dist/docx/parser.d.mts +0 -41
  115. package/dist/docx/parser.mjs +0 -1
  116. package/dist/docx/rezip.d.mts +0 -148
  117. package/dist/docx/rezip.mjs +0 -1
  118. package/dist/docx/serializer/index.d.mts +0 -42
  119. package/dist/docx/serializer/index.mjs +0 -1
  120. package/dist/editorTree-DO5PyDK8.d.mts +0 -37
  121. package/dist/executor-7O2RBJ2B.mjs +0 -1
  122. package/dist/headerFooterLayout-0zPT64Qc.d.mts +0 -316
  123. package/dist/headless.d.mts +0 -69
  124. package/dist/headless.mjs +0 -1
  125. package/dist/layout/flow/index.d.mts +0 -149
  126. package/dist/layout/flow/index.mjs +0 -1
  127. package/dist/layout/measure/index.d.mts +0 -324
  128. package/dist/layout/measure/index.mjs +0 -1
  129. package/dist/layout/pagination/types.d.mts +0 -4
  130. package/dist/layout/pagination/types.mjs +0 -1
  131. package/dist/managers/AutoSaveManager.d.mts +0 -81
  132. package/dist/managers/AutoSaveManager.mjs +0 -1
  133. package/dist/managers/TableSelectionManager.d.mts +0 -74
  134. package/dist/managers/TableSelectionManager.mjs +0 -1
  135. package/dist/managers/types.d.mts +0 -113
  136. package/dist/managers/types.mjs +0 -0
  137. package/dist/mcp-cli.mjs +0 -142
  138. package/dist/mcp.d.mts +0 -162
  139. package/dist/mcp.mjs +0 -16
  140. package/dist/measureBlocksPipeline-Df0Bbrwy.d.mts +0 -109
  141. package/dist/measuredBlock-DZwz8zhD.d.mts +0 -26
  142. package/dist/plugin-api/types.d.mts +0 -193
  143. package/dist/plugin-api/types.mjs +0 -0
  144. package/dist/processTemplate-HDUIZFJ5.mjs +0 -1
  145. package/dist/registry-DMM5VTdT.d.mts +0 -165
  146. package/dist/rustPagination-Bj2hq013.d.mts +0 -106
  147. package/dist/sectionConfigs-DW3J8q0X.d.mts +0 -55
  148. package/dist/selectionContext-Buc9BCU1.d.mts +0 -570
  149. package/dist/selectiveSave-oFBJ1n71.d.mts +0 -16
  150. package/dist/selectiveXmlPatch-ypkxlTD_.d.mts +0 -23
  151. package/dist/settingsParser-CcGvtmCK.d.mts +0 -33
  152. package/dist/types/agentApi.d.mts +0 -456
  153. package/dist/types/agentApi.mjs +0 -1
  154. package/dist/types-dYdjUZMo.d.mts +0 -311
  155. package/dist/units-O5Y02RKQ.d.mts +0 -34
  156. package/dist/utils/headingCollector.d.mts +0 -28
  157. package/dist/utils/headingCollector.mjs +0 -1
  158. package/dist/utils/highlightColors.d.mts +0 -14
  159. package/dist/utils/highlightColors.mjs +0 -1
  160. package/dist/utils/textSelection.d.mts +0 -92
  161. package/dist/utils/textSelection.mjs +0 -1
  162. package/dist/variableDetector-Borj29SF.d.mts +0 -115
  163. package/dist/wasm-FZQ5XB2Y.mjs +0 -1
  164. package/dist/wasm-SA237OSP.mjs +0 -1
  165. package/dist/watermarkApi-DCxjutkg.d.mts +0 -38
@@ -0,0 +1,278 @@
1
+ import { a as Layout } from './types-BfqUl2h_.mjs';
2
+ import { MeasuredBlock } from './layout/pagination/index.mjs';
3
+ import { D as DisplayList, R as RetainedFrame } from './frameDelta-D965X8yK.mjs';
4
+
5
+ /**
6
+ * JS seam to the Rust display-list builder (crates/docx-layout).
7
+ *
8
+ * Marshals the same `{ measured, options, layout }` triple the golden
9
+ * fixtures pin (see scripts/export-displaylist-fixtures.ts) across the wasm
10
+ * boundary and parses the resulting DisplayList. All paint/geometry decisions
11
+ * happen in Rust — this module is serialization glue only.
12
+ *
13
+ * The wasm module is loaded lazily via dynamic import on first build, so the
14
+ * ~800KB inlined binary costs nothing until the experimental canvas renderer
15
+ * is actually enabled.
16
+ *
17
+ * @experimental part of the rust-canvas-engine change; shape may evolve.
18
+ */
19
+
20
+ /**
21
+ * One header/footer part in the `headersFooters` envelope field: the measured
22
+ * blocks of the HF ProseMirror doc identified by `rId`, plus the band metrics
23
+ * `convertHeaderFooterPmDocToContent` computed (passed through verbatim — the
24
+ * Rust builder re-derives nothing).
25
+ */
26
+ interface DisplayListHfVariant {
27
+ rId: string;
28
+ kind: 'header' | 'footer';
29
+ type: 'default' | 'first' | 'even';
30
+ /** `toMeasuredBlocks(content.blocks, content.measures)` — same schema as body `measured` */
31
+ measured: MeasuredBlock[];
32
+ /** HeaderFooterContent.height (in-flow stack incl. floating blocks) */
33
+ height: number;
34
+ /** HeaderFooterContent.flowHeight (in-flow band height; fallback: height) */
35
+ flowHeight?: number;
36
+ visualTop?: number;
37
+ visualBottom?: number;
38
+ /**
39
+ * Per-page resolved widths of PAGE/NUMPAGES field runs in this HF part, so a
40
+ * centered/right-aligned line carrying such a field re-centers per page. The
41
+ * line width is measured ONCE at the field's fallback text ("1"), so without
42
+ * this the builder holds the same centered position on every page even though
43
+ * "Page 2 of 3"/"Page 10 of 12" have different widths. Omitted ⇒ the fields
44
+ * ride the char-distributed fallback width (byte-identical to before).
45
+ */
46
+ fieldWidths?: DisplayListFieldWidths[];
47
+ }
48
+ /**
49
+ * Per-page widths of one PAGE/NUMPAGES field run in an HF part. `pmStart` is the
50
+ * field run's position in the HF ProseMirror doc (the key the Rust builder
51
+ * matches). `fallbackWidth` is the width the measure baked into `line.width`
52
+ * (the field's fallback text); `perPage[i]` is the width of the field's resolved
53
+ * text on layout page index `i` (PAGE → that page's number, NUMPAGES → total).
54
+ */
55
+ interface DisplayListFieldWidths {
56
+ pmStart: number;
57
+ fallbackWidth: number;
58
+ perPage: number[];
59
+ }
60
+ /**
61
+ * Optional header/footer payload of the builder envelope. Absent ⇒ the Rust
62
+ * output is byte-identical to the body-only build. Flags come off the section
63
+ * properties / settings the DOM painter uses; distances are the same px the
64
+ * painter resolves (`headerDistance ?? page.margins.header ?? 48`).
65
+ */
66
+ interface DisplayListHeadersFooters {
67
+ titlePg?: boolean;
68
+ evenAndOddHeaders?: boolean;
69
+ headerDistance?: number;
70
+ footerDistance?: number;
71
+ /** Page-level Word watermark, painted behind body/header/footer content. */
72
+ watermark?: DisplayListWatermark;
73
+ variants: DisplayListHfVariant[];
74
+ /** Stable section identity. Undefined = document-global legacy envelope. */
75
+ sectionId?: string;
76
+ /** Zero-based section index. */
77
+ sectionIndex?: number;
78
+ }
79
+ type DisplayListWatermark = DisplayListTextWatermark | DisplayListPictureWatermark;
80
+ interface DisplayListTextWatermark {
81
+ kind: 'text';
82
+ text: string;
83
+ font: string;
84
+ color: string;
85
+ semitransparent: boolean;
86
+ layout: 'diagonal' | 'horizontal';
87
+ fontSize?: number;
88
+ /** Undefined defaults to true for watermarks. */
89
+ decorative?: boolean;
90
+ }
91
+ interface DisplayListPictureWatermark {
92
+ kind: 'picture';
93
+ relId?: string;
94
+ dataUrl?: string;
95
+ scale: number;
96
+ washout: boolean;
97
+ widthEmu?: number;
98
+ heightEmu?: number;
99
+ /** Undefined defaults to true for watermarks. */
100
+ decorative?: boolean;
101
+ }
102
+ /** One measured note in a page/section note area. */
103
+ interface DisplayListNoteItem {
104
+ kind?: 'footnote' | 'endnote';
105
+ id?: number;
106
+ displayLabel?: string;
107
+ measured?: MeasuredBlock[];
108
+ height?: number;
109
+ anchorDocStart?: number;
110
+ anchorDocEnd?: number;
111
+ customMarkFollows?: boolean;
112
+ }
113
+ /** Typed non-fragmented note-region input for the Rust display builder. */
114
+ interface DisplayListNoteArea {
115
+ pageIndex?: number;
116
+ sectionId?: string;
117
+ kind?: 'footnote' | 'endnote';
118
+ placement?: 'pageBottom' | 'beneathText' | 'sectEnd' | 'docEnd';
119
+ y?: number;
120
+ height?: number;
121
+ columns?: number;
122
+ separator?: DisplayListNoteItem;
123
+ notes?: DisplayListNoteItem[];
124
+ }
125
+ /** Stable reviewer palette entry for comments/revisions. */
126
+ interface DisplayListCommentAuthor {
127
+ id?: string;
128
+ name?: string;
129
+ paletteIndex?: number;
130
+ color?: string;
131
+ }
132
+ /** One reply of a comment thread (a11y announcement input). */
133
+ interface DisplayListCommentReply {
134
+ id?: number;
135
+ authorId?: string;
136
+ authorName?: string;
137
+ date?: string;
138
+ /** Plain-text body (the builder caps it before it reaches primitives). */
139
+ text?: string;
140
+ }
141
+ /**
142
+ * Per-comment thread metadata keyed by comment id, joined by the builder onto
143
+ * every primitive carrying that id in `commentIds` so the a11y mirror can
144
+ * announce the complete thread (author name, date, body, replies). All string
145
+ * values are file-derived/attacker-controlled; consumers must only ever
146
+ * assign them via textContent/setAttribute.
147
+ */
148
+ interface DisplayListCommentThread {
149
+ /** Comment id — matches the numeric ids in `resolvedCommentIds`/`commentIds`. */
150
+ id?: number;
151
+ authorId?: string;
152
+ authorName?: string;
153
+ date?: string;
154
+ /** Plain-text body (builder-capped before emission). */
155
+ text?: string;
156
+ /** Replies in thread order (builder-capped count and text). */
157
+ replies?: DisplayListCommentReply[];
158
+ }
159
+ /** The `{ measured, options, layout }` envelope the Rust builder consumes. */
160
+ interface DisplayListBuildInputs {
161
+ /** Serialization contract version. Undefined reads as legacy version 0. */
162
+ contractVersion?: number;
163
+ measured: MeasuredBlock[];
164
+ options: unknown;
165
+ layout: Layout;
166
+ /** header/footer parts + section flags; omitted ⇒ body-only display list */
167
+ headersFooters?: DisplayListHeadersFooters;
168
+ /**
169
+ * Doc-wide font-id chains keyed `"<family lowercase>|<bold 0|1>|<italic 0|1>"`
170
+ * → measurement `FontStore` ids — the SAME map the measurement input carries.
171
+ * Present only under Rust measurement (the ids must belong to a populated
172
+ * store); its presence against that store is what gates GlyphRun emission.
173
+ * Omitted ⇒ every text run takes the browser-measured `TextRunPrimitive` path
174
+ * (byte-identical to the pre-glyph build).
175
+ */
176
+ fontChains?: Record<string, number[]>;
177
+ /** Page/section note regions. Undefined = no note emission. */
178
+ noteAreas?: DisplayListNoteArea[];
179
+ /** Resolved comments suppressed from active tint. Undefined = none known. */
180
+ resolvedCommentIds?: number[];
181
+ /** Stable reviewer palette. Undefined = legacy hard-coded colors. */
182
+ commentAuthors?: DisplayListCommentAuthor[];
183
+ /** Per-comment thread metadata for a11y announcements. Undefined = none. */
184
+ commentThreads?: DisplayListCommentThread[];
185
+ }
186
+ /** Minimal engine surface, injectable so tests can fake the wasm module. */
187
+ interface RustDisplayListEngine {
188
+ buildDisplayListJson(input: string): string;
189
+ /** Resident editing engines expose binary deltas; the stateless layout wasm does not. */
190
+ buildDisplayListFrame?(input: string, expectedFrameEpoch: number): Uint8Array;
191
+ /** One-owner ordinary input path; available on the resident editing engine. */
192
+ applyInput?(text: string, expectedFrameEpoch: number): Uint8Array;
193
+ displayHitTestRegionsJson?(pageIndex: number, x: number, y: number): string;
194
+ displayRangeRectsJson?(from: number, to: number): string;
195
+ displayRangeRectsRegionJson?(region: 'body' | 'header' | 'footer', rId: string, from: number, to: number): string;
196
+ }
197
+ type RustDisplayListSourceErrorStage = 'load' | 'build' | 'parse' | 'decode' | 'apply';
198
+ interface RustDisplayFrameResult {
199
+ displayList: DisplayList;
200
+ /** Null only on the compatibility JSON engine path. */
201
+ frame: RetainedFrame | null;
202
+ transport: 'frame-delta-v1' | 'json';
203
+ }
204
+ /**
205
+ * Typed terminal error from the mandatory Rust display-list source. Hosts may
206
+ * surface this through their editor error boundary; it is never permission to
207
+ * silently substitute painter geometry.
208
+ */
209
+ declare class RustDisplayListSourceError extends Error {
210
+ readonly stage: RustDisplayListSourceErrorStage;
211
+ constructor(stage: RustDisplayListSourceErrorStage, cause: unknown);
212
+ }
213
+ /**
214
+ * Query surface over an already-built display list, injectable so tests can
215
+ * fake the wasm module.
216
+ *
217
+ * The `*Json` calls take the display-list JSON string as an argument (the Rust
218
+ * side re-parses it per query — callers should cache the string). The
219
+ * session-handle members parse the list ONCE (`openDisplayList` → handle) and
220
+ * answer many queries by handle with no re-serialization, reusing the same
221
+ * hit/range logic so results are byte-identical. The handle members are
222
+ * OPTIONAL: the embedded wasm carries them only after the integrator re-embeds,
223
+ * so `createDisplayListQueries` feature-detects `hasDisplayListSession` and
224
+ * falls back to the `*Json` path when they are absent.
225
+ */
226
+ interface RustDisplayListQueryEngine {
227
+ /** region-aware hit test → `{"region","rId"?,"pos"}` or `"null"` JSON */
228
+ hitTestRegionsJson(displayList: string, pageIndex: number, x: number, y: number): string;
229
+ /** body PM range → JSON array of `{pageIndex,x,y,width,height}` rects */
230
+ rangeRectsJson(displayList: string, from: number, to: number): string;
231
+ /**
232
+ * Region-aware PM range → JSON array of rects. `region` is
233
+ * `'body' | 'header' | 'footer'`; `rId` scopes header/footer to one HF part
234
+ * (empty for body / match-any). OPTIONAL: the embedded wasm carries it only
235
+ * after the integrator re-embeds, so `createDisplayListQueries` falls back to
236
+ * `[]` when absent (HF selection geometry stays a documented gap until then).
237
+ */
238
+ rangeRectsRegionJson?(displayList: string, region: string, rId: string, from: number, to: number): string;
239
+ /** true when the embedded wasm carries the region-aware range-rect exports */
240
+ hasRangeRectsRegion?(): boolean;
241
+ /** true when the embedded wasm carries the session-handle exports below */
242
+ hasDisplayListSession?(): boolean;
243
+ /** parse a display list once, return a handle for the by-handle queries */
244
+ openDisplayList?(displayList: string): number;
245
+ /** free a handle's parsed display list */
246
+ closeDisplayList?(handle: number): void;
247
+ /** patch a stored display list's changed pages in place (see layout wasm) */
248
+ updateDisplayList?(handle: number, update: string): void;
249
+ /** true when the embedded wasm carries the page-delta update export */
250
+ hasDisplayListUpdate?(): boolean;
251
+ /** region-aware hit test against a stored display list (by handle) */
252
+ hitTestRegionsByHandle?(handle: number, pageIndex: number, x: number, y: number): string;
253
+ /** body PM range against a stored display list (by handle) */
254
+ rangeRectsByHandle?(handle: number, from: number, to: number): string;
255
+ /** region-aware PM range against a stored display list (by handle) */
256
+ rangeRectsRegionByHandle?(handle: number, region: string, rId: string, from: number, to: number): string;
257
+ }
258
+ /**
259
+ * Lazily load the wasm query surface (hit-test + range-rects). Shares the
260
+ * module promise with `buildRustDisplayList`, so on the canvas-renderer path
261
+ * the engine is already resolved by the time the first display list lands.
262
+ */
263
+ declare function loadRustDisplayListQueryEngine(): Promise<RustDisplayListQueryEngine>;
264
+ /** Display-only fields sent to an engine that already retains pagination. */
265
+ declare function encodeDisplayListFrameExtras(inputs: DisplayListBuildInputs): string;
266
+ /**
267
+ * Build a DisplayList for a computed layout through the Rust engine. Throws
268
+ * when the wasm module fails to load or the builder rejects the input — the
269
+ * caller is expected to fall back to the DOM painter.
270
+ */
271
+ declare function buildRustDisplayList(inputs: DisplayListBuildInputs, engine?: RustDisplayListEngine): Promise<DisplayList>;
272
+ /**
273
+ * Production display build. Resident editing engines return FrameDelta v1;
274
+ * older/stateless engines retain the full-JSON parity path.
275
+ */
276
+ declare function buildRustDisplayFrame(inputs: DisplayListBuildInputs, engine?: RustDisplayListEngine, previous?: RetainedFrame | null): Promise<RustDisplayFrameResult>;
277
+
278
+ export { type DisplayListHeadersFooters as D, type RustDisplayListQueryEngine as R, type DisplayListBuildInputs as a, type DisplayListHfVariant as b, type DisplayListPictureWatermark as c, type DisplayListTextWatermark as d, type DisplayListWatermark as e, type RustDisplayFrameResult as f, type RustDisplayListEngine as g, RustDisplayListSourceError as h, type RustDisplayListSourceErrorStage as i, buildRustDisplayFrame as j, buildRustDisplayList as k, encodeDisplayListFrameExtras as l, loadRustDisplayListQueryEngine as m };
@@ -0,0 +1,106 @@
1
+ import { CompatibilityFlags } from './types/document.mjs';
2
+
3
+ /**
4
+ * Script bucket a fallback face provides glyph coverage for. Han text is
5
+ * region-resolved by the caller (SC/TC/JP/KR — see `rustMeasureSource.ts`);
6
+ * kana, Hangul, Arabic and Hebrew detect directly.
7
+ *
8
+ * @public
9
+ */
10
+ type FontScript = 'cjk-sc' | 'cjk-tc' | 'cjk-jp' | 'cjk-kr' | 'arabic' | 'hebrew';
11
+ /**
12
+ * Resolver for the bundled metric-compatible set (Carlito↔Calibri,
13
+ * Liberation↔Arial/Times/Courier, …). Returns a lazy byte loader so the
14
+ * (lazily fetched, same-origin) binary is only downloaded when a document
15
+ * actually needs the face, or `undefined` when the family has no bundled
16
+ * substitute.
17
+ *
18
+ * @public
19
+ */
20
+ interface BundledFontProvider {
21
+ /** Resolve a Word family to bundled metric-compatible face byte loaders, or undefined. */
22
+ resolve(family: string, bold: boolean, italic: boolean): (() => Promise<ArrayBuffer>) | undefined;
23
+ /**
24
+ * Optional per-script coverage fallback (Noto CJK/RTL faces). Same loader
25
+ * contract as {@link BundledFontProvider.resolve}; providers without
26
+ * script faces simply omit the method. These faces are coverage fallbacks
27
+ * first, metric approximations second — CJK metric compatibility is much
28
+ * weaker than the Carlito/Calibri class of substitutes.
29
+ */
30
+ resolveScriptFallback?(script: FontScript, bold: boolean, italic: boolean): (() => Promise<ArrayBuffer>) | undefined;
31
+ /**
32
+ * The always-available last-resort base face (broad-coverage Latin —
33
+ * Liberation Sans/Serif per serif-ness). Unlike {@link
34
+ * BundledFontProvider.resolve}, a conforming provider (e.g.
35
+ * `@betteroffice/docx-fonts`'s `resolveLastResortFace`) returns a loader for
36
+ * EVERY family, so the chain this registry builds is guaranteed non-empty
37
+ * and a run never routes to the browser measurer for want of font bytes. The
38
+ * face's metrics are the base font's, not the requested family's — the
39
+ * accepted divergence for a truly-unknown font, in exchange for staying on
40
+ * the native measurement path.
41
+ *
42
+ * Optional so mock/partial providers can omit it; when absent (or returning
43
+ * undefined) an unmapped family still yields an empty chain and the caller
44
+ * browser-falls-back that run — the pre-policy behavior. Same lazy loader
45
+ * contract as {@link BundledFontProvider.resolve}.
46
+ */
47
+ resolveLastResort?(family: string, bold: boolean, italic: boolean): (() => Promise<ArrayBuffer>) | undefined;
48
+ }
49
+ /**
50
+ * One embedded face extracted from the open document. Structurally identical
51
+ * to `EmbeddedFontFace` (`utils/embeddedFonts.ts`), so the output of
52
+ * `getEmbeddedFontFaces` feeds straight in; duplicated here so this module
53
+ * stays decoupled from the loader.
54
+ *
55
+ * @public
56
+ */
57
+ interface EmbeddedFaceInput {
58
+ /** Word font name the face is registered under (attacker-controlled). */
59
+ family: string;
60
+ /** `'bold'` for the embedBold/embedBoldItalic slots, else `'normal'`. */
61
+ weight: 'normal' | 'bold';
62
+ /** `'italic'` for the embedItalic/embedBoldItalic slots, else `'normal'`. */
63
+ style: 'normal' | 'italic';
64
+ /** De-obfuscated OpenType/TrueType bytes. */
65
+ data: ArrayBuffer;
66
+ /** Whether the source face was subsetted (`w:subsetted`). */
67
+ subsetted: boolean;
68
+ }
69
+
70
+ interface RustTextEngine {
71
+ registerFont(bytes: Uint8Array): number;
72
+ clearFonts(): void;
73
+ }
74
+ interface ResidentFontRequirement {
75
+ key: string;
76
+ family: string;
77
+ bold: boolean;
78
+ italic: boolean;
79
+ scripts?: FontScript[];
80
+ }
81
+ interface ResidentMeasurementConfig {
82
+ fontChains: Record<string, number[]>;
83
+ defaults: {
84
+ fontSize: 11;
85
+ fontFamily: 'Calibri';
86
+ };
87
+ compat: {
88
+ noLeading: boolean;
89
+ doNotExpandShiftReturn: boolean;
90
+ };
91
+ authoritativeShaping: true;
92
+ }
93
+ interface RustMeasureSource {
94
+ setEmbeddedFaces(faces: EmbeddedFaceInput[]): void;
95
+ setCompat(flags: CompatibilityFlags | undefined): void;
96
+ prepareFontRequirements(requirements: ResidentFontRequirement[]): Promise<boolean>;
97
+ measurementConfigForRequirements(requirements: ResidentFontRequirement[]): ResidentMeasurementConfig | undefined;
98
+ clear(): void;
99
+ }
100
+ declare function getRustTextEngine(): Promise<RustTextEngine>;
101
+ declare function createRustMeasureSource(options: {
102
+ engine: RustTextEngine;
103
+ bundled?: BundledFontProvider;
104
+ }): RustMeasureSource;
105
+
106
+ export { type BundledFontProvider as B, type EmbeddedFaceInput as E, type FontScript as F, type ResidentMeasurementConfig as R, type ResidentFontRequirement as a, type RustMeasureSource as b, type RustTextEngine as c, createRustMeasureSource as d, getRustTextEngine as g };
@@ -0,0 +1,56 @@
1
+ import { Document } from './types/document.mjs';
2
+ import { D as DocxInput } from './docxInput-DTbCa48g.mjs';
3
+
4
+ /**
5
+ * Public DOCX parser facade.
6
+ *
7
+ * Rust S9 owns ZIP/XML parsing. TypeScript only normalizes host inputs,
8
+ * rehydrates the public `Document`, reports progress, and registers fonts.
9
+ * @packageDocumentation
10
+ * @public
11
+ */
12
+
13
+ type ProgressCallback = (stage: string, percent: number) => void;
14
+ interface ParseOptions {
15
+ onProgress?: ProgressCallback;
16
+ preloadFonts?: boolean;
17
+ parseHeadersFooters?: boolean;
18
+ parseNotes?: boolean;
19
+ }
20
+ declare function parseDocx(input: DocxInput, options?: ParseOptions): Promise<Document>;
21
+
22
+ /**
23
+ * Public DOCX package I/O wrappers.
24
+ *
25
+ * Model serialization and selective package writing are Rust-owned. The
26
+ * TypeScript kept here is compatibility glue for public ZIP utilities and host
27
+ * values; package inflation/deflation continues through `docx-container` wasm.
28
+ * @packageDocumentation
29
+ * @public
30
+ */
31
+
32
+ interface RepackOptions {
33
+ /** Retained for signature compatibility; `docx-container` chooses compression. */
34
+ compressionLevel?: number;
35
+ updateModifiedDate?: boolean;
36
+ modifiedBy?: string;
37
+ }
38
+ /** Repack a public Document through the live Rust S13 writer. */
39
+ declare function repackDocx(doc: Document, options?: RepackOptions): Promise<ArrayBuffer>;
40
+ declare function updateMultipleFiles(originalBuffer: ArrayBuffer, updates: Map<string, string | ArrayBuffer>, options?: RepackOptions): Promise<ArrayBuffer>;
41
+ declare function createDocx(doc: Document): Promise<ArrayBuffer>;
42
+
43
+ /** Rust-backed selective DOCX save compatibility wrapper. */
44
+
45
+ interface SelectiveSaveOptions {
46
+ changedParaIds: Set<string>;
47
+ structuralChange: boolean;
48
+ hasUntrackedChanges: boolean;
49
+ }
50
+ /**
51
+ * Patch changed paragraphs through the Rust S13 writer. Returns `null` when
52
+ * selective save is unsafe so callers can fall back to a full repack.
53
+ */
54
+ declare function attemptSelectiveSave(doc: Document, originalBuffer: ArrayBuffer, options: SelectiveSaveOptions): Promise<ArrayBuffer | null>;
55
+
56
+ export { attemptSelectiveSave as a, createDocx as c, parseDocx as p, repackDocx as r, updateMultipleFiles as u };
@@ -1,5 +1,5 @@
1
- import { P as ParagraphFormatting, T as TextFormatting, p as TableLook } from '../formatting-DoL7KBSL.mjs';
2
- import { a as StyleDefinitions, S as Style, D as DocDefaults } from '../styles-VxNcXLdi.mjs';
1
+ import { P as ParagraphFormatting, a as TextFormatting } from '../formatting-D1EPSaJP.mjs';
2
+ import { S as StyleDefinitions, a as Style, D as DocDefaults } from '../styles-Dn_o3Vo5.mjs';
3
3
 
4
4
  /**
5
5
  * Style Resolver for ProseMirror Editor
@@ -8,7 +8,7 @@ import { a as StyleDefinitions, S as Style, D as DocDefaults } from '../styles-V
8
8
  * Handles the cascade:
9
9
  * 1. Document defaults (docDefaults)
10
10
  * 2. Normal style (if no explicit styleId)
11
- * 3. Style chain (basedOn inheritance - already resolved by styleParser)
11
+ * 3. Style chain (basedOn inheritance resolved during parsing)
12
12
  * 4. Inline properties
13
13
  *
14
14
  * Based on ECMA-376 style cascade rules.
@@ -124,39 +124,4 @@ declare class StyleResolver {
124
124
  */
125
125
  declare function createStyleResolver(styleDefinitions: StyleDefinitions | undefined): StyleResolver;
126
126
 
127
- /**
128
- * Which table style a freshly inserted table should wear.
129
- *
130
- * Both insert paths (toolbar and agent) call into here so a new table picks
131
- * up the document's own table look instead of a bare black grid. The
132
- * document can express that look two ways, and we trust them in order of
133
- * specificity: an explicit `w:defaultTableStyle` in settings.xml
134
- * (§17.15.1.44) wins when it points at a real style; failing that, a table
135
- * style marked `w:default="1"` (§17.7.4.18) is used — except when that
136
- * default is only the formatting-free base ("Table Normal"), which every
137
- * table already inherits and which would add nothing. With neither present
138
- * the caller keeps its plain-border fallback.
139
- *
140
- * We deliberately never guess by probing for the TableGrid builtin: a
141
- * document may ship that style without meaning it as its insert default,
142
- * and the two spec elements above are how templates state intent.
143
- */
144
-
145
- /**
146
- * `tblLook` Word applies to a brand-new table (val="04A0"): style the first
147
- * row and first column, enable horizontal banding, disable vertical banding.
148
- * Setting this lets a resolved table style paint its header-row and banding
149
- * conditional formatting on the inserted table, matching how Word renders a
150
- * fresh table created with that style.
151
- */
152
- declare const DEFAULT_NEW_TABLE_LOOK: TableLook;
153
- /**
154
- * StyleId a brand-new table should adopt, or `undefined` when the document
155
- * declares nothing usable (the caller then keeps its plain-border default).
156
- *
157
- * @param settingsStyleId - `w:defaultTableStyle` from settings.xml
158
- * @param styles - the document's style resolver (null when unavailable)
159
- */
160
- declare function pickTableStyleForInsert(settingsStyleId: string | undefined | null, styles: StyleResolver | null | undefined): string | undefined;
161
-
162
- export { DEFAULT_NEW_TABLE_LOOK, type ResolvedParagraphStyle, StyleResolver, createStyleResolver, pickTableStyleForInsert };
127
+ export { type ResolvedParagraphStyle, StyleResolver, createStyleResolver };
@@ -1 +1 @@
1
- export{d as DEFAULT_NEW_TABLE_LOOK,b as StyleResolver,c as createStyleResolver,e as pickTableStyleForInsert}from'../chunk-KXNZFTTK.mjs';import'../chunk-TTRUPDAB.mjs';
1
+ export{b as StyleResolver,c as createStyleResolver}from'../chunk-WBH3SXI6.mjs';import'../chunk-TTRUPDAB.mjs';
@@ -1,4 +1,4 @@
1
- import { T as TextFormatting, P as ParagraphFormatting, o as TableFormatting, s as TableRowFormatting, n as TableCellFormatting } from './formatting-DoL7KBSL.mjs';
1
+ import { a as TextFormatting, P as ParagraphFormatting, b as TableFormatting, c as TableRowFormatting, d as TableCellFormatting } from './formatting-D1EPSaJP.mjs';
2
2
 
3
3
  /**
4
4
  * Styles, Theme, Font Table, Relationships & Media Types
@@ -186,4 +186,4 @@ interface MediaFile {
186
186
  dataUrl?: string;
187
187
  }
188
188
 
189
- export type { DocDefaults as D, FontTable as F, MediaFile as M, Relationship as R, Style as S, StyleDefinitions as a, RelationshipMap as b, FontEmbed as c, FontInfo as d, RelationshipType as e, StyleType as f };
189
+ export type { DocDefaults as D, FontTable as F, MediaFile as M, RelationshipMap as R, StyleDefinitions as S, Style as a, FontEmbed as b, FontInfo as c, Relationship as d, RelationshipType as e, StyleType as f };
@@ -1,3 +1,3 @@
1
- export { B as BlockContent, p as BlockSdt, q as BookmarkEnd, r as BookmarkStart, s as BreakContent, n as Chart, t as ChartAxis, u as ChartContent, w as ChartLegend, z as ChartSeries, G as ChartType, J as Column, C as Comment, a as CommentRangeEnd, b as CommentRangeStart, U as ComplexField, X as DEFAULT_WATERMARK_PRESETS, D as Deletion, c as DocumentBody, Y as DrawingContent, E as Endnote, $ as EndnotePosition, a0 as EndnoteProperties, a1 as Field, a2 as FieldCharContent, a5 as FieldType, a6 as FooterReference, F as Footnote, a7 as FootnotePosition, a8 as FootnoteProperties, m as HeaderFooter, a9 as HeaderFooterType, aa as HeaderReference, H as Hyperlink, I as Image, ac as ImageCrop, af as ImagePadding, ag as ImagePosition, ai as ImageSize, aj as ImageTransform, ak as ImageWrap, am as InlineSdt, d as Insertion, an as InstrTextContent, ap as LineNumberRestart, ar as MathEquation, M as MoveFrom, as as MoveFromRangeEnd, at as MoveFromRangeStart, e as MoveTo, au as MoveToRangeEnd, av as MoveToRangeStart, aw as NoBreakHyphenContent, ay as NoteNumberRestart, az as NoteRefMarkContent, aA as NoteReferenceContent, aF as PageOrientation, P as Paragraph, f as ParagraphContent, aG as ParagraphPropertyChange, aH as PictureWatermark, aI as PropertyChangeInfo, R as Run, g as RunContent, aJ as RunPropertyChange, aM as SdtDataBinding, aP as SdtProperties, aQ as SdtType, aR as Section, S as SectionProperties, aS as SectionStart, aT as SeparatorContent, aU as Shape, aV as ShapeContent, aX as ShapeFill, aZ as ShapeOutline, a$ as ShapeTextBody, b1 as ShapeType, b2 as SimpleField, b3 as SoftHyphenContent, b6 as SymbolContent, b7 as TabContent, T as Table, h as TableCell, b8 as TableCellPropertyChange, b9 as TablePropertyChange, i as TableRow, ba as TableRowPropertyChange, bb as TableStructuralChangeInfo, bc as TextBox, j as TextContent, bd as TextWatermark, k as TrackedChangeInfo, l as TrackedRunChange, be as VerticalAlign, W as Watermark, bf as pictureWatermarkDisplayEmu } from '../content-sSHuWw49.mjs';
2
- import '../formatting-DoL7KBSL.mjs';
1
+ export { B as BlockContent, m as BlockSdt, n as BookmarkEnd, o as BookmarkStart, p as BreakContent, e as Chart, q as ChartAxis, r as ChartContent, t as ChartLegend, w as ChartSeries, x as ChartType, y as Column, g as Comment, I as CommentRangeEnd, J as CommentRangeStart, L as ComplexField, O as DEFAULT_WATERMARK_PRESETS, Q as Deletion, h as DocumentBody, T as DrawingContent, k as Endnote, V as EndnotePosition, E as EndnoteProperties, X as Field, Y as FieldCharContent, $ as FieldType, a0 as FooterReference, j as Footnote, a1 as FootnotePosition, F as FootnoteProperties, H as HeaderFooter, a2 as HeaderFooterType, a3 as HeaderReference, a4 as Hyperlink, a6 as Image, a7 as ImageCrop, aa as ImagePadding, ab as ImagePosition, ad as ImageSize, ae as ImageTransform, af as ImageWrap, ah as InlineSdt, ai as Insertion, aj as InstrTextContent, al as LineNumberRestart, ao as MathEquation, ap as MoveFrom, aq as MoveFromRangeEnd, ar as MoveFromRangeStart, as as MoveTo, at as MoveToRangeEnd, au as MoveToRangeStart, av as NoBreakHyphenContent, aw as NoteNumberRestart, ax as NoteRefMarkContent, ay as NoteReferenceContent, aD as PageOrientation, f as Paragraph, aE as ParagraphContent, aF as ParagraphPropertyChange, aG as PictureWatermark, aH as PropertyChangeInfo, aI as Run, aJ as RunContent, aK as RunPropertyChange, aM as SdtDataBinding, b as SdtProperties, aP as SdtType, aQ as Section, S as SectionProperties, aR as SectionStart, aS as SeparatorContent, aT as Shape, aU as ShapeContent, aV as ShapeFill, aX as ShapeOutline, aZ as ShapeTextBody, a_ as ShapeType, a$ as SimpleField, b0 as SoftHyphenContent, b3 as SymbolContent, b4 as TabContent, b5 as Table, b6 as TableCell, b7 as TableCellPropertyChange, b8 as TablePropertyChange, b9 as TableRow, ba as TableRowPropertyChange, bb as TableStructuralChangeInfo, bc as TextBox, bd as TextContent, be as TextWatermark, bf as TrackedChangeInfo, bg as TrackedRunChange, bh as VerticalAlign, W as Watermark, bi as pictureWatermarkDisplayEmu } from '../content-MOZ6hKP4.mjs';
2
+ import '../formatting-D1EPSaJP.mjs';
3
3
  import '../docx/wrapTypes.mjs';
@@ -1,13 +1,41 @@
1
- import { c as DocumentBody, N as NumberingDefinitions, F as Footnote, E as Endnote, m as HeaderFooter, n as Chart, o as BookmarkRange } from '../content-sSHuWw49.mjs';
2
- export { A as AbstractNumbering, B as BlockContent, p as BlockSdt, q as BookmarkEnd, r as BookmarkStart, s as BreakContent, t as ChartAxis, u as ChartContent, v as ChartGrouping, w as ChartLegend, x as ChartPlotGroup, y as ChartPoint, z as ChartSeries, G as ChartType, J as Column, C as Comment, K as CommentAnchorRange, O as CommentAuthor, a as CommentRangeEnd, b as CommentRangeStart, Q as CommentReferenceContent, U as ComplexField, V as ContentPosition, X as DEFAULT_WATERMARK_PRESETS, D as Deletion, Y as DrawingContent, Z as DrawingScene, _ as DrawingSceneNode, $ as EndnotePosition, a0 as EndnoteProperties, a1 as Field, a2 as FieldCharContent, a3 as FieldFormData, a4 as FieldInlineContent, a5 as FieldType, a6 as FooterReference, a7 as FootnotePosition, a8 as FootnoteProperties, a9 as HeaderFooterType, aa as HeaderReference, H as Hyperlink, ab as HyperlinkContent, I as Image, ac as ImageCrop, ad as ImageEffect, ae as ImageHyperlink, af as ImagePadding, ag as ImagePosition, ah as ImageRotationBounds, ai as ImageSize, aj as ImageTransform, ak as ImageWrap, al as ImageWrapPoint, am as InlineSdt, d as Insertion, an as InstrTextContent, ao as LevelSuffix, ap as LineNumberRestart, L as ListLevel, aq as ListRendering, ar as MathEquation, M as MoveFrom, as as MoveFromRangeEnd, at as MoveFromRangeStart, e as MoveTo, au as MoveToRangeEnd, av as MoveToRangeStart, aw as NoBreakHyphenContent, ax as NoteKind, ay as NoteNumberRestart, az as NoteRefMarkContent, aA as NoteReferenceContent, aB as NoteSeparatorReference, aC as NumberFormat, aD as NumberingInstance, aE as PageNumberingProperties, aF as PageOrientation, P as Paragraph, f as ParagraphContent, aG as ParagraphPropertyChange, aH as PictureWatermark, aI as PropertyChangeInfo, R as Run, g as RunContent, aJ as RunPropertyChange, aK as SdtCheckboxGlyph, aL as SdtControlState, aM as SdtDataBinding, aN as SdtDateState, aO as SdtGalleryState, aP as SdtProperties, aQ as SdtType, aR as Section, S as SectionProperties, aS as SectionStart, aT as SeparatorContent, aU as Shape, aV as ShapeContent, aW as ShapeEffect, aX as ShapeFill, aY as ShapeFillPaint, aZ as ShapeOutline, a_ as ShapeStrokePaint, a$ as ShapeTextBody, b0 as ShapeTextBodyProperties, b1 as ShapeType, b2 as SimpleField, b3 as SoftHyphenContent, b4 as StructuredFieldContent, b5 as StructuredFieldTree, b6 as SymbolContent, b7 as TabContent, T as Table, h as TableCell, b8 as TableCellPropertyChange, b9 as TablePropertyChange, i as TableRow, ba as TableRowPropertyChange, bb as TableStructuralChangeInfo, bc as TextBox, j as TextContent, bd as TextWatermark, k as TrackedChangeInfo, l as TrackedRunChange, be as VerticalAlign, W as Watermark, bf as pictureWatermarkDisplayEmu } from '../content-sSHuWw49.mjs';
3
- import { a as Theme, C as ColorValue } from '../formatting-DoL7KBSL.mjs';
4
- export { B as BorderSpec, c as CellMargins, e as ConditionalFormatStyle, E as EmphasisMark, F as FloatingTableProperties, L as LineSpacingRule, f as ParagraphAlignment, P as ParagraphFormatting, R as RunFontHint, h as RunLanguage, S as ShadingProperties, i as TabLeader, j as TabStop, k as TabStopAlignment, m as TableBorders, n as TableCellFormatting, o as TableFormatting, p as TableLook, q as TableMeasurement, s as TableRowFormatting, t as TableStyleCascade, u as TableStyleRegion, v as TableWidthType, w as TextEffect, T as TextFormatting, x as TextModernEffects, y as ThemeColorScheme, z as ThemeColorSlot, A as ThemeFont, D as ThemeFontScheme, U as UnderlineStyle } from '../formatting-DoL7KBSL.mjs';
5
- import { a as StyleDefinitions, F as FontTable, b as RelationshipMap, M as MediaFile } from '../styles-VxNcXLdi.mjs';
6
- export { D as DocDefaults, c as FontEmbed, d as FontInfo, R as Relationship, e as RelationshipType, S as Style, f as StyleType } from '../styles-VxNcXLdi.mjs';
7
- import { D as DocumentSettings } from '../settingsParser-CcGvtmCK.mjs';
8
- export { C as CompatibilityFlags } from '../settingsParser-CcGvtmCK.mjs';
1
+ import { F as FootnoteProperties, E as EndnoteProperties, h as DocumentBody, i as NumberingDefinitions, j as Footnote, k as Endnote, H as HeaderFooter, e as Chart, l as BookmarkRange } from '../content-MOZ6hKP4.mjs';
2
+ export { A as AbstractNumbering, B as BlockContent, m as BlockSdt, n as BookmarkEnd, o as BookmarkStart, p as BreakContent, q as ChartAxis, r as ChartContent, s as ChartGrouping, t as ChartLegend, u as ChartPlotGroup, v as ChartPoint, w as ChartSeries, x as ChartType, y as Column, g as Comment, z as CommentAnchorRange, G as CommentAuthor, I as CommentRangeEnd, J as CommentRangeStart, K as CommentReferenceContent, L as ComplexField, M as ContentPosition, O as DEFAULT_WATERMARK_PRESETS, Q as Deletion, T as DrawingContent, D as DrawingScene, U as DrawingSceneNode, V as EndnotePosition, X as Field, Y as FieldCharContent, Z as FieldFormData, _ as FieldInlineContent, $ as FieldType, a0 as FooterReference, a1 as FootnotePosition, a2 as HeaderFooterType, a3 as HeaderReference, a4 as Hyperlink, a5 as HyperlinkContent, a6 as Image, a7 as ImageCrop, a8 as ImageEffect, a9 as ImageHyperlink, aa as ImagePadding, ab as ImagePosition, ac as ImageRotationBounds, ad as ImageSize, ae as ImageTransform, af as ImageWrap, ag as ImageWrapPoint, ah as InlineSdt, ai as Insertion, aj as InstrTextContent, ak as LevelSuffix, al as LineNumberRestart, am as ListLevel, an as ListRendering, ao as MathEquation, ap as MoveFrom, aq as MoveFromRangeEnd, ar as MoveFromRangeStart, as as MoveTo, at as MoveToRangeEnd, au as MoveToRangeStart, av as NoBreakHyphenContent, N as NoteKind, aw as NoteNumberRestart, ax as NoteRefMarkContent, ay as NoteReferenceContent, az as NoteSeparatorReference, aA as NumberFormat, aB as NumberingInstance, aC as PageNumberingProperties, aD as PageOrientation, f as Paragraph, aE as ParagraphContent, aF as ParagraphPropertyChange, aG as PictureWatermark, aH as PropertyChangeInfo, aI as Run, aJ as RunContent, aK as RunPropertyChange, aL as SdtCheckboxGlyph, a as SdtControlState, aM as SdtDataBinding, aN as SdtDateState, aO as SdtGalleryState, b as SdtProperties, aP as SdtType, aQ as Section, S as SectionProperties, aR as SectionStart, aS as SeparatorContent, aT as Shape, aU as ShapeContent, c as ShapeEffect, aV as ShapeFill, aW as ShapeFillPaint, aX as ShapeOutline, aY as ShapeStrokePaint, aZ as ShapeTextBody, d as ShapeTextBodyProperties, a_ as ShapeType, a$ as SimpleField, b0 as SoftHyphenContent, b1 as StructuredFieldContent, b2 as StructuredFieldTree, b3 as SymbolContent, b4 as TabContent, b5 as Table, b6 as TableCell, b7 as TableCellPropertyChange, b8 as TablePropertyChange, b9 as TableRow, ba as TableRowPropertyChange, bb as TableStructuralChangeInfo, bc as TextBox, bd as TextContent, be as TextWatermark, bf as TrackedChangeInfo, bg as TrackedRunChange, bh as VerticalAlign, W as Watermark, bi as pictureWatermarkDisplayEmu } from '../content-MOZ6hKP4.mjs';
3
+ import { e as Theme, C as ColorValue } from '../formatting-D1EPSaJP.mjs';
4
+ export { B as BorderSpec, g as CellMargins, h as ConditionalFormatStyle, E as EmphasisMark, F as FloatingTableProperties, L as LineSpacingRule, i as ParagraphAlignment, P as ParagraphFormatting, R as RunFontHint, j as RunLanguage, S as ShadingProperties, k as TabLeader, l as TabStop, m as TabStopAlignment, n as TableBorders, d as TableCellFormatting, b as TableFormatting, o as TableLook, p as TableMeasurement, c as TableRowFormatting, q as TableStyleCascade, r as TableStyleRegion, s as TableWidthType, t as TextEffect, a as TextFormatting, T as TextModernEffects, u as ThemeColorScheme, f as ThemeColorSlot, v as ThemeFont, w as ThemeFontScheme, U as UnderlineStyle } from '../formatting-D1EPSaJP.mjs';
5
+ import { S as StyleDefinitions, F as FontTable, R as RelationshipMap, M as MediaFile } from '../styles-Dn_o3Vo5.mjs';
6
+ export { D as DocDefaults, b as FontEmbed, c as FontInfo, d as Relationship, e as RelationshipType, a as Style, f as StyleType } from '../styles-Dn_o3Vo5.mjs';
9
7
  import '../docx/wrapTypes.mjs';
10
8
 
9
+ interface CompatibilityFlags {
10
+ compatibilityMode: number;
11
+ noLeading: boolean;
12
+ doNotExpandShiftReturn: boolean;
13
+ useWord97LineBreakRules: boolean;
14
+ balanceSingleByteDoubleByteWidth: boolean;
15
+ }
16
+ /** Public model contract rehydrated by the Rust S9 facade. */
17
+ interface DocumentSettings {
18
+ defaultTabStop: number;
19
+ defaultTableStyle?: string;
20
+ themeFontLang?: {
21
+ eastAsia?: string;
22
+ bidi?: string;
23
+ };
24
+ compatibilityFlags: CompatibilityFlags;
25
+ updateFields?: boolean;
26
+ trackRevisions?: boolean;
27
+ doNotTrackMoves?: boolean;
28
+ doNotTrackFormatting?: boolean;
29
+ revisionView?: {
30
+ markup?: boolean;
31
+ comments?: boolean;
32
+ insertionsDeletions?: boolean;
33
+ formatting?: boolean;
34
+ };
35
+ footnotePr?: FootnoteProperties;
36
+ endnotePr?: EndnoteProperties;
37
+ }
38
+
11
39
  /**
12
40
  * Comprehensive TypeScript types for full DOCX document representation
13
41
  *
@@ -91,12 +119,12 @@ interface DocxPackage {
91
119
  * Top-level parsed DOCX document — the result of `parseDocx(buffer)`.
92
120
  *
93
121
  * Wraps the unzipped DOCX package (`document.xml`, `styles.xml`, etc.),
94
- * the original buffer for round-trip saves, and any template variables /
95
- * parse warnings detected during ingestion.
122
+ * the original buffer for round-trip saves and parse warnings detected during
123
+ * ingestion.
96
124
  *
97
125
  * @example
98
126
  * ```ts
99
- * import { parseDocx } from '@betteroffice/docx/headless';
127
+ * import { parseDocx } from '@betteroffice/docx/docx';
100
128
  * const doc = await parseDocx(buffer);
101
129
  * console.log(doc.package.document.content.length);
102
130
  * ```
@@ -108,10 +136,8 @@ interface Document {
108
136
  package: DocxPackage;
109
137
  /** Original DOCX buffer. Kept for round-trip saves that preserve untouched parts. */
110
138
  originalBuffer?: ArrayBuffer;
111
- /** Detected docxtemplater variables (e.g. `{name}`, `{address}`). Populated when the document is recognized as a template. */
112
- templateVariables?: string[];
113
139
  /** Non-fatal parser diagnostics — malformed parts, unsupported features, fallbacks. */
114
140
  warnings?: string[];
115
141
  }
116
142
 
117
- export { BookmarkRange, Chart, ColorValue, type Document, DocumentBody, DocumentSettings, type DocxPackage, Endnote, FontTable, Footnote, HeaderFooter, MediaFile, NumberingDefinitions, RelationshipMap, StyleDefinitions, Theme };
143
+ export { BookmarkRange, Chart, ColorValue, type CompatibilityFlags, type Document, DocumentBody, type DocumentSettings, type DocxPackage, Endnote, EndnoteProperties, FontTable, Footnote, FootnoteProperties, HeaderFooter, MediaFile, NumberingDefinitions, RelationshipMap, StyleDefinitions, Theme };