@docx4j/core-ts 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE +4 -0
- package/README.md +32 -4
- package/dist/html/convert.mjs +2 -1
- package/dist/html/elements.mjs +2 -1
- package/dist/model/color/ColorMath.d.mts +29 -0
- package/dist/model/color/ColorMath.mjs +146 -0
- package/dist/model/color/ColorTables.d.mts +6 -0
- package/dist/model/color/ColorTables.mjs +83 -0
- package/dist/model/color/DrawingMLColors.d.mts +52 -0
- package/dist/model/color/DrawingMLColors.mjs +374 -0
- package/dist/model/color/ResolvedColor.d.mts +36 -0
- package/dist/model/color/ResolvedColor.mjs +65 -0
- package/dist/model/color/SpreadsheetColors.d.mts +36 -0
- package/dist/model/color/SpreadsheetColors.mjs +84 -0
- package/dist/model/color/StyleFill.d.mts +28 -0
- package/dist/model/color/StyleFill.mjs +21 -0
- package/dist/model/color/ThemeColors.d.mts +86 -0
- package/dist/model/color/ThemeColors.mjs +304 -0
- package/dist/model/color/WordColors.d.mts +71 -0
- package/dist/model/color/WordColors.mjs +121 -0
- package/dist/model/color/index.d.mts +6 -0
- package/dist/model/color/index.mjs +30 -0
- package/dist/model/content/Body.d.mts +145 -23
- package/dist/model/content/Body.mjs +509 -141
- package/dist/model/content/Comment.d.mts +21 -3
- package/dist/model/content/Comment.mjs +195 -19
- package/dist/model/content/ContentControl.d.mts +197 -18
- package/dist/model/content/ContentControl.mjs +664 -95
- package/dist/model/content/Font.d.mts +67 -17
- package/dist/model/content/Font.mjs +114 -35
- package/dist/model/content/InlinePicture.d.mts +11 -0
- package/dist/model/content/InlinePicture.mjs +21 -1
- package/dist/model/content/List.mjs +3 -0
- package/dist/model/content/Paragraph.d.mts +189 -13
- package/dist/model/content/Paragraph.mjs +870 -74
- package/dist/model/content/Range.d.mts +227 -12
- package/dist/model/content/Range.mjs +785 -59
- package/dist/model/content/ResolvedView.d.mts +104 -0
- package/dist/model/content/ResolvedView.mjs +596 -0
- package/dist/model/content/Table.d.mts +29 -3
- package/dist/model/content/Table.mjs +109 -33
- package/dist/model/content/TrackedChange.d.mts +172 -13
- package/dist/model/content/TrackedChange.mjs +728 -167
- package/dist/model/content/comments.d.mts +20 -6
- package/dist/model/content/comments.mjs +67 -57
- package/dist/model/content/generalException.d.mts +18 -0
- package/dist/model/content/generalException.mjs +24 -0
- package/dist/model/content/index.d.mts +8 -3
- package/dist/model/content/index.mjs +7 -2
- package/dist/model/content/mathText.d.mts +21 -0
- package/dist/model/content/mathText.mjs +267 -0
- package/dist/model/content/officeText.d.mts +27 -0
- package/dist/model/content/officeText.mjs +74 -0
- package/dist/model/content/outline.d.mts +5 -0
- package/dist/model/content/outline.mjs +13 -0
- package/dist/model/content/placeholders.d.mts +110 -0
- package/dist/model/content/placeholders.mjs +253 -0
- package/dist/model/content/search.d.mts +72 -0
- package/dist/model/content/search.mjs +204 -2
- package/dist/model/content/spanEdits.d.mts +159 -0
- package/dist/model/content/spanEdits.mjs +728 -0
- package/dist/model/content/story.d.mts +44 -0
- package/dist/model/content/story.mjs +92 -0
- package/dist/model/content/tableColumns.d.mts +1 -1
- package/dist/model/content/tableColumns.mjs +108 -80
- package/dist/model/content/tableRevisions.d.mts +11 -3
- package/dist/model/content/tableRevisions.mjs +72 -42
- package/dist/model/content/tableRules.d.mts +30 -0
- package/dist/model/content/tableRules.mjs +100 -0
- package/dist/model/content/textBoxes.d.mts +18 -0
- package/dist/model/content/textBoxes.mjs +105 -0
- package/dist/model/content/trackedChangeFilter.d.mts +39 -0
- package/dist/model/content/trackedChangeFilter.mjs +81 -0
- package/dist/model/content/tracking.d.mts +28 -0
- package/dist/model/content/tracking.mjs +149 -10
- package/dist/model/content/tree.d.mts +171 -22
- package/dist/model/content/tree.mjs +329 -53
- package/dist/model/customxml/CustomXmlPartCollection.d.mts +8 -0
- package/dist/model/customxml/CustomXmlPartCollection.mjs +34 -11
- package/dist/model/customxml/XmlMapping.d.mts +1 -1
- package/dist/model/customxml/XmlMapping.mjs +11 -0
- package/dist/model/customxml/bindings.d.mts +21 -2
- package/dist/model/customxml/bindings.mjs +76 -32
- package/dist/model/customxml/kinds.d.mts +8 -3
- package/dist/model/customxml/kinds.mjs +26 -5
- package/dist/model/customxml/picturePlaceholder.d.mts +17 -0
- package/dist/model/customxml/picturePlaceholder.mjs +32 -0
- package/dist/model/customxml/pictures.d.mts +4 -3
- package/dist/model/customxml/pictures.mjs +18 -6
- package/dist/model/customxml/xhtml.mjs +8 -2
- package/dist/model/index.d.mts +2 -0
- package/dist/model/index.mjs +4 -0
- package/dist/model/listnumbering/Emulator.d.mts +37 -5
- package/dist/model/listnumbering/Emulator.mjs +63 -9
- package/dist/model/properties/PropertyResolver.d.mts +60 -1
- package/dist/model/properties/PropertyResolver.mjs +115 -2
- package/dist/model/properties/catalogue.d.mts +19 -5
- package/dist/model/properties/catalogue.mjs +41 -15
- package/dist/model/properties/log.d.mts +1 -1
- package/dist/model/properties/log.mjs +5 -5
- package/dist/model/properties/table.mjs +4 -2
- package/dist/model/text/Extractor.d.mts +289 -0
- package/dist/model/text/Extractor.mjs +2162 -0
- package/dist/model/text/LinkTargets.d.mts +45 -0
- package/dist/model/text/LinkTargets.mjs +170 -0
- package/dist/model/text/MarkdownExporter.d.mts +140 -0
- package/dist/model/text/MarkdownExporter.mjs +255 -0
- package/dist/model/text/PlainText.d.mts +29 -0
- package/dist/model/text/PlainText.mjs +539 -0
- package/dist/model/text/TextContext.d.mts +161 -0
- package/dist/model/text/TextContext.mjs +425 -0
- package/dist/model/text/TextOptions.d.mts +150 -0
- package/dist/model/text/TextOptions.mjs +278 -0
- package/dist/model/text/TextResult.d.mts +504 -0
- package/dist/model/text/TextResult.mjs +526 -0
- package/dist/model/text/Texts.d.mts +99 -0
- package/dist/model/text/Texts.mjs +187 -0
- package/dist/model/text/WmlToMarkdown.d.mts +120 -0
- package/dist/model/text/WmlToMarkdown.mjs +911 -0
- package/dist/model/text/commonmark.d.mts +121 -0
- package/dist/model/text/commonmark.mjs +655 -0
- package/dist/model/text/index.d.mts +7 -0
- package/dist/model/text/index.mjs +8 -0
- package/dist/model/text/normalize.d.mts +8 -0
- package/dist/model/text/normalize.mjs +13 -0
- package/dist/model/text/outline.d.mts +4 -0
- package/dist/model/text/outline.mjs +71 -0
- package/dist/office-js/fragment.d.mts +7 -5
- package/dist/office-js/fragment.mjs +63 -14
- package/dist/office-js/proxy.d.mts +8 -0
- package/dist/office-js/proxy.mjs +29 -0
- package/dist/office-js/run.mjs +2 -0
- package/dist/office-js/supported.generated.mjs +16 -0
- package/dist/office-js/toApiScript.mjs +21 -5
- package/dist/opc/Save.d.mts +17 -0
- package/dist/opc/Save.mjs +12 -2
- package/dist/opc/index.d.mts +3 -3
- package/dist/opc/index.mjs +1 -1
- package/dist/opc/mce/preprocessor.d.mts +28 -3
- package/dist/opc/mce/preprocessor.mjs +4 -4
- package/dist/opc/mce/understood.d.mts +30 -6
- package/dist/opc/mce/understood.mjs +37 -7
- package/dist/packages/OpcPackage.d.mts +13 -0
- package/dist/packages/OpcPackage.mjs +1 -0
- package/dist/packages/WordprocessingMLPackage.d.mts +45 -8
- package/dist/packages/WordprocessingMLPackage.mjs +155 -20
- package/dist/parts/DefaultXmlPart.mjs +2 -2
- package/dist/parts/Part.d.mts +10 -2
- package/dist/parts/XmlPart.d.mts +12 -30
- package/dist/parts/XmlPart.mjs +44 -93
- package/dist/parts/wml/comments.mjs +30 -0
- package/dist/parts/wml/index.mjs +12 -0
- package/dist/xml/dom.d.mts +7 -0
- package/dist/xml/dom.mjs +18 -0
- package/package.json +2 -2
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
import type * as wml from '@docx4j/generated-objects-ts/modules/org_docx4j_wml';
|
|
2
2
|
import type * as math from '@docx4j/generated-objects-ts/modules/org_docx4j_math';
|
|
3
|
+
import type * as mce from '@docx4j/generated-objects-ts/modules/org_docx4j_mce';
|
|
3
4
|
import { type Element, type Located, type RevisionKind } from './tree.mjs';
|
|
4
5
|
import { Range } from './Range.mjs';
|
|
5
6
|
import type { Paragraph } from './Paragraph.mjs';
|
|
6
7
|
import type { Body } from './Body.mjs';
|
|
7
8
|
import type { Part } from '../../parts/Part.mjs';
|
|
9
|
+
import type { XmlPart } from '../../parts/XmlPart.mjs';
|
|
8
10
|
import { type RelationshipRemovals } from './relationships.mjs';
|
|
9
11
|
/** Office JS `Word.ChangeTrackingState` (`Unknown` is not produced here). */
|
|
10
12
|
export type TrackedChangeType = 'Added' | 'Deleted' | 'Formatted' | 'None' | 'Unknown';
|
|
13
|
+
/**
|
|
14
|
+
* docx4j's finer kind of change (its `TrackedChange.Kind`, CR-043), the names verbatim, as data values
|
|
15
|
+
* a filter written for docx4j or passed as JSON carries over in (CR-011 D3). `INSERTION`, `DELETION` and
|
|
16
|
+
* `FORMATTING` are a group's whose pieces are of more than one kind.
|
|
17
|
+
*/
|
|
18
|
+
export type TrackedChangeKind = 'RUN_INSERTION' | 'RUN_DELETION' | 'MOVE' | 'PARAGRAPH_MARK_INSERTION' | 'PARAGRAPH_MARK_DELETION' | 'RUN_PROPERTIES' | 'PARAGRAPH_MARK_PROPERTIES' | 'PARAGRAPH_PROPERTIES' | 'ROW_INSERTION' | 'ROW_DELETION' | 'FIELD_INSERTION' | 'CONTENT_CONTROL_INSERTION' | 'CONTENT_CONTROL_DELETION' | 'MATH_STRUCTURE_INSERTION' | 'MATH_STRUCTURE_DELETION' | 'INSERTION' | 'DELETION' | 'FORMATTING' | 'TABLE_PROPERTIES' | 'SECTION_PROPERTIES' | 'CELL_INSERTION' | 'CELL_DELETION';
|
|
11
19
|
/** Which piece of revision markup a `TrackedChange` is over (an extension: Office JS has no such member). */
|
|
12
20
|
export type TrackedChangeTarget =
|
|
13
21
|
/** `w:ins` / `w:del` / `w:moveFrom` / `w:moveTo` around runs. */
|
|
@@ -107,10 +115,13 @@ export type TrackedChangeTarget =
|
|
|
107
115
|
* `w:sdt` or `w:customXml`, `owner` the list holding it, `outer` the pair in that list and `inner`
|
|
108
116
|
* the pair in its content. Rejecting takes the element away and leaves its content where it
|
|
109
117
|
* stood; accepting takes the markers away. Its text is its content's, which the pieces inside
|
|
110
|
-
* report.
|
|
118
|
+
* report. Or a deletion, `revision` `del`: the same form with `w:customXmlDelRangeStart` and `End`,
|
|
119
|
+
* Word's for a control a tracked deletion took (check 54 cases 15 and 17; CR-014 section 12), which
|
|
120
|
+
* groups with the deletions around and inside it; accepting takes the element away, rejecting the markers.
|
|
111
121
|
*/
|
|
112
122
|
| {
|
|
113
123
|
kind: 'holder';
|
|
124
|
+
revision: 'ins' | 'del';
|
|
114
125
|
holder: Element;
|
|
115
126
|
owner: Element[];
|
|
116
127
|
outer: [Element, Element];
|
|
@@ -164,8 +175,9 @@ export type TrackedChangeTarget =
|
|
|
164
175
|
};
|
|
165
176
|
/**
|
|
166
177
|
* A subset of Office JS `Word.TrackedChange`: `type`, `author`, `date`, `text`, `accept()`,
|
|
167
|
-
* `reject()` and `getRange()`, plus `element`, `id
|
|
168
|
-
* `Paragraph` and `Range`: it holds the markup it is
|
|
178
|
+
* `reject()` and `getRange()`, plus `element`, `id`, `target`, and docx4j's `kind`, `part` and
|
|
179
|
+
* `pieces` (CR-011) as extensions. A view, like `Paragraph` and `Range`: it holds the markup it is
|
|
180
|
+
* over, nothing is cached.
|
|
169
181
|
*/
|
|
170
182
|
export declare class TrackedChange {
|
|
171
183
|
readonly target: TrackedChangeTarget;
|
|
@@ -189,6 +201,24 @@ export declare class TrackedChange {
|
|
|
189
201
|
get date(): Date | undefined;
|
|
190
202
|
/** The annotation id (`w:id`; an extension). */
|
|
191
203
|
get id(): number;
|
|
204
|
+
/**
|
|
205
|
+
* docx4j's kind of change (an extension; its `TrackedChange.getKind()`, CR-011): `target.kind` in
|
|
206
|
+
* docx4j's names, an equation's runs as runs. A group's is its pieces' when they are all of one kind,
|
|
207
|
+
* else `INSERTION`, `DELETION` or `FORMATTING`.
|
|
208
|
+
*/
|
|
209
|
+
get kind(): TrackedChangeKind;
|
|
210
|
+
/**
|
|
211
|
+
* The part the change's story is in (an extension; docx4j's `getPart()`, CR-011): the main document
|
|
212
|
+
* part, a header or footer part, the footnotes, endnotes or comments part. A text box's change gives
|
|
213
|
+
* the part the text box is in.
|
|
214
|
+
*/
|
|
215
|
+
get part(): XmlPart<unknown> | undefined;
|
|
216
|
+
/**
|
|
217
|
+
* The single changes this one groups, in document order (an extension; docx4j's `getPieces()`,
|
|
218
|
+
* CR-011); a change that is no group is its own one piece. A filter's conditions are met or not by
|
|
219
|
+
* each piece, and each can be accepted or rejected on its own.
|
|
220
|
+
*/
|
|
221
|
+
get pieces(): readonly TrackedChange[];
|
|
192
222
|
/** The markup this change is over (an extension): the `w:ins` element, the `w:rPrChange`, ... */
|
|
193
223
|
get element(): object;
|
|
194
224
|
/** The text the change covers; `\r` for a paragraph mark, as Office JS gives it (check 22). */
|
|
@@ -198,14 +228,34 @@ export declare class TrackedChange {
|
|
|
198
228
|
/**
|
|
199
229
|
* Keeps the change: a `w:ins` is unwrapped, a `w:del` removed, a deleted mark joins the paragraphs.
|
|
200
230
|
* Either half of a move keeps the whole move, as Word's Review tab does (CR-002 section 29).
|
|
231
|
+
*
|
|
232
|
+
* Returns whether it acted: false, changing nothing, when the change has been resolved since it was
|
|
233
|
+
* listed (CR-002 section 53). An extension: Office JS's `accept()` returns nothing.
|
|
234
|
+
*/
|
|
235
|
+
accept(): boolean;
|
|
236
|
+
/**
|
|
237
|
+
* The change's twins resolved the same way: the changes in the other branches of the kept
|
|
238
|
+
* `mc:AlternateContent` this one was listed from, paired with it by kind and position (`pairTwins`,
|
|
239
|
+
* docx4j's; CR-013 phase 3), each with its own twins. A group's twins are its pieces', which its
|
|
240
|
+
* pieces resolve. A twin resolved since it was listed is passed over.
|
|
201
241
|
*/
|
|
202
|
-
|
|
242
|
+
private resolveTwins;
|
|
203
243
|
private acceptHere;
|
|
204
244
|
/**
|
|
205
245
|
* Puts back what was there: a `w:ins` is removed, a `w:del` restored, a `w:rPrChange` re-applied.
|
|
206
246
|
* Either half of a move rejects the whole move, as Word's Review tab does (CR-002 section 29).
|
|
247
|
+
*
|
|
248
|
+
* Returns whether it acted, as `accept()` does.
|
|
207
249
|
*/
|
|
208
|
-
reject():
|
|
250
|
+
reject(): boolean;
|
|
251
|
+
/**
|
|
252
|
+
* Whether the record this view was listed for, `target.value`, is still where it was listed. A view
|
|
253
|
+
* whose change has been resolved since, by itself or by another verb, does nothing; otherwise it
|
|
254
|
+
* would act on what stands there now (CR-002 section 53). The record is compared by identity. docx4j's
|
|
255
|
+
* views throw instead, once any change on the package has been resolved since they were listed; that
|
|
256
|
+
* would stop a loop resolving one listing last first, as `Body.acceptAll` does.
|
|
257
|
+
*/
|
|
258
|
+
private isCurrent;
|
|
209
259
|
private rejectHere;
|
|
210
260
|
/** The body the change is in. */
|
|
211
261
|
private get body_();
|
|
@@ -213,6 +263,12 @@ export declare class TrackedChange {
|
|
|
213
263
|
private get package_();
|
|
214
264
|
private requireParagraph;
|
|
215
265
|
}
|
|
266
|
+
/**
|
|
267
|
+
* A group's pieces resolved: its runs last first, then its marks last first, so that a paragraph join
|
|
268
|
+
* never strands a piece still to do. Office JS and Word's Review tab resolve the group as one (checks
|
|
269
|
+
* 22 and 23), and so, piece by piece, does this.
|
|
270
|
+
*/
|
|
271
|
+
export declare function resolvePieces(pieces: readonly TrackedChange[], what: 'accept' | 'reject'): void;
|
|
216
272
|
/** The ids of the footnotes and endnotes whose references removed content took with it. */
|
|
217
273
|
export interface NoteRemovals {
|
|
218
274
|
footnote: Set<number>;
|
|
@@ -238,10 +294,26 @@ export interface NoteRemovals {
|
|
|
238
294
|
* goes when nothing left in the part references it; its part goes when no relationship in the package
|
|
239
295
|
* targets it any more, and what that part alone related to goes with it. The kinds beyond pictures,
|
|
240
296
|
* headers and footers (charts, OLE objects, `v:imagedata`) are docx4j's reading, not measured.
|
|
297
|
+
* - **Comments**: a comment `removeRevision` left with its range's start and end in different paragraphs
|
|
298
|
+
* goes whole when the joins have brought them into one list with nothing with text between
|
|
299
|
+
* (`settleSpanningComments`; CR-002 section 54).
|
|
241
300
|
* A change resolved inside another's (a row's cells, a group's pieces, `acceptAll`'s changes) shares the
|
|
242
301
|
* outer resolution, so the bookmarks are read twice for the lot, and not at all when nothing is removed.
|
|
243
302
|
*/
|
|
244
303
|
export declare function resolving(pkg: unknown, body: Body | undefined, resolve: () => void): void;
|
|
304
|
+
/**
|
|
305
|
+
* Queues the notes whose references `removed` holds to go when the package is saved, as a resolution's
|
|
306
|
+
* removals go: what a range deleted untracked takes with it (CR-014 phase 2; check 52 case 12, where Word took
|
|
307
|
+
* the footnote out of `footnotes.xml` with its reference). A note goes only where no reference to it stands
|
|
308
|
+
* by then (`flushPendingNoteRemovals`), so content queued and then kept costs nothing.
|
|
309
|
+
*/
|
|
310
|
+
export declare function queueNoteRemovals(pkg: unknown, removed: unknown): void;
|
|
311
|
+
/**
|
|
312
|
+
* The notes `pending` holds that `flushPendingNoteRemovals` will take away: those whose reference no
|
|
313
|
+
* longer stands in the main document's tree. A listing of every story leaves them out, as docx4j's,
|
|
314
|
+
* which removes them when its resolution ends, does (CR-011).
|
|
315
|
+
*/
|
|
316
|
+
export declare function notesGoing(mainTree: unknown, pending: NoteRemovals): NoteRemovals;
|
|
245
317
|
/** What `flushPendingNoteRemovals` needs of the main document part. */
|
|
246
318
|
interface NotesHost {
|
|
247
319
|
getContents(): Promise<unknown>;
|
|
@@ -270,13 +342,16 @@ interface NoteRemovalHost {
|
|
|
270
342
|
* was in it is queued for removal, its anchor being gone.
|
|
271
343
|
*/
|
|
272
344
|
export declare function flushPendingNoteRemovals(main: NotesHost, pending: NoteRemovals, host?: NoteRemovalHost): Promise<void>;
|
|
345
|
+
/** Adds the ids of the `w:commentReference` elements anywhere in a tree to `into`. */
|
|
346
|
+
export declare function commentReferencesIn(tree: unknown, into: Set<number>): void;
|
|
273
347
|
/**
|
|
274
348
|
* The insertion of a content control or custom XML element, when `items[i]` is a
|
|
275
349
|
* `w:customXmlInsRangeStart` and what follows is Word's form for one (check 30): the element, whose
|
|
276
350
|
* content starts with that marker's `w:customXmlInsRangeEnd` and ends with a second start, and that
|
|
277
|
-
* one's end right after the element
|
|
351
|
+
* one's end right after the element; or its deletion, the same form of `w:customXmlDelRangeStart` and
|
|
352
|
+
* `End` (check 54). Anything else is not one (a marker on its own is left alone).
|
|
278
353
|
*/
|
|
279
|
-
export declare function
|
|
354
|
+
export declare function holderChangeAt(items: Element[], i: number, paragraph: Paragraph | undefined, body?: Body): TrackedChange | undefined;
|
|
280
355
|
/**
|
|
281
356
|
* Word's form for a field inserted under tracking, when `items[i]` starts it: a `w:ins` that opens a
|
|
282
357
|
* field (a `w:fldChar` begin it does not end), then plain runs - the separator and the result - and
|
|
@@ -293,10 +368,64 @@ export declare function insertedFieldAt(items: Element[], i: number, paragraph:
|
|
|
293
368
|
*
|
|
294
369
|
* `fallbackToPrevious` is for the second case at the end of a container, where this package's
|
|
295
370
|
* inserted paragraph carries its own mark (section 13) and there is nothing after it to join
|
|
296
|
-
* with: the paragraph then goes, its content joining the one before.
|
|
297
|
-
*
|
|
371
|
+
* with: the paragraph then goes, its content joining the one before. Otherwise, with no paragraph
|
|
372
|
+
* next, a join never crosses a container's edge, and Word 365's Accept All (check 54 and the text-left
|
|
373
|
+
* probe, docx4j CR-043 section 17) does one of four things: an emptied paragraph with a table or a
|
|
374
|
+
* block control next goes; text left with a table next joins the table's first cell's first paragraph,
|
|
375
|
+
* which keeps its properties; with a block control next it takes the control's first paragraph's
|
|
376
|
+
* properties, nothing joined; a control's last paragraph keeps a bare mark. Else the mark is only dropped.
|
|
298
377
|
*/
|
|
299
378
|
export declare function joinWithNext(paragraph: Pick<Paragraph, 'container' | 'element' | 'p'>, fallbackToPrevious?: boolean): void;
|
|
379
|
+
/** The first paragraph of a table's first cell, where a paragraph joining into the table lands; docx4j's `firstCellParagraph`. */
|
|
380
|
+
export declare function firstCellParagraphOf(tbl: wml.Tbl): wml.P | undefined;
|
|
381
|
+
/**
|
|
382
|
+
* One piece of a move's markup, in document order: a range marker, a run-level half (`w:moveFrom`
|
|
383
|
+
* or `w:moveTo` around runs), or a moved paragraph's mark (`w:pPr/w:rPr/w:moveFrom` or `w:moveTo`).
|
|
384
|
+
*/
|
|
385
|
+
export type MovePiece = {
|
|
386
|
+
kind: 'start';
|
|
387
|
+
side: 'from' | 'to';
|
|
388
|
+
id: number;
|
|
389
|
+
name: string;
|
|
390
|
+
element: Element;
|
|
391
|
+
owner: Element[];
|
|
392
|
+
} | {
|
|
393
|
+
kind: 'end';
|
|
394
|
+
side: 'from' | 'to';
|
|
395
|
+
id: number;
|
|
396
|
+
element: Element;
|
|
397
|
+
owner: Element[];
|
|
398
|
+
} | {
|
|
399
|
+
kind: 'half';
|
|
400
|
+
side: 'from' | 'to';
|
|
401
|
+
element: Element;
|
|
402
|
+
owner: Element[];
|
|
403
|
+
names: string[];
|
|
404
|
+
} | {
|
|
405
|
+
kind: 'mark';
|
|
406
|
+
side: 'from' | 'to';
|
|
407
|
+
paragraph: Element<wml.P>;
|
|
408
|
+
container: Element[];
|
|
409
|
+
names: string[];
|
|
410
|
+
}
|
|
411
|
+
/** Anything else directly in a paragraph while a range is open: text typed into moved text, say. */
|
|
412
|
+
| {
|
|
413
|
+
kind: 'inner';
|
|
414
|
+
side: 'from' | 'to';
|
|
415
|
+
element: Element;
|
|
416
|
+
owner: Element[];
|
|
417
|
+
names: string[];
|
|
418
|
+
};
|
|
419
|
+
/**
|
|
420
|
+
* The story a paragraph is in, for its moves: the outermost array of block content above it (a body, a
|
|
421
|
+
* header, a note). A kept `mc:AlternateContent`'s selected branch is part of the story it stands in, as
|
|
422
|
+
* Word reads it; another branch is a story of its own, its list (docx4j's twin stories, its CR-051 phase
|
|
423
|
+
* 2; CR-013 phase 3), so a move is paired within the branch. `value` may be the paragraph or anything in
|
|
424
|
+
* it, a run-level branch's revision among them.
|
|
425
|
+
*/
|
|
426
|
+
export declare function storyOf(value: object): Element[];
|
|
427
|
+
/** Every piece of move markup in a story, in document order, each half and mark with the names of the ranges open over it. */
|
|
428
|
+
export declare function movePiecesOf(story: Element[]): MovePiece[];
|
|
300
429
|
/**
|
|
301
430
|
* The tracked changes of one paragraph, in document order, touching pieces grouped as Office JS
|
|
302
431
|
* groups them (`groupTouching`). Office JS lists the changes that start in the paragraph (check 22):
|
|
@@ -307,11 +436,40 @@ export declare function trackedChangesOfParagraph(paragraph: Paragraph): Tracked
|
|
|
307
436
|
/** Between two tracked changes: something unrevised - text, a paragraph mark, a table - that keeps them apart. */
|
|
308
437
|
export declare const BREAK: "break";
|
|
309
438
|
export type TrackedChangeToken = TrackedChange | typeof BREAK;
|
|
439
|
+
/**
|
|
440
|
+
* How a listing takes the branches of a kept `mc:AlternateContent` (CR-013 phase 3), docx4j's two
|
|
441
|
+
* `Lister`s: `'listed'`, the public listing, lists the selected branch's changes where the element stands
|
|
442
|
+
* and pairs each other branch's with them as twins (`pairTwins`), so that resolving a listed change
|
|
443
|
+
* resolves its twins; `'every'`, resolve-all's, lists every other branch's changes on their own, into
|
|
444
|
+
* `extra`, which the caller puts after the story's, so that each is resolved, matched by a filter on its
|
|
445
|
+
* own, and the selected branch's grouping is the public listing's.
|
|
446
|
+
*/
|
|
447
|
+
export interface Listing {
|
|
448
|
+
mode: 'listed' | 'every';
|
|
449
|
+
extra: TrackedChangeToken[];
|
|
450
|
+
}
|
|
451
|
+
/** The public listing's (`Listing`). */
|
|
452
|
+
export declare function listedListing(): Listing;
|
|
453
|
+
/**
|
|
454
|
+
* A kept `mc:AlternateContent`'s changes: its selected branch's into `into`, as Word reads them, keeping
|
|
455
|
+
* nothing apart (CR-013 phase 2); each other branch's paired with them as twins or, resolve-all's,
|
|
456
|
+
* listed on their own after the story's (`Listing`). `visit` lists one branch's items, at the element's
|
|
457
|
+
* level (blocks, rows, cells or runs).
|
|
458
|
+
*/
|
|
459
|
+
export declare function alternateTokens(ac: mce.AlternateContent, visit: (items: Element[], into: TrackedChangeToken[]) => void, into: TrackedChangeToken[], listing: Listing): void;
|
|
460
|
+
/**
|
|
461
|
+
* Another branch's changes attached to the listed branch's as twins, piece by piece: the n-th single
|
|
462
|
+
* change of a kind with the n-th of that kind, never by id, as docx4j pairs a text box's `mc:Fallback`
|
|
463
|
+
* changes and a branch's (its `Lister.pairTwins`; Word gives twins different ids). docx4j pairs the
|
|
464
|
+
* listed changes, groups included; pieces are paired here, since this listing groups the selected
|
|
465
|
+
* branch's with what touches the element, so a piece resolved on its own resolves its twin too.
|
|
466
|
+
*/
|
|
467
|
+
export declare function pairTwins(primary: readonly TrackedChangeToken[], twins: readonly TrackedChangeToken[]): void;
|
|
310
468
|
/**
|
|
311
469
|
* A paragraph's single changes in document order, its mark last, with a `BREAK` wherever unrevised
|
|
312
470
|
* content stands between two of them: `groupTouching` makes the groups from these.
|
|
313
471
|
*/
|
|
314
|
-
export declare function trackedChangeTokensOfParagraph(paragraph: Paragraph): TrackedChangeToken[];
|
|
472
|
+
export declare function trackedChangeTokensOfParagraph(paragraph: Paragraph, listing?: Listing): TrackedChangeToken[];
|
|
315
473
|
/**
|
|
316
474
|
* Tokens made into the changes Office JS lists: consecutive pieces of one kind (inserted, deleted, or
|
|
317
475
|
* a run's formatting) by one author, nothing unrevised between them, are one change (checks 22, 23
|
|
@@ -327,21 +485,22 @@ export declare function groupTouching(tokens: TrackedChangeToken[]): TrackedChan
|
|
|
327
485
|
*/
|
|
328
486
|
export declare function trackedChangesOfRow(tr: Element<wml.Tr>, owner: Element[], inner?: TrackedChange[], table?: Located<wml.Tbl>, body?: Body): TrackedChange[];
|
|
329
487
|
/** The change a table's property records make, one per table, or undefined when they make none. */
|
|
330
|
-
export declare function tablePropertiesChangeOf(tbl: Element<wml.Tbl
|
|
488
|
+
export declare function tablePropertiesChangeOf(tbl: Element<wml.Tbl>, body?: Body): TrackedChange | undefined;
|
|
331
489
|
/** A cell's own revision, `w:cellIns` or `w:cellDel`, or undefined. */
|
|
332
490
|
export declare function cellChangeOf(tc: Element<wml.Tc>, owner: Element[], tr: wml.Tr, body?: Body): TrackedChange | undefined;
|
|
333
491
|
/** The change to the body's last section (`w:body/w:sectPr/w:sectPrChange`), its text the section's paragraphs'. */
|
|
334
492
|
export declare function bodySectionChangeOf(container: {
|
|
335
493
|
content?: Element[];
|
|
336
494
|
sectPr?: wml.SectPr;
|
|
337
|
-
}): TrackedChange | undefined;
|
|
495
|
+
}, body?: Body): TrackedChange | undefined;
|
|
338
496
|
/**
|
|
339
497
|
* What `acceptAll` and `rejectAll` resolve that is never listed: a `w:cellMerge`, which Office JS
|
|
340
498
|
* cannot list (check 27: `getTrackedChanges` throws); a `w:numberingChange`, which Word no longer
|
|
341
499
|
* writes and drops when one is put in, and whose record is the old number's text, so that a reject
|
|
342
500
|
* too can only drop it; and a table's records that change nothing. A merge rejected gets the merge it
|
|
343
501
|
* recorded back (docx4j's reading; unmeasured). A `w:customXmlInsRangeStart` or `End` left without
|
|
344
|
-
* the form `
|
|
502
|
+
* the form `holderChangeAt` lists marks nothing that can be found, and goes either way. Every branch
|
|
503
|
+
* of a kept `mc:AlternateContent` at block, row and cell level is swept (CR-013 phase 3).
|
|
345
504
|
*/
|
|
346
505
|
export declare function resolveUnlisted(items: Element[], what: 'accept' | 'reject'): void;
|
|
347
506
|
export {};
|