@docx-editor.dev/core 2.9.2 → 2.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/automation.cjs +1 -1
- package/dist/automation.d.cts +14 -5
- package/dist/automation.d.ts +14 -5
- package/dist/automation.js +1 -1
- package/dist/binding.cjs +1 -1
- package/dist/binding.d.cts +78 -13
- package/dist/binding.d.ts +78 -13
- package/dist/binding.js +1 -1
- package/dist/chunk-34BNQUD4.js +10 -0
- package/dist/chunk-5AVHO75P.cjs +19 -0
- package/dist/chunk-6HMSC7UV.js +2 -0
- package/dist/chunk-6JIJOZDW.js +1 -0
- package/dist/chunk-76Y3Y45J.cjs +2 -0
- package/dist/chunk-BP7ANXGA.js +1 -0
- package/dist/chunk-BTQKU64Q.cjs +1 -0
- package/dist/chunk-CRZR6K5Z.js +19 -0
- package/dist/chunk-D5EHDHYV.js +1 -0
- package/dist/chunk-EJATEGJZ.cjs +1 -0
- package/dist/{chunk-PSZH2VXP.js → chunk-GOEBQ26R.js} +1 -1
- package/dist/chunk-GRDFEH5Q.cjs +2 -0
- package/dist/chunk-GWV65NQW.cjs +10 -0
- package/dist/chunk-GXLZCXEH.js +2 -0
- package/dist/chunk-JUQOPVSK.cjs +2 -0
- package/dist/chunk-LAETEBHD.js +1 -0
- package/dist/chunk-M6Z3KFXM.cjs +5 -0
- package/dist/{chunk-YMYCPY5Y.cjs → chunk-OHJQ7GPZ.cjs} +1 -1
- package/dist/chunk-UQFOYZJO.cjs +18 -0
- package/dist/chunk-WPQMPHNR.cjs +1 -0
- package/dist/chunk-WXQ245MQ.js +18 -0
- package/dist/chunk-WZHIFNSU.js +5 -0
- package/dist/chunk-X7A5XART.js +2 -0
- package/dist/chunk-ZKWRCLT2.cjs +1 -0
- package/dist/collaboration/replication.cjs +1 -0
- package/dist/collaboration/replication.d.cts +216 -0
- package/dist/collaboration/replication.d.ts +216 -0
- package/dist/collaboration/replication.js +1 -0
- package/dist/collaboration.cjs +1 -0
- package/dist/collaboration.d.cts +176 -0
- package/dist/collaboration.d.ts +176 -0
- package/dist/collaboration.js +1 -0
- package/dist/contracts/document.d.cts +6 -1
- package/dist/contracts/document.d.ts +6 -1
- package/dist/contracts/editor.cjs +1 -1
- package/dist/contracts/editor.d.cts +8 -9
- package/dist/contracts/editor.d.ts +8 -9
- package/dist/contracts/editor.js +1 -1
- package/dist/contracts/interaction.d.cts +8 -9
- package/dist/contracts/interaction.d.ts +8 -9
- package/dist/contracts/modules.cjs +1 -1
- package/dist/contracts/modules.d.cts +20 -8
- package/dist/contracts/modules.d.ts +20 -8
- package/dist/contracts/modules.js +1 -1
- package/dist/custom-node-writes-CwkYRw3V.d.cts +310 -0
- package/dist/custom-node-writes-JfTn-Sy6.d.ts +310 -0
- package/dist/document-properties-D6Ahr8D6.d.cts +28 -0
- package/dist/document-properties-D6Ahr8D6.d.ts +28 -0
- package/dist/{editor-Cvd7Geoc.d.ts → editor-BogcVHXk.d.ts} +176 -59
- package/dist/{editor-cAEf1uXW.d.cts → editor-C8edZgy5.d.cts} +176 -59
- package/dist/editor.cjs +1 -1
- package/dist/editor.css +1 -7698
- package/dist/editor.d.cts +26 -25
- package/dist/editor.d.ts +26 -25
- package/dist/editor.js +1 -1
- package/dist/failure-BnGjoXf0.d.cts +64 -0
- package/dist/failure-BnGjoXf0.d.ts +64 -0
- package/dist/{index-DRqY5JVF.d.ts → index-BNv-ZLQP.d.ts} +327 -86
- package/dist/{index-wb-iOxfh.d.cts → index-Dn0lOp9Z.d.cts} +327 -86
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +20 -19
- package/dist/index.d.ts +20 -19
- package/dist/index.js +1 -1
- package/dist/layout.cjs +1 -1
- package/dist/layout.d.cts +92 -55
- package/dist/layout.d.ts +92 -55
- package/dist/layout.js +1 -1
- package/dist/{note-properties-jvnw_DGG.d.ts → note-properties-BmoSdyKS.d.ts} +1 -1
- package/dist/{note-properties-CQlxjic_.d.cts → note-properties-BvGfHk5e.d.cts} +1 -1
- package/dist/{omml-equation-Dd3mBep-.d.ts → omml-equation-Ciq5rgb7.d.ts} +1 -1
- package/dist/{omml-equation-BD-LsmWE.d.cts → omml-equation-CqQOt_dD.d.cts} +1 -1
- package/dist/output.cjs +1 -1
- package/dist/output.d.cts +6 -8
- package/dist/output.d.ts +6 -8
- package/dist/output.js +1 -1
- package/dist/{protocol-UuZOcOp7.d.cts → protocol-BB-WP3zk.d.cts} +2 -2
- package/dist/{protocol-C7ahrdUx.d.ts → protocol-Ckl7hWsv.d.ts} +2 -2
- package/dist/{review-items-bdGxFWNA.d.ts → review-items-BdeLNRi2.d.cts} +1 -2
- package/dist/{review-items-B8tffIXj.d.cts → review-items-CkYyXhXM.d.ts} +1 -2
- package/dist/{review-reads-Bxz03tHG.d.cts → review-reads-BOLSBm5w.d.cts} +2 -2
- package/dist/{review-reads-CHODU0LI.d.ts → review-reads-Crf0Xn42.d.ts} +2 -2
- package/dist/{revision-projection-CILpvv4M.d.ts → revision-projection-Ae2CWa8E.d.ts} +1 -1
- package/dist/{revision-projection-Cc4wz30g.d.cts → revision-projection-C2S8PSQm.d.cts} +1 -1
- package/dist/{semantic-cell-selection-BPzx6DdT.d.cts → semantic-cell-selection-C0OFD4D9.d.cts} +4 -4
- package/dist/{semantic-cell-selection-CsHcr-yk.d.ts → semantic-cell-selection-DdmoxC-y.d.ts} +4 -4
- package/dist/{semantic-interaction-D-RZ9Ust.d.ts → semantic-interaction-COyhZ9WH.d.ts} +21 -2
- package/dist/{semantic-interaction-BfWDD_0V.d.cts → semantic-interaction-Cs2jErnt.d.cts} +21 -2
- package/dist/{semantic-paint-WhVtSDJK.d.ts → semantic-paint-UHaj3sBY.d.cts} +2 -2
- package/dist/{semantic-paint-Bd7EqzXV.d.cts → semantic-paint-vA-oLSdV.d.ts} +2 -2
- package/dist/{semantic-records-DadVT_E1.d.cts → semantic-records-5AOQJmLX.d.cts} +20 -5
- package/dist/{semantic-records-DCt-ZwKU.d.ts → semantic-records-9xhwbJ23.d.ts} +20 -5
- package/dist/{shaped-measurer-CninrHr_.d.cts → shaped-measurer-NeF2mPSu.d.cts} +1 -1
- package/dist/{shaped-measurer-B9f4A7QA.d.ts → shaped-measurer-vzsY88oK.d.ts} +1 -1
- package/dist/store.cjs +1 -1
- package/dist/store.d.cts +193 -19
- package/dist/store.d.ts +193 -19
- package/dist/store.js +1 -1
- package/dist/tree-op-types-BPyXNxyL.d.cts +3053 -0
- package/dist/tree-op-types-DnzAOnc9.d.ts +3053 -0
- package/dist/{custom-node-writes-D6SGwebL.d.ts → tree-package-fragment-BjZ3RWAS.d.cts} +128 -312
- package/dist/{custom-node-writes-Dy3b20PS.d.cts → tree-package-fragment-CDER0G3B.d.ts} +128 -312
- package/dist/{tree-session-ZuBFOhIh.d.ts → tree-session-contract-BF2FVBOM.d.cts} +52 -106
- package/dist/{tree-session-Df02ajqc.d.cts → tree-session-contract-DhdsFT_z.d.ts} +52 -106
- package/dist/{tree-store-B_sJBMIS.d.cts → tree-store-CNZ3O83s.d.ts} +130 -25
- package/dist/{tree-store-DgETo6Mf.d.ts → tree-store-DfZi7FqY.d.cts} +130 -25
- package/package.json +14 -3
- package/dist/chunk-6JWP2H7K.js +0 -2
- package/dist/chunk-6KNLLEUW.cjs +0 -18
- package/dist/chunk-7ADTI533.cjs +0 -10
- package/dist/chunk-7ETDCPF6.cjs +0 -2
- package/dist/chunk-7I3BSGGS.js +0 -1
- package/dist/chunk-7UU5YFCD.cjs +0 -2
- package/dist/chunk-7VQ7YLW3.cjs +0 -1
- package/dist/chunk-CKDAK3MV.js +0 -10
- package/dist/chunk-DIMEYVNS.js +0 -2
- package/dist/chunk-GQQOL4PV.js +0 -1
- package/dist/chunk-H2656QDI.cjs +0 -1
- package/dist/chunk-KQGENNL5.cjs +0 -15
- package/dist/chunk-LIXPSV4T.js +0 -18
- package/dist/chunk-O4UULRAQ.cjs +0 -5
- package/dist/chunk-SIIFNE6U.js +0 -15
- package/dist/chunk-VXYECPKA.js +0 -5
- package/dist/hf-references-Dvk6De4Q.d.cts +0 -70
- package/dist/hf-references-z5Y4N1ab.d.ts +0 -70
- package/dist/image-resources-BgA9EQxY.d.ts +0 -203
- package/dist/image-resources-BiA-IXgo.d.cts +0 -203
- package/dist/note-nodes-BNCANoGN.d.ts +0 -108
- package/dist/note-nodes-DL-Au22P.d.cts +0 -108
- package/dist/ooxml-package-CdEy9ufK.d.cts +0 -1222
- package/dist/ooxml-package-CdEy9ufK.d.ts +0 -1222
- package/dist/tree-op-types-CnRb7AYo.d.ts +0 -1589
- package/dist/tree-op-types-D1vNJ7XC.d.cts +0 -1589
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { S as
|
|
2
|
-
import {
|
|
1
|
+
import { S as StoryScope, a as StoryTargetRejection, b as HeaderFooterParts, c as HeaderFooterSectionResolution, I as InsertImageInput, d as ImageIntentResult, R as ReplaceImageOptions, A as ApplyImagePropertiesInput, F as FragmentPasteInput, e as FragmentPasteResult } from './tree-package-fragment-BjZ3RWAS.cjs';
|
|
2
|
+
import { T as TreeDocOp, O as OoxmlPart, a as OoxmlNode, b as OoxmlPackage, g as OoxmlElement, y as SupportedImageMime, C as ImageDecodePort, E as RevisionAttributionInput } from './tree-op-types-BPyXNxyL.cjs';
|
|
3
|
+
import { D as DocumentTrackingSettings, I as InsertCustomNodeWrite, C as CustomNodeWriteResult, a as CustomNodeSweepOutcome, E as EmbeddedFont, B as BookmarkIndex, L as ListKind } from './custom-node-writes-CwkYRw3V.cjs';
|
|
4
|
+
import { D as DocumentProperties } from './document-properties-D6Ahr8D6.cjs';
|
|
5
|
+
import { S as SelectionMark, b as TransactOptions, T as TreeModelChange } from './tree-store-DfZi7FqY.cjs';
|
|
6
|
+
import { a as ReviewItem } from './review-items-BdeLNRi2.cjs';
|
|
3
7
|
import { Node } from 'prosemirror-model';
|
|
4
|
-
import {
|
|
5
|
-
import { a as HeaderFooterParts, b as HeaderFooterSectionResolution } from './hf-references-z5Y4N1ab.js';
|
|
6
|
-
import { T as TreeDocOp } from './tree-op-types-CnRb7AYo.js';
|
|
7
|
-
import { S as SelectionMark, T as TreeModelChange, D as DocumentProperties } from './tree-store-DgETo6Mf.js';
|
|
8
|
-
import { a as ReviewItem } from './review-items-bdGxFWNA.js';
|
|
9
|
-
import { ReviewModuleContribution } from './contracts/modules.js';
|
|
8
|
+
import { CollaborationDocumentPort } from './collaboration/replication.cjs';
|
|
10
9
|
|
|
11
10
|
/**
|
|
12
11
|
* Why an edited projection could not be mapped back into tree ops.
|
|
@@ -91,6 +90,27 @@ interface DocumentStyleEntry {
|
|
|
91
90
|
readonly preview: DocumentStylePreview;
|
|
92
91
|
}
|
|
93
92
|
|
|
93
|
+
/**
|
|
94
|
+
* The scheme slots the picker shows, in Word's column order.
|
|
95
|
+
*
|
|
96
|
+
* Assumes the default `w:clrSchemeMapping` (bg1→lt1, t1→dk1, ...); a settings part
|
|
97
|
+
* that remaps them is rare and a follow-up.
|
|
98
|
+
*/
|
|
99
|
+
declare const PICKER_SLOTS: readonly ["lt1", "dk1", "lt2", "dk2", "accent1", "accent2", "accent3", "accent4", "accent5", "accent6"];
|
|
100
|
+
type ThemeColorSlot = (typeof PICKER_SLOTS)[number];
|
|
101
|
+
/** One theme colour: the scheme slot and its resolved six-digit hex (no '#'). */
|
|
102
|
+
interface DocumentThemeColorEntry {
|
|
103
|
+
readonly slot: ThemeColorSlot;
|
|
104
|
+
readonly hex: string;
|
|
105
|
+
}
|
|
106
|
+
/** The theme's two font slots, for resolving `w:rFonts` theme attributes. */
|
|
107
|
+
interface DocumentThemeFonts {
|
|
108
|
+
/** `a:majorFont` latin typeface — headings. */
|
|
109
|
+
readonly major: string | null;
|
|
110
|
+
/** `a:minorFont` latin typeface — body text. */
|
|
111
|
+
readonly minor: string | null;
|
|
112
|
+
}
|
|
113
|
+
|
|
94
114
|
/** One heading of the outline, in document order. `level` is 0-based (Heading 1 = 0). */
|
|
95
115
|
interface DocumentOutlineEntry {
|
|
96
116
|
/** The paragraph's text, control characters flattened, bounded to 200 characters. */
|
|
@@ -142,38 +162,6 @@ interface DocumentSearchResult {
|
|
|
142
162
|
readonly truncated: boolean;
|
|
143
163
|
}
|
|
144
164
|
|
|
145
|
-
/**
|
|
146
|
-
* The scheme slots the picker shows, in Word's column order.
|
|
147
|
-
*
|
|
148
|
-
* Assumes the default `w:clrSchemeMapping` (bg1→lt1, t1→dk1, ...); a settings part
|
|
149
|
-
* that remaps them is rare and a follow-up.
|
|
150
|
-
*/
|
|
151
|
-
declare const PICKER_SLOTS: readonly ["lt1", "dk1", "lt2", "dk2", "accent1", "accent2", "accent3", "accent4", "accent5", "accent6"];
|
|
152
|
-
type ThemeColorSlot = (typeof PICKER_SLOTS)[number];
|
|
153
|
-
/** One theme colour: the scheme slot and its resolved six-digit hex (no '#'). */
|
|
154
|
-
interface DocumentThemeColorEntry {
|
|
155
|
-
readonly slot: ThemeColorSlot;
|
|
156
|
-
readonly hex: string;
|
|
157
|
-
}
|
|
158
|
-
/** The theme's two font slots, for resolving `w:rFonts` theme attributes. */
|
|
159
|
-
interface DocumentThemeFonts {
|
|
160
|
-
/** `a:majorFont` latin typeface — headings. */
|
|
161
|
-
readonly major: string | null;
|
|
162
|
-
/** `a:minorFont` latin typeface — body text. */
|
|
163
|
-
readonly minor: string | null;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
/** What a run inherits at one point of the chain — null means "nothing authored". */
|
|
167
|
-
interface StyleRunDefaults {
|
|
168
|
-
readonly fontFamily: string | null;
|
|
169
|
-
readonly fontSizeHalfPoints: number | null;
|
|
170
|
-
}
|
|
171
|
-
/** One run property as the layout records carry it (structurally SurfaceProperty). */
|
|
172
|
-
interface RunPropertyLike {
|
|
173
|
-
readonly localName: string;
|
|
174
|
-
readonly attributes?: Record<string, string>;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
165
|
interface ParagraphAnchorIndex {
|
|
178
166
|
/** nodeId → `w14:paraId`, verbatim as authored/minted. Paragraphs without one are absent. */
|
|
179
167
|
readonly paraIdByNode: ReadonlyMap<string, string>;
|
|
@@ -209,6 +197,17 @@ interface ParagraphAnchorIndex {
|
|
|
209
197
|
readonly claimantsByParaId: ReadonlyMap<string, readonly string[]>;
|
|
210
198
|
}
|
|
211
199
|
|
|
200
|
+
/** What a run inherits at one point of the chain — null means "nothing authored". */
|
|
201
|
+
interface StyleRunDefaults {
|
|
202
|
+
readonly fontFamily: string | null;
|
|
203
|
+
readonly fontSizeHalfPoints: number | null;
|
|
204
|
+
}
|
|
205
|
+
/** One run property as the layout records carry it (structurally SurfaceProperty). */
|
|
206
|
+
interface RunPropertyLike {
|
|
207
|
+
readonly localName: string;
|
|
208
|
+
readonly attributes?: Record<string, string>;
|
|
209
|
+
}
|
|
210
|
+
|
|
212
211
|
/**
|
|
213
212
|
* What applying ops produced: whether it committed, and why not when it did not.
|
|
214
213
|
*
|
|
@@ -222,6 +221,8 @@ interface TreeApplyResult {
|
|
|
222
221
|
/** Present when the edit was refused, so a host can report WHY rather than a silent no-op. */
|
|
223
222
|
readonly reason?: TreeBindingRejection | StoryTargetRejection | string;
|
|
224
223
|
}
|
|
224
|
+
/** Optional collaboration attribution for a direct tree-op transaction. */
|
|
225
|
+
type TreeApplyOptions = Pick<TransactOptions, 'origin' | 'actorId' | 'operationId' | 'recordsHistory'>;
|
|
225
226
|
/**
|
|
226
227
|
* One open document: the canonical tree, and the only write path into it.
|
|
227
228
|
*
|
|
@@ -262,7 +263,7 @@ interface TreeDocxSessionView {
|
|
|
262
263
|
* header/footer part; the transaction publishes one ModelChange (HF → `global` impact)
|
|
263
264
|
* and one undo unit without swapping the body store.
|
|
264
265
|
*/
|
|
265
|
-
applyTreeOps(ops: readonly TreeDocOp[], selectionBefore?: SelectionMark | null, selectionAfter?: SelectionMark | null, scope?: StoryScope): TreeApplyResult;
|
|
266
|
+
applyTreeOps(ops: readonly TreeDocOp[], selectionBefore?: SelectionMark | null, selectionAfter?: SelectionMark | null, scope?: StoryScope, options?: TreeApplyOptions): TreeApplyResult;
|
|
266
267
|
/**
|
|
267
268
|
* Every part that holds a story, body first, then headers, footers and note parts.
|
|
268
269
|
*
|
|
@@ -297,6 +298,8 @@ interface TreeDocxSessionView {
|
|
|
297
298
|
beginComposition(scope?: StoryScope): void;
|
|
298
299
|
endComposition(): void;
|
|
299
300
|
subscribe(onChange: (change: TreeModelChange) => void): () => void;
|
|
301
|
+
/** Narrow provider-neutral attachment over this session's canonical package store. */
|
|
302
|
+
collaborationPort(documentId: string): CollaborationDocumentPort;
|
|
300
303
|
/** Serialize the whole package back to DOCX bytes. */
|
|
301
304
|
save(): Uint8Array;
|
|
302
305
|
/**
|
|
@@ -423,7 +426,9 @@ interface TreeDocxSessionView {
|
|
|
423
426
|
endParagraphId?: string;
|
|
424
427
|
}, text: string, author: string,
|
|
425
428
|
/** ISO-8601. Omitted writes no `@w:date`, because inventing one is a content change. */
|
|
426
|
-
date?: string, scope?: StoryScope
|
|
429
|
+
date?: string, scope?: StoryScope,
|
|
430
|
+
/** Binds id allocation to one actor, so two peers cannot mint the same comment id. */
|
|
431
|
+
actorId?: string): string | null;
|
|
427
432
|
/**
|
|
428
433
|
* Resolve a comment thread, or reopen it. False when the document holds no such comment.
|
|
429
434
|
*
|
|
@@ -570,71 +575,12 @@ interface TreeDocxSessionView {
|
|
|
570
575
|
replaceImage(scope: StoryScope, drawingNodeId: string, bytes: Uint8Array, mime: SupportedImageMime, decodePort: ImageDecodePort, options: ReplaceImageOptions): Promise<ImageIntentResult>;
|
|
571
576
|
/** Delete a picture drawing and collect orphaned media in one package undo unit. */
|
|
572
577
|
deleteImage(scope: StoryScope, drawingNodeId: string): ImageIntentResult;
|
|
578
|
+
/** Propose the drawing's deletion as a tracked change (`w:del`); media stays untouched. */
|
|
579
|
+
deleteImageTracked(scope: StoryScope, drawingNodeId: string, revision: RevisionAttributionInput): ImageIntentResult;
|
|
573
580
|
/** Apply image property tree ops plus hyperlink relationship wiring atomically. */
|
|
574
581
|
applyImageProperties(scope: StoryScope, input: ApplyImagePropertiesInput): ImageIntentResult;
|
|
582
|
+
/** Land a clipboard fragment (resource merge + blocks) as one package undo unit. */
|
|
583
|
+
applyFragmentPaste(scope: StoryScope, input: FragmentPasteInput): FragmentPasteResult;
|
|
575
584
|
}
|
|
576
|
-
/**
|
|
577
|
-
* Binding-only session methods that exchange ProseMirror projections.
|
|
578
|
-
*
|
|
579
|
-
* Editor surfaces expose {@link TreeDocxSessionView}. Only the binding lane sees this extension.
|
|
580
|
-
*/
|
|
581
|
-
interface TreeDocxSession extends TreeDocxSessionView {
|
|
582
|
-
/** Project the current BODY revision into a ProseMirror doc. */
|
|
583
|
-
projectDoc(): Node;
|
|
584
|
-
/** Re-project incrementally from the last committed change, reusing untouched paragraphs. */
|
|
585
|
-
reconcile(previousDoc: Node): Node;
|
|
586
|
-
/**
|
|
587
|
-
* Whether the last commit changed the BLOCK SEQUENCE (a split, join, insert or delete).
|
|
588
|
-
*
|
|
589
|
-
* A host needs this to decide whether the view must be re-projected at all. After a pure
|
|
590
|
-
* text edit, the view already holds what the model holds. Re-projecting wastes work and
|
|
591
|
-
* races the next keystroke.
|
|
592
|
-
*/
|
|
593
|
-
lastCommitWasStructural(): boolean;
|
|
594
|
-
/** Map an edited BODY doc to tree ops and commit them as one transaction. */
|
|
595
|
-
applyPmDoc(doc: Node): TreeApplyResult;
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
/**
|
|
599
|
-
* Why bytes could not be opened: any bounded-reader rejection, plus the package that parsed but
|
|
600
|
-
* carried no main document tree.
|
|
601
|
-
*/
|
|
602
|
-
type TreeSessionRejection = OoxmlPackageRejection | 'no-main-document-tree';
|
|
603
|
-
/**
|
|
604
|
-
* An open session, or a typed refusal.
|
|
605
|
-
*
|
|
606
|
-
* A result rather than a throw: every failure here is a property of the FILE, and a host needs to
|
|
607
|
-
* tell "this is not a package" from "this package is malicious" from "this document has no body".
|
|
608
|
-
*/
|
|
609
|
-
type OpenTreeSessionResult = {
|
|
610
|
-
readonly ok: true;
|
|
611
|
-
readonly session: TreeDocxSession;
|
|
612
|
-
} | {
|
|
613
|
-
readonly ok: false;
|
|
614
|
-
readonly reason: TreeSessionRejection;
|
|
615
|
-
readonly detail?: string;
|
|
616
|
-
};
|
|
617
|
-
interface OpenTreeSessionOptions {
|
|
618
|
-
/**
|
|
619
|
-
* The review module's derivation hooks, contributed through the editor's
|
|
620
|
-
* `EditorModule` seam. Absent — the free engine — the session's
|
|
621
|
-
* `reviewItems()` reports the typed empty queue; parse, preservation, and
|
|
622
|
-
* `hasReviewContent` are unaffected.
|
|
623
|
-
*/
|
|
624
|
-
readonly reviewModel?: ReviewModuleContribution;
|
|
625
|
-
}
|
|
626
|
-
/**
|
|
627
|
-
* Open DOCX bytes into a tree-backed session.
|
|
628
|
-
*
|
|
629
|
-
* Returns a typed rejection rather than throwing: every failure here is a property of the FILE,
|
|
630
|
-
* and a host needs to tell "this is not a package" from "this package is malicious" from "this
|
|
631
|
-
* document has no body".
|
|
632
|
-
*
|
|
633
|
-
* The read is BOUNDED — decompression ratio, part count, XML depth and element counts are all
|
|
634
|
-
* capped — because the bytes are untrusted by definition.
|
|
635
|
-
*/
|
|
636
|
-
declare function openTreeSession(bytes: Uint8Array, options?: OpenTreeSessionOptions): OpenTreeSessionResult;
|
|
637
|
-
/** The origin a host should use when committing a reconciliation rather than a user edit. */
|
|
638
|
-
declare const PROJECTION_ORIGIN: "dev.docx-editor.core.origin.projection";
|
|
639
585
|
|
|
640
|
-
export { type DocumentStyleEntry as D, type MapResult as M, type
|
|
586
|
+
export { type DocumentStyleEntry as D, type MapResult as M, type TreeDocxSessionView as T, type TreeApplyResult as a, type TreeApplyOptions as b, type TreeBindingRejection as c, bodyParagraphs as d, docToTreeOps as e, type DocumentThemeColorEntry as f, partHasNode as p, reconcileDoc as r, treeToDoc as t };
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { S as
|
|
2
|
-
import {
|
|
1
|
+
import { S as StoryScope, a as StoryTargetRejection, b as HeaderFooterParts, c as HeaderFooterSectionResolution, I as InsertImageInput, d as ImageIntentResult, R as ReplaceImageOptions, A as ApplyImagePropertiesInput, F as FragmentPasteInput, e as FragmentPasteResult } from './tree-package-fragment-CDER0G3B.js';
|
|
2
|
+
import { T as TreeDocOp, O as OoxmlPart, a as OoxmlNode, b as OoxmlPackage, g as OoxmlElement, y as SupportedImageMime, C as ImageDecodePort, E as RevisionAttributionInput } from './tree-op-types-DnzAOnc9.js';
|
|
3
|
+
import { D as DocumentTrackingSettings, I as InsertCustomNodeWrite, C as CustomNodeWriteResult, a as CustomNodeSweepOutcome, E as EmbeddedFont, B as BookmarkIndex, L as ListKind } from './custom-node-writes-JfTn-Sy6.js';
|
|
4
|
+
import { D as DocumentProperties } from './document-properties-D6Ahr8D6.js';
|
|
5
|
+
import { S as SelectionMark, b as TransactOptions, T as TreeModelChange } from './tree-store-CNZ3O83s.js';
|
|
6
|
+
import { a as ReviewItem } from './review-items-CkYyXhXM.js';
|
|
3
7
|
import { Node } from 'prosemirror-model';
|
|
4
|
-
import {
|
|
5
|
-
import { a as HeaderFooterParts, b as HeaderFooterSectionResolution } from './hf-references-Dvk6De4Q.cjs';
|
|
6
|
-
import { T as TreeDocOp } from './tree-op-types-D1vNJ7XC.cjs';
|
|
7
|
-
import { S as SelectionMark, T as TreeModelChange, D as DocumentProperties } from './tree-store-B_sJBMIS.cjs';
|
|
8
|
-
import { a as ReviewItem } from './review-items-B8tffIXj.cjs';
|
|
9
|
-
import { ReviewModuleContribution } from './contracts/modules.cjs';
|
|
8
|
+
import { CollaborationDocumentPort } from './collaboration/replication.js';
|
|
10
9
|
|
|
11
10
|
/**
|
|
12
11
|
* Why an edited projection could not be mapped back into tree ops.
|
|
@@ -91,6 +90,27 @@ interface DocumentStyleEntry {
|
|
|
91
90
|
readonly preview: DocumentStylePreview;
|
|
92
91
|
}
|
|
93
92
|
|
|
93
|
+
/**
|
|
94
|
+
* The scheme slots the picker shows, in Word's column order.
|
|
95
|
+
*
|
|
96
|
+
* Assumes the default `w:clrSchemeMapping` (bg1→lt1, t1→dk1, ...); a settings part
|
|
97
|
+
* that remaps them is rare and a follow-up.
|
|
98
|
+
*/
|
|
99
|
+
declare const PICKER_SLOTS: readonly ["lt1", "dk1", "lt2", "dk2", "accent1", "accent2", "accent3", "accent4", "accent5", "accent6"];
|
|
100
|
+
type ThemeColorSlot = (typeof PICKER_SLOTS)[number];
|
|
101
|
+
/** One theme colour: the scheme slot and its resolved six-digit hex (no '#'). */
|
|
102
|
+
interface DocumentThemeColorEntry {
|
|
103
|
+
readonly slot: ThemeColorSlot;
|
|
104
|
+
readonly hex: string;
|
|
105
|
+
}
|
|
106
|
+
/** The theme's two font slots, for resolving `w:rFonts` theme attributes. */
|
|
107
|
+
interface DocumentThemeFonts {
|
|
108
|
+
/** `a:majorFont` latin typeface — headings. */
|
|
109
|
+
readonly major: string | null;
|
|
110
|
+
/** `a:minorFont` latin typeface — body text. */
|
|
111
|
+
readonly minor: string | null;
|
|
112
|
+
}
|
|
113
|
+
|
|
94
114
|
/** One heading of the outline, in document order. `level` is 0-based (Heading 1 = 0). */
|
|
95
115
|
interface DocumentOutlineEntry {
|
|
96
116
|
/** The paragraph's text, control characters flattened, bounded to 200 characters. */
|
|
@@ -142,38 +162,6 @@ interface DocumentSearchResult {
|
|
|
142
162
|
readonly truncated: boolean;
|
|
143
163
|
}
|
|
144
164
|
|
|
145
|
-
/**
|
|
146
|
-
* The scheme slots the picker shows, in Word's column order.
|
|
147
|
-
*
|
|
148
|
-
* Assumes the default `w:clrSchemeMapping` (bg1→lt1, t1→dk1, ...); a settings part
|
|
149
|
-
* that remaps them is rare and a follow-up.
|
|
150
|
-
*/
|
|
151
|
-
declare const PICKER_SLOTS: readonly ["lt1", "dk1", "lt2", "dk2", "accent1", "accent2", "accent3", "accent4", "accent5", "accent6"];
|
|
152
|
-
type ThemeColorSlot = (typeof PICKER_SLOTS)[number];
|
|
153
|
-
/** One theme colour: the scheme slot and its resolved six-digit hex (no '#'). */
|
|
154
|
-
interface DocumentThemeColorEntry {
|
|
155
|
-
readonly slot: ThemeColorSlot;
|
|
156
|
-
readonly hex: string;
|
|
157
|
-
}
|
|
158
|
-
/** The theme's two font slots, for resolving `w:rFonts` theme attributes. */
|
|
159
|
-
interface DocumentThemeFonts {
|
|
160
|
-
/** `a:majorFont` latin typeface — headings. */
|
|
161
|
-
readonly major: string | null;
|
|
162
|
-
/** `a:minorFont` latin typeface — body text. */
|
|
163
|
-
readonly minor: string | null;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
/** What a run inherits at one point of the chain — null means "nothing authored". */
|
|
167
|
-
interface StyleRunDefaults {
|
|
168
|
-
readonly fontFamily: string | null;
|
|
169
|
-
readonly fontSizeHalfPoints: number | null;
|
|
170
|
-
}
|
|
171
|
-
/** One run property as the layout records carry it (structurally SurfaceProperty). */
|
|
172
|
-
interface RunPropertyLike {
|
|
173
|
-
readonly localName: string;
|
|
174
|
-
readonly attributes?: Record<string, string>;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
165
|
interface ParagraphAnchorIndex {
|
|
178
166
|
/** nodeId → `w14:paraId`, verbatim as authored/minted. Paragraphs without one are absent. */
|
|
179
167
|
readonly paraIdByNode: ReadonlyMap<string, string>;
|
|
@@ -209,6 +197,17 @@ interface ParagraphAnchorIndex {
|
|
|
209
197
|
readonly claimantsByParaId: ReadonlyMap<string, readonly string[]>;
|
|
210
198
|
}
|
|
211
199
|
|
|
200
|
+
/** What a run inherits at one point of the chain — null means "nothing authored". */
|
|
201
|
+
interface StyleRunDefaults {
|
|
202
|
+
readonly fontFamily: string | null;
|
|
203
|
+
readonly fontSizeHalfPoints: number | null;
|
|
204
|
+
}
|
|
205
|
+
/** One run property as the layout records carry it (structurally SurfaceProperty). */
|
|
206
|
+
interface RunPropertyLike {
|
|
207
|
+
readonly localName: string;
|
|
208
|
+
readonly attributes?: Record<string, string>;
|
|
209
|
+
}
|
|
210
|
+
|
|
212
211
|
/**
|
|
213
212
|
* What applying ops produced: whether it committed, and why not when it did not.
|
|
214
213
|
*
|
|
@@ -222,6 +221,8 @@ interface TreeApplyResult {
|
|
|
222
221
|
/** Present when the edit was refused, so a host can report WHY rather than a silent no-op. */
|
|
223
222
|
readonly reason?: TreeBindingRejection | StoryTargetRejection | string;
|
|
224
223
|
}
|
|
224
|
+
/** Optional collaboration attribution for a direct tree-op transaction. */
|
|
225
|
+
type TreeApplyOptions = Pick<TransactOptions, 'origin' | 'actorId' | 'operationId' | 'recordsHistory'>;
|
|
225
226
|
/**
|
|
226
227
|
* One open document: the canonical tree, and the only write path into it.
|
|
227
228
|
*
|
|
@@ -262,7 +263,7 @@ interface TreeDocxSessionView {
|
|
|
262
263
|
* header/footer part; the transaction publishes one ModelChange (HF → `global` impact)
|
|
263
264
|
* and one undo unit without swapping the body store.
|
|
264
265
|
*/
|
|
265
|
-
applyTreeOps(ops: readonly TreeDocOp[], selectionBefore?: SelectionMark | null, selectionAfter?: SelectionMark | null, scope?: StoryScope): TreeApplyResult;
|
|
266
|
+
applyTreeOps(ops: readonly TreeDocOp[], selectionBefore?: SelectionMark | null, selectionAfter?: SelectionMark | null, scope?: StoryScope, options?: TreeApplyOptions): TreeApplyResult;
|
|
266
267
|
/**
|
|
267
268
|
* Every part that holds a story, body first, then headers, footers and note parts.
|
|
268
269
|
*
|
|
@@ -297,6 +298,8 @@ interface TreeDocxSessionView {
|
|
|
297
298
|
beginComposition(scope?: StoryScope): void;
|
|
298
299
|
endComposition(): void;
|
|
299
300
|
subscribe(onChange: (change: TreeModelChange) => void): () => void;
|
|
301
|
+
/** Narrow provider-neutral attachment over this session's canonical package store. */
|
|
302
|
+
collaborationPort(documentId: string): CollaborationDocumentPort;
|
|
300
303
|
/** Serialize the whole package back to DOCX bytes. */
|
|
301
304
|
save(): Uint8Array;
|
|
302
305
|
/**
|
|
@@ -423,7 +426,9 @@ interface TreeDocxSessionView {
|
|
|
423
426
|
endParagraphId?: string;
|
|
424
427
|
}, text: string, author: string,
|
|
425
428
|
/** ISO-8601. Omitted writes no `@w:date`, because inventing one is a content change. */
|
|
426
|
-
date?: string, scope?: StoryScope
|
|
429
|
+
date?: string, scope?: StoryScope,
|
|
430
|
+
/** Binds id allocation to one actor, so two peers cannot mint the same comment id. */
|
|
431
|
+
actorId?: string): string | null;
|
|
427
432
|
/**
|
|
428
433
|
* Resolve a comment thread, or reopen it. False when the document holds no such comment.
|
|
429
434
|
*
|
|
@@ -570,71 +575,12 @@ interface TreeDocxSessionView {
|
|
|
570
575
|
replaceImage(scope: StoryScope, drawingNodeId: string, bytes: Uint8Array, mime: SupportedImageMime, decodePort: ImageDecodePort, options: ReplaceImageOptions): Promise<ImageIntentResult>;
|
|
571
576
|
/** Delete a picture drawing and collect orphaned media in one package undo unit. */
|
|
572
577
|
deleteImage(scope: StoryScope, drawingNodeId: string): ImageIntentResult;
|
|
578
|
+
/** Propose the drawing's deletion as a tracked change (`w:del`); media stays untouched. */
|
|
579
|
+
deleteImageTracked(scope: StoryScope, drawingNodeId: string, revision: RevisionAttributionInput): ImageIntentResult;
|
|
573
580
|
/** Apply image property tree ops plus hyperlink relationship wiring atomically. */
|
|
574
581
|
applyImageProperties(scope: StoryScope, input: ApplyImagePropertiesInput): ImageIntentResult;
|
|
582
|
+
/** Land a clipboard fragment (resource merge + blocks) as one package undo unit. */
|
|
583
|
+
applyFragmentPaste(scope: StoryScope, input: FragmentPasteInput): FragmentPasteResult;
|
|
575
584
|
}
|
|
576
|
-
/**
|
|
577
|
-
* Binding-only session methods that exchange ProseMirror projections.
|
|
578
|
-
*
|
|
579
|
-
* Editor surfaces expose {@link TreeDocxSessionView}. Only the binding lane sees this extension.
|
|
580
|
-
*/
|
|
581
|
-
interface TreeDocxSession extends TreeDocxSessionView {
|
|
582
|
-
/** Project the current BODY revision into a ProseMirror doc. */
|
|
583
|
-
projectDoc(): Node;
|
|
584
|
-
/** Re-project incrementally from the last committed change, reusing untouched paragraphs. */
|
|
585
|
-
reconcile(previousDoc: Node): Node;
|
|
586
|
-
/**
|
|
587
|
-
* Whether the last commit changed the BLOCK SEQUENCE (a split, join, insert or delete).
|
|
588
|
-
*
|
|
589
|
-
* A host needs this to decide whether the view must be re-projected at all. After a pure
|
|
590
|
-
* text edit, the view already holds what the model holds. Re-projecting wastes work and
|
|
591
|
-
* races the next keystroke.
|
|
592
|
-
*/
|
|
593
|
-
lastCommitWasStructural(): boolean;
|
|
594
|
-
/** Map an edited BODY doc to tree ops and commit them as one transaction. */
|
|
595
|
-
applyPmDoc(doc: Node): TreeApplyResult;
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
/**
|
|
599
|
-
* Why bytes could not be opened: any bounded-reader rejection, plus the package that parsed but
|
|
600
|
-
* carried no main document tree.
|
|
601
|
-
*/
|
|
602
|
-
type TreeSessionRejection = OoxmlPackageRejection | 'no-main-document-tree';
|
|
603
|
-
/**
|
|
604
|
-
* An open session, or a typed refusal.
|
|
605
|
-
*
|
|
606
|
-
* A result rather than a throw: every failure here is a property of the FILE, and a host needs to
|
|
607
|
-
* tell "this is not a package" from "this package is malicious" from "this document has no body".
|
|
608
|
-
*/
|
|
609
|
-
type OpenTreeSessionResult = {
|
|
610
|
-
readonly ok: true;
|
|
611
|
-
readonly session: TreeDocxSession;
|
|
612
|
-
} | {
|
|
613
|
-
readonly ok: false;
|
|
614
|
-
readonly reason: TreeSessionRejection;
|
|
615
|
-
readonly detail?: string;
|
|
616
|
-
};
|
|
617
|
-
interface OpenTreeSessionOptions {
|
|
618
|
-
/**
|
|
619
|
-
* The review module's derivation hooks, contributed through the editor's
|
|
620
|
-
* `EditorModule` seam. Absent — the free engine — the session's
|
|
621
|
-
* `reviewItems()` reports the typed empty queue; parse, preservation, and
|
|
622
|
-
* `hasReviewContent` are unaffected.
|
|
623
|
-
*/
|
|
624
|
-
readonly reviewModel?: ReviewModuleContribution;
|
|
625
|
-
}
|
|
626
|
-
/**
|
|
627
|
-
* Open DOCX bytes into a tree-backed session.
|
|
628
|
-
*
|
|
629
|
-
* Returns a typed rejection rather than throwing: every failure here is a property of the FILE,
|
|
630
|
-
* and a host needs to tell "this is not a package" from "this package is malicious" from "this
|
|
631
|
-
* document has no body".
|
|
632
|
-
*
|
|
633
|
-
* The read is BOUNDED — decompression ratio, part count, XML depth and element counts are all
|
|
634
|
-
* capped — because the bytes are untrusted by definition.
|
|
635
|
-
*/
|
|
636
|
-
declare function openTreeSession(bytes: Uint8Array, options?: OpenTreeSessionOptions): OpenTreeSessionResult;
|
|
637
|
-
/** The origin a host should use when committing a reconciliation rather than a user edit. */
|
|
638
|
-
declare const PROJECTION_ORIGIN: "dev.docx-editor.core.origin.projection";
|
|
639
585
|
|
|
640
|
-
export { type DocumentStyleEntry as D, type MapResult as M, type
|
|
586
|
+
export { type DocumentStyleEntry as D, type MapResult as M, type TreeDocxSessionView as T, type TreeApplyResult as a, type TreeApplyOptions as b, type TreeBindingRejection as c, bodyParagraphs as d, docToTreeOps as e, type DocumentThemeColorEntry as f, partHasNode as p, reconcileDoc as r, treeToDoc as t };
|
|
@@ -1,32 +1,121 @@
|
|
|
1
|
-
import { O as OoxmlPart,
|
|
2
|
-
import { I as ImpactClass, T as TreeDocOp, a as TreeOpRejection } from './tree-op-types-D1vNJ7XC.cjs';
|
|
1
|
+
import { a as OoxmlNode, j as OoxmlParagraphNode, k as OoxmlNoteNode, l as OoxmlContinuationSeparatorNode, m as OoxmlEndnotesNode, n as OoxmlFootnotesNode, o as OoxmlNoteRefNode, p as OoxmlNoteReferenceNode, q as OoxmlSeparatorNode, I as ImpactClass, O as OoxmlPart, b as OoxmlPackage, T as TreeDocOp, r as TreeOpRejection } from './tree-op-types-DnzAOnc9.js';
|
|
3
2
|
|
|
3
|
+
/** UTF-16 placeholder for one atomic note unit in `paragraphTextOf` / segments. */
|
|
4
|
+
declare const NOTE_ATOM_CHAR = "\uFFFC";
|
|
5
|
+
/** Signed 32-bit Word-compatible note id range (positive allocation only). */
|
|
6
|
+
declare const NOTE_ID_MIN = 1;
|
|
7
|
+
/** Largest note id Word accepts — signed 32-bit. */
|
|
8
|
+
declare const NOTE_ID_MAX = 2147483647;
|
|
9
|
+
/** Reserved separator / continuation ids — never allocated for normal notes. */
|
|
10
|
+
declare const NOTE_SEPARATOR_ID = -1;
|
|
11
|
+
/** Reserved id of the continuation-separator entry. Never allocated to a real note. */
|
|
12
|
+
declare const NOTE_CONTINUATION_SEPARATOR_ID = 0;
|
|
13
|
+
/** Which notes part a note lives in. Decides both placement and numbering rules. */
|
|
14
|
+
type NoteKind = 'footnote' | 'endnote';
|
|
15
|
+
/** Authored `ST_FtnEdn` including explicit `normal`. Absent means Word default (normal). */
|
|
4
16
|
/**
|
|
5
|
-
*
|
|
17
|
+
* What a note entry IS.
|
|
6
18
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* names; the field → property mapping (`TITLE` → `title`, `AUTHOR` → `creator`, …) lives in
|
|
10
|
-
* `layout/field-doc-property.ts`.
|
|
19
|
+
* Only `normal` is a note a reader sees. The others are the furniture Word stores in the same
|
|
20
|
+
* part — the rules and notices drawn around the note area — reached by reserved ids.
|
|
11
21
|
*/
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
readonly
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
type NoteType = 'normal' | 'separator' | 'continuationSeparator' | 'continuationNotice';
|
|
23
|
+
/** Parse a signed decimal note id; reject non-integers and out-of-int32 values. */
|
|
24
|
+
declare function parseNoteId(raw: string | undefined): number | null;
|
|
25
|
+
/**
|
|
26
|
+
* Canonical `EditorScope { kind: 'note'; id }` encoding.
|
|
27
|
+
*
|
|
28
|
+
* Footnote id `1` and endnote id `1` coexist, so the kind is part of the string:
|
|
29
|
+
* `footnote:2` / `endnote:-1`. Do not invent a parallel scope union arm.
|
|
30
|
+
*/
|
|
31
|
+
declare function formatNoteScopeId(noteKind: NoteKind, noteId: number): string;
|
|
32
|
+
/**
|
|
33
|
+
* Parse {@link formatNoteScopeId}. Returns `null` for malformed / out-of-range ids.
|
|
34
|
+
*/
|
|
35
|
+
declare function parseNoteScopeId(id: string): {
|
|
36
|
+
readonly noteKind: NoteKind;
|
|
37
|
+
readonly noteId: number;
|
|
38
|
+
} | null;
|
|
39
|
+
/** Whether a node is a `w:footnotes` part root. */
|
|
40
|
+
declare function isFootnotesNode(node: OoxmlNode): node is OoxmlFootnotesNode;
|
|
41
|
+
/** Whether a node is a `w:endnotes` part root. */
|
|
42
|
+
declare function isEndnotesNode(node: OoxmlNode): node is OoxmlEndnotesNode;
|
|
43
|
+
/** Whether a node is a `w:footnote` or `w:endnote` body. */
|
|
44
|
+
declare function isNoteNode(node: OoxmlNode): node is OoxmlNoteNode;
|
|
45
|
+
/** Whether a node is a body-side `w:footnoteReference` / `w:endnoteReference`. */
|
|
46
|
+
declare function isNoteReferenceNode(node: OoxmlNode): node is OoxmlNoteReferenceNode;
|
|
47
|
+
/** Whether a node is the `w:footnoteRef` / `w:endnoteRef` mark inside a note's own body. */
|
|
48
|
+
declare function isNoteRefNode(node: OoxmlNode): node is OoxmlNoteRefNode;
|
|
49
|
+
/** Whether a node is the `w:separator` rule drawn above the note area. */
|
|
50
|
+
declare function isSeparatorNode(node: OoxmlNode): node is OoxmlSeparatorNode;
|
|
51
|
+
/** Whether a node is the `w:continuationSeparator` rule used on continuation pages. */
|
|
52
|
+
declare function isContinuationSeparatorNode(node: OoxmlNode): node is OoxmlContinuationSeparatorNode;
|
|
53
|
+
/** Typed or generic `w:footnote` / `w:endnote`. */
|
|
54
|
+
declare function noteKindOf(node: OoxmlNode): NoteKind | null;
|
|
55
|
+
/** Authored `@w:id` on a note or noteReference when parseable. */
|
|
56
|
+
declare function noteIdOf(node: OoxmlNode): number | null;
|
|
57
|
+
/** Authored `@w:type` (`ST_FtnEdn`) when present and schema-legal; else `undefined`. */
|
|
58
|
+
declare function noteTypeOf(node: OoxmlNode): NoteType | undefined;
|
|
59
|
+
/** Whether a note is a normal (body) note — absent type and explicit `normal` both count. */
|
|
60
|
+
declare function isNormalNote(node: OoxmlNode): boolean;
|
|
61
|
+
/** Typed or generic footnote/endnote reference kind. */
|
|
62
|
+
declare function noteReferenceKindOf(node: OoxmlNode): NoteKind | null;
|
|
63
|
+
/** Typed or generic `w:footnoteRef` / `w:endnoteRef`. */
|
|
64
|
+
declare function noteRefKindOf(node: OoxmlNode): NoteKind | null;
|
|
65
|
+
/**
|
|
66
|
+
* Read `@w:customMarkFollows` on a note reference.
|
|
67
|
+
* Returns `undefined` when absent; otherwise the OOXML on/off interpretation.
|
|
68
|
+
*/
|
|
69
|
+
declare function customMarkFollows(node: OoxmlNode): boolean | undefined;
|
|
70
|
+
/** Model text contributed by one atomic note unit. */
|
|
71
|
+
declare function noteAtomText(): typeof NOTE_ATOM_CHAR;
|
|
72
|
+
/**
|
|
73
|
+
* True when a run-inner node is a typed note atom that contributes one UTF-16 unit.
|
|
74
|
+
* Demoted/malformed known locals stay generic and contribute nothing.
|
|
75
|
+
*/
|
|
76
|
+
declare function isNoteAtomNode(node: OoxmlNode): boolean;
|
|
77
|
+
/**
|
|
78
|
+
* One atomic note span inside a paragraph for caret / delete / selection.
|
|
79
|
+
*
|
|
80
|
+
* Each typed note atom is a single-node span (`removeNodeIds` = that node).
|
|
81
|
+
*/
|
|
82
|
+
interface AtomicNoteSpan {
|
|
83
|
+
readonly kind: 'noteReference' | 'noteRef' | 'separator' | 'continuationSeparator';
|
|
84
|
+
readonly node: OoxmlNode;
|
|
85
|
+
readonly runId: string;
|
|
86
|
+
readonly removeNodeIds: readonly string[];
|
|
29
87
|
}
|
|
88
|
+
/**
|
|
89
|
+
* Collect typed note atoms in document order (one segment each).
|
|
90
|
+
*
|
|
91
|
+
* Walks the same paragraph-inline surface as `segmentsOf` / `walkParagraphInline`:
|
|
92
|
+
* hyperlinks and content controls flatten; only direct run children contribute atoms.
|
|
93
|
+
* A demoted run-inner SDT husk stays opaque — no phantom addressable hit.
|
|
94
|
+
*/
|
|
95
|
+
declare function atomicNoteSpansOf(paragraph: OoxmlParagraphNode): readonly AtomicNoteSpan[];
|
|
96
|
+
/** Cap on notes scanned when allocating / indexing a notes part. */
|
|
97
|
+
declare const MAX_NOTES_PER_PART = 10000;
|
|
98
|
+
/**
|
|
99
|
+
* Allocate the next positive signed 32-bit note id for a notes-part root.
|
|
100
|
+
*
|
|
101
|
+
* Solo: `max(existing)+1`, the dense sequence Word writes. `null` on exhaustion, so the
|
|
102
|
+
* caller refuses rather than wrapping onto an id a note already holds.
|
|
103
|
+
*
|
|
104
|
+
* With a collaboration actor bound — explicit argument, or the open store transaction — the
|
|
105
|
+
* id is the next unused value in that actor's stripe. Two peers each adding their first
|
|
106
|
+
* footnote from one snapshot otherwise both mint `w:id="1"`: the merge keeps both bodies
|
|
107
|
+
* under one id, both `w:footnoteReference` marks resolve to the first, and one author's note
|
|
108
|
+
* becomes unreachable.
|
|
109
|
+
*
|
|
110
|
+
* The reserved ids stay reserved either way. `0` (continuation separator) is seeded as used,
|
|
111
|
+
* so a residue of 0 advances one class instead of taking Word's furniture, and a stripe walk
|
|
112
|
+
* only ever climbs from a non-negative residue, so `-1` (separator) is unreachable.
|
|
113
|
+
*/
|
|
114
|
+
declare function allocateNoteId(notesRoot: OoxmlNode, actorId?: string): number | null;
|
|
115
|
+
/** Collect note bodies from a footnotes/endnotes root, bounded. */
|
|
116
|
+
declare function notesOf(root: OoxmlNode): readonly OoxmlNoteNode[];
|
|
117
|
+
/** Find a typed note by id inside a notes-part root. */
|
|
118
|
+
declare function findNoteById(root: OoxmlNode, noteId: number): OoxmlNoteNode | undefined;
|
|
30
119
|
|
|
31
120
|
/** A selection the caller wants restored when an entry is undone or redone. */
|
|
32
121
|
/** A selection captured with a transaction, so undo restores where the caret was. */
|
|
@@ -67,6 +156,10 @@ interface TreeModelChange {
|
|
|
67
156
|
readonly toRevision: number;
|
|
68
157
|
readonly commitId: string;
|
|
69
158
|
readonly origin: string;
|
|
159
|
+
/** Stable collaboration actor attribution, when the caller supplied it. */
|
|
160
|
+
readonly actorId?: string;
|
|
161
|
+
/** Stable collaboration operation identity, when the caller supplied it. */
|
|
162
|
+
readonly operationId?: string;
|
|
70
163
|
readonly dirty: readonly string[];
|
|
71
164
|
readonly created: readonly string[];
|
|
72
165
|
readonly deleted: readonly string[];
|
|
@@ -132,6 +225,17 @@ interface TransactionContext {
|
|
|
132
225
|
/** How one transaction behaves: its story scope, its attribution, and its selection marks. */
|
|
133
226
|
interface TransactOptions {
|
|
134
227
|
readonly origin?: string;
|
|
228
|
+
/** Stable actor attribution for collaboration and audit correlation. */
|
|
229
|
+
readonly actorId?: string;
|
|
230
|
+
/** Stable constituent identity for collaboration duplicate correlation. */
|
|
231
|
+
readonly operationId?: string;
|
|
232
|
+
/**
|
|
233
|
+
* Whether this transaction enters the legacy snapshot undo stack.
|
|
234
|
+
*
|
|
235
|
+
* Collaboration commits set this to false because their actor-local undo authority is the
|
|
236
|
+
* CRDT undo manager. Omitted preserves the ordinary non-collaborative history behavior.
|
|
237
|
+
*/
|
|
238
|
+
readonly recordsHistory?: boolean;
|
|
135
239
|
/**
|
|
136
240
|
* A COMMAND is one user intent that may need several ops (a toolbar click applying a
|
|
137
241
|
* property across a multi-run selection). It is still exactly one history entry, which is
|
|
@@ -284,6 +388,7 @@ declare class TreeDocumentStore {
|
|
|
284
388
|
* is open, in which case the entry already exists and this transaction joins it.
|
|
285
389
|
*/
|
|
286
390
|
transact(build: (ctx: TransactionContext) => void, options?: TransactOptions): TransactResult;
|
|
391
|
+
private commitTransaction;
|
|
287
392
|
/**
|
|
288
393
|
* Open one history entry for an IME composition.
|
|
289
394
|
*
|
|
@@ -308,4 +413,4 @@ declare class TreeDocumentStore {
|
|
|
308
413
|
private publish;
|
|
309
414
|
}
|
|
310
415
|
|
|
311
|
-
export { type
|
|
416
|
+
export { type AtomicNoteSpan as A, isNoteReferenceNode as B, isSeparatorNode as C, noteAtomText as D, noteIdOf as E, noteKindOf as F, noteRefKindOf as G, noteReferenceKindOf as H, notesOf as I, parseNoteId as J, parseNoteScopeId as K, MAX_NOTES_PER_PART as M, type NoteKind as N, type SelectionMark as S, type TreeModelChange as T, TreeDocumentStore as a, type TransactOptions as b, type TreeStoryRef as c, type TransactionContext as d, type TreeDocumentCheckpoint as e, NOTE_ATOM_CHAR as f, NOTE_CONTINUATION_SEPARATOR_ID as g, NOTE_ID_MAX as h, NOTE_ID_MIN as i, NOTE_SEPARATOR_ID as j, type NoteType as k, type TreeDocumentStoreOptions as l, type TransactResult as m, noteTypeOf as n, allocateNoteId as o, atomicNoteSpansOf as p, customMarkFollows as q, findNoteById as r, formatNoteScopeId as s, isContinuationSeparatorNode as t, isEndnotesNode as u, isFootnotesNode as v, isNormalNote as w, isNoteAtomNode as x, isNoteNode as y, isNoteRefNode as z };
|