docxodus 6.3.0 → 7.0.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 (74) hide show
  1. package/dist/docxodus.worker.js +13 -6
  2. package/dist/docxodus.worker.js.map +1 -1
  3. package/dist/editor.bundle.js +2143 -0
  4. package/dist/editor.d.ts +336 -0
  5. package/dist/editor.d.ts.map +1 -0
  6. package/dist/editor.js +1525 -0
  7. package/dist/editor.js.map +1 -0
  8. package/dist/index.d.ts +130 -5
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.js +336 -8
  11. package/dist/index.js.map +1 -1
  12. package/dist/session.bundle.js +674 -0
  13. package/dist/session.d.ts +72 -2
  14. package/dist/session.d.ts.map +1 -1
  15. package/dist/session.js +104 -0
  16. package/dist/session.js.map +1 -1
  17. package/dist/types.d.ts +326 -5
  18. package/dist/types.d.ts.map +1 -1
  19. package/dist/types.js +67 -0
  20. package/dist/types.js.map +1 -1
  21. package/dist/wasm/_framework/DocumentFormat.OpenXml.Framework.wasm +0 -0
  22. package/dist/wasm/_framework/DocumentFormat.OpenXml.wasm +0 -0
  23. package/dist/wasm/_framework/Docxodus.wasm +0 -0
  24. package/dist/wasm/_framework/DocxodusWasm.wasm +0 -0
  25. package/dist/wasm/_framework/System.Collections.Concurrent.wasm +0 -0
  26. package/dist/wasm/_framework/System.Collections.Immutable.wasm +0 -0
  27. package/dist/wasm/_framework/System.Collections.NonGeneric.wasm +0 -0
  28. package/dist/wasm/_framework/System.Collections.Specialized.wasm +0 -0
  29. package/dist/wasm/_framework/System.Collections.wasm +0 -0
  30. package/dist/wasm/_framework/System.ComponentModel.Primitives.wasm +0 -0
  31. package/dist/wasm/_framework/System.ComponentModel.TypeConverter.wasm +0 -0
  32. package/dist/wasm/_framework/System.ComponentModel.wasm +0 -0
  33. package/dist/wasm/_framework/System.Console.wasm +0 -0
  34. package/dist/wasm/_framework/System.Diagnostics.Process.wasm +0 -0
  35. package/dist/wasm/_framework/System.IO.Compression.wasm +0 -0
  36. package/dist/wasm/_framework/System.IO.Packaging.wasm +0 -0
  37. package/dist/wasm/_framework/System.IO.Pipelines.wasm +0 -0
  38. package/dist/wasm/_framework/System.Linq.Expressions.wasm +0 -0
  39. package/dist/wasm/_framework/System.Linq.wasm +0 -0
  40. package/dist/wasm/_framework/System.Memory.wasm +0 -0
  41. package/dist/wasm/_framework/System.Net.Http.wasm +0 -0
  42. package/dist/wasm/_framework/System.Net.Primitives.wasm +0 -0
  43. package/dist/wasm/_framework/System.ObjectModel.wasm +0 -0
  44. package/dist/wasm/_framework/System.Private.CoreLib.wasm +0 -0
  45. package/dist/wasm/_framework/System.Private.Uri.wasm +0 -0
  46. package/dist/wasm/_framework/System.Private.Xml.Linq.wasm +0 -0
  47. package/dist/wasm/_framework/System.Private.Xml.wasm +0 -0
  48. package/dist/wasm/_framework/System.Runtime.InteropServices.JavaScript.wasm +0 -0
  49. package/dist/wasm/_framework/System.Runtime.wasm +0 -0
  50. package/dist/wasm/_framework/System.Security.Cryptography.wasm +0 -0
  51. package/dist/wasm/_framework/System.Text.Encoding.Extensions.wasm +0 -0
  52. package/dist/wasm/_framework/System.Text.Encodings.Web.wasm +0 -0
  53. package/dist/wasm/_framework/System.Text.Json.wasm +0 -0
  54. package/dist/wasm/_framework/System.Text.RegularExpressions.wasm +0 -0
  55. package/dist/wasm/_framework/System.Threading.Thread.wasm +0 -0
  56. package/dist/wasm/_framework/System.Threading.wasm +0 -0
  57. package/dist/wasm/_framework/System.Xml.Linq.wasm +0 -0
  58. package/dist/wasm/_framework/System.Xml.ReaderWriter.wasm +0 -0
  59. package/dist/wasm/_framework/System.Xml.XDocument.wasm +0 -0
  60. package/dist/wasm/_framework/System.Xml.XPath.XDocument.wasm +0 -0
  61. package/dist/wasm/_framework/System.Xml.XPath.wasm +0 -0
  62. package/dist/wasm/_framework/System.wasm +0 -0
  63. package/dist/wasm/_framework/dotnet.boot.js +279 -0
  64. package/dist/wasm/_framework/dotnet.js +2 -2
  65. package/dist/wasm/_framework/dotnet.js.map +1 -1
  66. package/dist/wasm/_framework/dotnet.native.js +5628 -3
  67. package/dist/wasm/_framework/dotnet.native.js.symbols +5530 -3599
  68. package/dist/wasm/_framework/dotnet.native.wasm +0 -0
  69. package/dist/wasm/_framework/dotnet.runtime.js +1 -1
  70. package/dist/wasm/_framework/dotnet.runtime.js.map +1 -1
  71. package/package.json +8 -4
  72. package/dist/wasm/_framework/System.Diagnostics.DiagnosticSource.wasm +0 -0
  73. package/dist/wasm/_framework/blazor.boot.json +0 -66
  74. package/dist/wasm/_framework/supportFiles/0_runtimeconfig.bin +0 -1
@@ -0,0 +1,336 @@
1
+ /**
2
+ * DocxEditor — a framework-agnostic, in-browser DOCX block editor.
3
+ *
4
+ * Architecture (see docs/architecture/ir_editor_feasibility.md, "Option B"):
5
+ * - model-of-record: a live DocxSession in WASM (lossless save);
6
+ * - rendering: WmlToHtmlConverter HTML (faithful) stamped with data-anchor;
7
+ * - editing: each block is contenteditable; on commit, the edit goes through
8
+ * DocxSession by anchor, then ONLY that block is re-rendered from the live
9
+ * session (session-attached RenderBlockHtml) and patched into the DOM.
10
+ *
11
+ * The IR/anchor system is the addressing spine; the live OOXML is the truth.
12
+ * This is the pure-TypeScript core; a React wrapper can sit on top.
13
+ *
14
+ * MVP scope: per-block, commit-on-blur editing of paragraphs/headings. An edited
15
+ * block's content is replaced from its plain text (inline formatting within an
16
+ * edited block is not preserved — a documented MVP limit); UNTOUCHED blocks keep
17
+ * full fidelity, and save() is lossless for them.
18
+ */
19
+ /** The subset of WASM bridge exports the editor needs (as exposed on `window.Docxodus`). */
20
+ export interface DocxEditorExports {
21
+ DocxSessionBridge: {
22
+ OpenSession: (bytes: Uint8Array, settingsJson: string) => number;
23
+ CloseSession: (handle: number) => void;
24
+ CreateBlankDocx: () => Uint8Array;
25
+ Project: (handle: number) => string;
26
+ ReplaceText: (handle: number, anchor: string, md: string) => string;
27
+ ReplaceTextAtSpan: (handle: number, anchor: string, spanStart: number, spanLength: number, replace: string) => string;
28
+ SplitParagraph: (handle: number, anchor: string, offset: number) => string;
29
+ MergeParagraphs: (handle: number, first: string, second: string) => string;
30
+ DeleteBlock: (handle: number, anchor: string) => string;
31
+ InsertHorizontalRule: (handle: number, anchor: string, pos: string, ruleJson: string) => string;
32
+ InsertTable: (handle: number, anchor: string, pos: string, rows: number, cols: number, optionsJson: string) => string;
33
+ InsertTableRow: (handle: number, cellAnchor: string, pos: string) => string;
34
+ InsertTableColumn: (handle: number, cellAnchor: string, pos: string) => string;
35
+ DeleteTableRow: (handle: number, cellAnchor: string) => string;
36
+ DeleteTableColumn: (handle: number, cellAnchor: string) => string;
37
+ ApplyFormat: (handle: number, anchor: string, spanJson: string, opJson: string) => string;
38
+ SetParagraphStyle: (handle: number, anchor: string, styleId: string) => string;
39
+ SetParagraphFormat: (handle: number, anchor: string, opJson: string) => string;
40
+ ApplyListFormat: (handle: number, anchor: string, kind: string) => string;
41
+ SetListLevel: (handle: number, anchor: string, delta: number) => string;
42
+ GetListMembership: (handle: number, anchor: string) => string;
43
+ RenderBlockHtml: (handle: number, anchorId: string, cssPrefix: string, fabricateClasses: boolean) => string;
44
+ /** Session-attached full-document render (optional: older WASM bundles lack it). */
45
+ RenderHtml?: (handle: number, cssPrefix: string, fabricateClasses: boolean, paginated: boolean, scale: number) => string;
46
+ Save: (handle: number) => Uint8Array;
47
+ Undo: (handle: number) => boolean;
48
+ Redo: (handle: number) => boolean;
49
+ };
50
+ DocumentConverter: {
51
+ ConvertDocxToHtmlComplete: (...args: any[]) => string;
52
+ };
53
+ }
54
+ export interface DocxEditorOptions {
55
+ /** CSS class prefix for rendered HTML. Default "docx-". */
56
+ cssPrefix?: string;
57
+ /**
58
+ * Fabricate CSS classes (vs inline styles). Default FALSE for the editor: a per-block
59
+ * re-render must be self-contained, but fabricated class names are per-conversion and
60
+ * have no matching stylesheet on the page, so re-rendered blocks would lose styling.
61
+ * Inline styles keep every block's formatting intact on incremental re-render.
62
+ */
63
+ fabricateClasses?: boolean;
64
+ /** Make paragraph/heading blocks editable. Default true. */
65
+ editable?: boolean;
66
+ /** Render block-flow pages (page boxes via pagination.ts) vs a continuous view. Default false. */
67
+ paginated?: boolean;
68
+ /** Page render scale for paginated mode (1.0 = 100%). Default 1. */
69
+ scale?: number;
70
+ /** Called after a block edit commits (with the affected anchor). */
71
+ onEdit?: (info: {
72
+ anchorId: string;
73
+ unid: string;
74
+ }) => void;
75
+ }
76
+ /**
77
+ * Serialize a block's inline content to the projector's markdown subset, preserving
78
+ * bold / italic / links (emphasis detected via computed style). Used so an edit keeps
79
+ * the block's formatting instead of flattening it to plain text. Formatting the markdown
80
+ * subset cannot express (font size/color) is still dropped on an edited block.
81
+ */
82
+ export declare function serializeInlineMarkdown(block: HTMLElement): string;
83
+ export type FormatKey = "bold" | "italic" | "underline" | "strike" | "code" | "superscript" | "subscript";
84
+ /** Paragraph alignment passed to DocxEditor.setAlignment. */
85
+ export type EditorAlignment = "left" | "center" | "right" | "justify";
86
+ export declare class DocxEditor {
87
+ private readonly exports;
88
+ private readonly container;
89
+ private readonly handle;
90
+ private readonly options;
91
+ /** Map a block's current bare unid → its full kind:scope:unid (DocxSession anchor). */
92
+ private readonly unidToFullId;
93
+ /** The element whose [data-anchor] descendants are the editable blocks (container or page container). */
94
+ private editRoot;
95
+ /** The most recently focused editable block — the target for ribbon/format commands. */
96
+ private activeBlock;
97
+ private closed;
98
+ /**
99
+ * Re-entrancy guard for node replacement. Replacing a contenteditable block that still holds
100
+ * focus removes the focused node, which fires a SYNCHRONOUS `blur` → re-enters commitBlock; the
101
+ * interleaved second replaceWith then throws NotFoundError ("node ... no longer a child") and the
102
+ * structural edit (split/merge/format) is lost. While this flag is set, commitBlock no-ops.
103
+ */
104
+ private replacing;
105
+ /**
106
+ * The last real (non-collapsed) text selection inside an editable block. A toolbar control that
107
+ * must take focus to be used — the font-size combobox — blurs the block and collapses the live
108
+ * selection, so without this an operation triggered from such a control could only target the
109
+ * whole paragraph (S-1 smoke-test finding 3). Refreshed whenever a non-empty selection sits in a
110
+ * block, and cleared when a caret is collapsed inside a block (so it never goes stale).
111
+ */
112
+ private lastSelection;
113
+ private constructor();
114
+ /** Track the last meaningful selection so focus-stealing toolbar controls can still target it. */
115
+ private readonly onSelectionChange;
116
+ /** The editable block (contenteditable [data-anchor]) containing `node`, if any, within this editor. */
117
+ private editableBlockOf;
118
+ /** Open a document, render it into `container`, and wire up editing. */
119
+ static open(container: HTMLElement, bytes: Uint8Array, exports: DocxEditorExports, options?: DocxEditorOptions): DocxEditor;
120
+ /**
121
+ * Open a fresh, blank document (a "New document" — single empty paragraph, Normal style,
122
+ * US-Letter section) and wire up editing. The seed bytes come from the WASM bridge so the
123
+ * result opens cleanly in Word too.
124
+ */
125
+ static openBlank(container: HTMLElement, exports: DocxEditorExports, options?: DocxEditorOptions): DocxEditor;
126
+ /** Lossless DOCX bytes reflecting all edits. */
127
+ save(): Uint8Array;
128
+ /** Release the underlying WASM session. The editor is unusable afterward. */
129
+ close(): void;
130
+ /**
131
+ * Switch between continuous and paginated rendering WITHOUT losing edits. Re-renders from the
132
+ * LIVE session, so every committed edit (and the undo/redo history) survives the toggle — unlike
133
+ * re-opening the original bytes, which silently discards session edits. No-op if already `value`.
134
+ */
135
+ setPaginated(value: boolean): void;
136
+ /** The editor's current DOM (for inspection/tests). */
137
+ get root(): HTMLElement;
138
+ private assertOpen;
139
+ /** Rebuild unid → full-anchor-id from the live session projection. */
140
+ private refreshAnchorMap;
141
+ /** Continuous (non-paginated) mount: inject the converter's styles + body, wire blocks. */
142
+ private mountHtml;
143
+ /** Paginated mount: flow blocks into page boxes via pagination.ts, wire the page clones. */
144
+ private mountPaginated;
145
+ private wireBlocks;
146
+ private wireBlock;
147
+ /**
148
+ * Replace `oldEl` with `newNodes`, suppressing the re-entrant blur→commit that removing a focused
149
+ * block fires (see `replacing`), AND tolerating the case where a synchronous blur during focus
150
+ * transfer detaches `oldEl` between the caller's checks and here. `replaceWith` then throws
151
+ * NotFoundError ("node … no longer a child … moved in a blur event handler") — `isConnected`
152
+ * alone doesn't catch this race. The session is already updated, so a skipped/failed visual swap
153
+ * leaves correct content (the typed DOM); the next commit or remount reconciles it. This is why
154
+ * the catch is silent rather than rethrowing — there's no lost data, only a deferred re-render.
155
+ * Returns true if the swap happened.
156
+ */
157
+ private replaceNode;
158
+ /** Commit a block edit on blur: diff → run-preserving session op → re-render only this block. */
159
+ private commitBlock;
160
+ private onKeydown;
161
+ /** Shift+Enter: insert an intra-paragraph line break at the caret. Delegates to the
162
+ * native `insertLineBreak` command, which inserts a <br> AND positions the caret
163
+ * after it correctly (handling the browser's bogus trailing-<br> rule) so typing
164
+ * continues on the new line. Commits (on blur) as a w:br via the " \n" hard break
165
+ * the serializer emits for a <br>. */
166
+ private insertLineBreakAtCaret;
167
+ /** Enter: split the block at the caret into two paragraphs. */
168
+ private splitAtCaret;
169
+ /** Backspace at block start: merge this block into the previous one. */
170
+ private mergeWithPrevious;
171
+ /**
172
+ * Apply the block's pending text change to the session with full inline-formatting fidelity.
173
+ * Diffs the committed content text (markers + bidi excluded) against the current content text
174
+ * and rewrites only the changed span via ReplaceTextAtSpan — every untouched run keeps its exact
175
+ * rPr, and typed text inherits the boundary run's formatting. Returns the parsed EditResult, or
176
+ * null when there is no change. Empty/whitespace-only baselines (e.g. the placeholder space the
177
+ * converter renders for an empty paragraph, whose DOM text doesn't line up with the session's
178
+ * empty run text) are rebuilt via ReplaceText — there is no inline formatting to preserve there.
179
+ */
180
+ private commitTextChange;
181
+ /** Flush a block's current (uncommitted) text to the session; returns the live full id. */
182
+ private syncBlock;
183
+ /** Render a block by anchor and parse it into a detached element (null on error). */
184
+ private renderInto;
185
+ /** The editable block immediately before `el` in document order, or null. */
186
+ private previousEditable;
187
+ private parseEdit;
188
+ /** Editable blocks the current selection covers, in document order. Uses Range.comparePoint
189
+ * (robust to a selection boundary that normalized onto a wrapper element rather than a block
190
+ * or text node — Range.intersectsNode misses the end block at a `(block, childCount)` boundary).
191
+ * A collapsed or single-block selection yields just the active block. */
192
+ private selectedBlocks;
193
+ /** The selection's span within `block`, clipped to the block (for inline ops across blocks):
194
+ * the first block runs selection-start→end-of-block, middle blocks are whole, the last block
195
+ * runs start-of-block→selection-end. Returns null for a whole-block apply. */
196
+ private blockSpanForSelection;
197
+ /** Apply an inline ApplyFormat op to each block's slice of the selection, then reconcile
198
+ * the DOM incrementally (see {@link finishMultiBlockOp} — a full remount costs a whole-
199
+ * document convert, seconds on a large doc, where per-block swaps are ~10 ms each).
200
+ * Returns false (caller falls back to the single-block path) for a 1-block selection. */
201
+ private applyInlineOpAcrossBlocks;
202
+ /** Apply a whole-block (paragraph-level) op to each selected block, then reconcile the DOM
203
+ * incrementally ({@link finishMultiBlockOp}). `forceRemount` is for ops whose rendering
204
+ * needs whole-document context (e.g. border-div regrouping after clearBorders). Returns
205
+ * false for a 1-block selection (caller uses the single-block path). */
206
+ private applyParagraphOpAcrossBlocks;
207
+ /** Snapshot each selected block's identity + selection slice BEFORE any session op runs
208
+ * (ops never mutate the DOM, so spans captured here stay valid until the swap phase). */
209
+ private multiBlockTargets;
210
+ /**
211
+ * Reconcile the DOM after a multi-block op. Fidelity-identical to the single-block path by
212
+ * construction: each edited block is swapped for its own session-attached single-block
213
+ * render — exactly what format()/setFontSize()/applyParagraphFormat() do for one block —
214
+ * so a multi-block apply is N single-block applies, not one whole-document re-render
215
+ * (which froze the UI for the full-document convert time on every ribbon action). Falls
216
+ * back to ONE full remount when the op touched a list item (numbering continuation needs
217
+ * whole-document context) or the caller forced it. Restores the cross-block selection so
218
+ * consecutive ribbon actions (center, then bold) keep targeting the same range.
219
+ */
220
+ private finishMultiBlockOp;
221
+ /**
222
+ * Toggle (or set) an inline format on the current selection in the active block.
223
+ * A selection spanning multiple blocks applies to each. With no selection, applies to
224
+ * the whole paragraph. Routes through DocxSession (`ApplyFormat`) so it is lossless and
225
+ * supports underline/strike, not just markdown.
226
+ */
227
+ format(key: FormatKey, value?: boolean): void;
228
+ /**
229
+ * Set the font size (in points) of the current selection in the active block; with no
230
+ * selection, applies to the whole paragraph. `pts <= 0` clears the explicit size. Routes
231
+ * through DocxSession `ApplyFormat` (`w:sz`), so it is lossless and survives save.
232
+ */
233
+ setFontSize(pts: number): void;
234
+ /**
235
+ * Set the font family of the current selection in the active block; with no selection,
236
+ * applies to the whole paragraph. `""` clears the explicit font (inherits the style/default).
237
+ * Routes through DocxSession `ApplyFormat` (`w:rFonts`), so it is lossless and survives save.
238
+ * Multi-block + last-selection plumbing matches {@link setFontSize} (a focus-stealing font
239
+ * dropdown still applies to the real sub-range).
240
+ */
241
+ setFontFamily(name: string): void;
242
+ /** Set paragraph alignment (left/center/right/justify) on the active block. */
243
+ setAlignment(alignment: EditorAlignment): void;
244
+ /**
245
+ * Insert an S-1-style horizontal rule (an empty paragraph with a bottom border) after the
246
+ * active block. `weight` is the rule thickness in eighths of a point (default 12 ≈ 1.5pt).
247
+ * Re-renders fully (a new block needs whole-document context to lay out).
248
+ */
249
+ insertHorizontalRule(weight?: number, style?: string, position?: "above" | "below"): void;
250
+ /**
251
+ * Insert a `rows`×`cols` table after the active block. `options.cellContents` (row-major
252
+ * markdown) seeds the cells, `options.borderless` makes an invisible layout table, and
253
+ * `options.cellAlignment` aligns every cell. Re-renders fully (tables need document context).
254
+ */
255
+ insertTable(rows: number, cols: number, options?: {
256
+ borderless?: boolean;
257
+ cellContents?: string[];
258
+ cellAlignment?: EditorAlignment;
259
+ columnWidths?: number[];
260
+ }): void;
261
+ /** Run a table-structure op on the active cell (a cell-paragraph block) and re-render. */
262
+ private tableEdit;
263
+ /** Insert a row above/below the active cell's row. No-op outside a table. */
264
+ insertTableRow(where: "above" | "below"): void;
265
+ /** Insert a column left/right of the active cell's column. No-op outside a table. */
266
+ insertTableColumn(where: "left" | "right"): void;
267
+ /** Delete the active cell's row (deleting the last row removes the table). No-op outside a table. */
268
+ deleteTableRow(): void;
269
+ /** Delete the active cell's column (deleting the last column removes the table). No-op outside a table. */
270
+ deleteTableColumn(): void;
271
+ /**
272
+ * Indent/outdent the active block. On a LIST item this changes the list NESTING LEVEL
273
+ * (`SetListLevel`) so numbering nests (e.g. 1, 2 → a sub-level) rather than the item just
274
+ * shifting sideways with flat numbering. On a plain paragraph it adjusts the left indent by
275
+ * `deltaTwips` (default ±720 = 0.5"), clamped at 0.
276
+ */
277
+ indent(deltaTwips?: number): void;
278
+ /** Change the active list item's nesting level by `delta` (+1 deeper, −1 shallower). */
279
+ private setListLevel;
280
+ /** Toggle (or set) page-break-before on the active block. */
281
+ pageBreakBefore(value?: boolean): void;
282
+ /**
283
+ * Toggle the active block between a bullet/numbered list item and a plain paragraph.
284
+ * Clicking the same kind it already is removes the list; any other state applies the kind.
285
+ */
286
+ toggleList(kind: "bullet" | "decimal"): void;
287
+ /** Clear all paragraph borders (e.g. remove an inserted horizontal rule) on the active block —
288
+ * or every block in a multi-block selection. The engine/wire already accept `clearBorders`;
289
+ * this surfaces it on the editor so an HR border is removable (S-1 smoke-test finding 1b). */
290
+ clearParagraphBorders(): void;
291
+ /**
292
+ * Delete the active block (e.g. a stray empty paragraph left above/below a table). Routes
293
+ * through DocxSession `DeleteBlock` + re-render, focusing the previous block. No-op when the
294
+ * caret is inside a table (remove cells via the table toolbar's delete row/column instead) and
295
+ * no-op when it is the only editable block (don't empty the document). Closes the S-1
296
+ * smoke-test "no block-delete affordance" gap.
297
+ */
298
+ deleteBlock(): void;
299
+ private applyParagraphFormat;
300
+ /** Set the paragraph style of the active block — or of every block in a multi-block selection
301
+ * (e.g. "Heading1", "Heading2", "Normal"). */
302
+ setParagraphStyle(styleId: string): void;
303
+ /** Undo the last edit (re-renders the document). */
304
+ undo(): void;
305
+ /** Redo the last undone edit (re-renders the document). */
306
+ redo(): void;
307
+ /** Which inline formats the current selection carries — for ribbon button highlighting. */
308
+ queryFormatState(): Record<FormatKey, boolean>;
309
+ /** Re-render one block from the live session by EditResult ref, swapping it in place. */
310
+ private swapBlock;
311
+ /**
312
+ * Full-document HTML from the live session. Prefers the session-attached
313
+ * `RenderHtml` bridge — the saved bytes never cross the JS/WASM boundary
314
+ * (two multi-MB copies per remount on a large doc) — and falls back to
315
+ * Save + ConvertDocxToHtmlComplete for older WASM bundles. Both paths use
316
+ * the same option profile, so the rendered HTML is identical.
317
+ */
318
+ private renderFullHtml;
319
+ /** Editable blocks in document order. */
320
+ private editableList;
321
+ private blockIndex;
322
+ /**
323
+ * True when an edit produced or touched a list item (kind "li"). List markers and
324
+ * numbering CONTINUATION need whole-document context, which a single-block render lacks
325
+ * (every item would render as "1."), so such edits re-render the whole document.
326
+ */
327
+ private affectsList;
328
+ /**
329
+ * Full re-render from current session state (after undo/redo, and after list edits where
330
+ * single-block rendering can't compute numbering). Optionally focus the editable block at
331
+ * `focusIndex` (caret at start, or end if `caretAtEnd`) — addressed by index because a
332
+ * block's content-hashed unid changes across the save/reproject a remount performs.
333
+ */
334
+ private remount;
335
+ }
336
+ //# sourceMappingURL=editor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../src/editor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAIH,4FAA4F;AAC5F,MAAM,WAAW,iBAAiB;IAChC,iBAAiB,EAAE;QACjB,WAAW,EAAE,CAAC,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,KAAK,MAAM,CAAC;QACjE,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;QACvC,eAAe,EAAE,MAAM,UAAU,CAAC;QAClC,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;QACpC,WAAW,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,KAAK,MAAM,CAAC;QACpE,iBAAiB,EAAE,CACjB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,SAAS,E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