@docx-editor.dev/core 2.10.0 → 2.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/dist/automation.cjs +1 -1
  2. package/dist/automation.d.cts +14 -5
  3. package/dist/automation.d.ts +14 -5
  4. package/dist/automation.js +1 -1
  5. package/dist/binding.cjs +1 -1
  6. package/dist/binding.d.cts +12 -11
  7. package/dist/binding.d.ts +12 -11
  8. package/dist/binding.js +1 -1
  9. package/dist/chunk-3JON7JMD.cjs +1 -0
  10. package/dist/chunk-5V6FNKBE.cjs +2 -0
  11. package/dist/chunk-6JIJOZDW.js +1 -0
  12. package/dist/chunk-BTQKU64Q.cjs +1 -0
  13. package/dist/chunk-BXRVGHTY.cjs +18 -0
  14. package/dist/chunk-BXTTPJSH.js +5 -0
  15. package/dist/chunk-D5EHDHYV.js +1 -0
  16. package/dist/{chunk-PSZH2VXP.js → chunk-GOEBQ26R.js} +1 -1
  17. package/dist/chunk-ILTZTY3K.cjs +10 -0
  18. package/dist/chunk-IUM7FZPA.js +2 -0
  19. package/dist/chunk-JWZG4QJ5.cjs +2 -0
  20. package/dist/chunk-JXZYDBKU.cjs +19 -0
  21. package/dist/chunk-KBOOIC2Q.js +19 -0
  22. package/dist/chunk-L6XZTLPS.js +10 -0
  23. package/dist/chunk-L7OR5TJK.cjs +5 -0
  24. package/dist/chunk-MHQNR2OU.js +2 -0
  25. package/dist/chunk-MLGPISGH.js +1 -0
  26. package/dist/chunk-NJXQABQU.js +18 -0
  27. package/dist/{chunk-YMYCPY5Y.cjs → chunk-OHJQ7GPZ.cjs} +1 -1
  28. package/dist/chunk-TKEGK4GQ.cjs +2 -0
  29. package/dist/chunk-VGFMPWND.js +2 -0
  30. package/dist/chunk-W77HJGYX.js +1 -0
  31. package/dist/chunk-XCFM3G5L.cjs +1 -0
  32. package/dist/chunk-ZKWRCLT2.cjs +1 -0
  33. package/dist/collaboration/replication.cjs +1 -0
  34. package/dist/collaboration/replication.d.cts +216 -0
  35. package/dist/collaboration/replication.d.ts +216 -0
  36. package/dist/collaboration/replication.js +1 -0
  37. package/dist/collaboration.cjs +1 -0
  38. package/dist/collaboration.d.cts +176 -0
  39. package/dist/collaboration.d.ts +176 -0
  40. package/dist/collaboration.js +1 -0
  41. package/dist/contracts/editor.cjs +1 -1
  42. package/dist/contracts/editor.d.cts +8 -9
  43. package/dist/contracts/editor.d.ts +8 -9
  44. package/dist/contracts/editor.js +1 -1
  45. package/dist/contracts/interaction.d.cts +8 -9
  46. package/dist/contracts/interaction.d.ts +8 -9
  47. package/dist/contracts/modules.cjs +1 -1
  48. package/dist/contracts/modules.d.cts +21 -8
  49. package/dist/contracts/modules.d.ts +21 -8
  50. package/dist/contracts/modules.js +1 -1
  51. package/dist/custom-node-writes-CcNeHH5C.d.ts +310 -0
  52. package/dist/custom-node-writes-D4rMJIES.d.cts +310 -0
  53. package/dist/document-properties-D6Ahr8D6.d.cts +28 -0
  54. package/dist/document-properties-D6Ahr8D6.d.ts +28 -0
  55. package/dist/{editor-CwzY2Hcg.d.cts → editor-B76SEMZw.d.cts} +145 -49
  56. package/dist/{editor-C0my6Uta.d.ts → editor-BcdsPdbY.d.ts} +145 -49
  57. package/dist/editor.cjs +1 -1
  58. package/dist/editor.css +1 -7299
  59. package/dist/editor.d.cts +60 -26
  60. package/dist/editor.d.ts +60 -26
  61. package/dist/editor.js +1 -1
  62. package/dist/failure-BnGjoXf0.d.cts +64 -0
  63. package/dist/failure-BnGjoXf0.d.ts +64 -0
  64. package/dist/{index-kID8Ymkp.d.ts → index-BYTvklN5.d.ts} +262 -81
  65. package/dist/{index-nLFwo_17.d.cts → index-CDGhPib1.d.cts} +262 -81
  66. package/dist/index.cjs +1 -1
  67. package/dist/index.d.cts +19 -18
  68. package/dist/index.d.ts +19 -18
  69. package/dist/index.js +1 -1
  70. package/dist/layout.cjs +1 -1
  71. package/dist/layout.d.cts +82 -53
  72. package/dist/layout.d.ts +82 -53
  73. package/dist/layout.js +1 -1
  74. package/dist/{note-properties-jvnw_DGG.d.ts → note-properties-Bx7rXruA.d.ts} +1 -1
  75. package/dist/{note-properties-CQlxjic_.d.cts → note-properties-zQ8w04en.d.cts} +1 -1
  76. package/dist/{omml-equation-Dd3mBep-.d.ts → omml-equation-69O1Pd8G.d.ts} +1 -1
  77. package/dist/{omml-equation-BD-LsmWE.d.cts → omml-equation-BmV51rim.d.cts} +1 -1
  78. package/dist/output.cjs +1 -1
  79. package/dist/output.d.cts +6 -8
  80. package/dist/output.d.ts +6 -8
  81. package/dist/output.js +1 -1
  82. package/dist/{protocol-C7ahrdUx.d.ts → protocol-DC7ueVuo.d.ts} +2 -2
  83. package/dist/{protocol-UuZOcOp7.d.cts → protocol-FTXtrAIT.d.cts} +2 -2
  84. package/dist/{review-items-Dw-8a6Ie.d.ts → review-items-B78OsJU2.d.ts} +1 -2
  85. package/dist/{review-items-CwixiHNe.d.cts → review-items-C-2WQdEb.d.cts} +1 -2
  86. package/dist/{review-reads-BqkiJTeR.d.cts → review-reads-CbBQlb-n.d.cts} +2 -2
  87. package/dist/{review-reads-C0u-IKEA.d.ts → review-reads-UexYBp-m.d.ts} +2 -2
  88. package/dist/{revision-projection-Cc4wz30g.d.cts → revision-projection-6u8lae9J.d.cts} +1 -1
  89. package/dist/{revision-projection-CILpvv4M.d.ts → revision-projection-B2v9U3qx.d.ts} +1 -1
  90. package/dist/{semantic-cell-selection-Utrf0lz7.d.ts → semantic-cell-selection-DsYz2Vg3.d.ts} +4 -4
  91. package/dist/{semantic-cell-selection-DT9x9WLf.d.cts → semantic-cell-selection-nEE7E3Z8.d.cts} +4 -4
  92. package/dist/{semantic-interaction-B6hFRQLy.d.ts → semantic-interaction-C00BpIyC.d.ts} +1 -1
  93. package/dist/{semantic-interaction-Z0xKQcB4.d.cts → semantic-interaction-DiOX0FIH.d.cts} +1 -1
  94. package/dist/{semantic-paint-CQEOC0Od.d.cts → semantic-paint-Cc11nrDL.d.cts} +2 -2
  95. package/dist/{semantic-paint-quke354p.d.ts → semantic-paint-ofuoBsYo.d.ts} +2 -2
  96. package/dist/{semantic-records-Do3-i5oB.d.ts → semantic-records-CRG1r6-a.d.cts} +5 -4
  97. package/dist/{semantic-records-CMakzQ1X.d.cts → semantic-records-CzI0ZEuR.d.ts} +5 -4
  98. package/dist/{shaped-measurer-BxwTUluj.d.ts → shaped-measurer-CkOGZQn9.d.ts} +1 -1
  99. package/dist/{shaped-measurer-DzRwWrL5.d.cts → shaped-measurer-CneACGcP.d.cts} +1 -1
  100. package/dist/store.cjs +1 -1
  101. package/dist/store.d.cts +81 -17
  102. package/dist/store.d.ts +81 -17
  103. package/dist/store.js +1 -1
  104. package/dist/{tree-op-types-DSJYmf5b.d.cts → tree-op-types-CA7qgAUF.d.cts} +1288 -18
  105. package/dist/{tree-op-types-BuOfCrkp.d.ts → tree-op-types-HKfUzt_-.d.ts} +1288 -18
  106. package/dist/{custom-node-writes-BvpWCnW8.d.ts → tree-package-fragment-Cz-v-0B3.d.cts} +107 -322
  107. package/dist/{custom-node-writes-Db8H6Z3n.d.cts → tree-package-fragment-oJZX_5iN.d.ts} +107 -322
  108. package/dist/{tree-session-contract-ByWx8eew.d.cts → tree-session-contract-BPDLrEPX.d.ts} +16 -10
  109. package/dist/{tree-session-contract-C1dfE9hy.d.ts → tree-session-contract-Cbl87xa8.d.cts} +16 -10
  110. package/dist/{tree-store-ASBtz7UB.d.ts → tree-store-B7hd6cEa.d.ts} +130 -25
  111. package/dist/{tree-store-CWOUMGN8.d.cts → tree-store-BenW0Mg_.d.cts} +130 -25
  112. package/package.json +14 -3
  113. package/dist/chunk-27APDXY2.js +0 -2
  114. package/dist/chunk-35MI6K7M.cjs +0 -10
  115. package/dist/chunk-4XL7SOWQ.cjs +0 -2
  116. package/dist/chunk-6K6QQVAZ.cjs +0 -18
  117. package/dist/chunk-7VQ7YLW3.cjs +0 -1
  118. package/dist/chunk-7ZJL5AEY.cjs +0 -1
  119. package/dist/chunk-C6LK2BYA.cjs +0 -2
  120. package/dist/chunk-GQQOL4PV.js +0 -1
  121. package/dist/chunk-HBEBUCRM.cjs +0 -5
  122. package/dist/chunk-LG5K46OM.js +0 -2
  123. package/dist/chunk-LWADHMVV.js +0 -5
  124. package/dist/chunk-N725IUO7.js +0 -18
  125. package/dist/chunk-N7DBENH4.js +0 -10
  126. package/dist/chunk-NVGFWMCO.js +0 -1
  127. package/dist/chunk-SYTWKJPJ.cjs +0 -18
  128. package/dist/chunk-YI6JXF7U.js +0 -18
  129. package/dist/hf-references-Dvk6De4Q.d.cts +0 -70
  130. package/dist/hf-references-z5Y4N1ab.d.ts +0 -70
  131. package/dist/note-nodes-BNCANoGN.d.ts +0 -108
  132. package/dist/note-nodes-DL-Au22P.d.cts +0 -108
  133. package/dist/ooxml-package-CdEy9ufK.d.cts +0 -1222
  134. package/dist/ooxml-package-CdEy9ufK.d.ts +0 -1222
  135. package/dist/tree-op-revision-attribution-CN06Xshv.d.cts +0 -24
  136. package/dist/tree-op-revision-attribution-CN06Xshv.d.ts +0 -24
@@ -1,11 +1,11 @@
1
- import { S as StoryScope, a as StoryTargetRejection, D as DocumentTrackingSettings, I as InsertCustomNodeWrite, C as CustomNodeWriteResult, b as CustomNodeSweepOutcome, E as EmbeddedFont, B as BookmarkIndex, L as ListKind, c as InsertImageInput, d as ImageIntentResult, R as ReplaceImageOptions, A as ApplyImagePropertiesInput, F as FragmentPasteInput, e as FragmentPasteResult } from './custom-node-writes-BvpWCnW8.js';
2
- import { T as TreeDocOp, c as SupportedImageMime, j as ImageDecodePort } from './tree-op-types-BuOfCrkp.js';
3
- import { O as OoxmlPart, a as OoxmlNode, c as OoxmlPackage, b as OoxmlElement } from './ooxml-package-CdEy9ufK.js';
4
- import { a as HeaderFooterParts, b as HeaderFooterSectionResolution } from './hf-references-z5Y4N1ab.js';
5
- import { S as SelectionMark, T as TreeModelChange, D as DocumentProperties } from './tree-store-ASBtz7UB.js';
6
- import { a as ReviewItem } from './review-items-Dw-8a6Ie.js';
1
+ import { S as StoryScope, a as StoryTargetRejection, b as HeaderFooterParts, c as HeaderFooterSectionResolution, I as InsertImageInput, d as ImageIntentResult, R as ReplaceImageOptions, A as ApplyImagePropertiesInput, F as FragmentPasteInput, e as FragmentPasteResult } from './tree-package-fragment-Cz-v-0B3.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-CA7qgAUF.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-D4rMJIES.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-BenW0Mg_.cjs';
6
+ import { a as ReviewItem } from './review-items-C-2WQdEb.cjs';
7
7
  import { Node } from 'prosemirror-model';
8
- import { a as RevisionAttributionInput } from './tree-op-revision-attribution-CN06Xshv.js';
8
+ import { CollaborationDocumentPort } from './collaboration/replication.cjs';
9
9
 
10
10
  /**
11
11
  * Why an edited projection could not be mapped back into tree ops.
@@ -221,6 +221,8 @@ interface TreeApplyResult {
221
221
  /** Present when the edit was refused, so a host can report WHY rather than a silent no-op. */
222
222
  readonly reason?: TreeBindingRejection | StoryTargetRejection | string;
223
223
  }
224
+ /** Optional collaboration attribution for a direct tree-op transaction. */
225
+ type TreeApplyOptions = Pick<TransactOptions, 'origin' | 'actorId' | 'operationId' | 'recordsHistory'>;
224
226
  /**
225
227
  * One open document: the canonical tree, and the only write path into it.
226
228
  *
@@ -261,7 +263,7 @@ interface TreeDocxSessionView {
261
263
  * header/footer part; the transaction publishes one ModelChange (HF → `global` impact)
262
264
  * and one undo unit without swapping the body store.
263
265
  */
264
- applyTreeOps(ops: readonly TreeDocOp[], selectionBefore?: SelectionMark | null, selectionAfter?: SelectionMark | null, scope?: StoryScope): TreeApplyResult;
266
+ applyTreeOps(ops: readonly TreeDocOp[], selectionBefore?: SelectionMark | null, selectionAfter?: SelectionMark | null, scope?: StoryScope, options?: TreeApplyOptions): TreeApplyResult;
265
267
  /**
266
268
  * Every part that holds a story, body first, then headers, footers and note parts.
267
269
  *
@@ -296,6 +298,8 @@ interface TreeDocxSessionView {
296
298
  beginComposition(scope?: StoryScope): void;
297
299
  endComposition(): void;
298
300
  subscribe(onChange: (change: TreeModelChange) => void): () => void;
301
+ /** Narrow provider-neutral attachment over this session's canonical package store. */
302
+ collaborationPort(documentId: string): CollaborationDocumentPort;
299
303
  /** Serialize the whole package back to DOCX bytes. */
300
304
  save(): Uint8Array;
301
305
  /**
@@ -422,7 +426,9 @@ interface TreeDocxSessionView {
422
426
  endParagraphId?: string;
423
427
  }, text: string, author: string,
424
428
  /** ISO-8601. Omitted writes no `@w:date`, because inventing one is a content change. */
425
- date?: string, scope?: StoryScope): string | null;
429
+ date?: string, scope?: StoryScope,
430
+ /** Binds id allocation to one actor, so two peers cannot mint the same comment id. */
431
+ actorId?: string): string | null;
426
432
  /**
427
433
  * Resolve a comment thread, or reopen it. False when the document holds no such comment.
428
434
  *
@@ -577,4 +583,4 @@ interface TreeDocxSessionView {
577
583
  applyFragmentPaste(scope: StoryScope, input: FragmentPasteInput): FragmentPasteResult;
578
584
  }
579
585
 
580
- export { type DocumentStyleEntry as D, type MapResult as M, type TreeDocxSessionView as T, type TreeApplyResult as a, type TreeBindingRejection as b, bodyParagraphs as c, docToTreeOps as d, type DocumentThemeColorEntry as e, partHasNode as p, reconcileDoc as r, treeToDoc as t };
586
+ export { type DocumentStyleEntry as D, type MapResult as M, type TreeDocxSessionView as T, type TreeApplyResult as a, type TreeApplyOptions as b, type TreeBindingRejection as c, bodyParagraphs as d, docToTreeOps as e, type DocumentThemeColorEntry as f, partHasNode as p, reconcileDoc as r, treeToDoc as t };
@@ -1,32 +1,121 @@
1
- import { O as OoxmlPart, c as OoxmlPackage } from './ooxml-package-CdEy9ufK.js';
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-HKfUzt_-.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
- * The document metadata Word's document-property fields render.
17
+ * What a note entry IS.
6
18
  *
7
- * Every member is optional: an absent part, an absent element, or an empty value all read as
8
- * `undefined`, and a field over a missing property paints nothing. Keys are engine-internal
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
- interface DocumentProperties {
13
- /** `dc:title` — TITLE. */
14
- readonly title?: string;
15
- /** `dc:creator` — AUTHOR. */
16
- readonly creator?: string;
17
- /** `dc:subject` — SUBJECT. */
18
- readonly subject?: string;
19
- /** `cp:keywords` — KEYWORDS. */
20
- readonly keywords?: string;
21
- /** `cp:lastModifiedBy` — LASTSAVEDBY. */
22
- readonly lastModifiedBy?: string;
23
- /** `dc:description` — COMMENTS. */
24
- readonly description?: string;
25
- /** `Company` from `docProps/app.xml`. No field maps to it yet; carried for completeness. */
26
- readonly company?: string;
27
- /** `Manager` from `docProps/app.xml`. No field maps to it yet; carried for completeness. */
28
- readonly manager?: string;
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 DocumentProperties as D, type SelectionMark as S, type TreeModelChange as T, type TreeStoryRef as a, TreeDocumentStore as b, type TransactionContext as c, type TransactOptions as d, type TreeDocumentCheckpoint as e, type TreeDocumentStoreOptions as f, type TransactResult as g };
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, c as OoxmlPackage } from './ooxml-package-CdEy9ufK.cjs';
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-CA7qgAUF.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
- * The document metadata Word's document-property fields render.
17
+ * What a note entry IS.
6
18
  *
7
- * Every member is optional: an absent part, an absent element, or an empty value all read as
8
- * `undefined`, and a field over a missing property paints nothing. Keys are engine-internal
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
- interface DocumentProperties {
13
- /** `dc:title` — TITLE. */
14
- readonly title?: string;
15
- /** `dc:creator` — AUTHOR. */
16
- readonly creator?: string;
17
- /** `dc:subject` — SUBJECT. */
18
- readonly subject?: string;
19
- /** `cp:keywords` — KEYWORDS. */
20
- readonly keywords?: string;
21
- /** `cp:lastModifiedBy` — LASTSAVEDBY. */
22
- readonly lastModifiedBy?: string;
23
- /** `dc:description` — COMMENTS. */
24
- readonly description?: string;
25
- /** `Company` from `docProps/app.xml`. No field maps to it yet; carried for completeness. */
26
- readonly company?: string;
27
- /** `Manager` from `docProps/app.xml`. No field maps to it yet; carried for completeness. */
28
- readonly manager?: string;
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 DocumentProperties as D, type SelectionMark as S, type TreeModelChange as T, type TreeStoryRef as a, TreeDocumentStore as b, type TransactionContext as c, type TransactOptions as d, type TreeDocumentCheckpoint as e, type TreeDocumentStoreOptions as f, type TransactResult as g };
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.10.0",
3
+ "version": "2.12.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
- "postcss": "^8.4.33",
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.10.0",
100
+ "@docx-editor.dev/i18n": "^2.12.0",
90
101
  "bidi-js": "1.0.3",
91
102
  "emf-converter": "2.0.2",
92
103
  "fast-xml-parser": "^5.10.1",