@docx-editor.dev/core 2.14.0 → 2.15.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 (133) hide show
  1. package/README.md +42 -0
  2. package/dist/automation.cjs +1 -1
  3. package/dist/automation.d.ts +6 -5
  4. package/dist/automation.js +1 -1
  5. package/dist/binding.cjs +1 -1
  6. package/dist/binding.d.ts +16 -10
  7. package/dist/binding.js +1 -1
  8. package/dist/chunk-24APKZAN.cjs +11 -0
  9. package/dist/chunk-2YH4MSHX.cjs +2 -0
  10. package/dist/chunk-5Y7AADI6.js +1 -0
  11. package/dist/chunk-AREFLNUP.js +11 -0
  12. package/dist/chunk-AS7YZNQE.cjs +2 -0
  13. package/dist/chunk-AVGCKH6A.cjs +20 -0
  14. package/dist/chunk-CDYVDQRI.cjs +5 -0
  15. package/dist/chunk-FGBADUSK.cjs +1 -0
  16. package/dist/chunk-HOEWFH5U.cjs +1 -0
  17. package/dist/chunk-KFELX7CN.js +2 -0
  18. package/dist/{chunk-OKEDGR65.js → chunk-KXPVOPR5.js} +1 -1
  19. package/dist/chunk-LGFKIF4M.cjs +1 -0
  20. package/dist/chunk-M52QXFKI.js +1 -0
  21. package/dist/chunk-MNUKSXRO.js +1 -0
  22. package/dist/chunk-PBOIGBDO.js +2 -0
  23. package/dist/chunk-PMHGONET.cjs +1 -0
  24. package/dist/chunk-PXKZUTHX.cjs +2 -0
  25. package/dist/chunk-Q4AB7E4O.cjs +1 -0
  26. package/dist/chunk-QJYH6AYD.js +1 -0
  27. package/dist/chunk-QRC37MWG.cjs +20 -0
  28. package/dist/chunk-RJSB6RJ7.js +20 -0
  29. package/dist/chunk-SB54HLFJ.js +20 -0
  30. package/dist/chunk-VP7SDFCM.js +1 -0
  31. package/dist/chunk-XCESLTJL.js +2 -0
  32. package/dist/{chunk-KIAP7PFQ.cjs → chunk-YL4Q5LZP.cjs} +1 -1
  33. package/dist/chunk-Z4527AXR.js +5 -0
  34. package/dist/collaboration/replication.cjs +1 -1
  35. package/dist/collaboration/replication.d.ts +4 -3
  36. package/dist/collaboration/replication.js +1 -1
  37. package/dist/collaboration.d.ts +4 -3
  38. package/dist/contracts/editor.d.ts +7 -7
  39. package/dist/contracts/interaction.d.ts +7 -7
  40. package/dist/contracts/modules.d.ts +8 -7
  41. package/dist/{custom-node-writes-DntmaAVW.d.ts → custom-node-writes-C9ArIlJh.d.ts} +2 -2
  42. package/dist/{editor-a6VvsfYU.d.ts → editor-sRxrFJd8.d.ts} +29 -21
  43. package/dist/editor.cjs +1 -1
  44. package/dist/editor.d.ts +27 -58
  45. package/dist/editor.js +1 -1
  46. package/dist/export.cjs +2 -0
  47. package/dist/export.d.ts +337 -0
  48. package/dist/export.js +2 -0
  49. package/dist/font-resolver-BYEHQGTw.d.ts +251 -0
  50. package/dist/headless-document-view-DELC4E5v.d.ts +134 -0
  51. package/dist/hf-references-DTrHkktY.d.ts +70 -0
  52. package/dist/{index-C5ZnSRkF.d.ts → index-C3Gvq4jN.d.ts} +55 -246
  53. package/dist/index.cjs +1 -1
  54. package/dist/index.d.ts +18 -16
  55. package/dist/index.js +1 -1
  56. package/dist/{shaped-measurer-CFPnXFs9.d.cts → layout-shaping-DoGR5cf8.d.ts} +86 -12
  57. package/dist/layout.cjs +1 -1
  58. package/dist/layout.d.ts +1106 -729
  59. package/dist/layout.js +1 -1
  60. package/dist/{note-properties-CDFiNXcD.d.ts → note-properties-DSe8igrz.d.ts} +2 -2
  61. package/dist/{omml-equation-BY49UOIF.d.ts → omml-equation-BpRmfDAf.d.ts} +1 -1
  62. package/dist/output.cjs +1 -1
  63. package/dist/output.d.ts +6 -6
  64. package/dist/output.js +1 -1
  65. package/dist/{protocol-gOY5GA8K.d.cts → protocol-DZzKxH5r.d.ts} +18 -12
  66. package/dist/{review-items-CCS1h93f.d.ts → review-items-DYRx187i.d.ts} +2 -2
  67. package/dist/{review-reads-BjZYeMd4.d.ts → review-reads-LbGUdNzn.d.ts} +22 -25
  68. package/dist/{revision-projection-BeXVrSSV.d.ts → revision-projection-DHRJH48u.d.ts} +1 -1
  69. package/dist/{semantic-cell-selection-BK91NCCG.d.ts → semantic-cell-selection-BXVWCBYm.d.ts} +4 -4
  70. package/dist/{semantic-interaction-BmQ7h2cq.d.ts → semantic-interaction-DZsDmPg5.d.ts} +1 -1
  71. package/dist/{semantic-paint-WJD2KeG1.d.ts → semantic-paint-f7SqN4oW.d.ts} +2 -2
  72. package/dist/{semantic-records-BpozY7-j.d.cts → semantic-records-EIdwId-a.d.ts} +301 -205
  73. package/dist/store.cjs +1 -1
  74. package/dist/store.d.ts +15 -65
  75. package/dist/store.js +1 -1
  76. package/dist/{tree-op-types-D6HzlPR4.d.ts → tree-op-types-egdarvH_.d.ts} +7 -3
  77. package/dist/{tree-package-fragment-CWFjgH6a.d.ts → tree-package-fragment-DjkH4ESI.d.ts} +4 -70
  78. package/dist/{tree-session-contract-B2HfGt79.d.ts → tree-session-contract-CGOOgPjW.d.ts} +29 -23
  79. package/dist/{tree-store-APgWx6qn.d.ts → tree-store-DKJB0IcA.d.ts} +2 -2
  80. package/package.json +7 -2
  81. package/dist/automation.d.cts +0 -82
  82. package/dist/binding.d.cts +0 -153
  83. package/dist/chunk-2PIHW2QM.cjs +0 -1
  84. package/dist/chunk-2QTY5S6T.js +0 -1
  85. package/dist/chunk-4Z5MODAE.cjs +0 -2
  86. package/dist/chunk-5TKAPFZT.cjs +0 -2
  87. package/dist/chunk-DRQHIQ4R.cjs +0 -1
  88. package/dist/chunk-F2K6SDHA.cjs +0 -20
  89. package/dist/chunk-FBA57EUJ.js +0 -2
  90. package/dist/chunk-KTAQ7BRQ.js +0 -20
  91. package/dist/chunk-LBAHXZCU.cjs +0 -5
  92. package/dist/chunk-MCDUQYWP.js +0 -5
  93. package/dist/chunk-MQP26KCF.js +0 -1
  94. package/dist/chunk-NDJGSR6M.cjs +0 -19
  95. package/dist/chunk-NJNFJPGB.cjs +0 -11
  96. package/dist/chunk-O5M4CR4P.cjs +0 -2
  97. package/dist/chunk-UKUOZXUD.js +0 -19
  98. package/dist/chunk-VQ4R5LTU.js +0 -2
  99. package/dist/chunk-ZBEJHJN2.js +0 -11
  100. package/dist/chunk-ZVTW7RGD.js +0 -2
  101. package/dist/collaboration/replication.d.cts +0 -216
  102. package/dist/collaboration.d.cts +0 -176
  103. package/dist/contracts/document.d.cts +0 -273
  104. package/dist/contracts/editor.d.cts +0 -10
  105. package/dist/contracts/interaction.d.cts +0 -10
  106. package/dist/contracts/modules.d.cts +0 -130
  107. package/dist/contracts/types.d.cts +0 -562
  108. package/dist/custom-node-writes-C46r3_5O.d.cts +0 -310
  109. package/dist/document-properties-D6Ahr8D6.d.cts +0 -28
  110. package/dist/document-properties-D6Ahr8D6.d.ts +0 -28
  111. package/dist/editor-AJ06hyyg.d.cts +0 -1994
  112. package/dist/editor.d.cts +0 -393
  113. package/dist/failure-BnGjoXf0.d.cts +0 -64
  114. package/dist/index-Cbw4lkOt.d.cts +0 -3391
  115. package/dist/index.d.cts +0 -23
  116. package/dist/layout.d.cts +0 -2486
  117. package/dist/note-properties-Y6qYh2Hv.d.cts +0 -67
  118. package/dist/omml-equation-DB8d-jCq.d.cts +0 -84
  119. package/dist/output.d.cts +0 -74
  120. package/dist/protocol-BsmQgblT.d.ts +0 -1358
  121. package/dist/review-items-CaAkgi5s.d.cts +0 -360
  122. package/dist/review-reads-DEsV0OOW.d.cts +0 -163
  123. package/dist/revision-projection-DXbrfNGD.d.cts +0 -156
  124. package/dist/semantic-cell-selection-BMhku3B1.d.cts +0 -451
  125. package/dist/semantic-interaction-DUAnxbgf.d.cts +0 -160
  126. package/dist/semantic-paint-DufNL1Zr.d.cts +0 -247
  127. package/dist/semantic-records-92UnKeU_.d.ts +0 -2821
  128. package/dist/shaped-measurer-BWbindlI.d.ts +0 -168
  129. package/dist/store.d.cts +0 -2500
  130. package/dist/tree-op-types-BUulYD5y.d.cts +0 -3099
  131. package/dist/tree-package-fragment-Dhyw7oPm.d.cts +0 -732
  132. package/dist/tree-session-contract-BY9xd7s_.d.cts +0 -613
  133. package/dist/tree-store-DEEQ9wz_.d.cts +0 -416
@@ -1,5 +1,6 @@
1
- import { b as OoxmlPackage, y as SupportedImageMime, O as OoxmlPart, a as OoxmlNode, g as OoxmlElement, E as RevisionAttributionInput, C as ImageDecodePort, F as DrawingTreeDocOp, r as TreeOpRejection, T as TreeDocOp } from './tree-op-types-D6HzlPR4.js';
2
- import { N as NoteKind, T as TreeModelChange, a as TreeDocumentStore, c as TreeStoryRef, d as TransactionContext, b as TransactOptions, S as SelectionMark, e as TreeDocumentCheckpoint } from './tree-store-APgWx6qn.js';
1
+ import { b as OoxmlPackage, y as SupportedImageMime, O as OoxmlPart, C as RevisionAttributionInput, E as ImageDecodePort, F as DrawingTreeDocOp, p as TreeOpRejection, T as TreeDocOp } from './tree-op-types-egdarvH_.js';
2
+ import { c as HeaderFooterKind, H as HeaderFooterVariant } from './hf-references-DTrHkktY.js';
3
+ import { N as NoteKind, T as TreeModelChange, a as TreeDocumentStore, b as TreeStoryRef, c as TransactionContext, d as TransactOptions, S as SelectionMark, e as TreeDocumentCheckpoint } from './tree-store-DKJB0IcA.js';
3
4
 
4
5
  /** A freshly allocated drawing property id, or the reason one could not be minted. */
5
6
  type DrawingPropertyIdResult = {
@@ -63,73 +64,6 @@ interface ExternalImageFetchPort {
63
64
  }>>;
64
65
  }
65
66
 
66
- /** `w:headerReference w:type` vocabulary (ECMA-376 §17.10.5): default, first page, even pages. */
67
- type HeaderFooterVariant = 'default' | 'first' | 'even';
68
- /** Header vs footer region kind for chrome and lifecycle ops. */
69
- type HeaderFooterKind = 'header' | 'footer';
70
- /**
71
- * A section's resolved header and footer parts, by variant.
72
- *
73
- * The `even` variant is only honoured when `w:evenAndOddHeaders` is set in settings.xml —
74
- * without it Word ignores an authored even header, and so does this.
75
- */
76
- interface HeaderFooterParts {
77
- readonly headers: ReadonlyMap<HeaderFooterVariant, OoxmlPart>;
78
- readonly footers: ReadonlyMap<HeaderFooterVariant, OoxmlPart>;
79
- /** `w:evenAndOddHeaders` in settings.xml — without it the `even` variant is ignored. */
80
- readonly evenAndOddHeaders: boolean;
81
- /** Whether this section enables first-page header/footer furniture (`w:titlePg`). */
82
- readonly titlePage: boolean;
83
- }
84
- /**
85
- * One resolved furniture slot with enough metadata for "Same as previous" chrome.
86
- *
87
- * `inherited: true` means this section has no declared reference for the slot and the
88
- * part comes from a predecessor. The first section never reports inherited — omitting a
89
- * ref there is blank furniture, not inheritance from a later section.
90
- */
91
- interface HeaderFooterSlotMeta {
92
- readonly part: OoxmlPart;
93
- readonly partName: string;
94
- readonly rId: string;
95
- readonly inherited: boolean;
96
- }
97
- /** Per-section resolution including declared-vs-inherited metadata. */
98
- interface HeaderFooterSectionResolution {
99
- readonly headers: ReadonlyMap<HeaderFooterVariant, HeaderFooterSlotMeta>;
100
- readonly footers: ReadonlyMap<HeaderFooterVariant, HeaderFooterSlotMeta>;
101
- readonly evenAndOddHeaders: boolean;
102
- readonly titlePage: boolean;
103
- }
104
- /**
105
- * `w:sectPr` nodes in section order, aligned with layout's `enumerateDocumentSections`.
106
- *
107
- * `null` means a section with no `w:sectPr` node (Word defaults, inherits HF from previous).
108
- * Paragraph-level breaks first; the final entry covers remaining blocks (body-level or null).
109
- */
110
- declare function collectSectionPropertyNodes(root: OoxmlNode): Array<OoxmlElement | null>;
111
- /**
112
- * Resolve header/footer parts for every section with declared-vs-inherited metadata.
113
- *
114
- * Index aligns with `enumerateDocumentSections` in the layout package. Existing merged
115
- * maps stay available via {@link resolveHeaderFooterPartsBySection}.
116
- */
117
- declare function resolveHeaderFooterResolutionBySection(pkg: OoxmlPackage): readonly HeaderFooterSectionResolution[];
118
- /**
119
- * Resolve header/footer parts for every section, applying OOXML inheritance.
120
- *
121
- * Index aligns with `enumerateDocumentSections` in the layout package.
122
- */
123
- declare function resolveHeaderFooterPartsBySection(pkg: OoxmlPackage): readonly HeaderFooterParts[];
124
- /**
125
- * Resolve the main-document header/footer references to their parts, gated by the
126
- * settings the section actually declares.
127
- *
128
- * Returns the FINAL section's effective parts (after inheritance). Multi-section hosts
129
- * should prefer `resolveHeaderFooterPartsBySection`.
130
- */
131
- declare function resolveHeaderFooterParts(pkg: OoxmlPackage): HeaderFooterParts;
132
-
133
67
  /** Lifecycle impact — furniture always reaches multiple pages; never narrower than flow-structural. */
134
68
  type HeaderFooterLifecycleImpact = 'flow-structural' | 'global';
135
69
  /**
@@ -729,4 +663,4 @@ type FragmentPasteResult = (Extract<PackageTransactResult, {
729
663
  */
730
664
  declare function applyFragmentPaste(store: TreePackageStore, scope: StoryScope, input: FragmentPasteInput): FragmentPasteResult;
731
665
 
732
- export { resolveHeaderFooterResolutionBySection as $, type ApplyImagePropertiesInput as A, applyFragmentPaste as B, type CascadeDeletedNoteReferencesOptions as C, DEFAULT_MAX_EDITABLE_STORY_PARTS as D, applyHeaderFooterLifecycleOp as E, type FragmentPasteInput as F, applyNoteLifecycleOp as G, type HeaderFooterVariant as H, type InsertImageInput as I, cascadeDeletedNoteReferences as J, collectNoteReferences as K, collectPackageNoteReferences as L, MAX_FRAGMENT_DECODED_BYTES as M, type NoteDiagnostic as N, collectSectionPropertyNodes as O, type PackageTransactResult as P, createNoteReferenceScanBudget as Q, type ReplaceImageOptions as R, type StoryScope as S, TreePackageStore as T, diagnoseNoteReferences as U, isHeaderFooterLifecycleOp as V, isNoteLifecycleOp as W, normalNoteIds as X, notesPartHasId as Y, resolveHeaderFooterParts as Z, resolveHeaderFooterPartsBySection as _, type StoryTargetRejection as a, resolveNotesPart as a0, withBinaryPart as a1, withEmbeddedImage as a2, withoutUnreferencedImagePart as a3, type HeaderFooterParts as b, type HeaderFooterSectionResolution as c, type ImageIntentResult as d, type FragmentPasteResult as e, type DrawingPropertyIdResult as f, type HeaderFooterKind as g, type HeaderFooterLifecycleImpact as h, type HeaderFooterLifecycleOp as i, type HeaderFooterLifecycleRejection as j, type HeaderFooterLifecycleResult as k, type HeaderFooterSlotMeta as l, MAX_NOTE_REFERENCE_PARTS as m, MAX_NOTE_REFERENCE_SCAN as n, type NoteDiagnosticCode as o, type NoteLifecycleImpact as p, type NoteLifecycleOp as q, type NoteLifecycleOptions as r, type NoteLifecycleRejection as s, type NoteLifecycleResult as t, type NoteReferenceHit as u, type NoteReferenceScanBudget as v, type RemotePackageAttribution as w, type StoryResolveResult as x, type TreePackageStoreOptions as y, allocateDrawingPropertyId as z };
666
+ export { type ApplyImagePropertiesInput as A, collectPackageNoteReferences as B, type CascadeDeletedNoteReferencesOptions as C, DEFAULT_MAX_EDITABLE_STORY_PARTS as D, createNoteReferenceScanBudget as E, type FragmentPasteInput as F, diagnoseNoteReferences as G, type HeaderFooterLifecycleImpact as H, type InsertImageInput as I, isHeaderFooterLifecycleOp as J, isNoteLifecycleOp as K, normalNoteIds as L, MAX_FRAGMENT_DECODED_BYTES as M, type NoteDiagnostic as N, notesPartHasId as O, type PackageTransactResult as P, resolveNotesPart as Q, type ReplaceImageOptions as R, type StoryScope as S, TreePackageStore as T, withBinaryPart as U, withEmbeddedImage as V, withoutUnreferencedImagePart as W, type StoryTargetRejection as a, type ImageIntentResult as b, type FragmentPasteResult as c, type DrawingPropertyIdResult as d, type HeaderFooterLifecycleOp as e, type HeaderFooterLifecycleRejection as f, type HeaderFooterLifecycleResult as g, MAX_NOTE_REFERENCE_PARTS as h, MAX_NOTE_REFERENCE_SCAN as i, type NoteDiagnosticCode as j, type NoteLifecycleImpact as k, type NoteLifecycleOp as l, type NoteLifecycleOptions as m, type NoteLifecycleRejection as n, type NoteLifecycleResult as o, type NoteReferenceHit as p, type NoteReferenceScanBudget as q, type RemotePackageAttribution as r, type StoryResolveResult as s, type TreePackageStoreOptions as t, allocateDrawingPropertyId as u, applyFragmentPaste as v, applyHeaderFooterLifecycleOp as w, applyNoteLifecycleOp as x, cascadeDeletedNoteReferences as y, collectNoteReferences as z };
@@ -1,11 +1,13 @@
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-CWFjgH6a.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-D6HzlPR4.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-DntmaAVW.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-APgWx6qn.js';
6
- import { a as ReviewItem } from './review-items-CCS1h93f.js';
1
+ import { S as StoryScope, a as StoryTargetRejection, I as InsertImageInput, b as ImageIntentResult, R as ReplaceImageOptions, A as ApplyImagePropertiesInput, F as FragmentPasteInput, c as FragmentPasteResult } from './tree-package-fragment-DjkH4ESI.js';
2
+ import { T as TreeDocOp, O as OoxmlPart, a as OoxmlNode, b as OoxmlPackage, c as OoxmlElement, y as SupportedImageMime, E as ImageDecodePort, C as RevisionAttributionInput } from './tree-op-types-egdarvH_.js';
3
+ import { a as HeaderFooterParts, b as HeaderFooterSectionResolution } from './hf-references-DTrHkktY.js';
4
+ 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-C9ArIlJh.js';
5
+ import { H as HeadlessDocumentView, D as DocumentProperties } from './headless-document-view-DELC4E5v.js';
6
+ import { S as SelectionMark, d as TransactOptions, T as TreeModelChange } from './tree-store-DKJB0IcA.js';
7
+ import { a as ReviewItem } from './review-items-DYRx187i.js';
7
8
  import { Node } from 'prosemirror-model';
8
9
  import { CollaborationDocumentPort } from './collaboration/replication.js';
10
+ import { V as ViewScope } from './editor-sRxrFJd8.js';
9
11
 
10
12
  /**
11
13
  * Why an edited projection could not be mapped back into tree ops.
@@ -65,6 +67,18 @@ declare function reconcileDoc(previousDoc: Node, part: OoxmlPart, change: {
65
67
  readonly splitJoin: readonly unknown[];
66
68
  } | null): Node;
67
69
 
70
+ /** The theme's font slots, fully resolved, for resolving `w:rFonts` theme attributes. */
71
+ interface DocumentThemeFonts {
72
+ /** `a:majorFont` latin typeface — headings. */
73
+ readonly major: string | null;
74
+ /** `a:minorFont` latin typeface — body text. */
75
+ readonly minor: string | null;
76
+ /** `a:majorFont` east asian typeface (`a:ea`) — headings. */
77
+ readonly majorEastAsia: string | null;
78
+ /** `a:minorFont` east asian typeface (`a:ea`) — body text. */
79
+ readonly minorEastAsia: string | null;
80
+ }
81
+
68
82
  /**
69
83
  * How a style LOOKS, for a picker to preview it in its own face — Word shows the gallery
70
84
  * that way, and a list of identical rows makes the user apply a style to find out what it
@@ -103,17 +117,6 @@ interface DocumentThemeColorEntry {
103
117
  readonly slot: ThemeColorSlot;
104
118
  readonly hex: string;
105
119
  }
106
- /** The theme's 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
- /** `a:majorFont` east asian typeface (`a:ea`) — headings. */
113
- readonly majorEastAsia: string | null;
114
- /** `a:minorFont` east asian typeface (`a:ea`) — body text. */
115
- readonly minorEastAsia: string | null;
116
- }
117
120
 
118
121
  /** One heading of the outline, in document order. `level` is 0-based (Heading 1 = 0). */
119
122
  interface DocumentOutlineEntry {
@@ -131,9 +134,11 @@ interface DocumentSearchOptions {
131
134
  readonly wholeWord?: boolean;
132
135
  /** Override the default {@link SEARCH_MATCH_LIMIT}. Clamped to it; never raised past it. */
133
136
  readonly limit?: number;
137
+ /** Stories the facade can navigate in its current mode. */
138
+ readonly stories?: 'all' | 'body';
134
139
  }
135
140
  /**
136
- * One occurrence of a query in the body story.
141
+ * One occurrence of a query in an editable document story.
137
142
  *
138
143
  * Carries the engine's own address (`blockId` + `start`) and the positional one a find UI
139
144
  * needs (`paragraphIndex` / `runIndex` / `runOffset`), both derived from the SAME walk —
@@ -148,6 +153,8 @@ interface DocumentSearchMatch {
148
153
  readonly paragraphIndex: number;
149
154
  readonly runIndex: number;
150
155
  readonly runOffset: number;
156
+ /** Story containing the match. Omitted for the body. */
157
+ readonly scope?: ViewScope;
151
158
  /** The matched text as it appears in the document, control characters flattened. */
152
159
  readonly text: string;
153
160
  /** Paragraph text immediately before the match, bounded and flattened. */
@@ -237,7 +244,7 @@ type TreeApplyOptions = Pick<TransactOptions, 'origin' | 'actorId' | 'operationI
237
244
  * Holds the whole package, not just the body — headers, footers, notes, comments and styles are
238
245
  * all reachable through it, and parts the engine does not model are preserved verbatim.
239
246
  */
240
- interface TreeDocxSessionView {
247
+ interface TreeDocxSessionView extends HeadlessDocumentView {
241
248
  /** Whether the body holds at least one editable paragraph. */
242
249
  readonly editable: boolean;
243
250
  /** Canonical node ids of the body paragraphs, in order. */
@@ -515,11 +522,10 @@ interface TreeDocxSessionView {
515
522
  */
516
523
  sweepCustomNodePayloads(namespaces: readonly string[]): CustomNodeSweepOutcome;
517
524
  /**
518
- * Every occurrence of `query` in the BODY story, in document order, addressed in the
519
- * same offset vocabulary the tree ops and the surface selection use — so a match can be
520
- * handed straight to `setSelection` without re-deriving anything.
525
+ * Every occurrence of `query` across editable stories, in navigation order. Each match uses
526
+ * the same offset vocabulary as tree operations and surface selections.
521
527
  *
522
- * Memoized one deep, keyed on the revision AND the question asked: a find panel asks the
528
+ * Memoized one deep, keyed on the package revision AND the question asked: a find panel asks the
523
529
  * same question on every tick, and a different query replaces the entry rather than
524
530
  * growing a cache the session would have to bound.
525
531
  */
@@ -1,4 +1,4 @@
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-D6HzlPR4.js';
1
+ import { a as OoxmlNode, h as OoxmlParagraphNode, i as OoxmlNoteNode, j as OoxmlContinuationSeparatorNode, k as OoxmlEndnotesNode, l as OoxmlFootnotesNode, m as OoxmlNoteRefNode, n as OoxmlNoteReferenceNode, o as OoxmlSeparatorNode, I as ImpactClass, O as OoxmlPart, b as OoxmlPackage, T as TreeDocOp, p as TreeOpRejection } from './tree-op-types-egdarvH_.js';
2
2
 
3
3
  /** UTF-16 placeholder for one atomic note unit in `paragraphTextOf` / segments. */
4
4
  declare const NOTE_ATOM_CHAR = "\uFFFC";
@@ -413,4 +413,4 @@ declare class TreeDocumentStore {
413
413
  private publish;
414
414
  }
415
415
 
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 };
416
+ export { type AtomicNoteSpan as A, isSeparatorNode as B, noteAtomText as C, noteIdOf as D, noteKindOf as E, noteRefKindOf as F, noteReferenceKindOf as G, noteTypeOf 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 TreeStoryRef as b, type TransactionContext as c, type TransactOptions 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, allocateNoteId as n, atomicNoteSpansOf as o, customMarkFollows as p, findNoteById as q, formatNoteScopeId as r, isContinuationSeparatorNode as s, isEndnotesNode as t, isFootnotesNode as u, isNormalNote as v, isNoteAtomNode as w, isNoteNode as x, isNoteRefNode as y, isNoteReferenceNode as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docx-editor.dev/core",
3
- "version": "2.14.0",
3
+ "version": "2.15.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
  "engines": {
@@ -67,6 +67,11 @@
67
67
  "import": "./dist/output.js",
68
68
  "require": "./dist/output.cjs"
69
69
  },
70
+ "./export": {
71
+ "types": "./dist/export.d.ts",
72
+ "import": "./dist/export.js",
73
+ "require": "./dist/export.cjs"
74
+ },
70
75
  "./store": {
71
76
  "types": "./dist/store.d.ts",
72
77
  "import": "./dist/store.js",
@@ -100,7 +105,7 @@
100
105
  "directory": "packages/core"
101
106
  },
102
107
  "dependencies": {
103
- "@docx-editor.dev/i18n": "^2.14.0",
108
+ "@docx-editor.dev/i18n": "^2.15.0",
104
109
  "bidi-js": "1.0.3",
105
110
  "emf-converter": "2.0.2",
106
111
  "fast-xml-parser": "^5.10.1",
@@ -1,82 +0,0 @@
1
- import { A as AutomationCapabilities, a as AutomationHost } from './protocol-gOY5GA8K.cjs';
2
- export { b as AUTOMATION_COMMAND_OPERATIONS, c as AUTOMATION_QUERY_OPERATIONS, d as AUTOMATION_SOLITARY_OPERATIONS, e as AutomationAlignment, f as AutomationBatchRequest, g as AutomationBatchResponse, h as AutomationChangeEvent, i as AutomationContentControlLock, j as AutomationContentControlRangeLocation, k as AutomationContentControlScope, l as AutomationContentControlSubtype, m as AutomationContentControlValue, n as AutomationError, o as AutomationErrorCode, p as AutomationFontRead, q as AutomationFontWrite, r as AutomationHandle, s as AutomationHandleRef, t as AutomationObjectKind, u as AutomationOperation, v as AutomationOperationKind, w as AutomationOperationResult, x as AutomationPageOrientation, y as AutomationPageSetupRead, z as AutomationPageSetupWrite, B as AutomationParagraphFormatRead, C as AutomationParagraphFormatWrite, D as AutomationParagraphRef, E as AutomationPoint, F as AutomationSaveResult, G as AutomationSearchOptions, H as AutomationSelectionMode, I as AutomationSpan, J as AutomationSpanRef, K as AutomationTextProjection, L as AutomationUnsubscribe, M as AutomationValue, N as isAutomationCommand, O as isSolitaryAutomationCommand } from './protocol-gOY5GA8K.cjs';
3
- import { H as HeaderFooterVariant } from './tree-package-fragment-Dhyw7oPm.cjs';
4
- import { N as NoteKind } from './tree-store-DEEQ9wz_.cjs';
5
- import { e as OoxmlPackageLimits, f as OoxmlPackageRejection } from './tree-op-types-BUulYD5y.cjs';
6
- import { CollaborationModuleContribution } from './collaboration.cjs';
7
- import './contracts/types.cjs';
8
- import './collaboration/replication.cjs';
9
- import './failure-BnGjoXf0.cjs';
10
-
11
- /** The variants a section can declare furniture for. */
12
- declare const HEADER_FOOTER_VARIANTS: readonly HeaderFooterVariant[];
13
- /**
14
- * Which story an operation acts on: the main body, one header/footer variant of one section, or
15
- * one note.
16
- *
17
- * A header is addressed by section INDEX plus variant rather than by relationship id, because
18
- * that is how a caller thinks about it and because a section inheriting its predecessor's header
19
- * has no relationship of its own to name.
20
- */
21
- type AutomationStoryId = {
22
- readonly kind: 'body';
23
- } | {
24
- readonly kind: 'header' | 'footer';
25
- /** Position of the section in the document, from zero. */
26
- readonly sectionIndex: number;
27
- readonly variant: HeaderFooterVariant;
28
- } | {
29
- readonly kind: 'note';
30
- readonly noteKind: NoteKind;
31
- readonly noteId: number;
32
- };
33
-
34
- /** What a headless host can do. It paints nothing, so it claims nothing about painting. */
35
- declare const SERVER_AUTOMATION_CAPABILITIES: AutomationCapabilities;
36
- /**
37
- * Why bytes could not be opened as a document: any bounded-reader rejection, plus the package
38
- * that parsed but carried no main document part.
39
- */
40
- type ServerAutomationHostRejection = OoxmlPackageRejection | 'no-main-document-part';
41
- /**
42
- * A host over the opened bytes, or a refusal.
43
- *
44
- * A result rather than a throw: these bytes are untrusted input, and a malformed upload should
45
- * be a value the caller inspects rather than an exception from inside a zip decoder.
46
- */
47
- type ServerAutomationHostResult = {
48
- readonly ok: true;
49
- readonly host: AutomationHost;
50
- } | {
51
- readonly ok: false;
52
- readonly reason: ServerAutomationHostRejection;
53
- readonly detail?: string;
54
- };
55
- /**
56
- * How a headless host opens a document. Every field is optional.
57
- *
58
- * @public
59
- */
60
- interface ServerAutomationHostOptions {
61
- /**
62
- * Tighter budgets for the bounded reader — zip ratio, part count, XML depth.
63
- *
64
- * Exposed because a server opening documents it did not author is exactly where a caller
65
- * may want smaller limits than the defaults. Omitted means the engine's own defaults.
66
- */
67
- readonly limits?: OoxmlPackageLimits;
68
- /**
69
- * Collaboration replica from the module registry. Absent, this host does
70
- * not attach a replica.
71
- */
72
- readonly collaborationModel?: CollaborationModuleContribution;
73
- }
74
- /**
75
- * Open DOCX bytes into a headless automation host.
76
- *
77
- * A typed rejection rather than a throw: every failure here is a property of the FILE, and a
78
- * caller needs to tell "not a package" from "this package is hostile" from "no body".
79
- */
80
- declare function createServerAutomationHost(bytes: Uint8Array, options?: ServerAutomationHostOptions): ServerAutomationHostResult;
81
-
82
- export { AutomationCapabilities, AutomationHost, type AutomationStoryId, HEADER_FOOTER_VARIANTS, SERVER_AUTOMATION_CAPABILITIES, type ServerAutomationHostOptions, type ServerAutomationHostRejection, type ServerAutomationHostResult, createServerAutomationHost };
@@ -1,153 +0,0 @@
1
- import { Node, Schema } from 'prosemirror-model';
2
- import { s as OoxmlProperty, f as OoxmlPackageRejection } from './tree-op-types-BUulYD5y.cjs';
3
- import { T as TreeDocxSessionView, a as TreeApplyResult } from './tree-session-contract-BY9xd7s_.cjs';
4
- export { D as DocumentStyleEntry, M as MapResult, b as TreeApplyOptions, c as TreeBindingRejection, d as bodyParagraphs, e as docToTreeOps, p as partHasNode, r as reconcileDoc, t as treeToDoc } from './tree-session-contract-BY9xd7s_.cjs';
5
- import { ReviewModuleContribution } from './contracts/modules.cjs';
6
- export { S as StoryScope, a as StoryTargetRejection } from './tree-package-fragment-Dhyw7oPm.cjs';
7
- import { EditorView } from 'prosemirror-view';
8
- import './contracts/types.cjs';
9
- import './custom-node-writes-C46r3_5O.cjs';
10
- import './tree-store-DEEQ9wz_.cjs';
11
- import './document-properties-D6Ahr8D6.cjs';
12
- import './review-items-CaAkgi5s.cjs';
13
- import './collaboration/replication.cjs';
14
- import './collaboration.cjs';
15
- import './failure-BnGjoXf0.cjs';
16
- import './revision-projection-DXbrfNGD.cjs';
17
-
18
- /** Attributes carried by a projected paragraph. */
19
- interface ParagraphAttrs {
20
- /** The canonical tree node id this paragraph projects. */
21
- readonly nodeId: string | null;
22
- /** Accepted `w:pPr` children, as authored. */
23
- readonly props: readonly OoxmlProperty[];
24
- }
25
- /**
26
- * The ProseMirror schema the canonical tree projects into.
27
- *
28
- * Deliberately minimal. It models only what an editing surface must manipulate directly —
29
- * paragraphs, text, tabs, breaks, and run properties as marks — because everything it does NOT
30
- * model stays on the tree and is preserved losslessly there. Widening this schema moves content
31
- * out of the tree's custody, which is the opposite of what it is for.
32
- *
33
- * The node and mark unions are written out rather than inferred from the spec below. Inferred,
34
- * tsup's dts worker emits their members in an order that varies run to run, so the generated
35
- * `binding.api.md` differed between builds of identical source and `api:check` failed at random.
36
- * An explicit annotation pins the emitted order. Adding a node or mark to the spec means adding
37
- * it here too — the compiler rejects the assignment otherwise.
38
- */
39
- declare const treeSchema: Schema<'doc' | 'paragraph' | 'text' | 'tab' | 'hardBreak' | 'pageBreak' | 'unknownInline', 'runProps'>;
40
- /** The accepted run properties carried by a text node, or an empty list. */
41
- declare function runPropsOf(node: Node): readonly OoxmlProperty[];
42
-
43
- /**
44
- * Binding-only session methods that exchange ProseMirror projections.
45
- *
46
- * Editor surfaces expose {@link TreeDocxSessionView}. Only the binding lane sees this extension.
47
- */
48
- interface TreeDocxSession extends TreeDocxSessionView {
49
- /** Project the current BODY revision into a ProseMirror doc. */
50
- projectDoc(): Node;
51
- /** Re-project incrementally from the last committed change, reusing untouched paragraphs. */
52
- reconcile(previousDoc: Node): Node;
53
- /**
54
- * Whether the last commit changed the BLOCK SEQUENCE (a split, join, insert or delete).
55
- *
56
- * A host needs this to decide whether the view must be re-projected at all. After a pure
57
- * text edit, the view already holds what the model holds. Re-projecting wastes work and
58
- * races the next keystroke.
59
- */
60
- lastCommitWasStructural(): boolean;
61
- /** Map an edited BODY doc to tree ops and commit them as one transaction. */
62
- applyPmDoc(doc: Node): TreeApplyResult;
63
- }
64
-
65
- /**
66
- * Why bytes could not be opened: any bounded-reader rejection, plus the package that parsed but
67
- * carried no main document tree.
68
- */
69
- type TreeSessionRejection = OoxmlPackageRejection | 'no-main-document-tree';
70
- /**
71
- * An open session, or a typed refusal.
72
- *
73
- * A result rather than a throw: every failure here is a property of the FILE, and a host needs to
74
- * tell "this is not a package" from "this package is malicious" from "this document has no body".
75
- */
76
- type OpenTreeSessionResult = {
77
- readonly ok: true;
78
- readonly session: TreeDocxSession;
79
- } | {
80
- readonly ok: false;
81
- readonly reason: TreeSessionRejection;
82
- readonly detail?: string;
83
- };
84
- interface OpenTreeSessionOptions {
85
- /**
86
- * The review module's derivation hooks, contributed through the editor's
87
- * `EditorModule` seam. Absent — the free engine — the session's
88
- * `reviewItems()` reports the typed empty queue; parse, preservation, and
89
- * `hasReviewContent` are unaffected.
90
- */
91
- readonly reviewModel?: ReviewModuleContribution;
92
- }
93
- /**
94
- * Open DOCX bytes into a tree-backed session.
95
- *
96
- * Returns a typed rejection rather than throwing: every failure here is a property of the FILE,
97
- * and a host needs to tell "this is not a package" from "this package is malicious" from "this
98
- * document has no body".
99
- *
100
- * The read is BOUNDED — decompression ratio, part count, XML depth and element counts are all
101
- * capped — because the bytes are untrusted by definition.
102
- */
103
- declare function openTreeSession(bytes: Uint8Array, options?: OpenTreeSessionOptions): OpenTreeSessionResult;
104
- /** The origin a host should use when committing a reconciliation rather than a user edit. */
105
- declare const PROJECTION_ORIGIN: "dev.docx-editor.core.origin.projection";
106
-
107
- /** How a tree surface is mounted. */
108
- interface TreeSurfaceOptions {
109
- /** Called after every commit or refusal, so a host can show revision and rejection state. */
110
- readonly onChange?: (state: TreeSurfaceState) => void;
111
- }
112
- /**
113
- * Everything observable about a mounted tree surface.
114
- *
115
- * `lastRejection` is part of the state rather than a thrown error because a refused edit is an
116
- * ordinary outcome here — the binding refuses anything it cannot explain, and the host shows why
117
- * instead of the edit vanishing.
118
- */
119
- interface TreeSurfaceState {
120
- readonly revision: number;
121
- readonly canUndo: boolean;
122
- readonly canRedo: boolean;
123
- /** The reason the last transaction was refused, or null when the last one committed. */
124
- readonly lastRejection: string | null;
125
- }
126
- /**
127
- * A mounted ProseMirror view bound to a {@link TreeDocxSession}.
128
- *
129
- * Every committed transaction becomes tree ops through the binding; a transaction the binding
130
- * cannot explain is refused and reported through {@link TreeSurfaceState.lastRejection}, leaving
131
- * the tree untouched.
132
- */
133
- interface TreeSurface {
134
- readonly view: EditorView;
135
- state(): TreeSurfaceState;
136
- undo(): void;
137
- redo(): void;
138
- /** Toggle one accepted run property across the current selection. */
139
- toggleRunProperty(localName: string, attributes?: Record<string, string>): void;
140
- destroy(): void;
141
- }
142
- /**
143
- * Mount an editable ProseMirror view over a session's body story.
144
- *
145
- * The reference binding, not the production surface — `mountPaginatedSurface` is what the shipped
146
- * editor uses. This one exists to exercise the tree↔ProseMirror contract directly, without
147
- * pagination or painting in the way.
148
- *
149
- * Call {@link TreeSurface.destroy} to release the view.
150
- */
151
- declare function mountTreeSurface(mount: HTMLElement, session: TreeDocxSession, options?: TreeSurfaceOptions): TreeSurface;
152
-
153
- export { type OpenTreeSessionResult, PROJECTION_ORIGIN, type ParagraphAttrs, TreeApplyResult, type TreeDocxSession, TreeDocxSessionView, type TreeSessionRejection, type TreeSurface, type TreeSurfaceOptions, type TreeSurfaceState, mountTreeSurface, openTreeSession, runPropsOf, treeSchema };