@arbidocs/blocks 0.4.101 → 0.4.103
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.
- package/dist/chunk-6MG62I5B.cjs +272 -0
- package/dist/chunk-6MG62I5B.cjs.map +1 -0
- package/dist/{chunk-MYALCKDR.js → chunk-CVYY4X5R.js} +306 -75
- package/dist/chunk-CVYY4X5R.js.map +1 -0
- package/dist/chunk-EQB3WELX.js +269 -0
- package/dist/chunk-EQB3WELX.js.map +1 -0
- package/dist/{chunk-G5JH2YMQ.js → chunk-GQTIAATM.js} +3 -3
- package/dist/{chunk-G5JH2YMQ.js.map → chunk-GQTIAATM.js.map} +1 -1
- package/dist/{chunk-YGREW5TZ.js → chunk-H6DFXG5N.js} +3 -3
- package/dist/{chunk-YGREW5TZ.js.map → chunk-H6DFXG5N.js.map} +1 -1
- package/dist/{chunk-ZT2EBBSC.cjs → chunk-N36PWG7A.cjs} +5 -5
- package/dist/{chunk-ZT2EBBSC.cjs.map → chunk-N36PWG7A.cjs.map} +1 -1
- package/dist/{chunk-FAGQTB3D.cjs → chunk-O33EBMIX.cjs} +305 -74
- package/dist/chunk-O33EBMIX.cjs.map +1 -0
- package/dist/{chunk-Y5XW57U4.cjs → chunk-TFDU2KGS.cjs} +5 -5
- package/dist/{chunk-Y5XW57U4.cjs.map → chunk-TFDU2KGS.cjs.map} +1 -1
- package/dist/connect/docx.cjs +6 -6
- package/dist/connect/docx.js +4 -4
- package/dist/connect/index.cjs +3 -3
- package/dist/connect/index.js +2 -2
- package/dist/document-tools/AdoptSignatureDialog.d.ts +25 -0
- package/dist/document-tools/DocumentToolButtons.d.ts +2 -0
- package/dist/document-tools/SignatureRequestBanner.d.ts +18 -0
- package/dist/document-tools/index.cjs +175 -0
- package/dist/document-tools/index.cjs.map +1 -1
- package/dist/document-tools/index.d.ts +3 -1
- package/dist/document-tools/index.js +168 -3
- package/dist/document-tools/index.js.map +1 -1
- package/dist/document-tools/viewer/GuidedSigningViewer.d.ts +26 -0
- package/dist/document-tools/viewer/SignatureFieldsOverlay.d.ts +41 -0
- package/dist/document-tools/viewer/SignatureRequestEditor.d.ts +26 -0
- package/dist/document-tools/viewer/index.cjs +983 -0
- package/dist/document-tools/viewer/index.cjs.map +1 -1
- package/dist/document-tools/viewer/index.d.ts +3 -0
- package/dist/document-tools/viewer/index.js +983 -5
- package/dist/document-tools/viewer/index.js.map +1 -1
- package/dist/docx/RibbonMenu.d.ts +4 -1
- package/dist/docx/RibbonOverflow.d.ts +27 -0
- package/dist/docx/WordReferences.d.ts +3 -2
- package/dist/docx/index.cjs +35 -35
- package/dist/docx/index.js +3 -3
- package/dist/docx/noteStyles.d.ts +46 -0
- package/dist/docx/overflowPlan.d.ts +15 -0
- package/dist/index.cjs +5 -5
- package/dist/index.js +1 -1
- package/node_modules/@arbidocs/coedit/LICENSE +21 -0
- package/node_modules/@arbidocs/coedit/dist/encoding.cjs +751 -0
- package/node_modules/@arbidocs/coedit/dist/encoding.cjs.map +1 -0
- package/node_modules/@arbidocs/coedit/dist/encoding.d.cts +192 -0
- package/node_modules/@arbidocs/coedit/dist/encoding.d.ts +192 -0
- package/node_modules/@arbidocs/coedit/dist/encoding.js +716 -0
- package/node_modules/@arbidocs/coedit/dist/encoding.js.map +1 -0
- package/node_modules/@arbidocs/coedit/dist/hocuspocus.cjs +1759 -0
- package/node_modules/@arbidocs/coedit/dist/hocuspocus.cjs.map +1 -0
- package/node_modules/@arbidocs/coedit/dist/hocuspocus.d.cts +39 -0
- package/node_modules/@arbidocs/coedit/dist/hocuspocus.d.ts +39 -0
- package/node_modules/@arbidocs/coedit/dist/hocuspocus.js +1736 -0
- package/node_modules/@arbidocs/coedit/dist/hocuspocus.js.map +1 -0
- package/node_modules/@arbidocs/coedit/dist/index.cjs +1692 -0
- package/node_modules/@arbidocs/coedit/dist/index.cjs.map +1 -0
- package/node_modules/@arbidocs/coedit/dist/index.d.cts +16 -0
- package/node_modules/@arbidocs/coedit/dist/index.d.ts +16 -0
- package/node_modules/@arbidocs/coedit/dist/index.js +1664 -0
- package/node_modules/@arbidocs/coedit/dist/index.js.map +1 -0
- package/node_modules/@arbidocs/coedit/dist/server.cjs +1852 -0
- package/node_modules/@arbidocs/coedit/dist/server.cjs.map +1 -0
- package/node_modules/@arbidocs/coedit/dist/server.d.cts +43 -0
- package/node_modules/@arbidocs/coedit/dist/server.d.ts +43 -0
- package/node_modules/@arbidocs/coedit/dist/server.js +1822 -0
- package/node_modules/@arbidocs/coedit/dist/server.js.map +1 -0
- package/node_modules/@arbidocs/coedit/dist/session-Cf9iu1Vt.d.cts +82 -0
- package/node_modules/@arbidocs/coedit/dist/session-Cf9iu1Vt.d.ts +82 -0
- package/node_modules/@arbidocs/coedit/dist/template.cjs +1627 -0
- package/node_modules/@arbidocs/coedit/dist/template.cjs.map +1 -0
- package/node_modules/@arbidocs/coedit/dist/template.d.cts +125 -0
- package/node_modules/@arbidocs/coedit/dist/template.d.ts +125 -0
- package/node_modules/@arbidocs/coedit/dist/template.js +1612 -0
- package/node_modules/@arbidocs/coedit/dist/template.js.map +1 -0
- package/node_modules/@arbidocs/coedit/dist/versions-DXiFQMA6.d.cts +8 -0
- package/node_modules/@arbidocs/coedit/dist/versions-DXiFQMA6.d.ts +8 -0
- package/node_modules/@arbidocs/coedit/package.json +68 -0
- package/node_modules/@docx-editor.dev/core/LICENSE +201 -0
- package/node_modules/@docx-editor.dev/core/README.md +125 -0
- package/node_modules/@docx-editor.dev/core/THIRD_PARTY_NOTICES.md +56 -0
- package/node_modules/@docx-editor.dev/core/dist/automation.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/automation.d.ts +162 -0
- package/node_modules/@docx-editor.dev/core/dist/automation.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/binding.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/binding.d.ts +164 -0
- package/node_modules/@docx-editor.dev/core/dist/binding.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-2GO5T2JU.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-2RC2EPND.js +3 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-4GBTELJV.cjs +28 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-4R3TEXMN.js +18 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-5CSUYANV.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-6APGXLBB.cjs +3 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-6AWEKBLB.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-6EYYL7FL.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-6JIJOZDW.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-BTQKU64Q.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-E7BQA6UP.js +2 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-EO4C5QJW.cjs +2 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-ETTO6GK3.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-FIJZIQXA.cjs +18 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-FRXAOVTB.js +28 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-J6BVWIDB.js +2 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-JGNVNT2A.cjs +2 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-K5U2PLDP.cjs +2 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-KKIJG3C6.js +2 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-LWDSDCMO.js +27 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-NBCVVZOM.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-O2AL2HSJ.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-O5INAWZQ.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-QMLCVPCD.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-RCHS4ZEH.cjs +27 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-RIYSCEFQ.js +2 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-S6J4O5XP.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-SRPILEWV.cjs +5 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-TSLBZ26X.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-UKVVUHZL.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-VDNNLG6X.js +2 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-VHAVHCQY.js +7 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-VX43VBAX.cjs +7 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-Z6WBFXJU.js +5 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-ZUHOMK52.cjs +2 -0
- package/node_modules/@docx-editor.dev/core/dist/collaboration/replication.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/collaboration/replication.d.ts +270 -0
- package/node_modules/@docx-editor.dev/core/dist/collaboration/replication.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/collaboration.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/collaboration.d.ts +269 -0
- package/node_modules/@docx-editor.dev/core/dist/collaboration.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/contracts/document.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/contracts/document.d.ts +290 -0
- package/node_modules/@docx-editor.dev/core/dist/contracts/document.js +0 -0
- package/node_modules/@docx-editor.dev/core/dist/contracts/editor.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/contracts/editor.d.ts +22 -0
- package/node_modules/@docx-editor.dev/core/dist/contracts/editor.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/contracts/interaction.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/contracts/interaction.d.ts +103 -0
- package/node_modules/@docx-editor.dev/core/dist/contracts/interaction.js +0 -0
- package/node_modules/@docx-editor.dev/core/dist/contracts/modules.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/contracts/modules.d.ts +143 -0
- package/node_modules/@docx-editor.dev/core/dist/contracts/modules.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/contracts/types.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/contracts/types.d.ts +11 -0
- package/node_modules/@docx-editor.dev/core/dist/contracts/types.js +0 -0
- package/node_modules/@docx-editor.dev/core/dist/custom-node-writes-cvL5rhcD.d.ts +323 -0
- package/node_modules/@docx-editor.dev/core/dist/dist-PKZR6RSH.js +2 -0
- package/node_modules/@docx-editor.dev/core/dist/document-protection-BAGVGqaP.d.ts +20 -0
- package/node_modules/@docx-editor.dev/core/dist/editor-Ci7IZGmG.d.ts +2448 -0
- package/node_modules/@docx-editor.dev/core/dist/editor-scope-OHPwVQ5l.d.ts +84 -0
- package/node_modules/@docx-editor.dev/core/dist/editor.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/editor.css +15 -0
- package/node_modules/@docx-editor.dev/core/dist/editor.d.ts +1394 -0
- package/node_modules/@docx-editor.dev/core/dist/editor.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/export.cjs +2 -0
- package/node_modules/@docx-editor.dev/core/dist/export.d.ts +391 -0
- package/node_modules/@docx-editor.dev/core/dist/export.js +2 -0
- package/node_modules/@docx-editor.dev/core/dist/failure-NS2lsya4.d.ts +115 -0
- package/node_modules/@docx-editor.dev/core/dist/font-resolver-BVQB14qT.d.ts +256 -0
- package/node_modules/@docx-editor.dev/core/dist/harfbuzz.wasm +0 -0
- package/node_modules/@docx-editor.dev/core/dist/headless-document-view-qH331moE.d.ts +143 -0
- package/node_modules/@docx-editor.dev/core/dist/image-resources-BN-hUgCn.d.ts +211 -0
- package/node_modules/@docx-editor.dev/core/dist/index-Bsg7oIKP.d.ts +3869 -0
- package/node_modules/@docx-editor.dev/core/dist/index.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/index.d.ts +53 -0
- package/node_modules/@docx-editor.dev/core/dist/index.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/layout-shaping-BEyuiQOk.d.ts +246 -0
- package/node_modules/@docx-editor.dev/core/dist/layout.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/layout.d.ts +3151 -0
- package/node_modules/@docx-editor.dev/core/dist/layout.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/node-module-shim-TTKTT66I.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/note-properties-4Y9o6Gyk.d.ts +68 -0
- package/node_modules/@docx-editor.dev/core/dist/omml-equation-CuzBL5DD.d.ts +85 -0
- package/node_modules/@docx-editor.dev/core/dist/output.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/output.d.ts +97 -0
- package/node_modules/@docx-editor.dev/core/dist/output.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/protocol-Bqk4Izjc.d.ts +1651 -0
- package/node_modules/@docx-editor.dev/core/dist/review-pane-D9jm8DcY.d.ts +128 -0
- package/node_modules/@docx-editor.dev/core/dist/review-paragraph-order-DT-n6ouC.d.ts +85 -0
- package/node_modules/@docx-editor.dev/core/dist/revision-projection-DZ4kKVev.d.ts +242 -0
- package/node_modules/@docx-editor.dev/core/dist/semantic-cell-selection-D9D1KSXq.d.ts +464 -0
- package/node_modules/@docx-editor.dev/core/dist/semantic-interaction-CIC-PooQ.d.ts +135 -0
- package/node_modules/@docx-editor.dev/core/dist/semantic-paint-BME37OMv.d.ts +326 -0
- package/node_modules/@docx-editor.dev/core/dist/semantic-record-queries-CBlZqZNa.d.ts +177 -0
- package/node_modules/@docx-editor.dev/core/dist/semantic-records-4B3WwFAi.d.ts +3532 -0
- package/node_modules/@docx-editor.dev/core/dist/store.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/store.d.ts +2706 -0
- package/node_modules/@docx-editor.dev/core/dist/store.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/tree-package-fragment-BeeKxDw8.d.ts +1201 -0
- package/node_modules/@docx-editor.dev/core/dist/tree-session-contract-CVbmlMlq.d.ts +664 -0
- package/node_modules/@docx-editor.dev/core/dist/types-barrel-D3xCgQX6.d.ts +4269 -0
- package/node_modules/@docx-editor.dev/core/licenses/HarfBuzz-COPYING.txt +42 -0
- package/node_modules/@docx-editor.dev/core/package.json +140 -0
- package/node_modules/@docx-editor.dev/react/LICENSE +201 -0
- package/node_modules/@docx-editor.dev/react/README.md +141 -0
- package/node_modules/@docx-editor.dev/react/THIRD_PARTY_NOTICES.md +18 -0
- package/node_modules/@docx-editor.dev/react/dist/index.d.mts +4928 -0
- package/node_modules/@docx-editor.dev/react/dist/index.d.ts +4928 -0
- package/node_modules/@docx-editor.dev/react/dist/index.js +4 -0
- package/node_modules/@docx-editor.dev/react/dist/index.mjs +4 -0
- package/node_modules/@docx-editor.dev/react/package.json +74 -0
- package/node_modules/@docx-editor.dev/react/src/styles/editor.css +6 -0
- package/node_modules/@docx-editor.dev/react/src/styles/zIndex.ts +28 -0
- package/package.json +26 -15
- package/src/docx/README.md +10 -0
- package/src/docx/styles.css +73 -5
- package/dist/chunk-FAGQTB3D.cjs.map +0 -1
- package/dist/chunk-MYALCKDR.js.map +0 -1
|
@@ -0,0 +1,1201 @@
|
|
|
1
|
+
import { S as SupportedImageMime, a as ImageDecodePort } from './image-resources-BN-hUgCn.js';
|
|
2
|
+
import { Q as OoxmlPackage, O as OoxmlPart, N as OoxmlNode, Z as OoxmlElement, ab as OoxmlParagraphNode, ac as OoxmlNoteNode, ad as OoxmlContinuationSeparatorNode, ae as OoxmlEndnotesNode, af as OoxmlFootnotesNode, ag as OoxmlNoteRefNode, ah as OoxmlNoteReferenceNode, ai as OoxmlSeparatorNode, aa as RevisionAttributionInput, aj as DrawingTreeDocOp, ak as ImpactClass, W as TreeDocOp, a8 as TreeOpRejection } from './types-barrel-D3xCgQX6.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* How saved field results are addressed.
|
|
6
|
+
*
|
|
7
|
+
* - `atomic`: every closed field is one offset unit.
|
|
8
|
+
* - `editable`: the results of CREATEDATE, DATE, FILENAME, FILLIN, HYPERLINK, MERGEFIELD,
|
|
9
|
+
* PRINTDATE, QUOTE, SAVEDATE, SEQ, and TIME fields are text when their results are unnested.
|
|
10
|
+
* Simple fields inside complex field results are not supported in this mode. Other nested
|
|
11
|
+
* results, other field types, and legacy FORMTEXT inputs keep their existing addressing.
|
|
12
|
+
*/
|
|
13
|
+
type FieldResultsMode = 'atomic' | 'editable';
|
|
14
|
+
|
|
15
|
+
/** A freshly allocated drawing property id, or the reason one could not be minted. */
|
|
16
|
+
type DrawingPropertyIdResult = {
|
|
17
|
+
readonly ok: true;
|
|
18
|
+
readonly id: number;
|
|
19
|
+
} | {
|
|
20
|
+
readonly ok: false;
|
|
21
|
+
readonly reason: 'invalidArgs';
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Mint a `wp:docPr` id unused anywhere in the package.
|
|
25
|
+
*
|
|
26
|
+
* Package-wide rather than per-part: Word treats these ids as document-global, and a collision
|
|
27
|
+
* makes it renumber on open.
|
|
28
|
+
*
|
|
29
|
+
* Solo: `highest + 1`, the dense sequence Word writes. With a collaboration actor bound —
|
|
30
|
+
* explicit argument, or the open store transaction — the id is the next unused value in that
|
|
31
|
+
* actor's stripe. Two peers inserting a picture from one snapshot otherwise both mint `id="1"`,
|
|
32
|
+
* and the merged document carries two drawings under one document-global id.
|
|
33
|
+
*/
|
|
34
|
+
declare function allocateDrawingPropertyId(pkg: OoxmlPackage, actorId?: string): DrawingPropertyIdResult;
|
|
35
|
+
/**
|
|
36
|
+
* Store raw bytes for a part and declare its exact content type.
|
|
37
|
+
*
|
|
38
|
+
* Does not create a relationship; callers decide which owner points at the part.
|
|
39
|
+
*/
|
|
40
|
+
declare function withBinaryPart(pkg: OoxmlPackage, partName: string, bytes: Uint8Array, contentType: string): OoxmlPackage;
|
|
41
|
+
/**
|
|
42
|
+
* Add image bytes to the package: the media part, its content type, and the relationship.
|
|
43
|
+
*
|
|
44
|
+
* All three together — bytes with no relationship are unreachable, and a relationship with no
|
|
45
|
+
* content-type record makes the package invalid.
|
|
46
|
+
*/
|
|
47
|
+
declare function withEmbeddedImage(pkg: OoxmlPackage, ownerPartName: string, input: Readonly<{
|
|
48
|
+
bytes: Uint8Array;
|
|
49
|
+
mime: SupportedImageMime;
|
|
50
|
+
}>): Readonly<{
|
|
51
|
+
ok: true;
|
|
52
|
+
pkg: OoxmlPackage;
|
|
53
|
+
partName: string;
|
|
54
|
+
relationshipId: string;
|
|
55
|
+
docPrId: number;
|
|
56
|
+
}> | Readonly<{
|
|
57
|
+
ok: false;
|
|
58
|
+
reason: 'invalidArgs' | 'invalid-image';
|
|
59
|
+
}>;
|
|
60
|
+
/** Remove an orphaned image media part after a package-wide internal relationship target check. */
|
|
61
|
+
declare function withoutUnreferencedImagePart(pkg: OoxmlPackage, partName: string): OoxmlPackage;
|
|
62
|
+
interface ExternalImageFetchPort {
|
|
63
|
+
/** Atomically resolve, reject non-public addresses, and connect for one HTTPS hop. */
|
|
64
|
+
requestPublicHttps(url: string, init: Readonly<{
|
|
65
|
+
redirect: 'manual';
|
|
66
|
+
signal: AbortSignal;
|
|
67
|
+
}>): Promise<Readonly<{
|
|
68
|
+
status: number;
|
|
69
|
+
location: string | null;
|
|
70
|
+
contentType: string | null;
|
|
71
|
+
body: AsyncIterable<Uint8Array>;
|
|
72
|
+
/** Must equal the requested absolute URL for this hop. */
|
|
73
|
+
connectedUrl: string;
|
|
74
|
+
}>>;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** `w:headerReference w:type` vocabulary (ECMA-376 §17.10.5): default, first page, even pages. */
|
|
78
|
+
type HeaderFooterVariant = 'default' | 'first' | 'even';
|
|
79
|
+
/** Header vs footer region kind for chrome and lifecycle ops. */
|
|
80
|
+
type HeaderFooterKind = 'header' | 'footer';
|
|
81
|
+
/**
|
|
82
|
+
* A section's resolved header and footer parts, by variant.
|
|
83
|
+
*
|
|
84
|
+
* The `even` variant is only honoured when `w:evenAndOddHeaders` is set in settings.xml —
|
|
85
|
+
* without it Word ignores an authored even header, and so does this.
|
|
86
|
+
*/
|
|
87
|
+
interface HeaderFooterParts {
|
|
88
|
+
readonly headers: ReadonlyMap<HeaderFooterVariant, OoxmlPart>;
|
|
89
|
+
readonly footers: ReadonlyMap<HeaderFooterVariant, OoxmlPart>;
|
|
90
|
+
/** `w:evenAndOddHeaders` in settings.xml — without it the `even` variant is ignored. */
|
|
91
|
+
readonly evenAndOddHeaders: boolean;
|
|
92
|
+
/** Whether this section enables first-page header/footer furniture (`w:titlePg`). */
|
|
93
|
+
readonly titlePage: boolean;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* One resolved furniture slot with enough metadata for "Same as previous" chrome.
|
|
97
|
+
*
|
|
98
|
+
* `inherited: true` means this section has no declared reference for the slot and the
|
|
99
|
+
* part comes from a predecessor. The first section never reports inherited — omitting a
|
|
100
|
+
* ref there is blank furniture, not inheritance from a later section.
|
|
101
|
+
*/
|
|
102
|
+
interface HeaderFooterSlotMeta {
|
|
103
|
+
readonly part: OoxmlPart;
|
|
104
|
+
readonly partName: string;
|
|
105
|
+
readonly rId: string;
|
|
106
|
+
readonly inherited: boolean;
|
|
107
|
+
}
|
|
108
|
+
/** Per-section resolution including declared-vs-inherited metadata. */
|
|
109
|
+
interface HeaderFooterSectionResolution {
|
|
110
|
+
readonly headers: ReadonlyMap<HeaderFooterVariant, HeaderFooterSlotMeta>;
|
|
111
|
+
readonly footers: ReadonlyMap<HeaderFooterVariant, HeaderFooterSlotMeta>;
|
|
112
|
+
readonly evenAndOddHeaders: boolean;
|
|
113
|
+
readonly titlePage: boolean;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* `w:sectPr` nodes in section order, aligned with layout's `enumerateDocumentSections`.
|
|
117
|
+
*
|
|
118
|
+
* `null` means a section with no `w:sectPr` node (Word defaults, inherits HF from previous).
|
|
119
|
+
* Paragraph-level breaks first; the final entry covers remaining blocks (body-level or null).
|
|
120
|
+
*/
|
|
121
|
+
declare function collectSectionPropertyNodes(root: OoxmlNode): Array<OoxmlElement | null>;
|
|
122
|
+
/**
|
|
123
|
+
* Resolve header/footer parts for every section with declared-vs-inherited metadata.
|
|
124
|
+
*
|
|
125
|
+
* Index aligns with `enumerateDocumentSections` in the layout package. Existing merged
|
|
126
|
+
* maps stay available via {@link resolveHeaderFooterPartsBySection}.
|
|
127
|
+
*/
|
|
128
|
+
declare function resolveHeaderFooterResolutionBySection(pkg: OoxmlPackage): readonly HeaderFooterSectionResolution[];
|
|
129
|
+
/**
|
|
130
|
+
* Resolve header/footer parts for every section, applying OOXML inheritance.
|
|
131
|
+
*
|
|
132
|
+
* Index aligns with `enumerateDocumentSections` in the layout package.
|
|
133
|
+
*/
|
|
134
|
+
declare function resolveHeaderFooterPartsBySection(pkg: OoxmlPackage): readonly HeaderFooterParts[];
|
|
135
|
+
/**
|
|
136
|
+
* Resolve the main-document header/footer references to their parts, gated by the
|
|
137
|
+
* settings the section actually declares.
|
|
138
|
+
*
|
|
139
|
+
* Returns the FINAL section's effective parts (after inheritance). Multi-section hosts
|
|
140
|
+
* should prefer `resolveHeaderFooterPartsBySection`.
|
|
141
|
+
*/
|
|
142
|
+
declare function resolveHeaderFooterParts(pkg: OoxmlPackage): HeaderFooterParts;
|
|
143
|
+
|
|
144
|
+
/** Lifecycle impact — furniture always reaches multiple pages; never narrower than flow-structural. */
|
|
145
|
+
type HeaderFooterLifecycleImpact = 'flow-structural' | 'global';
|
|
146
|
+
/**
|
|
147
|
+
* A header/footer lifecycle mutation: create, remove, or relink a variant.
|
|
148
|
+
*
|
|
149
|
+
* Package-level, like note lifecycle: each touches the document, the header/footer part, the
|
|
150
|
+
* relationships and `[Content_Types].xml` together.
|
|
151
|
+
*/
|
|
152
|
+
type HeaderFooterLifecycleOp = {
|
|
153
|
+
readonly op: 'createHeaderFooter';
|
|
154
|
+
readonly sectionIndex: number;
|
|
155
|
+
readonly kind: HeaderFooterKind;
|
|
156
|
+
readonly variant: HeaderFooterVariant;
|
|
157
|
+
/** When true, also set section `w:titlePg` in the same package transaction. */
|
|
158
|
+
readonly titlePage?: boolean;
|
|
159
|
+
/** When true, also set document `w:evenAndOddHeaders` in the same package transaction. */
|
|
160
|
+
readonly evenAndOddHeaders?: boolean;
|
|
161
|
+
} | {
|
|
162
|
+
readonly op: 'deleteHeaderFooter';
|
|
163
|
+
readonly sectionIndex: number;
|
|
164
|
+
readonly kind: HeaderFooterKind;
|
|
165
|
+
readonly variant: HeaderFooterVariant;
|
|
166
|
+
} | {
|
|
167
|
+
readonly op: 'linkToPrevious';
|
|
168
|
+
readonly sectionIndex: number;
|
|
169
|
+
readonly kind: HeaderFooterKind;
|
|
170
|
+
readonly variant: HeaderFooterVariant;
|
|
171
|
+
} | {
|
|
172
|
+
readonly op: 'unlinkFromPrevious';
|
|
173
|
+
readonly sectionIndex: number;
|
|
174
|
+
readonly kind: HeaderFooterKind;
|
|
175
|
+
readonly variant: HeaderFooterVariant;
|
|
176
|
+
} | {
|
|
177
|
+
readonly op: 'setSectionFurnitureOptions';
|
|
178
|
+
readonly sectionIndex?: number;
|
|
179
|
+
readonly titlePage?: boolean;
|
|
180
|
+
readonly evenAndOddHeaders?: boolean;
|
|
181
|
+
readonly headerDistanceTwips?: number;
|
|
182
|
+
readonly footerDistanceTwips?: number;
|
|
183
|
+
} | {
|
|
184
|
+
/**
|
|
185
|
+
* A `settings.xml` write like `evenAndOddHeaders`, so it rides the same package-level
|
|
186
|
+
* undo unit and the same routing rather than growing a second lifecycle lane.
|
|
187
|
+
*/
|
|
188
|
+
readonly op: 'setDocumentProtection';
|
|
189
|
+
readonly enforce: boolean;
|
|
190
|
+
};
|
|
191
|
+
/** Why a header/footer lifecycle op was refused. */
|
|
192
|
+
type HeaderFooterLifecycleRejection = 'invalidArgs' | 'tree-invariant';
|
|
193
|
+
/** A new package, or a typed rejection. Pure and all-or-nothing — no partial writes. */
|
|
194
|
+
type HeaderFooterLifecycleResult = {
|
|
195
|
+
readonly ok: true;
|
|
196
|
+
readonly package: OoxmlPackage;
|
|
197
|
+
readonly impact: HeaderFooterLifecycleImpact;
|
|
198
|
+
readonly createdRId?: string;
|
|
199
|
+
readonly createdPartName?: string;
|
|
200
|
+
} | {
|
|
201
|
+
readonly ok: false;
|
|
202
|
+
readonly reason: HeaderFooterLifecycleRejection;
|
|
203
|
+
readonly detail?: string;
|
|
204
|
+
};
|
|
205
|
+
/** Whether an op is a header/footer lifecycle op rather than a story-level one. */
|
|
206
|
+
declare function isHeaderFooterLifecycleOp(op: {
|
|
207
|
+
readonly op: string;
|
|
208
|
+
}): op is HeaderFooterLifecycleOp;
|
|
209
|
+
/**
|
|
210
|
+
* Apply one furniture lifecycle op atomically. Rejected ops leave the input package
|
|
211
|
+
* untouched (pure function — callers discard the result).
|
|
212
|
+
*/
|
|
213
|
+
declare function applyHeaderFooterLifecycleOp(pkg: OoxmlPackage, op: HeaderFooterLifecycleOp): HeaderFooterLifecycleResult;
|
|
214
|
+
|
|
215
|
+
/** UTF-16 placeholder for one atomic note unit in `paragraphTextOf` / segments. */
|
|
216
|
+
declare const NOTE_ATOM_CHAR = "\uFFFC";
|
|
217
|
+
/** Signed 32-bit Word-compatible note id range (positive allocation only). */
|
|
218
|
+
declare const NOTE_ID_MIN = 1;
|
|
219
|
+
/** Largest note id Word accepts — signed 32-bit. */
|
|
220
|
+
declare const NOTE_ID_MAX = 2147483647;
|
|
221
|
+
/** Reserved separator / continuation ids — never allocated for normal notes. */
|
|
222
|
+
declare const NOTE_SEPARATOR_ID = -1;
|
|
223
|
+
/** Reserved id of the continuation-separator entry. Never allocated to a real note. */
|
|
224
|
+
declare const NOTE_CONTINUATION_SEPARATOR_ID = 0;
|
|
225
|
+
/** Which notes part a note lives in. Decides both placement and numbering rules. */
|
|
226
|
+
type NoteKind = 'footnote' | 'endnote';
|
|
227
|
+
/** Authored `ST_FtnEdn` including explicit `normal`. Absent means Word default (normal). */
|
|
228
|
+
/**
|
|
229
|
+
* What a note entry IS.
|
|
230
|
+
*
|
|
231
|
+
* Only `normal` is a note a reader sees. The others are the furniture Word stores in the same
|
|
232
|
+
* part — the rules and notices drawn around the note area — reached by reserved ids.
|
|
233
|
+
*/
|
|
234
|
+
type NoteType = 'normal' | 'separator' | 'continuationSeparator' | 'continuationNotice';
|
|
235
|
+
/** Parse a signed decimal note id; reject non-integers and out-of-int32 values. */
|
|
236
|
+
declare function parseNoteId(raw: string | undefined): number | null;
|
|
237
|
+
/**
|
|
238
|
+
* Canonical `EditorScope { kind: 'note'; id }` encoding.
|
|
239
|
+
*
|
|
240
|
+
* Footnote id `1` and endnote id `1` coexist, so the kind is part of the string:
|
|
241
|
+
* `footnote:2` / `endnote:-1`. Do not invent a parallel scope union arm.
|
|
242
|
+
*/
|
|
243
|
+
declare function formatNoteScopeId(noteKind: NoteKind, noteId: number): string;
|
|
244
|
+
/**
|
|
245
|
+
* Parse {@link formatNoteScopeId}. Returns `null` for malformed / out-of-range ids.
|
|
246
|
+
*/
|
|
247
|
+
declare function parseNoteScopeId(id: string): {
|
|
248
|
+
readonly noteKind: NoteKind;
|
|
249
|
+
readonly noteId: number;
|
|
250
|
+
} | null;
|
|
251
|
+
/** Whether a node is a `w:footnotes` part root. */
|
|
252
|
+
declare function isFootnotesNode(node: OoxmlNode): node is OoxmlFootnotesNode;
|
|
253
|
+
/** Whether a node is a `w:endnotes` part root. */
|
|
254
|
+
declare function isEndnotesNode(node: OoxmlNode): node is OoxmlEndnotesNode;
|
|
255
|
+
/** Whether a node is a `w:footnote` or `w:endnote` body. */
|
|
256
|
+
declare function isNoteNode(node: OoxmlNode): node is OoxmlNoteNode;
|
|
257
|
+
/** Whether a node is a body-side `w:footnoteReference` / `w:endnoteReference`. */
|
|
258
|
+
declare function isNoteReferenceNode(node: OoxmlNode): node is OoxmlNoteReferenceNode;
|
|
259
|
+
/** Whether a node is the `w:footnoteRef` / `w:endnoteRef` mark inside a note's own body. */
|
|
260
|
+
declare function isNoteRefNode(node: OoxmlNode): node is OoxmlNoteRefNode;
|
|
261
|
+
/** Whether a node is the `w:separator` rule drawn above the note area. */
|
|
262
|
+
declare function isSeparatorNode(node: OoxmlNode): node is OoxmlSeparatorNode;
|
|
263
|
+
/** Whether a node is the `w:continuationSeparator` rule used on continuation pages. */
|
|
264
|
+
declare function isContinuationSeparatorNode(node: OoxmlNode): node is OoxmlContinuationSeparatorNode;
|
|
265
|
+
/** Typed or generic `w:footnote` / `w:endnote`. */
|
|
266
|
+
declare function noteKindOf(node: OoxmlNode): NoteKind | null;
|
|
267
|
+
/** Authored `@w:id` on a note or noteReference when parseable. */
|
|
268
|
+
declare function noteIdOf(node: OoxmlNode): number | null;
|
|
269
|
+
/** Authored `@w:type` (`ST_FtnEdn`) when present and schema-legal; else `undefined`. */
|
|
270
|
+
declare function noteTypeOf(node: OoxmlNode): NoteType | undefined;
|
|
271
|
+
/** Whether a note is a normal (body) note — absent type and explicit `normal` both count. */
|
|
272
|
+
declare function isNormalNote(node: OoxmlNode): boolean;
|
|
273
|
+
/** Typed or generic footnote/endnote reference kind. */
|
|
274
|
+
declare function noteReferenceKindOf(node: OoxmlNode): NoteKind | null;
|
|
275
|
+
/** Typed or generic `w:footnoteRef` / `w:endnoteRef`. */
|
|
276
|
+
declare function noteRefKindOf(node: OoxmlNode): NoteKind | null;
|
|
277
|
+
/**
|
|
278
|
+
* Read `@w:customMarkFollows` on a note reference.
|
|
279
|
+
* Returns `undefined` when absent; otherwise the OOXML on/off interpretation.
|
|
280
|
+
*/
|
|
281
|
+
declare function customMarkFollows(node: OoxmlNode): boolean | undefined;
|
|
282
|
+
/** Model text contributed by one atomic note unit. */
|
|
283
|
+
declare function noteAtomText(): typeof NOTE_ATOM_CHAR;
|
|
284
|
+
/**
|
|
285
|
+
* True when a run-inner node is a typed note atom that contributes one UTF-16 unit.
|
|
286
|
+
* Demoted/malformed known locals stay generic and contribute nothing.
|
|
287
|
+
*/
|
|
288
|
+
declare function isNoteAtomNode(node: OoxmlNode): boolean;
|
|
289
|
+
/**
|
|
290
|
+
* One atomic note span inside a paragraph for caret / delete / selection.
|
|
291
|
+
*
|
|
292
|
+
* Each typed note atom is a single-node span (`removeNodeIds` = that node).
|
|
293
|
+
*/
|
|
294
|
+
interface AtomicNoteSpan {
|
|
295
|
+
readonly kind: 'noteReference' | 'noteRef' | 'separator' | 'continuationSeparator';
|
|
296
|
+
readonly node: OoxmlNode;
|
|
297
|
+
readonly runId: string;
|
|
298
|
+
readonly removeNodeIds: readonly string[];
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Collect typed note atoms in document order (one segment each).
|
|
302
|
+
*
|
|
303
|
+
* Walks the same paragraph-inline surface as `segmentsOf` / `walkParagraphInline`:
|
|
304
|
+
* hyperlinks and content controls flatten; only direct run children contribute atoms.
|
|
305
|
+
* A demoted run-inner SDT husk stays opaque — no phantom addressable hit.
|
|
306
|
+
*/
|
|
307
|
+
declare function atomicNoteSpansOf(paragraph: OoxmlParagraphNode): readonly AtomicNoteSpan[];
|
|
308
|
+
/** Cap on notes scanned when allocating / indexing a notes part. */
|
|
309
|
+
declare const MAX_NOTES_PER_PART = 10000;
|
|
310
|
+
/**
|
|
311
|
+
* Allocate the next positive signed 32-bit note id for a notes-part root.
|
|
312
|
+
*
|
|
313
|
+
* Solo: `max(existing)+1`, the dense sequence Word writes. `null` on exhaustion, so the
|
|
314
|
+
* caller refuses rather than wrapping onto an id a note already holds.
|
|
315
|
+
*
|
|
316
|
+
* With a collaboration actor bound — explicit argument, or the open store transaction — the
|
|
317
|
+
* id is the next unused value in that actor's stripe. Two peers each adding their first
|
|
318
|
+
* footnote from one snapshot otherwise both mint `w:id="1"`: the merge keeps both bodies
|
|
319
|
+
* under one id, both `w:footnoteReference` marks resolve to the first, and one author's note
|
|
320
|
+
* becomes unreachable.
|
|
321
|
+
*
|
|
322
|
+
* The reserved ids stay reserved either way. `0` (continuation separator) is seeded as used,
|
|
323
|
+
* so a residue of 0 advances one class instead of taking Word's furniture, and a stripe walk
|
|
324
|
+
* only ever climbs from a non-negative residue, so `-1` (separator) is unreachable.
|
|
325
|
+
*/
|
|
326
|
+
declare function allocateNoteId(notesRoot: OoxmlNode, actorId?: string): number | null;
|
|
327
|
+
/** Collect note bodies from a footnotes/endnotes root, bounded. */
|
|
328
|
+
declare function notesOf(root: OoxmlNode): readonly OoxmlNoteNode[];
|
|
329
|
+
/** Find a typed note by id inside a notes-part root. */
|
|
330
|
+
declare function findNoteById(root: OoxmlNode, noteId: number): OoxmlNoteNode | undefined;
|
|
331
|
+
|
|
332
|
+
/** Cap on nodes visited while scanning for note references across stories. */
|
|
333
|
+
declare const MAX_NOTE_REFERENCE_SCAN = 20000;
|
|
334
|
+
/**
|
|
335
|
+
* Cap on XML parts walked in one package-wide note-reference scan (N/N+1 gate).
|
|
336
|
+
* Soft targets are not allowed: exceeding this marks the shared budget truncated.
|
|
337
|
+
*/
|
|
338
|
+
declare const MAX_NOTE_REFERENCE_PARTS = 256;
|
|
339
|
+
/**
|
|
340
|
+
* A load-time note problem worth reporting.
|
|
341
|
+
*
|
|
342
|
+
* `dangling-note-reference` is a citation pointing at no note; `note-reference-scan-truncated`
|
|
343
|
+
* says the scan hit its budget, so absence of further diagnostics is not proof of correctness.
|
|
344
|
+
*/
|
|
345
|
+
type NoteDiagnosticCode = 'dangling-note-reference' | 'note-reference-scan-truncated';
|
|
346
|
+
/**
|
|
347
|
+
* Load-time note diagnostics. Array API preserved; truncation is signaled as a typed
|
|
348
|
+
* entry rather than by throwing or rejecting the package.
|
|
349
|
+
*/
|
|
350
|
+
type NoteDiagnostic = {
|
|
351
|
+
readonly code: 'dangling-note-reference';
|
|
352
|
+
readonly noteKind: NoteKind;
|
|
353
|
+
readonly noteId: number;
|
|
354
|
+
/** Paragraph / container node id when known. */
|
|
355
|
+
readonly sourceNodeId?: string;
|
|
356
|
+
} | {
|
|
357
|
+
/** Hard visited/part budget or soft hit cap stopped the scan before full coverage. */
|
|
358
|
+
readonly code: 'note-reference-scan-truncated';
|
|
359
|
+
};
|
|
360
|
+
/** One note reference found in a story, with where it sits. */
|
|
361
|
+
interface NoteReferenceHit {
|
|
362
|
+
readonly noteKind: NoteKind;
|
|
363
|
+
readonly noteId: number;
|
|
364
|
+
readonly nodeId: string;
|
|
365
|
+
readonly paragraphId: string;
|
|
366
|
+
/** Canonical UTF-16 atom offset within {@link paragraphId} (U+FFFC model). */
|
|
367
|
+
readonly atomOffset: number;
|
|
368
|
+
readonly customMarkFollows: boolean;
|
|
369
|
+
/** Canonical part name that owns this reference. */
|
|
370
|
+
readonly partName: string;
|
|
371
|
+
}
|
|
372
|
+
/** Mutable visited-node + part budget shared across parts / package snapshots. */
|
|
373
|
+
interface NoteReferenceScanBudget {
|
|
374
|
+
visited: number;
|
|
375
|
+
readonly maxVisited: number;
|
|
376
|
+
parts: number;
|
|
377
|
+
readonly maxParts: number;
|
|
378
|
+
/** Set when a walk stops before finishing because a cap was hit. */
|
|
379
|
+
truncated: boolean;
|
|
380
|
+
}
|
|
381
|
+
/** A bounded budget for scanning note references, so a crafted document cannot stall a load. */
|
|
382
|
+
declare function createNoteReferenceScanBudget(maxVisited?: number, maxParts?: number): NoteReferenceScanBudget;
|
|
383
|
+
/**
|
|
384
|
+
* Resolve the footnotes or endnotes part via safe Internal document relationships.
|
|
385
|
+
*
|
|
386
|
+
* Unusable matching relationships (External, unsafe target, missing part, wrong root)
|
|
387
|
+
* are skipped — never fetched, never accepted — so a decoy first match cannot hide a
|
|
388
|
+
* later usable Internal notes part (same continue-past-bad pattern as settingsPartOf).
|
|
389
|
+
*/
|
|
390
|
+
declare function resolveNotesPart(pkg: OoxmlPackage, noteKind: NoteKind): OoxmlPart | null;
|
|
391
|
+
/** Walk a part without applying a layout projection. */
|
|
392
|
+
declare function collectNoteReferences(part: OoxmlPart, options?: {
|
|
393
|
+
readonly maxHits?: number;
|
|
394
|
+
readonly budget?: NoteReferenceScanBudget;
|
|
395
|
+
}): readonly NoteReferenceHit[];
|
|
396
|
+
/** Collect references across every XML part under one shared part + visited-node budget. */
|
|
397
|
+
declare function collectPackageNoteReferences(pkg: OoxmlPackage, options?: {
|
|
398
|
+
readonly budget?: NoteReferenceScanBudget;
|
|
399
|
+
/** Soft hit cap for diagnostics. Omit / Infinity for mutation scans. */
|
|
400
|
+
readonly maxHits?: number;
|
|
401
|
+
}): readonly NoteReferenceHit[];
|
|
402
|
+
/**
|
|
403
|
+
* Load diagnostics for dangling note references. Fail-open: never throws or mutates;
|
|
404
|
+
* returns diagnostics for callers to surface. Does not invent missing note bodies.
|
|
405
|
+
*
|
|
406
|
+
* When the hard visited/part budget truncates or the soft hit cap binds, appends a single
|
|
407
|
+
* `note-reference-scan-truncated` entry so incomplete coverage is visible without breaking
|
|
408
|
+
* consumers that filter on `dangling-note-reference`.
|
|
409
|
+
*/
|
|
410
|
+
declare function diagnoseNoteReferences(pkg: OoxmlPackage): readonly NoteDiagnostic[];
|
|
411
|
+
/** Whether a notes-part root contains a note with the given id (any type). */
|
|
412
|
+
declare function notesPartHasId(part: OoxmlPart, noteId: number): boolean;
|
|
413
|
+
/** List normal (body) note ids in document order, bounded. */
|
|
414
|
+
declare function normalNoteIds(part: OoxmlPart): readonly number[];
|
|
415
|
+
|
|
416
|
+
/** How far a note lifecycle op reaches — which parts a caller must expect to have changed. */
|
|
417
|
+
type NoteLifecycleImpact = 'flow-structural' | 'global';
|
|
418
|
+
/**
|
|
419
|
+
* A note lifecycle mutation: insert, delete, convert, or set properties.
|
|
420
|
+
*
|
|
421
|
+
* Package-level rather than story-level, because every one of these touches the main document,
|
|
422
|
+
* the notes part, the document relationships AND `[Content_Types].xml` together.
|
|
423
|
+
*/
|
|
424
|
+
type NoteLifecycleOp = {
|
|
425
|
+
readonly op: 'insertNote';
|
|
426
|
+
readonly noteKind: NoteKind;
|
|
427
|
+
readonly paragraphId: string;
|
|
428
|
+
readonly offset: number;
|
|
429
|
+
/**
|
|
430
|
+
* Write the citing reference as a TRACKED insertion: the reference run goes inside a
|
|
431
|
+
* `w:ins` carrying this attribution. The note body stays plain — rejecting the
|
|
432
|
+
* reference removes it, and the orphaned body is swept by the same cascade an
|
|
433
|
+
* untracked reference deletion triggers.
|
|
434
|
+
*/
|
|
435
|
+
readonly revision?: RevisionAttributionInput;
|
|
436
|
+
} | {
|
|
437
|
+
readonly op: 'deleteNote';
|
|
438
|
+
readonly noteKind: NoteKind;
|
|
439
|
+
readonly noteId: number;
|
|
440
|
+
} | {
|
|
441
|
+
readonly op: 'convertNote';
|
|
442
|
+
readonly fromKind: NoteKind;
|
|
443
|
+
readonly noteId: number;
|
|
444
|
+
} | {
|
|
445
|
+
/**
|
|
446
|
+
* Convert every normal note of `fromKind` in document order. One atomic package
|
|
447
|
+
* transaction / undo unit with the same validation as repeated `convertNote`.
|
|
448
|
+
*/
|
|
449
|
+
readonly op: 'convertAllNotes';
|
|
450
|
+
readonly fromKind: NoteKind;
|
|
451
|
+
} | {
|
|
452
|
+
readonly op: 'setNoteProperties';
|
|
453
|
+
readonly scope: 'document' | 'section';
|
|
454
|
+
readonly sectionIndex?: number;
|
|
455
|
+
readonly footnote?: {
|
|
456
|
+
readonly numFmt?: string;
|
|
457
|
+
readonly numRestart?: string;
|
|
458
|
+
readonly position?: string;
|
|
459
|
+
readonly numStart?: number;
|
|
460
|
+
};
|
|
461
|
+
readonly endnote?: {
|
|
462
|
+
readonly numFmt?: string;
|
|
463
|
+
readonly numRestart?: string;
|
|
464
|
+
readonly position?: string;
|
|
465
|
+
readonly numStart?: number;
|
|
466
|
+
};
|
|
467
|
+
};
|
|
468
|
+
/** Why a note lifecycle op was refused. */
|
|
469
|
+
type NoteLifecycleRejection = 'invalidArgs' | 'invalid-property-value' | 'tree-invariant';
|
|
470
|
+
/**
|
|
471
|
+
* A new package, or a typed rejection.
|
|
472
|
+
*
|
|
473
|
+
* Application is PURE and all-or-nothing: there are no partial writes, so a refused op leaves the
|
|
474
|
+
* caller's package untouched rather than half-migrated across four parts.
|
|
475
|
+
*/
|
|
476
|
+
type NoteLifecycleResult = {
|
|
477
|
+
readonly ok: true;
|
|
478
|
+
readonly package: OoxmlPackage;
|
|
479
|
+
readonly impact: NoteLifecycleImpact;
|
|
480
|
+
readonly noteId?: number;
|
|
481
|
+
readonly noteKind?: NoteKind;
|
|
482
|
+
readonly createdPartName?: string;
|
|
483
|
+
} | {
|
|
484
|
+
readonly ok: false;
|
|
485
|
+
readonly reason: NoteLifecycleRejection;
|
|
486
|
+
readonly detail?: string;
|
|
487
|
+
};
|
|
488
|
+
/** Whether an op is a note lifecycle op rather than a story-level one. */
|
|
489
|
+
declare function isNoteLifecycleOp(op: {
|
|
490
|
+
readonly op: string;
|
|
491
|
+
}): op is NoteLifecycleOp;
|
|
492
|
+
/** Attribution and limits applied to one note lifecycle op. */
|
|
493
|
+
interface NoteLifecycleOptions {
|
|
494
|
+
/**
|
|
495
|
+
* Shared part + visited-node budget for reference scans. When omitted a fresh default
|
|
496
|
+
* budget is used. Truncation rejects the op with the original package unchanged.
|
|
497
|
+
*/
|
|
498
|
+
readonly scanBudget?: NoteReferenceScanBudget;
|
|
499
|
+
}
|
|
500
|
+
/**
|
|
501
|
+
* Apply one note lifecycle op atomically. Rejected ops leave the input package untouched.
|
|
502
|
+
*/
|
|
503
|
+
declare function applyNoteLifecycleOp(pkg: OoxmlPackage, op: NoteLifecycleOp, options?: NoteLifecycleOptions): NoteLifecycleResult;
|
|
504
|
+
/**
|
|
505
|
+
* How deleting text cascades into the notes it referenced.
|
|
506
|
+
*
|
|
507
|
+
* A note's body and the citation reaching it are one thing to a reader, so removing the reference
|
|
508
|
+
* must remove the body too or the notes part keeps an entry nothing points at.
|
|
509
|
+
*/
|
|
510
|
+
interface CascadeDeletedNoteReferencesOptions {
|
|
511
|
+
/**
|
|
512
|
+
* Independent full budgets per snapshot. When omitted each snapshot gets its own
|
|
513
|
+
* default budget — never share one counter across before/after walks.
|
|
514
|
+
*/
|
|
515
|
+
readonly beforeBudget?: NoteReferenceScanBudget;
|
|
516
|
+
readonly afterBudget?: NoteReferenceScanBudget;
|
|
517
|
+
}
|
|
518
|
+
/**
|
|
519
|
+
* Remove note bodies for references that disappeared between two package snapshots.
|
|
520
|
+
* Used when `deleteText` or `deleteBlock` removes a `noteReference` atom so body+ref stay
|
|
521
|
+
* one undo unit.
|
|
522
|
+
*
|
|
523
|
+
* Each snapshot gets an independent full visited/part budget. If either scan truncates
|
|
524
|
+
* the cascade fails closed so a hostile package cannot skip body deletion silently —
|
|
525
|
+
* without accidentally halving capacity by charging both walks to one counter.
|
|
526
|
+
*/
|
|
527
|
+
declare function cascadeDeletedNoteReferences(before: OoxmlPackage, after: OoxmlPackage, options?: CascadeDeletedNoteReferencesOptions): OoxmlPackage | null;
|
|
528
|
+
|
|
529
|
+
interface InsertImageInput {
|
|
530
|
+
readonly paragraphId: string;
|
|
531
|
+
readonly offset: number;
|
|
532
|
+
readonly bytes: Uint8Array;
|
|
533
|
+
readonly mime: SupportedImageMime;
|
|
534
|
+
readonly widthPoints: number;
|
|
535
|
+
readonly heightPoints: number;
|
|
536
|
+
readonly decodePort: ImageDecodePort;
|
|
537
|
+
readonly expectedPackageRevision: number;
|
|
538
|
+
readonly commitGuard?: () => boolean;
|
|
539
|
+
readonly title?: string;
|
|
540
|
+
readonly description?: string;
|
|
541
|
+
readonly hyperlink?: string;
|
|
542
|
+
/** Present in suggesting mode: the inserted drawing's run goes into a `w:ins`. */
|
|
543
|
+
readonly revision?: RevisionAttributionInput;
|
|
544
|
+
/**
|
|
545
|
+
* Collaboration actor for the ids this insert mints — `wp:docPr/@id`, the image
|
|
546
|
+
* relationship, and a hyperlink relationship when one is asked for.
|
|
547
|
+
*
|
|
548
|
+
* EXPLICIT, and not the ambient `runWithTransactionActor` binding, because this entry is
|
|
549
|
+
* async: the mint runs after `await validateEmbeddedImageForCommit` and the ambient actor
|
|
550
|
+
* is synchronous-only. A wrap around the call would compile, read as correct, and be gone
|
|
551
|
+
* by the time the id is taken. Omitted (solo) keeps Word's dense `highest + 1` sequence.
|
|
552
|
+
*/
|
|
553
|
+
readonly actorId?: string;
|
|
554
|
+
}
|
|
555
|
+
interface ReplaceImageOptions {
|
|
556
|
+
readonly expectedPackageRevision: number;
|
|
557
|
+
readonly commitGuard?: () => boolean;
|
|
558
|
+
/** Collaboration actor for the replacement's minted ids. See {@link InsertImageInput.actorId}. */
|
|
559
|
+
readonly actorId?: string;
|
|
560
|
+
}
|
|
561
|
+
type ImageIntentResult = (Extract<PackageTransactResult, {
|
|
562
|
+
ok: true;
|
|
563
|
+
}> & {
|
|
564
|
+
readonly drawingNodeId?: string;
|
|
565
|
+
readonly mediaPartName?: string;
|
|
566
|
+
}) | Extract<PackageTransactResult, {
|
|
567
|
+
ok: false;
|
|
568
|
+
}>;
|
|
569
|
+
interface ApplyImagePropertiesInput {
|
|
570
|
+
readonly drawingNodeId: string;
|
|
571
|
+
readonly ops: readonly DrawingTreeDocOp[];
|
|
572
|
+
readonly hyperlink: string | null;
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
/**
|
|
576
|
+
* The identity of one continuous user gesture, for history grouping.
|
|
577
|
+
*
|
|
578
|
+
* A live color picker, a font-size stepper or a spacing slider applies every intermediate
|
|
579
|
+
* value so the document updates under the pointer, and each of those writes is a
|
|
580
|
+
* transaction in its own right — it must render, and a collaborator must receive it. What
|
|
581
|
+
* they are NOT is separate undo steps. The caller mints one token when the gesture starts
|
|
582
|
+
* (`Symbol('color-drag')`) and passes it with every write until the gesture ends.
|
|
583
|
+
*
|
|
584
|
+
* A symbol rather than a string, so two unrelated callers cannot collide by naming their
|
|
585
|
+
* gesture the same way, and so a token cannot outlive its gesture by accident through
|
|
586
|
+
* serialization.
|
|
587
|
+
*/
|
|
588
|
+
type HistoryGroup = symbol;
|
|
589
|
+
type HistoryCaptureKind = 'started' | 'extended' | 'split';
|
|
590
|
+
type HistoryCaptureReason = 'package-unit' | 'composition';
|
|
591
|
+
declare function observeHistoryGroup<T>(group: HistoryGroup, report: (kind: HistoryCaptureKind, reason?: HistoryCaptureReason) => void, run: () => T): T;
|
|
592
|
+
declare function reportHistoryGroup(group: HistoryGroup | undefined, kind: HistoryCaptureKind, reason?: HistoryCaptureReason): void;
|
|
593
|
+
|
|
594
|
+
/** How one transaction behaves: its story scope, its attribution, and its selection marks. */
|
|
595
|
+
interface TransactOptions {
|
|
596
|
+
readonly origin?: string;
|
|
597
|
+
/** Stable actor attribution for collaboration and audit correlation. */
|
|
598
|
+
readonly actorId?: string;
|
|
599
|
+
/** Stable constituent identity for collaboration duplicate correlation. */
|
|
600
|
+
readonly operationId?: string;
|
|
601
|
+
/**
|
|
602
|
+
* Whether this transaction enters the legacy snapshot undo stack.
|
|
603
|
+
*
|
|
604
|
+
* Collaboration commits set this to false because their actor-local undo authority is the
|
|
605
|
+
* CRDT undo manager. Omitted preserves the ordinary non-collaborative history behavior.
|
|
606
|
+
*/
|
|
607
|
+
readonly recordsHistory?: boolean;
|
|
608
|
+
/**
|
|
609
|
+
* A COMMAND is one user intent that may need several ops (a toolbar click applying a
|
|
610
|
+
* property across a multi-run selection). It is still exactly one history entry, which is
|
|
611
|
+
* the same rule a plain transaction follows — the option exists to say so explicitly at
|
|
612
|
+
* the call site rather than leaving it implied.
|
|
613
|
+
*/
|
|
614
|
+
readonly scope?: 'transaction' | 'command';
|
|
615
|
+
/**
|
|
616
|
+
* Floor on the published impact. Header/footer story edits use `global` so every page
|
|
617
|
+
* sharing the part invalidates rather than keeping stale furniture.
|
|
618
|
+
*/
|
|
619
|
+
readonly minimumImpact?: ImpactClass;
|
|
620
|
+
/** Story identity stamped onto the published ModelChange (package-aware targeting). */
|
|
621
|
+
readonly story?: TreeStoryRef;
|
|
622
|
+
/**
|
|
623
|
+
* The gesture this transaction belongs to: consecutive transactions carrying the SAME
|
|
624
|
+
* token extend one history entry (package from before the first, selection after the
|
|
625
|
+
* latest). Another token, none, undo or redo closes the group. See {@link HistoryGroup}.
|
|
626
|
+
*/
|
|
627
|
+
readonly historyGroup?: HistoryGroup;
|
|
628
|
+
/**
|
|
629
|
+
* How the transaction's ops address saved field results. `atomic` (the default) keeps
|
|
630
|
+
* every field one offset unit; `editable` addresses saved results as text. See
|
|
631
|
+
* `field-result-mode.ts`.
|
|
632
|
+
*/
|
|
633
|
+
readonly fieldResults?: FieldResultsMode;
|
|
634
|
+
}
|
|
635
|
+
/** How a store is constructed: its limits, its history depth, and its identity source. */
|
|
636
|
+
interface TreeDocumentStoreOptions {
|
|
637
|
+
/** Bound on retained history entries. Oldest entries drop first. */
|
|
638
|
+
readonly historyLimit?: number;
|
|
639
|
+
/**
|
|
640
|
+
* The document's `settings.xml`, for a store built from a PART rather than a package.
|
|
641
|
+
*
|
|
642
|
+
* Forms protection lives one part up from the op, and a store built from a part gets a
|
|
643
|
+
* synthetic one-part package that cannot see it — so `w:documentProtection w:edit="forms"`
|
|
644
|
+
* was enforced in the body and nowhere else, and a header, a footer or a note accepted every
|
|
645
|
+
* write a protected document is supposed to refuse. Read through a getter, not captured: a
|
|
646
|
+
* document can gain or lose protection while its stories stay open.
|
|
647
|
+
*/
|
|
648
|
+
readonly settingsPart?: () => OoxmlPart | null | undefined;
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
/** A selection the caller wants restored when an entry is undone or redone. */
|
|
652
|
+
/** A selection captured with a transaction, so undo restores where the caret was. */
|
|
653
|
+
interface SelectionMark {
|
|
654
|
+
readonly paragraphId: string;
|
|
655
|
+
readonly start: number;
|
|
656
|
+
readonly end: number;
|
|
657
|
+
}
|
|
658
|
+
/**
|
|
659
|
+
* Which editable story a ModelChange came from.
|
|
660
|
+
*
|
|
661
|
+
* Mirrors `EditorScope` for body and header/footer — `{ kind: 'headerFooter'; rId }` —
|
|
662
|
+
* so package-aware mutation and the public scope contract stay one vocabulary. Body
|
|
663
|
+
* commits omit `rId`; header/footer commits carry the relationship id that addressed
|
|
664
|
+
* the part. Notes parts use `{ kind: 'notesPart'; noteKind }` (one store per part).
|
|
665
|
+
*/
|
|
666
|
+
/** Which story a transaction targets: the body, a header/footer part, or a notes part. */
|
|
667
|
+
type TreeStoryRef = {
|
|
668
|
+
readonly kind: 'body';
|
|
669
|
+
readonly partName: string;
|
|
670
|
+
} | {
|
|
671
|
+
readonly kind: 'headerFooter';
|
|
672
|
+
readonly partName: string;
|
|
673
|
+
readonly rId: string;
|
|
674
|
+
} | {
|
|
675
|
+
readonly kind: 'notesPart';
|
|
676
|
+
readonly partName: string;
|
|
677
|
+
readonly noteKind: 'footnote' | 'endnote';
|
|
678
|
+
};
|
|
679
|
+
/**
|
|
680
|
+
* What one committed transaction changed: the revision, the ids touched, and the impact class.
|
|
681
|
+
*
|
|
682
|
+
* The ids are what let layout and paint re-do only the affected blocks instead of the document.
|
|
683
|
+
*/
|
|
684
|
+
interface TreeModelChange {
|
|
685
|
+
readonly change: 'model-change';
|
|
686
|
+
readonly fromRevision: number;
|
|
687
|
+
readonly toRevision: number;
|
|
688
|
+
readonly commitId: string;
|
|
689
|
+
readonly origin: string;
|
|
690
|
+
/** Stable collaboration actor attribution, when the caller supplied it. */
|
|
691
|
+
readonly actorId?: string;
|
|
692
|
+
/** Stable collaboration operation identity, when the caller supplied it. */
|
|
693
|
+
readonly operationId?: string;
|
|
694
|
+
readonly dirty: readonly string[];
|
|
695
|
+
readonly created: readonly string[];
|
|
696
|
+
readonly deleted: readonly string[];
|
|
697
|
+
readonly splitJoin: readonly ({
|
|
698
|
+
readonly split: {
|
|
699
|
+
readonly from: string;
|
|
700
|
+
readonly tail: string;
|
|
701
|
+
};
|
|
702
|
+
} | {
|
|
703
|
+
readonly join: {
|
|
704
|
+
readonly kept: string;
|
|
705
|
+
readonly removed: string;
|
|
706
|
+
};
|
|
707
|
+
})[];
|
|
708
|
+
readonly dependencyKeys: readonly string[];
|
|
709
|
+
/** The widest impact among the transaction's ops — what layout must scope to. */
|
|
710
|
+
readonly impact: ImpactClass;
|
|
711
|
+
/**
|
|
712
|
+
* Story that published this change. Absent on body-only store publishes that predate
|
|
713
|
+
* package-aware targeting; `TreePackageStore` always sets it.
|
|
714
|
+
*/
|
|
715
|
+
readonly story?: TreeStoryRef;
|
|
716
|
+
/**
|
|
717
|
+
* Committed collapsed caret for this transaction, when one exists.
|
|
718
|
+
* Matches history `selectionAfter` when that mark is collapsed; absent for explicit
|
|
719
|
+
* null, non-collapsed explicit selection, or when no caret was committed.
|
|
720
|
+
*/
|
|
721
|
+
readonly caret?: SelectionMark;
|
|
722
|
+
}
|
|
723
|
+
/** Whether a transaction committed, or the typed reason it was refused. */
|
|
724
|
+
type TransactResult = {
|
|
725
|
+
readonly ok: true;
|
|
726
|
+
readonly change: TreeModelChange | null;
|
|
727
|
+
} | {
|
|
728
|
+
readonly ok: false;
|
|
729
|
+
readonly reason: TreeOpRejection;
|
|
730
|
+
readonly detail?: string;
|
|
731
|
+
};
|
|
732
|
+
/** What a transaction body is handed: the working tree, and the means to stage ops against it. */
|
|
733
|
+
interface TransactionContext {
|
|
734
|
+
/** Stage one op against the STORY part. Returns false once the transaction has failed. */
|
|
735
|
+
apply(op: TreeDocOp): boolean;
|
|
736
|
+
/**
|
|
737
|
+
* Stage one op against a named part.
|
|
738
|
+
*
|
|
739
|
+
* A comment body lives in `comments.xml` and is edited by the same ops that edit the story,
|
|
740
|
+
* so this is `apply` with the target named rather than a second vocabulary.
|
|
741
|
+
*/
|
|
742
|
+
applyTo(partName: string, op: TreeDocOp): boolean;
|
|
743
|
+
/**
|
|
744
|
+
* Stage a whole-package edit: a new part, a relationship, a content-type override.
|
|
745
|
+
*
|
|
746
|
+
* The edit is a pure function of the working package, so a rejected transaction discards it
|
|
747
|
+
* with everything else. Returning the SAME package is a no-op, not a failure — a primitive
|
|
748
|
+
* that finds nothing to do says so that way.
|
|
749
|
+
*/
|
|
750
|
+
applyPackage(edit: (pkg: OoxmlPackage) => OoxmlPackage): boolean;
|
|
751
|
+
/** The selection to restore when this entry is undone. */
|
|
752
|
+
selectionBefore(selection: SelectionMark | null): void;
|
|
753
|
+
/** The selection to restore when this entry is redone. */
|
|
754
|
+
selectionAfter(selection: SelectionMark | null): void;
|
|
755
|
+
}
|
|
756
|
+
interface HistoryEntry {
|
|
757
|
+
/**
|
|
758
|
+
* The whole package as it was, not just the story part.
|
|
759
|
+
*
|
|
760
|
+
* Affordable for the same reason a part snapshot was: parts are immutable and deep-frozen, so
|
|
761
|
+
* a package snapshot is a Map of references and every part the transaction did not touch is
|
|
762
|
+
* object-identical to the one before it. Undo stays a pointer swap, and it now reverses every
|
|
763
|
+
* part one intent wrote rather than only the story.
|
|
764
|
+
*/
|
|
765
|
+
readonly pkg: OoxmlPackage;
|
|
766
|
+
readonly revision: number;
|
|
767
|
+
readonly selectionBefore: SelectionMark | null;
|
|
768
|
+
readonly selectionAfter: SelectionMark | null;
|
|
769
|
+
/**
|
|
770
|
+
* The gesture this entry is still collecting, while it is the newest entry and nothing
|
|
771
|
+
* has closed it. Only ever set on the top of the undo stack: {@link closeHistoryGroup}
|
|
772
|
+
* strips it, and undo and redo never copy it onto the entries they push.
|
|
773
|
+
*/
|
|
774
|
+
readonly group?: HistoryGroup;
|
|
775
|
+
}
|
|
776
|
+
/**
|
|
777
|
+
* Opaque document+history checkpoint for package-coordinator rollback.
|
|
778
|
+
* Used when a story mutation may promote to a package undo unit (note-ref cascade).
|
|
779
|
+
*/
|
|
780
|
+
/** A restorable point in history — one entry of the intent-scoped undo stack. */
|
|
781
|
+
interface TreeDocumentCheckpoint {
|
|
782
|
+
/**
|
|
783
|
+
* The whole package, not one part. The store owns the package so a transaction spanning
|
|
784
|
+
* several parts is one publication — a checkpoint of only the story part could not roll
|
|
785
|
+
* back the comment or numbering part the same transaction wrote.
|
|
786
|
+
*/
|
|
787
|
+
readonly pkg: OoxmlPackage;
|
|
788
|
+
readonly revision: number;
|
|
789
|
+
readonly undoStack: readonly HistoryEntry[];
|
|
790
|
+
readonly redoStack: readonly HistoryEntry[];
|
|
791
|
+
readonly composition: {
|
|
792
|
+
readonly entry: HistoryEntry;
|
|
793
|
+
readonly committed: boolean;
|
|
794
|
+
} | null;
|
|
795
|
+
}
|
|
796
|
+
/**
|
|
797
|
+
* The document store: one transaction is one atomic publication and one history entry.
|
|
798
|
+
*
|
|
799
|
+
* `apply` STAGES ops against a working part and nothing is visible until `transact` returns, so a
|
|
800
|
+
* batch rejected halfway leaves the revision, the tree, the indexes and every subscriber exactly
|
|
801
|
+
* as they were. That all-or-nothing property is what lets a caller compose ops without having to
|
|
802
|
+
* reason about partial application.
|
|
803
|
+
*/
|
|
804
|
+
declare class TreeDocumentStore {
|
|
805
|
+
private current;
|
|
806
|
+
/** The part `apply` targets and `part` returns: the story this store is editing. */
|
|
807
|
+
private readonly storyPartName;
|
|
808
|
+
private rev;
|
|
809
|
+
private commitCounter;
|
|
810
|
+
private readonly undoStack;
|
|
811
|
+
private readonly redoStack;
|
|
812
|
+
private readonly subscribers;
|
|
813
|
+
private readonly historyLimit;
|
|
814
|
+
/** See {@link TreeDocumentStoreOptions.settingsPart}. */
|
|
815
|
+
private readonly settingsPartOverride;
|
|
816
|
+
/** Package-aware story tag applied to publishes (including undo/redo). */
|
|
817
|
+
private storyRef;
|
|
818
|
+
/** Open composition, if any. While set, transactions extend one entry (task 5.5). */
|
|
819
|
+
private composition;
|
|
820
|
+
/**
|
|
821
|
+
* Open a store over a package, editing the named story part.
|
|
822
|
+
*
|
|
823
|
+
* A bare part is accepted and wrapped in a single-part package, so callers that never open a
|
|
824
|
+
* real package — tests, headless tooling — are unaffected by the widening.
|
|
825
|
+
*/
|
|
826
|
+
constructor(source: OoxmlPart | OoxmlPackage, storyPartNameOrOptions?: string | TreeDocumentStoreOptions, maybeOptions?: TreeDocumentStoreOptions);
|
|
827
|
+
/**
|
|
828
|
+
* Stamp story identity onto subsequent publishes for this store (including undo/redo).
|
|
829
|
+
* Used by the package coordinator so history navigation keeps the same scope tag.
|
|
830
|
+
*/
|
|
831
|
+
setStoryRef(story: TreeStoryRef | null): void;
|
|
832
|
+
/** The story part being edited. Unchanged for every caller that predates the widening. */
|
|
833
|
+
get part(): OoxmlPart;
|
|
834
|
+
/** Every part, including the ones a multi-part transaction wrote. */
|
|
835
|
+
get package(): OoxmlPackage;
|
|
836
|
+
get revision(): number;
|
|
837
|
+
get canUndo(): boolean;
|
|
838
|
+
get canRedo(): boolean;
|
|
839
|
+
/** Retained entries — the unit `undo()` reverses, so tests can assert grouping. */
|
|
840
|
+
get historyDepth(): number;
|
|
841
|
+
get compositionActive(): boolean;
|
|
842
|
+
/**
|
|
843
|
+
* Replace the package OUTSIDE the transaction and history lanes.
|
|
844
|
+
*
|
|
845
|
+
* For package writes that are not a user intent and publish no revision: grafting
|
|
846
|
+
* `numbering.xml` into a document that never had one, which the caller performs as a
|
|
847
|
+
* precondition of the list op that follows. Those edits were previously kept in a package
|
|
848
|
+
* variable beside the store, which meant two owners of one value and, predictably, two
|
|
849
|
+
* values — a graft written to one and a save read from the other.
|
|
850
|
+
*
|
|
851
|
+
* Deliberately narrow and deliberately awkward to reach for: anything a user did belongs in
|
|
852
|
+
* `transact`, where it gets a revision, an undo entry and the invariant checks.
|
|
853
|
+
*/
|
|
854
|
+
graftPackage(edit: (pkg: OoxmlPackage) => OoxmlPackage): void;
|
|
855
|
+
/**
|
|
856
|
+
* Replace the current part without recording history, but advance the revision so
|
|
857
|
+
* revision-keyed projections cannot survive a package snapshot install.
|
|
858
|
+
*/
|
|
859
|
+
replacePart(part: OoxmlPart): void;
|
|
860
|
+
/**
|
|
861
|
+
* Snapshot part, revision, and undo/redo stacks so the package coordinator can roll
|
|
862
|
+
* back a story transaction that fails after commit (e.g. note-reference cascade) or
|
|
863
|
+
* discard a local history entry when promoting to a package undo unit.
|
|
864
|
+
*/
|
|
865
|
+
checkpoint(): TreeDocumentCheckpoint;
|
|
866
|
+
/** Full restore — part, revision, history stacks, and composition. */
|
|
867
|
+
restoreCheckpoint(checkpoint: TreeDocumentCheckpoint): void;
|
|
868
|
+
/**
|
|
869
|
+
* Restore undo/redo stacks only, keeping the current part and revision.
|
|
870
|
+
* Used when a story mutation is promoted to a package history pointer so the local
|
|
871
|
+
* orphan entry does not steal a later undo.
|
|
872
|
+
*/
|
|
873
|
+
restoreHistoryStacks(checkpoint: TreeDocumentCheckpoint): void;
|
|
874
|
+
subscribe(listener: (change: TreeModelChange) => void): () => void;
|
|
875
|
+
/**
|
|
876
|
+
* Run one atomic transaction.
|
|
877
|
+
*
|
|
878
|
+
* Ops are staged against a working copy. On the first rejection the whole transaction is
|
|
879
|
+
* abandoned: no revision, no history entry, no notification. On success exactly one
|
|
880
|
+
* revision is published and exactly one history entry is recorded — unless a composition
|
|
881
|
+
* is open, in which case the entry already exists and this transaction joins it.
|
|
882
|
+
*/
|
|
883
|
+
transact(build: (ctx: TransactionContext) => void, options?: TransactOptions): TransactResult;
|
|
884
|
+
private commitTransaction;
|
|
885
|
+
/**
|
|
886
|
+
* Open one history entry for an IME composition.
|
|
887
|
+
*
|
|
888
|
+
* Everything committed until `endComposition` collapses into this single entry, which is
|
|
889
|
+
* what makes a composed word one undo step rather than one per intermediate transaction.
|
|
890
|
+
*/
|
|
891
|
+
beginComposition(selectionBefore?: SelectionMark | null): void;
|
|
892
|
+
/** Close the composition, recording its entry only if anything actually committed. */
|
|
893
|
+
endComposition(): void;
|
|
894
|
+
/**
|
|
895
|
+
* Cancel an open composition without recording an entry, leaving whatever it committed
|
|
896
|
+
* in place. An IME cancel is not an undo request; the caller decides what to revert.
|
|
897
|
+
*/
|
|
898
|
+
cancelComposition(): void;
|
|
899
|
+
/**
|
|
900
|
+
* Close the open history group, if any: the next transaction records its own entry.
|
|
901
|
+
* The store does this itself for another token, none, undo and redo; the package
|
|
902
|
+
* coordinator does it for history moving ABOVE the store (a package unit, another
|
|
903
|
+
* story's pointer), which the store cannot see.
|
|
904
|
+
*/
|
|
905
|
+
closeHistoryGroup(): void;
|
|
906
|
+
undo(): TreeModelChange | null;
|
|
907
|
+
redo(): TreeModelChange | null;
|
|
908
|
+
/** The selection to restore for the entry `undo()` would reverse next. */
|
|
909
|
+
selectionForUndo(): SelectionMark | null;
|
|
910
|
+
/** The selection to restore for the entry `redo()` would reapply next. */
|
|
911
|
+
selectionForRedo(): SelectionMark | null;
|
|
912
|
+
private pushUndo;
|
|
913
|
+
private publish;
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
/** Attribution stamped on one remote canonical publication. */
|
|
917
|
+
interface RemotePackageAttribution {
|
|
918
|
+
readonly origin: string;
|
|
919
|
+
readonly actorId?: string;
|
|
920
|
+
readonly operationId?: string;
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
type NoteCascadeFn = (before: OoxmlPackage, after: OoxmlPackage) => OoxmlPackage | null;
|
|
924
|
+
/**
|
|
925
|
+
* Editable story target.
|
|
926
|
+
*
|
|
927
|
+
* Body and headerFooter mirror `EditorScope`. Notes use one lazy store per notes part
|
|
928
|
+
* (`notesPart`) — not one store per note — resolved through safe document relationships.
|
|
929
|
+
*/
|
|
930
|
+
type StoryScope = {
|
|
931
|
+
readonly kind: 'body';
|
|
932
|
+
} | {
|
|
933
|
+
readonly kind: 'headerFooter';
|
|
934
|
+
readonly rId: string;
|
|
935
|
+
} | {
|
|
936
|
+
readonly kind: 'notesPart';
|
|
937
|
+
readonly noteKind: NoteKind;
|
|
938
|
+
};
|
|
939
|
+
/**
|
|
940
|
+
* Why a story scope could not be resolved to a part.
|
|
941
|
+
*
|
|
942
|
+
* Several of these are FILE-hostile shapes rather than caller mistakes:
|
|
943
|
+
* `external-relationship` and `bad-relationship-target` are how a crafted document tries to
|
|
944
|
+
* point a story at something outside the package, and both are refused rather than followed.
|
|
945
|
+
*/
|
|
946
|
+
type StoryTargetRejection = 'unknown-scope' | 'dangling-relationship' | 'wrong-relationship-type' | 'external-relationship' | 'bad-relationship-target' | 'missing-part' | 'not-a-story-part' | 'too-many-story-stores';
|
|
947
|
+
/** A story scope resolved to a part, or the typed reason it could not be. */
|
|
948
|
+
type StoryResolveResult = {
|
|
949
|
+
readonly ok: true;
|
|
950
|
+
readonly story: TreeStoryRef;
|
|
951
|
+
readonly store: TreeDocumentStore;
|
|
952
|
+
} | {
|
|
953
|
+
readonly ok: false;
|
|
954
|
+
readonly reason: StoryTargetRejection;
|
|
955
|
+
readonly detail?: string;
|
|
956
|
+
};
|
|
957
|
+
/** Whether a package-level transaction committed, or why it was refused. */
|
|
958
|
+
type PackageTransactResult = {
|
|
959
|
+
readonly ok: true;
|
|
960
|
+
readonly change: TreeModelChange | null;
|
|
961
|
+
} | {
|
|
962
|
+
readonly ok: false;
|
|
963
|
+
readonly reason: StoryTargetRejection | TreeOpRejection;
|
|
964
|
+
readonly detail?: string;
|
|
965
|
+
};
|
|
966
|
+
/** Cap on simultaneously opened editable story stores (body + HF parts). Fail closed. */
|
|
967
|
+
declare const DEFAULT_MAX_EDITABLE_STORY_PARTS = 64;
|
|
968
|
+
/** How a package store is constructed: limits, history depth, and review contributions. */
|
|
969
|
+
interface TreePackageStoreOptions {
|
|
970
|
+
readonly historyLimit?: number;
|
|
971
|
+
/** Bound on opened story stores; defaults to {@link DEFAULT_MAX_EDITABLE_STORY_PARTS}. */
|
|
972
|
+
readonly maxEditableStoryParts?: number;
|
|
973
|
+
/**
|
|
974
|
+
* Test seam for note-reference cascade after `deleteText` / `deleteBlock`. Production uses
|
|
975
|
+
* {@link cascadeDeletedNoteReferences}.
|
|
976
|
+
*/
|
|
977
|
+
readonly cascadeDeletedNoteReferences?: NoteCascadeFn;
|
|
978
|
+
}
|
|
979
|
+
/**
|
|
980
|
+
* Package-level mutation authority: routes `TreeDocOp`s to the store for a story part,
|
|
981
|
+
* publishes one ModelChange / undo unit per transaction, and keeps `currentPackage()`
|
|
982
|
+
* coherent for save/reopen.
|
|
983
|
+
*/
|
|
984
|
+
declare class TreePackageStore {
|
|
985
|
+
private pkg;
|
|
986
|
+
private packageRev;
|
|
987
|
+
private readonly body;
|
|
988
|
+
/** Opened non-body story stores, keyed by canonical part name. */
|
|
989
|
+
private readonly stories;
|
|
990
|
+
/** rId → part name for opened HF stores (and resolved targets). */
|
|
991
|
+
private readonly rIdToPartName;
|
|
992
|
+
private readonly undoOrder;
|
|
993
|
+
private readonly redoOrder;
|
|
994
|
+
private readonly subscribers;
|
|
995
|
+
private readonly historyLimit;
|
|
996
|
+
private readonly maxEditableStoryParts;
|
|
997
|
+
private readonly cascadeNoteReferences;
|
|
998
|
+
private lastChange;
|
|
999
|
+
/**
|
|
1000
|
+
* Hyperlink externals minted via {@link replacePackageShell} (outside package history).
|
|
1001
|
+
* Re-applied on snapshot install so lifecycle undo cannot drop shell `r:id`s; not used for
|
|
1002
|
+
* lifecycle-cloned owned relationships, which history snapshots already restore.
|
|
1003
|
+
*/
|
|
1004
|
+
private shellHyperlinks;
|
|
1005
|
+
/**
|
|
1006
|
+
* Open IME composition session. Captures the package/story checkpoint at begin so a
|
|
1007
|
+
* mid-composition note-ref cascade can promote the whole composition to one package
|
|
1008
|
+
* undo unit (or restore on cancel) instead of a story-only pointer that orphans note bodies.
|
|
1009
|
+
*/
|
|
1010
|
+
private compositionSession;
|
|
1011
|
+
private commitCounter;
|
|
1012
|
+
/**
|
|
1013
|
+
* Memo for {@link currentPackage}, keyed on that method's COMPLETE read set by object identity:
|
|
1014
|
+
* the shell, the body part, and each open story's part in map order. Identity is the only sound
|
|
1015
|
+
* key — `packageRevision` is excluded, because shell writes (`replacePackageShell`, story-store
|
|
1016
|
+
* grafts, lazy opens) move `this.pkg` or a `store.part` without bumping it. Parts are frozen, so
|
|
1017
|
+
* a matching tuple proves the snapshot cannot differ; nothing invalidates explicitly.
|
|
1018
|
+
*/
|
|
1019
|
+
private currentPackageMemo;
|
|
1020
|
+
constructor(pkg: OoxmlPackage, main: OoxmlPart, options?: TreePackageStoreOptions);
|
|
1021
|
+
get packageRevision(): number;
|
|
1022
|
+
get canUndo(): boolean;
|
|
1023
|
+
get canRedo(): boolean;
|
|
1024
|
+
get lastModelChange(): TreeModelChange | null;
|
|
1025
|
+
/** Body store — independent revision/index from every HF store. */
|
|
1026
|
+
bodyStore(): TreeDocumentStore;
|
|
1027
|
+
/**
|
|
1028
|
+
* The current package with every opened story store's part merged in.
|
|
1029
|
+
* Pure snapshot of authority; callers must not mutate.
|
|
1030
|
+
*
|
|
1031
|
+
* Memoized on input identity: repeated calls with unchanged authority return the
|
|
1032
|
+
* SAME frozen instance instead of minting a copy per call. Layout asks for this
|
|
1033
|
+
* once per paragraph when keying drawing tokens, so the un-memoized `withPart`
|
|
1034
|
+
* map copies dominated large-document keystroke flushes.
|
|
1035
|
+
*
|
|
1036
|
+
* Stores whose parts are absent from the package shell (deleted furniture/notes)
|
|
1037
|
+
* stay parked for undo/redo identity but are not re-injected into the snapshot.
|
|
1038
|
+
*/
|
|
1039
|
+
currentPackage(): OoxmlPackage;
|
|
1040
|
+
subscribe(listener: (change: TreeModelChange) => void): () => void;
|
|
1041
|
+
/**
|
|
1042
|
+
* Resolve a story scope to its store. Fail closed for dangling / wrong-typed / missing
|
|
1043
|
+
* targets — layout may fail open on the same rId, but mutation must not invent a part.
|
|
1044
|
+
*/
|
|
1045
|
+
resolveStory(scope: StoryScope): StoryResolveResult;
|
|
1046
|
+
/** Current part for a scope, or null when the target is refused. */
|
|
1047
|
+
partFor(scope: StoryScope): OoxmlPart | null;
|
|
1048
|
+
/** Per-story revision, or null when the target is refused. */
|
|
1049
|
+
revisionFor(scope: StoryScope): number | null;
|
|
1050
|
+
/**
|
|
1051
|
+
* Commit ops against one story as ONE transaction / undo unit / ModelChange.
|
|
1052
|
+
* Header/footer and notes-part commits publish `impact: 'global'`.
|
|
1053
|
+
* Deleting a `noteReference` via `deleteText` or a block subtree via `deleteBlock`
|
|
1054
|
+
* cascades the note body in the same package undo unit.
|
|
1055
|
+
*/
|
|
1056
|
+
transact(scope: StoryScope, build: (ctx: TransactionContext) => void, options?: Omit<TransactOptions, 'story' | 'minimumImpact'>): PackageTransactResult;
|
|
1057
|
+
private commitStoryTransaction;
|
|
1058
|
+
/** Whether a package-wide IME composition session is open on any story. */
|
|
1059
|
+
compositionSessionOpen(): boolean;
|
|
1060
|
+
beginComposition(scope: StoryScope, selectionBefore?: SelectionMark | null): boolean;
|
|
1061
|
+
endComposition(): void;
|
|
1062
|
+
cancelComposition(): void;
|
|
1063
|
+
/**
|
|
1064
|
+
* Commit one furniture or note lifecycle op as one ModelChange / undo unit that restores the
|
|
1065
|
+
* whole package atomically. `actorId` scopes the ids it mints, as `transact` does.
|
|
1066
|
+
*/
|
|
1067
|
+
applyLifecycleOp(op: HeaderFooterLifecycleOp | NoteLifecycleOp | TreeDocOp, options?: {
|
|
1068
|
+
readonly actorId?: string;
|
|
1069
|
+
}): PackageTransactResult;
|
|
1070
|
+
private commitLifecycleOp;
|
|
1071
|
+
undo(): TreeModelChange | null;
|
|
1072
|
+
redo(): TreeModelChange | null;
|
|
1073
|
+
selectionForUndo(): SelectionMark | null;
|
|
1074
|
+
selectionForRedo(): SelectionMark | null;
|
|
1075
|
+
/** See {@link openStoryPartsOf}. */
|
|
1076
|
+
openStoryParts(): readonly OoxmlPart[];
|
|
1077
|
+
/** How many story stores are open (body counts as one). */
|
|
1078
|
+
openedStoryCount(): number;
|
|
1079
|
+
/** See {@link openStoryTokenOf}. */
|
|
1080
|
+
openStoryToken(): string;
|
|
1081
|
+
/** Insert a validated raster image as one package undo unit (task 12). */
|
|
1082
|
+
insertImage(scope: StoryScope, input: InsertImageInput): Promise<ImageIntentResult>;
|
|
1083
|
+
/** Land a clipboard fragment (resource merge + blocks) as one package undo unit. */
|
|
1084
|
+
applyFragmentPaste(scope: StoryScope, input: FragmentPasteInput): FragmentPasteResult;
|
|
1085
|
+
/** Replace a picture drawing's embedded media in one package undo unit. */
|
|
1086
|
+
replaceImage(scope: StoryScope, drawingNodeId: string, bytes: Uint8Array, mime: SupportedImageMime, decodePort: ImageDecodePort, options: ReplaceImageOptions): Promise<ImageIntentResult>;
|
|
1087
|
+
/** Delete a picture drawing and collect orphaned media in one package undo unit. */
|
|
1088
|
+
deleteImage(scope: StoryScope, drawingNodeId: string): ImageIntentResult;
|
|
1089
|
+
/** Propose the deletion as a tracked change: the drawing goes into a `w:del`, media stays. */
|
|
1090
|
+
deleteImageTracked(scope: StoryScope, drawingNodeId: string, revision: RevisionAttributionInput): ImageIntentResult;
|
|
1091
|
+
/** Fetch external bytes explicitly and embed them; no fetch on open/load. */
|
|
1092
|
+
embedExternalImage(scope: StoryScope, drawingNodeId: string, url: string, port: ExternalImageFetchPort, signal: AbortSignal, decodePort: ImageDecodePort, actorId?: string): Promise<ImageIntentResult>;
|
|
1093
|
+
/** Metadata plus hyperlink target creation in one package transaction. */
|
|
1094
|
+
setDrawingMetadataWithHyperlink(scope: StoryScope, drawingNodeId: string, title: string, description: string, hyperlink: string | null): ImageIntentResult;
|
|
1095
|
+
/** Properties batch with hyperlink relationship create/update/remove in one package unit. */
|
|
1096
|
+
applyImageProperties(scope: StoryScope, input: ApplyImagePropertiesInput): ImageIntentResult;
|
|
1097
|
+
/**
|
|
1098
|
+
* Promote a story transaction that wrote package bytes to one package undo pointer.
|
|
1099
|
+
* Used by the image and fragment-paste intents.
|
|
1100
|
+
*
|
|
1101
|
+
* The caller grafts {@link currentPackage} onto the story store BEFORE its transaction, so
|
|
1102
|
+
* the committed package carries every shell write and installs as it stands, like
|
|
1103
|
+
* `transact`: re-merging the live shell put the pre-transaction `numbering.xml` back over
|
|
1104
|
+
* the one the transaction wrote, and a pasted list referenced missing definitions.
|
|
1105
|
+
*/
|
|
1106
|
+
promoteStoryTransactionToPackageUnit(beforePackage: OoxmlPackage, store: TreeDocumentStore, checkpoint: TreeDocumentCheckpoint,
|
|
1107
|
+
/** Unused: the restore is unconditional now. Kept so the public signature stands. */
|
|
1108
|
+
_beforeDepth?: number): TreeModelChange;
|
|
1109
|
+
/**
|
|
1110
|
+
* Publish a story transaction the coordinator did not run.
|
|
1111
|
+
*
|
|
1112
|
+
* Comment writes commit straight on the story store and hand the new shell back through
|
|
1113
|
+
* {@link replacePackageShell}, so they never pass through `applyTreeOps` — the one place
|
|
1114
|
+
* every other edit bumps the revision and publishes. The subscriber channel therefore
|
|
1115
|
+
* stayed silent for a comment: `Editor.on('change')` never fired, and a review rail keyed
|
|
1116
|
+
* on it only caught up on the next unrelated caret move, so a reply someone had just
|
|
1117
|
+
* written was invisible until they clicked elsewhere.
|
|
1118
|
+
*
|
|
1119
|
+
* The STORY's own change is published rather than a synthetic one, because it carries the
|
|
1120
|
+
* dirty anchor paragraphs and the `text-local` impact the marker ops computed; a synthetic
|
|
1121
|
+
* `global` would make every comment cost a full relayout. History is deliberately
|
|
1122
|
+
* untouched — the story transaction already recorded its undo entry, exactly as
|
|
1123
|
+
* `applyTreeOps` leaves a non-cascading story edit.
|
|
1124
|
+
*
|
|
1125
|
+
* A `null` change is an identity no-op (nothing was written), and publishes nothing.
|
|
1126
|
+
*/
|
|
1127
|
+
publishStoryWrite(change: TreeModelChange | null): TreeModelChange | null;
|
|
1128
|
+
/**
|
|
1129
|
+
* Record a write that spanned SEVERAL parts as one package undo unit.
|
|
1130
|
+
*
|
|
1131
|
+
* A comment spans parts — the body in `comments.xml`, the thread record in
|
|
1132
|
+
* `commentsExtended.xml`, the markers in the story — and those writes reach the store through
|
|
1133
|
+
* the story store rather than `transact`. The story store's history cannot undo them: `undo()`
|
|
1134
|
+
* on a story pointer syncs the STORY PART alone, so undoing a comment restored the markers and
|
|
1135
|
+
* left the body, or the reverse. The caller discards the story entry and hands the package it
|
|
1136
|
+
* started from to this instead, the same promotion the note cascade does.
|
|
1137
|
+
*/
|
|
1138
|
+
adoptPackageUnit(before: OoxmlPackage): void;
|
|
1139
|
+
/** Install a full package snapshot (public seam for post-fetch cleanup). */
|
|
1140
|
+
installPackageSnapshot(snapshot: OoxmlPackage): void;
|
|
1141
|
+
/**
|
|
1142
|
+
* Install a package this replica did not author, verbatim. No shell merge — see
|
|
1143
|
+
* `publishRemoteCanonicalPackage` for why merging one here diverges two replicas.
|
|
1144
|
+
*/
|
|
1145
|
+
installAuthoritativePackageSnapshot(snapshot: OoxmlPackage): void;
|
|
1146
|
+
/** Publish one remotely materialized canonical package as one revision. */
|
|
1147
|
+
publishRemotePackage(pkg: OoxmlPackage, attribution: RemotePackageAttribution): PackageTransactResult;
|
|
1148
|
+
/**
|
|
1149
|
+
* Replace the package shell while preserving opened stores. Used when numbering /
|
|
1150
|
+
* content-types mutate the package outside story trees.
|
|
1151
|
+
*/
|
|
1152
|
+
replacePackageShell(pkg: OoxmlPackage): void;
|
|
1153
|
+
/** Restore snapshot stories while retaining history-reachable shell resources. */
|
|
1154
|
+
private installPackageSnapshotInternal;
|
|
1155
|
+
private openNotesPartStore;
|
|
1156
|
+
private openHeaderFooterStore;
|
|
1157
|
+
private storyRefForPart;
|
|
1158
|
+
private syncPackageFromStore;
|
|
1159
|
+
private pushUndoPointer;
|
|
1160
|
+
/** Keep history-reachable stories and prune unreachable shell hyperlink owners. */
|
|
1161
|
+
private evictUnreachableStories;
|
|
1162
|
+
private publish;
|
|
1163
|
+
private publishSynthetic;
|
|
1164
|
+
}
|
|
1165
|
+
|
|
1166
|
+
/** Decoded fragment payloads above this cap are refused before any package work. */
|
|
1167
|
+
declare const MAX_FRAGMENT_DECODED_BYTES: number;
|
|
1168
|
+
interface FragmentPasteInput {
|
|
1169
|
+
readonly paragraphId: string;
|
|
1170
|
+
readonly offset: number;
|
|
1171
|
+
/** The fragment package zip (from the clipboard codec or the HTML projection). */
|
|
1172
|
+
readonly fragmentBytes: Uint8Array;
|
|
1173
|
+
readonly lastMarkCovered: boolean;
|
|
1174
|
+
/** Ops that clear the current selection first (the surface's deleteSelectionPlan). */
|
|
1175
|
+
readonly priorOps?: readonly TreeDocOp[];
|
|
1176
|
+
/**
|
|
1177
|
+
* Collaboration actor for the ids this paste mints.
|
|
1178
|
+
*
|
|
1179
|
+
* A paste freshens three package-wide namespaces — bookmark `@w:id`, revision `@w:id` and
|
|
1180
|
+
* `wp:docPr/@id` — and the merge reads the actor off the open transaction. Without one, two
|
|
1181
|
+
* replicas pasting the same fragment from one snapshot mint the same numbers, and only the
|
|
1182
|
+
* merged document shows it. Omitted (solo) keeps Word's dense sequences.
|
|
1183
|
+
*/
|
|
1184
|
+
readonly actorId?: string;
|
|
1185
|
+
}
|
|
1186
|
+
type FragmentPasteResult = (Extract<PackageTransactResult, {
|
|
1187
|
+
ok: true;
|
|
1188
|
+
}> & {
|
|
1189
|
+
readonly blockCount: number;
|
|
1190
|
+
}) | Extract<PackageTransactResult, {
|
|
1191
|
+
ok: false;
|
|
1192
|
+
}>;
|
|
1193
|
+
/**
|
|
1194
|
+
* Read the fragment through the bounded file-open trust boundary, merge its resources,
|
|
1195
|
+
* and land its blocks — all inside one transaction. Any refusal leaves the document
|
|
1196
|
+
* exactly as it was; the caller (the paste router) degrades to the next flavour.
|
|
1197
|
+
*/
|
|
1198
|
+
declare function applyFragmentPaste(store: TreePackageStore, scope: StoryScope, input: FragmentPasteInput): FragmentPasteResult;
|
|
1199
|
+
|
|
1200
|
+
export { NOTE_ID_MAX as B, DEFAULT_MAX_EDITABLE_STORY_PARTS as D, NOTE_ID_MIN as E, NOTE_SEPARATOR_ID as G, MAX_FRAGMENT_DECODED_BYTES as M, TreePackageStore as T, allocateDrawingPropertyId as a4, allocateNoteId as a5, applyFragmentPaste as a6, applyHeaderFooterLifecycleOp as a7, applyNoteLifecycleOp as a8, atomicNoteSpansOf as a9, noteTypeOf as aA, notesOf as aB, notesPartHasId as aC, observeHistoryGroup as aD, parseNoteId as aE, parseNoteScopeId as aF, resolveHeaderFooterParts as aG, resolveHeaderFooterPartsBySection as aH, resolveHeaderFooterResolutionBySection as aI, resolveNotesPart as aJ, withBinaryPart as aK, withEmbeddedImage as aL, withoutUnreferencedImagePart as aM, cascadeDeletedNoteReferences as aa, collectNoteReferences as ab, collectPackageNoteReferences as ac, collectSectionPropertyNodes as ad, createNoteReferenceScanBudget as ae, customMarkFollows as af, diagnoseNoteReferences as ag, findNoteById as ah, formatNoteScopeId as ai, isContinuationSeparatorNode as aj, isEndnotesNode as ak, isFootnotesNode as al, isHeaderFooterLifecycleOp as am, isNormalNote as an, isNoteAtomNode as ao, isNoteLifecycleOp as ap, isNoteNode as aq, isNoteRefNode as ar, isNoteReferenceNode as as, isSeparatorNode as at, normalNoteIds as au, noteAtomText as av, noteIdOf as aw, noteKindOf as ax, noteRefKindOf as ay, noteReferenceKindOf as az, TreeDocumentStore as f, reportHistoryGroup as r, MAX_NOTES_PER_PART as v, MAX_NOTE_REFERENCE_PARTS as w, MAX_NOTE_REFERENCE_SCAN as x, NOTE_ATOM_CHAR as y, NOTE_CONTINUATION_SEPARATOR_ID as z };
|
|
1201
|
+
export type { TreeDocumentStoreOptions as $, ApplyImagePropertiesInput as A, CascadeDeletedNoteReferencesOptions as C, FragmentPasteInput as F, HeaderFooterParts as H, InsertImageInput as I, NoteDiagnostic as J, NoteDiagnosticCode as K, NoteLifecycleImpact as L, NoteKind as N, NoteLifecycleOp as O, NoteLifecycleOptions as P, NoteLifecycleRejection as Q, ReplaceImageOptions as R, StoryScope as S, NoteLifecycleResult as U, NoteReferenceHit as V, NoteReferenceScanBudget as W, NoteType as X, PackageTransactResult as Y, RemotePackageAttribution as Z, StoryResolveResult as _, StoryTargetRejection as a, TreePackageStoreOptions as a0, TreeStoryRef as a1, TransactResult as a2, TransactionContext as a3, HeaderFooterSectionResolution as b, HeaderFooterVariant as c, HistoryGroup as d, TreeModelChange as e, SelectionMark as g, TransactOptions as h, ImageIntentResult as i, FragmentPasteResult as j, FieldResultsMode as k, AtomicNoteSpan as l, DrawingPropertyIdResult as m, HeaderFooterKind as n, HeaderFooterLifecycleImpact as o, HeaderFooterLifecycleOp as p, HeaderFooterLifecycleRejection as q, HeaderFooterLifecycleResult as s, HeaderFooterSlotMeta as t, HistoryCaptureKind as u };
|