@docx-editor.dev/core 0.0.1 → 2.1.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 (116) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +91 -2
  3. package/THIRD_PARTY_NOTICES.md +18 -0
  4. package/dist/automation.cjs +1 -0
  5. package/dist/automation.d.cts +74 -0
  6. package/dist/automation.d.ts +74 -0
  7. package/dist/automation.js +1 -0
  8. package/dist/binding.cjs +1 -0
  9. package/dist/binding.d.cts +88 -0
  10. package/dist/binding.d.ts +88 -0
  11. package/dist/binding.js +1 -0
  12. package/dist/chunk-2DTQDAN7.js +2 -0
  13. package/dist/chunk-3JKQE4QJ.cjs +2 -0
  14. package/dist/chunk-4WWEDTTE.js +2 -0
  15. package/dist/chunk-6WIIHJFY.js +1 -0
  16. package/dist/chunk-7VQ7YLW3.cjs +1 -0
  17. package/dist/chunk-BS554B6D.cjs +2 -0
  18. package/dist/chunk-BZK64YU3.cjs +10 -0
  19. package/dist/chunk-CZFUMACF.cjs +12 -0
  20. package/dist/chunk-GQQOL4PV.js +1 -0
  21. package/dist/chunk-HBL3NNH5.cjs +1 -0
  22. package/dist/chunk-JQFDLZXQ.cjs +2 -0
  23. package/dist/chunk-O2WQY7IT.cjs +5 -0
  24. package/dist/chunk-PC76F2HR.cjs +1 -0
  25. package/dist/chunk-QRAUDDVY.js +2 -0
  26. package/dist/chunk-REZUWYB7.js +1 -0
  27. package/dist/chunk-STCITBJK.js +12 -0
  28. package/dist/chunk-TBBXCC7D.js +5 -0
  29. package/dist/chunk-TSXT537P.cjs +12 -0
  30. package/dist/chunk-WOGYVM3W.js +12 -0
  31. package/dist/chunk-Y7TA7TPF.js +10 -0
  32. package/dist/content-control-walk-CbTqHq6O.d.cts +56 -0
  33. package/dist/content-control-walk-D06GijR0.d.ts +56 -0
  34. package/dist/contracts/document.cjs +1 -0
  35. package/dist/contracts/document.d.cts +246 -0
  36. package/dist/contracts/document.d.ts +246 -0
  37. package/dist/contracts/document.js +0 -0
  38. package/dist/contracts/editor.cjs +1 -0
  39. package/dist/contracts/editor.d.cts +11 -0
  40. package/dist/contracts/editor.d.ts +11 -0
  41. package/dist/contracts/editor.js +1 -0
  42. package/dist/contracts/interaction.cjs +1 -0
  43. package/dist/contracts/interaction.d.cts +11 -0
  44. package/dist/contracts/interaction.d.ts +11 -0
  45. package/dist/contracts/interaction.js +0 -0
  46. package/dist/contracts/modules.cjs +1 -0
  47. package/dist/contracts/modules.d.cts +117 -0
  48. package/dist/contracts/modules.d.ts +117 -0
  49. package/dist/contracts/modules.js +1 -0
  50. package/dist/contracts/types.cjs +1 -0
  51. package/dist/contracts/types.d.cts +452 -0
  52. package/dist/contracts/types.d.ts +452 -0
  53. package/dist/contracts/types.js +0 -0
  54. package/dist/custom-node-writes-YqISlSRl.d.cts +885 -0
  55. package/dist/custom-node-writes-ttKuYd0M.d.ts +885 -0
  56. package/dist/editor-B93PggnR.d.cts +1690 -0
  57. package/dist/editor-CFsSrxGR.d.ts +1690 -0
  58. package/dist/editor.cjs +1 -0
  59. package/dist/editor.css +7106 -0
  60. package/dist/editor.d.cts +271 -0
  61. package/dist/editor.d.ts +271 -0
  62. package/dist/editor.js +1 -0
  63. package/dist/hf-references-BdjsQNE_.d.ts +71 -0
  64. package/dist/hf-references-CgEOSw3i.d.cts +71 -0
  65. package/dist/image-resources-C_YnqPhn.d.ts +203 -0
  66. package/dist/image-resources-DwpNnTg3.d.cts +203 -0
  67. package/dist/index-BjZelfWL.d.cts +2532 -0
  68. package/dist/index-DP1yJJ3R.d.ts +2532 -0
  69. package/dist/index.cjs +1 -0
  70. package/dist/index.d.cts +22 -0
  71. package/dist/index.d.ts +22 -0
  72. package/dist/index.js +1 -0
  73. package/dist/layout.cjs +1 -0
  74. package/dist/layout.d.cts +2366 -0
  75. package/dist/layout.d.ts +2366 -0
  76. package/dist/layout.js +1 -0
  77. package/dist/note-nodes-BPSTVDMr.d.ts +108 -0
  78. package/dist/note-nodes-C6DLxlvj.d.cts +108 -0
  79. package/dist/ooxml-package-CR5us6ad.d.cts +354 -0
  80. package/dist/ooxml-package-D_CtywTW.d.ts +354 -0
  81. package/dist/ooxml-tree-BU0e3DVi.d.cts +871 -0
  82. package/dist/ooxml-tree-BU0e3DVi.d.ts +871 -0
  83. package/dist/output.cjs +1 -0
  84. package/dist/output.d.cts +158 -0
  85. package/dist/output.d.ts +158 -0
  86. package/dist/output.js +1 -0
  87. package/dist/protocol-BWVA3Q1p.d.ts +1255 -0
  88. package/dist/protocol-FAz_nPm_.d.cts +1255 -0
  89. package/dist/review-reads-CsoXSvUg.d.ts +401 -0
  90. package/dist/review-reads-qW0jvdF1.d.cts +401 -0
  91. package/dist/review-support-D64Wu236.d.cts +358 -0
  92. package/dist/review-support-nsLXC9jf.d.ts +358 -0
  93. package/dist/revision-projection-72ZApe-g.d.cts +84 -0
  94. package/dist/revision-projection-DHAkcD_L.d.ts +84 -0
  95. package/dist/semantic-cell-selection-D_8RbPII.d.ts +427 -0
  96. package/dist/semantic-cell-selection-DwLB71fF.d.cts +427 -0
  97. package/dist/semantic-interaction-CXH2wFqi.d.ts +187 -0
  98. package/dist/semantic-interaction-DqcEonqD.d.cts +187 -0
  99. package/dist/semantic-paint-drawings-B5Wk2so5.d.ts +21 -0
  100. package/dist/semantic-paint-drawings-x8g44lD_.d.cts +21 -0
  101. package/dist/semantic-records-COVFW5aS.d.cts +1505 -0
  102. package/dist/semantic-records-zTC0_1zi.d.ts +1505 -0
  103. package/dist/shaped-measurer-AFnFxoot.d.cts +613 -0
  104. package/dist/shaped-measurer-CZXL-a6v.d.ts +613 -0
  105. package/dist/store.cjs +1 -0
  106. package/dist/store.d.cts +2153 -0
  107. package/dist/store.d.ts +2153 -0
  108. package/dist/store.js +1 -0
  109. package/dist/tree-op-types-DWLCllG7.d.ts +1486 -0
  110. package/dist/tree-op-types-UOXlRUqQ.d.cts +1486 -0
  111. package/dist/tree-session-BtVFXsF6.d.ts +580 -0
  112. package/dist/tree-session-DxIOHUOD.d.cts +580 -0
  113. package/dist/tree-store-B1lEkdXc.d.cts +273 -0
  114. package/dist/tree-store-BscFPB7x.d.ts +273 -0
  115. package/package.json +110 -8
  116. package/index.js +0 -1
@@ -0,0 +1,56 @@
1
+ import { O as OoxmlNode, a as OoxmlElement, b as OoxmlContentControlNode, c as OoxmlGenericElementNode, d as OoxmlContentControlContentNode } from './ooxml-tree-BU0e3DVi.cjs';
2
+
3
+ /** Nested content-control wrappers deeper than this stop flattening; content stays preserved. */
4
+ declare const MAX_CONTENT_CONTROL_NESTING = 32;
5
+ type ContentControlLike = OoxmlContentControlNode | OoxmlGenericElementNode;
6
+ type ContentControlContentLike = OoxmlContentControlContentNode | OoxmlGenericElementNode;
7
+ /**
8
+ * Block or inline structured-document-tag wrapper — typed or generic during migration.
9
+ *
10
+ * Generic fallback requires the WordprocessingML namespace so foreign-namespace
11
+ * `<x:sdt>` elements stay opaque wrappers and are never treated as Word controls.
12
+ */
13
+ declare function isContentControl(node: OoxmlNode): node is ContentControlLike;
14
+ /**
15
+ * True when `node` is the control's content container (`w:sdtContent`).
16
+ *
17
+ * Generic `sdtContent` requires the WML namespace — same foreign-namespace rule as
18
+ * {@link isContentControl}.
19
+ */
20
+ declare function isContentControlContent(node: OoxmlNode): node is ContentControlContentLike;
21
+ /** Children of the first `w:sdtContent` under a control, or null when absent or not a control. */
22
+ declare function contentControlContentOf(node: OoxmlNode): readonly OoxmlNode[] | null;
23
+ /**
24
+ * Children of every `w:sdtContent` under a control, in document order.
25
+ *
26
+ * Does not recurse into nested controls — callers that flatten blocks or inline runs do that
27
+ * with their own depth counter against {@link MAX_CONTENT_CONTROL_NESTING}.
28
+ */
29
+ declare function contentControlContentChildren(control: OoxmlNode): readonly OoxmlNode[];
30
+ /**
31
+ * Collect paragraph and table blocks from a sibling list, flattening through content-control
32
+ * wrappers up to {@link MAX_CONTENT_CONTROL_NESTING}.
33
+ *
34
+ * `accept` filters which typed blocks are kept (e.g. skip revision-removed paragraphs). When
35
+ * nesting exceeds the bound the wrapper is skipped entirely — same fail-closed rule as the
36
+ * historical `storyBlocks` walk.
37
+ */
38
+ declare function collectFlowBlocks(children: readonly OoxmlNode[], depth?: number, accept?: (block: OoxmlElement) => boolean): OoxmlElement[];
39
+ /**
40
+ * Story blocks in document order, flattening block-level content controls — same shape as
41
+ * layout's `storyBlocks` and store `bodyBlocks`.
42
+ */
43
+ declare function walkStoryBlocks(children: readonly OoxmlNode[], depth: number, visit: (block: OoxmlElement) => void): void;
44
+ /**
45
+ * Every story paragraph in reading order — body, table cells, and flattened block controls.
46
+ */
47
+ declare function walkAllStoryParagraphs(children: readonly OoxmlNode[], sdtDepth: number, visit: (paragraph: OoxmlElement) => void): void;
48
+ /**
49
+ * Paragraph-level inline sequence — runs, hyperlinks, and inline content controls in order.
50
+ *
51
+ * `visit` receives each direct `w:r` and any other inline node the caller treats as opaque
52
+ * (bookmarks, drawings, …). Hyperlinks and content controls are descended transparently.
53
+ */
54
+ declare function walkParagraphInline(children: readonly OoxmlNode[], depth: number, visit: (child: OoxmlNode) => void): void;
55
+
56
+ export { MAX_CONTENT_CONTROL_NESTING as M, contentControlContentChildren as a, isContentControlContent as b, collectFlowBlocks as c, contentControlContentOf as d, walkParagraphInline as e, walkStoryBlocks as f, isContentControl as i, walkAllStoryParagraphs as w };
@@ -0,0 +1,56 @@
1
+ import { O as OoxmlNode, a as OoxmlElement, b as OoxmlContentControlNode, c as OoxmlGenericElementNode, d as OoxmlContentControlContentNode } from './ooxml-tree-BU0e3DVi.js';
2
+
3
+ /** Nested content-control wrappers deeper than this stop flattening; content stays preserved. */
4
+ declare const MAX_CONTENT_CONTROL_NESTING = 32;
5
+ type ContentControlLike = OoxmlContentControlNode | OoxmlGenericElementNode;
6
+ type ContentControlContentLike = OoxmlContentControlContentNode | OoxmlGenericElementNode;
7
+ /**
8
+ * Block or inline structured-document-tag wrapper — typed or generic during migration.
9
+ *
10
+ * Generic fallback requires the WordprocessingML namespace so foreign-namespace
11
+ * `<x:sdt>` elements stay opaque wrappers and are never treated as Word controls.
12
+ */
13
+ declare function isContentControl(node: OoxmlNode): node is ContentControlLike;
14
+ /**
15
+ * True when `node` is the control's content container (`w:sdtContent`).
16
+ *
17
+ * Generic `sdtContent` requires the WML namespace — same foreign-namespace rule as
18
+ * {@link isContentControl}.
19
+ */
20
+ declare function isContentControlContent(node: OoxmlNode): node is ContentControlContentLike;
21
+ /** Children of the first `w:sdtContent` under a control, or null when absent or not a control. */
22
+ declare function contentControlContentOf(node: OoxmlNode): readonly OoxmlNode[] | null;
23
+ /**
24
+ * Children of every `w:sdtContent` under a control, in document order.
25
+ *
26
+ * Does not recurse into nested controls — callers that flatten blocks or inline runs do that
27
+ * with their own depth counter against {@link MAX_CONTENT_CONTROL_NESTING}.
28
+ */
29
+ declare function contentControlContentChildren(control: OoxmlNode): readonly OoxmlNode[];
30
+ /**
31
+ * Collect paragraph and table blocks from a sibling list, flattening through content-control
32
+ * wrappers up to {@link MAX_CONTENT_CONTROL_NESTING}.
33
+ *
34
+ * `accept` filters which typed blocks are kept (e.g. skip revision-removed paragraphs). When
35
+ * nesting exceeds the bound the wrapper is skipped entirely — same fail-closed rule as the
36
+ * historical `storyBlocks` walk.
37
+ */
38
+ declare function collectFlowBlocks(children: readonly OoxmlNode[], depth?: number, accept?: (block: OoxmlElement) => boolean): OoxmlElement[];
39
+ /**
40
+ * Story blocks in document order, flattening block-level content controls — same shape as
41
+ * layout's `storyBlocks` and store `bodyBlocks`.
42
+ */
43
+ declare function walkStoryBlocks(children: readonly OoxmlNode[], depth: number, visit: (block: OoxmlElement) => void): void;
44
+ /**
45
+ * Every story paragraph in reading order — body, table cells, and flattened block controls.
46
+ */
47
+ declare function walkAllStoryParagraphs(children: readonly OoxmlNode[], sdtDepth: number, visit: (paragraph: OoxmlElement) => void): void;
48
+ /**
49
+ * Paragraph-level inline sequence — runs, hyperlinks, and inline content controls in order.
50
+ *
51
+ * `visit` receives each direct `w:r` and any other inline node the caller treats as opaque
52
+ * (bookmarks, drawings, …). Hyperlinks and content controls are descended transparently.
53
+ */
54
+ declare function walkParagraphInline(children: readonly OoxmlNode[], depth: number, visit: (child: OoxmlNode) => void): void;
55
+
56
+ export { MAX_CONTENT_CONTROL_NESTING as M, contentControlContentChildren as a, isContentControlContent as b, collectFlowBlocks as c, contentControlContentOf as d, walkParagraphInline as e, walkStoryBlocks as f, isContentControl as i, walkAllStoryParagraphs as w };
@@ -0,0 +1 @@
1
+ 'use strict';
@@ -0,0 +1,246 @@
1
+ import { DocxDocument, ExecResult, ContentControlType, DocTarget, RunFormatting, Extent, ContainerRef, ContentControlFilter, DocRange, Revision, DocComment, StyleDefinitions } from './types.cjs';
2
+ export { Block, ColorValue, ContentControl, DocAnchor, DocAnchorRange, DocLocation, DocumentBody, ExecErrorCode, HeaderFooterSet, IndentFormatting, Paragraph, RevisionType, Section, SectionProperties, StyleDefinition, Table, Theme, ThemeColorScheme } from './types.cjs';
3
+
4
+ /**
5
+ * `@docx-editor.dev/core/contracts/document` — the document-level edit and query vocabulary.
6
+ *
7
+ * The subset that means something without a live editor: what an automation host or an LLM tool
8
+ * can ask for and change.
9
+ *
10
+ * A CONTRACT module, not a barrel. `contracts/editor` builds the `Editor` command and query
11
+ * surfaces on top of these, so they cannot live in the package root: the root re-exports
12
+ * runtime from `../editor`, and a contract importing the root would invert the dependency —
13
+ * safe today only because that import is type-only, and one accidental value import away from
14
+ * pulling the painted engine into a server bundle.
15
+ *
16
+ * @packageDocumentation
17
+ * @public
18
+ */
19
+
20
+ /**
21
+ * The document-executable edit vocabulary.
22
+ *
23
+ * An interface rather than a closed union so extensions can widen it by
24
+ * declaration merging. A sealed union cannot be extended by a plugin, and the
25
+ * runtime dispatch is already registry-backed.
26
+ */
27
+ interface DocEdits {
28
+ insertText: {
29
+ target: DocTarget;
30
+ text: string;
31
+ };
32
+ replaceText: {
33
+ target: DocTarget;
34
+ text: string;
35
+ };
36
+ deleteText: {
37
+ target: DocTarget;
38
+ };
39
+ applyFormatting: {
40
+ target: DocTarget;
41
+ marks: RunFormatting;
42
+ };
43
+ setParagraphStyle: {
44
+ target: DocTarget;
45
+ styleId: string;
46
+ };
47
+ insertTable: {
48
+ target: DocTarget;
49
+ rows: number;
50
+ cols: number;
51
+ };
52
+ insertImage: {
53
+ target: DocTarget;
54
+ data: Uint8Array;
55
+ extent?: Extent;
56
+ };
57
+ insertHyperlink: {
58
+ target: DocTarget;
59
+ href: string;
60
+ text?: string;
61
+ };
62
+ removeHyperlink: {
63
+ target: DocTarget;
64
+ };
65
+ insertBreak: {
66
+ target: DocTarget;
67
+ kind: 'page' | 'column' | 'line' | 'section';
68
+ };
69
+ /**
70
+ * Word's Increase/Decrease Indent.
71
+ *
72
+ * A numbered or bulleted paragraph changes LEVEL, so its marker re-resolves from the
73
+ * numbering definition — a bullet becomes a hollow circle, a `1.` becomes an `a.`.
74
+ * Every other paragraph moves its left indent by one default tab stop.
75
+ */
76
+ adjustIndent: {
77
+ target: DocTarget;
78
+ direction: 'increase' | 'decrease';
79
+ };
80
+ /**
81
+ * Word's Bullets and Numbering.
82
+ *
83
+ * Turns the selection into a list, or takes it out of one when it already is. The
84
+ * definition is created on first use, `numbering.xml` included.
85
+ */
86
+ toggleList: {
87
+ target: DocTarget;
88
+ kind: 'bullet' | 'ordered';
89
+ };
90
+ splitParagraph: {
91
+ target: DocTarget;
92
+ };
93
+ mergeParagraphs: {
94
+ target: DocTarget;
95
+ };
96
+ setVariable: {
97
+ name: string;
98
+ value: string;
99
+ };
100
+ applyVariables: {
101
+ values: Record<string, string>;
102
+ };
103
+ /**
104
+ * Authored family. `author` is required: tracked-ness is verb identity, not a
105
+ * boolean flag, so there is no global trackChanges toggle to forget.
106
+ */
107
+ proposeReplacement: {
108
+ target: DocTarget;
109
+ replaceWith: string;
110
+ author: string;
111
+ };
112
+ proposeInsertion: {
113
+ target: DocTarget;
114
+ text: string;
115
+ author: string;
116
+ };
117
+ proposeDeletion: {
118
+ target: DocTarget;
119
+ author: string;
120
+ };
121
+ addComment: {
122
+ target: DocTarget;
123
+ text: string;
124
+ author: string;
125
+ };
126
+ replyComment: {
127
+ commentId: string;
128
+ text: string;
129
+ author: string;
130
+ };
131
+ resolveComment: {
132
+ commentId: string;
133
+ };
134
+ acceptRevision: {
135
+ id: number;
136
+ part?: 'body' | 'footnote' | 'endnote';
137
+ noteId?: number;
138
+ };
139
+ rejectRevision: {
140
+ id: number;
141
+ part?: 'body' | 'footnote' | 'endnote';
142
+ noteId?: number;
143
+ };
144
+ acceptAllRevisions: Record<never, never>;
145
+ rejectAllRevisions: Record<never, never>;
146
+ setContentControlValue: {
147
+ target: DocTarget;
148
+ value: string;
149
+ };
150
+ removeContentControl: {
151
+ target: DocTarget;
152
+ };
153
+ addRepeatingSectionItem: {
154
+ target: DocTarget;
155
+ index?: number;
156
+ };
157
+ removeRepeatingSectionItem: {
158
+ target: DocTarget;
159
+ index: number;
160
+ };
161
+ }
162
+ /**
163
+ * One edit, as a discriminated union derived from {@link DocEdits}.
164
+ *
165
+ * Adding a key to `DocEdits` — including by declaration merging from a plugin — widens this
166
+ * automatically, so the union never drifts from the vocabulary it is built out of.
167
+ */
168
+ type DocEdit = {
169
+ [K in keyof DocEdits]: {
170
+ type: K;
171
+ } & DocEdits[K];
172
+ }[keyof DocEdits];
173
+ /**
174
+ * What applying a batch of edits produced: the new document, and a per-edit verdict.
175
+ *
176
+ * `results` is positionally aligned with the input, so an edit that failed is identified by its
177
+ * index rather than by anything the caller has to correlate.
178
+ */
179
+ interface ApplyResult {
180
+ doc: DocxDocument;
181
+ /** One per edit, positionally aligned with the input. */
182
+ results: ExecResult[];
183
+ }
184
+ /**
185
+ * The document-readable query vocabulary, keyed identically to {@link DocQueryResults}.
186
+ *
187
+ * An interface rather than a closed union for the same reason {@link DocEdits} is: an extension
188
+ * widens it by declaration merging, and the runtime dispatch is registry-backed.
189
+ */
190
+ interface DocQueries {
191
+ paragraphs: {
192
+ container?: ContainerRef;
193
+ };
194
+ findText: {
195
+ text: string;
196
+ container?: ContainerRef;
197
+ };
198
+ contentControls: {
199
+ filter?: ContentControlFilter;
200
+ };
201
+ revisions: {
202
+ part?: 'body' | 'footnote' | 'endnote';
203
+ };
204
+ comments: {
205
+ resolved?: boolean;
206
+ };
207
+ styles: Record<never, never>;
208
+ variables: Record<never, never>;
209
+ }
210
+ /** One query, as a discriminated union derived from {@link DocQueries}. */
211
+ type DocQuery = {
212
+ [K in keyof DocQueries]: {
213
+ type: K;
214
+ } & DocQueries[K];
215
+ }[keyof DocQueries];
216
+ /** What each query returns. Keyed identically to `DocQueries`. */
217
+ interface DocQueryResults {
218
+ paragraphs: readonly ParagraphSummary[];
219
+ findText: readonly DocRange[];
220
+ contentControls: readonly ContentControlSummary[];
221
+ revisions: readonly Revision[];
222
+ comments: readonly DocComment[];
223
+ styles: StyleDefinitions;
224
+ variables: Readonly<Record<string, string>>;
225
+ }
226
+ /**
227
+ * A paragraph reduced to what a listing needs: its stable handle, its text, and its style.
228
+ *
229
+ * `paraId` is what a follow-up edit addresses, so a summary without one names a paragraph the
230
+ * file gave no `w14:paraId` and that a `DocAnchor` cannot reach.
231
+ */
232
+ interface ParagraphSummary {
233
+ readonly paraId?: string;
234
+ readonly text: string;
235
+ readonly styleId?: string;
236
+ }
237
+ /** A content control reduced to what a listing needs: its identity, kind, and lock state. */
238
+ interface ContentControlSummary {
239
+ readonly id: string;
240
+ readonly tag?: string;
241
+ readonly alias?: string;
242
+ readonly controlType: ContentControlType;
243
+ readonly locked?: boolean;
244
+ }
245
+
246
+ export { type ApplyResult, ContainerRef, ContentControlFilter, type ContentControlSummary, ContentControlType, DocComment, type DocEdit, type DocEdits, type DocQueries, type DocQuery, type DocQueryResults, DocRange, DocTarget, DocxDocument, ExecResult, Extent, type ParagraphSummary, Revision, RunFormatting, StyleDefinitions };
@@ -0,0 +1,246 @@
1
+ import { DocxDocument, ExecResult, ContentControlType, DocTarget, RunFormatting, Extent, ContainerRef, ContentControlFilter, DocRange, Revision, DocComment, StyleDefinitions } from './types.js';
2
+ export { Block, ColorValue, ContentControl, DocAnchor, DocAnchorRange, DocLocation, DocumentBody, ExecErrorCode, HeaderFooterSet, IndentFormatting, Paragraph, RevisionType, Section, SectionProperties, StyleDefinition, Table, Theme, ThemeColorScheme } from './types.js';
3
+
4
+ /**
5
+ * `@docx-editor.dev/core/contracts/document` — the document-level edit and query vocabulary.
6
+ *
7
+ * The subset that means something without a live editor: what an automation host or an LLM tool
8
+ * can ask for and change.
9
+ *
10
+ * A CONTRACT module, not a barrel. `contracts/editor` builds the `Editor` command and query
11
+ * surfaces on top of these, so they cannot live in the package root: the root re-exports
12
+ * runtime from `../editor`, and a contract importing the root would invert the dependency —
13
+ * safe today only because that import is type-only, and one accidental value import away from
14
+ * pulling the painted engine into a server bundle.
15
+ *
16
+ * @packageDocumentation
17
+ * @public
18
+ */
19
+
20
+ /**
21
+ * The document-executable edit vocabulary.
22
+ *
23
+ * An interface rather than a closed union so extensions can widen it by
24
+ * declaration merging. A sealed union cannot be extended by a plugin, and the
25
+ * runtime dispatch is already registry-backed.
26
+ */
27
+ interface DocEdits {
28
+ insertText: {
29
+ target: DocTarget;
30
+ text: string;
31
+ };
32
+ replaceText: {
33
+ target: DocTarget;
34
+ text: string;
35
+ };
36
+ deleteText: {
37
+ target: DocTarget;
38
+ };
39
+ applyFormatting: {
40
+ target: DocTarget;
41
+ marks: RunFormatting;
42
+ };
43
+ setParagraphStyle: {
44
+ target: DocTarget;
45
+ styleId: string;
46
+ };
47
+ insertTable: {
48
+ target: DocTarget;
49
+ rows: number;
50
+ cols: number;
51
+ };
52
+ insertImage: {
53
+ target: DocTarget;
54
+ data: Uint8Array;
55
+ extent?: Extent;
56
+ };
57
+ insertHyperlink: {
58
+ target: DocTarget;
59
+ href: string;
60
+ text?: string;
61
+ };
62
+ removeHyperlink: {
63
+ target: DocTarget;
64
+ };
65
+ insertBreak: {
66
+ target: DocTarget;
67
+ kind: 'page' | 'column' | 'line' | 'section';
68
+ };
69
+ /**
70
+ * Word's Increase/Decrease Indent.
71
+ *
72
+ * A numbered or bulleted paragraph changes LEVEL, so its marker re-resolves from the
73
+ * numbering definition — a bullet becomes a hollow circle, a `1.` becomes an `a.`.
74
+ * Every other paragraph moves its left indent by one default tab stop.
75
+ */
76
+ adjustIndent: {
77
+ target: DocTarget;
78
+ direction: 'increase' | 'decrease';
79
+ };
80
+ /**
81
+ * Word's Bullets and Numbering.
82
+ *
83
+ * Turns the selection into a list, or takes it out of one when it already is. The
84
+ * definition is created on first use, `numbering.xml` included.
85
+ */
86
+ toggleList: {
87
+ target: DocTarget;
88
+ kind: 'bullet' | 'ordered';
89
+ };
90
+ splitParagraph: {
91
+ target: DocTarget;
92
+ };
93
+ mergeParagraphs: {
94
+ target: DocTarget;
95
+ };
96
+ setVariable: {
97
+ name: string;
98
+ value: string;
99
+ };
100
+ applyVariables: {
101
+ values: Record<string, string>;
102
+ };
103
+ /**
104
+ * Authored family. `author` is required: tracked-ness is verb identity, not a
105
+ * boolean flag, so there is no global trackChanges toggle to forget.
106
+ */
107
+ proposeReplacement: {
108
+ target: DocTarget;
109
+ replaceWith: string;
110
+ author: string;
111
+ };
112
+ proposeInsertion: {
113
+ target: DocTarget;
114
+ text: string;
115
+ author: string;
116
+ };
117
+ proposeDeletion: {
118
+ target: DocTarget;
119
+ author: string;
120
+ };
121
+ addComment: {
122
+ target: DocTarget;
123
+ text: string;
124
+ author: string;
125
+ };
126
+ replyComment: {
127
+ commentId: string;
128
+ text: string;
129
+ author: string;
130
+ };
131
+ resolveComment: {
132
+ commentId: string;
133
+ };
134
+ acceptRevision: {
135
+ id: number;
136
+ part?: 'body' | 'footnote' | 'endnote';
137
+ noteId?: number;
138
+ };
139
+ rejectRevision: {
140
+ id: number;
141
+ part?: 'body' | 'footnote' | 'endnote';
142
+ noteId?: number;
143
+ };
144
+ acceptAllRevisions: Record<never, never>;
145
+ rejectAllRevisions: Record<never, never>;
146
+ setContentControlValue: {
147
+ target: DocTarget;
148
+ value: string;
149
+ };
150
+ removeContentControl: {
151
+ target: DocTarget;
152
+ };
153
+ addRepeatingSectionItem: {
154
+ target: DocTarget;
155
+ index?: number;
156
+ };
157
+ removeRepeatingSectionItem: {
158
+ target: DocTarget;
159
+ index: number;
160
+ };
161
+ }
162
+ /**
163
+ * One edit, as a discriminated union derived from {@link DocEdits}.
164
+ *
165
+ * Adding a key to `DocEdits` — including by declaration merging from a plugin — widens this
166
+ * automatically, so the union never drifts from the vocabulary it is built out of.
167
+ */
168
+ type DocEdit = {
169
+ [K in keyof DocEdits]: {
170
+ type: K;
171
+ } & DocEdits[K];
172
+ }[keyof DocEdits];
173
+ /**
174
+ * What applying a batch of edits produced: the new document, and a per-edit verdict.
175
+ *
176
+ * `results` is positionally aligned with the input, so an edit that failed is identified by its
177
+ * index rather than by anything the caller has to correlate.
178
+ */
179
+ interface ApplyResult {
180
+ doc: DocxDocument;
181
+ /** One per edit, positionally aligned with the input. */
182
+ results: ExecResult[];
183
+ }
184
+ /**
185
+ * The document-readable query vocabulary, keyed identically to {@link DocQueryResults}.
186
+ *
187
+ * An interface rather than a closed union for the same reason {@link DocEdits} is: an extension
188
+ * widens it by declaration merging, and the runtime dispatch is registry-backed.
189
+ */
190
+ interface DocQueries {
191
+ paragraphs: {
192
+ container?: ContainerRef;
193
+ };
194
+ findText: {
195
+ text: string;
196
+ container?: ContainerRef;
197
+ };
198
+ contentControls: {
199
+ filter?: ContentControlFilter;
200
+ };
201
+ revisions: {
202
+ part?: 'body' | 'footnote' | 'endnote';
203
+ };
204
+ comments: {
205
+ resolved?: boolean;
206
+ };
207
+ styles: Record<never, never>;
208
+ variables: Record<never, never>;
209
+ }
210
+ /** One query, as a discriminated union derived from {@link DocQueries}. */
211
+ type DocQuery = {
212
+ [K in keyof DocQueries]: {
213
+ type: K;
214
+ } & DocQueries[K];
215
+ }[keyof DocQueries];
216
+ /** What each query returns. Keyed identically to `DocQueries`. */
217
+ interface DocQueryResults {
218
+ paragraphs: readonly ParagraphSummary[];
219
+ findText: readonly DocRange[];
220
+ contentControls: readonly ContentControlSummary[];
221
+ revisions: readonly Revision[];
222
+ comments: readonly DocComment[];
223
+ styles: StyleDefinitions;
224
+ variables: Readonly<Record<string, string>>;
225
+ }
226
+ /**
227
+ * A paragraph reduced to what a listing needs: its stable handle, its text, and its style.
228
+ *
229
+ * `paraId` is what a follow-up edit addresses, so a summary without one names a paragraph the
230
+ * file gave no `w14:paraId` and that a `DocAnchor` cannot reach.
231
+ */
232
+ interface ParagraphSummary {
233
+ readonly paraId?: string;
234
+ readonly text: string;
235
+ readonly styleId?: string;
236
+ }
237
+ /** A content control reduced to what a listing needs: its identity, kind, and lock state. */
238
+ interface ContentControlSummary {
239
+ readonly id: string;
240
+ readonly tag?: string;
241
+ readonly alias?: string;
242
+ readonly controlType: ContentControlType;
243
+ readonly locked?: boolean;
244
+ }
245
+
246
+ export { type ApplyResult, ContainerRef, ContentControlFilter, type ContentControlSummary, ContentControlType, DocComment, type DocEdit, type DocEdits, type DocQueries, type DocQuery, type DocQueryResults, DocRange, DocTarget, DocxDocument, ExecResult, Extent, type ParagraphSummary, Revision, RunFormatting, StyleDefinitions };
File without changes
@@ -0,0 +1 @@
1
+ 'use strict';var chunkHBL3NNH5_cjs=require('../chunk-HBL3NNH5.cjs');Object.defineProperty(exports,"EditorFontError",{enumerable:true,get:function(){return chunkHBL3NNH5_cjs.a}});
@@ -0,0 +1,11 @@
1
+ export { ContentControlSummary, DocEdits, DocQueries, DocQueryResults, ParagraphSummary } from './document.cjs';
2
+ export { C as CommentRecord, c as ReviewCommentItem, d as ReviewCustomItem, a as ReviewItem, e as ReviewPosition, f as ReviewRange, b as ReviewRevisionItem, g as ReviewRevisionKind } from '../review-support-D64Wu236.cjs';
3
+ export { A as AuthoredNoteNumbering, C as CanResult, p as DocumentChange, q as DocumentEditingMode, r as DocumentHandle, D as DocumentSource, l as Editor, a as EditorCommand, t as EditorCommandShape, u as EditorCommands, w as EditorError, x as EditorEvents, E as EditorFontError, y as EditorFontErrorCode, z as EditorHeaderFooterCommands, B as EditorNoteCommands, G as EditorPosition, H as EditorQueries, J as EditorQuery, K as EditorQueryResults, L as EditorScope, M as EditorSelection, N as EditorSnapshot, F as FontConfiguration, k as FontFaceRequest, i as FontSource, j as FontSourceSubstitution, O as FurnitureVariant, P as HeaderFooterSlotArgs, Q as HeaderFooterState, R as HyperlinkInfo, I as ImageContext, b as ImageCropPercent, U as InteractionAffinity, W as InteractionOutcome, X as InteractionOutcomeCode, Y as NoteKind, Z as NotePropertiesSide, _ as NotePropertiesState, $ as PageSetup, a0 as ResolvedNoteNumbering, a1 as ReviewCommentPlacement, a2 as ReviewCustomPlacement, a3 as ReviewItemPlacement, a4 as ReviewItemPlacementBase, a5 as ReviewItemQuery, a6 as ReviewRevisionPlacement, S as SelectedImageState, a7 as SemanticIdentity, a8 as SemanticTarget, T as TableBorderEdgeTarget, m as TableBorderSpec, n as TableBorderStyle, a9 as TableBorderTarget, aa as TableCellVerticalAlignment, ab as TableColumnDividerResizeTarget, ac as TableColumnOccurrenceTarget, o as TableContext, ad as TableRightEdgeResizeTarget, ae as TableRowOccurrenceTarget, af as TextMatch, V as ViewScope } from '../editor-B93PggnR.cjs';
4
+ export { S as SemanticPosition, a as SemanticSelection } from '../semantic-interaction-DqcEonqD.cjs';
5
+ export { Block, ColorValue, ContainerRef, ContentControl, ContentControlFilter, ContentControlType, DocAnchor, DocAnchorRange, DocComment, DocLocation, DocRange, DocTarget, DocumentBody, DocxDocument, DocxDocumentJSON, ExecErrorCode, ExecResult, Extent, FontDefinition, HeaderFooterSet, IndentFormatting, NumberingRef, PageMargins, Paragraph, Point, Rect, Revision, RevisionType, Run, RunFormatting, Section, SectionProperties, StyleDefinition, StyleDefinitions, Table, TableCell, TableRow, Theme, ThemeColorScheme, Unsubscribe, Watermark } from './types.cjs';
6
+ export { f as DrawingHorizontalReferenceFrame, c as DrawingKind, e as DrawingLocks, d as DrawingPositionInput, g as DrawingVerticalReferenceFrame, b as ImageWrapTarget, R as RevisionAddress } from '../tree-op-types-UOXlRUqQ.cjs';
7
+ export { I as ImageResourceState, P as PreservedImageMime, R as RenderableImageMime, S as SupportedImageMime, V as ValidatedImageBytesHandle, a as VectorImageMime } from '../image-resources-DwpNnTg3.cjs';
8
+ import '../ooxml-tree-BU0e3DVi.cjs';
9
+ import '../semantic-records-COVFW5aS.cjs';
10
+ import '../revision-projection-72ZApe-g.cjs';
11
+ import '../ooxml-package-CR5us6ad.cjs';
@@ -0,0 +1,11 @@
1
+ export { ContentControlSummary, DocEdits, DocQueries, DocQueryResults, ParagraphSummary } from './document.js';
2
+ export { C as CommentRecord, c as ReviewCommentItem, d as ReviewCustomItem, a as ReviewItem, e as ReviewPosition, f as ReviewRange, b as ReviewRevisionItem, g as ReviewRevisionKind } from '../review-support-nsLXC9jf.js';
3
+ export { A as AuthoredNoteNumbering, C as CanResult, p as DocumentChange, q as DocumentEditingMode, r as DocumentHandle, D as DocumentSource, l as Editor, a as EditorCommand, t as EditorCommandShape, u as EditorCommands, w as EditorError, x as EditorEvents, E as EditorFontError, y as EditorFontErrorCode, z as EditorHeaderFooterCommands, B as EditorNoteCommands, G as EditorPosition, H as EditorQueries, J as EditorQuery, K as EditorQueryResults, L as EditorScope, M as EditorSelection, N as EditorSnapshot, F as FontConfiguration, k as FontFaceRequest, i as FontSource, j as FontSourceSubstitution, O as FurnitureVariant, P as HeaderFooterSlotArgs, Q as HeaderFooterState, R as HyperlinkInfo, I as ImageContext, b as ImageCropPercent, U as InteractionAffinity, W as InteractionOutcome, X as InteractionOutcomeCode, Y as NoteKind, Z as NotePropertiesSide, _ as NotePropertiesState, $ as PageSetup, a0 as ResolvedNoteNumbering, a1 as ReviewCommentPlacement, a2 as ReviewCustomPlacement, a3 as ReviewItemPlacement, a4 as ReviewItemPlacementBase, a5 as ReviewItemQuery, a6 as ReviewRevisionPlacement, S as SelectedImageState, a7 as SemanticIdentity, a8 as SemanticTarget, T as TableBorderEdgeTarget, m as TableBorderSpec, n as TableBorderStyle, a9 as TableBorderTarget, aa as TableCellVerticalAlignment, ab as TableColumnDividerResizeTarget, ac as TableColumnOccurrenceTarget, o as TableContext, ad as TableRightEdgeResizeTarget, ae as TableRowOccurrenceTarget, af as TextMatch, V as ViewScope } from '../editor-CFsSrxGR.js';
4
+ export { S as SemanticPosition, a as SemanticSelection } from '../semantic-interaction-CXH2wFqi.js';
5
+ export { Block, ColorValue, ContainerRef, ContentControl, ContentControlFilter, ContentControlType, DocAnchor, DocAnchorRange, DocComment, DocLocation, DocRange, DocTarget, DocumentBody, DocxDocument, DocxDocumentJSON, ExecErrorCode, ExecResult, Extent, FontDefinition, HeaderFooterSet, IndentFormatting, NumberingRef, PageMargins, Paragraph, Point, Rect, Revision, RevisionType, Run, RunFormatting, Section, SectionProperties, StyleDefinition, StyleDefinitions, Table, TableCell, TableRow, Theme, ThemeColorScheme, Unsubscribe, Watermark } from './types.js';
6
+ export { f as DrawingHorizontalReferenceFrame, c as DrawingKind, e as DrawingLocks, d as DrawingPositionInput, g as DrawingVerticalReferenceFrame, b as ImageWrapTarget, R as RevisionAddress } from '../tree-op-types-DWLCllG7.js';
7
+ export { I as ImageResourceState, P as PreservedImageMime, R as RenderableImageMime, S as SupportedImageMime, V as ValidatedImageBytesHandle, a as VectorImageMime } from '../image-resources-C_YnqPhn.js';
8
+ import '../ooxml-tree-BU0e3DVi.js';
9
+ import '../semantic-records-zTC0_1zi.js';
10
+ import '../revision-projection-DHAkcD_L.js';
11
+ import '../ooxml-package-D_CtywTW.js';
@@ -0,0 +1 @@
1
+ export{a as EditorFontError}from'../chunk-REZUWYB7.js';
@@ -0,0 +1 @@
1
+ 'use strict';
@@ -0,0 +1,11 @@
1
+ export { L as EditorScope, U as InteractionAffinity, W as InteractionOutcome, X as InteractionOutcomeCode, a7 as SemanticIdentity, a8 as SemanticTarget, V as ViewScope } from '../editor-B93PggnR.cjs';
2
+ import './document.cjs';
3
+ import './types.cjs';
4
+ import '../review-support-D64Wu236.cjs';
5
+ import '../ooxml-tree-BU0e3DVi.cjs';
6
+ import '../tree-op-types-UOXlRUqQ.cjs';
7
+ import '../semantic-interaction-DqcEonqD.cjs';
8
+ import '../semantic-records-COVFW5aS.cjs';
9
+ import '../image-resources-DwpNnTg3.cjs';
10
+ import '../ooxml-package-CR5us6ad.cjs';
11
+ import '../revision-projection-72ZApe-g.cjs';
@@ -0,0 +1,11 @@
1
+ export { L as EditorScope, U as InteractionAffinity, W as InteractionOutcome, X as InteractionOutcomeCode, a7 as SemanticIdentity, a8 as SemanticTarget, V as ViewScope } from '../editor-CFsSrxGR.js';
2
+ import './document.js';
3
+ import './types.js';
4
+ import '../review-support-nsLXC9jf.js';
5
+ import '../ooxml-tree-BU0e3DVi.js';
6
+ import '../tree-op-types-DWLCllG7.js';
7
+ import '../semantic-interaction-CXH2wFqi.js';
8
+ import '../semantic-records-zTC0_1zi.js';
9
+ import '../image-resources-C_YnqPhn.js';
10
+ import '../ooxml-package-D_CtywTW.js';
11
+ import '../revision-projection-DHAkcD_L.js';
File without changes