@docx-editor.dev/editor-api 2.30.0 → 2.32.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.
@@ -1,4 +1,4 @@
1
- import { AutomationHandle, AutomationSpan, AutomationOperation, AutomationValue, AutomationSpanRef, RevisionBatchResult, RevisionAuthorResult, DiagnosticCode, AutomationHost, AutomationCapabilities, AutomationPaginationOptions, ByteSizeBucket, DocumentOpenDiagnosticCode, DocumentPartKind, DiagnosticErrorName, EditDiagnosticCode } from '@docx-editor.dev/core/automation';
1
+ import { AutomationHandle, AutomationSpan, AutomationOperation, AutomationValue, AutomationSpanRef, RevisionBatchResult, RevisionAuthorResult, DiagnosticCode, HistoryGroup, AutomationHost, AutomationCapabilities, AutomationPaginationOptions, ByteSizeBucket, DocumentOpenDiagnosticCode, DocumentPartKind, DiagnosticErrorName, EditDiagnosticCode } from '@docx-editor.dev/core/automation';
2
2
  import { CollaborationModuleContribution } from '@docx-editor.dev/core/collaboration';
3
3
 
4
4
  /**
@@ -17,6 +17,15 @@ type ObjectAddress = {
17
17
  } | {
18
18
  readonly kind: 'span';
19
19
  readonly span: AutomationSpan;
20
+ }
21
+ /**
22
+ * A field's cached result (`Field.result`). The field is one model character, so its result
23
+ * has no addressable position of its own: only the field's handle names it, and only the
24
+ * members a result supports read or write through it. Every other use refuses.
25
+ */
26
+ | {
27
+ readonly kind: 'fieldResult';
28
+ readonly field: AutomationHandle;
20
29
  };
21
30
  type ObjectPathState =
22
31
  /** Promised: created by a queued read that has not answered yet. */
@@ -39,7 +48,14 @@ type ObjectPathState =
39
48
  declare class ObjectPath {
40
49
  #private;
41
50
  readonly label: string;
51
+ /** Whether this path names the cached result of the field its parent names. */
52
+ readonly isFieldResult: boolean;
42
53
  private constructor();
54
+ /**
55
+ * The cached result of the field `field` names. It shares the field's fate, and resolves when
56
+ * the field does.
57
+ */
58
+ static fieldResult(label: string, field: ObjectPath): ObjectPath;
43
59
  /** A path that is addressable from the moment it exists — a root, or an item just hydrated. */
44
60
  static of(label: string, handle: AutomationHandle): ObjectPath;
45
61
  /** The same, for an object that IS a stretch of a story. */
@@ -102,6 +118,16 @@ interface QueuedAction {
102
118
  readonly nullableLoad?: ObjectPath;
103
119
  /** The consumer-facing name of what this action is for, for errors. Never a handle. */
104
120
  readonly label: string;
121
+ /**
122
+ * A runtime setting, not a document edit: an agent helper's own first sync may carry it. Set
123
+ * only for tracking-mode assignments the runtime accepts (`Off`, `TrackMineOnly`).
124
+ */
125
+ readonly runtimeSetting?: true;
126
+ /**
127
+ * The answer queues reads for the same sync: a listing whose items load properties named
128
+ * with `items/`. A sync that writes sends such a listing, and those reads, before its writes.
129
+ */
130
+ readonly continues?: boolean;
105
131
  /** Detach coalesced setters when sync captures this action, before asynchronous reads. */
106
132
  capture?(): void;
107
133
  /** Release coalesced state when a batch completes or is discarded. */
@@ -123,6 +149,22 @@ declare class ActionQueue {
123
149
  /** What is queued right now, for tests and for the empty-batch shortcut. */
124
150
  get pending(): readonly QueuedAction[];
125
151
  push(action: QueuedAction): void;
152
+ /**
153
+ * Run `work` and return what it queued instead of queueing it.
154
+ *
155
+ * Synchronous on purpose: nothing a consumer writes can run while `work` does, so no call of
156
+ * theirs can land in the returned list.
157
+ */
158
+ collect(work: () => void): QueuedAction[];
159
+ /**
160
+ * Run `work` while a sync settles an answer, and keep what it queued for that same sync.
161
+ *
162
+ * This is how `load('items/text')` reads each item: the items are known only once the listing
163
+ * has answered, and the sync that sent the listing sends their reads before it resolves.
164
+ */
165
+ continuing(work: () => void): void;
166
+ /** Hand over the reads `continuing` kept, and forget them. */
167
+ takeContinuations(): readonly QueuedAction[];
126
168
  /** Hand over everything queued and forget it. Never replayed — see the file header. */
127
169
  take(): readonly QueuedAction[];
128
170
  /** Drop everything queued: what a finished run does with actions nobody synced. */
@@ -221,11 +263,15 @@ declare abstract class ItemCollection<T extends ClientObject> extends ClientObje
221
263
  * The members this collection was loaded with.
222
264
  *
223
265
  * `PropertyNotLoaded` until a `load(...)` has been synced: a collection that answered `[]`
224
- * before it had been read would be indistinguishable from an empty document.
266
+ * before it had been read would be indistinguishable from an empty document. Name an item
267
+ * property with an `items/` path, such as `load('items/text')`, to load it on every member in
268
+ * the same sync.
225
269
  */
226
270
  get items(): readonly T[];
227
271
  /** @internal Take the members straight from the command that produced them. */
228
272
  fill(value: AutomationValue, label: string): void;
273
+ /** @internal Collections accept `items/<property>` paths. */
274
+ protected get loadsItemPaths(): boolean;
229
275
  /** @internal Plan the read this object's `load(...)` asked for. */
230
276
  protected onLoad(request: ResolvedLoadOptions): void;
231
277
  /** One member, by which end of the collection it is at. */
@@ -253,6 +299,30 @@ declare enum InsertLocation {
253
299
  before = "Before",
254
300
  after = "After"
255
301
  }
302
+ /**
303
+ * Which part of an object a `getRange` call answers. Each call validates its allowed subset;
304
+ * `Range.getRange` supports `Whole`, `Content`, `Start`, and `End`.
305
+ *
306
+ * @public
307
+ */
308
+ declare enum RangeLocation {
309
+ whole = "Whole",
310
+ start = "Start",
311
+ end = "End",
312
+ before = "Before",
313
+ after = "After",
314
+ content = "Content"
315
+ }
316
+ /**
317
+ * Which version of tracked text `getReviewedText` reads: as if every pending revision were
318
+ * rejected (`Original`) or accepted (`Current`).
319
+ *
320
+ * @public
321
+ */
322
+ declare enum ChangeTrackingVersion {
323
+ original = "Original",
324
+ current = "Current"
325
+ }
256
326
  /** Paragraph alignment vocabulary. Mixed and unknown are read states, not authoring modes. @public */
257
327
  declare enum Alignment {
258
328
  mixed = "Mixed",
@@ -335,223 +405,16 @@ declare enum RemoveDocInfoType {
335
405
  versions = "Versions"
336
406
  }
337
407
 
338
- /** Supported Word bullet styles. @public */
339
- declare enum ListBullet {
340
- custom = "Custom",
341
- solid = "Solid",
342
- hollow = "Hollow",
343
- square = "Square",
344
- diamonds = "Diamonds",
345
- arrow = "Arrow",
346
- checkmark = "Checkmark"
347
- }
348
- /** Supported Word numbering styles. @public */
349
- declare enum ListNumbering {
350
- none = "None",
351
- arabic = "Arabic",
352
- upperRoman = "UpperRoman",
353
- lowerRoman = "LowerRoman",
354
- upperLetter = "UpperLetter",
355
- lowerLetter = "LowerLetter"
356
- }
357
- /**
358
- * A list: the set of paragraphs sharing one numbering id.
359
- *
360
- * A list is not an ELEMENT. OOXML has no list — it has paragraphs that each name a `w:numId`, and
361
- * a list is the set that name the same one. So {@link List.id} is that number,
362
- * {@link List.paragraphs} is the set, and a list exists exactly as long as some paragraph is
363
- * still in it.
364
- *
365
- * @public
366
- */
367
- declare class List extends ModelObject implements PromisedItem {
368
- #private;
369
- /** @internal A list a read has already named. */
370
- static at(context: RequestContext, label: string, address: ObjectAddress): List;
371
- /** @internal A list a queued read will name, or report as nothing. */
372
- static promised(context: RequestContext, label: string, nullable: boolean): List;
373
- private constructor();
374
- /** @internal Bind this object to the address the owning read answered. */
375
- hydrateAddress(address: ObjectAddress): void;
376
- /** @internal Settle as the null object: the read found nothing to name. */
377
- hydrateNull(): void;
378
- /** The `w:numId` the list's paragraphs share — the document's own identity for the list. */
379
- get id(): number;
380
- /** Every paragraph in the list, in reading order. */
381
- get paragraphs(): ParagraphCollection;
382
- /** The list's paragraphs at one level, in reading order. */
383
- getLevelParagraphs(level: number): ParagraphCollection;
384
- /**
385
- * Add a numbered paragraph to the list, at its start or its end.
386
- *
387
- * All four of Word's locations are accepted and `Before`/`After` land INSIDE the list, at the
388
- * first and last position — the same places `Start` and `End` name. A list is a set of paragraphs
389
- * rather than a region, so "before the list" is a position in the story rather than in the list,
390
- * and `Paragraph#insertParagraph` is what addresses that. The divergence is recorded in
391
- * `compat/manifest.json`.
392
- */
393
- insertParagraph(paragraphText: string, insertLocation: 'Start' | 'End' | 'Before' | 'After'): Paragraph;
394
- /** Set a level's bullet glyph. Custom bullets require a Unicode character code. */
395
- setLevelBullet(level: number, listBullet: ListBullet, charCode?: number, fontName?: string): void;
396
- setLevelBullet(level: number, listBullet: 'Custom' | 'Solid' | 'Hollow' | 'Square' | 'Diamonds' | 'Arrow' | 'Checkmark', charCode?: number, fontName?: string): void;
397
- /** Set decimal, letter, Roman, or unnumbered markers. Numeric format entries identify zero-based levels. */
398
- setLevelNumbering(level: number, listNumbering: ListNumbering, formatString?: (string | number)[]): void;
399
- setLevelNumbering(level: number, listNumbering: 'None' | 'Arabic' | 'UpperRoman' | 'LowerRoman' | 'UpperLetter' | 'LowerLetter', formatString?: (string | number)[]): void;
400
- /** Set the starting counter for this list instance without changing other lists. */
401
- setLevelStartingNumber(level: number, startingNumber: number): void;
402
- /** Set text indent and relative first-line indent in points. Negative relative values create hanging indents. */
403
- setLevelIndents(level: number, textIndent: number, bulletNumberPictureIndent: number): void;
404
- /** @internal Plan the read this object's `load(...)` asked for. */
405
- protected onLoad(request: ResolvedLoadOptions): void;
406
- }
407
- /**
408
- * The lists in a story, as of the batch that loaded them.
409
- *
410
- * @public
411
- */
412
- declare class ListCollection extends HandleCollection<List> {
413
- #private;
414
- /** @internal The lists of one story, in the order their numbers first appear. */
415
- static of(context: RequestContext, label: string, owner: ObjectPath, body: AutomationHandle): ListCollection;
416
- private constructor();
417
- /** The first list. `ItemNotFound` at the sync if the story has none. */
418
- getFirst(): List;
419
- /**
420
- * The list with one `w:numId`, or `ItemNotFound` where the story has none.
421
- *
422
- * ONE read, answered by the host: a `w:numId` is a document value, and matching it against a
423
- * listing on this side would mean asking every list for its id and choosing locally — a batch
424
- * whose size depends on the document, to answer a question the host can answer directly. A number
425
- * no paragraph uses names a numbering definition rather than a list, and is refused.
426
- */
427
- getById(id: number): List;
428
- /** @internal The read that answers this collection's members. */
429
- protected listing(): AutomationOperation;
430
- /** @internal Build one member from an address the listing answered. */
431
- protected itemAt(label: string, address: ObjectAddress): List;
432
- /** @internal A member an edge accessor named before the sync that finds it. */
433
- protected promised(label: string, nullable: boolean): List & PromisedItem;
434
- }
435
- /**
436
- * A paragraph's membership of a list: which list, and at what level.
437
- *
438
- * `listString` (the "3." or "iv)" a reader sees) and `siblingIndex` are absent because they are
439
- * PAINTED, not authored — computed during layout by a counter that walks the story applying
440
- * `numbering.xml`, its abstract-numbering indirection, restarts and overrides. Answering them
441
- * here would mean a second counter that disagrees with the one on screen the first time a
442
- * document overrides a level.
443
- *
444
- * @public
445
- */
446
- declare class ListItem extends ModelObject {
447
- #private;
448
- /** @internal The list membership of the paragraph `owner` addresses. */
449
- static of(context: RequestContext, label: string, owner: ObjectPath): ListItem;
450
- private constructor();
451
- /**
452
- * How deeply the item is nested: zero for a top-level item, up to eight.
453
- *
454
- * Writing it is Word's Increase/Decrease Indent on a list item — the paragraph keeps its list and
455
- * changes its level, which is why this is one property rather than a pair of verbs.
456
- */
457
- get level(): number;
458
- set level(value: number);
459
- /** @internal Plan the read this object's `load(...)` asked for. */
460
- protected onLoad(request: ResolvedLoadOptions): void;
461
- }
462
-
463
408
  /** What the object is, which is what decides how its characters are named. */
464
409
  type SpanOwner = 'body' | 'paragraph' | 'span';
465
410
 
466
- /** Office.js underline values. Unsupported runtime modes refuse at sync. @public */
467
- declare enum UnderlineType {
468
- mixed = "Mixed",
469
- none = "None",
470
- hidden = "Hidden",
471
- dotLine = "DotLine",
472
- single = "Single",
473
- word = "Word",
474
- double = "Double",
475
- thick = "Thick",
476
- dotted = "Dotted",
477
- dottedHeavy = "DottedHeavy",
478
- dashLine = "DashLine",
479
- dashLineHeavy = "DashLineHeavy",
480
- dashLineLong = "DashLineLong",
481
- dashLineLongHeavy = "DashLineLongHeavy",
482
- dotDashLine = "DotDashLine",
483
- dotDashLineHeavy = "DotDashLineHeavy",
484
- twoDotDashLine = "TwoDotDashLine",
485
- twoDotDashLineHeavy = "TwoDotDashLineHeavy",
486
- wave = "Wave",
487
- waveHeavy = "WaveHeavy",
488
- waveDouble = "WaveDouble"
489
- }
490
411
  /**
491
- * The character formatting of whatever it belongs to: a story, a stretch of one, or a paragraph.
492
- *
493
- * A font has no identity of its own — it is a view onto its owner's characters and shares its
494
- * owner's path, so a font reached from a deleted paragraph's range refuses at the same moment the
495
- * range does rather than holding a stale address.
496
- *
497
- * Reading is AGREEMENT, and `null` means "no agreed value": every run the owner covers says bold,
498
- * or the answer is null. Null is also the answer when nothing in range authors the property at
499
- * all. Both are one answer on purpose, because this API reads what the document AUTHORS rather
500
- * than what the style cascade computes — a heading whose bold comes from `styles.xml` reads null.
501
- * Answering the cascade would let a caller read an inherited value, write it straight back, and
502
- * silently freeze it into the paragraph as if the author had chosen it.
503
- *
504
- * Assignments within one `sync()` are ONE write: `font.bold = true; font.size = 12` accumulates
505
- * into a single run-property operation. That is required, not an optimisation — a run-property
506
- * write carries the run's whole property bag, so a second write planned from the same pre-batch
507
- * tree would carry a bag the first had already superseded, which the host refuses with
508
- * `ConflictingChanges`.
412
+ * An inert Word field. Code writes and evaluation support PAGE and NUMPAGES. A field inside a
413
+ * pending tracked insertion reads, but refuses code writes and `updateResult` until accepted.
414
+ * Its cached result reads and writes through {@link Field.result}.
509
415
  *
510
416
  * @public
511
417
  */
512
- declare class Font extends ModelObject {
513
- #private;
514
- /** @internal The font of the object `owner` addresses. */
515
- static of(context: RequestContext, label: string, owner: ObjectPath, kind: SpanOwner): Font;
516
- private constructor();
517
- /** Whether every character agrees it is bold, or `null` where they do not. */
518
- get bold(): boolean | null;
519
- set bold(value: boolean);
520
- /** Whether every run in range is italic. `null` where they disagree or none says. */
521
- get italic(): boolean | null;
522
- set italic(value: boolean);
523
- /** `#RRGGBB`. `null` where the characters disagree, or where the colour is `auto`. */
524
- get color(): string | null;
525
- set color(value: string);
526
- /** The typeface name the characters state, or `null` where they do not agree on one. */
527
- get name(): string | null;
528
- set name(value: string);
529
- /** Points. */
530
- get size(): number | null;
531
- set size(value: number);
532
- /** Office underline styles. Mixed, Hidden, and DotLine refuse at sync. */
533
- get underline(): string | null;
534
- set underline(value: UnderlineType | 'Mixed' | 'None' | 'Hidden' | 'DotLine' | 'Single' | 'Word' | 'Double' | 'Thick' | 'Dotted' | 'DottedHeavy' | 'DashLine' | 'DashLineHeavy' | 'DashLineLong' | 'DashLineLongHeavy' | 'DotDashLine' | 'DotDashLineHeavy' | 'TwoDotDashLine' | 'TwoDotDashLineHeavy' | 'Wave' | 'WaveHeavy' | 'WaveDouble');
535
- /** Exact Word palette color, returned as #RRGGBB. Null clears highlighting. */
536
- get highlightColor(): string | null;
537
- set highlightColor(value: string);
538
- get strikeThrough(): boolean | null;
539
- set strikeThrough(value: boolean);
540
- get subscript(): boolean | null;
541
- set subscript(value: boolean);
542
- get superscript(): boolean | null;
543
- set superscript(value: boolean);
544
- /**
545
- * One read for every property asked for.
546
- *
547
- * They all come out of the same runs, so asking for them one at a time would send several
548
- * operations about the same characters and make a caller's cost depend on how many fields they
549
- * happened to name.
550
- */
551
- protected onLoad(request: ResolvedLoadOptions): void;
552
- }
553
-
554
- /** An inert Word field. Code writes and evaluation support PAGE and NUMPAGES. @public */
555
418
  declare class Field extends ModelObject implements PromisedItem {
556
419
  #private;
557
420
  /** @internal */
@@ -564,6 +427,17 @@ declare class Field extends ModelObject implements PromisedItem {
564
427
  /** @internal */
565
428
  hydrateNull(): void;
566
429
  get code(): string;
430
+ /**
431
+ * The field's cached result, as a range. Two members work on it: `text` (with
432
+ * `load('text')`, or `field.load('result')`) reads the result, and
433
+ * `insertText(text, 'Replace')` replaces it with plain text and marks the field `w:dirty`, so
434
+ * a reader that evaluates fields recomputes it. The instruction never changes and is never
435
+ * evaluated. Untracked, the field must sit outside every revision. With `TrackMineOnly`, the
436
+ * field must be your own pending insertion, and the result joins it. Every other range
437
+ * member, and every other insert location, refuses with `NotImplemented` and
438
+ * `edit.field-result-unsupported`.
439
+ */
440
+ get result(): Range;
567
441
  set code(value: string);
568
442
  /** Remove this field, including its cached result. Other fields remain inert and unchanged. */
569
443
  delete(): void;
@@ -588,7 +462,12 @@ declare class FieldCollection extends ItemCollection<Field> {
588
462
  protected promised(label: string, nullable: boolean): Field & PromisedItem;
589
463
  }
590
464
 
591
- /** Office field types. This runtime authors Page, NumPages, and Empty with a supported code. @public */
465
+ /**
466
+ * Office field types. This runtime authors Page, NumPages, Ref, PageRef, NoteRef, Seq, StyleRef,
467
+ * Date, Time, TOC, and Empty with an instruction of one of those types.
468
+ *
469
+ * @public
470
+ */
592
471
  declare enum FieldType {
593
472
  addin = "Addin",
594
473
  addressBlock = "AddressBlock",
@@ -725,7 +604,7 @@ declare class InlinePictureCollection extends ItemCollection<InlinePicture> {
725
604
  protected promised(label: string, nullable: boolean): InlinePicture & PromisedItem;
726
605
  }
727
606
 
728
- /** A canonical rectangular table. Reads require load() and sync(). @public */
607
+ /** A canonical table. Reads require load() and sync(). @public */
729
608
  declare class Table extends ModelObject implements PromisedItem {
730
609
  #private;
731
610
  /** @internal */
@@ -772,6 +651,18 @@ declare class Table extends ModelObject implements PromisedItem {
772
651
  deleteRows(rowIndex: number, rowCount?: number): void;
773
652
  /** Delete consecutive columns from a zero-based index. Defaults to one column. */
774
653
  deleteColumns(columnIndex: number, columnCount?: number): void;
654
+ /**
655
+ * Merge the rectangle that the cells at `(topRow, firstCell)` and `(bottomRow, lastCell)`
656
+ * span into one cell. Cell indexes count the cells of each row, as `rows.items[r].cells`
657
+ * lists them, so a merged cell counts once. `bottomRow` must not be above `topRow`; either
658
+ * cell can lie further left. The rectangle grows to whole merged cells; a cell that crosses
659
+ * its edge, or a rectangle of one cell, refuses with `InvalidArgument` and the diagnostic
660
+ * code `edit.table-merge-not-rectangle`. The merged cell keeps every non-empty cell's content
661
+ * in reading order. Edits to the returned cell can share the sync. A pending cell revision
662
+ * refuses with `NotImplemented`; tracking modes refuse with `NotSupported`, because a merge
663
+ * has no tracked form.
664
+ */
665
+ mergeCells(topRow: number, firstCell: number, bottomRow: number, lastCell: number): TableCell;
775
666
  /** Delete this table and its contents through the canonical document transaction. */
776
667
  delete(): void;
777
668
  protected onLoad(request: ResolvedLoadOptions): void;
@@ -797,7 +688,7 @@ declare class TableRow extends ModelObject implements PromisedItem {
797
688
  /** Stable cell collection for this row. Load `items` and sync before reading. */
798
689
  get cells(): TableCellCollection;
799
690
  }
800
- /** An ordinary table cell. Column width uses points and changes the whole grid column. @public */
691
+ /** A table cell. Column width uses points and changes the whole grid column. @public */
801
692
  declare class TableCell extends ModelObject implements PromisedItem {
802
693
  #private;
803
694
  /** @internal */
@@ -826,6 +717,14 @@ declare class TableCell extends ModelObject implements PromisedItem {
826
717
  /** Top, Center, or Bottom. Mixed is a read state and cannot be assigned. */
827
718
  get verticalAlignment(): VerticalAlignment | 'Top' | 'Center' | 'Bottom' | 'Mixed';
828
719
  set verticalAlignment(value: VerticalAlignment | 'Top' | 'Center' | 'Bottom' | 'Mixed');
720
+ /**
721
+ * Split this cell into `rowCount` rows and `columnCount` columns of equal width. Counts run
722
+ * from 1 to 63. A cell merged over several rows splits only into a divisor of them; a
723
+ * one-row cell adds rows to the table. Counts the cell cannot take, such as columns narrower
724
+ * than the minimum width, refuse with `InvalidArgument` and the diagnostic code
725
+ * `edit.table-split-unsupported`. Tracking modes refuse with `NotSupported`.
726
+ */
727
+ split(rowCount: number, columnCount: number): void;
829
728
  protected onLoad(request: ResolvedLoadOptions): void;
830
729
  }
831
730
  /** A loaded collection of Table objects. @public */
@@ -896,9 +795,8 @@ type SelectionMode = 'Select' | 'Start' | 'End';
896
795
  * enclose. A bookmark whose markers left with the text they surrounded refuses rather than
897
796
  * answering where they used to be.
898
797
  *
899
- * `start`, `end` and `delete` are absent by design: the first two are document-wide character
900
- * offsets, the coordinate space this API does not maintain, and `delete` would have to remove a
901
- * marker pair, which the canonical write path does not offer.
798
+ * `start` and `end` are absent by design: they are document-wide character offsets, the
799
+ * coordinate space this API does not maintain.
902
800
  *
903
801
  * @public
904
802
  */
@@ -931,6 +829,17 @@ declare class Bookmark extends ModelObject implements PromisedItem {
931
829
  * `NotSupported` where there is no reader.
932
830
  */
933
831
  select(selectionMode_?: SelectionMode): void;
832
+ /**
833
+ * Delete this bookmark. The text it marks stays.
834
+ *
835
+ * @example
836
+ * ```ts
837
+ * const bookmark = context.document.body.bookmarks.getFirst();
838
+ * bookmark.delete();
839
+ * await context.sync();
840
+ * ```
841
+ */
842
+ delete(): void;
934
843
  /** @internal Plan the read this object's `load(...)` asked for. */
935
844
  protected onLoad(request: ResolvedLoadOptions): void;
936
845
  }
@@ -955,190 +864,92 @@ declare class BookmarkCollection extends HandleCollection<Bookmark> {
955
864
  protected promised(label: string, nullable: boolean): Bookmark & PromisedItem;
956
865
  }
957
866
 
958
- /**
959
- * What a control's own type accepts as a value.
960
- *
961
- * A discriminated union rather than `unknown`: a dropdown and a checkbox do not take the same
962
- * kind of thing, and a single `setValue(value: string)` would have to guess what `'true'` means
963
- * to a date picker.
964
- */
965
- type ContentControlValue = {
966
- readonly kind: 'text';
967
- readonly text: string;
968
- } | {
969
- readonly kind: 'listItem';
970
- readonly value: string;
971
- } | {
972
- readonly kind: 'checkbox';
973
- readonly checked: boolean;
867
+ /** Office.js underline values. Unsupported runtime modes refuse at sync. @public */
868
+ declare enum UnderlineType {
869
+ mixed = "Mixed",
870
+ none = "None",
871
+ hidden = "Hidden",
872
+ dotLine = "DotLine",
873
+ single = "Single",
874
+ word = "Word",
875
+ double = "Double",
876
+ thick = "Thick",
877
+ dotted = "Dotted",
878
+ dottedHeavy = "DottedHeavy",
879
+ dashLine = "DashLine",
880
+ dashLineHeavy = "DashLineHeavy",
881
+ dashLineLong = "DashLineLong",
882
+ dashLineLongHeavy = "DashLineLongHeavy",
883
+ dotDashLine = "DotDashLine",
884
+ dotDashLineHeavy = "DotDashLineHeavy",
885
+ twoDotDashLine = "TwoDotDashLine",
886
+ twoDotDashLineHeavy = "TwoDotDashLineHeavy",
887
+ wave = "Wave",
888
+ waveHeavy = "WaveHeavy",
889
+ waveDouble = "WaveDouble"
974
890
  }
975
- /** `YYYY-MM-DD`, or a full ISO-8601 instant. */
976
- | {
977
- readonly kind: 'date';
978
- readonly iso: string;
979
- };
980
- /** The lock a control carries. `ST_Lock`, spelled as the schema spells it. */
981
- type ContentControlLockState = 'unlocked' | 'sdtLocked' | 'contentLocked' | 'sdtContentLocked';
982
- /** The control types this API can create. Picture and repeating section are deferred. */
983
- type ContentControlSubtype = 'richText' | 'plainText' | 'dropDownList' | 'comboBox' | 'date';
984
891
  /**
985
- * A part of a document a template marked as a field.
986
- *
987
- * A control is NOT its `w:id`. The attribute is optional in OOXML and unique nowhere, so a
988
- * document may hold one control with no id and two with the same one. This object is addressed by
989
- * an opaque host-minted handle instead, and {@link ContentControl.id} is answered as METADATA — a
990
- * label the file wrote, empty where it wrote none. `getById` still exists, because a template
991
- * author knows their own numbering, and it answers the first match in document order rather than
992
- * refusing.
892
+ * The character formatting of whatever it belongs to: a story, a stretch of one, or a paragraph.
993
893
  *
994
- * A control's contents are not its value. `text` reads the characters; `setValue` writes in the
995
- * vocabulary the control's own type accepts — a declared item for a dropdown, an ISO date for a
996
- * date picker, a state for a checkbox — because writing `"true"` into a checkbox's runs would
997
- * produce a document whose glyph and whose `w14:checked` disagree.
894
+ * A font has no identity of its own — it is a view onto its owner's characters and shares its
895
+ * owner's path, so a font reached from a deleted paragraph's range refuses at the same moment the
896
+ * range does rather than holding a stale address.
998
897
  *
999
- * @public
1000
- */
1001
- declare class ContentControl extends ModelObject implements PromisedItem {
1002
- #private;
1003
- /** @internal A control a read has already named. */
1004
- static at(context: RequestContext, label: string, address: ObjectAddress): ContentControl;
1005
- /** @internal A control a queued read will name, or report as nothing. */
1006
- static promised(context: RequestContext, label: string, nullable: boolean): ContentControl;
1007
- private constructor();
1008
- /** @internal Bind this object to the address the owning read answered. */
1009
- hydrateAddress(address: ObjectAddress): void;
1010
- /** @internal Settle as the null object: the read found nothing to name. */
1011
- hydrateNull(): void;
1012
- /**
1013
- * The `w:id` the file wrote, as a string, and `''` where it wrote none.
1014
- *
1015
- * A STRING and not a number, deliberately. The identity of this object is its handle; a numeric
1016
- * `id` invites a caller to key a map on a value the schema lets a document repeat.
1017
- */
1018
- get id(): string;
1019
- /** `w:tag` — the machine-readable label a template puts on a field. `''` where absent. */
1020
- get tag(): string;
1021
- set tag(value: string);
1022
- /** `w:alias` — what Word's UI calls the control's title. `''` where absent. */
1023
- get title(): string;
1024
- set title(value: string);
1025
- /** What kind of control it is: `plainText`, `dropDownList`, `checkbox`, `date`, … */
1026
- get subtype(): string;
1027
- /**
1028
- * Whether the control currently declares an OOXML data binding.
1029
- *
1030
- * This is advisory preflight for callers choosing controls to write. A document can change
1031
- * after this property is loaded, so the atomic sync-time refusal remains the final authority.
1032
- * Only binding presence is exposed: XPath, namespace mappings, store ids, and custom XML
1033
- * content remain inside the untrusted-document boundary.
1034
- */
1035
- get isBound(): boolean;
1036
- /**
1037
- * Whether the control refuses to be deleted.
1038
- *
1039
- * Reads the lock IN FORCE, so a control an enclosing one protects reports true even when its
1040
- * own `w:lock` says otherwise — that is what the document does, and reporting the control's own
1041
- * half would tell a caller an edit will work when the store is about to refuse it.
1042
- */
1043
- get cannotDelete(): boolean;
1044
- set cannotDelete(value: boolean);
1045
- /** Whether the control's contents refuse to be edited. Resolved like `cannotDelete`. */
1046
- get cannotEdit(): boolean;
1047
- set cannotEdit(value: boolean);
1048
- /**
1049
- * Whether the control is showing its prompt rather than a value (`w:showingPlcHdr`).
1050
- *
1051
- * STATE, not text. A control showing its placeholder holds the prompt in its runs, and the
1052
- * first thing written into it replaces the whole prompt — so a caller that treats `text` as a
1053
- * value must ask this before believing it.
1054
- */
1055
- get placeholderShown(): boolean;
1056
- /** Whether the control removes its own wrapper on the first content edit (`w:temporary`). */
1057
- get temporary(): boolean;
1058
- /** The characters the control encloses, as the document reads them. */
1059
- get text(): string;
1060
- /** The paragraphs the control holds. Empty for an inline control, which holds none. */
1061
- get paragraphs(): ParagraphCollection;
1062
- /** The controls INSIDE this one, in document order. */
1063
- get contentControls(): ContentControlCollection;
1064
- /**
1065
- * The stretch of the story the control's content covers.
1066
- *
1067
- * Read when it is asked for rather than carried by the control, because the content moves as
1068
- * the document is edited: the range a caller gets is where the control is now.
1069
- */
1070
- getRange(rangeLocation?: 'Whole' | 'Start' | 'End' | 'Before' | 'After' | 'Content'): Range;
1071
- /**
1072
- * Write the control's value.
1073
- *
1074
- * The refusals belong to the document, not to this method: a locked control, a control the file
1075
- * bound to custom XML, and a value the control's type does not accept are all refused by the
1076
- * engine's single write path, which is the same path a keystroke takes. {@link isBound} is an
1077
- * advisory preflight only; this sync-time check remains authoritative if the document changed
1078
- * after the flag was loaded.
1079
- */
1080
- setValue(value: ContentControlValue): void;
1081
- /**
1082
- * Put text into the control: over what it holds, or at one end of it.
1083
- * Supports text-like controls. Date, checkbox, and other typed controls refuse with NotSupported.
1084
- *
1085
- * `Replace` goes through the control's own value path, so the prompt it was showing and a
1086
- * `w:temporary` wrapper are dealt with there rather than a second time here. The range comes
1087
- * back from the WRITE and not from a read beside it: reads answer the document as it is when
1088
- * the batch is planned, so a read here would name the text the write was about to replace.
1089
- */
1090
- insertText(text: string, insertLocation: InsertLocation.replace | InsertLocation.start | InsertLocation.end | 'Replace' | 'Start' | 'End'): Range;
1091
- /**
1092
- * Remove the control.
1093
- *
1094
- * `keepContent` true is Word's own "Remove content control": the wrapper goes and the text it
1095
- * held stays exactly where it was. False takes the content with it.
1096
- */
1097
- delete(keepContent: boolean): void;
1098
- /** @internal Plan the read this object's `load(...)` asked for. */
1099
- protected onLoad(request: ResolvedLoadOptions): void;
1100
- }
1101
- /** Where a collection of controls looks: a story, or inside one control. */
1102
- type ContentControlScope = {
1103
- readonly body: AutomationHandle;
1104
- } | {
1105
- readonly contentControl: AutomationHandle;
1106
- };
1107
- /**
1108
- * The content controls of a document, story or range, as of the batch that loaded them.
898
+ * Reading is AGREEMENT, and `null` means "no agreed value": every run the owner covers says bold,
899
+ * or the answer is null. Null is also the answer when nothing in range authors the property at
900
+ * all. Both are one answer on purpose, because this API reads what the document AUTHORS rather
901
+ * than what the style cascade computes — a heading whose bold comes from `styles.xml` reads null.
902
+ * Answering the cascade would let a caller read an inherited value, write it straight back, and
903
+ * silently freeze it into the paragraph as if the author had chosen it.
1109
904
  *
1110
- * `getById` answers the first match in document order, because `w:id` is optional in OOXML and
1111
- * unique nowhere — see {@link ContentControl} for why choosing predictably beats refusing.
905
+ * Assignments within one `sync()` are ONE write: `font.bold = true; font.size = 12` accumulates
906
+ * into a single run-property operation. That is required, not an optimisation — a run-property
907
+ * write carries the run's whole property bag, so a second write planned from the same pre-batch
908
+ * tree would carry a bag the first had already superseded, which the host refuses with
909
+ * `ConflictingChanges`.
1112
910
  *
1113
911
  * @public
1114
912
  */
1115
- declare class ContentControlCollection extends HandleCollection<ContentControl> {
913
+ declare class Font extends ModelObject {
1116
914
  #private;
1117
- /** @internal The controls of a scope, in document order. */
1118
- static of(context: RequestContext, label: string, owner: ObjectPath, scope: ContentControlScope): ContentControlCollection;
915
+ /** @internal The font of the object `owner` addresses. */
916
+ static of(context: RequestContext, label: string, owner: ObjectPath, kind: SpanOwner): Font;
1119
917
  private constructor();
1120
- /** The first control. `ItemNotFound` at the sync if the scope holds none. */
1121
- getFirst(): ContentControl;
1122
- /** The first control, or an object that says `isNullObject` where there is none. */
1123
- getFirstOrNullObject(): ContentControl;
918
+ /** Whether every character agrees it is bold, or `null` where they do not. */
919
+ get bold(): boolean | null;
920
+ set bold(value: boolean);
921
+ /** Whether every run in range is italic. `null` where they disagree or none says. */
922
+ get italic(): boolean | null;
923
+ set italic(value: boolean);
924
+ /** `#RRGGBB`. `null` where the characters disagree, or where the colour is `auto`. */
925
+ get color(): string | null;
926
+ set color(value: string);
927
+ /** The typeface name the characters state, or `null` where they do not agree on one. */
928
+ get name(): string | null;
929
+ set name(value: string);
930
+ /** Points. */
931
+ get size(): number | null;
932
+ set size(value: number);
933
+ /** Office underline styles. Mixed, Hidden, and DotLine refuse at sync. */
934
+ get underline(): string | null;
935
+ set underline(value: UnderlineType | 'Mixed' | 'None' | 'Hidden' | 'DotLine' | 'Single' | 'Word' | 'Double' | 'Thick' | 'Dotted' | 'DottedHeavy' | 'DashLine' | 'DashLineHeavy' | 'DashLineLong' | 'DashLineLongHeavy' | 'DotDashLine' | 'DotDashLineHeavy' | 'TwoDotDashLine' | 'TwoDotDashLineHeavy' | 'Wave' | 'WaveHeavy' | 'WaveDouble');
936
+ /** Exact Word palette color, returned as #RRGGBB. Null clears highlighting. */
937
+ get highlightColor(): string | null;
938
+ set highlightColor(value: string);
939
+ get strikeThrough(): boolean | null;
940
+ set strikeThrough(value: boolean);
941
+ get subscript(): boolean | null;
942
+ set subscript(value: boolean);
943
+ get superscript(): boolean | null;
944
+ set superscript(value: boolean);
1124
945
  /**
1125
- * The first control carrying one `w:id`, or `ItemNotFound` where the scope holds none.
946
+ * One read for every property asked for.
1126
947
  *
1127
- * FIRST in document order, because `w:id` is not unique. The lookup is one read answered by the
1128
- * host: matching it here would mean asking every control for its id and choosing locally, which
1129
- * is a batch whose size depends on how many controls the document has.
948
+ * They all come out of the same runs, so asking for them one at a time would send several
949
+ * operations about the same characters and make a caller's cost depend on how many fields they
950
+ * happened to name.
1130
951
  */
1131
- getById(id: number): ContentControl;
1132
- /** Every control in the scope carrying one tag, in document order. */
1133
- getByTag(tag: string): ContentControlCollection;
1134
- /** Every control in the scope carrying one title, in document order. */
1135
- getByTitle(title: string): ContentControlCollection;
1136
- /** @internal The read that answers this collection's members. */
1137
- protected listing(): AutomationOperation;
1138
- /** @internal Build one member from an address the listing answered. */
1139
- protected itemAt(label: string, address: ObjectAddress): ContentControl;
1140
- /** @internal A member an edge accessor named before the sync that finds it. */
1141
- protected promised(label: string, nullable: boolean): ContentControl & PromisedItem;
952
+ protected onLoad(request: ResolvedLoadOptions): void;
1142
953
  }
1143
954
 
1144
955
  /**
@@ -1292,7 +1103,12 @@ declare class Comment extends CommentBase {
1292
1103
  *
1293
1104
  * The author is the one the request context was opened with: a reply records who wrote it, and
1294
1105
  * `CT_TrackChange` makes that mandatory, so a context with no author refuses here rather than
1295
- * writing an anonymous remark the file cannot represent.
1106
+ * writing an anonymous remark the file cannot represent. The refusal is `NotSupported` with
1107
+ * `debugInfo.innerError.code` `edit.comment-author-required`.
1108
+ *
1109
+ * In a React or Vue host with the review module, use `useReview().reply` from
1110
+ * `@docx-editor.dev/pro/react` or `@docx-editor.dev/pro/vue` instead. It replies as the
1111
+ * editor's author.
1296
1112
  */
1297
1113
  reply(replyText: string): CommentReply;
1298
1114
  /** @internal Plan the read this object's `load(...)` asked for. */
@@ -1345,9 +1161,20 @@ declare class Revision extends ModelObject implements PromisedItem {
1345
1161
  get type(): RevisionType;
1346
1162
  /** The words the change covers. */
1347
1163
  get range(): Range;
1348
- /** Keep the change, resolving every site that carries its identity in one transaction. */
1164
+ /**
1165
+ * Keep the change, resolving every site that carries its identity in one transaction.
1166
+ *
1167
+ * In a React or Vue host with the review module, use `useReview().accept` from
1168
+ * `@docx-editor.dev/pro/react` or `@docx-editor.dev/pro/vue` for a review UI.
1169
+ *
1170
+ * @see {@link https://www.docx-editor.dev/docs/2.x/recipes/accept-reject-without-scrolling | Accept or reject without scrolling}
1171
+ */
1349
1172
  accept(): void;
1350
- /** Undo the change, likewise in one transaction. */
1173
+ /**
1174
+ * Undo the change, likewise in one transaction.
1175
+ *
1176
+ * In a React or Vue host with the review module, use `useReview().reject` for a review UI.
1177
+ */
1351
1178
  reject(): void;
1352
1179
  /** @internal Plan the read this object's `load(...)` asked for. */
1353
1180
  protected onLoad(request: ResolvedLoadOptions): void;
@@ -1376,8 +1203,11 @@ interface RevisionAuthorOptions {
1376
1203
  * The tracked changes on a document, story or range, as of the batch that loaded them.
1377
1204
  *
1378
1205
  * `items` omits structural cards whose Word subtype this API cannot name; see {@link Revision}.
1379
- * Collection-wide `acceptAll` / `rejectAll` still resolve every store-resolvable revision in this
1380
- * story and refuse atomically if any `readOnly` or otherwise unsupported revision remains.
1206
+ * On a story's collection, `acceptAll` / `rejectAll` still resolve every store-resolvable
1207
+ * revision in the story and refuse atomically if any `readOnly` or otherwise unsupported
1208
+ * revision remains. On {@link Range.revisions} and `getReviewItemRevisions`, they resolve the
1209
+ * changes the range overlaps or the key names, and `resolve` and `setAuthor` refuse with
1210
+ * `NotSupported`.
1381
1211
  *
1382
1212
  * @public
1383
1213
  */
@@ -1385,6 +1215,10 @@ declare class RevisionCollection extends HandleCollection<Revision> {
1385
1215
  #private;
1386
1216
  /** @internal The pending decisions of one story. */
1387
1217
  static of(context: RequestContext, label: string, owner: ObjectPath, body: AutomationHandle): RevisionCollection;
1218
+ /** @internal The pending decisions a range overlaps, read from the range at plan time. */
1219
+ static inSpan(context: RequestContext, label: string, owner: ObjectPath, span: () => AutomationSpanRef): RevisionCollection;
1220
+ /** @internal The pending decisions one review-queue key names. */
1221
+ static ofReviewKey(context: RequestContext, label: string, owner: ObjectPath, key: string): RevisionCollection;
1388
1222
  private constructor();
1389
1223
  /**
1390
1224
  * Keep every change in this story, as ONE decision and one undo unit.
@@ -1393,6 +1227,14 @@ declare class RevisionCollection extends HandleCollection<Revision> {
1393
1227
  * omitted from `items`. Refuses the sync outright where any `readOnly` or otherwise
1394
1228
  * unsupported revision remains, rather than reporting the story as reviewed while pending
1395
1229
  * changes remain.
1230
+ *
1231
+ * On a collection from {@link Range.revisions}, resolves every change the range overlaps at
1232
+ * sync time, structural changes absent from `items` included. A change the range covers in
1233
+ * part resolves whole, characters outside the range included. On a collection from
1234
+ * `getReviewItemRevisions`, resolves the changes the key names, and refuses with
1235
+ * `InvalidObjectPath` when the key names nothing. Either way, the sync refuses whole when one
1236
+ * of the changes is read-only or cannot be resolved, and a change that an earlier decision in
1237
+ * the same sync resolved the same way is skipped.
1396
1238
  */
1397
1239
  acceptAll(): void;
1398
1240
  /** Undo every change, likewise as one decision. */
@@ -1403,6 +1245,8 @@ declare class RevisionCollection extends HandleCollection<Revision> {
1403
1245
  * Pass an empty array to select nothing. Duplicate objects resolve once; stale targets
1404
1246
  * are reported as unknown-revision. This must be the only write in its sync batch.
1405
1247
  * Unlike acceptAll/rejectAll, unsupported decisions do not block independent changes.
1248
+ * A collection from `Range.revisions` or `getReviewItemRevisions` refuses this call with
1249
+ * `NotSupported`.
1406
1250
  *
1407
1251
  * @example
1408
1252
  * ```ts
@@ -1421,6 +1265,8 @@ declare class RevisionCollection extends HandleCollection<Revision> {
1421
1265
  * author, including structural ones absent from `items`. An empty array selects nothing.
1422
1266
  * Each change keeps its date unless you pass `options.date`. Keep this the only write in
1423
1267
  * its sync batch. Revision objects you pass stay valid and read the new author after a load.
1268
+ * A collection from `Range.revisions` or `getReviewItemRevisions` refuses this call with
1269
+ * `NotSupported`.
1424
1270
  *
1425
1271
  * @example
1426
1272
  * ```ts
@@ -1492,6 +1338,8 @@ declare class Range extends ModelObject implements PromisedItem {
1492
1338
  static at(context: RequestContext, label: string, address: ObjectAddress): Range;
1493
1339
  /** @internal A range a queued operation will name, or report as nothing. */
1494
1340
  static promised(context: RequestContext, label: string, nullable: boolean): Range;
1341
+ /** @internal The cached result of the field `field` names. */
1342
+ static ofFieldResult(context: RequestContext, label: string, field: ObjectPath): Range;
1495
1343
  private constructor();
1496
1344
  /** @internal Bind this object to the address the owning read answered. */
1497
1345
  hydrateAddress(address: ObjectAddress): void;
@@ -1532,25 +1380,197 @@ declare class Range extends ModelObject implements PromisedItem {
1532
1380
  */
1533
1381
  get hyperlink(): string;
1534
1382
  set hyperlink(value: string);
1535
- /** The bookmarks whose text this range overlaps, in document order. */
1536
- get bookmarks(): BookmarkCollection;
1537
- /** Every occurrence of `searchText` inside this range, as ranges. */
1538
- search(searchText: string, options?: SearchOptions): RangeCollection;
1539
1383
  /**
1540
- * Write text at or over this range. Answers the range the written text occupies.
1384
+ * The content controls this range overlaps, in document order, at any nesting depth.
1385
+ *
1386
+ * A control counts when it shares at least one character with the range, and a control that
1387
+ * holds the whole range counts too, so a word range inside a locked control reports that
1388
+ * control. A block control counts when it holds one of the range's paragraphs. Load
1389
+ * `items/cannotEdit`, `items/tag`, and `items/text` to learn what an edit through the range
1390
+ * would touch.
1391
+ *
1392
+ * @example
1393
+ * ```ts
1394
+ * const controls = range.contentControls;
1395
+ * controls.load('items/cannotEdit,items/tag');
1396
+ * await context.sync();
1397
+ * ```
1398
+ */
1399
+ get contentControls(): ContentControlCollection;
1400
+ /** The bookmarks whose text this range overlaps, in document order. */
1401
+ get bookmarks(): BookmarkCollection;
1402
+ /**
1403
+ * Add a bookmark around this range, or at its position when the range is empty.
1404
+ *
1405
+ * Names compare without case and are unique in the whole document. A bookmark with the same
1406
+ * name moves here, also from another story (a header, a footer, or a note), in the same sync.
1407
+ * A name starts with a letter, or with an underscore for a hidden bookmark, holds only
1408
+ * letters, digits and underscores, and has at most 40 characters. Any other name fails
1409
+ * `context.sync()` with `InvalidArgument`, and nothing in that batch is written. Bookmarks are
1410
+ * not revisions, so with `TrackMineOnly` the markers are written directly.
1411
+ *
1412
+ * @example
1413
+ * ```ts
1414
+ * const range = context.document.body.paragraphs.getFirst().getRange();
1415
+ * range.insertBookmark('Intro');
1416
+ * await context.sync();
1417
+ * ```
1418
+ */
1419
+ insertBookmark(name: string): void;
1420
+ /**
1421
+ * The names of the bookmarks in or overlapping this range, in document order.
1422
+ *
1423
+ * A range holds a bookmark when the two share text, and a point bookmark when the point is
1424
+ * inside the range or at its start. An empty range holds the bookmarks around it. Pass
1425
+ * `includeAdjacent` to add bookmarks that only touch the range at one end, and
1426
+ * `includeHidden` to add hidden bookmarks, whose names start with an underscore.
1427
+ *
1428
+ * @example
1429
+ * ```ts
1430
+ * const names = range.getBookmarks(true, false);
1431
+ * await context.sync();
1432
+ * console.log(names.value);
1433
+ * ```
1434
+ */
1435
+ getBookmarks(includeHidden?: boolean, includeAdjacent?: boolean): ClientResult<string[]>;
1436
+ /**
1437
+ * The tracked changes whose characters this range overlaps, in document order.
1438
+ *
1439
+ * Lists the same `Revision` objects the story's collection lists, so a change reached here is
1440
+ * the one `body.revisions` holds. A collapsed range lists the changes it touches. A paragraph
1441
+ * mark change is listed only when the range continues into the next paragraph, so reach the
1442
+ * mark change of a whole paragraph through `body.revisions`. Membership
1443
+ * uses document positions, so the runtime's `revisionTextView` changes what `text` reads, not
1444
+ * which changes are listed. A change partly inside the range is listed whole. A replacement
1445
+ * stored as a deletion followed by an insertion lists as two members.
1446
+ *
1447
+ * On this collection, `acceptAll()` and `rejectAll()` resolve every change the range overlaps,
1448
+ * structural changes absent from `items` included, and a partly covered change resolves whole.
1449
+ * They refuse the whole sync when one of those changes is read-only or cannot be resolved.
1450
+ * `resolve()` and `setAuthor()` refuse with `NotSupported`; use the story's collection.
1451
+ *
1452
+ * A range can overlap changes nobody meant to decide: a change nested inside another, or one
1453
+ * by another author beside it. To decide the change a review card shows, use
1454
+ * `getReviewItemRevisions`.
1455
+ *
1456
+ * @example Accept every change in a search result
1457
+ * ```ts
1458
+ * const matches = context.document.body.search('indemnify');
1459
+ * matches.load('items');
1460
+ * await context.sync();
1461
+ *
1462
+ * for (const match of matches.items) match.revisions.acceptAll();
1463
+ * await context.sync();
1464
+ * ```
1465
+ */
1466
+ get revisions(): RevisionCollection;
1467
+ /** Every occurrence of `searchText` inside this range, as ranges. */
1468
+ search(searchText: string, options?: SearchOptions): RangeCollection;
1469
+ /**
1470
+ * Split this range into ranges that each end after one of `endingMarks`, such as `[' ']` for
1471
+ * words or `['.', '!', '?']` for sentences. A paragraph end always ends a range.
1472
+ *
1473
+ * Each range is an exact span of the document, so you can use it as an edit target in a later
1474
+ * sync: `insertText(text, 'Replace')`, `insertText(text, 'After')`, or `delete()`, also with
1475
+ * change tracking on. By default each range keeps the spacing after it, so a deleted word
1476
+ * takes its space with it; plan edits on those ranges by index. Pass `trimSpacing` as `true`
1477
+ * to remove spaces, tabs, and column breaks from the start and end of each range, for reading
1478
+ * words; a range that holds only spacing is then left out.
1479
+ *
1480
+ * A field, an equation, a picture, or a note reference is one character of the range and is
1481
+ * never split, so it joins the word it touches. A field reads as its result text; an equation,
1482
+ * a picture, and a note reference read as U+FFFC. A tab ends a range only when you list `'\t'`
1483
+ * as a mark. An inline content control adds no boundary, so its words join the ranges around
1484
+ * it; an edit of part of a content-locked control refuses with `edit.protected-content`. Pass at most 32 marks of at most 32
1485
+ * UTF-16 code units each, with no unpaired surrogate; other values refuse with
1486
+ * `InvalidArgument`.
1487
+ *
1488
+ * Ranges follow the runtime's `revisionTextView`. Hidden text, such as a pending insertion in
1489
+ * the `original` view, holds no mark, and each range starts and ends at shown characters.
1490
+ * Hidden text between two shown characters stays inside the range, so an edit through it
1491
+ * also changes that text. Read ranges once, before you edit: after tracked edits, a range can
1492
+ * join deleted and inserted text, and an edit that touches your own pending change refuses
1493
+ * with `edit.tracked-own-pending-change`. Read the result with `getReviewedText('Current')`.
1494
+ *
1495
+ * @example
1496
+ * ```ts
1497
+ * const words = paragraph.getTextRanges([' '], true);
1498
+ * words.load('items/text');
1499
+ * await context.sync();
1500
+ * ```
1501
+ */
1502
+ getTextRanges(endingMarks: string[], trimSpacing?: boolean): RangeCollection;
1503
+ /**
1504
+ * A new range from the start of whichever range starts first to the end of whichever ends
1505
+ * last. This range does not change.
1506
+ *
1507
+ * Use it to address a run of words from {@link Range.getTextRanges}: expand the first word to
1508
+ * the last, then replace the result. Both ranges must be in the same story, such as the body
1509
+ * or one header; ranges in different stories refuse the sync with `InvalidArgument`. A range
1510
+ * that spans paragraphs follows the same `StaleDocument` rule as `Body.getRange`.
1511
+ */
1512
+ expandTo(range: Range): Range;
1513
+ /**
1514
+ * The whole range, its content, or one of its endpoints, as a range. The default is `Whole`.
1515
+ *
1516
+ * `Whole` and `Content` answer the same span. `Start` and `End` answer a collapsed range at
1517
+ * that endpoint, for an insertion point. `After` refuses with `NotSupported`, because a range
1518
+ * here never owns the position after its end. A text write can use the returned range in the
1519
+ * same sync; sync before you load it.
1520
+ */
1521
+ getRange(rangeLocation?: RangeLocation.whole | RangeLocation.start | RangeLocation.end | RangeLocation.after | RangeLocation.content | 'Whole' | 'Start' | 'End' | 'After' | 'Content'): Range;
1522
+ /**
1523
+ * This range's text as if every pending tracked change were accepted (`Current`, the default)
1524
+ * or rejected (`Original`). The document does not change.
1525
+ *
1526
+ * Use it to read back a proposed rewrite between syncs: after tracked edits, `text` reads both
1527
+ * the deleted and the inserted words, while `getReviewedText('Current')` reads only the
1528
+ * result. A paragraph mark reads as `\r` when that version keeps it. Fields read as their
1529
+ * displayed results, like `text`. Formatting changes do not change the text.
1530
+ */
1531
+ getReviewedText(changeTrackingVersion?: ChangeTrackingVersion): ClientResult<string>;
1532
+ /**
1533
+ * This range's text as if every pending tracked change were accepted (`Current`, the default)
1534
+ * or rejected (`Original`). The document does not change.
1535
+ */
1536
+ getReviewedText(changeTrackingVersion?: 'Original' | 'Current'): ClientResult<string>;
1537
+ /**
1538
+ * Write text at or over this range. Answers the range the written text occupies.
1541
1539
  * Await `context.sync()` before loading or addressing that returned range.
1542
1540
  *
1543
1541
  * With server `document.changeTrackingMode = 'TrackMineOnly'`, this creates a tracked text
1544
1542
  * edit attributed to the runtime author. Tracked range replacement supports adjacent sibling paragraphs outside collaboration.
1545
- * Table and wrapper boundaries and foreign pending revisions refuse. Font and paragraph
1546
- * formatting support property revisions.
1543
+ * Table and wrapper boundaries refuse. Edits can go inside or beside another author's pending
1544
+ * text insertion or deletion: a deletion of their inserted text nests inside their insertion,
1545
+ * new text inside their insertion splits it in two, and the returned range names the new text
1546
+ * after any deleted text. Each author's change stays a separate decision. These refuse with
1547
+ * `NotImplemented`, and `debugInfo.innerError.code` names the rule: a range of only deleted
1548
+ * text (`edit.tracked-deleted-text-only`); another author's paragraph mark, formatting, move, or
1549
+ * structural change, or a link or content control inside their insertion
1550
+ * (`edit.tracked-foreign-revision-unsupported`); and your own pending change, including a
1551
+ * range a tracked write returned (`edit.tracked-own-pending-change`). The same edits work in
1552
+ * a collaboration session. Font and paragraph formatting support property revisions.
1547
1553
  * Empty text with `Replace` deletes the range; empty text at an insertion point is a no-op.
1548
1554
  * Agent tools that intend a replacement should validate non-empty model output first.
1549
1555
  *
1556
+ * `\n`, `\r`, and `\r\n` in `text` are paragraph breaks: the text after one starts a new
1557
+ * paragraph with the properties of the paragraph it was written into. With `TrackMineOnly`,
1558
+ * each new paragraph mark is a tracked insertion, and rejecting it joins the paragraphs again.
1559
+ * The answered range then ends after the last segment, in the last new paragraph. Text that
1560
+ * lands inside an inline content control refuses with `NotSupported`
1561
+ * (`edit.indivisible-content`), and a write with a break cannot share a sync with another
1562
+ * text edit in the same paragraph. `\v` is a manual line break.
1563
+ *
1550
1564
  * `Before`/`Start` and `After`/`End` land at the SAME position here, and the difference Word
1551
1565
  * draws between them — whether the new text becomes part of this range — has no meaning for a
1552
1566
  * snapshot. Both pairs are accepted because source-compatible code uses all four; what a caller
1553
1567
  * gets back is a range naming the text that was written, in every case.
1568
+ *
1569
+ * In a React or Vue host, replace a found match in the editor itself with
1570
+ * `editor.exec({ type: 'replaceMatch', match, text })` on a match from `editor.findMatches`.
1571
+ * In suggesting mode it records a tracked replacement as the editor's author.
1572
+ *
1573
+ * @see {@link https://www.docx-editor.dev/docs/2.x/recipes/tracked-replacement | Replace as a tracked change}
1554
1574
  */
1555
1575
  insertText(text: string, insertLocation: InsertLocation | 'Replace' | 'Start' | 'End' | 'Before' | 'After'): Range;
1556
1576
  /**
@@ -1570,7 +1590,14 @@ declare class Range extends ModelObject implements PromisedItem {
1570
1590
  *
1571
1591
  * The author is the identity the runtime was opened with. Empty comment text, a missing author,
1572
1592
  * stale endpoints, and ranges crossing a table-cell boundary are refused rather than authored
1573
- * approximately. A collapsed range creates an insertion-point comment.
1593
+ * approximately. A collapsed range creates an insertion-point comment. A missing author refuses
1594
+ * with `NotSupported` and `debugInfo.innerError.code` `edit.comment-author-required`.
1595
+ *
1596
+ * In a React or Vue host with the review module, use `useReview().comment` from
1597
+ * `@docx-editor.dev/pro/react` or `@docx-editor.dev/pro/vue` instead. It comments on the
1598
+ * editor's selection as the editor's author.
1599
+ *
1600
+ * @see {@link https://www.docx-editor.dev/docs/2.x/recipes/comment-on-found-text | Comment on found text}
1574
1601
  */
1575
1602
  insertComment(commentText: string): Comment;
1576
1603
  /**
@@ -1585,18 +1612,40 @@ declare class Range extends ModelObject implements PromisedItem {
1585
1612
  /** Fields fully contained within this range. */
1586
1613
  get fields(): FieldCollection;
1587
1614
  /**
1588
- * Insert PAGE, NUMPAGES, or an inert TOC field with supported switches.
1589
- * TOC entries are not calculated. Tracked field insertion refuses.
1615
+ * Insert an inert field: Page, NumPages, Ref, PageRef, NoteRef, Seq, StyleRef, Date, Time,
1616
+ * Empty with a whole instruction of one of those types, or TOC with supported switches.
1617
+ * `text` holds the field arguments. The instruction is never evaluated, and the cached
1618
+ * result is empty. Fields that fetch, embed, link, run, or prompt refuse with
1619
+ * `InvalidArgument` (`edit.field-unsupported`). With `TrackMineOnly`, the field is one tracked
1620
+ * insertion; tracked TOC creation refuses.
1590
1621
  */
1591
1622
  insertField(insertLocation: InsertLocation | 'Before' | 'After' | 'Start' | 'End' | 'Replace', fieldType?: FieldType, text?: string, removeFormatting?: boolean): Field;
1592
1623
  /**
1593
- * Insert PAGE, NUMPAGES, or an inert TOC field with supported switches.
1594
- * TOC entries are not calculated. Tracked field insertion refuses.
1624
+ * Insert an inert field: Page, NumPages, Ref, PageRef, NoteRef, Seq, StyleRef, Date, Time,
1625
+ * Empty with a whole instruction of one of those types, or TOC with supported switches.
1626
+ * `text` holds the field arguments. The instruction is never evaluated, and the cached
1627
+ * result is empty. Fields that fetch, embed, link, run, or prompt refuse with
1628
+ * `InvalidArgument` (`edit.field-unsupported`). With `TrackMineOnly`, the field is one tracked
1629
+ * insertion; tracked TOC creation refuses.
1595
1630
  */
1596
1631
  insertField(insertLocation: InsertLocation | 'Before' | 'After' | 'Start' | 'End' | 'Replace', fieldType?: FieldTypeLiteral, text?: string, removeFormatting?: boolean): Field;
1632
+ /**
1633
+ * Insert one equation from OOXML: a Flat OPC package (`pkg:package`) whose document part holds
1634
+ * one paragraph with exactly one inline `m:oMath` and, around it, plain runs. Other OOXML
1635
+ * refuses with `NotSupported` or `InvalidArgument` and `edit.ooxml-unsupported`, and nothing is
1636
+ * inserted. With `TrackMineOnly`, the equation is one tracked insertion. Returns the range the
1637
+ * inserted content occupies.
1638
+ */
1639
+ insertOoxml(ooxml: string, insertLocation: InsertLocation | 'Replace' | 'Start' | 'End' | 'Before' | 'After'): Range;
1597
1640
  /** Inline pictures fully contained within this snapshot range. */
1598
1641
  get inlinePictures(): InlinePictureCollection;
1599
- /** Insert a bounded PNG/JPEG image. Sync before configuring the returned picture. */
1642
+ /**
1643
+ * Insert a bounded PNG/JPEG image. Sync before configuring the returned picture.
1644
+ *
1645
+ * Works on server, browser, and collaborative runtimes; on a collaborative runtime the
1646
+ * picture, its media part, and its relationship replicate to every participant. Insertion
1647
+ * must be the only mutation in its sync, and tracking refuses it.
1648
+ */
1600
1649
  insertInlinePictureFromBase64(base64EncodedImage: string, insertLocation: InsertLocation | 'Before' | 'After' | 'Start' | 'End' | 'Replace'): InlinePicture;
1601
1650
  /**
1602
1651
  * Line, page, and next-page section breaks are supported; other break types refuse at sync.
@@ -1609,22 +1658,337 @@ declare class Range extends ModelObject implements PromisedItem {
1609
1658
  * TrackMineOnly records native row/cell insertions, including initial values.
1610
1659
  * Sync before configuring the returned table. Nested table authoring refuses.
1611
1660
  */
1612
- insertTable(rowCount: number, columnCount: number, insertLocation: InsertLocation.before | InsertLocation.after | 'Before' | 'After', values?: string[][]): Table;
1613
- /** Add a paragraph before or after the one this range starts or ends in. */
1614
- insertParagraph(paragraphText: string, insertLocation: InsertLocation.before | InsertLocation.after | 'Before' | 'After'): Paragraph;
1661
+ insertTable(rowCount: number, columnCount: number, insertLocation: InsertLocation.before | InsertLocation.after | 'Before' | 'After', values?: string[][]): Table;
1662
+ /** Add a paragraph before or after the one this range starts or ends in. */
1663
+ insertParagraph(paragraphText: string, insertLocation: InsertLocation.before | InsertLocation.after | 'Before' | 'After'): Paragraph;
1664
+ /**
1665
+ * Put the reader's selection on this range and navigate the editor viewport to it.
1666
+ *
1667
+ * The whole range is selected by default. `Start` and `End` instead collapse the caret to that
1668
+ * endpoint and reveal it. An already-visible endpoint stays still; an offscreen one is brought
1669
+ * into view from the editor's layout, including when its page has not been materialized yet.
1670
+ *
1671
+ * Refused with `NotSupported` where there is no reader — a document opened from bytes on a
1672
+ * server has no caret or viewport, and moving one would be a claim about a screen nobody is
1673
+ * looking at. The check is at the CALL rather than at the sync, so the mistake is reported where
1674
+ * it was made.
1675
+ */
1676
+ select(selectionMode_?: SelectionMode): void;
1677
+ /** @internal Plan the read this object's `load(...)` asked for. */
1678
+ protected onLoad(request: ResolvedLoadOptions): void;
1679
+ }
1680
+
1681
+ /**
1682
+ * What a control's own type accepts as a value.
1683
+ *
1684
+ * A discriminated union rather than `unknown`: a dropdown and a checkbox do not take the same
1685
+ * kind of thing, and a single `setValue(value: string)` would have to guess what `'true'` means
1686
+ * to a date picker.
1687
+ */
1688
+ type ContentControlValue = {
1689
+ readonly kind: 'text';
1690
+ readonly text: string;
1691
+ } | {
1692
+ readonly kind: 'listItem';
1693
+ readonly value: string;
1694
+ } | {
1695
+ readonly kind: 'checkbox';
1696
+ readonly checked: boolean;
1697
+ }
1698
+ /** `YYYY-MM-DD`, or a full ISO-8601 instant. */
1699
+ | {
1700
+ readonly kind: 'date';
1701
+ readonly iso: string;
1702
+ };
1703
+ /** The lock a control carries. `ST_Lock`, spelled as the schema spells it. */
1704
+ type ContentControlLockState = 'unlocked' | 'sdtLocked' | 'contentLocked' | 'sdtContentLocked';
1705
+ /** The control types this API can create. Picture and repeating section are deferred. */
1706
+ type ContentControlSubtype = 'richText' | 'plainText' | 'dropDownList' | 'comboBox' | 'date';
1707
+ /**
1708
+ * A part of a document a template marked as a field.
1709
+ *
1710
+ * A control is NOT its `w:id`. The attribute is optional in OOXML and unique nowhere, so a
1711
+ * document may hold one control with no id and two with the same one. This object is addressed by
1712
+ * an opaque host-minted handle instead, and {@link ContentControl.id} is answered as METADATA — a
1713
+ * label the file wrote, empty where it wrote none. `getById` still exists, because a template
1714
+ * author knows their own numbering, and it answers the first match in document order rather than
1715
+ * refusing.
1716
+ *
1717
+ * A control's contents are not its value. `text` reads the characters; `setValue` writes in the
1718
+ * vocabulary the control's own type accepts — a declared item for a dropdown, an ISO date for a
1719
+ * date picker, a state for a checkbox — because writing `"true"` into a checkbox's runs would
1720
+ * produce a document whose glyph and whose `w14:checked` disagree.
1721
+ *
1722
+ * @public
1723
+ */
1724
+ declare class ContentControl extends ModelObject implements PromisedItem {
1725
+ #private;
1726
+ /** @internal A control a read has already named. */
1727
+ static at(context: RequestContext, label: string, address: ObjectAddress): ContentControl;
1728
+ /** @internal A control a queued read will name, or report as nothing. */
1729
+ static promised(context: RequestContext, label: string, nullable: boolean): ContentControl;
1730
+ private constructor();
1731
+ /** @internal Bind this object to the address the owning read answered. */
1732
+ hydrateAddress(address: ObjectAddress): void;
1733
+ /** @internal Settle as the null object: the read found nothing to name. */
1734
+ hydrateNull(): void;
1735
+ /**
1736
+ * The `w:id` the file wrote, as a string, and `''` where it wrote none.
1737
+ *
1738
+ * A STRING and not a number, deliberately. The identity of this object is its handle; a numeric
1739
+ * `id` invites a caller to key a map on a value the schema lets a document repeat.
1740
+ */
1741
+ get id(): string;
1742
+ /** `w:tag` — the machine-readable label a template puts on a field. `''` where absent. */
1743
+ get tag(): string;
1744
+ set tag(value: string);
1745
+ /** `w:alias` — what Word's UI calls the control's title. `''` where absent. */
1746
+ get title(): string;
1747
+ set title(value: string);
1748
+ /** What kind of control it is: `plainText`, `dropDownList`, `checkbox`, `date`, … */
1749
+ get subtype(): string;
1750
+ /**
1751
+ * Whether the control currently declares an OOXML data binding.
1752
+ *
1753
+ * This is advisory preflight for callers choosing controls to write. A document can change
1754
+ * after this property is loaded, so the atomic sync-time refusal remains the final authority.
1755
+ * Only binding presence is exposed: XPath, namespace mappings, store ids, and custom XML
1756
+ * content remain inside the untrusted-document boundary.
1757
+ */
1758
+ get isBound(): boolean;
1759
+ /**
1760
+ * Whether the control refuses to be deleted.
1761
+ *
1762
+ * Reads the lock IN FORCE, so a control an enclosing one protects reports true even when its
1763
+ * own `w:lock` says otherwise — that is what the document does, and reporting the control's own
1764
+ * half would tell a caller an edit will work when the store is about to refuse it.
1765
+ */
1766
+ get cannotDelete(): boolean;
1767
+ set cannotDelete(value: boolean);
1768
+ /** Whether the control's contents refuse to be edited. Resolved like `cannotDelete`. */
1769
+ get cannotEdit(): boolean;
1770
+ set cannotEdit(value: boolean);
1771
+ /**
1772
+ * Whether the control is showing its prompt rather than a value (`w:showingPlcHdr`).
1773
+ *
1774
+ * STATE, not text. A control showing its placeholder holds the prompt in its runs, and the
1775
+ * first thing written into it replaces the whole prompt — so a caller that treats `text` as a
1776
+ * value must ask this before believing it.
1777
+ */
1778
+ get placeholderShown(): boolean;
1779
+ /** Whether the control removes its own wrapper on the first content edit (`w:temporary`). */
1780
+ get temporary(): boolean;
1781
+ /** The characters the control encloses, as the document reads them. */
1782
+ get text(): string;
1783
+ /** The paragraphs the control holds. Empty for an inline control, which holds none. */
1784
+ get paragraphs(): ParagraphCollection;
1785
+ /** The controls INSIDE this one, in document order. */
1786
+ get contentControls(): ContentControlCollection;
1787
+ /**
1788
+ * The stretch of the story the control's content covers.
1789
+ *
1790
+ * Read when it is asked for rather than carried by the control, because the content moves as
1791
+ * the document is edited: the range a caller gets is where the control is now.
1792
+ */
1793
+ getRange(rangeLocation?: 'Whole' | 'Start' | 'End' | 'Before' | 'After' | 'Content'): Range;
1794
+ /**
1795
+ * Write the control's value.
1796
+ *
1797
+ * The refusals belong to the document, not to this method: a locked control, a control the file
1798
+ * bound to custom XML, and a value the control's type does not accept are all refused by the
1799
+ * engine's single write path, which is the same path a keystroke takes. {@link isBound} is an
1800
+ * advisory preflight only; this sync-time check remains authoritative if the document changed
1801
+ * after the flag was loaded.
1802
+ */
1803
+ setValue(value: ContentControlValue): void;
1804
+ /**
1805
+ * Put text into the control: over what it holds, or at one end of it.
1806
+ * Supports text-like controls. Date, checkbox, and other typed controls refuse with NotSupported.
1807
+ *
1808
+ * `Replace` goes through the control's own value path, so the prompt it was showing and a
1809
+ * `w:temporary` wrapper are dealt with there rather than a second time here. The range comes
1810
+ * back from the WRITE and not from a read beside it: reads answer the document as it is when
1811
+ * the batch is planned, so a read here would name the text the write was about to replace.
1812
+ */
1813
+ insertText(text: string, insertLocation: InsertLocation.replace | InsertLocation.start | InsertLocation.end | 'Replace' | 'Start' | 'End'): Range;
1814
+ /**
1815
+ * Remove the control.
1816
+ *
1817
+ * `keepContent` true is Word's own "Remove content control": the wrapper goes and the text it
1818
+ * held stays exactly where it was. False takes the content with it.
1819
+ */
1820
+ delete(keepContent: boolean): void;
1821
+ /** @internal Plan the read this object's `load(...)` asked for. */
1822
+ protected onLoad(request: ResolvedLoadOptions): void;
1823
+ }
1824
+ /** Where a collection of controls looks: a story, or inside one control. */
1825
+ type ScopeValue = {
1826
+ readonly body: AutomationHandle;
1827
+ } | {
1828
+ readonly contentControl: AutomationHandle;
1829
+ } | {
1830
+ readonly span: AutomationSpanRef;
1831
+ };
1832
+ /** A scope now, or one a range or paragraph names when the batch is planned. */
1833
+ type ContentControlScope = ScopeValue | (() => ScopeValue);
1834
+ /**
1835
+ * The content controls of a document, story or range, as of the batch that loaded them.
1836
+ *
1837
+ * `getById` answers the first match in document order, because `w:id` is optional in OOXML and
1838
+ * unique nowhere — see {@link ContentControl} for why choosing predictably beats refusing.
1839
+ *
1840
+ * @public
1841
+ */
1842
+ declare class ContentControlCollection extends HandleCollection<ContentControl> {
1843
+ #private;
1844
+ /** @internal The controls of a scope, in document order. */
1845
+ static of(context: RequestContext, label: string, owner: ObjectPath, scope: ContentControlScope): ContentControlCollection;
1846
+ private constructor();
1847
+ /** The first control. `ItemNotFound` at the sync if the scope holds none. */
1848
+ getFirst(): ContentControl;
1849
+ /** The first control, or an object that says `isNullObject` where there is none. */
1850
+ getFirstOrNullObject(): ContentControl;
1851
+ /**
1852
+ * The first control carrying one `w:id`, or `ItemNotFound` where the scope holds none.
1853
+ *
1854
+ * FIRST in document order, because `w:id` is not unique. The lookup is one read answered by the
1855
+ * host: matching it here would mean asking every control for its id and choosing locally, which
1856
+ * is a batch whose size depends on how many controls the document has.
1857
+ */
1858
+ getById(id: number): ContentControl;
1859
+ /** Every control in the scope carrying one tag, in document order. */
1860
+ getByTag(tag: string): ContentControlCollection;
1861
+ /** Every control in the scope carrying one title, in document order. */
1862
+ getByTitle(title: string): ContentControlCollection;
1863
+ /** @internal The read that answers this collection's members. */
1864
+ protected listing(): AutomationOperation;
1865
+ /** @internal Build one member from an address the listing answered. */
1866
+ protected itemAt(label: string, address: ObjectAddress): ContentControl;
1867
+ /** @internal A member an edge accessor named before the sync that finds it. */
1868
+ protected promised(label: string, nullable: boolean): ContentControl & PromisedItem;
1869
+ }
1870
+
1871
+ /** Supported Word bullet styles. @public */
1872
+ declare enum ListBullet {
1873
+ custom = "Custom",
1874
+ solid = "Solid",
1875
+ hollow = "Hollow",
1876
+ square = "Square",
1877
+ diamonds = "Diamonds",
1878
+ arrow = "Arrow",
1879
+ checkmark = "Checkmark"
1880
+ }
1881
+ /** Supported Word numbering styles. @public */
1882
+ declare enum ListNumbering {
1883
+ none = "None",
1884
+ arabic = "Arabic",
1885
+ upperRoman = "UpperRoman",
1886
+ lowerRoman = "LowerRoman",
1887
+ upperLetter = "UpperLetter",
1888
+ lowerLetter = "LowerLetter"
1889
+ }
1890
+ /**
1891
+ * A list: the set of paragraphs sharing one numbering id.
1892
+ *
1893
+ * A list is not an ELEMENT. OOXML has no list — it has paragraphs that each name a `w:numId`, and
1894
+ * a list is the set that name the same one. So {@link List.id} is that number,
1895
+ * {@link List.paragraphs} is the set, and a list exists exactly as long as some paragraph is
1896
+ * still in it.
1897
+ *
1898
+ * @public
1899
+ */
1900
+ declare class List extends ModelObject implements PromisedItem {
1901
+ #private;
1902
+ /** @internal A list a read has already named. */
1903
+ static at(context: RequestContext, label: string, address: ObjectAddress): List;
1904
+ /** @internal A list a queued read will name, or report as nothing. */
1905
+ static promised(context: RequestContext, label: string, nullable: boolean): List;
1906
+ private constructor();
1907
+ /** @internal Bind this object to the address the owning read answered. */
1908
+ hydrateAddress(address: ObjectAddress): void;
1909
+ /** @internal Settle as the null object: the read found nothing to name. */
1910
+ hydrateNull(): void;
1911
+ /** The `w:numId` the list's paragraphs share — the document's own identity for the list. */
1912
+ get id(): number;
1913
+ /** Every paragraph in the list, in reading order. */
1914
+ get paragraphs(): ParagraphCollection;
1915
+ /** The list's paragraphs at one level, in reading order. */
1916
+ getLevelParagraphs(level: number): ParagraphCollection;
1917
+ /**
1918
+ * Add a numbered paragraph to the list, at its start or its end.
1919
+ *
1920
+ * All four of Word's locations are accepted and `Before`/`After` land INSIDE the list, at the
1921
+ * first and last position — the same places `Start` and `End` name. A list is a set of paragraphs
1922
+ * rather than a region, so "before the list" is a position in the story rather than in the list,
1923
+ * and `Paragraph#insertParagraph` is what addresses that. The divergence is recorded in
1924
+ * `compat/manifest.json`.
1925
+ */
1926
+ insertParagraph(paragraphText: string, insertLocation: 'Start' | 'End' | 'Before' | 'After'): Paragraph;
1927
+ /** Set a level's bullet glyph. Custom bullets require a Unicode character code. */
1928
+ setLevelBullet(level: number, listBullet: ListBullet, charCode?: number, fontName?: string): void;
1929
+ setLevelBullet(level: number, listBullet: 'Custom' | 'Solid' | 'Hollow' | 'Square' | 'Diamonds' | 'Arrow' | 'Checkmark', charCode?: number, fontName?: string): void;
1930
+ /** Set decimal, letter, Roman, or unnumbered markers. Numeric format entries identify zero-based levels. */
1931
+ setLevelNumbering(level: number, listNumbering: ListNumbering, formatString?: (string | number)[]): void;
1932
+ setLevelNumbering(level: number, listNumbering: 'None' | 'Arabic' | 'UpperRoman' | 'LowerRoman' | 'UpperLetter' | 'LowerLetter', formatString?: (string | number)[]): void;
1933
+ /** Set the starting counter for this list instance without changing other lists. */
1934
+ setLevelStartingNumber(level: number, startingNumber: number): void;
1935
+ /** Set text indent and relative first-line indent in points. Negative relative values create hanging indents. */
1936
+ setLevelIndents(level: number, textIndent: number, bulletNumberPictureIndent: number): void;
1937
+ /** @internal Plan the read this object's `load(...)` asked for. */
1938
+ protected onLoad(request: ResolvedLoadOptions): void;
1939
+ }
1940
+ /**
1941
+ * The lists in a story, as of the batch that loaded them.
1942
+ *
1943
+ * @public
1944
+ */
1945
+ declare class ListCollection extends HandleCollection<List> {
1946
+ #private;
1947
+ /** @internal The lists of one story, in the order their numbers first appear. */
1948
+ static of(context: RequestContext, label: string, owner: ObjectPath, body: AutomationHandle): ListCollection;
1949
+ private constructor();
1950
+ /** The first list. `ItemNotFound` at the sync if the story has none. */
1951
+ getFirst(): List;
1952
+ /**
1953
+ * The list with one `w:numId`, or `ItemNotFound` where the story has none.
1954
+ *
1955
+ * ONE read, answered by the host: a `w:numId` is a document value, and matching it against a
1956
+ * listing on this side would mean asking every list for its id and choosing locally — a batch
1957
+ * whose size depends on the document, to answer a question the host can answer directly. A number
1958
+ * no paragraph uses names a numbering definition rather than a list, and is refused.
1959
+ */
1960
+ getById(id: number): List;
1961
+ /** @internal The read that answers this collection's members. */
1962
+ protected listing(): AutomationOperation;
1963
+ /** @internal Build one member from an address the listing answered. */
1964
+ protected itemAt(label: string, address: ObjectAddress): List;
1965
+ /** @internal A member an edge accessor named before the sync that finds it. */
1966
+ protected promised(label: string, nullable: boolean): List & PromisedItem;
1967
+ }
1968
+ /**
1969
+ * A paragraph's membership of a list: which list, and at what level.
1970
+ *
1971
+ * `listString` (the "3." or "iv)" a reader sees) and `siblingIndex` are absent because they are
1972
+ * PAINTED, not authored — computed during layout by a counter that walks the story applying
1973
+ * `numbering.xml`, its abstract-numbering indirection, restarts and overrides. Answering them
1974
+ * here would mean a second counter that disagrees with the one on screen the first time a
1975
+ * document overrides a level.
1976
+ *
1977
+ * @public
1978
+ */
1979
+ declare class ListItem extends ModelObject {
1980
+ #private;
1981
+ /** @internal The list membership of the paragraph `owner` addresses. */
1982
+ static of(context: RequestContext, label: string, owner: ObjectPath): ListItem;
1983
+ private constructor();
1615
1984
  /**
1616
- * Put the reader's selection on this range and navigate the editor viewport to it.
1617
- *
1618
- * The whole range is selected by default. `Start` and `End` instead collapse the caret to that
1619
- * endpoint and reveal it. An already-visible endpoint stays still; an offscreen one is brought
1620
- * into view from the editor's layout, including when its page has not been materialized yet.
1985
+ * How deeply the item is nested: zero for a top-level item, up to eight.
1621
1986
  *
1622
- * Refused with `NotSupported` where there is no reader — a document opened from bytes on a
1623
- * server has no caret or viewport, and moving one would be a claim about a screen nobody is
1624
- * looking at. The check is at the CALL rather than at the sync, so the mistake is reported where
1625
- * it was made.
1987
+ * Writing it is Word's Increase/Decrease Indent on a list item — the paragraph keeps its list and
1988
+ * changes its level, which is why this is one property rather than a pair of verbs.
1626
1989
  */
1627
- select(selectionMode_?: SelectionMode): void;
1990
+ get level(): number;
1991
+ set level(value: number);
1628
1992
  /** @internal Plan the read this object's `load(...)` asked for. */
1629
1993
  protected onLoad(request: ResolvedLoadOptions): void;
1630
1994
  }
@@ -1668,6 +2032,14 @@ declare class Paragraph extends ModelObject implements PromisedItem {
1668
2032
  hydrateNull(): void;
1669
2033
  /** This paragraph's text. Readable after `load('text')` and a `sync()`. */
1670
2034
  get text(): string;
2035
+ /**
2036
+ * The content controls in this paragraph, in document order, at any nesting depth.
2037
+ *
2038
+ * Includes every inline control in the paragraph and a block control that holds it. Load
2039
+ * `items/cannotEdit`, `items/tag`, and `items/text` before you plan edits, and keep each locked
2040
+ * control as one unit.
2041
+ */
2042
+ get contentControls(): ContentControlCollection;
1671
2043
  /**
1672
2044
  * The document's own identity for this paragraph.
1673
2045
  *
@@ -1739,6 +2111,38 @@ declare class Paragraph extends ModelObject implements PromisedItem {
1739
2111
  get list(): List;
1740
2112
  /** Address this paragraph's content or an endpoint. Sync before using the returned range. */
1741
2113
  getRange(rangeLocation?: 'Whole' | 'Content' | 'Start' | 'End' | 'Before' | 'After'): Range;
2114
+ /**
2115
+ * Every occurrence of `searchText` in this paragraph, as ranges, in reading order.
2116
+ *
2117
+ * Takes the same options as `Body.search`. You can search a paragraph from `getFirst()` in the
2118
+ * same `context.sync()` that finds it.
2119
+ */
2120
+ search(searchText: string, searchOptions?: SearchOptions): RangeCollection;
2121
+ /**
2122
+ * Split this paragraph into ranges that each end after one of `endingMarks`, such as `[' ']`
2123
+ * for words. Takes the same arguments and follows the same rules as `Range.getTextRanges`.
2124
+ *
2125
+ * @example
2126
+ * ```ts
2127
+ * const words = paragraph.getTextRanges([' '], true);
2128
+ * words.load('items/text');
2129
+ * await context.sync();
2130
+ * ```
2131
+ */
2132
+ getTextRanges(endingMarks: string[], trimSpacing?: boolean): RangeCollection;
2133
+ /**
2134
+ * This paragraph's text as if every pending tracked change were accepted (`Current`, the
2135
+ * default) or rejected (`Original`). The document does not change.
2136
+ *
2137
+ * After tracked edits, `text` reads both the deleted and the inserted words. Read
2138
+ * `getReviewedText('Current')` to check the proposed result before the next edit.
2139
+ */
2140
+ getReviewedText(changeTrackingVersion?: ChangeTrackingVersion): ClientResult<string>;
2141
+ /**
2142
+ * This paragraph's text as if every pending tracked change were accepted (`Current`, the
2143
+ * default) or rejected (`Original`). The document does not change.
2144
+ */
2145
+ getReviewedText(changeTrackingVersion?: 'Original' | 'Current'): ClientResult<string>;
1742
2146
  /** Start a new independent bullet list with this paragraph. Sync before using the returned list. */
1743
2147
  startNewList(): List;
1744
2148
  /** Join an existing list at a zero-based nesting level. */
@@ -1761,13 +2165,19 @@ declare class Paragraph extends ModelObject implements PromisedItem {
1761
2165
  * paragraph whose mark ends a section; a paragraph with an inline content control; a
1762
2166
  * paragraph with a complex field boundary whose matching boundary is in another paragraph;
1763
2167
  * and a paragraph that nests inline content more than 64 levels deep. It refuses with
1764
- * `NotImplemented` when the paragraph or the start of the next paragraph has a pending change,
1765
- * including your own. Delete adjacent paragraphs in one sync:
2168
+ * `NotImplemented` when the paragraph has your own pending change or another author's pending
2169
+ * paragraph mark, formatting, move, or structural change, and when the start of the next
2170
+ * paragraph has any pending change. Delete adjacent paragraphs in one sync:
1766
2171
  * a later sync beside your own pending deletion refuses, because the two would review as one
1767
2172
  * decision. A refusal refuses the whole sync.
1768
2173
  */
1769
2174
  delete(): void;
1770
- /** Write text over this paragraph or at either edge of it. Answers the written text's range. */
2175
+ /**
2176
+ * Write text over this paragraph or at either edge of it. Answers the written text's range.
2177
+ *
2178
+ * `\n`, `\r`, and `\r\n` in `text` start new paragraphs, tracked with `TrackMineOnly`. See
2179
+ * `Range.insertText` for the rules.
2180
+ */
1771
2181
  insertText(text: string, insertLocation: InsertLocation.replace | InsertLocation.start | InsertLocation.end | 'Replace' | 'Start' | 'End'): Range;
1772
2182
  /** Add a paragraph beside this one. Answers the new paragraph. */
1773
2183
  insertParagraph(paragraphText: string, insertLocation: 'Before' | 'After'): Paragraph;
@@ -1794,6 +2204,9 @@ declare class Paragraph extends ModelObject implements PromisedItem {
1794
2204
  * {@link Paragraph.split} answers are filled in by the split's own command rather than by a
1795
2205
  * separate listing read.
1796
2206
  *
2207
+ * Load the paragraphs and a property of each in one sync with an `items/` path, such as
2208
+ * `paragraphs.load('items/text')`.
2209
+ *
1797
2210
  * @public
1798
2211
  */
1799
2212
  declare class ParagraphCollection extends ItemCollection<Paragraph> {
@@ -1834,6 +2247,9 @@ declare class ParagraphCollection extends ItemCollection<Paragraph> {
1834
2247
  * collections: each item carries its own paragraph-plus-offset endpoints instead of an opaque
1835
2248
  * host-minted id.
1836
2249
  *
2250
+ * Load the ranges and a property of each in one sync with an `items/` path, such as
2251
+ * `results.load('items/text')`.
2252
+ *
1837
2253
  * @public
1838
2254
  */
1839
2255
  declare class RangeCollection extends ItemCollection<Range> {
@@ -2123,7 +2539,8 @@ declare class Document extends ModelObject {
2123
2539
  /**
2124
2540
  * The tracked changes of the main-body story that this API can publish as typed objects.
2125
2541
  *
2126
- * Structural cards whose exact Word subtype cannot be named are omitted from `items`.
2542
+ * Structural cards whose exact Word subtype cannot be named are omitted from `items`, and so
2543
+ * are property changes that leave the resolved formatting unchanged.
2127
2544
  * `acceptAll` / `rejectAll` still resolve every store-resolvable revision in the main body
2128
2545
  * and refuse atomically if any `readOnly` or otherwise unsupported revision remains. Header,
2129
2546
  * footer, and note revisions live on those stories' own `Body.revisions` collections.
@@ -2137,6 +2554,32 @@ declare class Document extends ModelObject {
2137
2554
  get footnotes(): NoteItemCollection;
2138
2555
  /** The document's endnotes, in the order its notes part writes them. */
2139
2556
  get endnotes(): NoteItemCollection;
2557
+ /**
2558
+ * Delete the bookmark with this name, compared without case, from whichever story declares
2559
+ * it. The text stays. A name no bookmark has changes nothing.
2560
+ *
2561
+ * @example
2562
+ * ```ts
2563
+ * context.document.deleteBookmark('Intro');
2564
+ * await context.sync();
2565
+ * ```
2566
+ */
2567
+ deleteBookmark(name: string): void;
2568
+ /**
2569
+ * The range of the bookmark with this name, compared without case. The main text is searched
2570
+ * first, then headers, footers and notes. `ItemNotFound` at the sync when no bookmark has the
2571
+ * name.
2572
+ *
2573
+ * @example
2574
+ * ```ts
2575
+ * const range = context.document.getBookmarkRange('Intro');
2576
+ * range.load('text');
2577
+ * await context.sync();
2578
+ * ```
2579
+ */
2580
+ getBookmarkRange(name: string): Range;
2581
+ /** Like {@link Document.getBookmarkRange}, but a missing bookmark answers a null object. */
2582
+ getBookmarkRangeOrNullObject(name: string): Range;
2140
2583
  /** @internal Plan the read this object's `load(...)` asked for. */
2141
2584
  protected onLoad(request: ResolvedLoadOptions): void;
2142
2585
  }
@@ -2148,12 +2591,14 @@ type DocxEditorErrorCode =
2148
2591
  /** A `ClientResult` value was read before the sync that fills it. */
2149
2592
  | 'ValueNotLoaded'
2150
2593
  /**
2151
- * The object cannot be addressed, in either of the two ways that happens.
2594
+ * The object cannot be addressed, in one of three ways.
2152
2595
  *
2153
2596
  * NOT YET: an item accessor answers a proxy the read that names it has not answered for, and it
2154
2597
  * becomes usable at the next `sync()`. NOT ANY MORE: its run ended and nothing tracked it, which
2155
- * is terminal. One code because from a consumer's side both are "this object cannot be used
2156
- * here"; the message says which one, because the fix for one is not the fix for the other.
2598
+ * is terminal. GONE: the document no longer holds the object, because an edit removed or merged
2599
+ * it; `debugInfo.innerError.code` is then `edit.stale-target` and the message says so. One
2600
+ * code because from a consumer's side all three are "this object cannot be used here"; the
2601
+ * message says which one, because the fix for one is not the fix for the others.
2157
2602
  */
2158
2603
  | 'InvalidObjectPath'
2159
2604
  /** The object still belongs to a run that has not finished, so it cannot be handed over. */
@@ -2164,14 +2609,23 @@ type DocxEditorErrorCode =
2164
2609
  | 'ResourceLimitExceeded'
2165
2610
  /** The collection has no such item — `getFirst()` on an empty one. */
2166
2611
  | 'ItemNotFound'
2167
- /** The host cannot do this at all — a capability it reports false. */
2612
+ /**
2613
+ * The call is outside the supported subset for this host, mode, or content, and nothing
2614
+ * changed. Examples: a server has no selection to move; `TrackMineOnly` has no tracked form
2615
+ * for the operation; the OOXML or the field result holds content the subset does not take.
2616
+ *
2617
+ * Never retry the same call. Read `debugInfo.innerError.code` for the rule, then choose a
2618
+ * supported call, another mode, or other content.
2619
+ */
2168
2620
  | 'NotSupported'
2169
2621
  /**
2170
- * The member exists in this API's shape but this version does not implement it.
2622
+ * The member or rule is one this API does not implement for the target, and nothing changed.
2623
+ * Examples: a range member that a field result does not support; a tracked edit that touches
2624
+ * your own pending change or another author's pending structural change.
2171
2625
  *
2172
- * Distinct from `NotSupported`, which is about the HOST: a headless document really has no
2173
- * caret, and no version of this library will give it one. This code means the library, not the
2174
- * document, is the limit — so a consumer knows to check the release notes rather than the host.
2626
+ * Never retry the same call. Read `debugInfo.innerError.code` for the rule, then read the
2627
+ * target again and edit a different range, decide the pending change first, or use another
2628
+ * member.
2175
2629
  */
2176
2630
  | 'NotImplemented'
2177
2631
  /**
@@ -2194,6 +2648,13 @@ type DocxEditorErrorCode =
2194
2648
  | 'StaleDocument'
2195
2649
  /** The host is live but holds no document right now — an editor between mounts. */
2196
2650
  | 'DocumentUnavailable'
2651
+ /**
2652
+ * A preview is open over the editor, so it refuses this write or a second preview. Commit or
2653
+ * discard the open preview first. Browser runtime only.
2654
+ */
2655
+ | 'PreviewActive'
2656
+ /** The preview has ended — committed, discarded, or replaced by a remount — so it cannot commit. */
2657
+ | 'PreviewEnded'
2197
2658
  /** The document refused the change, or answered something this runtime cannot use. */
2198
2659
  | 'GeneralException';
2199
2660
  /**
@@ -2321,8 +2782,251 @@ declare class DocxEditorError extends Error {
2321
2782
  */
2322
2783
  declare function isDocxEditorError(value: unknown): value is DocxEditorError;
2323
2784
 
2785
+ /**
2786
+ * Where a {@link DocumentPreview} is in its life.
2787
+ *
2788
+ * - `active`: the page shows the preview, and the live document has not moved since the
2789
+ * preview began.
2790
+ * - `stale`: the live document moved after the preview began: a collaboration peer edited it,
2791
+ * or a local write landed while the callback ran. The page still shows the preview.
2792
+ * `commit()` refuses with `StaleDocument`; `commit({ rebase: true })` replays it on the
2793
+ * current document instead.
2794
+ * - `ended`: the preview was committed, discarded, or ended because its runtime was disposed or
2795
+ * the editor loaded, detached, or remounted. The page shows the live document. Final.
2796
+ *
2797
+ * @example
2798
+ * ```ts
2799
+ * preview.onStatusChanged((status) => {
2800
+ * applyButton.textContent = status === 'stale' ? 'Apply to the current text' : 'Apply';
2801
+ * });
2802
+ * ```
2803
+ * @public
2804
+ */
2805
+ type DocumentPreviewStatus = 'active' | 'stale' | 'ended';
2806
+ /**
2807
+ * What {@link DocxEditorRuntime.preview} hands its callback: an ordinary request context
2808
+ * whose reads and writes address the preview, not the live document.
2809
+ *
2810
+ * Write it as you would write the final edit, from data you already have. The editor stays
2811
+ * editable while the callback runs, so a callback that waits on a model call lets the document
2812
+ * move under it, and the preview then starts `stale`. Ask the model first, then preview.
2813
+ *
2814
+ * Text and formatting edits work in the body, headers, footers, and notes. The callback cannot
2815
+ * write tables, pictures, fields, lists, hyperlinks, content controls, or page setup, create or
2816
+ * delete headers, footers, or notes, or move the selection: `context.sync()` refuses those with
2817
+ * `NotSupported`. Comments are written in the body only, as in `run()`.
2818
+ *
2819
+ * @example
2820
+ * ```ts
2821
+ * const proposal = await model.propose(clauseText); // before the preview, not inside it
2822
+ * const preview = await runtime.preview(async (context) => {
2823
+ * context.document.changeTrackingMode = 'TrackMineOnly';
2824
+ * const range = context.document.body.search(proposal.find).getFirst();
2825
+ * range.insertText(proposal.replace, 'Replace');
2826
+ * await context.sync();
2827
+ * });
2828
+ * ```
2829
+ * @public
2830
+ */
2831
+ type PreviewCallback<T = void> = (context: RequestContext) => Promise<T>;
2832
+ /**
2833
+ * Options for {@link DocumentPreview.commit}.
2834
+ *
2835
+ * @example
2836
+ * ```ts
2837
+ * await preview.commit({ rebase: true });
2838
+ * ```
2839
+ * @public
2840
+ */
2841
+ interface CommitPreviewOptions {
2842
+ /**
2843
+ * When the live document moved after the preview began, replay the preview on the current
2844
+ * document instead of refusing. Ranges follow the text they name, so an edit elsewhere, even
2845
+ * earlier in the same paragraph, rebases. The replay still refuses with `StaleDocument`, and
2846
+ * writes nothing, when a replayed read answers differently or a write would overwrite text
2847
+ * that changed: a search finds a different number of matches, text the preview read now
2848
+ * reads otherwise, or the range, paragraph, or span a write replaces or formats holds other
2849
+ * text. Omitted or false, any move refuses.
2850
+ */
2851
+ readonly rebase?: boolean;
2852
+ }
2853
+ /**
2854
+ * Other wording, shown in the page over the live document until it is committed or
2855
+ * discarded. Answered by {@link DocxEditorRuntime.preview}.
2856
+ *
2857
+ * This is DocxEditor infrastructure with no Office.js equivalent.
2858
+ *
2859
+ * @example
2860
+ * ```ts
2861
+ * const preview = await runtime.preview(async (context) => {
2862
+ * context.document.changeTrackingMode = 'TrackMineOnly';
2863
+ * const range = context.document.body.search('thirty (30) days').getFirst();
2864
+ * range.insertText('forty-five (45) days', 'Replace');
2865
+ * await context.sync();
2866
+ * });
2867
+ * preview.reveal(); // scroll to the counter-proposal
2868
+ * // The page shows it as a tracked change. The live document is unchanged.
2869
+ * if (userAccepted) await preview.commit();
2870
+ * else preview.discard();
2871
+ * ```
2872
+ * @public
2873
+ */
2874
+ interface DocumentPreview<T = void> {
2875
+ /**
2876
+ * What the callback answered, as `run()` answers its callback's value. Return plain data from
2877
+ * the callback, never a proxy: proxies end with the callback.
2878
+ *
2879
+ * @example
2880
+ * ```ts
2881
+ * const preview = await runtime.preview(async (context) => {
2882
+ * const range = context.document.body.search('thirty (30) days').getFirst();
2883
+ * range.insertText('forty-five (45) days', 'Replace');
2884
+ * await context.sync();
2885
+ * return { replaced: 'thirty (30) days' };
2886
+ * });
2887
+ * console.log(preview.result.replaced);
2888
+ * ```
2889
+ */
2890
+ readonly result: T;
2891
+ /**
2892
+ * Where the preview is in its life. Read it at any time; it changes without a sync.
2893
+ *
2894
+ * @example
2895
+ * ```ts
2896
+ * if (preview.status === 'stale') await preview.commit({ rebase: true });
2897
+ * ```
2898
+ */
2899
+ readonly status: DocumentPreviewStatus;
2900
+ /**
2901
+ * Write the preview to the live document as one undo step, then end the preview.
2902
+ *
2903
+ * Commit first validates every recorded batch against a fresh fork of the live document.
2904
+ * A divergent read changes neither the live document nor its undo and redo history.
2905
+ * It then replays the batches against the live document inside one editor history group.
2906
+ * Editor event listeners run after replay and its history group finish.
2907
+ * It never runs the callback again. A tracking mode the callback set
2908
+ * stays set on this runtime afterwards, as it does after `run()`.
2909
+ *
2910
+ * Refusals:
2911
+ *
2912
+ * - `StaleDocument` when the live document moved after the preview began
2913
+ * (`expectedRevision` and `actualRevision` say from where to where). Nothing is written and
2914
+ * the preview stays open: call `commit({ rebase: true })` or `discard()`.
2915
+ * - `StaleDocument` from `commit({ rebase: true })` when a replayed read answers differently
2916
+ * or a write would overwrite changed text (`edit.preview-diverged`). Nothing stays written, and the preview ends.
2917
+ * - `PreviewEnded` when the preview was already committed, discarded, or ended by a remount.
2918
+ * - Any refusal the live document gives a replayed batch, such as a collaboration session
2919
+ * that is not ready. Replayed writes before it are undone as one step, and the preview ends.
2920
+ * If that undo itself fails, the error is `GeneralException` with target `preview.rollback`.
2921
+ *
2922
+ * @example
2923
+ * ```ts
2924
+ * try {
2925
+ * await preview.commit();
2926
+ * } catch (error) {
2927
+ * if (!isDocxEditorError(error) || error.code !== 'StaleDocument') throw error;
2928
+ * if (preview.status === 'stale') await preview.commit({ rebase: true });
2929
+ * }
2930
+ * ```
2931
+ */
2932
+ commit(options?: CommitPreviewOptions): Promise<void>;
2933
+ /**
2934
+ * End the preview without writing anything. The page shows the live document again, with
2935
+ * its selection, scroll position, and focus as they were. A tracking mode the callback set
2936
+ * is discarded with the preview. Safe to call more than once and after `commit()`.
2937
+ * Disposing the runtime that opened the preview discards it too.
2938
+ *
2939
+ * @example
2940
+ * ```ts
2941
+ * cancelButton.onclick = () => preview.discard();
2942
+ * ```
2943
+ */
2944
+ discard(): void;
2945
+ /**
2946
+ * Scroll the page to the first paragraph of the document body the preview changed. Answers
2947
+ * false, scrolling nothing, when the preview has ended or changed no body paragraph: an
2948
+ * edit only in a header, a footer, or a note is not found.
2949
+ *
2950
+ * @example
2951
+ * ```ts
2952
+ * const preview = await runtime.preview(counterProposal);
2953
+ * preview.reveal();
2954
+ * ```
2955
+ */
2956
+ reveal(): boolean;
2957
+ /**
2958
+ * Be told when {@link DocumentPreview.status} changes: to `stale` when the live document
2959
+ * moves, and to `ended` once. Returns a function that removes the listener.
2960
+ *
2961
+ * @example
2962
+ * ```ts
2963
+ * const stop = preview.onStatusChanged((status) => {
2964
+ * if (status === 'stale') showBanner('The clause changed since this preview.');
2965
+ * });
2966
+ * ```
2967
+ */
2968
+ onStatusChanged(listener: (status: DocumentPreviewStatus) => void): () => void;
2969
+ }
2970
+
2324
2971
  /** What a `run` callback is given, and what it may answer with. */
2325
2972
  type RunCallback<T> = (context: RequestContext) => Promise<T>;
2973
+ /**
2974
+ * Options for {@link DocxEditorRuntime.run}, passed before the callback.
2975
+ *
2976
+ * This is DocxEditor infrastructure, not part of the Office.js object model: the Office.js
2977
+ * `run` function has no options and no undo grouping.
2978
+ *
2979
+ * @example
2980
+ * ```ts
2981
+ * // One review decision, one undo step: the editor's writes and every sync of the run.
2982
+ * const decision = editor.beginHistoryGroup();
2983
+ * try {
2984
+ * const resolved = editor.exec(
2985
+ * { type: 'resolveAllReviewChanges', action: 'reject', keys },
2986
+ * { historyGroup: decision }
2987
+ * );
2988
+ * if (!resolved.ok) throw new Error(resolved.reason);
2989
+ * await runtime.run({ historyGroup: decision }, async (context) => {
2990
+ * const ranges = context.document.body.search('30 days');
2991
+ * ranges.load('items');
2992
+ * await context.sync();
2993
+ * const target = ranges.items[0];
2994
+ * if (!target) throw new Error('The document has no "30 days" text.');
2995
+ * const replaced = target.insertText('45 days', 'Replace');
2996
+ * await context.sync();
2997
+ * replaced.insertComment('Counter-proposal: 45 days.');
2998
+ * await context.sync();
2999
+ * });
3000
+ * } finally {
3001
+ * decision.end();
3002
+ * }
3003
+ * ```
3004
+ * @public
3005
+ */
3006
+ interface RunOptions {
3007
+ /**
3008
+ * Make every write this run commits part of an open editor history group, so one undo
3009
+ * reverts them together with the group's other writes.
3010
+ *
3011
+ * Pass the handle `editor.beginHistoryGroup()` returns, unchanged.
3012
+ *
3013
+ * Browser runtime only. A server or collaborative runtime refuses the run with
3014
+ * `NotSupported` before the callback starts. To make one operation of a collaborative
3015
+ * server runtime one undo step, open `beginUndoGroup()` on its collaboration session.
3016
+ *
3017
+ * A closed handle, or a handle from another editor, refuses with `InvalidArgument` and
3018
+ * `target: 'historyGroup'` before the callback starts. A handle that closes during the run
3019
+ * refuses the next `context.sync()` the same way, and that sync writes nothing. Runs without
3020
+ * this option never join a group.
3021
+ *
3022
+ * The run has no `ExecResult`. The whole run is one write of the group: after the callback
3023
+ * finishes, `historyGroup.lastOutcome` holds its outcome, which is `split` if any sync split
3024
+ * the group. A split also emits the editor's `historyDiagnostic` event.
3025
+ */
3026
+ readonly historyGroup?: HistoryGroup;
3027
+ /** Objects a previous run tracked, adopted by this run. The same as the object argument. */
3028
+ readonly previousObjects?: ClientObject | readonly ClientObject[];
3029
+ }
2326
3030
  /** Capabilities exposed by a DocxEditor runtime, frozen for its lifetime. */
2327
3031
  interface DocumentCapabilities {
2328
3032
  /** There is a document to address at all. False for a browser host between mounts. */
@@ -2337,6 +3041,20 @@ interface DocumentCapabilities {
2337
3041
  readonly scrolling: boolean;
2338
3042
  /** The host lays the document out, so paginated positions are meaningful. */
2339
3043
  readonly layout: boolean;
3044
+ /**
3045
+ * `preview()` is offered: true for a runtime over a live browser editor, false for a server
3046
+ * runtime, which has no page to show a preview in.
3047
+ *
3048
+ * @example
3049
+ * ```ts
3050
+ * if (runtime.capabilities.preview) {
3051
+ * const preview = await runtime.preview(counterProposal);
3052
+ * } else {
3053
+ * await runtime.run(counterProposal); // write directly, for example on a server
3054
+ * }
3055
+ * ```
3056
+ */
3057
+ readonly preview: boolean;
2340
3058
  }
2341
3059
  /**
2342
3060
  * A runtime: one document host, many runs.
@@ -2358,6 +3076,75 @@ interface DocxEditorRuntime {
2358
3076
  run<T>(callback: RunCallback<T>): Promise<T>;
2359
3077
  /** Run one batch of work, adopting objects a previous run tracked. */
2360
3078
  run<T>(object: ClientObject | readonly ClientObject[], callback: RunCallback<T>): Promise<T>;
3079
+ /**
3080
+ * Run one batch of work with options, such as an editor history group.
3081
+ *
3082
+ * @example
3083
+ * ```ts
3084
+ * const decision = editor.beginHistoryGroup();
3085
+ * await runtime.run({ historyGroup: decision }, async (context) => {
3086
+ * context.document.body.insertParagraph('Revised terms follow.', 'End');
3087
+ * await context.sync();
3088
+ * });
3089
+ * ```
3090
+ */
3091
+ run<T>(options: RunOptions, callback: RunCallback<T>): Promise<T>;
3092
+ /**
3093
+ * Show other wording in the page without writing it, until the answered preview is
3094
+ * committed or discarded.
3095
+ *
3096
+ * The callback gets an ordinary request context. Its reads and writes address a private
3097
+ * copy of the document, and the page paints that copy when the callback finishes. The live
3098
+ * document, its undo history, and every collaboration peer see nothing until
3099
+ * `preview.commit()`, which writes the preview as one undo step. This is DocxEditor
3100
+ * infrastructure; Office.js has no preview.
3101
+ *
3102
+ * The live editor stays editable while the callback runs; build the preview from data you
3103
+ * already have, because a write that lands meanwhile makes the preview start `stale`. Once
3104
+ * the preview shows, the editor refuses document writes: `editor.exec()` edits, typing,
3105
+ * undo and redo, and writes from any runtime, which refuse with `PreviewActive`. Zoom,
3106
+ * paragraph marks, the review pane toggle, and selection keep working. Reads from `run()` see
3107
+ * the live document; reads inside the preview callback see the preview. The review rail and
3108
+ * the editor's text highlights keep describing the live document, and the highlights are
3109
+ * hidden while the preview shows.
3110
+ *
3111
+ * In suggesting mode, a write the callback makes with tracking off becomes a suggestion
3112
+ * attributed to the editor's author, in the preview and at commit alike, as it does in
3113
+ * `run()`.
3114
+ *
3115
+ * Refusals, after each of which nothing is shown and nothing is written; `debugInfo.innerError`
3116
+ * names the reason:
3117
+ *
3118
+ * - `NotSupported` (target `preview`) on a server runtime, while the editor is open for
3119
+ * viewing (`edit.read-only`), while an external refresh replaces the document
3120
+ * (`edit.refresh-in-progress`), or during an input method composition
3121
+ * (`edit.preview-composing`).
3122
+ * - `PreviewActive` (`edit.preview-active`) while another preview is open on the editor.
3123
+ * - `DocumentUnavailable` while the editor holds no mounted document.
3124
+ * - `NotSupported` (`edit.preview-unsupported`) from `context.sync()` for a write a preview
3125
+ * cannot show: tables, pictures, fields, lists, hyperlinks, content controls, creating or
3126
+ * deleting headers, footers, and notes, section and page setup, page and section breaks,
3127
+ * and selection. Text edits in headers, footers, and notes show and commit.
3128
+ * - The same refusal `run()` would give for a write the live editor refuses: a protected
3129
+ * range, a generated table of contents, a collaboration session that is not ready, or a
3130
+ * comment outside the body (`edit.unsupported-story`). A preview never shows what its
3131
+ * commit would refuse.
3132
+ * - Any error the callback throws. The preview ends, and the error propagates unchanged.
3133
+ *
3134
+ * @example
3135
+ * ```ts
3136
+ * const preview = await runtime.preview(async (context) => {
3137
+ * context.document.changeTrackingMode = 'TrackMineOnly';
3138
+ * const range = context.document.body.search('thirty (30) days of receipt').getFirst();
3139
+ * range.insertText('forty-five (45) days of receipt', 'Replace');
3140
+ * await context.sync();
3141
+ * });
3142
+ * preview.reveal();
3143
+ * // Later, from the review UI:
3144
+ * await preview.commit(); // or preview.discard()
3145
+ * ```
3146
+ */
3147
+ preview<T = void>(callback: PreviewCallback<T>): Promise<DocumentPreview<T>>;
2361
3148
  /** Release the host. Idempotent. */
2362
3149
  dispose(): void;
2363
3150
  }
@@ -2412,7 +3199,7 @@ declare class TrackedObjects {
2412
3199
  /** What a context needs from the runtime that made it. */
2413
3200
  interface RuntimeSession {
2414
3201
  readonly host: AutomationHost;
2415
- readonly capabilities: AutomationCapabilities;
3202
+ readonly capabilities: DocumentCapabilities;
2416
3203
  /** Who a comment this runtime writes is recorded as, or absent when it may not write one. */
2417
3204
  readonly author?: string;
2418
3205
  /** Revision view used by standard Office-compatible text reads and searches. */
@@ -2586,10 +3373,17 @@ interface LoadQueryOptions {
2586
3373
  * paragraph.load('text');
2587
3374
  * paragraph.load(['text', 'style']);
2588
3375
  * paragraphs.load({ select: 'items', top: 5 });
3376
+ * paragraphs.load('items/text,items/style');
2589
3377
  * ```
2590
3378
  *
2591
- * Collections load their `items`; properties such as `text` are loaded on each item after the
2592
- * collection has been synced.
3379
+ * On a collection, `items/<property>` loads `items` and that property on each item in the same
3380
+ * `context.sync()`. A property name without the `items/` prefix means the same thing on a
3381
+ * collection, so `paragraphs.load('text')` equals `paragraphs.load('items/text')`.
3382
+ *
3383
+ * Only one level of navigation is supported. A deeper path, such as `items/font/bold`, and a
3384
+ * navigation path on an object that is not a collection, such as `font/bold`, are refused as
3385
+ * `InvalidArgument`, with the path as the error's `target`. Load the navigation object itself
3386
+ * instead, for example `paragraph.font.load('bold')` for each item.
2593
3387
  *
2594
3388
  * @public
2595
3389
  */
@@ -2597,6 +3391,11 @@ type LoadOption = string | readonly string[] | LoadQueryOptions;
2597
3391
  interface ResolvedLoadOptions {
2598
3392
  /** Selected property names. Empty means "this object's default set". */
2599
3393
  readonly select: readonly string[];
3394
+ /**
3395
+ * Property names selected with an `items/` path, to load on each item of a collection. Empty
3396
+ * when none was named. An object that is not a collection refuses a non-empty list.
3397
+ */
3398
+ readonly itemSelect: readonly string[];
2600
3399
  readonly top?: number;
2601
3400
  readonly skip?: number;
2602
3401
  }
@@ -2640,6 +3439,8 @@ declare abstract class ClientObject implements RuntimeManagedObject {
2640
3439
  load(option?: LoadOption): this;
2641
3440
  /** What this kind of object does with a resolved load request. */
2642
3441
  protected abstract onLoad(request: ResolvedLoadOptions): void;
3442
+ /** @internal Whether `load(...)` accepts `items/<property>` paths. Only collections do. */
3443
+ protected get loadsItemPaths(): boolean;
2643
3444
  /** @internal This object's address, or the placeholder standing in until a sync resolves it. */
2644
3445
  protected get path(): ObjectPath;
2645
3446
  /** @internal The owning context's internal surface. */
@@ -2845,7 +3646,12 @@ declare class Body extends ModelObject {
2845
3646
  search(searchText: string, options?: SearchOptions): RangeCollection;
2846
3647
  /** Empty the story, leaving one empty paragraph behind. */
2847
3648
  clear(): void;
2848
- /** Write text over the whole story, or at either edge of it. Answers the text's own range. */
3649
+ /**
3650
+ * Write text over the whole story, or at either edge of it. Answers the text's own range.
3651
+ *
3652
+ * `\n`, `\r`, and `\r\n` in `text` start new paragraphs, tracked with `TrackMineOnly` at
3653
+ * `Start` and `End`. See `Range.insertText` for the rules.
3654
+ */
2849
3655
  insertText(text: string, insertLocation: InsertLocation.replace | InsertLocation.start | InsertLocation.end | 'Replace' | 'Start' | 'End'): Range;
2850
3656
  /** Add a paragraph at the start or the end of the story. Answers the new paragraph. */
2851
3657
  insertParagraph(paragraphText: string, insertLocation: InsertLocation.start | InsertLocation.end | 'Start' | 'End'): Paragraph;
@@ -2861,6 +3667,108 @@ declare class Body extends ModelObject {
2861
3667
  get tables(): TableCollection;
2862
3668
  }
2863
3669
 
3670
+ /**
3671
+ * The tracked changes a review card stands for, by the key the editor's review queue gives it.
3672
+ *
3673
+ * Pass the `key` of a revision item from `editor.getReviewItems()` or `useReview().items`. The
3674
+ * collection holds that change only, or the deletion and the insertion of a paired replacement.
3675
+ * Unlike {@link Range.revisions} on the card's range, it never holds a nested or adjacent change
3676
+ * by another author.
3677
+ *
3678
+ * A key that names nothing in the document, such as one whose change was already resolved,
3679
+ * loads an empty collection, and `acceptAll()` or `rejectAll()` on it refuses with
3680
+ * `InvalidObjectPath`. A comment or custom node key refuses with `NotSupported` at the call.
3681
+ * `resolve()` and `setAuthor()` refuse with `NotSupported` on this collection.
3682
+ *
3683
+ * This is a DocxEditor addition. Office.js has no review queue and no key for a revision.
3684
+ *
3685
+ * @param context - The request context of the current `run()`.
3686
+ * @param key - The review item's `key`.
3687
+ * @returns The change or changes that the key names.
3688
+ *
3689
+ * @example Accept the change a review card shows
3690
+ * ```ts
3691
+ * import { getReviewItemRevisions } from '@docx-editor.dev/editor-api/browser';
3692
+ *
3693
+ * const key = item.key; // From useReview().items or editor.getReviewItems().
3694
+ * await runtime.run(async (context) => {
3695
+ * getReviewItemRevisions(context, key).acceptAll();
3696
+ * await context.sync();
3697
+ * });
3698
+ * ```
3699
+ *
3700
+ * @public
3701
+ */
3702
+ declare function getReviewItemRevisions(context: RequestContext, key: string): RevisionCollection;
3703
+ /**
3704
+ * The range a review item covers, by the key the editor's review queue gives it.
3705
+ *
3706
+ * Pass the `key` of an item from `editor.getReviewItems()` or `useReview().items`. A tracked
3707
+ * change resolves to the characters it covers. A paired replacement key resolves to one range
3708
+ * over both its deletion and its insertion. A comment or reply resolves to the range its thread
3709
+ * is anchored to. The range is a snapshot like any other.
3710
+ *
3711
+ * To act on the card's own change, use {@link getReviewItemRevisions}. {@link Range.revisions} on
3712
+ * this range also lists nested or adjacent changes that the range overlaps.
3713
+ *
3714
+ * A key that names nothing in the document, such as one whose change was already accepted, or a
3715
+ * comment with no anchor in the document, fails the sync with `ItemNotFound`. Use
3716
+ * {@link getReviewItemRangeOrNullObject} to test for that instead. A custom node's key refuses
3717
+ * with `NotSupported` at the call.
3718
+ *
3719
+ * This is a DocxEditor addition. Office.js has no review queue and no key for a revision.
3720
+ *
3721
+ * @param context - The request context of the current `run()`.
3722
+ * @param key - The review item's `key`.
3723
+ * @returns A range that becomes addressable at the next `context.sync()`.
3724
+ *
3725
+ * @example Read the words a comment card is about
3726
+ * ```ts
3727
+ * import { getReviewItemRange } from '@docx-editor.dev/editor-api/browser';
3728
+ *
3729
+ * const key = item.key; // From useReview().items or editor.getReviewItems().
3730
+ * const text = await runtime.run(async (context) => {
3731
+ * const range = getReviewItemRange(context, key);
3732
+ * range.load('text');
3733
+ * await context.sync();
3734
+ * return range.text;
3735
+ * });
3736
+ * ```
3737
+ *
3738
+ * @public
3739
+ */
3740
+ declare function getReviewItemRange(context: RequestContext, key: string): Range;
3741
+ /**
3742
+ * The range a review item covers, or a null object when the key names nothing.
3743
+ *
3744
+ * The same lookup as {@link getReviewItemRange}. A key that names nothing in the document
3745
+ * answers a range whose `isNullObject` is `true` after the sync, instead of failing it.
3746
+ *
3747
+ * This is a DocxEditor addition. Office.js has no review queue and no key for a revision.
3748
+ *
3749
+ * @param context - The request context of the current `run()`.
3750
+ * @param key - The review item's `key`.
3751
+ * @returns A range whose `isNullObject` is known after the next `context.sync()`.
3752
+ *
3753
+ * @example Skip a card whose change another reviewer already resolved
3754
+ * ```ts
3755
+ * import { getReviewItemRangeOrNullObject } from '@docx-editor.dev/editor-api/browser';
3756
+ *
3757
+ * const key = item.key; // From useReview().items or editor.getReviewItems().
3758
+ * await runtime.run(async (context) => {
3759
+ * const range = getReviewItemRangeOrNullObject(context, key);
3760
+ * range.load('text');
3761
+ * await context.sync();
3762
+ *
3763
+ * if (range.isNullObject) return;
3764
+ * console.log(range.text);
3765
+ * });
3766
+ * ```
3767
+ *
3768
+ * @public
3769
+ */
3770
+ declare function getReviewItemRangeOrNullObject(context: RequestContext, key: string): Range;
3771
+
2864
3772
  /** Explicit measurement inputs for headless field calculation. @public */
2865
3773
  interface ServerPaginationOptions extends AutomationPaginationOptions {
2866
3774
  }
@@ -3004,5 +3912,5 @@ interface CreateServerOptions {
3004
3912
  /** Options for {@link createCollaborative}. @public */
3005
3913
  type CreateCollaborativeOptions = CreateServerOptions;
3006
3914
 
3007
- export { NoteItem as $, Alignment as A, DocxEditorError as F, Field as L, FieldCollection as M, FieldType as N, Font as P, InlinePicture as R, InlinePictureCollection as S, InsertLocation as T, List as U, ListBullet as V, ListCollection as W, ListItem as X, ListNumbering as Y, NoteItemCollection as a0, PageOrientation as a2, PageSetup as a3, Paragraph as a4, ParagraphCollection as a6, Range as a9, TrackedObjects as aA, UnderlineType as aB, VerticalAlignment as aC, isDocxEditorError as aD, RangeCollection as aa, RemoveDocInfoType as ac, RequestContext as ad, Revision as ae, RevisionCollection as ah, Section as an, SectionCollection as ao, Shape as ar, ShapeCollection as as, ShapeType as at, Table as au, TableCell as av, TableCellCollection as aw, TableCollection as ax, TableRow as ay, TableRowCollection as az, Body as b, Bookmark as e, BookmarkCollection as f, BreakType as g, ChangeTrackingMode as h, ClientObject as i, ClientResult as j, Comment as k, CommentCollection as l, CommentReply as m, CommentReplyCollection as n, ContentControl as o, ContentControlCollection as p, ContentControlType as s, Document as u, DocumentProperties as x };
3008
- export type { BesideLocation as B, CreateServerOptions as C, DocxEditorServerRuntime as D, DocxEditorDebugInfo as E, DocxEditorErrorCode as G, DocxEditorErrorInit as H, DocxEditorInnerError as I, DocxEditorRuntime as J, EditorModule as K, FieldTypeLiteral as O, HeaderFooterType as Q, LoadOption as Z, LoadQueryOptions as _, CreateCollaborativeOptions as a, NoteItemType as a1, ParagraphAlignment as a5, ParagraphInsertTextLocation as a7, ParagraphReadingOrder as a8, RangeInsertTextLocation as ab, RevisionAuthorOptions as af, RevisionAuthorSelection as ag, RevisionTextView as ai, RevisionType as aj, RunCallback as ak, RuntimeDiagnostic as al, SearchOptions as am, SelectionMode as ap, ServerPaginationOptions as aq, BodyInsertParagraphLocation as c, BodyInsertTextLocation as d, ContentControlLockState as q, ContentControlSubtype as r, ContentControlValue as t, DocumentCapabilities as v, DocumentLimits as w, DocumentXmlLimits as y, DocumentZipLimits as z };
3915
+ export { ListItem as $, Alignment as A, DocumentProperties as F, DocxEditorError as J, Field as P, FieldCollection as Q, FieldType as R, Font as T, InlinePicture as V, InlinePictureCollection as W, InsertLocation as X, List as Y, ListBullet as Z, ListCollection as _, ListNumbering as a0, NoteItem as a3, NoteItemCollection as a4, PageOrientation as a6, PageSetup as a7, Paragraph as a8, ShapeType as aA, Table as aB, TableCell as aC, TableCellCollection as aD, TableCollection as aE, TableRow as aF, TableRowCollection as aG, TrackedObjects as aH, UnderlineType as aI, VerticalAlignment as aJ, getReviewItemRange as aK, getReviewItemRangeOrNullObject as aL, getReviewItemRevisions as aM, isDocxEditorError as aN, ParagraphCollection as aa, Range as ae, RangeCollection as af, RangeLocation as ah, RemoveDocInfoType as ai, RequestContext as aj, Revision as ak, RevisionCollection as an, Section as au, SectionCollection as av, Shape as ay, ShapeCollection as az, Body as b, Bookmark as e, BookmarkCollection as f, BreakType as g, ChangeTrackingMode as h, ChangeTrackingVersion as i, ClientObject as j, ClientResult as k, Comment as l, CommentCollection as m, CommentReply as n, CommentReplyCollection as o, ContentControl as q, ContentControlCollection as r, ContentControlType as u, Document as w };
3916
+ export type { BesideLocation as B, CreateServerOptions as C, DocxEditorServerRuntime as D, DocumentPreviewStatus as E, DocumentXmlLimits as G, DocumentZipLimits as H, DocxEditorDebugInfo as I, DocxEditorErrorCode as K, DocxEditorErrorInit as L, DocxEditorInnerError as M, DocxEditorRuntime as N, EditorModule as O, FieldTypeLiteral as S, HeaderFooterType as U, CreateCollaborativeOptions as a, LoadOption as a1, LoadQueryOptions as a2, NoteItemType as a5, ParagraphAlignment as a9, ParagraphInsertTextLocation as ab, ParagraphReadingOrder as ac, PreviewCallback as ad, RangeInsertTextLocation as ag, RevisionAuthorOptions as al, RevisionAuthorSelection as am, RevisionTextView as ao, RevisionType as ap, RunCallback as aq, RunOptions as ar, RuntimeDiagnostic as as, SearchOptions as at, SelectionMode as aw, ServerPaginationOptions as ax, BodyInsertParagraphLocation as c, BodyInsertTextLocation as d, CommitPreviewOptions as p, ContentControlLockState as s, ContentControlSubtype as t, ContentControlValue as v, DocumentCapabilities as x, DocumentLimits as y, DocumentPreview as z };