@docx-editor.dev/core 2.10.0 → 2.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/dist/automation.cjs +1 -1
  2. package/dist/automation.d.cts +14 -5
  3. package/dist/automation.d.ts +14 -5
  4. package/dist/automation.js +1 -1
  5. package/dist/binding.cjs +1 -1
  6. package/dist/binding.d.cts +12 -11
  7. package/dist/binding.d.ts +12 -11
  8. package/dist/binding.js +1 -1
  9. package/dist/chunk-34BNQUD4.js +10 -0
  10. package/dist/chunk-5AVHO75P.cjs +19 -0
  11. package/dist/chunk-6HMSC7UV.js +2 -0
  12. package/dist/chunk-6JIJOZDW.js +1 -0
  13. package/dist/chunk-76Y3Y45J.cjs +2 -0
  14. package/dist/chunk-BP7ANXGA.js +1 -0
  15. package/dist/chunk-BTQKU64Q.cjs +1 -0
  16. package/dist/chunk-CRZR6K5Z.js +19 -0
  17. package/dist/chunk-D5EHDHYV.js +1 -0
  18. package/dist/chunk-EJATEGJZ.cjs +1 -0
  19. package/dist/{chunk-PSZH2VXP.js → chunk-GOEBQ26R.js} +1 -1
  20. package/dist/chunk-GRDFEH5Q.cjs +2 -0
  21. package/dist/chunk-GWV65NQW.cjs +10 -0
  22. package/dist/chunk-GXLZCXEH.js +2 -0
  23. package/dist/chunk-JUQOPVSK.cjs +2 -0
  24. package/dist/chunk-LAETEBHD.js +1 -0
  25. package/dist/chunk-M6Z3KFXM.cjs +5 -0
  26. package/dist/{chunk-YMYCPY5Y.cjs → chunk-OHJQ7GPZ.cjs} +1 -1
  27. package/dist/chunk-UQFOYZJO.cjs +18 -0
  28. package/dist/chunk-WPQMPHNR.cjs +1 -0
  29. package/dist/chunk-WXQ245MQ.js +18 -0
  30. package/dist/chunk-WZHIFNSU.js +5 -0
  31. package/dist/chunk-X7A5XART.js +2 -0
  32. package/dist/chunk-ZKWRCLT2.cjs +1 -0
  33. package/dist/collaboration/replication.cjs +1 -0
  34. package/dist/collaboration/replication.d.cts +216 -0
  35. package/dist/collaboration/replication.d.ts +216 -0
  36. package/dist/collaboration/replication.js +1 -0
  37. package/dist/collaboration.cjs +1 -0
  38. package/dist/collaboration.d.cts +176 -0
  39. package/dist/collaboration.d.ts +176 -0
  40. package/dist/collaboration.js +1 -0
  41. package/dist/contracts/editor.cjs +1 -1
  42. package/dist/contracts/editor.d.cts +8 -9
  43. package/dist/contracts/editor.d.ts +8 -9
  44. package/dist/contracts/editor.js +1 -1
  45. package/dist/contracts/interaction.d.cts +8 -9
  46. package/dist/contracts/interaction.d.ts +8 -9
  47. package/dist/contracts/modules.cjs +1 -1
  48. package/dist/contracts/modules.d.cts +21 -8
  49. package/dist/contracts/modules.d.ts +21 -8
  50. package/dist/contracts/modules.js +1 -1
  51. package/dist/custom-node-writes-CwkYRw3V.d.cts +310 -0
  52. package/dist/custom-node-writes-JfTn-Sy6.d.ts +310 -0
  53. package/dist/document-properties-D6Ahr8D6.d.cts +28 -0
  54. package/dist/document-properties-D6Ahr8D6.d.ts +28 -0
  55. package/dist/{editor-C0my6Uta.d.ts → editor-BogcVHXk.d.ts} +145 -49
  56. package/dist/{editor-CwzY2Hcg.d.cts → editor-C8edZgy5.d.cts} +145 -49
  57. package/dist/editor.cjs +1 -1
  58. package/dist/editor.css +1 -7299
  59. package/dist/editor.d.cts +26 -25
  60. package/dist/editor.d.ts +26 -25
  61. package/dist/editor.js +1 -1
  62. package/dist/failure-BnGjoXf0.d.cts +64 -0
  63. package/dist/failure-BnGjoXf0.d.ts +64 -0
  64. package/dist/{index-kID8Ymkp.d.ts → index-BNv-ZLQP.d.ts} +262 -81
  65. package/dist/{index-nLFwo_17.d.cts → index-Dn0lOp9Z.d.cts} +262 -81
  66. package/dist/index.cjs +1 -1
  67. package/dist/index.d.cts +19 -18
  68. package/dist/index.d.ts +19 -18
  69. package/dist/index.js +1 -1
  70. package/dist/layout.cjs +1 -1
  71. package/dist/layout.d.cts +71 -53
  72. package/dist/layout.d.ts +71 -53
  73. package/dist/layout.js +1 -1
  74. package/dist/{note-properties-jvnw_DGG.d.ts → note-properties-BmoSdyKS.d.ts} +1 -1
  75. package/dist/{note-properties-CQlxjic_.d.cts → note-properties-BvGfHk5e.d.cts} +1 -1
  76. package/dist/{omml-equation-Dd3mBep-.d.ts → omml-equation-Ciq5rgb7.d.ts} +1 -1
  77. package/dist/{omml-equation-BD-LsmWE.d.cts → omml-equation-CqQOt_dD.d.cts} +1 -1
  78. package/dist/output.cjs +1 -1
  79. package/dist/output.d.cts +6 -8
  80. package/dist/output.d.ts +6 -8
  81. package/dist/output.js +1 -1
  82. package/dist/{protocol-UuZOcOp7.d.cts → protocol-BB-WP3zk.d.cts} +2 -2
  83. package/dist/{protocol-C7ahrdUx.d.ts → protocol-Ckl7hWsv.d.ts} +2 -2
  84. package/dist/{review-items-Dw-8a6Ie.d.ts → review-items-BdeLNRi2.d.cts} +1 -2
  85. package/dist/{review-items-CwixiHNe.d.cts → review-items-CkYyXhXM.d.ts} +1 -2
  86. package/dist/{review-reads-BqkiJTeR.d.cts → review-reads-BOLSBm5w.d.cts} +2 -2
  87. package/dist/{review-reads-C0u-IKEA.d.ts → review-reads-Crf0Xn42.d.ts} +2 -2
  88. package/dist/{revision-projection-CILpvv4M.d.ts → revision-projection-Ae2CWa8E.d.ts} +1 -1
  89. package/dist/{revision-projection-Cc4wz30g.d.cts → revision-projection-C2S8PSQm.d.cts} +1 -1
  90. package/dist/{semantic-cell-selection-DT9x9WLf.d.cts → semantic-cell-selection-C0OFD4D9.d.cts} +4 -4
  91. package/dist/{semantic-cell-selection-Utrf0lz7.d.ts → semantic-cell-selection-DdmoxC-y.d.ts} +4 -4
  92. package/dist/{semantic-interaction-B6hFRQLy.d.ts → semantic-interaction-COyhZ9WH.d.ts} +1 -1
  93. package/dist/{semantic-interaction-Z0xKQcB4.d.cts → semantic-interaction-Cs2jErnt.d.cts} +1 -1
  94. package/dist/{semantic-paint-CQEOC0Od.d.cts → semantic-paint-UHaj3sBY.d.cts} +2 -2
  95. package/dist/{semantic-paint-quke354p.d.ts → semantic-paint-vA-oLSdV.d.ts} +2 -2
  96. package/dist/{semantic-records-Do3-i5oB.d.ts → semantic-records-5AOQJmLX.d.cts} +5 -4
  97. package/dist/{semantic-records-CMakzQ1X.d.cts → semantic-records-9xhwbJ23.d.ts} +5 -4
  98. package/dist/{shaped-measurer-DzRwWrL5.d.cts → shaped-measurer-NeF2mPSu.d.cts} +1 -1
  99. package/dist/{shaped-measurer-BxwTUluj.d.ts → shaped-measurer-vzsY88oK.d.ts} +1 -1
  100. package/dist/store.cjs +1 -1
  101. package/dist/store.d.cts +74 -16
  102. package/dist/store.d.ts +74 -16
  103. package/dist/store.js +1 -1
  104. package/dist/{tree-op-types-DSJYmf5b.d.cts → tree-op-types-BPyXNxyL.d.cts} +1247 -10
  105. package/dist/{tree-op-types-BuOfCrkp.d.ts → tree-op-types-DnzAOnc9.d.ts} +1247 -10
  106. package/dist/{custom-node-writes-BvpWCnW8.d.ts → tree-package-fragment-BjZ3RWAS.d.cts} +107 -322
  107. package/dist/{custom-node-writes-Db8H6Z3n.d.cts → tree-package-fragment-CDER0G3B.d.ts} +107 -322
  108. package/dist/{tree-session-contract-C1dfE9hy.d.ts → tree-session-contract-BF2FVBOM.d.cts} +16 -10
  109. package/dist/{tree-session-contract-ByWx8eew.d.cts → tree-session-contract-DhdsFT_z.d.ts} +16 -10
  110. package/dist/{tree-store-ASBtz7UB.d.ts → tree-store-CNZ3O83s.d.ts} +130 -25
  111. package/dist/{tree-store-CWOUMGN8.d.cts → tree-store-DfZi7FqY.d.cts} +130 -25
  112. package/package.json +14 -3
  113. package/dist/chunk-27APDXY2.js +0 -2
  114. package/dist/chunk-35MI6K7M.cjs +0 -10
  115. package/dist/chunk-4XL7SOWQ.cjs +0 -2
  116. package/dist/chunk-6K6QQVAZ.cjs +0 -18
  117. package/dist/chunk-7VQ7YLW3.cjs +0 -1
  118. package/dist/chunk-7ZJL5AEY.cjs +0 -1
  119. package/dist/chunk-C6LK2BYA.cjs +0 -2
  120. package/dist/chunk-GQQOL4PV.js +0 -1
  121. package/dist/chunk-HBEBUCRM.cjs +0 -5
  122. package/dist/chunk-LG5K46OM.js +0 -2
  123. package/dist/chunk-LWADHMVV.js +0 -5
  124. package/dist/chunk-N725IUO7.js +0 -18
  125. package/dist/chunk-N7DBENH4.js +0 -10
  126. package/dist/chunk-NVGFWMCO.js +0 -1
  127. package/dist/chunk-SYTWKJPJ.cjs +0 -18
  128. package/dist/chunk-YI6JXF7U.js +0 -18
  129. package/dist/hf-references-Dvk6De4Q.d.cts +0 -70
  130. package/dist/hf-references-z5Y4N1ab.d.ts +0 -70
  131. package/dist/note-nodes-BNCANoGN.d.ts +0 -108
  132. package/dist/note-nodes-DL-Au22P.d.cts +0 -108
  133. package/dist/ooxml-package-CdEy9ufK.d.cts +0 -1222
  134. package/dist/ooxml-package-CdEy9ufK.d.ts +0 -1222
  135. package/dist/tree-op-revision-attribution-CN06Xshv.d.cts +0 -24
  136. package/dist/tree-op-revision-attribution-CN06Xshv.d.ts +0 -24
@@ -1,9 +1,5 @@
1
- import { c as OoxmlPackage, O as OoxmlPart, a as OoxmlNode } from './ooxml-package-CdEy9ufK.cjs';
2
- import { c as SupportedImageMime, j as ImageDecodePort, k as DrawingTreeDocOp, a as TreeOpRejection, T as TreeDocOp } from './tree-op-types-DSJYmf5b.cjs';
3
- import { a as RevisionAttributionInput } from './tree-op-revision-attribution-CN06Xshv.cjs';
4
- import { c as HeaderFooterKind, H as HeaderFooterVariant } from './hf-references-Dvk6De4Q.cjs';
5
- import { N as NoteKind } from './note-nodes-DL-Au22P.cjs';
6
- import { T as TreeModelChange, a as TreeStoryRef, b as TreeDocumentStore, c as TransactionContext, d as TransactOptions, S as SelectionMark, e as TreeDocumentCheckpoint } from './tree-store-CWOUMGN8.cjs';
1
+ import { b as OoxmlPackage, y as SupportedImageMime, O as OoxmlPart, a as OoxmlNode, g as OoxmlElement, E as RevisionAttributionInput, C as ImageDecodePort, F as DrawingTreeDocOp, r as TreeOpRejection, T as TreeDocOp } from './tree-op-types-DnzAOnc9.js';
2
+ import { N as NoteKind, T as TreeModelChange, a as TreeDocumentStore, c as TreeStoryRef, d as TransactionContext, b as TransactOptions, S as SelectionMark, e as TreeDocumentCheckpoint } from './tree-store-CNZ3O83s.js';
7
3
 
8
4
  /** A freshly allocated drawing property id, or the reason one could not be minted. */
9
5
  type DrawingPropertyIdResult = {
@@ -18,8 +14,13 @@ type DrawingPropertyIdResult = {
18
14
  *
19
15
  * Package-wide rather than per-part: Word treats these ids as document-global, and a collision
20
16
  * makes it renumber on open.
17
+ *
18
+ * Solo: `highest + 1`, the dense sequence Word writes. With a collaboration actor bound —
19
+ * explicit argument, or the open store transaction — the id is the next unused value in that
20
+ * actor's stripe. Two peers inserting a picture from one snapshot otherwise both mint `id="1"`,
21
+ * and the merged document carries two drawings under one document-global id.
21
22
  */
22
- declare function allocateDrawingPropertyId(pkg: OoxmlPackage): DrawingPropertyIdResult;
23
+ declare function allocateDrawingPropertyId(pkg: OoxmlPackage, actorId?: string): DrawingPropertyIdResult;
23
24
  /**
24
25
  * Store raw bytes for a part and declare its exact content type.
25
26
  *
@@ -62,103 +63,72 @@ interface ExternalImageFetchPort {
62
63
  }>>;
63
64
  }
64
65
 
65
- /** Which of a family's four faces an embedded font relationship supplies. */
66
- type FontStyleKey = 'regular' | 'bold' | 'italic' | 'boldItalic';
66
+ /** `w:headerReference w:type` vocabulary (ECMA-376 §17.10.5): default, first page, even pages. */
67
+ type HeaderFooterVariant = 'default' | 'first' | 'even';
68
+ /** Header vs footer region kind for chrome and lifecycle ops. */
69
+ type HeaderFooterKind = 'header' | 'footer';
70
+ /**
71
+ * A section's resolved header and footer parts, by variant.
72
+ *
73
+ * The `even` variant is only honoured when `w:evenAndOddHeaders` is set in settings.xml —
74
+ * without it Word ignores an authored even header, and so does this.
75
+ */
76
+ interface HeaderFooterParts {
77
+ readonly headers: ReadonlyMap<HeaderFooterVariant, OoxmlPart>;
78
+ readonly footers: ReadonlyMap<HeaderFooterVariant, OoxmlPart>;
79
+ /** `w:evenAndOddHeaders` in settings.xml — without it the `even` variant is ignored. */
80
+ readonly evenAndOddHeaders: boolean;
81
+ /** Whether this section enables first-page header/footer furniture (`w:titlePg`). */
82
+ readonly titlePage: boolean;
83
+ }
67
84
  /**
68
- * One font whose bytes travel inside the package.
85
+ * One resolved furniture slot with enough metadata for "Same as previous" chrome.
69
86
  *
70
- * The family name is the DOCUMENT's and is not validated — it is attacker-controlled, so it is
71
- * escaped into CSS and never registered globally on `document.fonts`, where it would shadow the
72
- * host application's own fonts.
87
+ * `inherited: true` means this section has no declared reference for the slot and the
88
+ * part comes from a predecessor. The first section never reports inherited — omitting a
89
+ * ref there is blank furniture, not inheritance from a later section.
73
90
  */
74
- interface EmbeddedFont {
75
- /** The family as the document names it. Not validated against anything. */
76
- readonly family: string;
77
- readonly style: FontStyleKey;
78
- /** Deobfuscated bytes, ready to be offered to a font validator. */
79
- readonly bytes: Uint8Array;
80
- /** The part they came from, for diagnostics. */
91
+ interface HeaderFooterSlotMeta {
92
+ readonly part: OoxmlPart;
81
93
  readonly partName: string;
94
+ readonly rId: string;
95
+ readonly inherited: boolean;
82
96
  }
83
- /**
84
- * Undo Word's embedded-font obfuscation (ECMA-376 Part 4 §2.8.1).
85
- *
86
- * The key is the `w:fontKey` GUID's 16 bytes in REVERSED order — not the per-group
87
- * little-endian reading a GUID usually gets. It is XORed over the first 32 bytes of the
88
- * part, applied twice. Getting the order wrong produces a font that looks corrupt rather
89
- * than obfuscated, which is indistinguishable from a damaged file at the point it fails.
90
- *
91
- * Pure XOR, so the same operation obfuscates and deobfuscates.
92
- */
93
- declare function deobfuscateFont(bytes: Uint8Array, fontKey: string): Uint8Array | null;
94
- /** Limits and instrumentation for reading embedded fonts out of a package. */
95
- interface ReadEmbeddedFontsOptions {
96
- /** Refuse a font part larger than this. Defaults to 16 MB. */
97
- readonly maxFontBytes?: number;
98
- /** Refuse more than this many fonts. Defaults to 64. */
99
- readonly maxFonts?: number;
97
+ /** Per-section resolution including declared-vs-inherited metadata. */
98
+ interface HeaderFooterSectionResolution {
99
+ readonly headers: ReadonlyMap<HeaderFooterVariant, HeaderFooterSlotMeta>;
100
+ readonly footers: ReadonlyMap<HeaderFooterVariant, HeaderFooterSlotMeta>;
101
+ readonly evenAndOddHeaders: boolean;
102
+ readonly titlePage: boolean;
100
103
  }
101
104
  /**
102
- * Every font the package embeds, deobfuscated.
105
+ * `w:sectPr` nodes in section order, aligned with layout's `enumerateDocumentSections`.
103
106
  *
104
- * Silently skips anything malformed rather than rejecting the document: a broken font table
105
- * is a reason to fall back to substitution, never a reason to refuse to open the file.
107
+ * `null` means a section with no `w:sectPr` node (Word defaults, inherits HF from previous).
108
+ * Paragraph-level breaks first; the final entry covers remaining blocks (body-level or null).
106
109
  */
107
- declare function readEmbeddedFonts(pkg: OoxmlPackage, fontTable: OoxmlPart | undefined, options?: ReadEmbeddedFontsOptions): EmbeddedFont[];
108
-
109
- /** The two list kinds a toolbar offers. */
110
- type ListKind = 'bullet' | 'ordered';
111
- interface EnsuredListDefinition {
112
- readonly pkg: OoxmlPackage;
113
- /** The `w:numId` a paragraph's `w:numPr` should name. */
114
- readonly numId: string;
115
- }
110
+ declare function collectSectionPropertyNodes(root: OoxmlNode): Array<OoxmlElement | null>;
116
111
  /**
117
- * Find or create a list definition of `kind`, returning the package that holds it.
112
+ * Resolve header/footer parts for every section with declared-vs-inherited metadata.
118
113
  *
119
- * An existing abstract definition of the same kind is reused, but every disconnected list
120
- * gets a fresh `w:num` instance. Counters belong to `w:num`, so reusing that instance would
121
- * continue an earlier list. Returns null only when the part cannot be built at all.
114
+ * Index aligns with `enumerateDocumentSections` in the layout package. Existing merged
115
+ * maps stay available via {@link resolveHeaderFooterPartsBySection}.
122
116
  */
123
- declare function ensureListDefinition(pkg: OoxmlPackage, kind: ListKind): EnsuredListDefinition | null;
117
+ declare function resolveHeaderFooterResolutionBySection(pkg: OoxmlPackage): readonly HeaderFooterSectionResolution[];
124
118
  /**
125
- * Declare `level` in the definition `numId` names, with Word's default format for that
126
- * level, or refuse.
119
+ * Resolve header/footer parts for every section, applying OOXML inheritance.
127
120
  *
128
- * Word never greys Increase Indent out on a list item: demoting past the deepest level a
129
- * `w:abstractNum` declares makes Word DEFINE the level, cycling its stock bullets
130
- * (Symbol •, Courier `o`, Wingdings ▪) or number formats (decimal, lowerLetter,
131
- * lowerRoman) by depth. This is that write. An already-declared level returns the package
132
- * unchanged, so callers may ask first and act second without a second lookup.
133
- *
134
- * A delegating definition (`w:numStyleLink`, 17.9.21) is refused: its levels live on the
135
- * linked style's definition, and a `w:lvl` grafted here would be shadowed the moment the
136
- * link resolves.
121
+ * Index aligns with `enumerateDocumentSections` in the layout package.
137
122
  */
138
- declare function ensureNumberingLevel(pkg: OoxmlPackage, numId: string, level: number, kind: ListKind): OoxmlPackage | null;
139
-
140
- /** One bookmark's name and the range its marker pair currently encloses. */
141
- interface BookmarkAnchor {
142
- readonly name: string;
143
- /** Canonical node id of the paragraph the marker sits in. */
144
- readonly paragraphId: string;
145
- /** UTF-16 offset within that paragraph, in `paragraphTextOf`'s vocabulary. */
146
- readonly offset: number;
147
- }
148
- /** Bookmarks by name. A name the document declares twice resolves to the first in order. */
149
- type BookmarkIndex = ReadonlyMap<string, BookmarkAnchor>;
123
+ declare function resolveHeaderFooterPartsBySection(pkg: OoxmlPackage): readonly HeaderFooterParts[];
150
124
  /**
151
- * Build `name -> position` for every bookmark start in a part, in document order.
125
+ * Resolve the main-document header/footer references to their parts, gated by the
126
+ * settings the section actually declares.
152
127
  *
153
- * FIRST IN DOCUMENT ORDER WINS on a duplicate name. Word treats a repeated bookmark name as
154
- * the same bookmark and jumps to the first, and the alternative — last-wins — makes a jump
155
- * target move when an edit far away happens to duplicate a name.
156
- *
157
- * The offset is measured the way the ops measure: text of the runs before the marker inside
158
- * its own paragraph, hyperlink runs included, so the position a jump places the caret at is a
159
- * position `setSelection` accepts.
128
+ * Returns the FINAL section's effective parts (after inheritance). Multi-section hosts
129
+ * should prefer `resolveHeaderFooterPartsBySection`.
160
130
  */
161
- declare function buildBookmarkIndex(part: OoxmlPart): BookmarkIndex;
131
+ declare function resolveHeaderFooterParts(pkg: OoxmlPackage): HeaderFooterParts;
162
132
 
163
133
  /** Lifecycle impact — furniture always reaches multiple pages; never narrower than flow-structural. */
164
134
  type HeaderFooterLifecycleImpact = 'flow-structural' | 'global';
@@ -429,26 +399,6 @@ interface CascadeDeletedNoteReferencesOptions {
429
399
  */
430
400
  declare function cascadeDeletedNoteReferences(before: OoxmlPackage, after: OoxmlPackage, options?: CascadeDeletedNoteReferencesOptions): OoxmlPackage | null;
431
401
 
432
- /** What the document asks for. Every field defaults to "the document said nothing". */
433
- interface DocumentTrackingSettings {
434
- /** `w:trackRevisions` — the document asks for edits to be tracked. */
435
- readonly trackRevisions: boolean;
436
- /**
437
- * `w:documentProtection/@w:edit="trackedChanges"` — tracking may not be turned OFF.
438
- *
439
- * Advisory. Presenting it as enforcement would be a lie about a file anyone can edit.
440
- */
441
- readonly restrictedToTrackedChanges: boolean;
442
- /** `w:doNotTrackMoves` — write a move as a delete and an insert. */
443
- readonly doNotTrackMoves: boolean;
444
- /** `w:doNotTrackFormatting` — apply formatting without recording a `w:rPrChange`. */
445
- readonly doNotTrackFormatting: boolean;
446
- }
447
- /** The frozen "nothing is tracked" settings — what a document with no `w:trackChanges` gets. */
448
- declare const NO_TRACKING_SETTINGS: DocumentTrackingSettings;
449
- /** Read the tracking settings from a `settings.xml` root, or the defaults when it has none. */
450
- declare function readTrackingSettings(settingsRoot: OoxmlNode | null | undefined): DocumentTrackingSettings;
451
-
452
402
  interface InsertImageInput {
453
403
  readonly paragraphId: string;
454
404
  readonly offset: number;
@@ -464,10 +414,22 @@ interface InsertImageInput {
464
414
  readonly hyperlink?: string;
465
415
  /** Present in suggesting mode: the inserted drawing's run goes into a `w:ins`. */
466
416
  readonly revision?: RevisionAttributionInput;
417
+ /**
418
+ * Collaboration actor for the ids this insert mints — `wp:docPr/@id`, the image
419
+ * relationship, and a hyperlink relationship when one is asked for.
420
+ *
421
+ * EXPLICIT, and not the ambient `runWithTransactionActor` binding, because this entry is
422
+ * async: the mint runs after `await validateEmbeddedImageForCommit` and the ambient actor
423
+ * is synchronous-only. A wrap around the call would compile, read as correct, and be gone
424
+ * by the time the id is taken. Omitted (solo) keeps Word's dense `highest + 1` sequence.
425
+ */
426
+ readonly actorId?: string;
467
427
  }
468
428
  interface ReplaceImageOptions {
469
429
  readonly expectedPackageRevision: number;
470
430
  readonly commitGuard?: () => boolean;
431
+ /** Collaboration actor for the replacement's minted ids. See {@link InsertImageInput.actorId}. */
432
+ readonly actorId?: string;
471
433
  }
472
434
  type ImageIntentResult = (Extract<PackageTransactResult, {
473
435
  ok: true;
@@ -483,6 +445,13 @@ interface ApplyImagePropertiesInput {
483
445
  readonly hyperlink: string | null;
484
446
  }
485
447
 
448
+ /** Attribution stamped on one remote canonical publication. */
449
+ interface RemotePackageAttribution {
450
+ readonly origin: string;
451
+ readonly actorId?: string;
452
+ readonly operationId?: string;
453
+ }
454
+
486
455
  type NoteCascadeFn = (before: OoxmlPackage, after: OoxmlPackage) => OoxmlPackage | null;
487
456
  /**
488
457
  * Editable story target.
@@ -573,13 +542,11 @@ declare class TreePackageStore {
573
542
  private compositionSession;
574
543
  private commitCounter;
575
544
  /**
576
- * Memo for {@link currentPackage}, keyed on the COMPLETE read set of that method by
577
- * object identity: the package shell, the body part, and each open story's part in
578
- * map order. Identity is the only sound key — `packageRevision` deliberately is not
579
- * part of it, because shell writes (`replacePackageShell`, story-store grafts, lazy
580
- * store opens) move `this.pkg` or a `store.part` without bumping the revision.
581
- * Packages and parts are frozen-immutable, so a matching tuple proves the merged
582
- * snapshot cannot differ; no explicit invalidation exists anywhere.
545
+ * Memo for {@link currentPackage}, keyed on that method's COMPLETE read set by object identity:
546
+ * the shell, the body part, and each open story's part in map order. Identity is the only sound
547
+ * key — `packageRevision` is excluded, because shell writes (`replacePackageShell`, story-store
548
+ * grafts, lazy opens) move `this.pkg` or a `store.part` without bumping it. Parts are frozen, so
549
+ * a matching tuple proves the snapshot cannot differ; nothing invalidates explicitly.
583
550
  */
584
551
  private currentPackageMemo;
585
552
  constructor(pkg: OoxmlPackage, main: OoxmlPart, options?: TreePackageStoreOptions);
@@ -619,6 +586,7 @@ declare class TreePackageStore {
619
586
  * cascades the note body in the same package undo unit.
620
587
  */
621
588
  transact(scope: StoryScope, build: (ctx: TransactionContext) => void, options?: Omit<TransactOptions, 'story' | 'minimumImpact'>): PackageTransactResult;
589
+ private commitStoryTransaction;
622
590
  /** Whether a package-wide IME composition session is open on any story. */
623
591
  compositionSessionOpen(): boolean;
624
592
  beginComposition(scope: StoryScope, selectionBefore?: SelectionMark | null): boolean;
@@ -629,6 +597,7 @@ declare class TreePackageStore {
629
597
  * restores the entire package atomically (parts, rels, content-types, settings).
630
598
  */
631
599
  applyLifecycleOp(op: HeaderFooterLifecycleOp | NoteLifecycleOp | TreeDocOp): PackageTransactResult;
600
+ private commitLifecycleOp;
632
601
  undo(): TreeModelChange | null;
633
602
  redo(): TreeModelChange | null;
634
603
  selectionForUndo(): SelectionMark | null;
@@ -639,9 +608,7 @@ declare class TreePackageStore {
639
608
  openedStoryCount(): number;
640
609
  /** See {@link openStoryTokenOf}. */
641
610
  openStoryToken(): string;
642
- /**
643
- * Insert a validated raster image as one package undo unit (task 12).
644
- */
611
+ /** Insert a validated raster image as one package undo unit (task 12). */
645
612
  insertImage(scope: StoryScope, input: InsertImageInput): Promise<ImageIntentResult>;
646
613
  /** Land a clipboard fragment (resource merge + blocks) as one package undo unit. */
647
614
  applyFragmentPaste(scope: StoryScope, input: FragmentPasteInput): FragmentPasteResult;
@@ -652,7 +619,7 @@ declare class TreePackageStore {
652
619
  /** Propose the deletion as a tracked change: the drawing goes into a `w:del`, media stays. */
653
620
  deleteImageTracked(scope: StoryScope, drawingNodeId: string, revision: RevisionAttributionInput): ImageIntentResult;
654
621
  /** Fetch external bytes explicitly and embed them; no fetch on open/load. */
655
- embedExternalImage(scope: StoryScope, drawingNodeId: string, url: string, port: ExternalImageFetchPort, signal: AbortSignal, decodePort: ImageDecodePort): Promise<ImageIntentResult>;
622
+ embedExternalImage(scope: StoryScope, drawingNodeId: string, url: string, port: ExternalImageFetchPort, signal: AbortSignal, decodePort: ImageDecodePort, actorId?: string): Promise<ImageIntentResult>;
656
623
  /** Metadata plus hyperlink target creation in one package transaction. */
657
624
  setDrawingMetadataWithHyperlink(scope: StoryScope, drawingNodeId: string, title: string, description: string, hyperlink: string | null): ImageIntentResult;
658
625
  /** Properties batch with hyperlink relationship create/update/remove in one package unit. */
@@ -684,17 +651,23 @@ declare class TreePackageStore {
684
651
  /**
685
652
  * Record a write that spanned SEVERAL parts as one package undo unit.
686
653
  *
687
- * A comment is not in one part — the body in `comments.xml`, the thread record in
688
- * `commentsExtended.xml`, the markers in the story — and those writes reach the store
689
- * through the story store directly rather than through `transact`. The story store's own
690
- * history entry cannot undo them: `undo()` on a story pointer syncs the STORY PART back and
691
- * nothing else, so undoing a comment restored the markers and left the body behind, or the
692
- * other way round. The caller discards the story entry and hands the package it started
693
- * from to this instead, which is the same promotion the note cascade does.
654
+ * A comment spans parts — the body in `comments.xml`, the thread record in
655
+ * `commentsExtended.xml`, the markers in the story — and those writes reach the store through
656
+ * the story store rather than `transact`. The story store's history cannot undo them: `undo()`
657
+ * on a story pointer syncs the STORY PART alone, so undoing a comment restored the markers and
658
+ * left the body, or the reverse. The caller discards the story entry and hands the package it
659
+ * started from to this instead, the same promotion the note cascade does.
694
660
  */
695
661
  adoptPackageUnit(before: OoxmlPackage): void;
696
662
  /** Install a full package snapshot (public seam for post-fetch cleanup). */
697
663
  installPackageSnapshot(snapshot: OoxmlPackage): void;
664
+ /**
665
+ * Install a package this replica did not author, verbatim. No shell merge — see
666
+ * `publishRemoteCanonicalPackage` for why merging one here diverges two replicas.
667
+ */
668
+ installAuthoritativePackageSnapshot(snapshot: OoxmlPackage): void;
669
+ /** Publish one remotely materialized canonical package as one revision. */
670
+ publishRemotePackage(pkg: OoxmlPackage, attribution: RemotePackageAttribution): PackageTransactResult;
698
671
  /**
699
672
  * Replace the package shell while preserving opened stores. Used when numbering /
700
673
  * content-types mutate the package outside story trees.
@@ -726,15 +699,6 @@ declare class TreePackageStore {
726
699
  * live and not history-reachable (see `pruneUnreachableHyperlinkShell`).
727
700
  */
728
701
  private evictUnreachableStories;
729
- private retainedStoryPartNames;
730
- /**
731
- * Owners whose scoped hyperlink shell must survive while furniture/notes parts are
732
- * temporarily absent: opened/parked story retention plus every part name that package
733
- * history can still restore (even when the story store was never opened).
734
- */
735
- private retainedHyperlinkOwnerParts;
736
- private retainPointerStoryParts;
737
- private retainPointerHyperlinkOwners;
738
702
  private publish;
739
703
  private publishSynthetic;
740
704
  }
@@ -749,6 +713,15 @@ interface FragmentPasteInput {
749
713
  readonly lastMarkCovered: boolean;
750
714
  /** Ops that clear the current selection first (the surface's deleteSelectionPlan). */
751
715
  readonly priorOps?: readonly TreeDocOp[];
716
+ /**
717
+ * Collaboration actor for the ids this paste mints.
718
+ *
719
+ * A paste freshens three package-wide namespaces — bookmark `@w:id`, revision `@w:id` and
720
+ * `wp:docPr/@id` — and the merge reads the actor off the open transaction. Without one, two
721
+ * replicas pasting the same fragment from one snapshot mint the same numbers, and only the
722
+ * merged document shows it. Omitted (solo) keeps Word's dense sequences.
723
+ */
724
+ readonly actorId?: string;
752
725
  }
753
726
  type FragmentPasteResult = (Extract<PackageTransactResult, {
754
727
  ok: true;
@@ -764,192 +737,4 @@ type FragmentPasteResult = (Extract<PackageTransactResult, {
764
737
  */
765
738
  declare function applyFragmentPaste(store: TreePackageStore, scope: StoryScope, input: FragmentPasteInput): FragmentPasteResult;
766
739
 
767
- /**
768
- * The payload half of an insert: which store, which node, and what it holds.
769
- *
770
- * `data` is opaque here. The lane that owns a schema is the one that declared it, and a store
771
- * that parsed payloads would be a second opinion about what a host's node means.
772
- */
773
- interface CustomNodePayloadWrite {
774
- /** Namespace of the store's root element — what identifies one store among several. */
775
- readonly namespaceUri: string;
776
- /** Local name of that root. An NCName; anything else refuses. */
777
- readonly rootLocalName: string;
778
- /** The node's own id, which the binding's xpath quotes. */
779
- readonly nodeId: string;
780
- /** The text the control shows. Word paints this from the store, so an empty one is an empty chip. */
781
- readonly label: string;
782
- /** The payload, serialized. JSON by convention; never parsed here. */
783
- readonly data: string;
784
- }
785
- /** Where the control goes, what it says, and the payload it carries. */
786
- interface InsertCustomNodeWrite {
787
- readonly paragraphId: string;
788
- readonly offset: number;
789
- /**
790
- * Wrap rather than insert: the text from `offset` to here is removed first.
791
- *
792
- * The node's label REPLACES the words it covered, because that is what turning a stretch of a
793
- * sentence into a citation means. Removed inside the same transaction, so a refused insert
794
- * leaves the text where it was.
795
- */
796
- readonly replaceUntil?: number;
797
- /**
798
- * Rewrite an existing control: it and the payload it bound go first, in this transaction.
799
- *
800
- * An UPDATE is remove-and-reinsert, because the tag codec has no in-place rewrite and
801
- * pretending it did would put a second write path beside this one. Doing both halves here is
802
- * what keeps it one undo step, and what stops an update from leaving a label and a payload
803
- * that disagree.
804
- */
805
- readonly replaceControlId?: string;
806
- readonly tag: string;
807
- readonly text: string;
808
- readonly alias?: string;
809
- /** Defaults to none. Callers that want Word's own "cannot type into it" pass `contentLocked`. */
810
- readonly lock?: 'sdtLocked' | 'sdtContentLocked' | 'contentLocked';
811
- /** Omitted authors an ordinary tagged control with no store — the pre-payload behaviour. */
812
- readonly payload?: CustomNodePayloadWrite;
813
- }
814
- /**
815
- * Why a payload write was refused.
816
- *
817
- * The tree rejections pass through unchanged, so a locked paragraph refuses a bound insert for
818
- * the same named reason it refuses a plain one. The three added here are the payload's own.
819
- */
820
- type CustomNodeWriteRejection = TreeOpRejection
821
- /** The id, root name or namespace cannot be spelled in an XPath, so no binding could name it. */
822
- | 'unaddressable-payload'
823
- /** The store could not be authored — see `withCustomXmlDataPart` for every way that happens. */
824
- | 'store-not-authored'
825
- /** The payload or the label is past the cap. */
826
- | 'payload-too-large';
827
- type CustomNodeWriteResult = {
828
- readonly ok: true;
829
- readonly change: TreeModelChange | null;
830
- /**
831
- * The control this write authored, when it authored one. A rewrite replaces the control
832
- * rather than editing it, so the id the caller passed in names nothing afterwards.
833
- */
834
- readonly nodeId?: string;
835
- } | {
836
- readonly ok: false;
837
- readonly reason: CustomNodeWriteRejection;
838
- readonly detail?: string;
839
- };
840
- /**
841
- * The largest payload one node may carry, in UTF-16 code units.
842
- *
843
- * Same figure as the read side's (`parseCustomNodeData`) and for the same reason: far past any
844
- * legitimate chip, far short of anything that hurts. Checked on the WRITE too, so a document
845
- * cannot be authored here holding a payload the reader will later refuse to parse.
846
- */
847
- declare const MAX_CUSTOM_NODE_PAYLOAD_LENGTH: number;
848
- /** The longest label a binding may paint. Word renders it as the control's whole content. */
849
- declare const MAX_CUSTOM_NODE_LABEL_LENGTH = 4096;
850
- /**
851
- * Insert one custom node, with its payload, as a single transaction.
852
- *
853
- * Answers the store transaction's own change so the caller can publish it — a payload write is a
854
- * package write reaching through a story store, exactly as a comment is, and the coordinator
855
- * needs the change to know which paragraphs went dirty.
856
- */
857
- declare function insertCustomNodeWrite(store: TreeDocumentStore, write: InsertCustomNodeWrite,
858
- /**
859
- * The part the customXml store hangs off, defaulting to the story being written.
860
- *
861
- * A chip in a header is written against the HEADER store, but Word enumerates the data
862
- * store from the main document part — a store authored off a header is one Word never
863
- * sees. So the caller passes the main part while the control itself lands in the story.
864
- */
865
- dataOwnerPartName?: string): CustomNodeWriteResult;
866
- /**
867
- * Remove a control and, in the same transaction, the payload it bound.
868
- *
869
- * The sweep would collect the node eventually — that is what makes deletion in Word survivable —
870
- * but "eventually" is the next open, and a document saved in between carries a payload for a
871
- * chip that is gone. Doing it here means the ordinary case is exact and the sweep is a backstop.
872
- */
873
- declare function removeCustomNodeWrite(store: TreeDocumentStore, controlNodeId: string): CustomNodeWriteResult;
874
- /**
875
- * What one sweep collected, or why it collected nothing.
876
- *
877
- * `ok: false` is NOT "the document was already tidy" — that is `ok: true` with an empty
878
- * `removed`. It means a store this sweep was asked to tidy refused the rewrite, which a caller
879
- * that keeps saving into the same document should know about rather than silently retry forever.
880
- */
881
- type CustomNodeSweepResult = {
882
- readonly ok: true;
883
- readonly pkg: OoxmlPackage;
884
- /** Node ids removed, across every store swept. Empty means there were no orphans. */
885
- readonly removed: readonly string[];
886
- } | {
887
- readonly ok: false;
888
- readonly reason: string;
889
- };
890
- /**
891
- * Drop every payload no control binds, in the stores whose namespaces a host claims.
892
- *
893
- * ON OPEN, NOT ON SAVE. A chip cut to the clipboard is unbound for as long as it sits there, so a
894
- * save mid-cut would destroy the payload the user is about to paste. On open the only unbound
895
- * nodes are ones a control genuinely lost — deleted here, or deleted in Word, which is the case
896
- * nothing else can collect.
897
- *
898
- * `namespaces` is the claim, and it is what keeps this off other people's stores: Word's own Cover
899
- * Page Properties store rides in most templates, and a sweep that walked every customXml part
900
- * would be deleting from it on the strength of a name collision.
901
- */
902
- declare function sweepCustomNodePayloads(pkg: OoxmlPackage, storyPartName: string, namespaces: readonly string[]): CustomNodeSweepResult;
903
- /** One control's payload, as the store holds it. Both strings are untrusted file input. */
904
- interface CustomNodePayloadRead {
905
- /** The store node's own id. */
906
- readonly nodeId: string;
907
- /** The text Word paints the control from. */
908
- readonly label: string;
909
- /** The payload as authored. JSON by convention, unparsed here. */
910
- readonly data: string;
911
- }
912
- /**
913
- * The payload every control in a story binds to, keyed by the CONTROL's canonical node id.
914
- *
915
- * Keyed by the control rather than by the store node because that is the question a reader
916
- * actually has — "what does this chip carry" — and because two stores may each hold a `cx1`.
917
- * Resolved here rather than by a capability package: the stores are package parts, and a
918
- * derivation that only gets story parts has no way to reach them.
919
- *
920
- * Every store the story relates to, so a document carrying two definitions' payloads answers
921
- * for both without anyone naming a namespace.
922
- */
923
- declare function customNodePayloadsByControl(pkg: OoxmlPackage, storyPartName: string,
924
- /**
925
- * The part that RELATES the customXml store, when it is not the story's own.
926
- *
927
- * Two different questions wear one name here: which part holds the CONTROLS, and which part
928
- * relates the STORE they bind into. Word only reads a store hung off the main document part,
929
- * so {@link writeCustomNode} already takes them separately — this read did not, and answered
930
- * with the body's controls whatever story it was asked about. A chip in a header therefore
931
- * read as having no payload at all, and an update that meant to keep the existing data
932
- * dropped it.
933
- */
934
- dataOwnerPartName?: string): ReadonlyMap<string, CustomNodePayloadRead>;
935
- /** Every payload one store holds, for a caller resolving a control's `data`. */
936
- declare function customNodePayloadsOf(pkg: OoxmlPackage, storyPartName: string, namespaceUri: string): ReadonlyMap<string, {
937
- readonly label: string;
938
- readonly data: string;
939
- }>;
940
- /**
941
- * What the session answers for a sweep: the ids collected, or the reason none were.
942
- *
943
- * Narrower than {@link CustomNodeSweepResult}, which also carries the rewritten package — the
944
- * session has already installed that, and handing it back would invite a caller to install it
945
- * twice.
946
- */
947
- type CustomNodeSweepOutcome = {
948
- readonly ok: true;
949
- readonly removed: readonly string[];
950
- } | {
951
- readonly ok: false;
952
- readonly reason: string;
953
- };
954
-
955
- export { cascadeDeletedNoteReferences as $, type ApplyImagePropertiesInput as A, type BookmarkIndex as B, type CustomNodeWriteResult as C, type DocumentTrackingSettings as D, type EmbeddedFont as E, type FragmentPasteInput as F, type NoteLifecycleRejection as G, type HeaderFooterLifecycleImpact as H, type InsertCustomNodeWrite as I, type NoteLifecycleResult as J, type NoteReferenceHit as K, type ListKind as L, MAX_CUSTOM_NODE_LABEL_LENGTH as M, NO_TRACKING_SETTINGS as N, type NoteReferenceScanBudget as O, type PackageTransactResult as P, type ReadEmbeddedFontsOptions as Q, type ReplaceImageOptions as R, type StoryScope as S, type StoryResolveResult as T, TreePackageStore as U, type TreePackageStoreOptions as V, allocateDrawingPropertyId as W, applyFragmentPaste as X, applyHeaderFooterLifecycleOp as Y, applyNoteLifecycleOp as Z, buildBookmarkIndex as _, type StoryTargetRejection as a, collectNoteReferences as a0, collectPackageNoteReferences as a1, createNoteReferenceScanBudget as a2, customNodePayloadsByControl as a3, customNodePayloadsOf as a4, deobfuscateFont as a5, diagnoseNoteReferences as a6, ensureListDefinition as a7, ensureNumberingLevel as a8, insertCustomNodeWrite as a9, isHeaderFooterLifecycleOp as aa, isNoteLifecycleOp as ab, normalNoteIds as ac, notesPartHasId as ad, readEmbeddedFonts as ae, readTrackingSettings as af, removeCustomNodeWrite as ag, resolveNotesPart as ah, sweepCustomNodePayloads as ai, withBinaryPart as aj, withEmbeddedImage as ak, withoutUnreferencedImagePart as al, type CustomNodeSweepOutcome as b, type InsertImageInput as c, type ImageIntentResult as d, type FragmentPasteResult as e, type BookmarkAnchor as f, type CascadeDeletedNoteReferencesOptions as g, type CustomNodePayloadRead as h, type CustomNodePayloadWrite as i, type CustomNodeSweepResult as j, type CustomNodeWriteRejection as k, DEFAULT_MAX_EDITABLE_STORY_PARTS as l, type DrawingPropertyIdResult as m, type FontStyleKey as n, type HeaderFooterLifecycleOp as o, type HeaderFooterLifecycleRejection as p, type HeaderFooterLifecycleResult as q, MAX_CUSTOM_NODE_PAYLOAD_LENGTH as r, MAX_FRAGMENT_DECODED_BYTES as s, MAX_NOTE_REFERENCE_PARTS as t, MAX_NOTE_REFERENCE_SCAN as u, type NoteDiagnostic as v, type NoteDiagnosticCode as w, type NoteLifecycleImpact as x, type NoteLifecycleOp as y, type NoteLifecycleOptions as z };
740
+ export { resolveHeaderFooterResolutionBySection as $, type ApplyImagePropertiesInput as A, applyFragmentPaste as B, type CascadeDeletedNoteReferencesOptions as C, DEFAULT_MAX_EDITABLE_STORY_PARTS as D, applyHeaderFooterLifecycleOp as E, type FragmentPasteInput as F, applyNoteLifecycleOp as G, type HeaderFooterVariant as H, type InsertImageInput as I, cascadeDeletedNoteReferences as J, collectNoteReferences as K, collectPackageNoteReferences as L, MAX_FRAGMENT_DECODED_BYTES as M, type NoteDiagnostic as N, collectSectionPropertyNodes as O, type PackageTransactResult as P, createNoteReferenceScanBudget as Q, type ReplaceImageOptions as R, type StoryScope as S, TreePackageStore as T, diagnoseNoteReferences as U, isHeaderFooterLifecycleOp as V, isNoteLifecycleOp as W, normalNoteIds as X, notesPartHasId as Y, resolveHeaderFooterParts as Z, resolveHeaderFooterPartsBySection as _, type StoryTargetRejection as a, resolveNotesPart as a0, withBinaryPart as a1, withEmbeddedImage as a2, withoutUnreferencedImagePart as a3, type HeaderFooterParts as b, type HeaderFooterSectionResolution as c, type ImageIntentResult as d, type FragmentPasteResult as e, type DrawingPropertyIdResult as f, type HeaderFooterKind as g, type HeaderFooterLifecycleImpact as h, type HeaderFooterLifecycleOp as i, type HeaderFooterLifecycleRejection as j, type HeaderFooterLifecycleResult as k, type HeaderFooterSlotMeta as l, MAX_NOTE_REFERENCE_PARTS as m, MAX_NOTE_REFERENCE_SCAN as n, type NoteDiagnosticCode as o, type NoteLifecycleImpact as p, type NoteLifecycleOp as q, type NoteLifecycleOptions as r, type NoteLifecycleRejection as s, type NoteLifecycleResult as t, type NoteReferenceHit as u, type NoteReferenceScanBudget as v, type RemotePackageAttribution as w, type StoryResolveResult as x, type TreePackageStoreOptions as y, allocateDrawingPropertyId as z };
@@ -1,11 +1,11 @@
1
- import { S as StoryScope, a as StoryTargetRejection, D as DocumentTrackingSettings, I as InsertCustomNodeWrite, C as CustomNodeWriteResult, b as CustomNodeSweepOutcome, E as EmbeddedFont, B as BookmarkIndex, L as ListKind, c as InsertImageInput, d as ImageIntentResult, R as ReplaceImageOptions, A as ApplyImagePropertiesInput, F as FragmentPasteInput, e as FragmentPasteResult } from './custom-node-writes-BvpWCnW8.js';
2
- import { T as TreeDocOp, c as SupportedImageMime, j as ImageDecodePort } from './tree-op-types-BuOfCrkp.js';
3
- import { O as OoxmlPart, a as OoxmlNode, c as OoxmlPackage, b as OoxmlElement } from './ooxml-package-CdEy9ufK.js';
4
- import { a as HeaderFooterParts, b as HeaderFooterSectionResolution } from './hf-references-z5Y4N1ab.js';
5
- import { S as SelectionMark, T as TreeModelChange, D as DocumentProperties } from './tree-store-ASBtz7UB.js';
6
- import { a as ReviewItem } from './review-items-Dw-8a6Ie.js';
1
+ import { S as StoryScope, a as StoryTargetRejection, b as HeaderFooterParts, c as HeaderFooterSectionResolution, I as InsertImageInput, d as ImageIntentResult, R as ReplaceImageOptions, A as ApplyImagePropertiesInput, F as FragmentPasteInput, e as FragmentPasteResult } from './tree-package-fragment-BjZ3RWAS.cjs';
2
+ import { T as TreeDocOp, O as OoxmlPart, a as OoxmlNode, b as OoxmlPackage, g as OoxmlElement, y as SupportedImageMime, C as ImageDecodePort, E as RevisionAttributionInput } from './tree-op-types-BPyXNxyL.cjs';
3
+ import { D as DocumentTrackingSettings, I as InsertCustomNodeWrite, C as CustomNodeWriteResult, a as CustomNodeSweepOutcome, E as EmbeddedFont, B as BookmarkIndex, L as ListKind } from './custom-node-writes-CwkYRw3V.cjs';
4
+ import { D as DocumentProperties } from './document-properties-D6Ahr8D6.cjs';
5
+ import { S as SelectionMark, b as TransactOptions, T as TreeModelChange } from './tree-store-DfZi7FqY.cjs';
6
+ import { a as ReviewItem } from './review-items-BdeLNRi2.cjs';
7
7
  import { Node } from 'prosemirror-model';
8
- import { a as RevisionAttributionInput } from './tree-op-revision-attribution-CN06Xshv.js';
8
+ import { CollaborationDocumentPort } from './collaboration/replication.cjs';
9
9
 
10
10
  /**
11
11
  * Why an edited projection could not be mapped back into tree ops.
@@ -221,6 +221,8 @@ interface TreeApplyResult {
221
221
  /** Present when the edit was refused, so a host can report WHY rather than a silent no-op. */
222
222
  readonly reason?: TreeBindingRejection | StoryTargetRejection | string;
223
223
  }
224
+ /** Optional collaboration attribution for a direct tree-op transaction. */
225
+ type TreeApplyOptions = Pick<TransactOptions, 'origin' | 'actorId' | 'operationId' | 'recordsHistory'>;
224
226
  /**
225
227
  * One open document: the canonical tree, and the only write path into it.
226
228
  *
@@ -261,7 +263,7 @@ interface TreeDocxSessionView {
261
263
  * header/footer part; the transaction publishes one ModelChange (HF → `global` impact)
262
264
  * and one undo unit without swapping the body store.
263
265
  */
264
- applyTreeOps(ops: readonly TreeDocOp[], selectionBefore?: SelectionMark | null, selectionAfter?: SelectionMark | null, scope?: StoryScope): TreeApplyResult;
266
+ applyTreeOps(ops: readonly TreeDocOp[], selectionBefore?: SelectionMark | null, selectionAfter?: SelectionMark | null, scope?: StoryScope, options?: TreeApplyOptions): TreeApplyResult;
265
267
  /**
266
268
  * Every part that holds a story, body first, then headers, footers and note parts.
267
269
  *
@@ -296,6 +298,8 @@ interface TreeDocxSessionView {
296
298
  beginComposition(scope?: StoryScope): void;
297
299
  endComposition(): void;
298
300
  subscribe(onChange: (change: TreeModelChange) => void): () => void;
301
+ /** Narrow provider-neutral attachment over this session's canonical package store. */
302
+ collaborationPort(documentId: string): CollaborationDocumentPort;
299
303
  /** Serialize the whole package back to DOCX bytes. */
300
304
  save(): Uint8Array;
301
305
  /**
@@ -422,7 +426,9 @@ interface TreeDocxSessionView {
422
426
  endParagraphId?: string;
423
427
  }, text: string, author: string,
424
428
  /** ISO-8601. Omitted writes no `@w:date`, because inventing one is a content change. */
425
- date?: string, scope?: StoryScope): string | null;
429
+ date?: string, scope?: StoryScope,
430
+ /** Binds id allocation to one actor, so two peers cannot mint the same comment id. */
431
+ actorId?: string): string | null;
426
432
  /**
427
433
  * Resolve a comment thread, or reopen it. False when the document holds no such comment.
428
434
  *
@@ -577,4 +583,4 @@ interface TreeDocxSessionView {
577
583
  applyFragmentPaste(scope: StoryScope, input: FragmentPasteInput): FragmentPasteResult;
578
584
  }
579
585
 
580
- export { type DocumentStyleEntry as D, type MapResult as M, type TreeDocxSessionView as T, type TreeApplyResult as a, type TreeBindingRejection as b, bodyParagraphs as c, docToTreeOps as d, type DocumentThemeColorEntry as e, partHasNode as p, reconcileDoc as r, treeToDoc as t };
586
+ export { type DocumentStyleEntry as D, type MapResult as M, type TreeDocxSessionView as T, type TreeApplyResult as a, type TreeApplyOptions as b, type TreeBindingRejection as c, bodyParagraphs as d, docToTreeOps as e, type DocumentThemeColorEntry as f, partHasNode as p, reconcileDoc as r, treeToDoc as t };