@betteroffice/docx 0.2.1 → 0.3.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 (69) hide show
  1. package/README.md +522 -3
  2. package/dist/{chunk-JHJLG4I6.mjs → chunk-5B4VMUXM.mjs} +1 -1
  3. package/dist/chunk-5JEQC76K.mjs +1 -0
  4. package/dist/chunk-7GJG6LLU.mjs +1 -0
  5. package/dist/chunk-FE6FWGBJ.mjs +1 -0
  6. package/dist/chunk-H5YYCN42.mjs +1 -0
  7. package/dist/chunk-NT2OYIJ4.mjs +57 -0
  8. package/dist/chunk-QE4ZDRKV.mjs +1 -0
  9. package/dist/chunk-VQXNED2P.mjs +2 -0
  10. package/dist/chunk-Z4HZIPBS.mjs +1 -0
  11. package/dist/collaboration/index.d.mts +8 -6
  12. package/dist/compareDocx-XXTZV4CG.mjs +1 -0
  13. package/dist/computeLayout-LWLAJWYA.mjs +1 -0
  14. package/dist/{content-CvEtPl0c.d.mts → content-BzoC6bSz.d.mts} +48 -8
  15. package/dist/core.d.mts +172 -9
  16. package/dist/core.mjs +1 -1
  17. package/dist/{displayListQueries-DF8F6fMl.d.mts → displayListQueries-BYFrBkw5.d.mts} +2 -2
  18. package/dist/docx/index.d.mts +5 -4
  19. package/dist/docx/index.mjs +1 -1
  20. package/dist/editor/index.d.mts +10 -8
  21. package/dist/editor/index.mjs +1 -1
  22. package/dist/{fontLoader-b8eicJKV.d.mts → fontLoader-CkXcPB1C.d.mts} +1 -1
  23. package/dist/{formatting-7zKCTu5a.d.mts → formatting-gqLFeJ9X.d.mts} +8 -0
  24. package/dist/{frameDelta-pA4jrQ1G.d.mts → frameDelta-CVt5FAXT.d.mts} +14 -3
  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-CHl2zLJ7.d.mts → index-BbZwdkPz.d.mts} +457 -29
  30. package/dist/layout/index.d.mts +6 -6
  31. package/dist/layout/index.mjs +1 -1
  32. package/dist/layout/pagination/index.d.mts +4 -4
  33. package/dist/layout/render/index.d.mts +12 -10
  34. package/dist/layout/render/index.mjs +1 -1
  35. package/dist/pagedExport-D3E4jZ-B.d.mts +907 -0
  36. package/dist/plugin-api/RenderedDomContext.d.mts +10 -9
  37. package/dist/plugin-api/RenderedDomContext.mjs +1 -1
  38. package/dist/plugin-api/index.d.mts +21 -4
  39. package/dist/plugin-api/resolveItemPositions.d.mts +3 -3
  40. package/dist/rezip-Bxiq4Z_R.d.mts +24 -0
  41. package/dist/{rustDisplayList-BJqaN9tt.d.mts → rustDisplayList-CwOoUn3t.d.mts} +2 -2
  42. package/dist/{rustMeasureSource-C0EZB055.d.mts → rustMeasureSource-CyBMcy1x.d.mts} +12 -4
  43. package/dist/{selectiveSave-CRh-_Y_C.d.mts → selectiveSave-r-NMK6aI.d.mts} +1 -22
  44. package/dist/styles/index.d.mts +2 -2
  45. package/dist/{styles-7e-mq3c-.d.mts → styles-AryxLAhx.d.mts} +1 -1
  46. package/dist/types/content.d.mts +2 -2
  47. package/dist/types/document.d.mts +6 -6
  48. package/dist/{types-C4A8mWjU.d.mts → types-B4jD0rrc.d.mts} +19 -2
  49. package/dist/utils/comments.d.mts +2 -2
  50. package/dist/utils/index.d.mts +7 -4
  51. package/dist/utils/index.mjs +1 -1
  52. package/dist/utils/stylePreview.d.mts +2 -2
  53. package/dist/wasm-G62X4WRW.mjs +1 -0
  54. package/dist/wasm-US6R7SWN.mjs +1 -0
  55. package/dist/wasm-edit.d.mts +246 -13
  56. package/dist/wasm-edit.mjs +1 -1
  57. package/dist/wasm-layout.d.mts +8 -1
  58. package/dist/wasm-layout.mjs +1 -1
  59. package/dist/yrs/index.d.mts +7 -5
  60. package/dist/yrs/index.mjs +1 -1
  61. package/dist/yrs/residentEngineWorker.mjs +1 -1
  62. package/package.json +2 -2
  63. package/dist/chunk-6LQJAKOC.mjs +0 -1
  64. package/dist/chunk-AFMVSI4Z.mjs +0 -57
  65. package/dist/chunk-GD4VNJ64.mjs +0 -1
  66. package/dist/chunk-WRWRCBLK.mjs +0 -1
  67. package/dist/chunk-WTFRNX5K.mjs +0 -1
  68. package/dist/wasm-7SOSHNGP.mjs +0 -1
  69. package/dist/wasm-ZQAVP7P2.mjs +0 -1
@@ -39,6 +39,10 @@ declare class EditSession {
39
39
  * well-formed ranges, or is empty.
40
40
  */
41
41
  add_comment(ranges_json: string, author: string, date: string, body_json: string): string;
42
+ /**
43
+ * Closes the current undo capture without adding an empty step.
44
+ */
45
+ add_undo_boundary(): void;
42
46
  /**
43
47
  * Deletes one character at this session's collapsed selection and returns
44
48
  * the resulting binary `FrameDelta`. `direction` is `"backward"` or
@@ -57,6 +61,13 @@ declare class EditSession {
57
61
  * [`EditSession::apply_input_profile_json`].
58
62
  */
59
63
  apply_delete_profiled(direction: string, expected_frame_epoch: number): Uint8Array;
64
+ /**
65
+ * Applies an edit batch all-or-nothing:
66
+ * `{"ok":true,"baseVersion","version","applied","source","changedStories",
67
+ * "receipts"}`. An applied batch commits one transaction; `history`
68
+ * `"separate"` makes it exactly one undo step.
69
+ */
70
+ apply_edits_json(request: string): string;
60
71
  /**
61
72
  * Applies one ordinary insertion at this session's collapsed selection
62
73
  * and returns the resulting binary `FrameDelta`. The inserted text
@@ -141,6 +152,10 @@ declare class EditSession {
141
152
  * Errors on a malformed update.
142
153
  */
143
154
  apply_update_with_inference(update: Uint8Array): string;
155
+ /**
156
+ * Starts a new opening of the document; see [`EditingDoc::begin_opening`].
157
+ */
158
+ begin_opening(generation?: string | null): void;
144
159
  /**
145
160
  * Display-only input JSON in, one binary `FrameDelta` v1 out (exposed as
146
161
  * a transferable `Uint8Array`). `expected_frame_epoch` is the epoch of the
@@ -170,8 +185,8 @@ declare class EditSession {
170
185
  cell_selection(): string;
171
186
  /**
172
187
  * Removes the authored `value` from the content-control embed carrying
173
- * `embed_id`, leaving the control itself in place. Errors when no embed
174
- * has that id.
188
+ * `embed_id`, leaving the control and its content in place: it never
189
+ * erases a text control's text. Errors when no embed has that id.
175
190
  */
176
191
  clear_content_control_value(embed_id: string): void;
177
192
  /**
@@ -198,6 +213,26 @@ declare class EditSession {
198
213
  * This replica's client id, as passed to the constructor.
199
214
  */
200
215
  client_id(): number;
216
+ /**
217
+ * Resolves a text target and anchors a side-map comment over it in one
218
+ * call (legacy agent helpers). `comment_json`:
219
+ * `{"id","author","date","body"?}`. Returns `{"ok":true,"version"}` or a
220
+ * refusal.
221
+ */
222
+ comment_text_target_json(target_json: string, comment_json: string): string;
223
+ /**
224
+ * Compares two DOCX packages into this session, which must hold no document: the original
225
+ * is opened here and the revised body text differences are applied as tracked changes,
226
+ * outside undo history.
227
+ *
228
+ * `options` is `{"author","date","granularity"?,"unsupported"?,"limits"?}`. Returns a final
229
+ * `{"ok":false,"diagnostics"}` or `{"ok":true,"noop":true,"changes":[],"diagnostics"}`, or
230
+ * `{"ok":true,"noop":false,"save"}` naming what a save of the applied changes may write:
231
+ * then pass the saved bytes to [`EditSession::finish_compared_docx_json`], or the save
232
+ * failure to [`EditSession::fail_compared_docx_json`]. Malformed options and internal
233
+ * failures throw.
234
+ */
235
+ compare_docx_json(original: Uint8Array, revised: Uint8Array, options: string): string;
201
236
  /**
202
237
  * Adds a story holding one paragraph with `initial_text` (which must not
203
238
  * contain paragraph breaks), `p_style` and `alignment`. Receipt:
@@ -308,6 +343,58 @@ declare class EditSession {
308
343
  * with [`EditSession::resolve_encoded_selection`].
309
344
  */
310
345
  encoded_selection(): string;
346
+ /**
347
+ * [`EditSession::export_structured_json`] rendered as Markdown from the same read:
348
+ * `{"ok":true,"version","content":{"markdown","anchors","diagnostics","truncated"}}`.
349
+ */
350
+ export_markdown_json(options: string): string;
351
+ /**
352
+ * Lays this private session out with its own fonts and exports it with pages as a
353
+ * snapshot. `fonts` holds the font files back to back, `font_lengths` their byte lengths;
354
+ * `request` is a region layout request whose font chains name fonts by their index. The
355
+ * reply is `{"ok":true,"content"}` or `{"ok":false,"failure"}`; a rejected font or an
356
+ * unusable request throws. The module's shared measurement fonts are left untouched.
357
+ */
358
+ export_snapshot_with_private_fonts_json(fonts: Uint8Array, font_lengths: Uint32Array, request: string, options: string): string;
359
+ /**
360
+ * Structured export of the committed document state:
361
+ * `{"revisionView","stories"?,"includeFormatting"?,"maxBlocks"?,"maxBytes"?}` ->
362
+ * `{"ok":true,"version","content"}` or `{"ok":false,"version","failure"}`. Anchors are scoped
363
+ * to the returned version. Reads only: nothing is committed, minted or published.
364
+ */
365
+ export_structured_json(options: string): string;
366
+ /**
367
+ * [`EditSession::export_structured_json`] with the page map of the retained region
368
+ * layout. `options` adds `"includeGeometry"?`, `"expectLayoutVersion"?`,
369
+ * `"maxFragments"?` and `"maxLayoutBytes"?`; the reply is
370
+ * `{"ok":true,"version","content":{"structured","layout"}}` or a refusal. An editor passes
371
+ * the region layout request it would lay the document out with now as `current_request`,
372
+ * and the layout must have been computed from the same inputs. Lays nothing out and changes
373
+ * nothing.
374
+ */
375
+ export_structured_with_pages_json(options: string, current_request?: string | null): string;
376
+ /**
377
+ * The final comparison result when saving the applied changes failed with `message`.
378
+ */
379
+ fail_compared_docx_json(message: string): string;
380
+ /**
381
+ * [`EditSession::list_content_controls_json`] keeping the controls that match `query`
382
+ * (`{"kind":"id","controlId"}`, `{"kind":"tag","tag"}`, `{"kind":"ooxmlId","ooxmlId"}` or
383
+ * `{"kind":"alias","alias"}`) exactly.
384
+ */
385
+ find_content_controls_json(query: string, options: string): string;
386
+ /**
387
+ * Exact, case-sensitive, paragraph-local search:
388
+ * `{"text","within","view","limit"?}` ->
389
+ * `{"ok":true,"version","matches":[{"text","range"}],"truncated"}`.
390
+ */
391
+ find_text_json(request: string): string;
392
+ /**
393
+ * The final comparison result for `bytes`, the saved applied changes, verified against both
394
+ * inputs: `{"ok":true,"changes","diagnostics"}` or `{"ok":false,"diagnostics"}`. Throws
395
+ * when no comparison awaits its saved bytes.
396
+ */
397
+ finish_compared_docx_json(bytes: Uint8Array): string;
311
398
  /**
312
399
  * Applies a set-valued, tri-state inline formatting delta over
313
400
  * `[start, end)` in one transaction. An omitted key keeps the current
@@ -332,6 +419,17 @@ declare class EditSession {
332
419
  * there is no receipt. Errors when a key carries a type not listed here.
333
420
  */
334
421
  format_range(story: string, start_para: string, start_offset: number, end_para: string, end_offset: number, delta_json: string): void;
422
+ /**
423
+ * Resolves a text target and formats it in one call (legacy agent
424
+ * helpers). `delta_json` is the [`EditSession::format_range`] delta.
425
+ * Returns `{"ok":true,"version"}` or a refusal.
426
+ */
427
+ format_text_target_json(target_json: string, delta_json: string): string;
428
+ /**
429
+ * The headings of `story` in document order, classified as the structured export
430
+ * classifies them: `[{"paraId","heading":{"outlineLevel","source"}}]`.
431
+ */
432
+ headings_json(story: string): string;
335
433
  /**
336
434
  * Stories changed by the latest undo or redo, sorted.
337
435
  */
@@ -409,6 +507,19 @@ declare class EditSession {
409
507
  * needs as JSON out, so the host can register fonts before laying out.
410
508
  */
411
509
  layout_font_requirements_json(input: string): string;
510
+ /**
511
+ * Every comment the session holds, sorted by id:
512
+ * `[{"id","author","date","done","parentId","body"}, …]`, `parentId`
513
+ * null for a top-level comment and `body` the JSON value it was given.
514
+ */
515
+ list_comments(): string;
516
+ /**
517
+ * The content controls of the committed state:
518
+ * `{"stories"?,"maxControls"?,"maxBytes"?}` -> `{"ok":true,"version","content"}` or
519
+ * `{"ok":false,"version","failure"}`. Control ids and anchors are scoped to the returned
520
+ * version. Reads only.
521
+ */
522
+ list_content_controls_json(options: string): string;
412
523
  /**
413
524
  * Every pending tracked change across all stories, in deterministic
414
525
  * story-then-position order:
@@ -434,7 +545,9 @@ declare class EditSession {
434
545
  * text must not contain paragraph breaks. Receipt:
435
546
  * `{storyId: [paraId, …]}` with each story's paragraphs in document
436
547
  * order. Errors when a story entry has no `storyId`, no `paragraphs`
437
- * array, or an empty one, and when a story id already exists.
548
+ * array, or an empty one, and when a story id already exists. Seeding a
549
+ * document that has no opening yet starts one; see
550
+ * [`EditingDoc::begin_opening`].
438
551
  */
439
552
  load_json(stories_json: string): string;
440
553
  /**
@@ -483,7 +596,9 @@ declare class EditSession {
483
596
  /**
484
597
  * Parses a DOCX package, optionally seeds its editable stories into this
485
598
  * replica, and retains the source bytes for
486
- * [`EditSession::materialize_docx`].
599
+ * [`EditSession::materialize_docx`] and paragraph identity reads.
600
+ * Seeding starts a new opening, with `generation` or a fresh one, so its
601
+ * session anchors are its own; see [`EditingDoc::begin_opening`].
487
602
  *
488
603
  * Returns `{"envelope","referencedFonts":[string, …]}`. The envelope is
489
604
  * the parsed package with the parts the host does not need stripped —
@@ -493,7 +608,7 @@ declare class EditSession {
493
608
  * bulk of the document stays in Rust. Errors on bytes that are not a
494
609
  * readable DOCX.
495
610
  */
496
- open_docx(bytes: Uint8Array, seed_stories: boolean): string;
611
+ open_docx(bytes: Uint8Array, seed_stories: boolean, generation?: string | null): string;
497
612
  /**
498
613
  * One glyph outline from this session's resident font store:
499
614
  * `{"upem":n,"cmds":[{"t":"M"|"L"|"Q"|"C"|"Z", …}]}` — commands in font
@@ -502,6 +617,20 @@ declare class EditSession {
502
617
  * Errors when the glyph cannot be extracted.
503
618
  */
504
619
  outline_glyph_json(font_id: number, glyph_id: number): string;
620
+ /**
621
+ * Every paragraph's identities: `{"sessionId","packageSha256",
622
+ * "paragraphs":[{"session","origin","ooxmlParaId","idOrigin",
623
+ * "persisted","source"}]}`, session paragraphs with stories sorted and
624
+ * in document order, then source paragraphs outside the stories, whose
625
+ * `session` is `null`. Reads only.
626
+ */
627
+ paragraph_identities(): string;
628
+ /**
629
+ * The paragraph IDs a save applies, as the package writer's
630
+ * `paragraphIds` request field: `{"assignments":[{"part","ordinal",
631
+ * "paraId"}],"patchedParts":[{"part","paraIds":[[ordinal,"ID"]]}]}`.
632
+ */
633
+ paragraph_save_plan(): string;
505
634
  /**
506
635
  * Compact paragraph-position projection built in one story traversal:
507
636
  * `[{"paraId","length"}, …]` in document order, where `length` counts the
@@ -517,6 +646,30 @@ declare class EditSession {
517
646
  * else has been set on it). Errors on an unknown story.
518
647
  */
519
648
  paragraphs(story: string): string;
649
+ /**
650
+ * Gives every paragraph that saves without a Word paragraph ID a fresh
651
+ * one and repairs duplicates; see [`EditingDoc::persist_paragraph_ids`].
652
+ * Receipt: `{"status":"applied","assignments":[{"paragraph",
653
+ * "replacedParaId","previousOoxmlParaId","ooxmlParaId","idOrigin",
654
+ * "persisted"}],"diagnostics":[…]}`, or `{"status":"refused","refusal"}`
655
+ * when nothing was changed.
656
+ */
657
+ persist_paragraph_ids(): string;
658
+ /**
659
+ * Versioned paragraph texts:
660
+ * `{"story"?,"paraIds"?,"view":"accepted"|"original"}` ->
661
+ * `{"ok":true,"version","view","paragraphs":[{"story","paraId","text",
662
+ * "styleId"?,"atoms":[{"offset","kind"}]}]}`. Each inline atom occupies one
663
+ * U+FFFC in `text`.
664
+ */
665
+ read_paragraphs_json(request: string): string;
666
+ /**
667
+ * Reconciles and publishes the `[owner, paraId]` pairs a save captured,
668
+ * an owner being a session key or a source occurrence's
669
+ * `{partUri}#{ordinal}`; returns the stale pairs as the same JSON shape.
670
+ * See [`EditingDoc::record_saved_paragraph_ids`].
671
+ */
672
+ record_saved_paragraph_ids(saved_json: string): string;
520
673
  /**
521
674
  * Reapplies the latest locally undone transaction and reports whether
522
675
  * anything was reapplied.
@@ -528,6 +681,13 @@ declare class EditSession {
528
681
  * Errors on bytes the font parser rejects.
529
682
  */
530
683
  register_measure_font(bytes: Uint8Array): number;
684
+ /**
685
+ * Registers a measurement view of `base` carrying the vertical metrics
686
+ * and advance pitch Word measures `requested_family` with — for a face
687
+ * this host had to substitute. Returns `base` for a family whose metrics
688
+ * are unknown.
689
+ */
690
+ register_substitute_measure_font(base: number, requested_family: string): number;
531
691
  /**
532
692
  * Rejects tracked changes — the inverse of
533
693
  * [`EditSession::accept_change`]: pending insertions roll back, pending
@@ -564,6 +724,16 @@ declare class EditSession {
564
724
  * Errors on malformed bytes or an endpoint that no longer resolves.
565
725
  */
566
726
  resolve_encoded_selection(story: string, anchor: Uint8Array, head: Uint8Array): string;
727
+ /**
728
+ * Resolves a `session`, `source` or `persisted` anchor JSON against the
729
+ * current state: `{"status":"found","anchor"}`, `{"status":"missing"}`,
730
+ * `{"status":"ambiguous","candidates"}` or `{"status":"unsupported",
731
+ * "reason"}` with a `foreign-session`, `foreign-package` or
732
+ * `no-source-package` reason. A found source paragraph outside the
733
+ * session stories comes back as its source anchor. Errors on a malformed
734
+ * anchor.
735
+ */
736
+ resolve_paragraph_anchor(anchor_json: string): string;
567
737
  /**
568
738
  * Resolves sticky bytes from [`EditSession::encode_sticky_position`] back
569
739
  * to `{"story","paraId","offset"}`. Errors when the bytes are malformed
@@ -575,13 +745,13 @@ declare class EditSession {
575
745
  * fallback after a retained-only region layout.
576
746
  */
577
747
  retained_kernel_inputs_json(): string;
748
+ search_text(query: string, case_sensitive: boolean, limit?: number | null): string;
578
749
  /**
579
750
  * [`EditSession::open_docx`] with seeding always on.
580
751
  */
581
- seed_from_docx(bytes: Uint8Array): string;
752
+ seed_from_docx(bytes: Uint8Array, generation?: string | null): string;
582
753
  /**
583
- * Notes the story a direct operation is about to edit; a different story
584
- * than the previous edit or caret closes the current undo step.
754
+ * Selects a story, closing capture unless manual grouping is selected.
585
755
  */
586
756
  select_story(story: string): void;
587
757
  /**
@@ -596,7 +766,9 @@ declare class EditSession {
596
766
  * ```json
597
767
  * {
598
768
  * "bold": true | false | "mixed", "italic": …, "underline": …, "strike": …,
769
+ * "superscript": …, "subscript": …,
599
770
  * "fontFamily": string|null, "fontSize": number|null, "color": string|null,
771
+ * "highlight": string|null,
600
772
  * "paraId": string, "styleId": string|null, "alignment": string|null,
601
773
  * "paragraphProperties": {…},
602
774
  * "hasSelection": bool, "isMultiParagraph": bool, "inTable": bool,
@@ -612,6 +784,12 @@ declare class EditSession {
612
784
  * pending tracked change.
613
785
  */
614
786
  selection_context(story: string, start_para: string, start_offset: number, end_para: string, end_offset: number): string;
787
+ /**
788
+ * Accepted-view texts around a paragraph-keyed selection:
789
+ * `{"paraId","selectedText","paragraphText","before","after"}`, with
790
+ * `\n` between paragraphs and U+FFFC for each inline atom.
791
+ */
792
+ selection_text_json(story: string, start_para: string, start_offset: number, end_para: string, end_offset: number): string;
615
793
  /**
616
794
  * Merges the sides of the JSON object `borders_json` into every selected
617
795
  * cell's `tcPr.borders`; `insideH`/`insideV` resolve to the physical edges
@@ -648,18 +826,25 @@ declare class EditSession {
648
826
  * `width_twips` is finite and positive.
649
827
  */
650
828
  set_column_width(at_json: string, width_twips: number): string;
829
+ /**
830
+ * Reanchors an existing comment without changing its metadata.
831
+ */
832
+ set_comment_ranges(comment_id: string, ranges_json: string): void;
651
833
  /**
652
834
  * Sets the authored `value` (any JSON) on the content-control embed
653
- * carrying `embed_id`, searching every story. Errors when no embed has
654
- * that id.
835
+ * carrying `embed_id`, searching every story. A plain- or rich-text
836
+ * control takes a string, which fills its content as one
837
+ * version-checked batch step instead. Errors when no embed has that id
838
+ * and when a fill is refused.
655
839
  */
656
840
  set_content_control_value(embed_id: string, value_json: string): void;
657
841
  /**
658
842
  * Sets the authored `value` on the content-control embed at
659
843
  * `(story, para_id, offset)` — the way to reach a control with no
660
844
  * authored `w:id` or tag, which
661
- * [`EditSession::set_content_control_value`] cannot address. Errors when
662
- * that position holds no embed.
845
+ * [`EditSession::set_content_control_value`] cannot address. A text
846
+ * control's string value fills it as that method does. Errors when that
847
+ * position holds no embed.
663
848
  */
664
849
  set_content_control_value_at(story: string, para_id: string, offset: number, value_json: string): void;
665
850
  /**
@@ -679,6 +864,13 @@ declare class EditSession {
679
864
  * has that id.
680
865
  */
681
866
  set_image_geometry(embed_id: string, geometry_json: string): void;
867
+ /**
868
+ * [`EditSession::set_image_geometry`] for the image embed at
869
+ * `(story, para_id, offset)` — the way to reach one of several images
870
+ * sharing a relationship id, which the id variant resolves to the first.
871
+ * Errors when that position holds no image.
872
+ */
873
+ set_image_geometry_at(story: string, para_id: string, offset: number, geometry_json: string): void;
682
874
  /**
683
875
  * Sets one paragraph property to any JSON value on `para_id`'s pilcrow,
684
876
  * searching every story. Unlike
@@ -718,6 +910,10 @@ declare class EditSession {
718
910
  * `width_twips` is finite and positive.
719
911
  */
720
912
  set_table_width(table_json: string, width_twips: number): string;
913
+ /**
914
+ * Changes grouping policy while retaining undo and redo history.
915
+ */
916
+ set_undo_capture_mode(mode: string): void;
721
917
  /**
722
918
  * Subscribes `callback(update: Uint8Array, isRemote: 0|1)` to every
723
919
  * committed transaction. `update` is v1-encoded — feed it straight to
@@ -770,6 +966,11 @@ declare class EditSession {
770
966
  * as one. Errors on an unknown story.
771
967
  */
772
968
  story_len(story: string): number;
969
+ /**
970
+ * The Word paragraph ID each paragraph of `story` saves with, as a JSON
971
+ * array of strings or `null` in document order. Errors on an unknown story.
972
+ */
973
+ story_paragraph_ids(story: string): string;
773
974
  /**
774
975
  * The story as an ordered run of formatted segments — the same view
775
976
  * lowering reads:
@@ -807,6 +1008,26 @@ declare class EditSession {
807
1008
  * tracked-origin policy; `false` before tracking starts.
808
1009
  */
809
1010
  undo(): boolean;
1011
+ /**
1012
+ * Current undo grouping policy.
1013
+ */
1014
+ undo_capture_mode(): string;
1015
+ /**
1016
+ * Runs every check of [`EditSession::apply_edits_json`], staging included,
1017
+ * without changing anything: `{"ok":true,"baseVersion","wouldApply","previews"}`.
1018
+ */
1019
+ validate_edits_json(request: string): string;
1020
+ /**
1021
+ * The session-scoped version token of the committed document state. It
1022
+ * changes on every committed change, local or remote, and when the
1023
+ * document or its retained source is replaced.
1024
+ */
1025
+ version(): string;
1026
+ /**
1027
+ * The Word paragraph IDs a DOCX package holds, as JSON mapping each XML
1028
+ * part URI to its paragraphs' IDs in document order, in canonical form.
1029
+ */
1030
+ written_paragraph_ids(bytes: Uint8Array): string;
810
1031
  /**
811
1032
  * Lowers one story to a `LayoutBlock[]` JSON array — the block, run and
812
1033
  * table vocabulary the layout engine consumes. `env_json` supplies the
@@ -842,5 +1063,17 @@ declare function preloadEditWasm(input?: WasmAsyncInput): Promise<void>;
842
1063
  * surface — nothing else should call it.
843
1064
  */
844
1065
  declare function createEditSession(clientId: number): EditSession;
1066
+ /** Structured export of DOCX bytes: `{ok: true, content}` or `{ok: false, failure}` JSON. */
1067
+ declare function exportDocxStructuredJson(bytes: Uint8Array, options: string): string;
1068
+ /** {@link exportDocxStructuredJson} rendered as Markdown. */
1069
+ declare function exportDocxMarkdownJson(bytes: Uint8Array, options: string): string;
1070
+ /** Markdown rendering of structured content JSON. */
1071
+ declare function renderDocxMarkdownJson(content: string, options: string): string;
1072
+ /** Content controls of DOCX bytes: `{ok: true, content}` or `{ok: false, failure}` JSON. */
1073
+ declare function listDocxContentControlsJson(bytes: Uint8Array, options: string): string;
1074
+ /** The content controls of DOCX bytes matching a query, as {@link listDocxContentControlsJson}. */
1075
+ declare function findDocxContentControlsJson(bytes: Uint8Array, query: string, options: string): string;
1076
+ /** Markdown rendering of a paged export's JSON, with optional page markers. */
1077
+ declare function renderDocxMarkdownWithPagesJson(content: string, options: string): string;
845
1078
 
846
- export { EditSession, createEditSession, preloadEditWasm };
1079
+ export { EditSession, createEditSession, exportDocxMarkdownJson, exportDocxStructuredJson, findDocxContentControlsJson, listDocxContentControlsJson, preloadEditWasm, renderDocxMarkdownJson, renderDocxMarkdownWithPagesJson };
@@ -1 +1 @@
1
- export{b as createEditSession,a as preloadEditWasm}from'./chunk-GD4VNJ64.mjs';import'./chunk-5F6DLQZP.mjs';import'./chunk-TTRUPDAB.mjs';
1
+ export{b as createEditSession,d as exportDocxMarkdownJson,c as exportDocxStructuredJson,g as findDocxContentControlsJson,f as listDocxContentControlsJson,a as preloadEditWasm,e as renderDocxMarkdownJson,h as renderDocxMarkdownWithPagesJson}from'./chunk-Z4HZIPBS.mjs';import'./chunk-5F6DLQZP.mjs';import'./chunk-TTRUPDAB.mjs';
@@ -106,6 +106,13 @@ declare function layoutDocumentJson(input: string): string;
106
106
  * rejects unparseable input at this boundary).
107
107
  */
108
108
  declare function registerMeasureFont(bytes: Uint8Array): number;
109
+ /**
110
+ * Register a measurement view of `base` carrying the vertical metrics and
111
+ * advance pitch Word measures `family` with — for a face the host
112
+ * substituted. Returns `base` unchanged for a family whose metrics the engine
113
+ * does not know.
114
+ */
115
+ declare function registerSubstituteMeasureFont(base: number, family: string): number;
109
116
  /** Drop every registered measurement font (ids restart at 0). Callers must re-register before the next `measureParagraphJson`. */
110
117
  declare function clearMeasureFonts(): void;
111
118
  /**
@@ -125,4 +132,4 @@ declare function measureParagraphJson(input: string): string;
125
132
  */
126
133
  declare function outlineGlyphJson(fontId: number, glyphId: number): string;
127
134
 
128
- export { buildDisplayListJson, clearMeasureFonts, closeDisplayList, hasDisplayListSession, hasDisplayListUpdate, hasRangeRectsRegion, hitTestRegionsByHandle, hitTestRegionsJson, layoutDocumentJson, measureParagraphJson, openDisplayList, outlineGlyphJson, preloadLayoutWasm, rangeRectsByHandle, rangeRectsJson, rangeRectsRegionByHandle, rangeRectsRegionJson, registerMeasureFont, updateDisplayList, verticalMoveByHandle, verticalMoveJson };
135
+ export { buildDisplayListJson, clearMeasureFonts, closeDisplayList, hasDisplayListSession, hasDisplayListUpdate, hasRangeRectsRegion, hitTestRegionsByHandle, hitTestRegionsJson, layoutDocumentJson, measureParagraphJson, openDisplayList, outlineGlyphJson, preloadLayoutWasm, rangeRectsByHandle, rangeRectsJson, rangeRectsRegionByHandle, rangeRectsRegionJson, registerMeasureFont, registerSubstituteMeasureFont, updateDisplayList, verticalMoveByHandle, verticalMoveJson };
@@ -1 +1 @@
1
- export{p as buildDisplayListJson,s as clearMeasureFonts,g as closeDisplayList,d as hasDisplayListSession,i as hasDisplayListUpdate,e as hasRangeRectsRegion,j as hitTestRegionsByHandle,b as hitTestRegionsJson,q as layoutDocumentJson,t as measureParagraphJson,f as openDisplayList,u as outlineGlyphJson,a as preloadLayoutWasm,m as rangeRectsByHandle,c as rangeRectsJson,o as rangeRectsRegionByHandle,n as rangeRectsRegionJson,r as registerMeasureFont,h as updateDisplayList,l as verticalMoveByHandle,k as verticalMoveJson}from'./chunk-WTFRNX5K.mjs';import'./chunk-5F6DLQZP.mjs';import'./chunk-TTRUPDAB.mjs';
1
+ export{p as buildDisplayListJson,t as clearMeasureFonts,g as closeDisplayList,d as hasDisplayListSession,i as hasDisplayListUpdate,e as hasRangeRectsRegion,j as hitTestRegionsByHandle,b as hitTestRegionsJson,q as layoutDocumentJson,u as measureParagraphJson,f as openDisplayList,v as outlineGlyphJson,a as preloadLayoutWasm,m as rangeRectsByHandle,c as rangeRectsJson,o as rangeRectsRegionByHandle,n as rangeRectsRegionJson,r as registerMeasureFont,s as registerSubstituteMeasureFont,h as updateDisplayList,l as verticalMoveByHandle,k as verticalMoveJson}from'./chunk-H5YYCN42.mjs';import'./chunk-5F6DLQZP.mjs';import'./chunk-TTRUPDAB.mjs';
@@ -1,7 +1,9 @@
1
+ import '../formatting-gqLFeJ9X.mjs';
1
2
  import '../types/document.mjs';
2
- export { w as CreateYrsSessionOptions, R as ResidentCaretPaintStyle, x as ResidentEngineOffscreenPage, y as ResidentEngineWorkerApplyResult, z as ResidentEngineWorkerClient, A as ResidentEngineWorkerFrame, B as ResidentWorkerFailureError, D as YrsAuthor, E as YrsCellBorder, F as YrsCellBorders, G as YrsCellLoc, H as YrsChangeTarget, I as YrsCommentReceipt, J as YrsContentControlValue, K as YrsDocxHost, L as YrsEngineApplyProfile, M as YrsHyperlinkAttrs, N as YrsImageGeometry, O as YrsInlineFormatDelta, P as YrsInputParagraphSeed, Q as YrsInputParagraphSpan, S as YrsInputPositionMap, u as YrsLoc, T as YrsNumberingProperties, U as YrsParaOffset, V as YrsParagraph, W as YrsParagraphAttrs, X as YrsParagraphLength, Z as YrsParagraphReceipt, _ as YrsParagraphSeed, $ as YrsParagraphSpan, a0 as YrsParagraphTabStop, a1 as YrsRawOp, a as YrsRenderEnv, a2 as YrsResidentCaretRect, a3 as YrsResidentCaretSnapshot, a4 as YrsResidentWorkerSnapshot, a5 as YrsResidentWorkerSyncOptions, a6 as YrsResolveReceipt, a7 as YrsResolvedCommentAnchor, v as YrsRevisionInfo, a8 as YrsRevisionReceipt, a9 as YrsRunMark, j as YrsSelection, aa as YrsSelectionContext, Y as YrsSession, ab as YrsSplitReceipt, ac as YrsStickyPosition, ad as YrsStoryRange, ae as YrsStorySeed, af as YrsStorySegment, ag as YrsTableLoc, ah as YrsTableRange, ai as YrsTableReceipt, aj as YrsTextColor, ak as YrsTriState, al as YrsWatermark, am as canUseResidentEngineWorker, an as compareYrsLocs, ao as createYrsInputPositionMap, ap as createYrsSession, aq as displayPositionToYrsLoc, ar as documentToYrs, as as residentCaretDeviceRect, at as residentCaretSnapshotForFrame, au as sameYrsSelection, av as yrsLocToDisplayPosition, aw as yrsToDocument } from '../index-CHl2zLJ7.mjs';
3
- import '../content-CvEtPl0c.mjs';
4
- import '../formatting-7zKCTu5a.mjs';
3
+ export { w as CreateYrsSessionOptions, D as DocxParagraphAnchor, x as DocxParagraphAnchorResult, y as DocxParagraphIdAssignment, z as DocxParagraphIdDiagnostic, A as DocxParagraphIdOrigin, B as DocxParagraphIdRefusal, E as DocxParagraphIdentity, F as DocxParagraphIdentityReceipt, G as DocxParagraphIdentitySnapshot, H as DocxParagraphOrigin, I as DocxParagraphRef, J as DocxParagraphSavePlan, K as DocxPersistedParagraphAnchor, L as DocxSavedDocument, M as DocxSavedParagraph, N as DocxSessionParagraphAnchor, O as DocxSessionSave, P as DocxSourceParagraphAnchor, Q as DocxSourceStory, R as ResidentCaretPaintStyle, S as ResidentEngineOffscreenPage, T as ResidentEngineWorkerApplyResult, U as ResidentEngineWorkerClient, V as ResidentEngineWorkerFrame, W as ResidentWorkerFailureError, X as YrsAuthor, Z as YrsCellBorder, _ as YrsCellBorders, $ as YrsCellLoc, a0 as YrsChangeTarget, a1 as YrsCommentInfo, a2 as YrsCommentReceipt, a3 as YrsContentControlValue, a4 as YrsDocxHost, a5 as YrsEngineApplyProfile, a6 as YrsHyperlinkAttrs, a7 as YrsImageGeometry, a8 as YrsInlineFormatDelta, a9 as YrsInputParagraphSeed, aa as YrsInputParagraphSpan, ab as YrsInputPositionMap, u as YrsLoc, ac as YrsNumberingProperties, ad as YrsOpeningOptions, ae as YrsParaOffset, af as YrsParagraph, ag as YrsParagraphAttrs, ah as YrsParagraphLength, ai as YrsParagraphReceipt, aj as YrsParagraphSeed, ak as YrsParagraphSpan, al as YrsParagraphTabStop, am as YrsRawOp, a as YrsRenderEnv, an as YrsResidentCaretRect, ao as YrsResidentCaretSnapshot, ap as YrsResidentFontRegistration, aq as YrsResidentWorkerSnapshot, ar as YrsResidentWorkerSyncOptions, as as YrsResolveReceipt, at as YrsResolvedCommentAnchor, v as YrsRevisionInfo, au as YrsRevisionReceipt, av as YrsRunMark, j as YrsSelection, aw as YrsSelectionContext, ax as YrsSelectionText, Y as YrsSession, ay as YrsSplitReceipt, az as YrsStickyPosition, aA as YrsStoryRange, aB as YrsStorySeed, aC as YrsStorySegment, aD as YrsTableLoc, aE as YrsTableRange, aF as YrsTableReceipt, aG as YrsTargetEditResult, aH as YrsTextColor, aI as YrsTextMatch, aJ as YrsTextSearchOptions, aK as YrsTriState, aL as YrsUndoCaptureMode, aM as YrsWatermark, aN as canUseResidentEngineWorker, aO as captureSessionSave, aP as compareYrsLocs, aQ as createYrsInputPositionMap, aR as createYrsSession, aS as displayPositionToYrsLoc, aT as documentToYrs, aU as residentCaretDeviceRect, aV as residentCaretSnapshotForFrame, aW as sameYrsSelection, aX as saveYrsDocx, aY as writeSessionSave, aZ as yrsLocToDisplayPosition, a_ as yrsToDocument } from '../index-BbZwdkPz.mjs';
4
+ export { o as DocxAnchor, p as DocxAnchorScope, a9 as DocxAtomKind, q as DocxCachedResult, r as DocxCommentMetadata, s as DocxContentControl, t as DocxContentControlDiagnostic, l as DocxContentControlQuery, k as DocxContentControlReadFailure, u as DocxContentControlSelector, v as DocxContentControlValue, m as DocxContentControlsOptions, w as DocxContentControlsResult, n as DocxContentControlsSnapshot, x as DocxControlMetadata, aa as DocxEditFailure, ab as DocxEditFailureCode, ac as DocxEditFailureReason, ad as DocxEditGuard, ae as DocxEditHistory, af as DocxEditOperation, ag as DocxEditPreview, ah as DocxEditReceipt, a8 as DocxEditRefusal, a4 as DocxEditRequest, a6 as DocxEditResult, ai as DocxEditSource, aj as DocxEditStep, ak as DocxEditSuggestion, al as DocxEditTarget, y as DocxExportBlock, z as DocxExportCell, A as DocxExportDiagnostic, B as DocxExportDiagnosticCode, D as DocxExportFailure, C as DocxExportFailureCode, E as DocxExportInline, a as DocxExportOptions, F as DocxExportPage, G as DocxExportRefusal, H as DocxExportResult, I as DocxExportStory, J as DocxExportTable, a2 as DocxFindTextRequest, a3 as DocxFindTextResult, K as DocxFormattingMark, L as DocxFragmentGeometry, M as DocxHeadingInfo, N as DocxHeadlessFont, e as DocxHeadlessLayoutOptions, O as DocxInlineRevision, i as DocxLayoutMap, P as DocxLayoutProvenance, Q as DocxListInfo, b as DocxMarkdownContent, h as DocxMarkdownOptions, R as DocxPageDiagnostic, d as DocxPageExportOptions, S as DocxPageFragment, T as DocxPageMapContent, j as DocxPageMarkdownOptions, f as DocxPagedStructuredContent, U as DocxParagraphData, V as DocxParagraphHeading, am as DocxParagraphInput, an as DocxParagraphTarget, ao as DocxParagraphText, a0 as DocxReadParagraphsRequest, a1 as DocxReadParagraphsResult, ap as DocxResolvedControl, W as DocxRevisionView, aq as DocxSearchScope, ar as DocxSetContentControlTextStep, g as DocxSnapshotLayoutMap, X as DocxSnapshotLayoutProvenance, Y as DocxStoryKind, Z as DocxStoryOccurrence, _ as DocxStorySelection, c as DocxStructuredContent, as as DocxTextAtom, at as DocxTextMatch, au as DocxTextPosition, av as DocxTextRange, a7 as DocxTextTarget, aw as DocxTextView, $ as DocxUnlocatedReason, a5 as DocxValidationResult, ax as EditSuccess, ay as OperationFailure, az as OperationRefusal, aA as ValidationSuccess } from '../pagedExport-D3E4jZ-B.mjs';
5
+ import '../content-BzoC6bSz.mjs';
5
6
  import '../docx/wrapTypes.mjs';
6
- import '../styles-7e-mq3c-.mjs';
7
- import '../frameDelta-pA4jrQ1G.mjs';
7
+ import '../styles-AryxLAhx.mjs';
8
+ import '../frameDelta-CVt5FAXT.mjs';
9
+ import '../rezip-Bxiq4Z_R.mjs';