@docx-editor.dev/core 2.10.0 → 2.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +12 -11
- package/dist/binding.d.ts +12 -11
- 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/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 +21 -8
- package/dist/contracts/modules.d.ts +21 -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-C0my6Uta.d.ts → editor-BogcVHXk.d.ts} +145 -49
- package/dist/{editor-CwzY2Hcg.d.cts → editor-C8edZgy5.d.cts} +145 -49
- package/dist/editor.cjs +1 -1
- package/dist/editor.css +1 -7299
- 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-kID8Ymkp.d.ts → index-BNv-ZLQP.d.ts} +262 -81
- package/dist/{index-nLFwo_17.d.cts → index-Dn0lOp9Z.d.cts} +262 -81
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +19 -18
- package/dist/index.d.ts +19 -18
- package/dist/index.js +1 -1
- package/dist/layout.cjs +1 -1
- package/dist/layout.d.cts +71 -53
- package/dist/layout.d.ts +71 -53
- 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-Dw-8a6Ie.d.ts → review-items-BdeLNRi2.d.cts} +1 -2
- package/dist/{review-items-CwixiHNe.d.cts → review-items-CkYyXhXM.d.ts} +1 -2
- package/dist/{review-reads-BqkiJTeR.d.cts → review-reads-BOLSBm5w.d.cts} +2 -2
- package/dist/{review-reads-C0u-IKEA.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-DT9x9WLf.d.cts → semantic-cell-selection-C0OFD4D9.d.cts} +4 -4
- package/dist/{semantic-cell-selection-Utrf0lz7.d.ts → semantic-cell-selection-DdmoxC-y.d.ts} +4 -4
- package/dist/{semantic-interaction-B6hFRQLy.d.ts → semantic-interaction-COyhZ9WH.d.ts} +1 -1
- package/dist/{semantic-interaction-Z0xKQcB4.d.cts → semantic-interaction-Cs2jErnt.d.cts} +1 -1
- package/dist/{semantic-paint-CQEOC0Od.d.cts → semantic-paint-UHaj3sBY.d.cts} +2 -2
- package/dist/{semantic-paint-quke354p.d.ts → semantic-paint-vA-oLSdV.d.ts} +2 -2
- package/dist/{semantic-records-Do3-i5oB.d.ts → semantic-records-5AOQJmLX.d.cts} +5 -4
- package/dist/{semantic-records-CMakzQ1X.d.cts → semantic-records-9xhwbJ23.d.ts} +5 -4
- package/dist/{shaped-measurer-DzRwWrL5.d.cts → shaped-measurer-NeF2mPSu.d.cts} +1 -1
- package/dist/{shaped-measurer-BxwTUluj.d.ts → shaped-measurer-vzsY88oK.d.ts} +1 -1
- package/dist/store.cjs +1 -1
- package/dist/store.d.cts +74 -16
- package/dist/store.d.ts +74 -16
- package/dist/store.js +1 -1
- package/dist/{tree-op-types-DSJYmf5b.d.cts → tree-op-types-BPyXNxyL.d.cts} +1247 -10
- package/dist/{tree-op-types-BuOfCrkp.d.ts → tree-op-types-DnzAOnc9.d.ts} +1247 -10
- package/dist/{custom-node-writes-BvpWCnW8.d.ts → tree-package-fragment-BjZ3RWAS.d.cts} +107 -322
- package/dist/{custom-node-writes-Db8H6Z3n.d.cts → tree-package-fragment-CDER0G3B.d.ts} +107 -322
- package/dist/{tree-session-contract-C1dfE9hy.d.ts → tree-session-contract-BF2FVBOM.d.cts} +16 -10
- package/dist/{tree-session-contract-ByWx8eew.d.cts → tree-session-contract-DhdsFT_z.d.ts} +16 -10
- package/dist/{tree-store-ASBtz7UB.d.ts → tree-store-CNZ3O83s.d.ts} +130 -25
- package/dist/{tree-store-CWOUMGN8.d.cts → tree-store-DfZi7FqY.d.cts} +130 -25
- package/package.json +14 -3
- package/dist/chunk-27APDXY2.js +0 -2
- package/dist/chunk-35MI6K7M.cjs +0 -10
- package/dist/chunk-4XL7SOWQ.cjs +0 -2
- package/dist/chunk-6K6QQVAZ.cjs +0 -18
- package/dist/chunk-7VQ7YLW3.cjs +0 -1
- package/dist/chunk-7ZJL5AEY.cjs +0 -1
- package/dist/chunk-C6LK2BYA.cjs +0 -2
- package/dist/chunk-GQQOL4PV.js +0 -1
- package/dist/chunk-HBEBUCRM.cjs +0 -5
- package/dist/chunk-LG5K46OM.js +0 -2
- package/dist/chunk-LWADHMVV.js +0 -5
- package/dist/chunk-N725IUO7.js +0 -18
- package/dist/chunk-N7DBENH4.js +0 -10
- package/dist/chunk-NVGFWMCO.js +0 -1
- package/dist/chunk-SYTWKJPJ.cjs +0 -18
- package/dist/chunk-YI6JXF7U.js +0 -18
- package/dist/hf-references-Dvk6De4Q.d.cts +0 -70
- package/dist/hf-references-z5Y4N1ab.d.ts +0 -70
- 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-revision-attribution-CN06Xshv.d.cts +0 -24
- package/dist/tree-op-revision-attribution-CN06Xshv.d.ts +0 -24
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { S as StoryScope, a as StoryTargetRejection,
|
|
2
|
-
import { T as TreeDocOp,
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { S as SelectionMark,
|
|
6
|
-
import { a as ReviewItem } from './review-items-
|
|
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';
|
|
7
7
|
import { Node } from 'prosemirror-model';
|
|
8
|
-
import {
|
|
8
|
+
import { CollaborationDocumentPort } from './collaboration/replication.js';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Why an edited projection could not be mapped back into tree ops.
|
|
@@ -221,6 +221,8 @@ interface TreeApplyResult {
|
|
|
221
221
|
/** Present when the edit was refused, so a host can report WHY rather than a silent no-op. */
|
|
222
222
|
readonly reason?: TreeBindingRejection | StoryTargetRejection | string;
|
|
223
223
|
}
|
|
224
|
+
/** Optional collaboration attribution for a direct tree-op transaction. */
|
|
225
|
+
type TreeApplyOptions = Pick<TransactOptions, 'origin' | 'actorId' | 'operationId' | 'recordsHistory'>;
|
|
224
226
|
/**
|
|
225
227
|
* One open document: the canonical tree, and the only write path into it.
|
|
226
228
|
*
|
|
@@ -261,7 +263,7 @@ interface TreeDocxSessionView {
|
|
|
261
263
|
* header/footer part; the transaction publishes one ModelChange (HF → `global` impact)
|
|
262
264
|
* and one undo unit without swapping the body store.
|
|
263
265
|
*/
|
|
264
|
-
applyTreeOps(ops: readonly TreeDocOp[], selectionBefore?: SelectionMark | null, selectionAfter?: SelectionMark | null, scope?: StoryScope): TreeApplyResult;
|
|
266
|
+
applyTreeOps(ops: readonly TreeDocOp[], selectionBefore?: SelectionMark | null, selectionAfter?: SelectionMark | null, scope?: StoryScope, options?: TreeApplyOptions): TreeApplyResult;
|
|
265
267
|
/**
|
|
266
268
|
* Every part that holds a story, body first, then headers, footers and note parts.
|
|
267
269
|
*
|
|
@@ -296,6 +298,8 @@ interface TreeDocxSessionView {
|
|
|
296
298
|
beginComposition(scope?: StoryScope): void;
|
|
297
299
|
endComposition(): void;
|
|
298
300
|
subscribe(onChange: (change: TreeModelChange) => void): () => void;
|
|
301
|
+
/** Narrow provider-neutral attachment over this session's canonical package store. */
|
|
302
|
+
collaborationPort(documentId: string): CollaborationDocumentPort;
|
|
299
303
|
/** Serialize the whole package back to DOCX bytes. */
|
|
300
304
|
save(): Uint8Array;
|
|
301
305
|
/**
|
|
@@ -422,7 +426,9 @@ interface TreeDocxSessionView {
|
|
|
422
426
|
endParagraphId?: string;
|
|
423
427
|
}, text: string, author: string,
|
|
424
428
|
/** ISO-8601. Omitted writes no `@w:date`, because inventing one is a content change. */
|
|
425
|
-
date?: string, scope?: StoryScope
|
|
429
|
+
date?: string, scope?: StoryScope,
|
|
430
|
+
/** Binds id allocation to one actor, so two peers cannot mint the same comment id. */
|
|
431
|
+
actorId?: string): string | null;
|
|
426
432
|
/**
|
|
427
433
|
* Resolve a comment thread, or reopen it. False when the document holds no such comment.
|
|
428
434
|
*
|
|
@@ -577,4 +583,4 @@ interface TreeDocxSessionView {
|
|
|
577
583
|
applyFragmentPaste(scope: StoryScope, input: FragmentPasteInput): FragmentPasteResult;
|
|
578
584
|
}
|
|
579
585
|
|
|
580
|
-
export { type DocumentStyleEntry as D, type MapResult as M, type TreeDocxSessionView as T, type TreeApplyResult as a, type
|
|
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-BuOfCrkp.js';
|
|
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 };
|
|
@@ -1,32 +1,121 @@
|
|
|
1
|
-
import { O as OoxmlPart,
|
|
2
|
-
import { I as ImpactClass, T as TreeDocOp, a as TreeOpRejection } from './tree-op-types-DSJYmf5b.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-BPyXNxyL.cjs';
|
|
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 };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docx-editor.dev/core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.11.0",
|
|
4
4
|
"description": "Framework-agnostic core for docx-editor.dev: OOXML parse/serialize, the canonical document tree, layout and paint, and the Editor contract the adapters render.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -19,6 +19,16 @@
|
|
|
19
19
|
"import": "./dist/binding.js",
|
|
20
20
|
"require": "./dist/binding.cjs"
|
|
21
21
|
},
|
|
22
|
+
"./collaboration": {
|
|
23
|
+
"types": "./dist/collaboration.d.ts",
|
|
24
|
+
"import": "./dist/collaboration.js",
|
|
25
|
+
"require": "./dist/collaboration.cjs"
|
|
26
|
+
},
|
|
27
|
+
"./collaboration/replication": {
|
|
28
|
+
"types": "./dist/collaboration/replication.d.ts",
|
|
29
|
+
"import": "./dist/collaboration/replication.js",
|
|
30
|
+
"require": "./dist/collaboration/replication.cjs"
|
|
31
|
+
},
|
|
22
32
|
"./contracts/editor": {
|
|
23
33
|
"types": "./dist/contracts/editor.d.ts",
|
|
24
34
|
"import": "./dist/contracts/editor.js",
|
|
@@ -74,7 +84,8 @@
|
|
|
74
84
|
},
|
|
75
85
|
"devDependencies": {
|
|
76
86
|
"autoprefixer": "^10.4.17",
|
|
77
|
-
"
|
|
87
|
+
"cssnano": "^7.1.9",
|
|
88
|
+
"postcss": "^8.5.13",
|
|
78
89
|
"tailwindcss": "^3.4.1",
|
|
79
90
|
"tailwindcss-animate": "^1.0.7",
|
|
80
91
|
"typescript": "^5.3.3"
|
|
@@ -86,7 +97,7 @@
|
|
|
86
97
|
"directory": "packages/core"
|
|
87
98
|
},
|
|
88
99
|
"dependencies": {
|
|
89
|
-
"@docx-editor.dev/i18n": "^2.
|
|
100
|
+
"@docx-editor.dev/i18n": "^2.11.0",
|
|
90
101
|
"bidi-js": "1.0.3",
|
|
91
102
|
"emf-converter": "2.0.2",
|
|
92
103
|
"fast-xml-parser": "^5.10.1",
|