@docx-editor.dev/editor-api 2.31.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.
@@ -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,11 @@ 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;
105
126
  /**
106
127
  * The answer queues reads for the same sync: a listing whose items load properties named
107
128
  * with `items/`. A sync that writes sends such a listing, and those reads, before its writes.
@@ -278,6 +299,30 @@ declare enum InsertLocation {
278
299
  before = "Before",
279
300
  after = "After"
280
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
+ }
281
326
  /** Paragraph alignment vocabulary. Mixed and unknown are read states, not authoring modes. @public */
282
327
  declare enum Alignment {
283
328
  mixed = "Mixed",
@@ -360,223 +405,16 @@ declare enum RemoveDocInfoType {
360
405
  versions = "Versions"
361
406
  }
362
407
 
363
- /** Supported Word bullet styles. @public */
364
- declare enum ListBullet {
365
- custom = "Custom",
366
- solid = "Solid",
367
- hollow = "Hollow",
368
- square = "Square",
369
- diamonds = "Diamonds",
370
- arrow = "Arrow",
371
- checkmark = "Checkmark"
372
- }
373
- /** Supported Word numbering styles. @public */
374
- declare enum ListNumbering {
375
- none = "None",
376
- arabic = "Arabic",
377
- upperRoman = "UpperRoman",
378
- lowerRoman = "LowerRoman",
379
- upperLetter = "UpperLetter",
380
- lowerLetter = "LowerLetter"
381
- }
382
- /**
383
- * A list: the set of paragraphs sharing one numbering id.
384
- *
385
- * A list is not an ELEMENT. OOXML has no list — it has paragraphs that each name a `w:numId`, and
386
- * a list is the set that name the same one. So {@link List.id} is that number,
387
- * {@link List.paragraphs} is the set, and a list exists exactly as long as some paragraph is
388
- * still in it.
389
- *
390
- * @public
391
- */
392
- declare class List extends ModelObject implements PromisedItem {
393
- #private;
394
- /** @internal A list a read has already named. */
395
- static at(context: RequestContext, label: string, address: ObjectAddress): List;
396
- /** @internal A list a queued read will name, or report as nothing. */
397
- static promised(context: RequestContext, label: string, nullable: boolean): List;
398
- private constructor();
399
- /** @internal Bind this object to the address the owning read answered. */
400
- hydrateAddress(address: ObjectAddress): void;
401
- /** @internal Settle as the null object: the read found nothing to name. */
402
- hydrateNull(): void;
403
- /** The `w:numId` the list's paragraphs share — the document's own identity for the list. */
404
- get id(): number;
405
- /** Every paragraph in the list, in reading order. */
406
- get paragraphs(): ParagraphCollection;
407
- /** The list's paragraphs at one level, in reading order. */
408
- getLevelParagraphs(level: number): ParagraphCollection;
409
- /**
410
- * Add a numbered paragraph to the list, at its start or its end.
411
- *
412
- * All four of Word's locations are accepted and `Before`/`After` land INSIDE the list, at the
413
- * first and last position — the same places `Start` and `End` name. A list is a set of paragraphs
414
- * rather than a region, so "before the list" is a position in the story rather than in the list,
415
- * and `Paragraph#insertParagraph` is what addresses that. The divergence is recorded in
416
- * `compat/manifest.json`.
417
- */
418
- insertParagraph(paragraphText: string, insertLocation: 'Start' | 'End' | 'Before' | 'After'): Paragraph;
419
- /** Set a level's bullet glyph. Custom bullets require a Unicode character code. */
420
- setLevelBullet(level: number, listBullet: ListBullet, charCode?: number, fontName?: string): void;
421
- setLevelBullet(level: number, listBullet: 'Custom' | 'Solid' | 'Hollow' | 'Square' | 'Diamonds' | 'Arrow' | 'Checkmark', charCode?: number, fontName?: string): void;
422
- /** Set decimal, letter, Roman, or unnumbered markers. Numeric format entries identify zero-based levels. */
423
- setLevelNumbering(level: number, listNumbering: ListNumbering, formatString?: (string | number)[]): void;
424
- setLevelNumbering(level: number, listNumbering: 'None' | 'Arabic' | 'UpperRoman' | 'LowerRoman' | 'UpperLetter' | 'LowerLetter', formatString?: (string | number)[]): void;
425
- /** Set the starting counter for this list instance without changing other lists. */
426
- setLevelStartingNumber(level: number, startingNumber: number): void;
427
- /** Set text indent and relative first-line indent in points. Negative relative values create hanging indents. */
428
- setLevelIndents(level: number, textIndent: number, bulletNumberPictureIndent: number): void;
429
- /** @internal Plan the read this object's `load(...)` asked for. */
430
- protected onLoad(request: ResolvedLoadOptions): void;
431
- }
432
- /**
433
- * The lists in a story, as of the batch that loaded them.
434
- *
435
- * @public
436
- */
437
- declare class ListCollection extends HandleCollection<List> {
438
- #private;
439
- /** @internal The lists of one story, in the order their numbers first appear. */
440
- static of(context: RequestContext, label: string, owner: ObjectPath, body: AutomationHandle): ListCollection;
441
- private constructor();
442
- /** The first list. `ItemNotFound` at the sync if the story has none. */
443
- getFirst(): List;
444
- /**
445
- * The list with one `w:numId`, or `ItemNotFound` where the story has none.
446
- *
447
- * ONE read, answered by the host: a `w:numId` is a document value, and matching it against a
448
- * listing on this side would mean asking every list for its id and choosing locally — a batch
449
- * whose size depends on the document, to answer a question the host can answer directly. A number
450
- * no paragraph uses names a numbering definition rather than a list, and is refused.
451
- */
452
- getById(id: number): List;
453
- /** @internal The read that answers this collection's members. */
454
- protected listing(): AutomationOperation;
455
- /** @internal Build one member from an address the listing answered. */
456
- protected itemAt(label: string, address: ObjectAddress): List;
457
- /** @internal A member an edge accessor named before the sync that finds it. */
458
- protected promised(label: string, nullable: boolean): List & PromisedItem;
459
- }
460
- /**
461
- * A paragraph's membership of a list: which list, and at what level.
462
- *
463
- * `listString` (the "3." or "iv)" a reader sees) and `siblingIndex` are absent because they are
464
- * PAINTED, not authored — computed during layout by a counter that walks the story applying
465
- * `numbering.xml`, its abstract-numbering indirection, restarts and overrides. Answering them
466
- * here would mean a second counter that disagrees with the one on screen the first time a
467
- * document overrides a level.
468
- *
469
- * @public
470
- */
471
- declare class ListItem extends ModelObject {
472
- #private;
473
- /** @internal The list membership of the paragraph `owner` addresses. */
474
- static of(context: RequestContext, label: string, owner: ObjectPath): ListItem;
475
- private constructor();
476
- /**
477
- * How deeply the item is nested: zero for a top-level item, up to eight.
478
- *
479
- * Writing it is Word's Increase/Decrease Indent on a list item — the paragraph keeps its list and
480
- * changes its level, which is why this is one property rather than a pair of verbs.
481
- */
482
- get level(): number;
483
- set level(value: number);
484
- /** @internal Plan the read this object's `load(...)` asked for. */
485
- protected onLoad(request: ResolvedLoadOptions): void;
486
- }
487
-
488
408
  /** What the object is, which is what decides how its characters are named. */
489
409
  type SpanOwner = 'body' | 'paragraph' | 'span';
490
410
 
491
- /** Office.js underline values. Unsupported runtime modes refuse at sync. @public */
492
- declare enum UnderlineType {
493
- mixed = "Mixed",
494
- none = "None",
495
- hidden = "Hidden",
496
- dotLine = "DotLine",
497
- single = "Single",
498
- word = "Word",
499
- double = "Double",
500
- thick = "Thick",
501
- dotted = "Dotted",
502
- dottedHeavy = "DottedHeavy",
503
- dashLine = "DashLine",
504
- dashLineHeavy = "DashLineHeavy",
505
- dashLineLong = "DashLineLong",
506
- dashLineLongHeavy = "DashLineLongHeavy",
507
- dotDashLine = "DotDashLine",
508
- dotDashLineHeavy = "DotDashLineHeavy",
509
- twoDotDashLine = "TwoDotDashLine",
510
- twoDotDashLineHeavy = "TwoDotDashLineHeavy",
511
- wave = "Wave",
512
- waveHeavy = "WaveHeavy",
513
- waveDouble = "WaveDouble"
514
- }
515
411
  /**
516
- * The character formatting of whatever it belongs to: a story, a stretch of one, or a paragraph.
517
- *
518
- * A font has no identity of its own — it is a view onto its owner's characters and shares its
519
- * owner's path, so a font reached from a deleted paragraph's range refuses at the same moment the
520
- * range does rather than holding a stale address.
521
- *
522
- * Reading is AGREEMENT, and `null` means "no agreed value": every run the owner covers says bold,
523
- * or the answer is null. Null is also the answer when nothing in range authors the property at
524
- * all. Both are one answer on purpose, because this API reads what the document AUTHORS rather
525
- * than what the style cascade computes — a heading whose bold comes from `styles.xml` reads null.
526
- * Answering the cascade would let a caller read an inherited value, write it straight back, and
527
- * silently freeze it into the paragraph as if the author had chosen it.
528
- *
529
- * Assignments within one `sync()` are ONE write: `font.bold = true; font.size = 12` accumulates
530
- * into a single run-property operation. That is required, not an optimisation — a run-property
531
- * write carries the run's whole property bag, so a second write planned from the same pre-batch
532
- * tree would carry a bag the first had already superseded, which the host refuses with
533
- * `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}.
534
415
  *
535
416
  * @public
536
417
  */
537
- declare class Font extends ModelObject {
538
- #private;
539
- /** @internal The font of the object `owner` addresses. */
540
- static of(context: RequestContext, label: string, owner: ObjectPath, kind: SpanOwner): Font;
541
- private constructor();
542
- /** Whether every character agrees it is bold, or `null` where they do not. */
543
- get bold(): boolean | null;
544
- set bold(value: boolean);
545
- /** Whether every run in range is italic. `null` where they disagree or none says. */
546
- get italic(): boolean | null;
547
- set italic(value: boolean);
548
- /** `#RRGGBB`. `null` where the characters disagree, or where the colour is `auto`. */
549
- get color(): string | null;
550
- set color(value: string);
551
- /** The typeface name the characters state, or `null` where they do not agree on one. */
552
- get name(): string | null;
553
- set name(value: string);
554
- /** Points. */
555
- get size(): number | null;
556
- set size(value: number);
557
- /** Office underline styles. Mixed, Hidden, and DotLine refuse at sync. */
558
- get underline(): string | null;
559
- 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');
560
- /** Exact Word palette color, returned as #RRGGBB. Null clears highlighting. */
561
- get highlightColor(): string | null;
562
- set highlightColor(value: string);
563
- get strikeThrough(): boolean | null;
564
- set strikeThrough(value: boolean);
565
- get subscript(): boolean | null;
566
- set subscript(value: boolean);
567
- get superscript(): boolean | null;
568
- set superscript(value: boolean);
569
- /**
570
- * One read for every property asked for.
571
- *
572
- * They all come out of the same runs, so asking for them one at a time would send several
573
- * operations about the same characters and make a caller's cost depend on how many fields they
574
- * happened to name.
575
- */
576
- protected onLoad(request: ResolvedLoadOptions): void;
577
- }
578
-
579
- /** An inert Word field. Code writes and evaluation support PAGE and NUMPAGES. @public */
580
418
  declare class Field extends ModelObject implements PromisedItem {
581
419
  #private;
582
420
  /** @internal */
@@ -589,6 +427,17 @@ declare class Field extends ModelObject implements PromisedItem {
589
427
  /** @internal */
590
428
  hydrateNull(): void;
591
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;
592
441
  set code(value: string);
593
442
  /** Remove this field, including its cached result. Other fields remain inert and unchanged. */
594
443
  delete(): void;
@@ -613,7 +462,12 @@ declare class FieldCollection extends ItemCollection<Field> {
613
462
  protected promised(label: string, nullable: boolean): Field & PromisedItem;
614
463
  }
615
464
 
616
- /** 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
+ */
617
471
  declare enum FieldType {
618
472
  addin = "Addin",
619
473
  addressBlock = "AddressBlock",
@@ -750,7 +604,7 @@ declare class InlinePictureCollection extends ItemCollection<InlinePicture> {
750
604
  protected promised(label: string, nullable: boolean): InlinePicture & PromisedItem;
751
605
  }
752
606
 
753
- /** A canonical rectangular table. Reads require load() and sync(). @public */
607
+ /** A canonical table. Reads require load() and sync(). @public */
754
608
  declare class Table extends ModelObject implements PromisedItem {
755
609
  #private;
756
610
  /** @internal */
@@ -797,6 +651,18 @@ declare class Table extends ModelObject implements PromisedItem {
797
651
  deleteRows(rowIndex: number, rowCount?: number): void;
798
652
  /** Delete consecutive columns from a zero-based index. Defaults to one column. */
799
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;
800
666
  /** Delete this table and its contents through the canonical document transaction. */
801
667
  delete(): void;
802
668
  protected onLoad(request: ResolvedLoadOptions): void;
@@ -822,7 +688,7 @@ declare class TableRow extends ModelObject implements PromisedItem {
822
688
  /** Stable cell collection for this row. Load `items` and sync before reading. */
823
689
  get cells(): TableCellCollection;
824
690
  }
825
- /** 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 */
826
692
  declare class TableCell extends ModelObject implements PromisedItem {
827
693
  #private;
828
694
  /** @internal */
@@ -851,6 +717,14 @@ declare class TableCell extends ModelObject implements PromisedItem {
851
717
  /** Top, Center, or Bottom. Mixed is a read state and cannot be assigned. */
852
718
  get verticalAlignment(): VerticalAlignment | 'Top' | 'Center' | 'Bottom' | 'Mixed';
853
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;
854
728
  protected onLoad(request: ResolvedLoadOptions): void;
855
729
  }
856
730
  /** A loaded collection of Table objects. @public */
@@ -990,190 +864,92 @@ declare class BookmarkCollection extends HandleCollection<Bookmark> {
990
864
  protected promised(label: string, nullable: boolean): Bookmark & PromisedItem;
991
865
  }
992
866
 
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"
890
+ }
993
891
  /**
994
- * What a control's own type accepts as a value.
995
- *
996
- * A discriminated union rather than `unknown`: a dropdown and a checkbox do not take the same
997
- * kind of thing, and a single `setValue(value: string)` would have to guess what `'true'` means
998
- * to a date picker.
999
- */
1000
- type ContentControlValue = {
1001
- readonly kind: 'text';
1002
- readonly text: string;
1003
- } | {
1004
- readonly kind: 'listItem';
1005
- readonly value: string;
1006
- } | {
1007
- readonly kind: 'checkbox';
1008
- readonly checked: boolean;
1009
- }
1010
- /** `YYYY-MM-DD`, or a full ISO-8601 instant. */
1011
- | {
1012
- readonly kind: 'date';
1013
- readonly iso: string;
1014
- };
1015
- /** The lock a control carries. `ST_Lock`, spelled as the schema spells it. */
1016
- type ContentControlLockState = 'unlocked' | 'sdtLocked' | 'contentLocked' | 'sdtContentLocked';
1017
- /** The control types this API can create. Picture and repeating section are deferred. */
1018
- type ContentControlSubtype = 'richText' | 'plainText' | 'dropDownList' | 'comboBox' | 'date';
1019
- /**
1020
- * A part of a document a template marked as a field.
1021
- *
1022
- * A control is NOT its `w:id`. The attribute is optional in OOXML and unique nowhere, so a
1023
- * document may hold one control with no id and two with the same one. This object is addressed by
1024
- * an opaque host-minted handle instead, and {@link ContentControl.id} is answered as METADATA — a
1025
- * label the file wrote, empty where it wrote none. `getById` still exists, because a template
1026
- * author knows their own numbering, and it answers the first match in document order rather than
1027
- * refusing.
892
+ * The character formatting of whatever it belongs to: a story, a stretch of one, or a paragraph.
1028
893
  *
1029
- * A control's contents are not its value. `text` reads the characters; `setValue` writes in the
1030
- * vocabulary the control's own type accepts — a declared item for a dropdown, an ISO date for a
1031
- * date picker, a state for a checkbox — because writing `"true"` into a checkbox's runs would
1032
- * 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.
1033
897
  *
1034
- * @public
1035
- */
1036
- declare class ContentControl extends ModelObject implements PromisedItem {
1037
- #private;
1038
- /** @internal A control a read has already named. */
1039
- static at(context: RequestContext, label: string, address: ObjectAddress): ContentControl;
1040
- /** @internal A control a queued read will name, or report as nothing. */
1041
- static promised(context: RequestContext, label: string, nullable: boolean): ContentControl;
1042
- private constructor();
1043
- /** @internal Bind this object to the address the owning read answered. */
1044
- hydrateAddress(address: ObjectAddress): void;
1045
- /** @internal Settle as the null object: the read found nothing to name. */
1046
- hydrateNull(): void;
1047
- /**
1048
- * The `w:id` the file wrote, as a string, and `''` where it wrote none.
1049
- *
1050
- * A STRING and not a number, deliberately. The identity of this object is its handle; a numeric
1051
- * `id` invites a caller to key a map on a value the schema lets a document repeat.
1052
- */
1053
- get id(): string;
1054
- /** `w:tag` — the machine-readable label a template puts on a field. `''` where absent. */
1055
- get tag(): string;
1056
- set tag(value: string);
1057
- /** `w:alias` — what Word's UI calls the control's title. `''` where absent. */
1058
- get title(): string;
1059
- set title(value: string);
1060
- /** What kind of control it is: `plainText`, `dropDownList`, `checkbox`, `date`, … */
1061
- get subtype(): string;
1062
- /**
1063
- * Whether the control currently declares an OOXML data binding.
1064
- *
1065
- * This is advisory preflight for callers choosing controls to write. A document can change
1066
- * after this property is loaded, so the atomic sync-time refusal remains the final authority.
1067
- * Only binding presence is exposed: XPath, namespace mappings, store ids, and custom XML
1068
- * content remain inside the untrusted-document boundary.
1069
- */
1070
- get isBound(): boolean;
1071
- /**
1072
- * Whether the control refuses to be deleted.
1073
- *
1074
- * Reads the lock IN FORCE, so a control an enclosing one protects reports true even when its
1075
- * own `w:lock` says otherwise — that is what the document does, and reporting the control's own
1076
- * half would tell a caller an edit will work when the store is about to refuse it.
1077
- */
1078
- get cannotDelete(): boolean;
1079
- set cannotDelete(value: boolean);
1080
- /** Whether the control's contents refuse to be edited. Resolved like `cannotDelete`. */
1081
- get cannotEdit(): boolean;
1082
- set cannotEdit(value: boolean);
1083
- /**
1084
- * Whether the control is showing its prompt rather than a value (`w:showingPlcHdr`).
1085
- *
1086
- * STATE, not text. A control showing its placeholder holds the prompt in its runs, and the
1087
- * first thing written into it replaces the whole prompt — so a caller that treats `text` as a
1088
- * value must ask this before believing it.
1089
- */
1090
- get placeholderShown(): boolean;
1091
- /** Whether the control removes its own wrapper on the first content edit (`w:temporary`). */
1092
- get temporary(): boolean;
1093
- /** The characters the control encloses, as the document reads them. */
1094
- get text(): string;
1095
- /** The paragraphs the control holds. Empty for an inline control, which holds none. */
1096
- get paragraphs(): ParagraphCollection;
1097
- /** The controls INSIDE this one, in document order. */
1098
- get contentControls(): ContentControlCollection;
1099
- /**
1100
- * The stretch of the story the control's content covers.
1101
- *
1102
- * Read when it is asked for rather than carried by the control, because the content moves as
1103
- * the document is edited: the range a caller gets is where the control is now.
1104
- */
1105
- getRange(rangeLocation?: 'Whole' | 'Start' | 'End' | 'Before' | 'After' | 'Content'): Range;
1106
- /**
1107
- * Write the control's value.
1108
- *
1109
- * The refusals belong to the document, not to this method: a locked control, a control the file
1110
- * bound to custom XML, and a value the control's type does not accept are all refused by the
1111
- * engine's single write path, which is the same path a keystroke takes. {@link isBound} is an
1112
- * advisory preflight only; this sync-time check remains authoritative if the document changed
1113
- * after the flag was loaded.
1114
- */
1115
- setValue(value: ContentControlValue): void;
1116
- /**
1117
- * Put text into the control: over what it holds, or at one end of it.
1118
- * Supports text-like controls. Date, checkbox, and other typed controls refuse with NotSupported.
1119
- *
1120
- * `Replace` goes through the control's own value path, so the prompt it was showing and a
1121
- * `w:temporary` wrapper are dealt with there rather than a second time here. The range comes
1122
- * back from the WRITE and not from a read beside it: reads answer the document as it is when
1123
- * the batch is planned, so a read here would name the text the write was about to replace.
1124
- */
1125
- insertText(text: string, insertLocation: InsertLocation.replace | InsertLocation.start | InsertLocation.end | 'Replace' | 'Start' | 'End'): Range;
1126
- /**
1127
- * Remove the control.
1128
- *
1129
- * `keepContent` true is Word's own "Remove content control": the wrapper goes and the text it
1130
- * held stays exactly where it was. False takes the content with it.
1131
- */
1132
- delete(keepContent: boolean): void;
1133
- /** @internal Plan the read this object's `load(...)` asked for. */
1134
- protected onLoad(request: ResolvedLoadOptions): void;
1135
- }
1136
- /** Where a collection of controls looks: a story, or inside one control. */
1137
- type ContentControlScope = {
1138
- readonly body: AutomationHandle;
1139
- } | {
1140
- readonly contentControl: AutomationHandle;
1141
- };
1142
- /**
1143
- * 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.
1144
904
  *
1145
- * `getById` answers the first match in document order, because `w:id` is optional in OOXML and
1146
- * 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`.
1147
910
  *
1148
911
  * @public
1149
912
  */
1150
- declare class ContentControlCollection extends HandleCollection<ContentControl> {
913
+ declare class Font extends ModelObject {
1151
914
  #private;
1152
- /** @internal The controls of a scope, in document order. */
1153
- 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;
1154
917
  private constructor();
1155
- /** The first control. `ItemNotFound` at the sync if the scope holds none. */
1156
- getFirst(): ContentControl;
1157
- /** The first control, or an object that says `isNullObject` where there is none. */
1158
- 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);
1159
945
  /**
1160
- * The first control carrying one `w:id`, or `ItemNotFound` where the scope holds none.
946
+ * One read for every property asked for.
1161
947
  *
1162
- * FIRST in document order, because `w:id` is not unique. The lookup is one read answered by the
1163
- * host: matching it here would mean asking every control for its id and choosing locally, which
1164
- * 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.
1165
951
  */
1166
- getById(id: number): ContentControl;
1167
- /** Every control in the scope carrying one tag, in document order. */
1168
- getByTag(tag: string): ContentControlCollection;
1169
- /** Every control in the scope carrying one title, in document order. */
1170
- getByTitle(title: string): ContentControlCollection;
1171
- /** @internal The read that answers this collection's members. */
1172
- protected listing(): AutomationOperation;
1173
- /** @internal Build one member from an address the listing answered. */
1174
- protected itemAt(label: string, address: ObjectAddress): ContentControl;
1175
- /** @internal A member an edge accessor named before the sync that finds it. */
1176
- protected promised(label: string, nullable: boolean): ContentControl & PromisedItem;
952
+ protected onLoad(request: ResolvedLoadOptions): void;
1177
953
  }
1178
954
 
1179
955
  /**
@@ -1327,7 +1103,12 @@ declare class Comment extends CommentBase {
1327
1103
  *
1328
1104
  * The author is the one the request context was opened with: a reply records who wrote it, and
1329
1105
  * `CT_TrackChange` makes that mandatory, so a context with no author refuses here rather than
1330
- * 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.
1331
1112
  */
1332
1113
  reply(replyText: string): CommentReply;
1333
1114
  /** @internal Plan the read this object's `load(...)` asked for. */
@@ -1380,9 +1161,20 @@ declare class Revision extends ModelObject implements PromisedItem {
1380
1161
  get type(): RevisionType;
1381
1162
  /** The words the change covers. */
1382
1163
  get range(): Range;
1383
- /** 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
+ */
1384
1172
  accept(): void;
1385
- /** 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
+ */
1386
1178
  reject(): void;
1387
1179
  /** @internal Plan the read this object's `load(...)` asked for. */
1388
1180
  protected onLoad(request: ResolvedLoadOptions): void;
@@ -1546,6 +1338,8 @@ declare class Range extends ModelObject implements PromisedItem {
1546
1338
  static at(context: RequestContext, label: string, address: ObjectAddress): Range;
1547
1339
  /** @internal A range a queued operation will name, or report as nothing. */
1548
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;
1549
1343
  private constructor();
1550
1344
  /** @internal Bind this object to the address the owning read answered. */
1551
1345
  hydrateAddress(address: ObjectAddress): void;
@@ -1586,6 +1380,23 @@ declare class Range extends ModelObject implements PromisedItem {
1586
1380
  */
1587
1381
  get hyperlink(): string;
1588
1382
  set hyperlink(value: string);
1383
+ /**
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;
1589
1400
  /** The bookmarks whose text this range overlaps, in document order. */
1590
1401
  get bookmarks(): BookmarkCollection;
1591
1402
  /**
@@ -1655,6 +1466,74 @@ declare class Range extends ModelObject implements PromisedItem {
1655
1466
  get revisions(): RevisionCollection;
1656
1467
  /** Every occurrence of `searchText` inside this range, as ranges. */
1657
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>;
1658
1537
  /**
1659
1538
  * Write text at or over this range. Answers the range the written text occupies.
1660
1539
  * Await `context.sync()` before loading or addressing that returned range.
@@ -1669,17 +1548,29 @@ declare class Range extends ModelObject implements PromisedItem {
1669
1548
  * text (`edit.tracked-deleted-text-only`); another author's paragraph mark, formatting, move, or
1670
1549
  * structural change, or a link or content control inside their insertion
1671
1550
  * (`edit.tracked-foreign-revision-unsupported`); and your own pending change, including a
1672
- * range a tracked write returned (`edit.tracked-own-pending-change`). In a collaboration
1673
- * session, the API refuses strikes over another author's pending insertion or deletion,
1674
- * and edits that start inside or right after one, with `edit.tracked-foreign-revision-unsupported`. Font and paragraph
1675
- * formatting support property revisions.
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.
1676
1553
  * Empty text with `Replace` deletes the range; empty text at an insertion point is a no-op.
1677
1554
  * Agent tools that intend a replacement should validate non-empty model output first.
1678
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
+ *
1679
1564
  * `Before`/`Start` and `After`/`End` land at the SAME position here, and the difference Word
1680
1565
  * draws between them — whether the new text becomes part of this range — has no meaning for a
1681
1566
  * snapshot. Both pairs are accepted because source-compatible code uses all four; what a caller
1682
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}
1683
1574
  */
1684
1575
  insertText(text: string, insertLocation: InsertLocation | 'Replace' | 'Start' | 'End' | 'Before' | 'After'): Range;
1685
1576
  /**
@@ -1695,71 +1586,409 @@ declare class Range extends ModelObject implements PromisedItem {
1695
1586
  /** Clear this range's content, preserving the surrounding structure. */
1696
1587
  clear(): void;
1697
1588
  /**
1698
- * Create a top-level comment anchored to exactly this range.
1589
+ * Create a top-level comment anchored to exactly this range.
1590
+ *
1591
+ * The author is the identity the runtime was opened with. Empty comment text, a missing author,
1592
+ * stale endpoints, and ranges crossing a table-cell boundary are refused rather than authored
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}
1601
+ */
1602
+ insertComment(commentText: string): Comment;
1603
+ /**
1604
+ * Wrap this single-paragraph range in a rich-text, plain-text, or date-picker content control.
1605
+ * Await sync before configuring the returned control. Other types explicitly refuse.
1606
+ * TrackMineOnly supports nonempty ordinary text outside collaboration.
1607
+ * Existing revisions and empty tracked ranges refuse with NotSupported.
1608
+ */
1609
+ insertContentControl(contentControlType?: ContentControlType.richText | ContentControlType.plainText | ContentControlType.buildingBlockGallery | ContentControlType.checkBox | ContentControlType.comboBox | ContentControlType.datePicker | ContentControlType.dropDownList | ContentControlType.group | ContentControlType.picture | ContentControlType.repeatingSection | 'RichText' | 'PlainText' | 'BuildingBlockGallery' | 'CheckBox' | 'ComboBox' | 'DatePicker' | 'DropDownList' | 'Group' | 'Picture' | 'RepeatingSection'): ContentControl;
1610
+ /** Tables contained by this range, in document order. */
1611
+ get tables(): TableCollection;
1612
+ /** Fields fully contained within this range. */
1613
+ get fields(): FieldCollection;
1614
+ /**
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.
1621
+ */
1622
+ insertField(insertLocation: InsertLocation | 'Before' | 'After' | 'Start' | 'End' | 'Replace', fieldType?: FieldType, text?: string, removeFormatting?: boolean): Field;
1623
+ /**
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.
1630
+ */
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;
1640
+ /** Inline pictures fully contained within this snapshot range. */
1641
+ get inlinePictures(): InlinePictureCollection;
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
+ */
1649
+ insertInlinePictureFromBase64(base64EncodedImage: string, insertLocation: InsertLocation | 'Before' | 'After' | 'Start' | 'End' | 'Replace'): InlinePicture;
1650
+ /**
1651
+ * Line, page, and next-page section breaks are supported; other break types refuse at sync.
1652
+ * TrackMineOnly records a line break as a tracked insertion. Page and section breaks refuse
1653
+ * while tracking.
1654
+ */
1655
+ insertBreak(breakType: BreakType | 'Page' | 'SectionNext' | 'Next' | 'Line' | 'SectionContinuous' | 'SectionEven' | 'SectionOdd', insertLocation: InsertLocation.before | InsertLocation.after | 'Before' | 'After'): void;
1656
+ /**
1657
+ * Insert a rectangular table before or after this range.
1658
+ * TrackMineOnly records native row/cell insertions, including initial values.
1659
+ * Sync before configuring the returned table. Nested table authoring refuses.
1660
+ */
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.
1699
1789
  *
1700
- * The author is the identity the runtime was opened with. Empty comment text, a missing author,
1701
- * stale endpoints, and ranges crossing a table-cell boundary are refused rather than authored
1702
- * approximately. A collapsed range creates an insertion-point comment.
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.
1703
1792
  */
1704
- insertComment(commentText: string): Comment;
1793
+ getRange(rangeLocation?: 'Whole' | 'Start' | 'End' | 'Before' | 'After' | 'Content'): Range;
1705
1794
  /**
1706
- * Wrap this single-paragraph range in a rich-text, plain-text, or date-picker content control.
1707
- * Await sync before configuring the returned control. Other types explicitly refuse.
1708
- * TrackMineOnly supports nonempty ordinary text outside collaboration.
1709
- * Existing revisions and empty tracked ranges refuse with NotSupported.
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.
1710
1802
  */
1711
- insertContentControl(contentControlType?: ContentControlType.richText | ContentControlType.plainText | ContentControlType.buildingBlockGallery | ContentControlType.checkBox | ContentControlType.comboBox | ContentControlType.datePicker | ContentControlType.dropDownList | ContentControlType.group | ContentControlType.picture | ContentControlType.repeatingSection | 'RichText' | 'PlainText' | 'BuildingBlockGallery' | 'CheckBox' | 'ComboBox' | 'DatePicker' | 'DropDownList' | 'Group' | 'Picture' | 'RepeatingSection'): ContentControl;
1712
- /** Tables contained by this range, in document order. */
1713
- get tables(): TableCollection;
1714
- /** Fields fully contained within this range. */
1715
- get fields(): FieldCollection;
1803
+ setValue(value: ContentControlValue): void;
1716
1804
  /**
1717
- * Insert PAGE, NUMPAGES, or an inert TOC field with supported switches.
1718
- * TOC entries are not calculated. Tracked field insertion refuses.
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.
1719
1812
  */
1720
- insertField(insertLocation: InsertLocation | 'Before' | 'After' | 'Start' | 'End' | 'Replace', fieldType?: FieldType, text?: string, removeFormatting?: boolean): Field;
1813
+ insertText(text: string, insertLocation: InsertLocation.replace | InsertLocation.start | InsertLocation.end | 'Replace' | 'Start' | 'End'): Range;
1721
1814
  /**
1722
- * Insert PAGE, NUMPAGES, or an inert TOC field with supported switches.
1723
- * TOC entries are not calculated. Tracked field insertion refuses.
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.
1724
1819
  */
1725
- insertField(insertLocation: InsertLocation | 'Before' | 'After' | 'Start' | 'End' | 'Replace', fieldType?: FieldTypeLiteral, text?: string, removeFormatting?: boolean): Field;
1726
- /** Inline pictures fully contained within this snapshot range. */
1727
- get inlinePictures(): InlinePictureCollection;
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;
1728
1851
  /**
1729
- * Insert a bounded PNG/JPEG image. Sync before configuring the returned picture.
1852
+ * The first control carrying one `w:id`, or `ItemNotFound` where the scope holds none.
1730
1853
  *
1731
- * Works on server, browser, and collaborative runtimes; on a collaborative runtime the
1732
- * picture, its media part, and its relationship replicate to every participant. Insertion
1733
- * must be the only mutation in its sync, and tracking refuses it.
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.
1734
1857
  */
1735
- insertInlinePictureFromBase64(base64EncodedImage: string, insertLocation: InsertLocation | 'Before' | 'After' | 'Start' | 'End' | 'Replace'): InlinePicture;
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;
1736
1917
  /**
1737
- * Line, page, and next-page section breaks are supported; other break types refuse at sync.
1738
- * TrackMineOnly records a line break as a tracked insertion. Page and section breaks refuse
1739
- * while tracking.
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`.
1740
1925
  */
1741
- insertBreak(breakType: BreakType | 'Page' | 'SectionNext' | 'Next' | 'Line' | 'SectionContinuous' | 'SectionEven' | 'SectionOdd', insertLocation: InsertLocation.before | InsertLocation.after | 'Before' | 'After'): void;
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;
1742
1952
  /**
1743
- * Insert a rectangular table before or after this range.
1744
- * TrackMineOnly records native row/cell insertions, including initial values.
1745
- * Sync before configuring the returned table. Nested table authoring refuses.
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.
1746
1959
  */
1747
- insertTable(rowCount: number, columnCount: number, insertLocation: InsertLocation.before | InsertLocation.after | 'Before' | 'After', values?: string[][]): Table;
1748
- /** Add a paragraph before or after the one this range starts or ends in. */
1749
- insertParagraph(paragraphText: string, insertLocation: InsertLocation.before | InsertLocation.after | 'Before' | 'After'): Paragraph;
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();
1750
1984
  /**
1751
- * Put the reader's selection on this range and navigate the editor viewport to it.
1752
- *
1753
- * The whole range is selected by default. `Start` and `End` instead collapse the caret to that
1754
- * endpoint and reveal it. An already-visible endpoint stays still; an offscreen one is brought
1755
- * 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.
1756
1986
  *
1757
- * Refused with `NotSupported` where there is no reader — a document opened from bytes on a
1758
- * server has no caret or viewport, and moving one would be a claim about a screen nobody is
1759
- * looking at. The check is at the CALL rather than at the sync, so the mistake is reported where
1760
- * 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.
1761
1989
  */
1762
- select(selectionMode_?: SelectionMode): void;
1990
+ get level(): number;
1991
+ set level(value: number);
1763
1992
  /** @internal Plan the read this object's `load(...)` asked for. */
1764
1993
  protected onLoad(request: ResolvedLoadOptions): void;
1765
1994
  }
@@ -1803,6 +2032,14 @@ declare class Paragraph extends ModelObject implements PromisedItem {
1803
2032
  hydrateNull(): void;
1804
2033
  /** This paragraph's text. Readable after `load('text')` and a `sync()`. */
1805
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;
1806
2043
  /**
1807
2044
  * The document's own identity for this paragraph.
1808
2045
  *
@@ -1881,6 +2118,31 @@ declare class Paragraph extends ModelObject implements PromisedItem {
1881
2118
  * same `context.sync()` that finds it.
1882
2119
  */
1883
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>;
1884
2146
  /** Start a new independent bullet list with this paragraph. Sync before using the returned list. */
1885
2147
  startNewList(): List;
1886
2148
  /** Join an existing list at a zero-based nesting level. */
@@ -1910,7 +2172,12 @@ declare class Paragraph extends ModelObject implements PromisedItem {
1910
2172
  * decision. A refusal refuses the whole sync.
1911
2173
  */
1912
2174
  delete(): void;
1913
- /** 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
+ */
1914
2181
  insertText(text: string, insertLocation: InsertLocation.replace | InsertLocation.start | InsertLocation.end | 'Replace' | 'Start' | 'End'): Range;
1915
2182
  /** Add a paragraph beside this one. Answers the new paragraph. */
1916
2183
  insertParagraph(paragraphText: string, insertLocation: 'Before' | 'After'): Paragraph;
@@ -2272,7 +2539,8 @@ declare class Document extends ModelObject {
2272
2539
  /**
2273
2540
  * The tracked changes of the main-body story that this API can publish as typed objects.
2274
2541
  *
2275
- * 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.
2276
2544
  * `acceptAll` / `rejectAll` still resolve every store-resolvable revision in the main body
2277
2545
  * and refuse atomically if any `readOnly` or otherwise unsupported revision remains. Header,
2278
2546
  * footer, and note revisions live on those stories' own `Body.revisions` collections.
@@ -2341,14 +2609,23 @@ type DocxEditorErrorCode =
2341
2609
  | 'ResourceLimitExceeded'
2342
2610
  /** The collection has no such item — `getFirst()` on an empty one. */
2343
2611
  | 'ItemNotFound'
2344
- /** 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
+ */
2345
2620
  | 'NotSupported'
2346
2621
  /**
2347
- * 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.
2348
2625
  *
2349
- * Distinct from `NotSupported`, which is about the HOST: a headless document really has no
2350
- * caret, and no version of this library will give it one. This code means the library, not the
2351
- * 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.
2352
2629
  */
2353
2630
  | 'NotImplemented'
2354
2631
  /**
@@ -2734,10 +3011,13 @@ interface RunOptions {
2734
3011
  * Pass the handle `editor.beginHistoryGroup()` returns, unchanged.
2735
3012
  *
2736
3013
  * Browser runtime only. A server or collaborative runtime refuses the run with
2737
- * `NotSupported` before the callback starts. A closed handle, or a handle from another
2738
- * editor, refuses with `InvalidArgument` and `target: 'historyGroup'` before the callback
2739
- * starts. A handle that closes during the run refuses the next `context.sync()` the same way,
2740
- * and that sync writes nothing. Runs without this option never join a group.
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.
2741
3021
  *
2742
3022
  * The run has no `ExecResult`. The whole run is one write of the group: after the callback
2743
3023
  * finishes, `historyGroup.lastOutcome` holds its outcome, which is `split` if any sync split
@@ -3366,7 +3646,12 @@ declare class Body extends ModelObject {
3366
3646
  search(searchText: string, options?: SearchOptions): RangeCollection;
3367
3647
  /** Empty the story, leaving one empty paragraph behind. */
3368
3648
  clear(): void;
3369
- /** 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
+ */
3370
3655
  insertText(text: string, insertLocation: InsertLocation.replace | InsertLocation.start | InsertLocation.end | 'Replace' | 'Start' | 'End'): Range;
3371
3656
  /** Add a paragraph at the start or the end of the story. Answers the new paragraph. */
3372
3657
  insertParagraph(paragraphText: string, insertLocation: InsertLocation.start | InsertLocation.end | 'Start' | 'End'): Paragraph;
@@ -3627,5 +3912,5 @@ interface CreateServerOptions {
3627
3912
  /** Options for {@link createCollaborative}. @public */
3628
3913
  type CreateCollaborativeOptions = CreateServerOptions;
3629
3914
 
3630
- export { ListNumbering as $, Alignment as A, DocumentProperties as E, DocxEditorError as I, Field as O, FieldCollection as P, FieldType as Q, Font as S, InlinePicture as U, InlinePictureCollection as V, InsertLocation as W, List as X, ListBullet as Y, ListCollection as Z, ListItem as _, NoteItem as a2, NoteItemCollection as a3, PageOrientation as a5, PageSetup as a6, Paragraph as a7, ParagraphCollection as a9, TableCell as aA, TableCellCollection as aB, TableCollection as aC, TableRow as aD, TableRowCollection as aE, TrackedObjects as aF, UnderlineType as aG, VerticalAlignment as aH, getReviewItemRange as aI, getReviewItemRangeOrNullObject as aJ, getReviewItemRevisions as aK, isDocxEditorError as aL, Range as ad, RangeCollection as ae, RemoveDocInfoType as ag, RequestContext as ah, Revision as ai, RevisionCollection as al, Section as as, SectionCollection as at, Shape as aw, ShapeCollection as ax, ShapeType as ay, Table 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 p, ContentControlCollection as q, ContentControlType as t, Document as v };
3631
- export type { BesideLocation as B, CreateServerOptions as C, DocxEditorServerRuntime as D, DocumentXmlLimits as F, DocumentZipLimits as G, DocxEditorDebugInfo as H, DocxEditorErrorCode as J, DocxEditorErrorInit as K, DocxEditorInnerError as L, DocxEditorRuntime as M, EditorModule as N, FieldTypeLiteral as R, HeaderFooterType as T, CreateCollaborativeOptions as a, LoadOption as a0, LoadQueryOptions as a1, NoteItemType as a4, ParagraphAlignment as a8, ParagraphInsertTextLocation as aa, ParagraphReadingOrder as ab, PreviewCallback as ac, RangeInsertTextLocation as af, RevisionAuthorOptions as aj, RevisionAuthorSelection as ak, RevisionTextView as am, RevisionType as an, RunCallback as ao, RunOptions as ap, RuntimeDiagnostic as aq, SearchOptions as ar, SelectionMode as au, ServerPaginationOptions as av, BodyInsertParagraphLocation as c, BodyInsertTextLocation as d, CommitPreviewOptions as o, ContentControlLockState as r, ContentControlSubtype as s, ContentControlValue as u, DocumentCapabilities as w, DocumentLimits as x, DocumentPreview as y, DocumentPreviewStatus 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 };