@stll/docx-core 0.38.0 → 0.39.1
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/dist/{document-wNmygRXS.d.ts → document-BkGU2ctn.d.ts} +158 -68
- package/dist/{document-C02Ulybe.js → document-oU-dz9zs.js} +141 -1
- package/dist/docx_kernel_bg.wasm +0 -0
- package/dist/index.d.ts +30 -68
- package/dist/index.js +78 -33
- package/dist/model/document.d.ts +2 -2
- package/dist/model/document.js +1 -2
- package/dist/ops/documentOps.d.ts +356 -93
- package/dist/ops/documentOps.js +5937 -3887
- package/dist/projection.d.ts +15 -14
- package/dist/projection.js +8 -4
- package/dist/schema/sequenceChildren.d.ts +7 -7
- package/dist/schema/sequenceChildren.js +1 -2
- package/dist/{sequenceChildren-B8ODeI3J.js → sequenceChildren-9SUK1Tm1.js} +23 -4
- package/dist/zip/writeZipPart.d.ts +2 -2
- package/package.json +7 -8
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Result } from "better-result";
|
|
1
|
+
import { C as Relationship, D as StyleDefinitions, Dn as Run, Dt as HeaderFooter, Hr as NumberingInstance, Jn as TabContent, Jr as ParagraphFormatting, K as BlockContent, Mr as AbstractNumbering, Nn as Section, Oi as HeadingOutlineLevel, On as RunContent, Ot as HeaderFooterType, Pn as SectionProperties, Q as BreakContent, S as MediaFile, Vr as NumberingDefinitions, Y as BookmarkEnd, Yn as Table, a as DocumentSettings, dn as Paragraph, ei as TableCellFormatting, et as Comment, fn as ParagraphContent, g as ExhaustiveFields, gt as Endnote, hn as ParagraphPropertyChange, i as Document, ir as TableRow, jt as INSERTION_SEAM_POLICIES, li as TextFormatting, oi as TableRowFormatting, pn as ParagraphMarkChange, s as DocxPackage, ti as TableFormatting, ut as DocumentBody, wt as Footnote } from "../document-BkGU2ctn.js";
|
|
2
|
+
import { Result, TaggedErrorClass } from "better-result";
|
|
3
3
|
//#region src/ops/types.d.ts
|
|
4
4
|
/** JSON-safe map presence, including an explicitly undefined section map. */
|
|
5
5
|
type SectionMapState = {
|
|
@@ -54,12 +54,12 @@ type SectionViewChange = {
|
|
|
54
54
|
* and paragraph operations, and the review operations `setParagraphReview`,
|
|
55
55
|
* `replaceInline` and `resolveRevision`.
|
|
56
56
|
*/
|
|
57
|
-
declare const DOCUMENT_OP_SCHEMA_VERSION = 10;
|
|
57
|
+
export declare const DOCUMENT_OP_SCHEMA_VERSION = 10;
|
|
58
58
|
/**
|
|
59
59
|
* The main story has a fixed address; other editable parts use their stable
|
|
60
60
|
* relationship id or note id. Comment bodies are not yet editable stories.
|
|
61
61
|
*/
|
|
62
|
-
declare const OP_STORIES: Readonly<{
|
|
62
|
+
export declare const OP_STORIES: Readonly<{
|
|
63
63
|
readonly MAIN: "main";
|
|
64
64
|
}>;
|
|
65
65
|
/** The stable identity of an independently editable package story. */
|
|
@@ -105,7 +105,7 @@ type ParagraphPropsPatch = FormattingPatch<ParagraphFormatting>;
|
|
|
105
105
|
* empty set. The two state the same thing; the choice is how an inverse
|
|
106
106
|
* gives back a record in the spelling it had.
|
|
107
107
|
*/
|
|
108
|
-
declare const EMPTY_PROPERTY_SETS: Readonly<{
|
|
108
|
+
export declare const EMPTY_PROPERTY_SETS: Readonly<{
|
|
109
109
|
readonly OMIT: "omit";
|
|
110
110
|
readonly KEEP: "keep";
|
|
111
111
|
}>;
|
|
@@ -115,7 +115,7 @@ type EmptyPropertySet = (typeof EMPTY_PROPERTY_SETS)[keyof typeof EMPTY_PROPERTY
|
|
|
115
115
|
* Inserted text takes the properties of the run it joins: the run holding the
|
|
116
116
|
* unit before the position, or the one after it at the start of a paragraph.
|
|
117
117
|
*/
|
|
118
|
-
declare const INHERIT_RUN_PROPS = "inherit";
|
|
118
|
+
export declare const INHERIT_RUN_PROPS = "inherit";
|
|
119
119
|
/** The run properties inserted text carries. */
|
|
120
120
|
type InsertedRunProps = typeof INHERIT_RUN_PROPS | TextFormatting;
|
|
121
121
|
/**
|
|
@@ -170,7 +170,7 @@ declare const SECTION_BOUNDARY_POLICIES: Readonly<{
|
|
|
170
170
|
readonly REPLACE: "replace";
|
|
171
171
|
}>;
|
|
172
172
|
/** The operation kinds of schema version 10. */
|
|
173
|
-
declare const DOCUMENT_OP_TYPES: Readonly<{
|
|
173
|
+
export declare const DOCUMENT_OP_TYPES: Readonly<{
|
|
174
174
|
readonly CREATE_COMMENT: "createComment";
|
|
175
175
|
readonly UPDATE_COMMENT_CONTENT: "updateCommentContent";
|
|
176
176
|
readonly SET_COMMENT_RESOLUTION: "setCommentResolution";
|
|
@@ -319,7 +319,7 @@ type JoinInlineOp = {
|
|
|
319
319
|
depth: number;
|
|
320
320
|
};
|
|
321
321
|
/** Whether a tracked run patch appends an independently rejectable review. */
|
|
322
|
-
declare const PROPERTY_REVIEW_POLICIES: Readonly<{
|
|
322
|
+
export declare const PROPERTY_REVIEW_POLICIES: Readonly<{
|
|
323
323
|
readonly APPEND: "append";
|
|
324
324
|
}>;
|
|
325
325
|
/**
|
|
@@ -381,9 +381,9 @@ type SetParagraphPropsOp = {
|
|
|
381
381
|
* (`w:pPr/w:rPr`) rather than to the paragraph properties a `w:pPrChange`
|
|
382
382
|
* records.
|
|
383
383
|
*/
|
|
384
|
-
declare const PARAGRAPH_MARK_FORMATTING_KEYS: readonly ["runProperties", "runInWithNext"];
|
|
384
|
+
export declare const PARAGRAPH_MARK_FORMATTING_KEYS: readonly ["runProperties", "runInWithNext"];
|
|
385
385
|
/** Which half of a split, or of a join, a rule applies to. */
|
|
386
|
-
declare const SPLIT_HALVES: Readonly<{
|
|
386
|
+
export declare const SPLIT_HALVES: Readonly<{
|
|
387
387
|
readonly FIRST: "first";
|
|
388
388
|
readonly SECOND: "second";
|
|
389
389
|
}>;
|
|
@@ -570,7 +570,7 @@ type ReplaceInlineOp = {
|
|
|
570
570
|
content: readonly ParagraphContent[];
|
|
571
571
|
};
|
|
572
572
|
/** What resolving a tracked change does with it. */
|
|
573
|
-
declare const REVISION_DECISIONS: Readonly<{
|
|
573
|
+
export declare const REVISION_DECISIONS: Readonly<{
|
|
574
574
|
readonly ACCEPT: "accept";
|
|
575
575
|
readonly REJECT: "reject";
|
|
576
576
|
}>;
|
|
@@ -808,11 +808,15 @@ type AddNoteOp = {
|
|
|
808
808
|
type: typeof DOCUMENT_OP_TYPES.ADD_NOTE;
|
|
809
809
|
at: TextPosition;
|
|
810
810
|
note: Footnote | Endnote;
|
|
811
|
+
revision?: RevisionStamp;
|
|
812
|
+
newIds?: NewIds;
|
|
811
813
|
};
|
|
812
814
|
type RemoveNoteOp = {
|
|
813
815
|
type: typeof DOCUMENT_OP_TYPES.REMOVE_NOTE;
|
|
814
816
|
at: TextPosition;
|
|
815
817
|
story: NoteStory;
|
|
818
|
+
revision?: RevisionStamp;
|
|
819
|
+
newIds?: NewIds;
|
|
816
820
|
};
|
|
817
821
|
type SetSectionPropsOp = {
|
|
818
822
|
type: typeof DOCUMENT_OP_TYPES.SET_SECTION_PROPS;
|
|
@@ -996,7 +1000,7 @@ type DocumentOpEnvelope = {
|
|
|
996
1000
|
op: DocumentOp;
|
|
997
1001
|
};
|
|
998
1002
|
/** An operation in the envelope it is journaled and sent in. */
|
|
999
|
-
declare const toOpEnvelope: (op: DocumentOp) => DocumentOpEnvelope;
|
|
1003
|
+
export declare const toOpEnvelope: (op: DocumentOp) => DocumentOpEnvelope;
|
|
1000
1004
|
/** The blocks an operation changed, by id. */
|
|
1001
1005
|
type TouchedBlocks = {
|
|
1002
1006
|
modified: readonly string[];
|
|
@@ -1013,14 +1017,15 @@ type DocumentEdit = {
|
|
|
1013
1017
|
touched: TouchedBlocks;
|
|
1014
1018
|
};
|
|
1015
1019
|
/** Edits made in turn, starting from `document`, as one edit. */
|
|
1016
|
-
declare const combineEdits: (document: Document, edits: readonly DocumentEdit[]) => DocumentEdit;
|
|
1020
|
+
export declare const combineEdits: (document: Document, edits: readonly DocumentEdit[]) => DocumentEdit;
|
|
1017
1021
|
//#endregion
|
|
1018
1022
|
//#region src/ops/refusal.d.ts
|
|
1023
|
+
declare const DocumentOpRefusalBase: TaggedErrorClass<"DocumentOpRefusal">;
|
|
1019
1024
|
/**
|
|
1020
1025
|
* Why an operation was not applied. A refused operation changes nothing: the
|
|
1021
1026
|
* document it was applied to is returned as it was.
|
|
1022
1027
|
*/
|
|
1023
|
-
declare const DOCUMENT_OP_REFUSAL_REASONS: Readonly<{
|
|
1028
|
+
export declare const DOCUMENT_OP_REFUSAL_REASONS: Readonly<{
|
|
1024
1029
|
/** The journal envelope uses a schema this reader does not implement. */
|
|
1025
1030
|
readonly UNSUPPORTED_SCHEMA: "unsupportedSchema";
|
|
1026
1031
|
/** No paragraph in the story carries the id. */
|
|
@@ -1116,9 +1121,8 @@ declare const DOCUMENT_OP_REFUSAL_REASONS: Readonly<{
|
|
|
1116
1121
|
}>;
|
|
1117
1122
|
/** One of {@link DOCUMENT_OP_REFUSAL_REASONS}. */
|
|
1118
1123
|
type DocumentOpRefusalReason = (typeof DOCUMENT_OP_REFUSAL_REASONS)[keyof typeof DOCUMENT_OP_REFUSAL_REASONS];
|
|
1119
|
-
declare const DocumentOpRefusal_base: import("better-result").TaggedErrorClass<"DocumentOpRefusal">;
|
|
1120
1124
|
/** An operation the document cannot take as stated. */
|
|
1121
|
-
declare class DocumentOpRefusal extends
|
|
1125
|
+
export declare class DocumentOpRefusal extends DocumentOpRefusalBase<{
|
|
1122
1126
|
message: string;
|
|
1123
1127
|
reason: DocumentOpRefusalReason;
|
|
1124
1128
|
opType: DocumentOpType | undefined;
|
|
@@ -1132,45 +1136,85 @@ type Gap = {
|
|
|
1132
1136
|
};
|
|
1133
1137
|
/** A node of a paragraph's content tree: a paragraph child or a run child. */
|
|
1134
1138
|
type InlineNode = ParagraphContent | RunContent;
|
|
1139
|
+
/** Comment anchors are preserved by planned deletion and cannot be wrapped. */
|
|
1140
|
+
declare const COMMENT_ANCHOR_TYPES: {
|
|
1141
|
+
readonly commentRangeStart: true;
|
|
1142
|
+
readonly commentRangeEnd: true;
|
|
1143
|
+
readonly commentReference: true;
|
|
1144
|
+
};
|
|
1145
|
+
type CommentAnchorCarrier = Extract<InlineNode, {
|
|
1146
|
+
type: keyof typeof COMMENT_ANCHOR_TYPES;
|
|
1147
|
+
}>;
|
|
1148
|
+
/** Whether a leaf carries an anchor rather than content covered by its range. */
|
|
1149
|
+
export declare const isCommentAnchorCarrierType: (type: string) => boolean;
|
|
1135
1150
|
/** The zero-width leaves at an offset, in document order. */
|
|
1136
|
-
declare const zeroWidthLeavesAt: (items: readonly InlineNode[], offset: number) => InlineNode[];
|
|
1151
|
+
export declare const zeroWidthLeavesAt: (items: readonly InlineNode[], offset: number) => InlineNode[];
|
|
1137
1152
|
/**
|
|
1138
1153
|
* The gap an insertion defaults to: before the first zero-width leaf at the
|
|
1139
1154
|
* offset that opens a range, so a marker opening there stays with what
|
|
1140
1155
|
* follows it and every other one with what precedes it.
|
|
1141
1156
|
*/
|
|
1142
|
-
declare const defaultInsertionGap: (items: readonly InlineNode[], offset: number) => Gap;
|
|
1157
|
+
export declare const defaultInsertionGap: (items: readonly InlineNode[], offset: number) => Gap;
|
|
1143
1158
|
/** Source leaf coordinates without the ancestry needed by edit planning. */
|
|
1144
|
-
declare const inlineLeafSpans: (items: readonly InlineNode[]) => {
|
|
1159
|
+
export declare const inlineLeafSpans: (items: readonly InlineNode[]) => {
|
|
1145
1160
|
node: InlineNode;
|
|
1146
1161
|
before: Gap;
|
|
1147
1162
|
after: Gap;
|
|
1148
1163
|
}[];
|
|
1149
1164
|
/** Gaps in document order: by offset, then by the zero-width leaves before them. */
|
|
1150
|
-
declare const compareGaps: (left: Gap, right: Gap) => number;
|
|
1165
|
+
export declare const compareGaps: (left: Gap, right: Gap) => number;
|
|
1151
1166
|
//#endregion
|
|
1152
1167
|
//#region src/ops/comments.d.ts
|
|
1168
|
+
type CommentExhaustionInput = {
|
|
1169
|
+
type: "document";
|
|
1170
|
+
document: Document;
|
|
1171
|
+
id: number;
|
|
1172
|
+
} | {
|
|
1173
|
+
type: "coverage";
|
|
1174
|
+
anchorKind: Comment["anchorKind"];
|
|
1175
|
+
survivingNonCarrierContent: boolean;
|
|
1176
|
+
};
|
|
1177
|
+
/** Whether a statically ranged comment currently covers no document content. */
|
|
1178
|
+
export declare const isCommentExhausted: (input: CommentExhaustionInput) => boolean;
|
|
1179
|
+
/** Comment definitions whose root remains covered or projected, with replies. */
|
|
1180
|
+
export declare const survivingComments: (document: Document, projectedRootIds?: ReadonlySet<number>) => Comment[];
|
|
1181
|
+
/** Remove each supplied root and its recursive replies, preserving input order. */
|
|
1182
|
+
export declare const withoutCommentThreads: (comments: readonly Comment[], removedRootIds: ReadonlySet<number>) => Comment[];
|
|
1153
1183
|
/**
|
|
1154
1184
|
* Shared loaded-comment activation contract; legacy parentId revision associations stay explicit.
|
|
1155
1185
|
* `allowedOrphans` names unanchored root comments the caller accepts ("all" for a loaded package).
|
|
1156
1186
|
*/
|
|
1157
|
-
declare const commentDocumentIssue: (document: Document, allowedOrphans?: ReadonlySet<number> | "all") => string | undefined;
|
|
1187
|
+
export declare const commentDocumentIssue: (document: Document, allowedOrphans?: ReadonlySet<number> | "all") => string | undefined;
|
|
1158
1188
|
/** Allocate from the package's annotation domains without a hidden mutable counter. */
|
|
1159
|
-
declare const freshCommentId: (document: Document) => Result<number, DocumentOpRefusal>;
|
|
1189
|
+
export declare const freshCommentId: (document: Document) => Result<number, DocumentOpRefusal>;
|
|
1160
1190
|
/** Reconcile modeled comment and numbering parts with their document relationships. */
|
|
1161
|
-
declare const reconcileDocumentPartRelationships: (document: Document) => Document;
|
|
1191
|
+
export declare const reconcileDocumentPartRelationships: (document: Document) => Document;
|
|
1192
|
+
//#endregion
|
|
1193
|
+
//#region src/ops/copyOriginAncestors.d.ts
|
|
1194
|
+
type CopyOriginAncestorList = NonNullable<BookmarkEnd["copyOriginAncestors"]>;
|
|
1195
|
+
export declare const isCopyOriginAncestors: (value: unknown) => value is CopyOriginAncestorList;
|
|
1196
|
+
export declare const shiftCopyOriginAncestors: (origins: CopyOriginAncestorList | undefined, insertedOrdinal: number) => CopyOriginAncestorList | undefined;
|
|
1197
|
+
export declare const addCopyOriginAncestor: (origins: CopyOriginAncestorList | undefined, addedOrdinal: number) => CopyOriginAncestorList | undefined;
|
|
1198
|
+
export declare const acceptCopyOriginAncestors: (origins: CopyOriginAncestorList | undefined, acceptedOrdinal: number) => CopyOriginAncestorList | undefined;
|
|
1199
|
+
type RejectedCopyOriginAncestors = {
|
|
1200
|
+
type: "drop";
|
|
1201
|
+
} | {
|
|
1202
|
+
type: "retain";
|
|
1203
|
+
copyOriginAncestors?: CopyOriginAncestorList;
|
|
1204
|
+
};
|
|
1205
|
+
export declare const rejectCopyOriginAncestors: (origins: CopyOriginAncestorList | undefined, removedAddedAncestors: number) => RejectedCopyOriginAncestors;
|
|
1162
1206
|
//#endregion
|
|
1163
1207
|
//#region src/ops/noteMarks.d.ts
|
|
1164
|
-
declare const noteUsesCustomMark: (document: Document, note: Footnote | Endnote) => boolean;
|
|
1208
|
+
export declare const noteUsesCustomMark: (document: Document, note: Footnote | Endnote) => boolean;
|
|
1165
1209
|
//#endregion
|
|
1166
1210
|
//#region src/ops/storyLifecycle.d.ts
|
|
1167
|
-
declare const sectionPropertiesAt: (document: Document, sectionIndex: number) => SectionProperties | undefined;
|
|
1211
|
+
export declare const sectionPropertiesAt: (document: Document, sectionIndex: number) => SectionProperties | undefined;
|
|
1168
1212
|
//#endregion
|
|
1169
1213
|
//#region src/ops/stories.d.ts
|
|
1170
|
-
declare const sameStory: (left: OpStory, right: OpStory) => boolean;
|
|
1171
|
-
declare const findStoryBody: (document: Document, story: OpStory) => DocumentBody | undefined;
|
|
1172
|
-
declare const storyBody: (document: Document, story: OpStory) => DocumentBody;
|
|
1173
|
-
declare const documentStories: (document: Document) => OpStory[];
|
|
1214
|
+
export declare const sameStory: (left: OpStory, right: OpStory) => boolean;
|
|
1215
|
+
export declare const findStoryBody: (document: Document, story: OpStory) => DocumentBody | undefined;
|
|
1216
|
+
export declare const storyBody: (document: Document, story: OpStory) => DocumentBody;
|
|
1217
|
+
export declare const documentStories: (document: Document) => OpStory[];
|
|
1174
1218
|
//#endregion
|
|
1175
1219
|
//#region src/ops/blocks.d.ts
|
|
1176
1220
|
/**
|
|
@@ -1178,11 +1222,190 @@ declare const documentStories: (document: Document) => OpStory[];
|
|
|
1178
1222
|
* that does not line up with the blocks (a different section count) is left
|
|
1179
1223
|
* for {@link sectionsInStep} to report.
|
|
1180
1224
|
*/
|
|
1181
|
-
declare const withBodyContent: (body: DocumentBody, content: BlockContent[]) => DocumentBody;
|
|
1225
|
+
export declare const withBodyContent: (body: DocumentBody, content: BlockContent[]) => DocumentBody;
|
|
1226
|
+
//#endregion
|
|
1227
|
+
//#region src/ops/offsets.d.ts
|
|
1228
|
+
/**
|
|
1229
|
+
* The zero-width items a paragraph can hold, and whether each is content its
|
|
1230
|
+
* mark must not take away. None is. A range boundary is a position, not
|
|
1231
|
+
* content: a paragraph that goes leaves it where the paragraph was
|
|
1232
|
+
* (`paragraphRemains` in `rangeBoundaries.ts`), so it keeps no blank
|
|
1233
|
+
* paragraph standing. A comment reference remains one logical offset unit,
|
|
1234
|
+
* but moves as an anchor when its paragraph goes. A cached page break and a
|
|
1235
|
+
* note's own marker mark nothing a reader placed.
|
|
1236
|
+
*/
|
|
1237
|
+
declare const ZERO_WIDTH_ITEMS_HOLD_CONTENT: {
|
|
1238
|
+
readonly commentReference: false;
|
|
1239
|
+
readonly bookmarkStart: false;
|
|
1240
|
+
readonly bookmarkEnd: false;
|
|
1241
|
+
readonly commentRangeStart: false;
|
|
1242
|
+
readonly commentRangeEnd: false;
|
|
1243
|
+
readonly moveFromRangeStart: false;
|
|
1244
|
+
readonly moveFromRangeEnd: false;
|
|
1245
|
+
readonly moveToRangeStart: false;
|
|
1246
|
+
readonly moveToRangeEnd: false;
|
|
1247
|
+
readonly renderedPageBreak: false;
|
|
1248
|
+
readonly noteMarker: false;
|
|
1249
|
+
};
|
|
1250
|
+
/** A zero-width item the paragraph-content rule classifies. */
|
|
1251
|
+
type ZeroWidthItem = keyof typeof ZERO_WIDTH_ITEMS_HOLD_CONTENT;
|
|
1252
|
+
declare const paragraphContentBrand: unique symbol;
|
|
1253
|
+
/**
|
|
1254
|
+
* Whether a paragraph holds content its mark must not take away. Only
|
|
1255
|
+
* {@link paragraphContentVerdict} makes one, so every paragraph-mark outcome,
|
|
1256
|
+
* in the engine and in the editor, is decided by the same rule.
|
|
1257
|
+
*/
|
|
1258
|
+
type ParagraphContentVerdict = boolean & {
|
|
1259
|
+
readonly [paragraphContentBrand]: true;
|
|
1260
|
+
};
|
|
1261
|
+
/** The one paragraph-content rule: any width, or a zero-width item that is content. */
|
|
1262
|
+
export declare const paragraphContentVerdict: ({ width, zeroWidthItems }: {
|
|
1263
|
+
width: number;
|
|
1264
|
+
zeroWidthItems: Iterable<ZeroWidthItem>;
|
|
1265
|
+
}) => ParagraphContentVerdict;
|
|
1266
|
+
/** The number of logical units in a paragraph: its largest valid offset. */
|
|
1267
|
+
export declare const paragraphLength: (paragraph: Paragraph) => number;
|
|
1268
|
+
/** The character a unit that is not run text stands for in {@link paragraphLogicalText}. */
|
|
1269
|
+
export declare const OBJECT_REPLACEMENT_CHARACTER = "";
|
|
1270
|
+
/**
|
|
1271
|
+
* The paragraph's offset space as a string: run text as it stands and
|
|
1272
|
+
* {@link OBJECT_REPLACEMENT_CHARACTER} for every other unit, so index `i` of
|
|
1273
|
+
* the string is unit `i` of the paragraph.
|
|
1274
|
+
*/
|
|
1275
|
+
export declare const paragraphLogicalText: (paragraph: Paragraph) => string;
|
|
1276
|
+
//#endregion
|
|
1277
|
+
//#region src/ops/blockDeletion.d.ts
|
|
1278
|
+
/** The single structural outcome of resolving a paragraph mark. */
|
|
1279
|
+
export declare const paragraphMarkOutcome: ({ follows, holdsContent, markWasAdded, containerStillEndsWithParagraph, followingTableCanReceiveRunIn, needsFollowingCommentHost, tableRemovalIsTrackable, removedSectionProperties, precedingSectionOwner, followingHasSectionProperties }: {
|
|
1280
|
+
follows: "paragraph" | "table" | "nothing";
|
|
1281
|
+
/** From {@link paragraphHoldsContent} or the editor's view of the same rule, never re-derived. */
|
|
1282
|
+
holdsContent: ParagraphContentVerdict;
|
|
1283
|
+
markWasAdded: boolean;
|
|
1284
|
+
/**
|
|
1285
|
+
* Read only when nothing follows: whether the block BEFORE this paragraph,
|
|
1286
|
+
* which becomes the container's last block once this one is removed, is a
|
|
1287
|
+
* paragraph. Never the container's current last child, which is this one.
|
|
1288
|
+
*/
|
|
1289
|
+
containerStillEndsWithParagraph: boolean;
|
|
1290
|
+
followingTableCanReceiveRunIn: boolean;
|
|
1291
|
+
needsFollowingCommentHost?: boolean;
|
|
1292
|
+
tableRemovalIsTrackable?: boolean;
|
|
1293
|
+
removedSectionProperties?: boolean;
|
|
1294
|
+
precedingSectionOwner?: "unavailable" | "available" | "same" | "occupied";
|
|
1295
|
+
followingHasSectionProperties?: boolean;
|
|
1296
|
+
}) => ({
|
|
1297
|
+
kind: "join";
|
|
1298
|
+
} & SectionTransfer) | ({
|
|
1299
|
+
kind: "remove";
|
|
1300
|
+
} & SectionTransfer) | ({
|
|
1301
|
+
kind: "run-in";
|
|
1302
|
+
} & SectionTransfer) | ({
|
|
1303
|
+
kind: "keep";
|
|
1304
|
+
} & SectionTransfer) | ({
|
|
1305
|
+
kind: "refuse";
|
|
1306
|
+
reason: "untrackable";
|
|
1307
|
+
} & SectionTransfer);
|
|
1308
|
+
type SectionTransfer = {
|
|
1309
|
+
sectionDestination: "none" | "preceding" | "following";
|
|
1310
|
+
};
|
|
1311
|
+
//#endregion
|
|
1312
|
+
//#region src/ops/rangeBoundaries.d.ts
|
|
1313
|
+
declare const BOUNDARY_SIDES: {
|
|
1314
|
+
readonly bookmarkStart: {
|
|
1315
|
+
readonly family: "bookmark";
|
|
1316
|
+
readonly side: "start";
|
|
1317
|
+
};
|
|
1318
|
+
readonly bookmarkEnd: {
|
|
1319
|
+
readonly family: "bookmark";
|
|
1320
|
+
readonly side: "end";
|
|
1321
|
+
};
|
|
1322
|
+
readonly commentRangeStart: {
|
|
1323
|
+
readonly family: "comment";
|
|
1324
|
+
readonly side: "start";
|
|
1325
|
+
};
|
|
1326
|
+
readonly commentRangeEnd: {
|
|
1327
|
+
readonly family: "comment";
|
|
1328
|
+
readonly side: "end";
|
|
1329
|
+
};
|
|
1330
|
+
readonly moveFromRangeStart: {
|
|
1331
|
+
readonly family: "moveFrom";
|
|
1332
|
+
readonly side: "start";
|
|
1333
|
+
};
|
|
1334
|
+
readonly moveFromRangeEnd: {
|
|
1335
|
+
readonly family: "moveFrom";
|
|
1336
|
+
readonly side: "end";
|
|
1337
|
+
};
|
|
1338
|
+
readonly moveToRangeStart: {
|
|
1339
|
+
readonly family: "moveTo";
|
|
1340
|
+
readonly side: "start";
|
|
1341
|
+
};
|
|
1342
|
+
readonly moveToRangeEnd: {
|
|
1343
|
+
readonly family: "moveTo";
|
|
1344
|
+
readonly side: "end";
|
|
1345
|
+
};
|
|
1346
|
+
};
|
|
1347
|
+
type BoundaryType = keyof typeof BOUNDARY_SIDES;
|
|
1348
|
+
type Boundary = Extract<InlineNode, {
|
|
1349
|
+
type: BoundaryType;
|
|
1350
|
+
}>;
|
|
1351
|
+
type CommentAnchor$1 = CommentAnchorCarrier;
|
|
1352
|
+
/** A boundary a block list holds between its blocks. */
|
|
1353
|
+
type BlockBoundary = Exclude<Boundary, CommentAnchor$1>;
|
|
1354
|
+
/**
|
|
1355
|
+
* What a paragraph that goes whole leaves where it was: every bookmark and
|
|
1356
|
+
* move range boundary it holds, at any depth, as blocks in its place, and its
|
|
1357
|
+
* comment anchors for the nearest paragraph that stays to take. When a
|
|
1358
|
+
* comment needs that host, every carrier travels there together in source
|
|
1359
|
+
* order. A comment with both anchors there becomes a point there, so the
|
|
1360
|
+
* comment and its anchor survive the paragraph.
|
|
1361
|
+
*/
|
|
1362
|
+
export declare const paragraphRemains: (content: readonly InlineNode[]) => {
|
|
1363
|
+
all: (Boundary | CommentAnchor$1)[];
|
|
1364
|
+
blocks: BlockBoundary[];
|
|
1365
|
+
comments: CommentAnchor$1[];
|
|
1366
|
+
placement: "blocks" | "previous";
|
|
1367
|
+
};
|
|
1368
|
+
/** One range boundary in document order, as {@link planWellFormedRanges} reads it. */
|
|
1369
|
+
type BoundaryOccurrence = {
|
|
1370
|
+
/** The marker's element and id: what two copies of one boundary share. */
|
|
1371
|
+
boundary: string;
|
|
1372
|
+
/** The range it belongs to: its family and id. */
|
|
1373
|
+
range: string;
|
|
1374
|
+
side: "start" | "end";
|
|
1375
|
+
/** Whether a rejection kept it from removed content. */
|
|
1376
|
+
kept: boolean;
|
|
1377
|
+
/**
|
|
1378
|
+
* The date of the revision a kept boundary came from. Of a kept start and
|
|
1379
|
+
* end out of order, the one kept from the later revision moves: that edit
|
|
1380
|
+
* put it out of order, and the earlier one stays where it was.
|
|
1381
|
+
*/
|
|
1382
|
+
keptFrom?: string;
|
|
1383
|
+
};
|
|
1384
|
+
/** What makes kept boundaries' ranges well-formed, by index into the occurrences. */
|
|
1385
|
+
type WellFormedRangePlan = {
|
|
1386
|
+
dropped: number[];
|
|
1387
|
+
/** Each kept boundary that moves to just before or after the other end of its range. */
|
|
1388
|
+
moved: {
|
|
1389
|
+
moving: number;
|
|
1390
|
+
anchor: number;
|
|
1391
|
+
side: "before" | "after";
|
|
1392
|
+
}[];
|
|
1393
|
+
};
|
|
1394
|
+
/**
|
|
1395
|
+
* The one rule that makes every range a rejection kept boundaries of
|
|
1396
|
+
* well-formed, for the engine's model and the editor's document alike. A
|
|
1397
|
+
* kept copy of a boundary the story still holds is no boundary of its own and
|
|
1398
|
+
* goes (of several kept copies, the first stays); then, where such a range's
|
|
1399
|
+
* end comes before its start, the half the rejection kept closes on the
|
|
1400
|
+
* other: a kept end moves to just after the start, or else a kept start to
|
|
1401
|
+
* just before the end. A boundary that was standing never moves, and a range
|
|
1402
|
+
* still with more than one start or end is left as it is.
|
|
1403
|
+
*/
|
|
1404
|
+
export declare const planWellFormedRanges: (occurrences: readonly BoundaryOccurrence[]) => WellFormedRangePlan;
|
|
1182
1405
|
//#endregion
|
|
1183
1406
|
//#region src/ops/wire.d.ts
|
|
1184
1407
|
/** Capture own undefined fields before an operation enters its JSON journal. */
|
|
1185
|
-
declare const captureDocumentOp: (op: DocumentOp) => DocumentOp;
|
|
1408
|
+
export declare const captureDocumentOp: (op: DocumentOp) => DocumentOp;
|
|
1186
1409
|
//#endregion
|
|
1187
1410
|
//#region src/ops/hyperlinkIntent.d.ts
|
|
1188
1411
|
type HyperlinkEditorIntent = {
|
|
@@ -1300,7 +1523,7 @@ type CompiledEditorIntent = {
|
|
|
1300
1523
|
/** A split's paragraph identity is allocated with its other fresh identities. */
|
|
1301
1524
|
type EditorIntentAllocation = EditorIntent | SplitParagraphIntent;
|
|
1302
1525
|
/** Cache only immutable document versions; never retain a retired version strongly. */
|
|
1303
|
-
declare const createEditorIntentIdAllocator: () => (document: Document, intent: EditorIntentAllocation) => {
|
|
1526
|
+
export declare const createEditorIntentIdAllocator: () => (document: Document, intent: EditorIntentAllocation) => {
|
|
1304
1527
|
revisionId: number;
|
|
1305
1528
|
newBlockId: string;
|
|
1306
1529
|
newIds: {
|
|
@@ -1309,25 +1532,25 @@ declare const createEditorIntentIdAllocator: () => (document: Document, intent:
|
|
|
1309
1532
|
};
|
|
1310
1533
|
};
|
|
1311
1534
|
/** Accepted-view text without changing the canonical paragraph or its offset space. */
|
|
1312
|
-
declare const paragraphVisibleText: (paragraph: Paragraph) => string;
|
|
1535
|
+
export declare const paragraphVisibleText: (paragraph: Paragraph) => string;
|
|
1313
1536
|
/**
|
|
1314
1537
|
* Right-affine translation: a visible gap follows retained deleted content at
|
|
1315
1538
|
* that gap, so a new insertion never lands inside a deletion wrapper.
|
|
1316
1539
|
* Invalid offsets remain invalid for the operation boundary to diagnose.
|
|
1317
1540
|
*/
|
|
1318
|
-
declare const physicalOffsetAtVisibleOffset: (paragraph: Paragraph, offset: number) => number;
|
|
1541
|
+
export declare const physicalOffsetAtVisibleOffset: (paragraph: Paragraph, offset: number) => number;
|
|
1319
1542
|
/** Deleted paragraph marks concatenate physical paragraphs in the editing view. */
|
|
1320
|
-
declare const editorParagraphGroups: (document: Document, story: OpStory) => {
|
|
1543
|
+
export declare const editorParagraphGroups: (document: Document, story: OpStory) => {
|
|
1321
1544
|
blockId: string;
|
|
1322
1545
|
paragraphs: Paragraph[];
|
|
1323
1546
|
text: string;
|
|
1324
1547
|
}[];
|
|
1325
1548
|
/** One logical paragraph and visible offset for a physical canonical address. */
|
|
1326
|
-
declare const editorPositionAtPhysicalPosition: (document: Document, at: TextPosition) => TextPosition;
|
|
1549
|
+
export declare const editorPositionAtPhysicalPosition: (document: Document, at: TextPosition) => TextPosition;
|
|
1327
1550
|
/** Translate an editing-view paragraph gap to its physical canonical address. */
|
|
1328
|
-
declare const physicalPositionAtEditorOffset: (document: Document, at: TextPosition) => TextPosition;
|
|
1551
|
+
export declare const physicalPositionAtEditorOffset: (document: Document, at: TextPosition) => TextPosition;
|
|
1329
1552
|
/** Compile one batch; the caller applies it atomically and journals its exact inverse. */
|
|
1330
|
-
declare const compileEditorIntent: (document: Document, { intent, mode, firstBlockId }: CompileEditorIntentOptions) => Result<CompiledEditorIntent, DocumentOpRefusal>;
|
|
1553
|
+
export declare const compileEditorIntent: (document: Document, { intent, mode, firstBlockId }: CompileEditorIntentOptions) => Result<CompiledEditorIntent, DocumentOpRefusal>;
|
|
1331
1554
|
//#endregion
|
|
1332
1555
|
//#region src/ops/tocIntent.d.ts
|
|
1333
1556
|
type TocHeading = {
|
|
@@ -1346,7 +1569,7 @@ type GenerateTOCIntent = {
|
|
|
1346
1569
|
tabPosition: number;
|
|
1347
1570
|
};
|
|
1348
1571
|
/** Map original endpoints through the bookmark wrappers emitted by TOC compilation. */
|
|
1349
|
-
declare const mapTocBookmarkPosition: (position: TextPosition, ops: readonly DocumentOp[]) => TextPosition;
|
|
1572
|
+
export declare const mapTocBookmarkPosition: (position: TextPosition, ops: readonly DocumentOp[]) => TextPosition;
|
|
1350
1573
|
//#endregion
|
|
1351
1574
|
//#region src/ops/packageResources.d.ts
|
|
1352
1575
|
type PackageResourcesOpOptions = {
|
|
@@ -1354,7 +1577,7 @@ type PackageResourcesOpOptions = {
|
|
|
1354
1577
|
after: Document;
|
|
1355
1578
|
};
|
|
1356
1579
|
/** Describe the package resource difference as one operation carrying only changed entries. */
|
|
1357
|
-
declare const packageResourcesOpOf: ({ before, after }: PackageResourcesOpOptions) => SetPackageResourcesOp;
|
|
1580
|
+
export declare const packageResourcesOpOf: ({ before, after }: PackageResourcesOpOptions) => SetPackageResourcesOp;
|
|
1358
1581
|
//#endregion
|
|
1359
1582
|
//#region src/ops/paragraphPropertySnapshot.d.ts
|
|
1360
1583
|
type RegisterParagraphPropertySnapshotOptions = {
|
|
@@ -1362,7 +1585,7 @@ type RegisterParagraphPropertySnapshotOptions = {
|
|
|
1362
1585
|
snapshot: ParagraphFormatting | undefined;
|
|
1363
1586
|
};
|
|
1364
1587
|
/** Bind effective formatting to the authored properties a review must record. */
|
|
1365
|
-
declare const registerParagraphPropertySnapshot: ({ paragraph, snapshot }: RegisterParagraphPropertySnapshotOptions) => void;
|
|
1588
|
+
export declare const registerParagraphPropertySnapshot: ({ paragraph, snapshot }: RegisterParagraphPropertySnapshotOptions) => void;
|
|
1366
1589
|
//#endregion
|
|
1367
1590
|
//#region src/ops/apply.d.ts
|
|
1368
1591
|
/** A document an operation produced, the operations that undo it, and what it changed. */
|
|
@@ -1379,9 +1602,9 @@ type AppliedDocumentOp = {
|
|
|
1379
1602
|
revisions: readonly number[];
|
|
1380
1603
|
};
|
|
1381
1604
|
/** Apply one operation to a document that meets the seed contract. */
|
|
1382
|
-
declare const applyDocumentOp: (document: Document, input: DocumentOp) => Result<AppliedDocumentOp, DocumentOpRefusal>;
|
|
1605
|
+
export declare const applyDocumentOp: (document: Document, input: DocumentOp) => Result<AppliedDocumentOp, DocumentOpRefusal>;
|
|
1383
1606
|
/** Apply a journal envelope only when its schema matches this reader. */
|
|
1384
|
-
declare const applyDocumentOpEnvelope: (document: Document, envelope: {
|
|
1607
|
+
export declare const applyDocumentOpEnvelope: (document: Document, envelope: {
|
|
1385
1608
|
schema: number;
|
|
1386
1609
|
op: DocumentOp;
|
|
1387
1610
|
}) => Result<AppliedDocumentOp, DocumentOpRefusal>;
|
|
@@ -1390,7 +1613,7 @@ declare const applyDocumentOpEnvelope: (document: Document, envelope: {
|
|
|
1390
1613
|
* the document is unchanged. The inverse undoes the whole list, and
|
|
1391
1614
|
* `revisions` lists each operation's in turn.
|
|
1392
1615
|
*/
|
|
1393
|
-
declare const applyDocumentOps: (document: Document, ops: readonly DocumentOp[]) => Result<AppliedDocumentOp, DocumentOpRefusal>;
|
|
1616
|
+
export declare const applyDocumentOps: (document: Document, ops: readonly DocumentOp[]) => Result<AppliedDocumentOp, DocumentOpRefusal>;
|
|
1394
1617
|
//#endregion
|
|
1395
1618
|
//#region src/ops/runMerge.d.ts
|
|
1396
1619
|
/**
|
|
@@ -1408,12 +1631,12 @@ type ComparedTextFormatting = ExhaustiveFields<TextFormatting, ComparedTextForma
|
|
|
1408
1631
|
* Uses deep comparison of all properties to determine if runs
|
|
1409
1632
|
* can be merged without losing formatting information.
|
|
1410
1633
|
*/
|
|
1411
|
-
declare function formattingEquals(a: ComparedTextFormatting | undefined, b: ComparedTextFormatting | undefined): boolean;
|
|
1634
|
+
export declare function formattingEquals(a: ComparedTextFormatting | undefined, b: ComparedTextFormatting | undefined): boolean;
|
|
1412
1635
|
/**
|
|
1413
1636
|
* Check if a run contains only text content
|
|
1414
1637
|
* (runs with special content like images, fields, etc. should not be merged)
|
|
1415
1638
|
*/
|
|
1416
|
-
declare function isTextOnlyRun(run: Run): boolean;
|
|
1639
|
+
export declare function isTextOnlyRun(run: Run): boolean;
|
|
1417
1640
|
/**
|
|
1418
1641
|
* Every `Run` field, named by what a merge does with it.
|
|
1419
1642
|
*
|
|
@@ -1421,17 +1644,7 @@ declare function isTextOnlyRun(run: Run): boolean;
|
|
|
1421
1644
|
* is carried over from one side by default. Naming each one here forces the
|
|
1422
1645
|
* next field to state whether that default is right before it can compile.
|
|
1423
1646
|
*/
|
|
1424
|
-
type MergeDecidedRunField =
|
|
1425
|
-
/** Identical for every run. */
|
|
1426
|
-
"type" |
|
|
1427
|
-
/** Concatenated; see {@link mergeRunContent}. */
|
|
1428
|
-
"content" |
|
|
1429
|
-
/** Must be equal, and the survivor keeps it. */
|
|
1430
|
-
"formatting" |
|
|
1431
|
-
/** Must be equal, and the survivor keeps it. */
|
|
1432
|
-
"preservedAttributes" |
|
|
1433
|
-
/** Refuses the merge outright; see {@link canMergeRun}. */
|
|
1434
|
-
"propertyChanges";
|
|
1647
|
+
type MergeDecidedRunField = "type" | "content" | "formatting" | "preservedAttributes" | "propertyChanges";
|
|
1435
1648
|
type MergeDecidedRun = ExhaustiveFields<Run, MergeDecidedRunField>;
|
|
1436
1649
|
/**
|
|
1437
1650
|
* May two adjacent runs become one?
|
|
@@ -1444,59 +1657,49 @@ type MergeDecidedRun = ExhaustiveFields<Run, MergeDecidedRunField>;
|
|
|
1444
1657
|
* of them discards the loser's copy, which is how both runs' `w:rsid*` used to
|
|
1445
1658
|
* vanish at parse time — before the editor, before any gate could see it.
|
|
1446
1659
|
*/
|
|
1447
|
-
declare function runsMergeable(a: MergeDecidedRun, b: MergeDecidedRun): boolean;
|
|
1660
|
+
export declare function runsMergeable(a: MergeDecidedRun, b: MergeDecidedRun): boolean;
|
|
1448
1661
|
/**
|
|
1449
1662
|
* Merge the content of two runs into a single content array
|
|
1450
1663
|
*/
|
|
1451
|
-
declare function mergeRunContent(content1: RunContent[], content2: RunContent[]): RunContent[];
|
|
1664
|
+
export declare function mergeRunContent(content1: RunContent[], content2: RunContent[]): RunContent[];
|
|
1452
1665
|
//#endregion
|
|
1453
1666
|
//#region src/ops/contract.d.ts
|
|
1454
|
-
declare const
|
|
1667
|
+
declare const DocumentOpsContractErrorBase: TaggedErrorClass<"DocumentOpsContractError">;
|
|
1455
1668
|
/** A document that does not meet the seed contract. */
|
|
1456
|
-
declare class DocumentOpsContractError extends
|
|
1669
|
+
export declare class DocumentOpsContractError extends DocumentOpsContractErrorBase<{
|
|
1457
1670
|
message: string;
|
|
1458
1671
|
reason: DocumentOpRefusalReason;
|
|
1459
1672
|
}> {}
|
|
1460
1673
|
/** Check a document against the seed contract. */
|
|
1461
|
-
declare const validateOpsDocument: (document: Document) => Result<Document, DocumentOpsContractError>;
|
|
1674
|
+
export declare const validateOpsDocument: (document: Document) => Result<Document, DocumentOpsContractError>;
|
|
1462
1675
|
/**
|
|
1463
1676
|
* The document with every empty run and empty text node of each editable story
|
|
1464
1677
|
* removed, and its section view derived again. Nothing else changes.
|
|
1465
1678
|
*/
|
|
1466
|
-
declare const normalizeForOps: (document: Document) => Document;
|
|
1467
|
-
//#endregion
|
|
1468
|
-
//#region src/ops/offsets.d.ts
|
|
1469
|
-
/** The number of logical units in a paragraph: its largest valid offset. */
|
|
1470
|
-
declare const paragraphLength: (paragraph: Paragraph) => number;
|
|
1471
|
-
/** The character a unit that is not run text stands for in {@link paragraphLogicalText}. */
|
|
1472
|
-
declare const OBJECT_REPLACEMENT_CHARACTER = "";
|
|
1473
|
-
/**
|
|
1474
|
-
* The paragraph's offset space as a string: run text as it stands and
|
|
1475
|
-
* {@link OBJECT_REPLACEMENT_CHARACTER} for every other unit, so index `i` of
|
|
1476
|
-
* the string is unit `i` of the paragraph.
|
|
1477
|
-
*/
|
|
1478
|
-
declare const paragraphLogicalText: (paragraph: Paragraph) => string;
|
|
1679
|
+
export declare const normalizeForOps: (document: Document) => Document;
|
|
1479
1680
|
//#endregion
|
|
1480
1681
|
//#region src/ops/ids.d.ts
|
|
1682
|
+
/** Every `paraId` of every paragraph in a value, nested ones included, in document order. */
|
|
1683
|
+
export declare const paragraphIdsIn: (value: unknown) => string[];
|
|
1481
1684
|
/** Every paragraph id of a package, each story walked once. */
|
|
1482
|
-
declare const packageParagraphIds: (pkg: DocxPackage) => string[];
|
|
1685
|
+
export declare const packageParagraphIds: (pkg: DocxPackage) => string[];
|
|
1483
1686
|
/**
|
|
1484
1687
|
* The key two spellings of one id share. `ST_LongHexNumber` is hex, so
|
|
1485
1688
|
* `0000abcd` and `0000ABCD` are the same id; every lookup and comparison of
|
|
1486
1689
|
* paragraph ids goes through this.
|
|
1487
1690
|
*/
|
|
1488
|
-
declare const idKey: (id: string) => string;
|
|
1691
|
+
export declare const idKey: (id: string) => string;
|
|
1489
1692
|
//#endregion
|
|
1490
1693
|
//#region src/ops/plan.d.ts
|
|
1491
1694
|
/** Package-aware explicit pools for every semantic comment anchor cut, including replies. */
|
|
1492
|
-
declare const allocateCommentAnchorIds: (document: Document, op: CreateCommentOp) => Result<NewIds, DocumentOpRefusal>;
|
|
1695
|
+
export declare const allocateCommentAnchorIds: (document: Document, op: CreateCommentOp) => Result<NewIds, DocumentOpRefusal>;
|
|
1493
1696
|
/**
|
|
1494
1697
|
* How many `newIds.revision` entries an operation takes on a document,
|
|
1495
1698
|
* besides its stamp's id: the length of the shortest list of unused ids it
|
|
1496
1699
|
* applies with. Content-control ids are supplied freely while counting. The
|
|
1497
1700
|
* refusal is the one the operation meets whatever ids it is given.
|
|
1498
1701
|
*/
|
|
1499
|
-
declare const revisionIdDemand: (document: Document, op: DocumentOp) => Result<number, DocumentOpRefusal>;
|
|
1702
|
+
export declare const revisionIdDemand: (document: Document, op: DocumentOp) => Result<number, DocumentOpRefusal>;
|
|
1500
1703
|
/** The range a tracked deletion covers, its stamp, and the ids its later pieces take. */
|
|
1501
1704
|
type PlanTrackedDeletionOptions = {
|
|
1502
1705
|
from: TextPosition;
|
|
@@ -1511,7 +1714,7 @@ type PlanTrackedDeletionOptions = {
|
|
|
1511
1714
|
* Inline ranges run in reverse order, then joins run from last to first.
|
|
1512
1715
|
* All physical revision ids come from one pool for the complete batch.
|
|
1513
1716
|
*/
|
|
1514
|
-
declare const planTrackedDeletion: (document: Document, options: PlanTrackedDeletionOptions) => Result<DocumentOp[], DocumentOpRefusal>;
|
|
1717
|
+
export declare const planTrackedDeletion: (document: Document, options: PlanTrackedDeletionOptions) => Result<DocumentOp[], DocumentOpRefusal>;
|
|
1515
1718
|
//#endregion
|
|
1516
1719
|
//#region src/ops/rangeReplacement.d.ts
|
|
1517
1720
|
/**
|
|
@@ -1538,7 +1741,7 @@ type PlanTrackedReplaceOptions = PlanTrackedDeletionOptions & {
|
|
|
1538
1741
|
* deletion followed by the replacement fragment as tracked insertions.
|
|
1539
1742
|
* All physical revision ids come from one pool for the complete batch.
|
|
1540
1743
|
*/
|
|
1541
|
-
declare const planTrackedReplace: (document: Document, options: PlanTrackedReplaceOptions) => Result<DocumentOp[], DocumentOpRefusal>;
|
|
1744
|
+
export declare const planTrackedReplace: (document: Document, options: PlanTrackedReplaceOptions) => Result<DocumentOp[], DocumentOpRefusal>;
|
|
1542
1745
|
//#endregion
|
|
1543
1746
|
//#region src/ops/sequencing/envelope.d.ts
|
|
1544
1747
|
/** A batch applies atomically, in array order, against its stated revision. */
|
|
@@ -1570,7 +1773,7 @@ type SequencedBatch = DocumentBatch & {
|
|
|
1570
1773
|
revision: number;
|
|
1571
1774
|
effects?: readonly SequencedOpEffect[];
|
|
1572
1775
|
};
|
|
1573
|
-
declare const BATCH_REJECTION_REASONS: {
|
|
1776
|
+
export declare const BATCH_REJECTION_REASONS: {
|
|
1574
1777
|
readonly INVALID_BATCH: "invalidBatch";
|
|
1575
1778
|
readonly UNSUPPORTED_SCHEMA: "unsupportedSchema";
|
|
1576
1779
|
readonly UNSUPPORTED_PAIR: "unsupportedPair";
|
|
@@ -1580,30 +1783,30 @@ declare const BATCH_REJECTION_REASONS: {
|
|
|
1580
1783
|
readonly TABLE_REQUIRES_EXCLUSIVE_EDIT: "tableRequiresExclusiveEdit";
|
|
1581
1784
|
};
|
|
1582
1785
|
type BatchRejectionReason = (typeof BATCH_REJECTION_REASONS)[keyof typeof BATCH_REJECTION_REASONS];
|
|
1583
|
-
declare const
|
|
1584
|
-
declare class BatchRejection extends
|
|
1786
|
+
declare const BatchRejectionBase: TaggedErrorClass<"BatchRejection">;
|
|
1787
|
+
export declare class BatchRejection extends BatchRejectionBase<{
|
|
1585
1788
|
message: string;
|
|
1586
1789
|
reason: BatchRejectionReason;
|
|
1587
1790
|
opId?: string;
|
|
1588
1791
|
opType?: DocumentOpType;
|
|
1589
1792
|
overType?: DocumentOpType;
|
|
1590
1793
|
}> {}
|
|
1591
|
-
declare const BATCH_WIRE_OP_TYPES: readonly string[];
|
|
1794
|
+
export declare const BATCH_WIRE_OP_TYPES: readonly string[];
|
|
1592
1795
|
/** Bound recursion and refuse values except JSON data and absent object fields. */
|
|
1593
|
-
declare const MAX_BATCH_WIRE_BYTES: number;
|
|
1796
|
+
export declare const MAX_BATCH_WIRE_BYTES: number;
|
|
1594
1797
|
/** Decode a JSON-shaped batch, refusing unsupported payloads before apply. */
|
|
1595
|
-
declare const validateDocumentBatch: (value: unknown) => Result<DocumentBatch, BatchRejection>;
|
|
1798
|
+
export declare const validateDocumentBatch: (value: unknown) => Result<DocumentBatch, BatchRejection>;
|
|
1596
1799
|
/** Validate an assigned revision and any document-dependent effect metadata. */
|
|
1597
|
-
declare const validateSequencedBatch: (value: unknown) => Result<SequencedBatch, BatchRejection>;
|
|
1800
|
+
export declare const validateSequencedBatch: (value: unknown) => Result<SequencedBatch, BatchRejection>;
|
|
1598
1801
|
/** Parse the wire representation without propagating parser exceptions. */
|
|
1599
|
-
declare const parseDocumentBatch: (json: string) => Result<DocumentBatch, BatchRejection>;
|
|
1802
|
+
export declare const parseDocumentBatch: (json: string) => Result<DocumentBatch, BatchRejection>;
|
|
1600
1803
|
//#endregion
|
|
1601
1804
|
//#region src/ops/sequencing/transform.d.ts
|
|
1602
1805
|
type TransformOptions = {
|
|
1603
1806
|
order?: "before" | "after";
|
|
1604
1807
|
};
|
|
1605
1808
|
/** Rebase an atomic batch over an ordered journal tail. */
|
|
1606
|
-
declare const transformBatch: (batch: DocumentBatch, over: readonly SequencedBatch[], options?: TransformOptions) => Result<DocumentBatch, BatchRejection>;
|
|
1809
|
+
export declare const transformBatch: (batch: DocumentBatch, over: readonly SequencedBatch[], options?: TransformOptions) => Result<DocumentBatch, BatchRejection>;
|
|
1607
1810
|
//#endregion
|
|
1608
1811
|
//#region src/ops/sequencing/sequencer.d.ts
|
|
1609
1812
|
type BatchAck = {
|
|
@@ -1619,7 +1822,7 @@ type BatchReject = {
|
|
|
1619
1822
|
};
|
|
1620
1823
|
type BatchSubmission = BatchAck | BatchReject;
|
|
1621
1824
|
/** Deterministic append-only authority; the caller supplies delivery and storage. */
|
|
1622
|
-
declare const createSequencer: (document: Document) => {
|
|
1825
|
+
export declare const createSequencer: (document: Document) => {
|
|
1623
1826
|
submit: (batch: DocumentBatch) => BatchSubmission;
|
|
1624
1827
|
readonly document: Document;
|
|
1625
1828
|
readonly headRev: number;
|
|
@@ -1633,7 +1836,7 @@ type ClientNotice = {
|
|
|
1633
1836
|
ops: readonly DocumentOp[];
|
|
1634
1837
|
};
|
|
1635
1838
|
/** Optimistic state with ordered authoritative replay and one causal submission in flight. */
|
|
1636
|
-
declare const createClient: (document: Document) => {
|
|
1839
|
+
export declare const createClient: (document: Document) => {
|
|
1637
1840
|
enqueue: (batch: DocumentBatch) => Result<DocumentBatch, BatchRejection>;
|
|
1638
1841
|
nextSubmission: () => DocumentBatch | undefined;
|
|
1639
1842
|
receiveAck: (ack: BatchAck) => void;
|
|
@@ -1645,4 +1848,64 @@ declare const createClient: (document: Document) => {
|
|
|
1645
1848
|
readonly notices: readonly ClientNotice[];
|
|
1646
1849
|
};
|
|
1647
1850
|
//#endregion
|
|
1648
|
-
|
|
1851
|
+
//#region src/ops/batchOrder.d.ts
|
|
1852
|
+
/**
|
|
1853
|
+
* The execution coordinates of an operation resolved against a batch's
|
|
1854
|
+
* pre-state. Positions and table coordinates are ordered from right to left;
|
|
1855
|
+
* equal content coordinates use an explicit rank, then reverse input order.
|
|
1856
|
+
* Annotations run before moving edits, while table-shape and column edits run
|
|
1857
|
+
* after ordinary content edits. Table mutations in nested tables still run
|
|
1858
|
+
* right to left before the phase order is applied within the same table.
|
|
1859
|
+
*/
|
|
1860
|
+
type BatchOrderAddress = {
|
|
1861
|
+
type: "annotation";
|
|
1862
|
+
position: number;
|
|
1863
|
+
inputIndex: number;
|
|
1864
|
+
} | {
|
|
1865
|
+
type: "content";
|
|
1866
|
+
position: number;
|
|
1867
|
+
rank: number;
|
|
1868
|
+
inputIndex: number;
|
|
1869
|
+
} | {
|
|
1870
|
+
type: "cell";
|
|
1871
|
+
tablePosition: number;
|
|
1872
|
+
bottom: number;
|
|
1873
|
+
right: number;
|
|
1874
|
+
inputIndex: number;
|
|
1875
|
+
} | {
|
|
1876
|
+
type: "column";
|
|
1877
|
+
tablePosition: number;
|
|
1878
|
+
columnIndex: number;
|
|
1879
|
+
insertion: boolean;
|
|
1880
|
+
inputIndex: number;
|
|
1881
|
+
};
|
|
1882
|
+
type ContentRankOperation = {
|
|
1883
|
+
type: string;
|
|
1884
|
+
position?: unknown;
|
|
1885
|
+
};
|
|
1886
|
+
/**
|
|
1887
|
+
* Rank content operations at one pre-batch target. A tracked split deletion
|
|
1888
|
+
* must retract the inserted paragraph before a table is placed after it;
|
|
1889
|
+
* ordinary edits stay between those two exceptional operations.
|
|
1890
|
+
*/
|
|
1891
|
+
export declare const contentRank: (operation: ContentRankOperation, target: {
|
|
1892
|
+
hasDeletedSplit: boolean;
|
|
1893
|
+
}) => number;
|
|
1894
|
+
/** Compare two pre-batch addresses in the documented batch execution order. */
|
|
1895
|
+
export declare const compareBatchOrder: (left: BatchOrderAddress, right: BatchOrderAddress) => number;
|
|
1896
|
+
/** Order operations once from addresses captured before the batch changes the document. */
|
|
1897
|
+
export declare const orderBatchOperations: <T>(operations: readonly T[], addressOf: (operation: T) => BatchOrderAddress) => T[];
|
|
1898
|
+
/**
|
|
1899
|
+
* Partition an ordered batch into execution runs. Insertions at the same
|
|
1900
|
+
* position share a run; every other operation remains a singleton.
|
|
1901
|
+
*
|
|
1902
|
+
* An operation that `keepsGap` admits (one that writes properties and places
|
|
1903
|
+
* nothing in the gap) does not end a run: an equal-gap insertion after it
|
|
1904
|
+
* still joins the run, which runs before it. Otherwise a property write tied
|
|
1905
|
+
* between two insertions at one gap would split them, and they would inherit
|
|
1906
|
+
* their anchor's properties from different moments while landing in one
|
|
1907
|
+
* requested sequence, which no series of single edits produces.
|
|
1908
|
+
*/
|
|
1909
|
+
export declare const groupInsertionRuns: <T>(operations: readonly T[], insertionPositionOf: (operation: T) => number | null, keepsGap?: (operation: T) => boolean) => T[][];
|
|
1910
|
+
//#endregion
|
|
1911
|
+
export type { AddNoteOp, AppliedDocumentOp, BatchOrderAddress, BatchRejectionReason, BlockInsertionPoint, BoundaryOccurrence, CommentAnchor, CommentExhaustionInput, CommentState, CopyOriginAncestorList, CreateCommentOp, CreateHeaderFooterOp, CreateNumberingInstanceOp, DeleteBlocksOp, DeleteColumnOp, DeleteCommentOp, DeleteNumberingInstanceOp, DeleteRangeOp, DeleteRowOp, DeleteTableOp, DocumentBatch, DocumentOp, DocumentOpEnvelope, DocumentOpRefusalReason, DocumentOpType, EditorIntent, EditorIntentMode, EmptyPropertySet, FormattingPatch, HeaderFooterStory, InlineSlice, InsertBlocksOp, InsertColumnOp, InsertContentOp, InsertRowOp, InsertTableOp, InsertTextOp, InsertedRunProps, JoinBlocksOp, JoinInlineOp, MergeCellsOp, NewIds, NoteStory, NumberingPartState, OpStory, PackageResourceEntry, PackageResourceEntryChange, PackageResourceMapChange, PackageResourceMedia, PackageResourcePart, PackageResources, ParagraphContentVerdict, ParagraphPropsPatch, ParagraphReviewFields, PlanTrackedDeletionOptions, PlanTrackedReplaceOptions, RemoveHeaderFooterOp, RemoveNoteOp, ReplaceBlocksOp, ReplaceInlineOp, ResolveRevisionOp, RestoreCommentStateOp, RestoreStoryPartsOp, RevisionDecision, RevisionStamp, RunPropsPatch, SectionEndpoint, SectionMapState, SectionPropertiesState, SectionViewEntry, SectionViewState, SequencedBatch, SetCellPropsOp, SetCommentResolutionOp, SetContainerBlocksOp, SetPackageResourcesOp, SetParagraphPropsOp, SetParagraphReviewOp, SetRowPropsOp, SetRunPropsOp, SetSectionEndpointOp, SetSectionPropsOp, SetTableGridOp, SetTableOp, SetTablePropsOp, SetTableRowsOp, SplitBlockOp, SplitCellOp, SplitHalf, SplitInlineOp, SplitParagraphFields, TableEditOp, TableIntentOperation, TextPosition, TouchedBlocks, UpdateCommentContentOp, WellFormedRangePlan, ZeroWidthItem };
|