docxodus 5.5.4 → 6.1.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 (37) hide show
  1. package/dist/docxodus.worker.js +154 -1
  2. package/dist/docxodus.worker.js.map +1 -1
  3. package/dist/index.d.ts +43 -4
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js +79 -2
  6. package/dist/index.js.map +1 -1
  7. package/dist/session.d.ts +302 -0
  8. package/dist/session.d.ts.map +1 -0
  9. package/dist/session.js +505 -0
  10. package/dist/session.js.map +1 -0
  11. package/dist/types.d.ts +731 -3
  12. package/dist/types.d.ts.map +1 -1
  13. package/dist/types.js +148 -0
  14. package/dist/types.js.map +1 -1
  15. package/dist/wasm/_framework/DocumentFormat.OpenXml.Framework.wasm +0 -0
  16. package/dist/wasm/_framework/DocumentFormat.OpenXml.wasm +0 -0
  17. package/dist/wasm/_framework/Docxodus.wasm +0 -0
  18. package/dist/wasm/_framework/DocxodusWasm.wasm +0 -0
  19. package/dist/wasm/_framework/System.Collections.Concurrent.wasm +0 -0
  20. package/dist/wasm/_framework/System.Collections.wasm +0 -0
  21. package/dist/wasm/_framework/System.Linq.wasm +0 -0
  22. package/dist/wasm/_framework/System.Memory.wasm +0 -0
  23. package/dist/wasm/_framework/System.Net.Http.wasm +0 -0
  24. package/dist/wasm/_framework/System.Private.CoreLib.wasm +0 -0
  25. package/dist/wasm/_framework/System.Runtime.wasm +0 -0
  26. package/dist/wasm/_framework/System.Security.Cryptography.wasm +0 -0
  27. package/dist/wasm/_framework/System.Text.Json.wasm +0 -0
  28. package/dist/wasm/_framework/System.Text.RegularExpressions.wasm +0 -0
  29. package/dist/wasm/_framework/System.Threading.wasm +0 -0
  30. package/dist/wasm/_framework/blazor.boot.json +17 -17
  31. package/dist/wasm/_framework/dotnet.native.wasm +0 -0
  32. package/dist/worker-proxy.bundle.js +81 -0
  33. package/dist/worker-proxy.d.ts +57 -1
  34. package/dist/worker-proxy.d.ts.map +1 -1
  35. package/dist/worker-proxy.js +76 -0
  36. package/dist/worker-proxy.js.map +1 -1
  37. package/package.json +1 -1
@@ -0,0 +1,505 @@
1
+ // Copyright (c) Microsoft. All rights reserved.
2
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
+ import { ContextBoundary, DiffFormat, PlaceholderKinds, ProjectionDepth } from "./types.js";
4
+ /**
5
+ * Stateful in-memory DOCX editing session keyed by markdown-projection anchor ids.
6
+ * Mirror of the .NET `DocxSession` surface. See
7
+ * `docs/architecture/docx_mutation_api.md` for the surface contract,
8
+ * anchor lifecycle, error catalog, and supported markdown subset.
9
+ *
10
+ * Sessions are not eligible for JS-side garbage collection — call {@link close}
11
+ * (or use a `using` block under TypeScript 5.2+) when done.
12
+ */
13
+ export class DocxSession {
14
+ /** @internal */
15
+ constructor(handle, wasm) {
16
+ // ─── Raw escape hatch ────────────────────────────────────────────────
17
+ this.raw = {
18
+ getXml: (anchorId) => this.wasm.RawGetXml(this.handle, anchorId),
19
+ insertXml: (anchorId, position, xml) => JSON.parse(this.wasm.RawInsertXml(this.handle, anchorId, position, xml)),
20
+ replaceXml: (anchorId, xml) => JSON.parse(this.wasm.RawReplaceXml(this.handle, anchorId, xml)),
21
+ };
22
+ this.handle = handle;
23
+ this.wasm = wasm;
24
+ }
25
+ // ─── View ────────────────────────────────────────────────────────────
26
+ project() {
27
+ return JSON.parse(this.wasm.Project(this.handle));
28
+ }
29
+ /**
30
+ * Project a slice of the document keyed off an anchor — useful for showing
31
+ * one section to an LLM at a time without paying the cost of projecting the
32
+ * whole document.
33
+ *
34
+ * - `ProjectionDepth.SelfOnly` — just the addressed block (one paragraph,
35
+ * row, etc.).
36
+ * - `ProjectionDepth.Subtree` — the block + descendants (e.g. a table with
37
+ * all its rows/cells, but no following content).
38
+ * - `ProjectionDepth.SubtreeAndFollowingSiblings` (default) — for headings
39
+ * this returns the whole section (heading + content up to the next same-
40
+ * or-higher heading); for non-headings it behaves like `Subtree`.
41
+ *
42
+ * @see docs/architecture/docx_mutation_api.md
43
+ */
44
+ projectAnchor(anchorId, depth = ProjectionDepth.SubtreeAndFollowingSiblings) {
45
+ return JSON.parse(this.wasm.ProjectAnchor(this.handle, anchorId, depth));
46
+ }
47
+ // ─── Tier A: text CRUD ───────────────────────────────────────────────
48
+ replaceText(anchorId, markdown) {
49
+ return JSON.parse(this.wasm.ReplaceText(this.handle, anchorId, markdown));
50
+ }
51
+ deleteBlock(anchorId) {
52
+ return JSON.parse(this.wasm.DeleteBlock(this.handle, anchorId));
53
+ }
54
+ /**
55
+ * Delete every top-level block-level sibling between `fromAnchorId` (inclusive)
56
+ * and `toAnchorIdExclusive` (exclusive). Both anchors must share a direct
57
+ * parent and live in the same package part. Returns a single `EditResult`
58
+ * whose `removed` lists every anchor that was deleted.
59
+ *
60
+ * Records ONE undo snapshot — `undo()` restores the entire range.
61
+ *
62
+ * @see docs/architecture/docx_mutation_api.md#deleterange
63
+ */
64
+ deleteRange(fromAnchorId, toAnchorIdExclusive) {
65
+ return JSON.parse(this.wasm.DeleteRange(this.handle, fromAnchorId, toAnchorIdExclusive));
66
+ }
67
+ /**
68
+ * Delete a heading and everything below it up to (but not including) the next
69
+ * heading at the same or higher level. The heading anchor must have `kind === "h"`.
70
+ *
71
+ * If the target is the last heading in its parent, the section extends to the
72
+ * end of the parent (heading + everything after).
73
+ *
74
+ * @see docs/architecture/docx_mutation_api.md#deletesection
75
+ */
76
+ deleteSection(headingAnchorId) {
77
+ return JSON.parse(this.wasm.DeleteSection(this.handle, headingAnchorId));
78
+ }
79
+ // ─── Tier B: structural ──────────────────────────────────────────────
80
+ insertParagraph(anchorId, position, markdown) {
81
+ return JSON.parse(this.wasm.InsertParagraph(this.handle, anchorId, position, markdown));
82
+ }
83
+ splitParagraph(anchorId, characterOffset) {
84
+ return JSON.parse(this.wasm.SplitParagraph(this.handle, anchorId, characterOffset));
85
+ }
86
+ mergeParagraphs(firstAnchorId, secondAnchorId) {
87
+ return JSON.parse(this.wasm.MergeParagraphs(this.handle, firstAnchorId, secondAnchorId));
88
+ }
89
+ // ─── Tier C: formatting ──────────────────────────────────────────────
90
+ applyFormat(anchorId, span, op) {
91
+ const spanJson = span ? JSON.stringify(span) : "";
92
+ return JSON.parse(this.wasm.ApplyFormat(this.handle, anchorId, spanJson, JSON.stringify(op)));
93
+ }
94
+ /**
95
+ * Convenience: find `substring` in the anchor's flat text and apply `op` to the
96
+ * first occurrence. Eliminates the offset-arithmetic trap from #138 — caller passes
97
+ * the visible text they want formatted, the WASM-side resolves it to a CharSpan.
98
+ */
99
+ applyFormatBySubstring(anchorId, substring, op) {
100
+ return JSON.parse(this.wasm.ApplyFormatBySubstring(this.handle, anchorId, substring, JSON.stringify(op)));
101
+ }
102
+ /**
103
+ * Convenience: apply `op` to the exact span of a {@link TextMatch} (typically from
104
+ * {@link grep}). The match's `enclosingAnchor.id` + `span` address one specific
105
+ * occurrence even when several identical needles share the same block.
106
+ */
107
+ applyFormatToMatch(match, op) {
108
+ const span = { start: match.span.start, length: match.span.length };
109
+ return this.applyFormat(match.enclosingAnchor.id, span, op);
110
+ }
111
+ setParagraphStyle(anchorId, styleId) {
112
+ return JSON.parse(this.wasm.SetParagraphStyle(this.handle, anchorId, styleId));
113
+ }
114
+ setListLevel(anchorId, levelDelta) {
115
+ return JSON.parse(this.wasm.SetListLevel(this.handle, anchorId, levelDelta));
116
+ }
117
+ removeListMembership(anchorId) {
118
+ return JSON.parse(this.wasm.RemoveListMembership(this.handle, anchorId));
119
+ }
120
+ // ─── Tier D: cell content ────────────────────────────────────────────
121
+ replaceCellContent(cellAnchorId, markdown) {
122
+ return JSON.parse(this.wasm.ReplaceCellContent(this.handle, cellAnchorId, markdown));
123
+ }
124
+ // ─── Search ──────────────────────────────────────────────────────────
125
+ /**
126
+ * Searches the flat text of every paragraph/heading/list-item in scope for
127
+ * matches of `pattern`, returning them in document order with the run
128
+ * fragments each match spans. Lets callers rewrite a match in place while
129
+ * preserving each fragment's formatting (bold/italic/hyperlink/etc.).
130
+ *
131
+ * `pattern` is a regular expression — use plain string equivalents wrapped
132
+ * in `^` / `$` or pass literal text escaped via a helper.
133
+ *
134
+ * @see docs/architecture/docx_mutation_api.md#grep
135
+ */
136
+ grep(pattern, options) {
137
+ return JSON.parse(this.wasm.Grep(this.handle, pattern, options ? JSON.stringify(options) : ""));
138
+ }
139
+ /**
140
+ * Like {@link grep}, but lets a single match span adjacent block-level
141
+ * siblings (paragraphs/headings/list items) under the same parent. Block
142
+ * boundaries appear in the matched text as `\n`, so `^`/`$` with the
143
+ * Multiline flag anchor at boundaries and `.` won't cross unless Singleline
144
+ * is set.
145
+ *
146
+ * Matches never cross OOXML package parts, container boundaries (body →
147
+ * table cell), or non-paragraph siblings (a table between two paragraphs
148
+ * breaks the run). Returned superset of {@link grep}: single-block matches
149
+ * still appear with one slice. Filter `slices.length > 1` for cross-block only.
150
+ *
151
+ * @see docs/architecture/docx_mutation_api.md#grepcrossblock
152
+ */
153
+ grepCrossBlock(pattern, options) {
154
+ return JSON.parse(this.wasm.GrepCrossBlock(this.handle, pattern, options ? JSON.stringify(options) : ""));
155
+ }
156
+ /**
157
+ * Finds every literal occurrence of `find` in the anchor's flat text and
158
+ * replaces it with `replace`, preserving the surrounding run formatting that
159
+ * the match didn't touch. Returns one `EditResult` per attempted match.
160
+ *
161
+ * Run-formatting contract: the replacement text inherits the formatting of
162
+ * the FIRST run the match spanned. Middle/trailing runs keep their `w:rPr`
163
+ * but lose the slice of text the match consumed.
164
+ *
165
+ * @see docs/architecture/docx_mutation_api.md#replacetextrange
166
+ */
167
+ replaceTextRange(anchorId, find, replace, options) {
168
+ return JSON.parse(this.wasm.ReplaceTextRange(this.handle, anchorId, find, replace, options ? JSON.stringify(options) : ""));
169
+ }
170
+ /**
171
+ * Replaces a specific Grep match in place — addresses the exact span by
172
+ * `enclosingAnchor.id` + `span.{start,length}`, so identical needles in the
173
+ * same paragraph (the template-fill case where five `[___]` placeholders
174
+ * each get a different value) don't collide.
175
+ */
176
+ replaceMatch(match, replace) {
177
+ return JSON.parse(this.wasm.ReplaceTextAtSpan(this.handle, match.enclosingAnchor.id, match.span.start, match.span.length, replace));
178
+ }
179
+ /**
180
+ * Helper for {@link fillPlaceholders} `coalesceWhitespaceAroundEmptyFill` path —
181
+ * mirrors the .NET `ReplaceMatchCoalescingNeighbors` rules. Inspects the chars
182
+ * immediately surrounding the match via `match.contextBefore` / `contextAfter`
183
+ * (so the option requires `contextChars >= 1`, the default) and expands the
184
+ * deletion span to absorb whitespace / leading-space-before-punctuation /
185
+ * matched-brackets where the patterns match. Falls back to literal-delete
186
+ * when no neighbor pattern applies.
187
+ *
188
+ * Note: with `boundary: ContextBoundary.Bracket`, neighbor brackets are not
189
+ * captured in context, so the bracket-coalesce rule won't fire on the JS side.
190
+ * The .NET implementation reads flat text directly and handles that case;
191
+ * callers who care should leave `boundary` at the default `Char`.
192
+ */
193
+ replaceMatchCoalescingNeighbors(match) {
194
+ // Fold NBSP / narrow NBSP / thin space to ASCII space so e.g. an NBSP on
195
+ // either side still gets treated as whitespace by the rules below.
196
+ const fold = (c) => {
197
+ if (c === " " || c === " " || c === " ")
198
+ return " ";
199
+ return c;
200
+ };
201
+ const l = fold(match.contextBefore.length > 0 ? match.contextBefore[match.contextBefore.length - 1] : undefined);
202
+ const r = fold(match.contextAfter.length > 0 ? match.contextAfter[0] : undefined);
203
+ const isSpace = (c) => c === " " || c === "\t";
204
+ const isClauseTerm = (c) => c === "." || c === "," || c === ";" || c === ":" || c === "!" || c === "?";
205
+ const isOpen = (c) => c === "(" || c === "[" || c === "{";
206
+ const isClose = (c) => c === ")" || c === "]" || c === "}";
207
+ let extendLeft = 0;
208
+ let extendRight = 0;
209
+ if (isSpace(l) && isSpace(r)) {
210
+ extendRight = 1;
211
+ }
212
+ else if (isSpace(l) && isClauseTerm(r)) {
213
+ extendLeft = 1;
214
+ }
215
+ else if (isOpen(l) && isClose(r)) {
216
+ extendLeft = 1;
217
+ extendRight = 1;
218
+ }
219
+ if (extendLeft === 0 && extendRight === 0) {
220
+ return this.replaceMatch(match, "");
221
+ }
222
+ return JSON.parse(this.wasm.ReplaceTextAtSpan(this.handle, match.enclosingAnchor.id, match.span.start - extendLeft, match.span.length + extendLeft + extendRight, ""));
223
+ }
224
+ /**
225
+ * Replace the bracketed portion of a `TextMatch` with `newInner`, preserving any
226
+ * prefix or suffix outside the brackets. Designed for `findPlaceholders` matches
227
+ * like `$[___]` where the regex `\$?\[…\]` captures a leading `$`:
228
+ * `replaceInner(match, "0.20")` yields `$0.20`, not `0.20`.
229
+ *
230
+ * Returns `MalformedMarkdown` if the match text does not contain balanced brackets.
231
+ */
232
+ replaceInner(match, newInner) {
233
+ return JSON.parse(this.wasm.ReplaceInner(this.handle, match.text, match.enclosingAnchor.id, match.span.start, match.span.length, newInner));
234
+ }
235
+ /**
236
+ * Picker-driven template fill. For every placeholder matching `options.kinds`,
237
+ * calls `picker`; if the picker returns a non-null string, the placeholder is
238
+ * replaced (with optional `$`-prefix preservation). Iterates until no more
239
+ * placeholders match (or `maxPasses` is reached, or a pass makes zero changes)
240
+ * — handles nested brackets that surface only after the inner ones are stripped.
241
+ *
242
+ * The TypeScript implementation mirrors the .NET `DocxSession.FillPlaceholders`
243
+ * exactly.
244
+ *
245
+ * The picker is invoked synchronously by this loop on the JS side (it does
246
+ * NOT run inside the WASM module). Async pickers are not supported: returning
247
+ * a `Promise` will cause a `TypeError` at runtime inside the `$`-prefix
248
+ * preservation branch (`Promise.startsWith is not a function`). For async
249
+ * data, pre-build a lookup map before calling and have the picker read from
250
+ * it synchronously.
251
+ */
252
+ fillPlaceholders(picker, options) {
253
+ const opts = options ?? {};
254
+ // Default Kinds = All so the picker is invoked for every kind the doc contains.
255
+ // Callers that want to ignore AlternativeClause matches should narrow this to
256
+ // `PlaceholderKinds.BlankFill | PlaceholderKinds.Instruction`.
257
+ const kinds = opts.kinds ?? PlaceholderKinds.All;
258
+ const scope = opts.scope ?? 1; // Body
259
+ const maxPasses = opts.maxPasses ?? 8;
260
+ const preserveDollarPrefix = opts.preserveDollarPrefix ?? true;
261
+ const contextChars = opts.contextChars ?? 80;
262
+ const boundary = opts.boundary ?? ContextBoundary.Char;
263
+ const coalesceEmpty = opts.coalesceWhitespaceAroundEmptyFill ?? false;
264
+ if (maxPasses <= 0) {
265
+ throw new RangeError("FillOptions.maxPasses must be > 0");
266
+ }
267
+ let filled = 0;
268
+ let workPasses = 0;
269
+ const errors = [];
270
+ const unfilled = [];
271
+ const seenSkipKeys = new Set();
272
+ for (let pass = 1; pass <= maxPasses; pass++) {
273
+ const placeholders = this.findPlaceholders(kinds, scope, contextChars, boundary)
274
+ .sort((a, b) => {
275
+ const cmp = b.match.enclosingAnchor.id.localeCompare(a.match.enclosingAnchor.id);
276
+ if (cmp !== 0)
277
+ return cmp;
278
+ return b.match.span.start - a.match.span.start;
279
+ });
280
+ if (placeholders.length === 0)
281
+ break;
282
+ let passChanges = 0;
283
+ for (const p of placeholders) {
284
+ const pick = picker(p);
285
+ if (pick == null) {
286
+ const key = `${p.match.enclosingAnchor.id}:${p.match.span.start}:${p.match.span.length}`;
287
+ if (!seenSkipKeys.has(key)) {
288
+ seenSkipKeys.add(key);
289
+ unfilled.push(p);
290
+ }
291
+ continue;
292
+ }
293
+ let replacement = pick;
294
+ if (preserveDollarPrefix && p.match.text.startsWith("$") && !replacement.startsWith("$")) {
295
+ replacement = "$" + replacement;
296
+ }
297
+ const r = coalesceEmpty && replacement.length === 0
298
+ ? this.replaceMatchCoalescingNeighbors(p.match)
299
+ : this.replaceMatch(p.match, replacement);
300
+ if (r.success) {
301
+ filled++;
302
+ passChanges++;
303
+ }
304
+ else if (r.error) {
305
+ errors.push(r.error);
306
+ }
307
+ }
308
+ if (passChanges > 0)
309
+ workPasses = pass;
310
+ if (passChanges === 0)
311
+ break;
312
+ }
313
+ const stillPresent = this.findPlaceholders(kinds, scope).length;
314
+ return {
315
+ filled,
316
+ skipped: unfilled.length,
317
+ stillPresent,
318
+ passes: workPasses,
319
+ unfilled,
320
+ errors,
321
+ };
322
+ }
323
+ /**
324
+ * Enumerate template placeholders in the document. Thin classifier over
325
+ * {@link grep}: distinguishes `[___]` value blanks (`blank_fill`),
326
+ * `[bracketed alternative clauses]` (`alternative_clause`), and
327
+ * `[insert X]` / `[*italic hint*]` instructions (`instruction`).
328
+ *
329
+ * Combine kinds with bitwise OR: `PlaceholderKinds.BlankFill | PlaceholderKinds.Instruction`.
330
+ * Default is `PlaceholderKinds.All`; default scope is body only (1).
331
+ *
332
+ * @see docs/architecture/docx_mutation_api.md#findplaceholders
333
+ */
334
+ findPlaceholders(kinds = PlaceholderKinds.All, scope = 1, contextChars = 80, boundary = ContextBoundary.Char) {
335
+ return JSON.parse(this.wasm.FindPlaceholders(this.handle, kinds, scope, contextChars, boundary));
336
+ }
337
+ /**
338
+ * Returns a snapshot of edit-state introspection signals — placeholder counts,
339
+ * underscore-run leftovers, footnote/comment counts. Useful for "am I done?"
340
+ * verification at the end of an edit pipeline.
341
+ */
342
+ getEditSummary() {
343
+ return JSON.parse(this.wasm.GetEditSummary(this.handle));
344
+ }
345
+ /**
346
+ * Discoverability alias for {@link findPlaceholders}. Same return shape.
347
+ */
348
+ remainingPlaceholders(kinds = PlaceholderKinds.All) {
349
+ return JSON.parse(this.wasm.RemainingPlaceholders(this.handle, kinds));
350
+ }
351
+ getDiff(format = DiffFormat.Json) {
352
+ const raw = this.wasm.GetDiff(this.handle, format);
353
+ if (format === DiffFormat.Json) {
354
+ return JSON.parse(raw);
355
+ }
356
+ return raw;
357
+ }
358
+ // ─── Annotation-based anchor discovery (#132) ────────────────────────
359
+ /**
360
+ * Resolves an annotation's range to the block-level markdown anchors covering
361
+ * it, in document order. The bridge between Docxodus' read-side annotation API
362
+ * and the write-side session: an agent that wants to edit "the indemnification
363
+ * clause" looks the annotation up by id and gets the anchors it can hand to
364
+ * {@link replaceText} / {@link deleteBlock} / {@link raw}. Returns an empty
365
+ * list when the id is unknown or its bookmark is missing.
366
+ *
367
+ * v1 returns the enclosing block anchors — every paragraph/heading/list-item/
368
+ * cell/row/table whose subtree overlaps the bookmark range. Filter by
369
+ * `kind === "p" | "h" | "li"` when you want only text-bearing blocks.
370
+ *
371
+ * @see docs/architecture/docx_mutation_api.md#findbyannotation
372
+ */
373
+ findByAnnotation(annotationId) {
374
+ return JSON.parse(this.wasm.FindByAnnotation(this.handle, annotationId));
375
+ }
376
+ /**
377
+ * Finds every annotation whose `labelId` matches and resolves each of their
378
+ * ranges. The result is keyed by annotation id so callers can disambiguate
379
+ * when the same label is applied to multiple regions (three "WARRANTY"
380
+ * annotations on different paragraphs become three entries). Annotations
381
+ * whose bookmark resolves to no anchors are omitted from the result.
382
+ */
383
+ findByLabel(labelId) {
384
+ return JSON.parse(this.wasm.FindByLabel(this.handle, labelId));
385
+ }
386
+ /**
387
+ * Resolves any bookmark in the main document part (Docxodus-managed or
388
+ * user-authored) to the block-level anchors covering its range, in document
389
+ * order. Empty when the bookmark name is unknown. Use this for raw bookmark
390
+ * names that didn't come from the annotation system.
391
+ */
392
+ findByBookmark(bookmarkName) {
393
+ return JSON.parse(this.wasm.FindByBookmark(this.handle, bookmarkName));
394
+ }
395
+ /**
396
+ * Look up a single anchor's preview info — `{ id, kind, scope, textPreview }`.
397
+ * Returns null when the anchor id is unknown.
398
+ *
399
+ * For iterating many anchors at once, prefer reading `textPreview` directly
400
+ * off the {@link MarkdownProjection.anchorIndex} entries (cheaper — no extra
401
+ * WASM round trip), or use {@link getAnchorInfos} for batched lookups.
402
+ */
403
+ getAnchorInfo(anchorId) {
404
+ const raw = this.wasm.GetAnchorInfo(this.handle, anchorId);
405
+ return JSON.parse(raw);
406
+ }
407
+ /**
408
+ * Bulk variant of {@link getAnchorInfo}: takes an array of anchor ids,
409
+ * returns a record where each unknown id maps to `null`.
410
+ */
411
+ getAnchorInfos(anchorIds) {
412
+ const raw = this.wasm.GetAnchorInfos(this.handle, JSON.stringify(anchorIds));
413
+ return JSON.parse(raw);
414
+ }
415
+ /**
416
+ * Resolve block-level metadata (style id+name, outline level, list membership,
417
+ * formatting probe) for an anchor. Returns null when the anchor doesn't exist.
418
+ */
419
+ getBlockMetadata(anchorId) {
420
+ const raw = this.wasm.GetBlockMetadata(this.handle, anchorId);
421
+ return JSON.parse(raw);
422
+ }
423
+ /**
424
+ * Bulk variant of {@link getBlockMetadata}. Unknown ids map to null;
425
+ * duplicates are deduped.
426
+ */
427
+ getBlockMetadatas(anchorIds) {
428
+ const raw = this.wasm.GetBlockMetadatas(this.handle, JSON.stringify(anchorIds));
429
+ return JSON.parse(raw);
430
+ }
431
+ /**
432
+ * Resolve the numbering facts for a list-item paragraph; returns null when
433
+ * the anchor has no w:numPr.
434
+ */
435
+ getListMembership(anchorId) {
436
+ const raw = this.wasm.GetListMembership(this.handle, anchorId);
437
+ return JSON.parse(raw);
438
+ }
439
+ /**
440
+ * Resolve page-layout info for the w:sectPr that governs an anchor.
441
+ * Returns null for anchors outside the body part.
442
+ */
443
+ getSectionInfo(anchorId) {
444
+ const raw = this.wasm.GetSectionInfo(this.handle, anchorId);
445
+ return JSON.parse(raw);
446
+ }
447
+ /**
448
+ * Enumerates every annotation persisted in the document. Lets an agent prime
449
+ * itself with "here are the labeled regions you can target" before committing
450
+ * to a specific id.
451
+ */
452
+ listAnnotations() {
453
+ return JSON.parse(this.wasm.ListAnnotations(this.handle));
454
+ }
455
+ // ─── Annotation write surface ────────────────────────────────────────
456
+ /**
457
+ * Annotate a range inside `anchorId`. When `span` is `null`/`undefined`
458
+ * the annotation wraps every inline run of the block. When
459
+ * `annotation.id` is `undefined`, a 16-char hex id is auto-generated and
460
+ * returned in `EditResult.annotationId`.
461
+ */
462
+ addAnnotation(anchorId, span, annotation) {
463
+ const spanJson = span ? JSON.stringify(span) : "";
464
+ return JSON.parse(this.wasm.AddAnnotation(this.handle, anchorId, spanJson, JSON.stringify(annotation)));
465
+ }
466
+ removeAnnotation(annotationId) {
467
+ return JSON.parse(this.wasm.SessionRemoveAnnotation(this.handle, annotationId));
468
+ }
469
+ updateAnnotation(annotationId, update) {
470
+ return JSON.parse(this.wasm.UpdateAnnotation(this.handle, annotationId, JSON.stringify(update)));
471
+ }
472
+ moveAnnotation(annotationId, newAnchorId, newSpan) {
473
+ const spanJson = newSpan ? JSON.stringify(newSpan) : "";
474
+ return JSON.parse(this.wasm.MoveAnnotation(this.handle, annotationId, newAnchorId, spanJson));
475
+ }
476
+ // ─── Lifecycle ───────────────────────────────────────────────────────
477
+ undo() {
478
+ return this.wasm.Undo(this.handle);
479
+ }
480
+ redo() {
481
+ return this.wasm.Redo(this.handle);
482
+ }
483
+ save() {
484
+ return this.wasm.Save(this.handle);
485
+ }
486
+ close() {
487
+ this.wasm.CloseSession(this.handle);
488
+ }
489
+ // TypeScript 5.2+ disposable protocol
490
+ [Symbol.dispose]() {
491
+ this.close();
492
+ }
493
+ }
494
+ /**
495
+ * Opens a new {@link DocxSession} over the supplied DOCX bytes.
496
+ * The returned session holds its document in WASM memory until you call
497
+ * {@link DocxSession.close} (or it is disposed).
498
+ */
499
+ export function openDocxSession(bytes, wasmExports, settings) {
500
+ const bridge = wasmExports.DocxSessionBridge;
501
+ const handle = bridge.OpenSession(bytes, settings ? JSON.stringify(settings) : "");
502
+ return new DocxSession(handle, bridge);
503
+ }
504
+ export { ContextBoundary, PlaceholderKinds } from "./types.js";
505
+ //# sourceMappingURL=session.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session.js","sourceRoot":"","sources":["../src/session.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,qGAAqG;AA4BrG,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE5F;;;;;;;;GAQG;AACH,MAAM,OAAO,WAAW;IAItB,gBAAgB;IAChB,YAAY,MAAc,EAAE,IAA8C;QAoI1E,wEAAwE;QAE/D,QAAG,GAAG;YACb,MAAM,EAAE,CAAC,QAAgB,EAAU,EAAE,CAAC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