@docx-editor.dev/core 2.10.0 → 2.12.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-3JON7JMD.cjs +1 -0
  10. package/dist/chunk-5V6FNKBE.cjs +2 -0
  11. package/dist/chunk-6JIJOZDW.js +1 -0
  12. package/dist/chunk-BTQKU64Q.cjs +1 -0
  13. package/dist/chunk-BXRVGHTY.cjs +18 -0
  14. package/dist/chunk-BXTTPJSH.js +5 -0
  15. package/dist/chunk-D5EHDHYV.js +1 -0
  16. package/dist/{chunk-PSZH2VXP.js → chunk-GOEBQ26R.js} +1 -1
  17. package/dist/chunk-ILTZTY3K.cjs +10 -0
  18. package/dist/chunk-IUM7FZPA.js +2 -0
  19. package/dist/chunk-JWZG4QJ5.cjs +2 -0
  20. package/dist/chunk-JXZYDBKU.cjs +19 -0
  21. package/dist/chunk-KBOOIC2Q.js +19 -0
  22. package/dist/chunk-L6XZTLPS.js +10 -0
  23. package/dist/chunk-L7OR5TJK.cjs +5 -0
  24. package/dist/chunk-MHQNR2OU.js +2 -0
  25. package/dist/chunk-MLGPISGH.js +1 -0
  26. package/dist/chunk-NJXQABQU.js +18 -0
  27. package/dist/{chunk-YMYCPY5Y.cjs → chunk-OHJQ7GPZ.cjs} +1 -1
  28. package/dist/chunk-TKEGK4GQ.cjs +2 -0
  29. package/dist/chunk-VGFMPWND.js +2 -0
  30. package/dist/chunk-W77HJGYX.js +1 -0
  31. package/dist/chunk-XCFM3G5L.cjs +1 -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-CcNeHH5C.d.ts +310 -0
  52. package/dist/custom-node-writes-D4rMJIES.d.cts +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-CwzY2Hcg.d.cts → editor-B76SEMZw.d.cts} +145 -49
  56. package/dist/{editor-C0my6Uta.d.ts → editor-BcdsPdbY.d.ts} +145 -49
  57. package/dist/editor.cjs +1 -1
  58. package/dist/editor.css +1 -7299
  59. package/dist/editor.d.cts +60 -26
  60. package/dist/editor.d.ts +60 -26
  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-BYTvklN5.d.ts} +262 -81
  65. package/dist/{index-nLFwo_17.d.cts → index-CDGhPib1.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 +82 -53
  72. package/dist/layout.d.ts +82 -53
  73. package/dist/layout.js +1 -1
  74. package/dist/{note-properties-jvnw_DGG.d.ts → note-properties-Bx7rXruA.d.ts} +1 -1
  75. package/dist/{note-properties-CQlxjic_.d.cts → note-properties-zQ8w04en.d.cts} +1 -1
  76. package/dist/{omml-equation-Dd3mBep-.d.ts → omml-equation-69O1Pd8G.d.ts} +1 -1
  77. package/dist/{omml-equation-BD-LsmWE.d.cts → omml-equation-BmV51rim.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-C7ahrdUx.d.ts → protocol-DC7ueVuo.d.ts} +2 -2
  83. package/dist/{protocol-UuZOcOp7.d.cts → protocol-FTXtrAIT.d.cts} +2 -2
  84. package/dist/{review-items-Dw-8a6Ie.d.ts → review-items-B78OsJU2.d.ts} +1 -2
  85. package/dist/{review-items-CwixiHNe.d.cts → review-items-C-2WQdEb.d.cts} +1 -2
  86. package/dist/{review-reads-BqkiJTeR.d.cts → review-reads-CbBQlb-n.d.cts} +2 -2
  87. package/dist/{review-reads-C0u-IKEA.d.ts → review-reads-UexYBp-m.d.ts} +2 -2
  88. package/dist/{revision-projection-Cc4wz30g.d.cts → revision-projection-6u8lae9J.d.cts} +1 -1
  89. package/dist/{revision-projection-CILpvv4M.d.ts → revision-projection-B2v9U3qx.d.ts} +1 -1
  90. package/dist/{semantic-cell-selection-Utrf0lz7.d.ts → semantic-cell-selection-DsYz2Vg3.d.ts} +4 -4
  91. package/dist/{semantic-cell-selection-DT9x9WLf.d.cts → semantic-cell-selection-nEE7E3Z8.d.cts} +4 -4
  92. package/dist/{semantic-interaction-B6hFRQLy.d.ts → semantic-interaction-C00BpIyC.d.ts} +1 -1
  93. package/dist/{semantic-interaction-Z0xKQcB4.d.cts → semantic-interaction-DiOX0FIH.d.cts} +1 -1
  94. package/dist/{semantic-paint-CQEOC0Od.d.cts → semantic-paint-Cc11nrDL.d.cts} +2 -2
  95. package/dist/{semantic-paint-quke354p.d.ts → semantic-paint-ofuoBsYo.d.ts} +2 -2
  96. package/dist/{semantic-records-Do3-i5oB.d.ts → semantic-records-CRG1r6-a.d.cts} +5 -4
  97. package/dist/{semantic-records-CMakzQ1X.d.cts → semantic-records-CzI0ZEuR.d.ts} +5 -4
  98. package/dist/{shaped-measurer-BxwTUluj.d.ts → shaped-measurer-CkOGZQn9.d.ts} +1 -1
  99. package/dist/{shaped-measurer-DzRwWrL5.d.cts → shaped-measurer-CneACGcP.d.cts} +1 -1
  100. package/dist/store.cjs +1 -1
  101. package/dist/store.d.cts +81 -17
  102. package/dist/store.d.ts +81 -17
  103. package/dist/store.js +1 -1
  104. package/dist/{tree-op-types-DSJYmf5b.d.cts → tree-op-types-CA7qgAUF.d.cts} +1288 -18
  105. package/dist/{tree-op-types-BuOfCrkp.d.ts → tree-op-types-HKfUzt_-.d.ts} +1288 -18
  106. package/dist/{custom-node-writes-BvpWCnW8.d.ts → tree-package-fragment-Cz-v-0B3.d.cts} +107 -322
  107. package/dist/{custom-node-writes-Db8H6Z3n.d.cts → tree-package-fragment-oJZX_5iN.d.ts} +107 -322
  108. package/dist/{tree-session-contract-ByWx8eew.d.cts → tree-session-contract-BPDLrEPX.d.ts} +16 -10
  109. package/dist/{tree-session-contract-C1dfE9hy.d.ts → tree-session-contract-Cbl87xa8.d.cts} +16 -10
  110. package/dist/{tree-store-ASBtz7UB.d.ts → tree-store-B7hd6cEa.d.ts} +130 -25
  111. package/dist/{tree-store-CWOUMGN8.d.cts → tree-store-BenW0Mg_.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
@@ -0,0 +1,310 @@
1
+ import { b as OoxmlPackage, O as OoxmlPart, a as OoxmlNode, r as TreeOpRejection } from './tree-op-types-CA7qgAUF.cjs';
2
+ import { T as TreeModelChange, a as TreeDocumentStore } from './tree-store-BenW0Mg_.cjs';
3
+
4
+ /** Which of a family's four faces an embedded font relationship supplies. */
5
+ type FontStyleKey = 'regular' | 'bold' | 'italic' | 'boldItalic';
6
+ /**
7
+ * One font whose bytes travel inside the package.
8
+ *
9
+ * The family name is the DOCUMENT's and is not validated — it is attacker-controlled, so it is
10
+ * escaped into CSS and never registered globally on `document.fonts`, where it would shadow the
11
+ * host application's own fonts.
12
+ */
13
+ interface EmbeddedFont {
14
+ /** The family as the document names it. Not validated against anything. */
15
+ readonly family: string;
16
+ readonly style: FontStyleKey;
17
+ /** Deobfuscated bytes, ready to be offered to a font validator. */
18
+ readonly bytes: Uint8Array;
19
+ /** The part they came from, for diagnostics. */
20
+ readonly partName: string;
21
+ }
22
+ /**
23
+ * Undo Word's embedded-font obfuscation (ECMA-376 Part 4 §2.8.1).
24
+ *
25
+ * The key is the `w:fontKey` GUID's 16 bytes in REVERSED order — not the per-group
26
+ * little-endian reading a GUID usually gets. It is XORed over the first 32 bytes of the
27
+ * part, applied twice. Getting the order wrong produces a font that looks corrupt rather
28
+ * than obfuscated, which is indistinguishable from a damaged file at the point it fails.
29
+ *
30
+ * Pure XOR, so the same operation obfuscates and deobfuscates.
31
+ */
32
+ declare function deobfuscateFont(bytes: Uint8Array, fontKey: string): Uint8Array | null;
33
+ /** Limits and instrumentation for reading embedded fonts out of a package. */
34
+ interface ReadEmbeddedFontsOptions {
35
+ /** Refuse a font part larger than this. Defaults to 16 MB. */
36
+ readonly maxFontBytes?: number;
37
+ /** Refuse more than this many fonts. Defaults to 64. */
38
+ readonly maxFonts?: number;
39
+ }
40
+ /**
41
+ * Every font the package embeds, deobfuscated.
42
+ *
43
+ * Silently skips anything malformed rather than rejecting the document: a broken font table
44
+ * is a reason to fall back to substitution, never a reason to refuse to open the file.
45
+ */
46
+ declare function readEmbeddedFonts(pkg: OoxmlPackage, fontTable: OoxmlPart | undefined, options?: ReadEmbeddedFontsOptions): EmbeddedFont[];
47
+
48
+ /** The two list kinds a toolbar offers. */
49
+ type ListKind = 'bullet' | 'ordered';
50
+ interface EnsuredListDefinition {
51
+ readonly pkg: OoxmlPackage;
52
+ /** The `w:numId` a paragraph's `w:numPr` should name. */
53
+ readonly numId: string;
54
+ }
55
+ /**
56
+ * Find or create a list definition of `kind`, returning the package that holds it.
57
+ *
58
+ * An existing abstract definition of the same kind is reused, but every disconnected list
59
+ * gets a fresh `w:num` instance. Counters belong to `w:num`, so reusing that instance would
60
+ * continue an earlier list. Returns null only when the part cannot be built at all.
61
+ */
62
+ declare function ensureListDefinition(pkg: OoxmlPackage, kind: ListKind): EnsuredListDefinition | null;
63
+ /**
64
+ * Declare `level` in the definition `numId` names, with Word's default format for that
65
+ * level, or refuse.
66
+ *
67
+ * Word never greys Increase Indent out on a list item: demoting past the deepest level a
68
+ * `w:abstractNum` declares makes Word DEFINE the level, cycling its stock bullets
69
+ * (Symbol •, Courier `o`, Wingdings ▪) or number formats (decimal, lowerLetter,
70
+ * lowerRoman) by depth. This is that write. An already-declared level returns the package
71
+ * unchanged, so callers may ask first and act second without a second lookup.
72
+ *
73
+ * A delegating definition (`w:numStyleLink`, 17.9.21) is refused: its levels live on the
74
+ * linked style's definition, and a `w:lvl` grafted here would be shadowed the moment the
75
+ * link resolves.
76
+ */
77
+ declare function ensureNumberingLevel(pkg: OoxmlPackage, numId: string, level: number, kind: ListKind): OoxmlPackage | null;
78
+
79
+ /** One bookmark's name and the range its marker pair currently encloses. */
80
+ interface BookmarkAnchor {
81
+ readonly name: string;
82
+ /** Canonical node id of the paragraph the marker sits in. */
83
+ readonly paragraphId: string;
84
+ /** UTF-16 offset within that paragraph, in `paragraphTextOf`'s vocabulary. */
85
+ readonly offset: number;
86
+ }
87
+ /** Bookmarks by name. A name the document declares twice resolves to the first in order. */
88
+ type BookmarkIndex = ReadonlyMap<string, BookmarkAnchor>;
89
+ /**
90
+ * Build `name -> position` for every bookmark start in a part, in document order.
91
+ *
92
+ * FIRST IN DOCUMENT ORDER WINS on a duplicate name. Word treats a repeated bookmark name as
93
+ * the same bookmark and jumps to the first, and the alternative — last-wins — makes a jump
94
+ * target move when an edit far away happens to duplicate a name.
95
+ *
96
+ * The offset is measured the way the ops measure: text of the runs before the marker inside
97
+ * its own paragraph, hyperlink runs included, so the position a jump places the caret at is a
98
+ * position `setSelection` accepts.
99
+ */
100
+ declare function buildBookmarkIndex(part: OoxmlPart): BookmarkIndex;
101
+
102
+ /** What the document asks for. Every field defaults to "the document said nothing". */
103
+ interface DocumentTrackingSettings {
104
+ /** `w:trackRevisions` — the document asks for edits to be tracked. */
105
+ readonly trackRevisions: boolean;
106
+ /**
107
+ * `w:documentProtection/@w:edit="trackedChanges"` — tracking may not be turned OFF.
108
+ *
109
+ * Advisory. Presenting it as enforcement would be a lie about a file anyone can edit.
110
+ */
111
+ readonly restrictedToTrackedChanges: boolean;
112
+ /** `w:doNotTrackMoves` — write a move as a delete and an insert. */
113
+ readonly doNotTrackMoves: boolean;
114
+ /** `w:doNotTrackFormatting` — apply formatting without recording a `w:rPrChange`. */
115
+ readonly doNotTrackFormatting: boolean;
116
+ }
117
+ /** The frozen "nothing is tracked" settings — what a document with no `w:trackChanges` gets. */
118
+ declare const NO_TRACKING_SETTINGS: DocumentTrackingSettings;
119
+ /** Read the tracking settings from a `settings.xml` root, or the defaults when it has none. */
120
+ declare function readTrackingSettings(settingsRoot: OoxmlNode | null | undefined): DocumentTrackingSettings;
121
+
122
+ /**
123
+ * The payload half of an insert: which store, which node, and what it holds.
124
+ *
125
+ * `data` is opaque here. The lane that owns a schema is the one that declared it, and a store
126
+ * that parsed payloads would be a second opinion about what a host's node means.
127
+ */
128
+ interface CustomNodePayloadWrite {
129
+ /** Namespace of the store's root element — what identifies one store among several. */
130
+ readonly namespaceUri: string;
131
+ /** Local name of that root. An NCName; anything else refuses. */
132
+ readonly rootLocalName: string;
133
+ /** The node's own id, which the binding's xpath quotes. */
134
+ readonly nodeId: string;
135
+ /** The text the control shows. Word paints this from the store, so an empty one is an empty chip. */
136
+ readonly label: string;
137
+ /** The payload, serialized. JSON by convention; never parsed here. */
138
+ readonly data: string;
139
+ }
140
+ /** Where the control goes, what it says, and the payload it carries. */
141
+ interface InsertCustomNodeWrite {
142
+ readonly paragraphId: string;
143
+ readonly offset: number;
144
+ /**
145
+ * Wrap rather than insert: the text from `offset` to here is removed first.
146
+ *
147
+ * The node's label REPLACES the words it covered, because that is what turning a stretch of a
148
+ * sentence into a citation means. Removed inside the same transaction, so a refused insert
149
+ * leaves the text where it was.
150
+ */
151
+ readonly replaceUntil?: number;
152
+ /**
153
+ * Rewrite an existing control: it and the payload it bound go first, in this transaction.
154
+ *
155
+ * An UPDATE is remove-and-reinsert, because the tag codec has no in-place rewrite and
156
+ * pretending it did would put a second write path beside this one. Doing both halves here is
157
+ * what keeps it one undo step, and what stops an update from leaving a label and a payload
158
+ * that disagree.
159
+ */
160
+ readonly replaceControlId?: string;
161
+ readonly tag: string;
162
+ readonly text: string;
163
+ readonly alias?: string;
164
+ /** Defaults to none. Callers that want Word's own "cannot type into it" pass `contentLocked`. */
165
+ readonly lock?: 'sdtLocked' | 'sdtContentLocked' | 'contentLocked';
166
+ /** Omitted authors an ordinary tagged control with no store — the pre-payload behaviour. */
167
+ readonly payload?: CustomNodePayloadWrite;
168
+ }
169
+ /**
170
+ * Why a payload write was refused.
171
+ *
172
+ * The tree rejections pass through unchanged, so a locked paragraph refuses a bound insert for
173
+ * the same named reason it refuses a plain one. The three added here are the payload's own.
174
+ */
175
+ type CustomNodeWriteRejection = TreeOpRejection
176
+ /** The id, root name or namespace cannot be spelled in an XPath, so no binding could name it. */
177
+ | 'unaddressable-payload'
178
+ /** The store could not be authored — see `withCustomXmlDataPart` for every way that happens. */
179
+ | 'store-not-authored'
180
+ /** The payload or the label is past the cap. */
181
+ | 'payload-too-large';
182
+ type CustomNodeWriteResult = {
183
+ readonly ok: true;
184
+ readonly change: TreeModelChange | null;
185
+ /**
186
+ * The control this write authored, when it authored one. A rewrite replaces the control
187
+ * rather than editing it, so the id the caller passed in names nothing afterwards.
188
+ */
189
+ readonly nodeId?: string;
190
+ } | {
191
+ readonly ok: false;
192
+ readonly reason: CustomNodeWriteRejection;
193
+ readonly detail?: string;
194
+ };
195
+ /**
196
+ * The largest payload one node may carry, in UTF-16 code units.
197
+ *
198
+ * Same figure as the read side's (`parseCustomNodeData`) and for the same reason: far past any
199
+ * legitimate chip, far short of anything that hurts. Checked on the WRITE too, so a document
200
+ * cannot be authored here holding a payload the reader will later refuse to parse.
201
+ */
202
+ declare const MAX_CUSTOM_NODE_PAYLOAD_LENGTH: number;
203
+ /** The longest label a binding may paint. Word renders it as the control's whole content. */
204
+ declare const MAX_CUSTOM_NODE_LABEL_LENGTH = 4096;
205
+ /**
206
+ * Insert one custom node, with its payload, as a single transaction.
207
+ *
208
+ * Answers the store transaction's own change so the caller can publish it — a payload write is a
209
+ * package write reaching through a story store, exactly as a comment is, and the coordinator
210
+ * needs the change to know which paragraphs went dirty.
211
+ */
212
+ declare function insertCustomNodeWrite(store: TreeDocumentStore, write: InsertCustomNodeWrite,
213
+ /**
214
+ * The part the customXml store hangs off, defaulting to the story being written.
215
+ *
216
+ * A chip in a header is written against the HEADER store, but Word enumerates the data
217
+ * store from the main document part — a store authored off a header is one Word never
218
+ * sees. So the caller passes the main part while the control itself lands in the story.
219
+ */
220
+ dataOwnerPartName?: string): CustomNodeWriteResult;
221
+ /**
222
+ * Remove a control and, in the same transaction, the payload it bound.
223
+ *
224
+ * The sweep would collect the node eventually — that is what makes deletion in Word survivable —
225
+ * but "eventually" is the next open, and a document saved in between carries a payload for a
226
+ * chip that is gone. Doing it here means the ordinary case is exact and the sweep is a backstop.
227
+ */
228
+ declare function removeCustomNodeWrite(store: TreeDocumentStore, controlNodeId: string): CustomNodeWriteResult;
229
+ /**
230
+ * What one sweep collected, or why it collected nothing.
231
+ *
232
+ * `ok: false` is NOT "the document was already tidy" — that is `ok: true` with an empty
233
+ * `removed`. It means a store this sweep was asked to tidy refused the rewrite, which a caller
234
+ * that keeps saving into the same document should know about rather than silently retry forever.
235
+ */
236
+ type CustomNodeSweepResult = {
237
+ readonly ok: true;
238
+ readonly pkg: OoxmlPackage;
239
+ /** Node ids removed, across every store swept. Empty means there were no orphans. */
240
+ readonly removed: readonly string[];
241
+ } | {
242
+ readonly ok: false;
243
+ readonly reason: string;
244
+ };
245
+ /**
246
+ * Drop every payload no control binds, in the stores whose namespaces a host claims.
247
+ *
248
+ * ON OPEN, NOT ON SAVE. A chip cut to the clipboard is unbound for as long as it sits there, so a
249
+ * save mid-cut would destroy the payload the user is about to paste. On open the only unbound
250
+ * nodes are ones a control genuinely lost — deleted here, or deleted in Word, which is the case
251
+ * nothing else can collect.
252
+ *
253
+ * `namespaces` is the claim, and it is what keeps this off other people's stores: Word's own Cover
254
+ * Page Properties store rides in most templates, and a sweep that walked every customXml part
255
+ * would be deleting from it on the strength of a name collision.
256
+ */
257
+ declare function sweepCustomNodePayloads(pkg: OoxmlPackage, storyPartName: string, namespaces: readonly string[]): CustomNodeSweepResult;
258
+ /** One control's payload, as the store holds it. Both strings are untrusted file input. */
259
+ interface CustomNodePayloadRead {
260
+ /** The store node's own id. */
261
+ readonly nodeId: string;
262
+ /** The text Word paints the control from. */
263
+ readonly label: string;
264
+ /** The payload as authored. JSON by convention, unparsed here. */
265
+ readonly data: string;
266
+ }
267
+ /**
268
+ * The payload every control in a story binds to, keyed by the CONTROL's canonical node id.
269
+ *
270
+ * Keyed by the control rather than by the store node because that is the question a reader
271
+ * actually has — "what does this chip carry" — and because two stores may each hold a `cx1`.
272
+ * Resolved here rather than by a capability package: the stores are package parts, and a
273
+ * derivation that only gets story parts has no way to reach them.
274
+ *
275
+ * Every store the story relates to, so a document carrying two definitions' payloads answers
276
+ * for both without anyone naming a namespace.
277
+ */
278
+ declare function customNodePayloadsByControl(pkg: OoxmlPackage, storyPartName: string,
279
+ /**
280
+ * The part that RELATES the customXml store, when it is not the story's own.
281
+ *
282
+ * Two different questions wear one name here: which part holds the CONTROLS, and which part
283
+ * relates the STORE they bind into. Word only reads a store hung off the main document part,
284
+ * so {@link writeCustomNode} already takes them separately — this read did not, and answered
285
+ * with the body's controls whatever story it was asked about. A chip in a header therefore
286
+ * read as having no payload at all, and an update that meant to keep the existing data
287
+ * dropped it.
288
+ */
289
+ dataOwnerPartName?: string): ReadonlyMap<string, CustomNodePayloadRead>;
290
+ /** Every payload one store holds, for a caller resolving a control's `data`. */
291
+ declare function customNodePayloadsOf(pkg: OoxmlPackage, storyPartName: string, namespaceUri: string): ReadonlyMap<string, {
292
+ readonly label: string;
293
+ readonly data: string;
294
+ }>;
295
+ /**
296
+ * What the session answers for a sweep: the ids collected, or the reason none were.
297
+ *
298
+ * Narrower than {@link CustomNodeSweepResult}, which also carries the rewritten package — the
299
+ * session has already installed that, and handing it back would invite a caller to install it
300
+ * twice.
301
+ */
302
+ type CustomNodeSweepOutcome = {
303
+ readonly ok: true;
304
+ readonly removed: readonly string[];
305
+ } | {
306
+ readonly ok: false;
307
+ readonly reason: string;
308
+ };
309
+
310
+ export { type BookmarkIndex as B, type CustomNodeWriteResult as C, type DocumentTrackingSettings as D, type EmbeddedFont as E, type FontStyleKey as F, type InsertCustomNodeWrite as I, type ListKind as L, MAX_CUSTOM_NODE_LABEL_LENGTH as M, NO_TRACKING_SETTINGS as N, type ReadEmbeddedFontsOptions as R, type CustomNodeSweepOutcome as a, type BookmarkAnchor as b, type CustomNodePayloadRead as c, type CustomNodePayloadWrite as d, type CustomNodeSweepResult as e, type CustomNodeWriteRejection as f, MAX_CUSTOM_NODE_PAYLOAD_LENGTH as g, buildBookmarkIndex as h, customNodePayloadsByControl as i, customNodePayloadsOf as j, deobfuscateFont as k, ensureListDefinition as l, ensureNumberingLevel as m, insertCustomNodeWrite as n, readTrackingSettings as o, removeCustomNodeWrite as p, readEmbeddedFonts as r, sweepCustomNodePayloads as s };
@@ -0,0 +1,28 @@
1
+ /**
2
+ * The document metadata Word's document-property fields render.
3
+ *
4
+ * Every member is optional: an absent part, an absent element, or an empty value all read as
5
+ * `undefined`, and a field over a missing property paints nothing. Keys are engine-internal
6
+ * names; the field → property mapping (`TITLE` → `title`, `AUTHOR` → `creator`, …) lives in
7
+ * `layout/field-doc-property.ts`.
8
+ */
9
+ interface DocumentProperties {
10
+ /** `dc:title` — TITLE. */
11
+ readonly title?: string;
12
+ /** `dc:creator` — AUTHOR. */
13
+ readonly creator?: string;
14
+ /** `dc:subject` — SUBJECT. */
15
+ readonly subject?: string;
16
+ /** `cp:keywords` — KEYWORDS. */
17
+ readonly keywords?: string;
18
+ /** `cp:lastModifiedBy` — LASTSAVEDBY. */
19
+ readonly lastModifiedBy?: string;
20
+ /** `dc:description` — COMMENTS. */
21
+ readonly description?: string;
22
+ /** `Company` from `docProps/app.xml`. No field maps to it yet; carried for completeness. */
23
+ readonly company?: string;
24
+ /** `Manager` from `docProps/app.xml`. No field maps to it yet; carried for completeness. */
25
+ readonly manager?: string;
26
+ }
27
+
28
+ export type { DocumentProperties as D };
@@ -0,0 +1,28 @@
1
+ /**
2
+ * The document metadata Word's document-property fields render.
3
+ *
4
+ * Every member is optional: an absent part, an absent element, or an empty value all read as
5
+ * `undefined`, and a field over a missing property paints nothing. Keys are engine-internal
6
+ * names; the field → property mapping (`TITLE` → `title`, `AUTHOR` → `creator`, …) lives in
7
+ * `layout/field-doc-property.ts`.
8
+ */
9
+ interface DocumentProperties {
10
+ /** `dc:title` — TITLE. */
11
+ readonly title?: string;
12
+ /** `dc:creator` — AUTHOR. */
13
+ readonly creator?: string;
14
+ /** `dc:subject` — SUBJECT. */
15
+ readonly subject?: string;
16
+ /** `cp:keywords` — KEYWORDS. */
17
+ readonly keywords?: string;
18
+ /** `cp:lastModifiedBy` — LASTSAVEDBY. */
19
+ readonly lastModifiedBy?: string;
20
+ /** `dc:description` — COMMENTS. */
21
+ readonly description?: string;
22
+ /** `Company` from `docProps/app.xml`. No field maps to it yet; carried for completeness. */
23
+ readonly company?: string;
24
+ /** `Manager` from `docProps/app.xml`. No field maps to it yet; carried for completeness. */
25
+ readonly manager?: string;
26
+ }
27
+
28
+ export type { DocumentProperties as D };
@@ -1,9 +1,9 @@
1
1
  import { DocEdits, DocQueries, DocQueryResults, ContentControlSummary } from './contracts/document.cjs';
2
- import { g as ReviewRevisionKind, c as ReviewCommentItem, b as ReviewRevisionItem, d as ReviewCustomItem } from './review-items-CwixiHNe.cjs';
3
- import { a as SemanticSelection, S as SemanticPosition } from './semantic-interaction-Z0xKQcB4.cjs';
2
+ import { g as ReviewRevisionKind, c as ReviewCommentItem, b as ReviewRevisionItem, d as ReviewCustomItem } from './review-items-C-2WQdEb.cjs';
3
+ import { a as SemanticSelection, S as SemanticPosition } from './semantic-interaction-DiOX0FIH.cjs';
4
+ import { S as SourceCrop, D as DrawingKind, u as ImageWrapTarget, v as DrawingPositionInput, w as DrawingLocks, x as ImageResourceState, y as SupportedImageMime } from './tree-op-types-CA7qgAUF.cjs';
4
5
  import { ColorValue, ExecErrorCode, ParagraphFormatCommand, Watermark, DocAnchor, ExecResult, ContentControlFilter, DocRange, RunFormatting, Revision, Rect, SelectionPin, Unsubscribe } from './contracts/types.cjs';
5
- import { S as SourceCrop, b as ImageWrapTarget, c as SupportedImageMime, D as DrawingKind, d as DrawingPositionInput, e as DrawingLocks, f as ImageResourceState } from './tree-op-types-DSJYmf5b.cjs';
6
- import './tree-op-revision-attribution-CN06Xshv.cjs';
6
+ import { C as CollaborationStatus } from './failure-BnGjoXf0.cjs';
7
7
 
8
8
  /**
9
9
  * `@docx-editor.dev/core/contracts/interaction` — semantic addressing and interaction outcomes.
@@ -247,6 +247,78 @@ interface EditorNoteCommands {
247
247
  };
248
248
  }
249
249
 
250
+ /**
251
+ * Format painter commands for the Editor facade.
252
+ *
253
+ * Separated from `editor.ts` so the facade file stays under the max-lines gate while the
254
+ * painter keeps one cohesive vocabulary. Re-exported from `editor.ts`, so consumers keep
255
+ * importing `@docx-editor.dev/core/contracts/editor`.
256
+ */
257
+ /**
258
+ * Word's Format Painter, as the two halves a keyboard user drives separately.
259
+ *
260
+ * The pair is deliberately NOT one command with a direction flag: `copyFormatting` reads
261
+ * and `pasteFormatting` writes, so they answer `can` differently — copying is allowed on a
262
+ * document open for viewing, and applying is not.
263
+ */
264
+ interface EditorFormatPainterCommands {
265
+ /**
266
+ * Capture the formatting at the selection (Word's Ctrl+Shift+C).
267
+ *
268
+ * Reads the RESOLVED cascade rather than the direct run properties, so painting from a
269
+ * styled paragraph carries what the reader sees rather than the little the paragraph
270
+ * happens to state itself.
271
+ *
272
+ * The LEVEL follows the selection, as Word's does. A range inside one paragraph captures
273
+ * character formatting alone; a range that covers a paragraph mark — a whole paragraph, a
274
+ * multi-paragraph selection, or a collapsed caret — captures the paragraph style and its
275
+ * direct paragraph properties as well.
276
+ *
277
+ * Non-mutating: the capture lives on the editor, not in the document, and it survives
278
+ * until the next capture or until the editor is detached.
279
+ */
280
+ copyFormatting: Record<never, never>;
281
+ /**
282
+ * Apply the captured formatting to the current selection (Word's Ctrl+Shift+V).
283
+ *
284
+ * Refused with `no formatting has been copied` until `copyFormatting` has run. Paragraph
285
+ * formatting is applied only when the capture carries it; the text itself never moves.
286
+ *
287
+ * Three things stay on the TARGET rather than being painted over, because they are outside
288
+ * the property vocabulary an op may name — the same limit `clearFormatting` states:
289
+ * paragraph borders (`w:pBdr`), the run's character style (`w:rStyle`), and character
290
+ * shading (`w:rPr/w:shd`), which is resolved and painted but cannot be authored.
291
+ */
292
+ pasteFormatting: Record<never, never>;
293
+ }
294
+ /**
295
+ * How long the painter stays armed.
296
+ *
297
+ * Word's two gestures, named: a single press arms it for ONE application, a double press
298
+ * locks it on until the user presses `Esc`. `'off'` is the resting state.
299
+ */
300
+ type FormatPainterMode = 'off' | 'once' | 'locked';
301
+ /**
302
+ * What a capture carries.
303
+ *
304
+ * `'run'` is character formatting alone — the level a range INSIDE one paragraph copies.
305
+ * `'paragraph'` adds the paragraph style and its direct paragraph properties, which is what
306
+ * a selection covering a paragraph mark copies. `'none'` means nothing has been captured.
307
+ */
308
+ type FormatPainterLevel = 'none' | 'run' | 'paragraph';
309
+ /**
310
+ * Painter state, as the editor publishes it.
311
+ *
312
+ * Chrome state rather than document state, so it moves through the same report every other
313
+ * observable surface state uses — a toolbar's pressed state has one source. It lives in the
314
+ * CONTRACTS lane rather than beside the surface implementation because `EditorSnapshot`
315
+ * names it, and the contracts lane may not reach into the editor lane.
316
+ */
317
+ interface FormatPainterSurfaceState {
318
+ readonly mode: FormatPainterMode;
319
+ readonly level: FormatPainterLevel;
320
+ }
321
+
250
322
  /** Crop edge in UI percent (0–100). @public */
251
323
  interface ImageCropPercent {
252
324
  readonly left: number;
@@ -282,6 +354,58 @@ declare function cropPercentFromCropPermille(crop: ImageCropPermille): ImageCrop
282
354
  */
283
355
  declare function validateImageCropPercent(crop: ImageCropPercent): boolean;
284
356
 
357
+ /**
358
+ * The selected-image read model, split out of `editor.ts`.
359
+ *
360
+ * Separated so the facade file stays under the max-lines gate while the image vocabulary
361
+ * stays one cohesive shape. Re-exported from `editor.ts`, so consumers keep importing
362
+ * `@docx-editor.dev/core/contracts/editor`.
363
+ */
364
+
365
+ /**
366
+ * Canonical selected-image read model shared by {@link EditorSnapshot.image} and
367
+ * {@link Editor.getSelectedImage}.
368
+ *
369
+ * @public
370
+ */
371
+ interface SelectedImageState {
372
+ readonly id: string;
373
+ readonly kind: DrawingKind;
374
+ readonly widthEmu: number;
375
+ readonly heightEmu: number;
376
+ /** Crop inset per edge in UI percent (0–100); OOXML stores permille (×1000). */
377
+ readonly crop: ImageCropPercent;
378
+ readonly rotationDegrees: number;
379
+ readonly wrap: ImageWrapTarget;
380
+ readonly position: DrawingPositionInput | null;
381
+ readonly name: string;
382
+ readonly title: string;
383
+ readonly description: string;
384
+ readonly hyperlink: string | null;
385
+ readonly locks: DrawingLocks;
386
+ readonly hidden: boolean;
387
+ readonly resourceStatus: ImageResourceState['kind'];
388
+ readonly intrinsic: Readonly<{
389
+ readonly pixelWidth: number;
390
+ readonly pixelHeight: number;
391
+ readonly dpiX: number;
392
+ readonly dpiY: number;
393
+ }> | null;
394
+ readonly canResize: boolean;
395
+ readonly canMove: boolean;
396
+ readonly canChangeWrap: boolean;
397
+ readonly canCrop: boolean;
398
+ }
399
+ /**
400
+ * The selected image and what may be done to it — the `imageContext` query's answer.
401
+ *
402
+ * An alias of `SelectedImageState`, kept as its own name because it is the query's result type
403
+ * and chrome is written against it.
404
+ *
405
+ * @public
406
+ */
407
+ type ImageContext = SelectedImageState;
408
+
285
409
  /** Which cell edges a table border command targets. */
286
410
  type TableBorderTarget = 'all' | 'outside' | 'inside' | 'none' | 'top' | 'bottom' | 'left' | 'right';
287
411
  /** Concrete scopes that apply a complete border spec. */
@@ -1147,7 +1271,7 @@ type DocumentEditingMode = 'editing' | 'suggesting' | 'viewing';
1147
1271
  * selection, view state, chrome modes, header/footer and note editing. An interface rather than a
1148
1272
  * closed union so an extension can widen it by declaration merging.
1149
1273
  */
1150
- interface EditorCommands extends EditorCommandShape<DocEdits>, EditorHeaderFooterCommands, EditorNoteCommands {
1274
+ interface EditorCommands extends EditorCommandShape<DocEdits>, EditorHeaderFooterCommands, EditorNoteCommands, EditorFormatPainterCommands {
1151
1275
  /** Switch how edits are written. A view command: it changes no document state. */
1152
1276
  setEditingMode: {
1153
1277
  mode: DocumentEditingMode;
@@ -1767,6 +1891,15 @@ interface EditorSnapshot {
1767
1891
  * vocabulary and memoized per revision.
1768
1892
  */
1769
1893
  readonly hasReviewContent?: boolean;
1894
+ /**
1895
+ * Lifecycle of the attached collaboration replica, or `'inactive'` when no
1896
+ * collaboration module is registered.
1897
+ *
1898
+ * The free tier's honest upsell signal: a host can render from this value
1899
+ * without importing `@docx-editor.dev/pro`. When a module is registered the
1900
+ * field follows the session's `status()`.
1901
+ */
1902
+ readonly collaborationStatus: CollaborationStatus | 'inactive';
1770
1903
  /**
1771
1904
  * How edits are written right now.
1772
1905
  *
@@ -1791,50 +1924,13 @@ interface EditorSnapshot {
1791
1924
  * derived it; empty means every family resolved (or no document is loaded).
1792
1925
  */
1793
1926
  readonly fontSubstitutions?: readonly string[];
1927
+ /**
1928
+ * Format painter arming, and the level of what it holds. Here for the same reason
1929
+ * `lastRejection` is: it moves no revision and no caret, so a mode the snapshot does not
1930
+ * carry is a mode no toolbar can reflect. Optional and additive.
1931
+ */
1932
+ readonly formatPainter?: FormatPainterSurfaceState;
1794
1933
  }
1795
- /**
1796
- * Canonical selected-image read model shared by {@link EditorSnapshot.image} and
1797
- * {@link Editor.getSelectedImage}.
1798
- *
1799
- * @public
1800
- */
1801
- interface SelectedImageState {
1802
- readonly id: string;
1803
- readonly kind: DrawingKind;
1804
- readonly widthEmu: number;
1805
- readonly heightEmu: number;
1806
- /** Crop inset per edge in UI percent (0–100); OOXML stores permille (×1000). */
1807
- readonly crop: ImageCropPercent;
1808
- readonly rotationDegrees: number;
1809
- readonly wrap: ImageWrapTarget;
1810
- readonly position: DrawingPositionInput | null;
1811
- readonly name: string;
1812
- readonly title: string;
1813
- readonly description: string;
1814
- readonly hyperlink: string | null;
1815
- readonly locks: DrawingLocks;
1816
- readonly hidden: boolean;
1817
- readonly resourceStatus: ImageResourceState['kind'];
1818
- readonly intrinsic: Readonly<{
1819
- readonly pixelWidth: number;
1820
- readonly pixelHeight: number;
1821
- readonly dpiX: number;
1822
- readonly dpiY: number;
1823
- }> | null;
1824
- readonly canResize: boolean;
1825
- readonly canMove: boolean;
1826
- readonly canChangeWrap: boolean;
1827
- readonly canCrop: boolean;
1828
- }
1829
- /**
1830
- * The selected image and what may be done to it — the `imageContext` query's answer.
1831
- *
1832
- * An alias of `SelectedImageState`, kept as its own name because it is the query's result type
1833
- * and chrome is written against it.
1834
- *
1835
- * @public
1836
- */
1837
- type ImageContext = SelectedImageState;
1838
1934
  /**
1839
1935
  * An error the engine raised, carrying a machine-readable `code` alongside the message.
1840
1936
  *
@@ -1859,4 +1955,4 @@ interface EditorEvents {
1859
1955
  error: (error: EditorError) => void;
1860
1956
  }
1861
1957
 
1862
- export { type NotePropertiesState as $, type AuthoredNoteNumbering as A, type EditorHeaderFooterCommands as B, type CanResult as C, type DocumentSource as D, EditorFontError as E, type FontConfiguration as F, type EditorNoteCommands as G, type EditorPosition as H, type ImageContext as I, type EditorQueries as J, type EditorQuery as K, type EditorQueryResults as L, type EditorScope as M, type EditorSelection as N, type FurnitureVariant as O, type HeaderFooterSlotArgs as P, type HeaderFooterState as Q, type HyperlinkInfo as R, type SelectedImageState as S, type TableBorderEdgeTarget as T, type InteractionAffinity as U, type ViewScope as V, type InteractionOutcome as W, type InteractionOutcomeCode as X, type NoteKind as Y, type ZoomMode as Z, type NotePropertiesSide as _, type EditorSnapshot as a, type PageSetup as a0, type ResolvedNoteNumbering as a1, type ReviewActivationOptions as a2, type ReviewCommentPlacement as a3, type ReviewCustomPlacement as a4, type ReviewItemPlacement as a5, type ReviewItemPlacementBase as a6, type ReviewItemQuery as a7, type ReviewRevisionPlacement as a8, type SemanticIdentity as a9, type SemanticTarget as aa, type TableBorderTarget as ab, type TableCellVerticalAlignment as ac, type TableColumnDividerResizeTarget as ad, type TableColumnOccurrenceTarget as ae, type TableRightEdgeResizeTarget as af, type TableRowOccurrenceTarget as ag, type TextMatch as ah, type ZoomFitTarget as ai, type EditorCommand as b, type ImageCropPercent as c, type ImageCropPermille as d, cropPercentFromCropPermille as e, cropPercentFromPermille as f, cropPercentFromSourceCrop as g, cropPermilleFromCropPercent as h, cropPermilleFromPercent as i, type FontSource as j, type FontSourceSubstitution as k, type Editor as l, type FontFaceRequest as m, type TableBorderSpec as n, type TableBorderStyle as o, type TableContext as p, type DocumentChange as q, type DocumentEditingMode as r, sourceCropFromCropPercent as s, type DocumentHandle as t, type EditorCommandShape as u, validateImageCropPercent as v, type EditorCommands as w, type EditorError as x, type EditorEvents as y, type EditorFontErrorCode as z };
1958
+ export { type InteractionOutcome as $, type AuthoredNoteNumbering as A, type EditorFontErrorCode as B, type CanResult as C, type DocumentSource as D, EditorFontError as E, type FontConfiguration as F, type EditorFormatPainterCommands as G, type EditorHeaderFooterCommands as H, type ImageContext as I, type EditorNoteCommands as J, type EditorPosition as K, type EditorQueries as L, type EditorQuery as M, type EditorQueryResults as N, type EditorScope as O, type EditorSelection as P, type FormatPainterLevel as Q, type FormatPainterMode as R, type SelectedImageState as S, type TableBorderEdgeTarget as T, type FurnitureVariant as U, type ViewScope as V, type HeaderFooterSlotArgs as W, type HeaderFooterState as X, type HyperlinkInfo as Y, type ZoomMode as Z, type InteractionAffinity as _, type EditorSnapshot as a, type InteractionOutcomeCode as a0, type NoteKind as a1, type NotePropertiesSide as a2, type NotePropertiesState as a3, type PageSetup as a4, type ResolvedNoteNumbering as a5, type ReviewActivationOptions as a6, type ReviewCommentPlacement as a7, type ReviewCustomPlacement as a8, type ReviewItemPlacement as a9, type ReviewItemPlacementBase as aa, type ReviewItemQuery as ab, type ReviewRevisionPlacement as ac, type SemanticIdentity as ad, type SemanticTarget as ae, type TableBorderTarget as af, type TableCellVerticalAlignment as ag, type TableColumnDividerResizeTarget as ah, type TableColumnOccurrenceTarget as ai, type TableRightEdgeResizeTarget as aj, type TableRowOccurrenceTarget as ak, type TextMatch as al, type ZoomFitTarget as am, type EditorCommand as b, type ImageCropPercent as c, type ImageCropPermille as d, cropPercentFromCropPermille as e, cropPercentFromPermille as f, cropPercentFromSourceCrop as g, cropPermilleFromCropPercent as h, cropPermilleFromPercent as i, type FontSource as j, type FontSourceSubstitution as k, type Editor as l, type FormatPainterSurfaceState as m, type FontFaceRequest as n, type TableBorderSpec as o, type TableBorderStyle as p, type TableContext as q, type DocumentChange as r, sourceCropFromCropPercent as s, type DocumentEditingMode as t, type DocumentHandle as u, validateImageCropPercent as v, type EditorCommandShape as w, type EditorCommands as x, type EditorError as y, type EditorEvents as z };