@coco-vexel/coco-office-editor 0.0.0-stage → 1.0.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 (57) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +510 -2
  3. package/THIRD_PARTY_NOTICES.md +212 -0
  4. package/dist/index.cjs +26401 -0
  5. package/dist/index.cjs.map +1 -0
  6. package/dist/index.d.cts +12 -0
  7. package/dist/index.d.ts +12 -0
  8. package/dist/index.js +26192 -0
  9. package/dist/index.js.map +1 -0
  10. package/dist/model-DB6aN6uJ.d.cts +321 -0
  11. package/dist/model-DB6aN6uJ.d.ts +321 -0
  12. package/dist/native-B6B649CC.d.ts +1111 -0
  13. package/dist/native-Ct9nN06K.d.cts +1111 -0
  14. package/dist/ppt-native.cjs +5334 -0
  15. package/dist/ppt-native.cjs.map +1 -0
  16. package/dist/ppt-native.d.cts +2 -0
  17. package/dist/ppt-native.d.ts +2 -0
  18. package/dist/ppt-native.js +5332 -0
  19. package/dist/ppt-native.js.map +1 -0
  20. package/dist/ppt.cjs +5426 -0
  21. package/dist/ppt.cjs.map +1 -0
  22. package/dist/ppt.d.cts +306 -0
  23. package/dist/ppt.d.ts +306 -0
  24. package/dist/ppt.js +5410 -0
  25. package/dist/ppt.js.map +1 -0
  26. package/dist/spreadsheet.cjs +4276 -0
  27. package/dist/spreadsheet.cjs.map +1 -0
  28. package/dist/spreadsheet.d.cts +676 -0
  29. package/dist/spreadsheet.d.ts +676 -0
  30. package/dist/spreadsheet.js +4213 -0
  31. package/dist/spreadsheet.js.map +1 -0
  32. package/dist/word-editing.cjs +812 -0
  33. package/dist/word-editing.cjs.map +1 -0
  34. package/dist/word-editing.d.cts +149 -0
  35. package/dist/word-editing.d.ts +149 -0
  36. package/dist/word-editing.js +803 -0
  37. package/dist/word-editing.js.map +1 -0
  38. package/dist/word-native.cjs +13400 -0
  39. package/dist/word-native.cjs.map +1 -0
  40. package/dist/word-native.d.cts +4 -0
  41. package/dist/word-native.d.ts +4 -0
  42. package/dist/word-native.js +13293 -0
  43. package/dist/word-native.js.map +1 -0
  44. package/dist/word-prosemirror.cjs +489 -0
  45. package/dist/word-prosemirror.cjs.map +1 -0
  46. package/dist/word-prosemirror.d.cts +21 -0
  47. package/dist/word-prosemirror.d.ts +21 -0
  48. package/dist/word-prosemirror.js +483 -0
  49. package/dist/word-prosemirror.js.map +1 -0
  50. package/dist/word.cjs +16764 -0
  51. package/dist/word.cjs.map +1 -0
  52. package/dist/word.d.cts +84 -0
  53. package/dist/word.d.ts +84 -0
  54. package/dist/word.js +16632 -0
  55. package/dist/word.js.map +1 -0
  56. package/package.json +106 -3
  57. package/src/styles/editor.css +1507 -0
@@ -0,0 +1,1111 @@
1
+ import { p as EditorParagraphFormat, v as EditorRunFormat, t as EditorRevisionSegment, j as EditorHyperlink, k as EditorImageSegment, f as EditorDrawingSegment, g as EditorFieldSegment, I as EditorTableView, C as EditorTableBorders, D as EditorTableCellView, d as EditorDocumentDefaults, m as EditorPageLayout, e as EditorDocumentView, i as EditorHeaderFooterStoryView, l as EditorNumberingFormat } from './model-DB6aN6uJ.cjs';
2
+ import { Package } from '@coco-vexel/coco-office/pack';
3
+ import { PackageIndices } from '@coco-vexel/coco-office/word-view';
4
+
5
+ interface NativeWordTextNode {
6
+ kind: 'text';
7
+ text: string;
8
+ format: EditorRunFormat | null;
9
+ marks?: NativeWordTextMark[];
10
+ formatRevision?: NativeWordFormatRevisionMark;
11
+ hyperlink?: EditorHyperlink;
12
+ }
13
+ type NativeWordTextMark = NativeWordCommentMark | NativeWordRevisionMark;
14
+ interface NativeWordFormatRevisionMark {
15
+ kind: 'format';
16
+ revisionId: string;
17
+ beforeFormat: EditorRunFormat | null;
18
+ author?: string;
19
+ date?: string;
20
+ }
21
+ interface NativeWordCommentMark {
22
+ kind: 'comment';
23
+ id: string;
24
+ commentId: number;
25
+ parentCommentId?: number;
26
+ author: string;
27
+ date: string;
28
+ body: string;
29
+ }
30
+ interface NativeWordRevisionMark {
31
+ kind: 'revision';
32
+ id: string;
33
+ revisionId: string;
34
+ revisionKind: EditorRevisionSegment['revisionKind'];
35
+ author?: string;
36
+ date?: string;
37
+ }
38
+ interface NativeWordImageNode {
39
+ kind: 'image';
40
+ drawingId: string;
41
+ src: string;
42
+ revision?: NativeWordRevisionMark;
43
+ formatRevision?: {
44
+ kind: 'format';
45
+ revisionId: string;
46
+ beforeWidth?: number;
47
+ beforeHeight?: number;
48
+ afterWidth?: number;
49
+ afterHeight?: number;
50
+ author?: string;
51
+ date?: string;
52
+ };
53
+ width?: number;
54
+ height?: number;
55
+ anchoringMode?: EditorImageSegment['anchoringMode'];
56
+ wrap?: EditorImageSegment['wrap'];
57
+ position?: EditorImageSegment['position'];
58
+ }
59
+ interface NativeWordDrawingNode {
60
+ kind: 'drawing';
61
+ drawingId: string;
62
+ drawingKind: EditorDrawingSegment['drawingKind'];
63
+ text?: string;
64
+ width?: number;
65
+ height?: number;
66
+ anchoringMode?: EditorDrawingSegment['anchoringMode'];
67
+ wrap?: EditorDrawingSegment['wrap'];
68
+ position?: EditorDrawingSegment['position'];
69
+ hasBorder?: boolean;
70
+ hasFill?: boolean;
71
+ isLineOrConnector?: boolean;
72
+ innerTextAlign?: string;
73
+ paragraphs?: NativeWordParagraphNode[];
74
+ }
75
+ interface NativeWordPageBreakNode {
76
+ kind: 'pageBreak';
77
+ }
78
+ interface NativeWordFieldNode {
79
+ kind: 'field';
80
+ fieldKind: EditorFieldSegment['fieldKind'];
81
+ instruction: string;
82
+ cachedText?: string;
83
+ format: EditorRunFormat | null;
84
+ }
85
+ type NativeWordInlineNode = NativeWordTextNode | NativeWordImageNode | NativeWordDrawingNode | NativeWordFieldNode | NativeWordPageBreakNode;
86
+ interface NativeWordParagraphNode {
87
+ kind: 'paragraph';
88
+ paraId: string;
89
+ story: string;
90
+ styleId: string | null;
91
+ format: EditorParagraphFormat | null;
92
+ content: NativeWordInlineNode[];
93
+ }
94
+ interface NativeWordTableNode {
95
+ kind: 'table';
96
+ tableId: string;
97
+ revision?: NativeWordRevisionMark;
98
+ tableStyleId?: string;
99
+ columnWidths: number[];
100
+ layout?: EditorTableView['layout'];
101
+ borders?: EditorTableBorders;
102
+ rows: NativeWordTableRowNode[];
103
+ }
104
+ interface NativeWordTableRowNode {
105
+ height?: {
106
+ val: number;
107
+ hRule: 'auto' | 'atLeast' | 'exact';
108
+ };
109
+ isHeader?: boolean;
110
+ cantSplit?: boolean;
111
+ cells: NativeWordTableCellNode[];
112
+ }
113
+ interface NativeWordTableCellNode {
114
+ blocks: NativeWordBlockNode[];
115
+ paragraphs: NativeWordParagraphNode[];
116
+ gridSpan: number;
117
+ rowSpan?: number;
118
+ vMerge?: EditorTableCellView['vMerge'];
119
+ width?: number;
120
+ margin?: EditorTableCellView['margin'];
121
+ borders?: EditorTableCellView['borders'];
122
+ shading?: EditorTableCellView['shading'];
123
+ verticalAlignment?: EditorTableCellView['verticalAlignment'];
124
+ noWrap?: EditorTableCellView['noWrap'];
125
+ }
126
+ type NativeWordBlockNode = NativeWordParagraphNode | NativeWordTableNode;
127
+ interface NativeWordDocument {
128
+ kind: 'word';
129
+ defaults?: EditorDocumentDefaults;
130
+ pageLayout?: EditorPageLayout;
131
+ sections: EditorDocumentView['sections'];
132
+ headers: NativeWordHeaderFooterStory[];
133
+ footers: NativeWordHeaderFooterStory[];
134
+ blocks: NativeWordBlockNode[];
135
+ }
136
+ interface NativeWordHeaderFooterStory {
137
+ kind: EditorHeaderFooterStoryView['kind'];
138
+ partName: string;
139
+ blocks: NativeWordBlockNode[];
140
+ }
141
+ interface NativeParagraphLocation {
142
+ paragraph: NativeWordParagraphNode;
143
+ previous: NativeWordParagraphNode | null;
144
+ container: NativeWordBlockNode[];
145
+ index: number;
146
+ insertAfter(paragraph: NativeWordParagraphNode): void;
147
+ remove(): void;
148
+ }
149
+ interface NativeTableCellLocation {
150
+ table: NativeWordTableNode;
151
+ container: NativeWordBlockNode[];
152
+ tableIndex: number;
153
+ row: NativeWordTableRowNode;
154
+ rowIndex: number;
155
+ cell: NativeWordTableCellNode;
156
+ cellIndex: number;
157
+ columnIndex: number;
158
+ }
159
+ interface NativeTableLocation {
160
+ table: NativeWordTableNode;
161
+ container: NativeWordBlockNode[];
162
+ tableIndex: number;
163
+ }
164
+ declare function createNativeWordDocument(view: EditorDocumentView): NativeWordDocument;
165
+ declare function findNativeParagraph(doc: NativeWordDocument, paraId: string): NativeWordParagraphNode | null;
166
+ declare function previousNativeParagraphId(doc: NativeWordDocument, paraId: string): string | null;
167
+ declare function findNativeParagraphLocation(doc: NativeWordDocument, paraId: string): NativeParagraphLocation | null;
168
+ declare function findNativeTableCellLocation(doc: NativeWordDocument, paraId: string): NativeTableCellLocation | null;
169
+ declare function findNativeTableLocation(doc: NativeWordDocument, tableId: string): NativeTableLocation | null;
170
+ declare function allNativeParagraphs(doc: NativeWordDocument): NativeWordParagraphNode[];
171
+ declare function nativeParagraphText(paragraph: NativeWordParagraphNode): string;
172
+ declare function createNativeParaId(doc: NativeWordDocument): string;
173
+
174
+ type NativeWordChange = {
175
+ kind: 'text';
176
+ op: 'insert' | 'delete' | 'replace';
177
+ paraId: string;
178
+ offset: number;
179
+ text: string;
180
+ deletedText?: string;
181
+ } | {
182
+ kind: 'block';
183
+ op: 'split' | 'merge';
184
+ paraId: string;
185
+ newParaId?: string;
186
+ offset?: number;
187
+ } | {
188
+ kind: 'structure';
189
+ op: 'delete-range';
190
+ startParaId: string;
191
+ endParaId: string;
192
+ deletedBlockIds: string[];
193
+ } | {
194
+ kind: 'structure';
195
+ op: 'insert-range';
196
+ paraId: string;
197
+ insertedBlockIds: string[];
198
+ } | {
199
+ kind: 'image';
200
+ op: 'insert' | 'delete' | 'resize' | 'accept' | 'reject';
201
+ paraId: string;
202
+ offset: number;
203
+ drawingId: string;
204
+ src?: string;
205
+ width?: number;
206
+ height?: number;
207
+ revisionId?: string;
208
+ revisionKind?: 'insert' | 'delete' | 'format';
209
+ } | {
210
+ kind: 'format';
211
+ op: 'run' | 'accept' | 'reject';
212
+ paraId: string;
213
+ from: number;
214
+ to: number;
215
+ format: Partial<EditorRunFormat>;
216
+ clear?: boolean;
217
+ revisionId?: string;
218
+ revisionKind?: 'format';
219
+ beforeFormat?: Partial<EditorRunFormat> | null;
220
+ } | {
221
+ kind: 'format';
222
+ op: 'paragraph';
223
+ paraId: string;
224
+ format: Partial<EditorParagraphFormat>;
225
+ } | {
226
+ kind: 'list';
227
+ paraId: string;
228
+ numbering: EditorNumberingFormat | null;
229
+ } | {
230
+ kind: 'hyperlink';
231
+ op: 'set' | 'remove';
232
+ paraId: string;
233
+ from: number;
234
+ to: number;
235
+ hyperlink?: EditorHyperlink;
236
+ } | {
237
+ kind: 'annotation';
238
+ op: 'insert' | 'delete' | 'update';
239
+ paraId: string;
240
+ from: number;
241
+ to: number;
242
+ commentId: number;
243
+ body?: string;
244
+ parentCommentId?: number;
245
+ } | {
246
+ kind: 'revision';
247
+ op: 'insert' | 'delete' | 'accept' | 'reject';
248
+ paraId: string;
249
+ from: number;
250
+ to: number;
251
+ revisionId: string;
252
+ revisionKind: 'insert' | 'delete';
253
+ } | {
254
+ kind: 'page-break';
255
+ op: 'insert' | 'delete';
256
+ paraId: string;
257
+ offset: number;
258
+ } | {
259
+ kind: 'table';
260
+ op: 'insert-table' | 'delete-table' | 'insert-row' | 'delete-row' | 'insert-column' | 'delete-column' | 'merge-cells' | 'split-cell' | 'format-cell' | 'clear-cell' | 'replace-cell';
261
+ tableId: string;
262
+ rowIndex: number;
263
+ columnIndex: number;
264
+ endColumnIndex?: number;
265
+ endRowIndex?: number;
266
+ format?: {
267
+ backgroundColor?: string | null;
268
+ verticalAlignment?: NativeWordTableCellNode['verticalAlignment'] | null;
269
+ borderColor?: string | null;
270
+ };
271
+ text?: string;
272
+ cellSnapshot?: NativeWordTableCellNode;
273
+ revisionId?: string;
274
+ revisionKind?: 'insert' | 'delete';
275
+ revisionAction?: 'accept' | 'reject';
276
+ beforeTable?: NativeWordTableNode;
277
+ anchorParaId?: string;
278
+ anchorOffset?: number;
279
+ tableSnapshot?: NativeWordTableNode;
280
+ };
281
+ interface NativePlainTextReplacement {
282
+ changes: NativeWordChange[];
283
+ cursor: {
284
+ paraId: string;
285
+ offset: number;
286
+ };
287
+ paragraphIds: string[];
288
+ }
289
+ interface NativeBlockRangeReplacement {
290
+ changes: NativeWordChange[];
291
+ cursor: {
292
+ paraId: string;
293
+ offset: number;
294
+ };
295
+ container: NativeWordBlockNode[];
296
+ startIndex: number;
297
+ beforeBlocks: NativeWordBlockNode[];
298
+ afterBlocks: NativeWordBlockNode[];
299
+ }
300
+ interface NativeTableEditResult {
301
+ change: NativeWordChange;
302
+ cursor: {
303
+ paraId: string;
304
+ offset: number;
305
+ };
306
+ }
307
+ interface NativeTableCellPoint {
308
+ rowIndex: number;
309
+ columnIndex: number;
310
+ }
311
+ interface NativeTableCellRange {
312
+ anchor: NativeTableCellPoint;
313
+ focus: NativeTableCellPoint;
314
+ }
315
+ interface NativeTableRangeEditResult {
316
+ changes: NativeWordChange[];
317
+ cursor: {
318
+ paraId: string;
319
+ offset: number;
320
+ };
321
+ }
322
+ interface NativeTableClipboardCell {
323
+ blocks: NativeWordBlockNode[];
324
+ format: {
325
+ margin?: NativeWordTableCellNode['margin'];
326
+ borders?: NativeWordTableCellNode['borders'];
327
+ shading?: NativeWordTableCellNode['shading'];
328
+ verticalAlignment?: NativeWordTableCellNode['verticalAlignment'];
329
+ noWrap?: NativeWordTableCellNode['noWrap'];
330
+ };
331
+ }
332
+ type NativeTableStructureOperation = {
333
+ kind: 'insert-row';
334
+ position: 'before' | 'after';
335
+ } | {
336
+ kind: 'delete-row';
337
+ } | {
338
+ kind: 'insert-column';
339
+ position: 'before' | 'after';
340
+ } | {
341
+ kind: 'delete-column';
342
+ };
343
+ interface NativeTableCellFormatPatch {
344
+ backgroundColor?: string | null;
345
+ verticalAlignment?: NativeWordTableCellNode['verticalAlignment'] | null;
346
+ borderColor?: string | null;
347
+ }
348
+ declare function cloneNativeWordBlocks(blocks: readonly NativeWordBlockNode[]): NativeWordBlockNode[];
349
+ declare function nativeTableSupportsStructuralEditing(table: NativeWordTableNode): boolean;
350
+ declare function nativeInsertTable(doc: NativeWordDocument, paraId: string, offset: number, rowCount: number, columnCount: number, createParaId?: () => string, createTableId?: () => string): NativeBlockRangeReplacement | null;
351
+ declare function nativeDeleteTable(doc: NativeWordDocument, tableId: string, createParaId?: () => string): NativeBlockRangeReplacement | null;
352
+ declare function nativeEditTableStructure(doc: NativeWordDocument, paraId: string, operation: NativeTableStructureOperation, createParaId?: () => string): NativeTableEditResult | null;
353
+ declare function nativeSetTableCellFormat(doc: NativeWordDocument, paraId: string, patch: NativeTableCellFormatPatch): NativeTableEditResult | null;
354
+ declare function nativeTableCellsInRange(table: NativeWordTableNode, range: NativeTableCellRange): Array<{
355
+ cell: NativeWordTableCellNode;
356
+ rowIndex: number;
357
+ columnIndex: number;
358
+ }>;
359
+ declare function nativeMergeTableCells(doc: NativeWordDocument, tableId: string, range: NativeTableCellRange): {
360
+ change: NativeWordChange;
361
+ cursor: {
362
+ paraId: string;
363
+ offset: number;
364
+ };
365
+ } | null;
366
+ declare function nativeSplitTableCell(doc: NativeWordDocument, tableId: string, rowIndex: number, columnIndex: number, createParaId?: () => string): {
367
+ change: NativeWordChange;
368
+ cursor: {
369
+ paraId: string;
370
+ offset: number;
371
+ };
372
+ } | null;
373
+ declare function nativeSetTableCellRangeFormat(doc: NativeWordDocument, tableId: string, range: NativeTableCellRange, patch: NativeTableCellFormatPatch): NativeTableRangeEditResult | null;
374
+ declare function nativeClearTableCellRange(doc: NativeWordDocument, tableId: string, range: NativeTableCellRange): NativeTableRangeEditResult | null;
375
+ declare function nativeReplaceTableCellRangeText(doc: NativeWordDocument, tableId: string, anchor: NativeTableCellPoint, values: readonly (readonly string[])[]): NativeTableRangeEditResult | null;
376
+ declare function nativeReplaceTableCellRangeContent(doc: NativeWordDocument, tableId: string, anchor: NativeTableCellPoint, values: readonly (readonly (NativeTableClipboardCell | null)[])[]): NativeTableRangeEditResult | null;
377
+ declare function nativeInsertText(doc: NativeWordDocument, paraId: string, offset: number, text: string): NativeWordChange | null;
378
+ declare function nativeInsertImage(doc: NativeWordDocument, paraId: string, offset: number, src: string, options?: {
379
+ drawingId?: string;
380
+ width?: number;
381
+ height?: number;
382
+ }): NativeWordChange | null;
383
+ declare function nativeInsertPageBreak(doc: NativeWordDocument, paraId: string, offset: number): NativeWordChange | null;
384
+ declare function nativePageBreakAt(doc: NativeWordDocument, paraId: string, offset: number): boolean;
385
+ declare function nativeRangeContainsPageBreak(doc: NativeWordDocument, paraId: string, from: number, to: number): boolean;
386
+ declare function nativeSetImageSize(doc: NativeWordDocument, paraId: string, drawingId: string, size: {
387
+ width: number;
388
+ height: number;
389
+ }): NativeWordChange | null;
390
+ declare function nativeDeleteBackward(doc: NativeWordDocument, paraId: string, offset: number): NativeWordChange | null;
391
+ declare function nativeDeleteForward(doc: NativeWordDocument, paraId: string, offset: number): NativeWordChange | null;
392
+ declare function nativeDeleteRange(doc: NativeWordDocument, paraId: string, from: number, to: number): NativeWordChange[];
393
+ declare function nativeDeleteTextRangeAcrossParagraphs(doc: NativeWordDocument, anchor: {
394
+ paraId: string;
395
+ offset: number;
396
+ }, focus: {
397
+ paraId: string;
398
+ offset: number;
399
+ }): NativeWordChange[];
400
+ declare function nativeReplaceBlockRangeAcrossParagraphs(doc: NativeWordDocument, anchor: {
401
+ paraId: string;
402
+ offset: number;
403
+ }, focus: {
404
+ paraId: string;
405
+ offset: number;
406
+ }, text: string): NativeBlockRangeReplacement | null;
407
+ declare function nativeCopyBlockRange(doc: NativeWordDocument, anchor: {
408
+ paraId: string;
409
+ offset: number;
410
+ }, focus: {
411
+ paraId: string;
412
+ offset: number;
413
+ }): NativeWordBlockNode[] | null;
414
+ declare function nativeReplaceRangeWithBlocks(doc: NativeWordDocument, anchor: {
415
+ paraId: string;
416
+ offset: number;
417
+ }, focus: {
418
+ paraId: string;
419
+ offset: number;
420
+ }, clipboardBlocks: readonly NativeWordBlockNode[]): NativeBlockRangeReplacement | null;
421
+ declare function nativeReplaceRange(doc: NativeWordDocument, paraId: string, from: number, to: number, text: string): NativeWordChange[];
422
+ declare function nativeReplaceTextRangeAcrossParagraphs(doc: NativeWordDocument, anchor: {
423
+ paraId: string;
424
+ offset: number;
425
+ }, focus: {
426
+ paraId: string;
427
+ offset: number;
428
+ }, text: string): NativeWordChange[];
429
+ declare function nativeReplaceTextRangeWithParagraphs(doc: NativeWordDocument, anchor: {
430
+ paraId: string;
431
+ offset: number;
432
+ }, focus: {
433
+ paraId: string;
434
+ offset: number;
435
+ }, text: string): NativePlainTextReplacement | null;
436
+ declare function nativeSetRunFormat(doc: NativeWordDocument, paraId: string, from: number, to: number, format: Partial<EditorRunFormat>): NativeWordChange | null;
437
+ declare function nativeAddComment(doc: NativeWordDocument, paraId: string, from: number, to: number, comment: {
438
+ commentId: number;
439
+ author: string;
440
+ date: string;
441
+ body: string;
442
+ parentCommentId?: number;
443
+ preserveExistingComments?: boolean;
444
+ }): NativeWordChange | null;
445
+ declare function nativeUpdateComment(doc: NativeWordDocument, commentId: number, body: string): NativeWordChange[];
446
+ declare function nativeDeleteComment(doc: NativeWordDocument, commentId: number): NativeWordChange[];
447
+ declare function nativeAddRevision(doc: NativeWordDocument, paraId: string, from: number, to: number, revision: {
448
+ revisionId: string;
449
+ revisionKind: 'insert' | 'delete';
450
+ author: string;
451
+ date: string;
452
+ }): NativeWordChange | null;
453
+ declare function nativeResolveRevision(doc: NativeWordDocument, paraId: string, from: number, to: number, operation: 'accept' | 'reject'): NativeWordChange | null;
454
+ declare function nativeResolveFormatRevision(doc: NativeWordDocument, paraId: string, from: number, to: number, operation: 'accept' | 'reject'): NativeWordChange | null;
455
+ declare function nativeSetHyperlink(doc: NativeWordDocument, paraId: string, from: number, to: number, hyperlink: EditorHyperlink | null): NativeWordChange | null;
456
+ declare function nativeSetParagraphFormat(doc: NativeWordDocument, paraId: string, format: Partial<EditorParagraphFormat>): NativeWordChange | null;
457
+ declare function nativeClearRunFormat(doc: NativeWordDocument, paraId: string, from: number, to: number): NativeWordChange | null;
458
+ declare function nativeSetParagraphList(doc: NativeWordDocument, paraId: string, numbering: EditorNumberingFormat | null): NativeWordChange | null;
459
+ declare function nativeTextRangeIsBold(doc: NativeWordDocument, paraId: string, from: number, to: number): boolean;
460
+ declare function nativeDeleteImage(doc: NativeWordDocument, paraId: string, drawingId: string): NativeWordChange | null;
461
+ declare function nativeAddFormatRevision(doc: NativeWordDocument, paraId: string, from: number, to: number, beforeParagraph: NativeWordParagraphNode, revision: {
462
+ revisionId: string;
463
+ author?: string;
464
+ date?: string;
465
+ }): NativeWordChange | null;
466
+ declare function nativeResolveImageRevision(doc: NativeWordDocument, paraId: string, drawingId: string, operation: 'accept' | 'reject'): NativeWordChange | null;
467
+ declare function nativeResolveImageFormatRevision(doc: NativeWordDocument, paraId: string, drawingId: string, operation: 'accept' | 'reject'): NativeWordChange | null;
468
+ declare function nativeSplitParagraph(doc: NativeWordDocument, paraId: string, offset: number, newParaId?: string): NativeWordChange | null;
469
+ declare function nativeSyncParagraphText(doc: NativeWordDocument, paraId: string, nextText: string): NativeWordChange | null;
470
+
471
+ type WordEditorEngineKind = 'native-word';
472
+ type WordEditorSelection = {
473
+ kind: 'caret';
474
+ paraId: string;
475
+ offset: number;
476
+ } | {
477
+ kind: 'text-range';
478
+ anchor: WordEditorSelectionPoint;
479
+ focus: WordEditorSelectionPoint;
480
+ } | {
481
+ kind: 'object';
482
+ paraId: string;
483
+ objectKind: 'image';
484
+ objectId: string;
485
+ offset: number;
486
+ } | {
487
+ kind: 'table-cell-range';
488
+ tableId: string;
489
+ anchor: WordEditorTableCellPoint;
490
+ focus: WordEditorTableCellPoint;
491
+ };
492
+ interface WordEditorSelectionPoint {
493
+ paraId: string;
494
+ offset: number;
495
+ }
496
+ interface WordEditorTableCellPoint {
497
+ rowIndex: number;
498
+ columnIndex: number;
499
+ }
500
+ interface WordEditorSearchOptions {
501
+ query: string;
502
+ matchCase?: boolean;
503
+ wholeWord?: boolean;
504
+ }
505
+ interface WordEditorSearchMatch {
506
+ id: string;
507
+ paraId: string;
508
+ from: number;
509
+ to: number;
510
+ text: string;
511
+ }
512
+ interface WordEditorSearchState {
513
+ options: WordEditorSearchOptions;
514
+ matches: readonly WordEditorSearchMatch[];
515
+ activeIndex: number;
516
+ }
517
+ interface WordEditorHyperlink {
518
+ target?: string;
519
+ anchor?: string;
520
+ tooltip?: string;
521
+ }
522
+ type WordEditorFormatValue<T> = T | 'mixed' | null;
523
+ interface WordEditorLineSpacingState {
524
+ line: number;
525
+ lineRule: 'auto' | 'exact' | 'atLeast';
526
+ }
527
+ interface WordEditorCommandState {
528
+ selectionKind: WordEditorSelection['kind'] | null;
529
+ trackRevisions: boolean;
530
+ bold: boolean | 'mixed';
531
+ italic: boolean | 'mixed';
532
+ underline: boolean | 'mixed';
533
+ strike: boolean | 'mixed';
534
+ fontFamily: WordEditorFormatValue<string>;
535
+ fontSize: WordEditorFormatValue<number>;
536
+ textColor: WordEditorFormatValue<string>;
537
+ highlightColor: WordEditorFormatValue<string>;
538
+ hyperlink: WordEditorFormatValue<WordEditorHyperlink>;
539
+ paragraphAlignment: WordEditorFormatValue<'left' | 'center' | 'right' | 'both'>;
540
+ leftIndent: number | 'mixed';
541
+ rightIndent: number | 'mixed';
542
+ firstLineIndent: number | 'mixed';
543
+ spacingBefore: number | 'mixed';
544
+ spacingAfter: number | 'mixed';
545
+ lineSpacing: WordEditorFormatValue<WordEditorLineSpacingState>;
546
+ listType: WordEditorFormatValue<'bullet' | 'numbered'>;
547
+ listLevel: WordEditorFormatValue<number>;
548
+ image: WordEditorImageState | null;
549
+ table: WordEditorTableState | null;
550
+ }
551
+ interface WordEditorImageState {
552
+ objectId: string;
553
+ width: number | null;
554
+ height: number | null;
555
+ alignment: 'left' | 'center' | 'right' | 'both' | null;
556
+ }
557
+ interface WordEditorImageInsertOptions {
558
+ width?: number;
559
+ height?: number;
560
+ }
561
+ interface WordEditorTableState {
562
+ tableId: string;
563
+ rowIndex: number;
564
+ rowCount: number;
565
+ columnIndex: number;
566
+ columnCount: number;
567
+ range: {
568
+ startRow: number;
569
+ endRow: number;
570
+ startColumn: number;
571
+ endColumn: number;
572
+ cellCount: number;
573
+ } | null;
574
+ structuralEditingSupported: boolean;
575
+ backgroundColor: WordEditorFormatValue<string>;
576
+ verticalAlignment: WordEditorFormatValue<'top' | 'center' | 'bottom' | 'both'>;
577
+ borderColor: WordEditorFormatValue<string>;
578
+ bordersVisible: boolean | 'mixed';
579
+ }
580
+ type WordEditorRuntimeEvent = 'change' | 'selectionChange';
581
+ interface WordEditorChangeEvent {
582
+ readonly revision: number;
583
+ readonly changes: readonly NativeWordChange[];
584
+ readonly revertedChanges: readonly NativeWordChange[];
585
+ readonly totalChangeCount: number;
586
+ }
587
+ interface WordEditorSelectionChangeEvent {
588
+ readonly selection: WordEditorSelection | null;
589
+ readonly commandState: WordEditorCommandState;
590
+ }
591
+ interface WordEditorRuntimeEventMap {
592
+ change: WordEditorChangeEvent;
593
+ selectionChange: WordEditorSelectionChangeEvent;
594
+ }
595
+ type WordEditorCommand = {
596
+ kind: 'insert-text';
597
+ text: string;
598
+ } | {
599
+ kind: 'delete-backward';
600
+ } | {
601
+ kind: 'delete-forward';
602
+ } | {
603
+ kind: 'delete-range';
604
+ anchor: WordEditorSelectionPoint;
605
+ focus: WordEditorSelectionPoint;
606
+ } | {
607
+ kind: 'replace-range';
608
+ anchor: WordEditorSelectionPoint;
609
+ focus: WordEditorSelectionPoint;
610
+ text: string;
611
+ } | {
612
+ kind: 'split-paragraph';
613
+ } | {
614
+ kind: 'insert-page-break';
615
+ } | {
616
+ kind: 'delete-object';
617
+ objectKind: 'image';
618
+ objectId: string;
619
+ } | {
620
+ kind: 'insert-image';
621
+ src: string;
622
+ width?: number;
623
+ height?: number;
624
+ } | {
625
+ kind: 'set-image-size';
626
+ objectId: string;
627
+ width: number;
628
+ height: number;
629
+ } | {
630
+ kind: 'set-image-alignment';
631
+ objectId: string;
632
+ alignment: 'left' | 'center' | 'right';
633
+ } | {
634
+ kind: 'insert-table-row';
635
+ position: 'before' | 'after';
636
+ } | {
637
+ kind: 'insert-table';
638
+ rows: number;
639
+ columns: number;
640
+ } | {
641
+ kind: 'delete-table';
642
+ } | {
643
+ kind: 'delete-table-row';
644
+ } | {
645
+ kind: 'insert-table-column';
646
+ position: 'before' | 'after';
647
+ } | {
648
+ kind: 'delete-table-column';
649
+ } | {
650
+ kind: 'merge-table-cells';
651
+ } | {
652
+ kind: 'split-table-cell';
653
+ } | {
654
+ kind: 'set-table-cell-background';
655
+ color: string | null;
656
+ } | {
657
+ kind: 'set-table-cell-vertical-alignment';
658
+ alignment: 'top' | 'center' | 'bottom' | null;
659
+ } | {
660
+ kind: 'set-table-cell-borders';
661
+ color: string | null;
662
+ } | {
663
+ kind: 'clear-table-cells';
664
+ } | {
665
+ kind: 'set-hyperlink';
666
+ hyperlink: WordEditorHyperlink;
667
+ } | {
668
+ kind: 'remove-hyperlink';
669
+ } | {
670
+ kind: 'add-comment';
671
+ body: string;
672
+ author?: string;
673
+ date?: string;
674
+ } | {
675
+ kind: 'edit-comment';
676
+ commentId: number;
677
+ body: string;
678
+ } | {
679
+ kind: 'delete-comment';
680
+ commentId: number;
681
+ } | {
682
+ kind: 'reply-comment';
683
+ commentId: number;
684
+ body: string;
685
+ } | {
686
+ kind: 'add-revision';
687
+ revisionKind: 'insert' | 'delete';
688
+ author?: string;
689
+ date?: string;
690
+ } | {
691
+ kind: 'toggle-track-revisions';
692
+ } | {
693
+ kind: 'accept-revision';
694
+ revisionId?: string;
695
+ revisionKind?: 'insert' | 'delete' | 'format';
696
+ } | {
697
+ kind: 'reject-revision';
698
+ revisionId?: string;
699
+ revisionKind?: 'insert' | 'delete' | 'format';
700
+ } | {
701
+ kind: 'accept-all-revisions' | 'reject-all-revisions';
702
+ } | {
703
+ kind: 'toggle-bold';
704
+ } | {
705
+ kind: 'toggle-italic';
706
+ } | {
707
+ kind: 'toggle-underline';
708
+ } | {
709
+ kind: 'toggle-strike';
710
+ } | {
711
+ kind: 'set-font-family';
712
+ fontFamily: string;
713
+ } | {
714
+ kind: 'set-font-size';
715
+ fontSize: number;
716
+ } | {
717
+ kind: 'set-text-color';
718
+ color: string;
719
+ } | {
720
+ kind: 'set-highlight-color';
721
+ color: string | null;
722
+ } | {
723
+ kind: 'clear-text-format';
724
+ } | {
725
+ kind: 'set-paragraph-alignment';
726
+ alignment: 'left' | 'center' | 'right' | 'both';
727
+ } | {
728
+ kind: 'set-paragraph-indent';
729
+ indent: {
730
+ left?: number;
731
+ right?: number;
732
+ firstLine?: number;
733
+ };
734
+ } | {
735
+ kind: 'adjust-paragraph-left-indent';
736
+ delta: number;
737
+ } | {
738
+ kind: 'set-paragraph-spacing';
739
+ spacing: {
740
+ before?: number;
741
+ after?: number;
742
+ };
743
+ } | {
744
+ kind: 'set-paragraph-line-spacing';
745
+ line: number;
746
+ lineRule: 'auto' | 'exact' | 'atLeast';
747
+ } | {
748
+ kind: 'toggle-list';
749
+ listType: 'bullet' | 'numbered';
750
+ } | {
751
+ kind: 'remove-list';
752
+ } | {
753
+ kind: 'adjust-list-level';
754
+ delta: number;
755
+ };
756
+ interface WordEditorRuntime {
757
+ readonly kind: WordEditorEngineKind;
758
+ readonly destroyed: boolean;
759
+ destroy(): void;
760
+ loadDocument(view: EditorDocumentView): void;
761
+ getSourceView(): EditorDocumentView;
762
+ getDocument(): NativeWordDocument;
763
+ getSelection(): WordEditorSelection | null;
764
+ setSelection(selection: WordEditorSelection | null): boolean;
765
+ focus(): boolean;
766
+ insertImage(source: string | Blob, options?: WordEditorImageInsertOptions): Promise<boolean>;
767
+ search(options: WordEditorSearchOptions): WordEditorSearchState;
768
+ getSearchState(): WordEditorSearchState | null;
769
+ findNext(direction?: 'forward' | 'backward'): WordEditorSearchState | null;
770
+ replaceCurrent(replacement: string): boolean;
771
+ replaceAll(replacement: string): number;
772
+ clearSearch(): void;
773
+ getCommandState(): WordEditorCommandState;
774
+ getChanges(): readonly NativeWordChange[];
775
+ canUndo(): boolean;
776
+ canRedo(): boolean;
777
+ undo(): boolean;
778
+ redo(): boolean;
779
+ canDispatch(command: WordEditorCommand): boolean;
780
+ dispatch(command: WordEditorCommand): boolean;
781
+ subscribe<Event extends WordEditorRuntimeEvent>(event: Event, listener: (payload: WordEditorRuntimeEventMap[Event]) => void): () => void;
782
+ }
783
+ interface WordEditorRuntimeOptions {
784
+ onChange?: (event: WordEditorChangeEvent) => void;
785
+ onSelectionChange?: (event: WordEditorSelectionChangeEvent) => void;
786
+ contextMenu?: boolean;
787
+ trackRevisions?: boolean;
788
+ /** Keep the editor DOM and styles inside a component boundary by default. */
789
+ styleIsolation?: 'shadow' | 'none';
790
+ /** CSS text to install inside the ShadowRoot when styleIsolation is 'shadow'. */
791
+ styleText?: string;
792
+ }
793
+
794
+ type NativeTableRowPaginationKind = 'repeat-header' | 'keep-together' | 'block-fragmentable' | 'text-fragmentable' | 'unsplittable';
795
+ type NativeTableRowPaginationRisk = 'cant-split' | 'row-span' | 'vertical-merge' | 'nested-table' | 'media' | 'field' | 'page-break' | 'comment' | 'revision' | 'empty-row';
796
+ interface NativeTableRowPaginationAnalysis {
797
+ kind: NativeTableRowPaginationKind;
798
+ risks: NativeTableRowPaginationRisk[];
799
+ textLength: number;
800
+ paragraphCount: number;
801
+ }
802
+ interface NativeTablePaginationSummary {
803
+ tables: number;
804
+ rows: number;
805
+ repeatHeaderRows: number;
806
+ keepTogetherRows: number;
807
+ blockFragmentableRows: number;
808
+ textFragmentableRows: number;
809
+ unsplittableRows: number;
810
+ risks: Record<NativeTableRowPaginationRisk, number>;
811
+ }
812
+ interface NativeTableRowBlockSplitPlan {
813
+ cellBlockCounts: number[];
814
+ }
815
+ interface NativeTableRowBlockSplitResult {
816
+ head: NativeWordTableRowNode;
817
+ tail: NativeWordTableRowNode;
818
+ }
819
+ interface NativeTableRowTextSplitPlan {
820
+ cellTextOffsets: number[];
821
+ }
822
+ declare function analyzeNativeTableRowPagination(row: NativeWordTableRowNode): NativeTableRowPaginationAnalysis;
823
+ declare function summarizeNativeTablePagination(doc: NativeWordDocument): NativeTablePaginationSummary;
824
+ declare function splitNativeTableRowAtBlockBoundary(row: NativeWordTableRowNode, plan: NativeTableRowBlockSplitPlan): NativeTableRowBlockSplitResult | null;
825
+ declare function splitNativeTableRowAtTextOffset(row: NativeWordTableRowNode, plan: NativeTableRowTextSplitPlan): NativeTableRowBlockSplitResult | null;
826
+
827
+ interface NativeAnchorLayoutMetadata {
828
+ classNames: string[];
829
+ dataset: Record<string, string>;
830
+ styleProperties: Record<string, string>;
831
+ }
832
+ interface NativeRenderOptions {
833
+ implicitGridForParagraphs?: boolean;
834
+ implicitGridLinePitch?: number;
835
+ }
836
+ declare function defineNativeWordElements(): void;
837
+ declare function renderNativeDocument(doc: NativeWordDocument): HTMLElement;
838
+ declare function paginateNativeDocument(root: HTMLElement, doc: NativeWordDocument): void;
839
+ declare function reflowNativeDocumentFromParagraph(root: HTMLElement, doc: NativeWordDocument, paraId: string): boolean;
840
+ interface NativeDocumentReflowMeasurement {
841
+ overflowPx: number;
842
+ canBackfillPrevious: boolean;
843
+ canBackfillNext: boolean;
844
+ }
845
+ declare function measureNativeDocumentReflowFromParagraph(root: HTMLElement, doc: NativeWordDocument, paraId: string): NativeDocumentReflowMeasurement;
846
+ declare function rebuildNativeTableFragmentsFromParagraph(root: HTMLElement, doc: NativeWordDocument, paraId: string): boolean;
847
+ declare function refreshNativePageCommentBubbles(root: HTMLElement): void;
848
+ /** Keep comments and revisions in one ordered, non-overlapping page rail. */
849
+ declare function layoutNativePageAnnotationBubbles(page: HTMLElement): void;
850
+ declare function resolveNativeSectionPageNumberStarts(sections: Array<{
851
+ sectionIndex: number;
852
+ pageNumberStart?: number;
853
+ }>, sectionOrder: number[], sectionPageCounts: Map<number, number>): Map<number, number>;
854
+ declare function renderNativeBlock(block: NativeWordBlockNode, options?: NativeRenderOptions): HTMLElement;
855
+ declare function renderNativeParagraph(paragraph: NativeWordParagraphNode, options?: NativeRenderOptions): HTMLElement;
856
+ declare function renderNativeImage(child: NativeWordImageNode): HTMLImageElement;
857
+ declare function nativeDrawingWidthCss(child: Pick<NativeWordDrawingNode, 'width' | 'anchoringMode' | 'wrap' | 'isLineOrConnector'>): string | undefined;
858
+ declare function nativeAnchorLayoutMetadata(child: Pick<NativeWordImageNode | NativeWordDrawingNode, 'position' | 'wrap'>): NativeAnchorLayoutMetadata;
859
+ declare function renderNativeTable(table: NativeWordTableNode): HTMLElement;
860
+ interface NativeTableCellPosition {
861
+ rowIndex: number;
862
+ rowCount: number;
863
+ columnIndex: number;
864
+ columnSpan: number;
865
+ columnCount: number;
866
+ }
867
+ declare function resolveNativeTableCellBorders(table: NativeWordTableNode, cell: NativeWordTableCellNode, position: NativeTableCellPosition): EditorTableBorders | undefined;
868
+
869
+ interface NativeCursorPoint {
870
+ paraId: string;
871
+ offset: number;
872
+ }
873
+ interface NativeSelectedImage {
874
+ paraId: string;
875
+ drawingId: string;
876
+ }
877
+ declare function nativeSelection(host: HTMLElement): Selection | null;
878
+ declare function currentNativeCursor(host: HTMLElement): NativeCursorPoint | null;
879
+ declare function nativeSelectionFromCursor(host: HTMLElement): WordEditorSelection | null;
880
+ declare function currentNativeSelection(host: HTMLElement): WordEditorSelection | null;
881
+ declare function nativeCursorFromPoint(host: HTMLElement, x: number, y: number): NativeCursorPoint | null;
882
+ declare function restoreNativeCursor(host: HTMLElement, cursor: NativeCursorPoint): void;
883
+ declare function restoreNativeTextSelection(host: HTMLElement, anchor: NativeCursorPoint, focus: NativeCursorPoint): void;
884
+ declare function restoreNativeElementSelection(host: HTMLElement, element: HTMLElement): boolean;
885
+ declare function createNativeTextRange(host: HTMLElement, paraId: string, from: number, to: number): Range | null;
886
+ declare function createNativeSelectionRange(host: HTMLElement, start: NativeCursorPoint, end: NativeCursorPoint): Range | null;
887
+ declare function selectNativeImage(host: HTMLElement, selectedImage: NativeSelectedImage): void;
888
+ declare function clearNativeImageSelection(host: HTMLElement): void;
889
+ declare function imageOffset(paragraph: HTMLElement, image: HTMLImageElement): number;
890
+ declare function parentNativeParagraph(node: Node): HTMLElement | null;
891
+
892
+ declare function searchNativeWordDocument(doc: NativeWordDocument, options: WordEditorSearchOptions): WordEditorSearchMatch[];
893
+ declare function bodyParagraphs(blocks: readonly NativeWordBlockNode[]): NativeWordParagraphNode[];
894
+
895
+ type NativeWordListType = 'bullet' | 'numbered';
896
+ declare function nativeListType(numbering: EditorNumberingFormat | undefined): NativeWordListType | null;
897
+ declare function createNativeListNumbering(doc: NativeWordDocument, type: NativeWordListType, ilvl?: number): EditorNumberingFormat;
898
+ declare function nativeNumberingAtLevel(numbering: EditorNumberingFormat, ilvl: number): EditorNumberingFormat;
899
+ declare function refreshNativeNumberingLabels(doc: NativeWordDocument): void;
900
+ declare function nativeListIndent(ilvl: number): {
901
+ left: number;
902
+ firstLine: number;
903
+ };
904
+ declare function adjacentNativeListNumbering(doc: NativeWordDocument, paraIds: string[], type: NativeWordListType): EditorNumberingFormat | null;
905
+
906
+ type WordOoxmlPatchKind = 'paragraph-text' | 'paragraph-split' | 'paragraph-merge' | 'paragraph-format' | 'format-revision' | 'drawing-delete' | 'hyperlink' | 'table-structure' | 'table-insert' | 'table-cell-format' | 'table-cell-clear' | 'table-cell-replace' | 'table-cell-replace-rich' | 'revision' | 'drawing-revision' | 'table-delete';
907
+ type WordOoxmlPatch = {
908
+ kind: 'paragraph-text';
909
+ op: 'insert' | 'delete' | 'replace';
910
+ paraId: string;
911
+ offset: number;
912
+ text: string;
913
+ deletedText?: string;
914
+ } | {
915
+ kind: 'paragraph-split';
916
+ paraId: string;
917
+ newParaId: string;
918
+ offset: number;
919
+ } | {
920
+ kind: 'paragraph-merge';
921
+ paraId: string;
922
+ } | {
923
+ kind: 'paragraph-format';
924
+ paraId: string;
925
+ from: number;
926
+ to: number;
927
+ format: Partial<EditorRunFormat>;
928
+ } | {
929
+ kind: 'format-revision';
930
+ op: 'run' | 'accept' | 'reject';
931
+ paraId: string;
932
+ from: number;
933
+ to: number;
934
+ revisionId: string;
935
+ beforeFormat?: Partial<EditorRunFormat> | null;
936
+ } | {
937
+ kind: 'drawing-delete';
938
+ paraId: string;
939
+ drawingId: string;
940
+ offset: number;
941
+ } | {
942
+ kind: 'drawing-resize';
943
+ paraId: string;
944
+ drawingId: string;
945
+ offset: number;
946
+ width: number;
947
+ height: number;
948
+ } | {
949
+ kind: 'drawing-insert';
950
+ paraId: string;
951
+ drawingId: string;
952
+ offset: number;
953
+ src: string;
954
+ width: number;
955
+ height: number;
956
+ } | {
957
+ kind: 'drawing-revision';
958
+ op: 'accept' | 'reject';
959
+ paraId: string;
960
+ drawingId: string;
961
+ offset: number;
962
+ revisionId: string;
963
+ revisionKind: 'insert' | 'delete';
964
+ } | {
965
+ kind: 'comment';
966
+ op: 'insert' | 'delete' | 'update';
967
+ paraId: string;
968
+ from: number;
969
+ to: number;
970
+ commentId: number;
971
+ body?: string;
972
+ parentCommentId?: number;
973
+ } | {
974
+ kind: 'revision';
975
+ op: 'insert' | 'delete' | 'accept' | 'reject';
976
+ paraId: string;
977
+ from: number;
978
+ to: number;
979
+ revisionId: string;
980
+ revisionKind: 'insert' | 'delete';
981
+ } | {
982
+ kind: 'hyperlink';
983
+ op: 'set' | 'remove';
984
+ paraId: string;
985
+ from: number;
986
+ to: number;
987
+ hyperlink?: {
988
+ target?: string;
989
+ anchor?: string;
990
+ tooltip?: string;
991
+ };
992
+ } | {
993
+ kind: 'table-structure';
994
+ op: 'insert-row' | 'delete-row' | 'insert-column' | 'delete-column' | 'merge-cells' | 'split-cell';
995
+ tableId: string;
996
+ rowIndex: number;
997
+ columnIndex: number;
998
+ endColumnIndex?: number;
999
+ endRowIndex?: number;
1000
+ } | {
1001
+ kind: 'table-cell-replace-rich';
1002
+ tableId: string;
1003
+ rowIndex: number;
1004
+ columnIndex: number;
1005
+ cell: NativeWordTableCellNode;
1006
+ } | {
1007
+ kind: 'table-cell-replace';
1008
+ tableId: string;
1009
+ rowIndex: number;
1010
+ columnIndex: number;
1011
+ text: string;
1012
+ } | {
1013
+ kind: 'table-cell-clear';
1014
+ tableId: string;
1015
+ rowIndex: number;
1016
+ columnIndex: number;
1017
+ } | {
1018
+ kind: 'table-cell-format';
1019
+ tableId: string;
1020
+ rowIndex: number;
1021
+ columnIndex: number;
1022
+ format: {
1023
+ backgroundColor?: string | null;
1024
+ verticalAlignment?: 'top' | 'center' | 'bottom' | 'both' | null;
1025
+ borderColor?: string | null;
1026
+ };
1027
+ } | {
1028
+ kind: 'table-insert';
1029
+ anchorParaId: string;
1030
+ anchorOffset: number;
1031
+ table: NativeWordTableNode;
1032
+ } | {
1033
+ kind: 'table-delete';
1034
+ tableId: string;
1035
+ };
1036
+ interface WordOoxmlPatchPlan {
1037
+ target: 'word/document.xml';
1038
+ patches: WordOoxmlPatch[];
1039
+ unsupported: UnsupportedNativeWordChange[];
1040
+ }
1041
+ type ResolvedWordOoxmlPatchTarget = {
1042
+ kind: 'paragraph';
1043
+ patch: Extract<WordOoxmlPatch, {
1044
+ kind: 'paragraph-text' | 'paragraph-split' | 'paragraph-merge' | 'paragraph-format' | 'format-revision' | 'hyperlink' | 'revision';
1045
+ }>;
1046
+ partPath: string;
1047
+ paragraph: Element;
1048
+ } | {
1049
+ kind: 'table';
1050
+ patch: Extract<WordOoxmlPatch, {
1051
+ kind: 'table-structure' | 'table-insert' | 'table-cell-format' | 'table-cell-clear' | 'table-cell-replace' | 'table-cell-replace-rich' | 'table-delete';
1052
+ }>;
1053
+ partPath: string;
1054
+ table: Element;
1055
+ paragraph?: Element;
1056
+ } | {
1057
+ kind: 'drawing';
1058
+ patch: Extract<WordOoxmlPatch, {
1059
+ kind: 'drawing-delete' | 'drawing-resize' | 'drawing-insert' | 'drawing-revision';
1060
+ }>;
1061
+ partPath: string;
1062
+ drawing: Element;
1063
+ paragraph: Element | null;
1064
+ } | {
1065
+ kind: 'comment';
1066
+ patch: Extract<WordOoxmlPatch, {
1067
+ kind: 'comment';
1068
+ }>;
1069
+ partPath: string;
1070
+ paragraph: Element;
1071
+ };
1072
+ interface UnresolvedWordOoxmlPatchTarget {
1073
+ patch: WordOoxmlPatch;
1074
+ reason: string;
1075
+ }
1076
+ interface WordOoxmlPatchTargetResolution {
1077
+ resolved: ResolvedWordOoxmlPatchTarget[];
1078
+ unresolved: UnresolvedWordOoxmlPatchTarget[];
1079
+ }
1080
+ interface SkippedWordOoxmlPatch {
1081
+ patch: WordOoxmlPatch;
1082
+ reason: string;
1083
+ }
1084
+ interface WordOoxmlPatchApplyResult {
1085
+ applied: WordOoxmlPatch[];
1086
+ skipped: SkippedWordOoxmlPatch[];
1087
+ unresolved: UnresolvedWordOoxmlPatchTarget[];
1088
+ }
1089
+ interface NativeWordChangeApplyResult extends WordOoxmlPatchApplyResult {
1090
+ plan: WordOoxmlPatchPlan;
1091
+ }
1092
+ interface UnsupportedNativeWordChange {
1093
+ change: NativeWordChange;
1094
+ reason: string;
1095
+ }
1096
+ declare function planWordOoxmlPatches(changes: readonly NativeWordChange[]): WordOoxmlPatchPlan;
1097
+ declare function applyNativeWordChangesToPackage(pkg: Package, changes: readonly NativeWordChange[], indices?: PackageIndices): NativeWordChangeApplyResult;
1098
+ declare function planWordOoxmlPatch(change: NativeWordChange, options?: {
1099
+ allowTrackedTable?: boolean;
1100
+ }): WordOoxmlPatch | null;
1101
+ declare function resolveWordOoxmlPatchTargets(pkg: Package, indices: PackageIndices, patches: readonly WordOoxmlPatch[]): WordOoxmlPatchTargetResolution;
1102
+ declare function applyWordOoxmlPatches(pkg: Package, indices: PackageIndices, patches: readonly WordOoxmlPatch[]): WordOoxmlPatchApplyResult;
1103
+
1104
+ declare function getNativeWordCommandState(doc: NativeWordDocument, selection: WordEditorSelection | null): WordEditorCommandState;
1105
+ declare function canDispatchNativeWordCommand(doc: NativeWordDocument, selection: WordEditorSelection | null, command: WordEditorCommand): boolean;
1106
+
1107
+ interface NativeWordEditor extends WordEditorRuntime {
1108
+ }
1109
+ declare function renderNativeWordEditor(host: HTMLElement, initialView: EditorDocumentView, options?: WordEditorRuntimeOptions): NativeWordEditor;
1110
+
1111
+ export { type WordEditorFormatValue as $, type NativeWordCommentMark as A, type NativeWordDocument as B, type NativeWordDrawingNode as C, type NativeWordEditor as D, type NativeWordFieldNode as E, type NativeWordFormatRevisionMark as F, type NativeWordHeaderFooterStory as G, type NativeWordImageNode as H, type NativeWordInlineNode as I, type NativeWordListType as J, type NativeWordPageBreakNode as K, type NativeWordParagraphNode as L, type NativeWordRevisionMark as M, type NativeAnchorLayoutMetadata as N, type NativeWordTableCellNode as O, type NativeWordTableNode as P, type NativeWordTableRowNode as Q, type NativeWordTextMark as R, type NativeWordTextNode as S, type ResolvedWordOoxmlPatchTarget as T, type SkippedWordOoxmlPatch as U, type UnresolvedWordOoxmlPatchTarget as V, type UnsupportedNativeWordChange as W, type WordEditorChangeEvent as X, type WordEditorCommand as Y, type WordEditorCommandState as Z, type WordEditorEngineKind as _, type NativeBlockRangeReplacement as a, nativeInsertImage as a$, type WordEditorHyperlink as a0, type WordEditorImageInsertOptions as a1, type WordEditorImageState as a2, type WordEditorLineSpacingState as a3, type WordEditorRuntime as a4, type WordEditorRuntimeEvent as a5, type WordEditorRuntimeEventMap as a6, type WordEditorRuntimeOptions as a7, type WordEditorSearchMatch as a8, type WordEditorSearchOptions as a9, currentNativeSelection as aA, defineNativeWordElements as aB, findNativeParagraph as aC, findNativeParagraphLocation as aD, findNativeTableCellLocation as aE, findNativeTableLocation as aF, getNativeWordCommandState as aG, imageOffset as aH, layoutNativePageAnnotationBubbles as aI, measureNativeDocumentReflowFromParagraph as aJ, nativeAddComment as aK, nativeAddFormatRevision as aL, nativeAddRevision as aM, nativeAnchorLayoutMetadata as aN, nativeClearRunFormat as aO, nativeClearTableCellRange as aP, nativeCopyBlockRange as aQ, nativeCursorFromPoint as aR, nativeDeleteBackward as aS, nativeDeleteComment as aT, nativeDeleteForward as aU, nativeDeleteImage as aV, nativeDeleteRange as aW, nativeDeleteTable as aX, nativeDeleteTextRangeAcrossParagraphs as aY, nativeDrawingWidthCss as aZ, nativeEditTableStructure as a_, type WordEditorSearchState as aa, type WordEditorSelection as ab, type WordEditorSelectionChangeEvent as ac, type WordEditorSelectionPoint as ad, type WordEditorTableCellPoint as ae, type WordEditorTableState as af, type WordOoxmlPatch as ag, type WordOoxmlPatchApplyResult as ah, type WordOoxmlPatchKind as ai, type WordOoxmlPatchPlan as aj, type WordOoxmlPatchTargetResolution as ak, adjacentNativeListNumbering as al, allNativeParagraphs as am, analyzeNativeTableRowPagination as an, applyNativeWordChangesToPackage as ao, applyWordOoxmlPatches as ap, bodyParagraphs as aq, canDispatchNativeWordCommand as ar, clearNativeImageSelection as as, cloneNativeWordBlocks as at, createNativeListNumbering as au, createNativeParaId as av, createNativeSelectionRange as aw, createNativeTextRange as ax, createNativeWordDocument as ay, currentNativeCursor as az, type NativeCursorPoint as b, nativeInsertPageBreak as b0, nativeInsertTable as b1, nativeInsertText as b2, nativeListIndent as b3, nativeListType as b4, nativeMergeTableCells as b5, nativeNumberingAtLevel as b6, nativePageBreakAt as b7, nativeParagraphText as b8, nativeRangeContainsPageBreak as b9, nativeUpdateComment as bA, paginateNativeDocument as bB, parentNativeParagraph as bC, planWordOoxmlPatch as bD, planWordOoxmlPatches as bE, previousNativeParagraphId as bF, rebuildNativeTableFragmentsFromParagraph as bG, reflowNativeDocumentFromParagraph as bH, refreshNativeNumberingLabels as bI, refreshNativePageCommentBubbles as bJ, renderNativeBlock as bK, renderNativeDocument as bL, renderNativeImage as bM, renderNativeParagraph as bN, renderNativeTable as bO, renderNativeWordEditor as bP, resolveNativeSectionPageNumberStarts as bQ, resolveNativeTableCellBorders as bR, resolveWordOoxmlPatchTargets as bS, restoreNativeCursor as bT, restoreNativeElementSelection as bU, restoreNativeTextSelection as bV, searchNativeWordDocument as bW, selectNativeImage as bX, splitNativeTableRowAtBlockBoundary as bY, splitNativeTableRowAtTextOffset as bZ, summarizeNativeTablePagination as b_, nativeReplaceBlockRangeAcrossParagraphs as ba, nativeReplaceRange as bb, nativeReplaceRangeWithBlocks as bc, nativeReplaceTableCellRangeContent as bd, nativeReplaceTableCellRangeText as be, nativeReplaceTextRangeAcrossParagraphs as bf, nativeReplaceTextRangeWithParagraphs as bg, nativeResolveFormatRevision as bh, nativeResolveImageFormatRevision as bi, nativeResolveImageRevision as bj, nativeResolveRevision as bk, nativeSelection as bl, nativeSelectionFromCursor as bm, nativeSetHyperlink as bn, nativeSetImageSize as bo, nativeSetParagraphFormat as bp, nativeSetParagraphList as bq, nativeSetRunFormat as br, nativeSetTableCellFormat as bs, nativeSetTableCellRangeFormat as bt, nativeSplitParagraph as bu, nativeSplitTableCell as bv, nativeSyncParagraphText as bw, nativeTableCellsInRange as bx, nativeTableSupportsStructuralEditing as by, nativeTextRangeIsBold as bz, type NativeDocumentReflowMeasurement as c, type NativeParagraphLocation as d, type NativePlainTextReplacement as e, type NativeSelectedImage as f, type NativeTableCellFormatPatch as g, type NativeTableCellLocation as h, type NativeTableCellPoint as i, type NativeTableCellPosition as j, type NativeTableCellRange as k, type NativeTableClipboardCell as l, type NativeTableEditResult as m, type NativeTableLocation as n, type NativeTablePaginationSummary as o, type NativeTableRangeEditResult as p, type NativeTableRowBlockSplitPlan as q, type NativeTableRowBlockSplitResult as r, type NativeTableRowPaginationAnalysis as s, type NativeTableRowPaginationKind as t, type NativeTableRowPaginationRisk as u, type NativeTableRowTextSplitPlan as v, type NativeTableStructureOperation as w, type NativeWordBlockNode as x, type NativeWordChange as y, type NativeWordChangeApplyResult as z };