@stll/folio-core 0.75.0 → 0.76.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/dist/ai-edits/headless.d.ts +2 -1
- package/dist/ai-edits/headless.js +18 -12
- package/dist/ai-edits/pending-suggestions.js +2 -3
- package/dist/ai-edits/read.js +9 -3
- package/dist/ai-edits/types.d.ts +9 -4
- package/dist/canonical/batchCommentReferences.js +2 -1
- package/dist/canonical/canonicalBatchReview.js +5 -8
- package/dist/canonical/canonicalComments.js +8 -2
- package/dist/canonical/canonicalCompilerRefusal.d.ts +2 -4
- package/dist/canonical/canonicalCompilerRefusal.js +20 -14
- package/dist/canonical/canonicalPublicOperations.js +203 -71
- package/dist/canonical/canonicalSession.js +3 -1
- package/dist/controller/canonicalClipboard.d.ts +1 -1
- package/dist/controller/canonicalClipboard.js +71 -17
- package/dist/controller/canonicalContentControlValue.js +7 -7
- package/dist/controller/canonicalReview.d.ts +21 -0
- package/dist/controller/canonicalReview.js +44 -9
- package/dist/controller/canonicalStructure.d.ts +1 -2
- package/dist/controller/canonicalStructure.js +51 -24
- package/dist/controller/fontReadiness.js +50 -23
- package/dist/controller/hiddenEditorManager.js +5 -20
- package/dist/docx/bulletMarkers.d.ts +8 -0
- package/dist/docx/bulletMarkers.js +9 -1
- package/dist/docx/canonicalSessionInput.js +25 -11
- package/dist/docx/ensureParaIds.d.ts +31 -0
- package/dist/docx/ensureParaIds.js +57 -32
- package/dist/docx/ensureUniqueControlIds.d.ts +13 -0
- package/dist/docx/ensureUniqueControlIds.js +47 -29
- package/dist/docx/ensureUniqueRevisionIds.d.ts +13 -0
- package/dist/docx/ensureUniqueRevisionIds.js +52 -29
- package/dist/docx/server/templatePlan/apply.js +62 -8
- package/dist/docx/server/templatePlan/blocks.d.ts +55 -3
- package/dist/docx/server/templatePlan/blocks.js +182 -6
- package/dist/docx/server/templatePlan/builders.d.ts +16 -1
- package/dist/docx/server/templatePlan/builders.js +31 -3
- package/dist/docx/server/templatePlan/effects.d.ts +27 -0
- package/dist/docx/server/templatePlan/effects.js +188 -0
- package/dist/docx/server/templatePlan/emit.d.ts +2 -1
- package/dist/docx/server/templatePlan/emit.js +44 -2
- package/dist/docx/server/templatePlan/inspect.js +21 -1
- package/dist/docx/server/templatePlan/labels.js +16 -1
- package/dist/docx/server/templatePlan/plan.d.ts +12 -3
- package/dist/docx/server/templatePlan/plan.js +36 -12
- package/dist/docx/server/templatePlan/planShape.js +47 -22
- package/dist/docx/server/templatePlan/revisions.d.ts +46 -0
- package/dist/docx/server/templatePlan/revisions.js +407 -0
- package/dist/docx/server/templatePlan/story.d.ts +15 -1
- package/dist/docx/server/templatePlan/story.js +50 -2
- package/dist/docx/server/templatePlan/types.d.ts +217 -1
- package/dist/docx/server/templatePlan/verify.js +117 -8
- package/dist/docx/server/templatePlan/xml.d.ts +3 -0
- package/dist/docx/server/templatePlan/xml.js +4 -1
- package/dist/internal/revisionResolutionStep.d.ts +2 -31
- package/dist/internal/revisionResolutionStep.js +2 -171
- package/dist/prosemirror/commands/comments.d.ts +6 -234
- package/dist/prosemirror/commands/comments.js +5 -2464
- package/dist/prosemirror/commands/index.d.ts +4 -2
- package/dist/prosemirror/commands/index.js +4 -2
- package/dist/prosemirror/commands/tableCellMergeResolution.d.ts +1 -11
- package/dist/prosemirror/commands/tableCellMergeResolution.js +3 -154
- package/dist/prosemirror/extensions/marks/HyperlinkExtension.js +6 -8
- package/dist/prosemirror/hyperlinkRemoval.d.ts +11 -8
- package/dist/prosemirror/hyperlinkRemoval.js +24 -15
- package/dist/prosemirror/paraIds.d.ts +1 -14
- package/dist/prosemirror/paraIds.js +1 -14
- package/dist/prosemirror/paragraphMarkJoin.d.ts +0 -16
- package/dist/prosemirror/paragraphMarkJoin.js +3 -46
- package/dist/prosemirror/projectionReview.d.ts +49 -0
- package/dist/prosemirror/projectionReview.js +292 -0
- package/dist/prosemirror/rebaseParagraphRunFormatting.d.ts +1 -13
- package/dist/prosemirror/rebaseParagraphRunFormatting.js +1 -16
- package/dist/prosemirror/replacedAnnotations.d.ts +2 -5
- package/dist/prosemirror/replacedAnnotations.js +1 -10
- package/dist/prosemirror/revisionCarriers.d.ts +9 -1
- package/dist/prosemirror/revisionCarriers.js +15 -1
- package/dist/prosemirror/revisionRangeQueries.d.ts +32 -0
- package/dist/prosemirror/revisionRangeQueries.js +76 -0
- package/dist/prosemirror/runFormattingMarkNames.d.ts +1 -1
- package/dist/prosemirror/runFormattingMarkNames.js +1 -1
- package/dist/prosemirror/suggestionQueries.d.ts +114 -0
- package/dist/prosemirror/suggestionQueries.js +320 -0
- package/dist/prosemirror/tableGridMutation.d.ts +1 -16
- package/dist/prosemirror/tableGridMutation.js +1 -78
- package/dist/prosemirror/tableRowRevisionOwnership.d.ts +18 -0
- package/dist/prosemirror/tableRowRevisionOwnership.js +7 -0
- package/dist/prosemirror/utils/extractTrackedChanges.js +14 -4
- package/dist/server.d.ts +2 -2
- package/dist/types/canonicalCapabilities.d.ts +1 -25
- package/dist/types/canonicalCapabilities.js +1 -23
- package/package.json +2 -2
- package/dist/internal/headlessRevisionResolutionGuard.d.ts +0 -3
- package/dist/internal/headlessRevisionResolutionGuard.js +0 -18
|
@@ -25,6 +25,9 @@ export declare const integerOrNull: (value: string | null) => number | null;
|
|
|
25
25
|
* universal measure (`1in`, `2.54cm`), which the schema allows in its place.
|
|
26
26
|
*/
|
|
27
27
|
export declare const twipsOrNull: (value: string | null) => number | null;
|
|
28
|
+
/** A length in half-points: a plain number, or a universal measure such as
|
|
29
|
+
* `12pt`. */
|
|
30
|
+
export declare const halfPointsOrNull: (value: string | null) => number | null;
|
|
28
31
|
/** The largest of `values`, or `floor` when none is larger. */
|
|
29
32
|
export declare const maxOf: (values: Iterable<number>, floor: number) => number;
|
|
30
33
|
/** A relationship attribute (`r:id`, `r:embed`, ...) by local name. */
|
|
@@ -32,6 +32,9 @@ const integerOrNull = (value) => {
|
|
|
32
32
|
* universal measure (`1in`, `2.54cm`), which the schema allows in its place.
|
|
33
33
|
*/
|
|
34
34
|
const twipsOrNull = (value) => integerOrNull(value) ?? (value === null ? null : universalMeasureAs(value.trim(), "twips") ?? null);
|
|
35
|
+
/** A length in half-points: a plain number, or a universal measure such as
|
|
36
|
+
* `12pt`. */
|
|
37
|
+
const halfPointsOrNull = (value) => integerOrNull(value) ?? (value === null ? null : universalMeasureAs(value.trim(), "halfPoints") ?? null);
|
|
35
38
|
/** The largest of `values`, or `floor` when none is larger. */
|
|
36
39
|
const maxOf = (values, floor) => {
|
|
37
40
|
let max = floor;
|
|
@@ -122,4 +125,4 @@ const walkElements = (root, visit) => {
|
|
|
122
125
|
}
|
|
123
126
|
}
|
|
124
127
|
};
|
|
125
|
-
export { MARKUP_COMPATIBILITY_NAMESPACE, MATH_NAMESPACE, elementChildren, escapeXmlAttribute, escapeXmlText, innerRangeOf, integerOrNull, isW, maxOf, partPrefixes, prefixFor, rangeOf, readRawPart, relationshipAttr, sliceWithSplices, spliceXml, twipsOrNull, wAttr, wChild, wChildVal, wChildren, wName, walkElements };
|
|
128
|
+
export { MARKUP_COMPATIBILITY_NAMESPACE, MATH_NAMESPACE, elementChildren, escapeXmlAttribute, escapeXmlText, halfPointsOrNull, innerRangeOf, integerOrNull, isW, maxOf, partPrefixes, prefixFor, rangeOf, readRawPart, relationshipAttr, sliceWithSplices, spliceXml, twipsOrNull, wAttr, wChild, wChildVal, wChildren, wName, walkElements };
|
|
@@ -1,32 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Mappable, Step, StepMap, StepResult } from "prosemirror-transform";
|
|
3
|
-
type DeferredInverse = {
|
|
4
|
-
doc: Node;
|
|
5
|
-
steps: readonly Step[];
|
|
6
|
-
};
|
|
7
|
-
type RevisionResolutionStepOptions = {
|
|
8
|
-
beforeDoc: Node | null;
|
|
9
|
-
afterDoc: Node | null;
|
|
10
|
-
steps: readonly Step[];
|
|
11
|
-
positionMap: StepMap;
|
|
12
|
-
deferredInverse?: DeferredInverse;
|
|
13
|
-
};
|
|
1
|
+
import { StepMap } from "prosemirror-transform";
|
|
14
2
|
/** Compose by retaining precisely the source positions that survive both maps. */
|
|
15
|
-
export declare const composeRevisionResolutionMaps: (first: StepMap, second: StepMap) => StepMap;
|
|
16
|
-
/** One transaction step for a bulk resolution, with a granular position map. */
|
|
17
|
-
export declare class RevisionResolutionStep extends Step {
|
|
18
|
-
private materializedSteps;
|
|
19
|
-
private readonly beforeDoc;
|
|
20
|
-
private readonly afterDoc;
|
|
21
|
-
private readonly positionMap;
|
|
22
|
-
private readonly deferredInverse;
|
|
23
|
-
constructor({ beforeDoc, afterDoc, steps, positionMap, deferredInverse }: RevisionResolutionStepOptions);
|
|
24
|
-
private steps;
|
|
25
|
-
apply(doc: Node): StepResult;
|
|
26
|
-
getMap(): StepMap;
|
|
27
|
-
invert(doc: Node): RevisionResolutionStep;
|
|
28
|
-
map(mapping: Mappable): RevisionResolutionStep | null;
|
|
29
|
-
toJSON(): unknown;
|
|
30
|
-
static fromJSON(schema: Schema, json: unknown): RevisionResolutionStep;
|
|
31
|
-
}
|
|
32
|
-
export {};
|
|
3
|
+
export declare const composeRevisionResolutionMaps: (first: StepMap, second: StepMap) => StepMap;
|
|
@@ -1,60 +1,6 @@
|
|
|
1
1
|
import { indexedPositionMap } from "./indexedPositionMap.js";
|
|
2
|
-
import {
|
|
3
|
-
import { Step, StepMap, StepResult } from "prosemirror-transform";
|
|
2
|
+
import { StepMap } from "prosemirror-transform";
|
|
4
3
|
// src/internal/revisionResolutionStep.ts
|
|
5
|
-
const mapThrough = (position, assoc, maps) => {
|
|
6
|
-
let mapped = position;
|
|
7
|
-
let deleted = false;
|
|
8
|
-
let deletedBefore = false;
|
|
9
|
-
let deletedAfter = false;
|
|
10
|
-
let deletedAcross = false;
|
|
11
|
-
for (const map of maps) {
|
|
12
|
-
const result = map.mapResult(mapped, assoc);
|
|
13
|
-
mapped = result.pos;
|
|
14
|
-
deleted ||= result.deleted;
|
|
15
|
-
deletedBefore ||= result.deletedBefore;
|
|
16
|
-
deletedAfter ||= result.deletedAfter;
|
|
17
|
-
deletedAcross ||= result.deletedAcross;
|
|
18
|
-
}
|
|
19
|
-
return {
|
|
20
|
-
pos: mapped,
|
|
21
|
-
deleted,
|
|
22
|
-
deletedBefore,
|
|
23
|
-
deletedAfter,
|
|
24
|
-
deletedAcross
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
const chainedMap = (maps) => ({
|
|
28
|
-
map: (position, assoc = 1) => mapThrough(position, assoc, maps).pos,
|
|
29
|
-
mapResult: (position, assoc = 1) => mapThrough(position, assoc, maps)
|
|
30
|
-
});
|
|
31
|
-
const replaySteps = (doc, steps) => {
|
|
32
|
-
let current = doc;
|
|
33
|
-
for (const step of steps) {
|
|
34
|
-
const result = step.apply(current);
|
|
35
|
-
if (!result.doc) return result;
|
|
36
|
-
current = result.doc;
|
|
37
|
-
}
|
|
38
|
-
return StepResult.ok(current);
|
|
39
|
-
};
|
|
40
|
-
const isValidMapRanges = (value) => {
|
|
41
|
-
if (!Array.isArray(value) || value.length % 3 !== 0) return false;
|
|
42
|
-
let previousEnd = 0;
|
|
43
|
-
let delta = 0;
|
|
44
|
-
for (let index = 0; index < value.length; index += 3) {
|
|
45
|
-
const start = value.at(index);
|
|
46
|
-
const oldSize = value.at(index + 1);
|
|
47
|
-
const newSize = value.at(index + 2);
|
|
48
|
-
if (!Number.isSafeInteger(start) || !Number.isSafeInteger(oldSize) || !Number.isSafeInteger(newSize) || start < previousEnd || oldSize < 0 || newSize < 0) return false;
|
|
49
|
-
const oldEnd = start + oldSize;
|
|
50
|
-
const newStart = start + delta;
|
|
51
|
-
const newEnd = newStart + newSize;
|
|
52
|
-
if (!Number.isSafeInteger(oldEnd) || !Number.isSafeInteger(newStart) || !Number.isSafeInteger(newEnd) || !Number.isSafeInteger(newEnd - oldEnd) || newStart < 0) return false;
|
|
53
|
-
previousEnd = oldEnd;
|
|
54
|
-
delta = newEnd - oldEnd;
|
|
55
|
-
}
|
|
56
|
-
return true;
|
|
57
|
-
};
|
|
58
4
|
const indexedStepMapResult = (map) => {
|
|
59
5
|
const changes = [];
|
|
60
6
|
map.forEach((oldStart, oldEnd, newStart, newEnd) => {
|
|
@@ -164,119 +110,4 @@ const composeRevisionResolutionMaps = (first, second) => {
|
|
|
164
110
|
}
|
|
165
111
|
return new StepMap(ranges);
|
|
166
112
|
};
|
|
167
|
-
|
|
168
|
-
var RevisionResolutionStep = class RevisionResolutionStep extends Step {
|
|
169
|
-
materializedSteps;
|
|
170
|
-
beforeDoc;
|
|
171
|
-
afterDoc;
|
|
172
|
-
positionMap;
|
|
173
|
-
deferredInverse;
|
|
174
|
-
constructor({ beforeDoc, afterDoc, steps, positionMap, deferredInverse }) {
|
|
175
|
-
super();
|
|
176
|
-
this.beforeDoc = beforeDoc;
|
|
177
|
-
this.afterDoc = afterDoc;
|
|
178
|
-
this.positionMap = positionMap;
|
|
179
|
-
this.deferredInverse = deferredInverse ?? null;
|
|
180
|
-
this.materializedSteps = deferredInverse ? null : steps;
|
|
181
|
-
}
|
|
182
|
-
steps() {
|
|
183
|
-
if (this.materializedSteps) return this.materializedSteps;
|
|
184
|
-
const deferred = this.deferredInverse;
|
|
185
|
-
if (!deferred) return panic("Revision resolution has no inverse steps");
|
|
186
|
-
let doc = deferred.doc;
|
|
187
|
-
const inverse = [];
|
|
188
|
-
for (const step of deferred.steps) {
|
|
189
|
-
inverse.push(step.invert(doc));
|
|
190
|
-
const result = step.apply(doc);
|
|
191
|
-
if (!result.doc) return panic(result.failed ?? "Revision resolution cannot invert a failed step");
|
|
192
|
-
doc = result.doc;
|
|
193
|
-
}
|
|
194
|
-
this.materializedSteps = inverse.reverse();
|
|
195
|
-
return inverse;
|
|
196
|
-
}
|
|
197
|
-
apply(doc) {
|
|
198
|
-
if (doc === this.beforeDoc && this.afterDoc) return StepResult.ok(this.afterDoc);
|
|
199
|
-
return replaySteps(doc, this.steps());
|
|
200
|
-
}
|
|
201
|
-
getMap() {
|
|
202
|
-
return this.positionMap;
|
|
203
|
-
}
|
|
204
|
-
invert(doc) {
|
|
205
|
-
if (doc === this.beforeDoc && this.afterDoc) return new RevisionResolutionStep({
|
|
206
|
-
beforeDoc: this.afterDoc,
|
|
207
|
-
afterDoc: doc,
|
|
208
|
-
steps: [],
|
|
209
|
-
positionMap: this.positionMap.invert(),
|
|
210
|
-
deferredInverse: {
|
|
211
|
-
doc,
|
|
212
|
-
steps: this.steps()
|
|
213
|
-
}
|
|
214
|
-
});
|
|
215
|
-
let current = doc;
|
|
216
|
-
const inverse = [];
|
|
217
|
-
for (const step of this.steps()) {
|
|
218
|
-
inverse.push(step.invert(current));
|
|
219
|
-
const result = step.apply(current);
|
|
220
|
-
if (!result.doc) return panic(result.failed ?? "Revision resolution cannot invert a failed step");
|
|
221
|
-
current = result.doc;
|
|
222
|
-
}
|
|
223
|
-
return new RevisionResolutionStep({
|
|
224
|
-
beforeDoc: current,
|
|
225
|
-
afterDoc: doc,
|
|
226
|
-
steps: inverse.reverse(),
|
|
227
|
-
positionMap: this.positionMap.invert()
|
|
228
|
-
});
|
|
229
|
-
}
|
|
230
|
-
map(mapping) {
|
|
231
|
-
const original = this.steps();
|
|
232
|
-
const mapped = [];
|
|
233
|
-
const inverseOriginalMaps = [];
|
|
234
|
-
const mappedMaps = [];
|
|
235
|
-
for (const step of original) {
|
|
236
|
-
const through = chainedMap([
|
|
237
|
-
...inverseOriginalMaps.toReversed(),
|
|
238
|
-
mapping,
|
|
239
|
-
...mappedMaps
|
|
240
|
-
]);
|
|
241
|
-
const rebased = step.map(through);
|
|
242
|
-
if (rebased) {
|
|
243
|
-
mapped.push(rebased);
|
|
244
|
-
mappedMaps.push(rebased.getMap());
|
|
245
|
-
}
|
|
246
|
-
inverseOriginalMaps.push(step.getMap().invert());
|
|
247
|
-
}
|
|
248
|
-
if (mapped.length === 0) return null;
|
|
249
|
-
let positionMap = StepMap.empty;
|
|
250
|
-
for (const step of mapped) positionMap = composeRevisionResolutionMaps(positionMap, step.getMap());
|
|
251
|
-
return new RevisionResolutionStep({
|
|
252
|
-
beforeDoc: null,
|
|
253
|
-
afterDoc: null,
|
|
254
|
-
steps: mapped,
|
|
255
|
-
positionMap
|
|
256
|
-
});
|
|
257
|
-
}
|
|
258
|
-
toJSON() {
|
|
259
|
-
const mapRanges = [];
|
|
260
|
-
this.positionMap.forEach((oldStart, oldEnd, newStart, newEnd) => {
|
|
261
|
-
mapRanges.push(oldStart, oldEnd - oldStart, newEnd - newStart);
|
|
262
|
-
});
|
|
263
|
-
return {
|
|
264
|
-
stepType: "folioRevisionResolution",
|
|
265
|
-
steps: this.steps().map((step) => step.toJSON()),
|
|
266
|
-
mapRanges
|
|
267
|
-
};
|
|
268
|
-
}
|
|
269
|
-
static fromJSON(schema, json) {
|
|
270
|
-
if (typeof json !== "object" || json === null || !("steps" in json) || !("mapRanges" in json)) throw new RangeError("Invalid revision resolution step JSON");
|
|
271
|
-
const { steps, mapRanges } = json;
|
|
272
|
-
if (!Array.isArray(steps) || !isValidMapRanges(mapRanges)) throw new RangeError("Invalid revision resolution step JSON");
|
|
273
|
-
return new RevisionResolutionStep({
|
|
274
|
-
beforeDoc: null,
|
|
275
|
-
afterDoc: null,
|
|
276
|
-
steps: steps.map((step) => Step.fromJSON(schema, step)),
|
|
277
|
-
positionMap: new StepMap(mapRanges)
|
|
278
|
-
});
|
|
279
|
-
}
|
|
280
|
-
};
|
|
281
|
-
Step.jsonID("folioRevisionResolution", RevisionResolutionStep);
|
|
282
|
-
export { RevisionResolutionStep, composeRevisionResolutionMaps };
|
|
113
|
+
export { composeRevisionResolutionMaps };
|
|
@@ -1,234 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
*/
|
|
8
|
-
export declare function addCommentMark(commentId: number): Command;
|
|
9
|
-
/**
|
|
10
|
-
* Remove a comment mark by ID from the entire document.
|
|
11
|
-
*/
|
|
12
|
-
export declare function removeCommentMark(commentId: number): Command;
|
|
13
|
-
type ResolveMode = "accept" | "reject";
|
|
14
|
-
export type ParagraphBoundaryChange = {
|
|
15
|
-
from: number;
|
|
16
|
-
to: number;
|
|
17
|
-
type: "insertion" | "deletion";
|
|
18
|
-
author?: string;
|
|
19
|
-
date?: string;
|
|
20
|
-
revisionId?: number;
|
|
21
|
-
};
|
|
22
|
-
export declare function findParagraphBoundaryChangeAtPosition(state: EditorState, pos: number): ParagraphBoundaryChange | null;
|
|
23
|
-
/**
|
|
24
|
-
* What the content-control locks say about resolving the tracked changes
|
|
25
|
-
* between `from` and `to` (only those of `revisionIds`, when given): `null`
|
|
26
|
-
* when they allow it or there is nothing there to resolve. A revision whose
|
|
27
|
-
* resolution would change a content-locked control's content, or remove a
|
|
28
|
-
* control locked against removal, stays pending.
|
|
29
|
-
*/
|
|
30
|
-
export declare const changeResolutionLockViolation: (state: EditorState, { from, to, mode, revisionIds }: {
|
|
31
|
-
from: number;
|
|
32
|
-
to: number;
|
|
33
|
-
mode: "accept" | "reject";
|
|
34
|
-
revisionIds?: readonly number[];
|
|
35
|
-
}) => LockedControlViolation | null;
|
|
36
|
-
/** {@link changeResolutionLockViolation} for the revisions `revisionIds`, wherever they are. */
|
|
37
|
-
export declare const revisionResolutionLockViolation: (state: EditorState, revisionIds: number | readonly number[], mode: "accept" | "reject") => LockedControlViolation | null;
|
|
38
|
-
/**
|
|
39
|
-
* Accept a tracked change at the given range.
|
|
40
|
-
* - Insertion: remove mark, keep text
|
|
41
|
-
* - Deletion: remove mark AND text
|
|
42
|
-
*/
|
|
43
|
-
export declare function acceptChange(from: number, to: number): Command;
|
|
44
|
-
/**
|
|
45
|
-
* Reject a tracked change at the given range.
|
|
46
|
-
* - Insertion: remove mark AND text
|
|
47
|
-
* - Deletion: remove mark, keep text
|
|
48
|
-
*/
|
|
49
|
-
export declare function rejectChange(from: number, to: number): Command;
|
|
50
|
-
/**
|
|
51
|
-
* Accept all tracked changes in the document. Returns `false` while pending
|
|
52
|
-
* suggestions are present because this command cannot restage them.
|
|
53
|
-
*/
|
|
54
|
-
export declare function acceptAllChanges(): Command;
|
|
55
|
-
/**
|
|
56
|
-
* Reject all tracked changes in the document.
|
|
57
|
-
*/
|
|
58
|
-
export declare function rejectAllChanges(): Command;
|
|
59
|
-
/**
|
|
60
|
-
* The revisions of `state` that a content control's lock keeps from being
|
|
61
|
-
* resolved in `mode`, each with the lock's verdict: see
|
|
62
|
-
* {@link changeResolutionLockViolation}. Empty without a locked control.
|
|
63
|
-
*/
|
|
64
|
-
export declare const lockHeldRevisions: (state: EditorState, mode: "accept" | "reject") => Map<number, LockedControlViolation>;
|
|
65
|
-
/** Every revision id one sidebar entry stands for. */
|
|
66
|
-
export declare const trackedChangeEntryRevisionIds: (entry: TrackedChangeEntry) => number[];
|
|
67
|
-
/**
|
|
68
|
-
* Resolve a complete state synchronously for a headless reader or writer.
|
|
69
|
-
*
|
|
70
|
-
* Uses the same single-step resolver as the interactive editor command.
|
|
71
|
-
*/
|
|
72
|
-
export declare function resolveAllChangesInHeadlessState(state: EditorState, mode: ResolveMode): EditorState;
|
|
73
|
-
/** The review transaction, or null when its content cannot be resolved. */
|
|
74
|
-
export declare const projectAllChangesInHeadlessState: (state: EditorState, mode: ResolveMode) => EditorState | null;
|
|
75
|
-
/**
|
|
76
|
-
* Resolve a story and retain its position map for callers addressing the tracked source.
|
|
77
|
-
*/
|
|
78
|
-
export declare const resolveAllChangesInHeadlessStateWithMapping: (state: EditorState, mode: ResolveMode) => {
|
|
79
|
-
state: EditorState;
|
|
80
|
-
mapping: Mapping;
|
|
81
|
-
};
|
|
82
|
-
/**
|
|
83
|
-
* Find the document range covered by all revision carriers with any of the
|
|
84
|
-
* given ids. Returns null when none are present (already accepted/rejected, or
|
|
85
|
-
* never existed). A replace operation typically passes two ids; standalone
|
|
86
|
-
* text, formatting, paragraph, section, and table revisions pass a single id.
|
|
87
|
-
*/
|
|
88
|
-
export declare function findAIEditRevisionRange(state: EditorState, revisionIds: number | readonly number[]): {
|
|
89
|
-
from: number;
|
|
90
|
-
to: number;
|
|
91
|
-
} | null;
|
|
92
|
-
/**
|
|
93
|
-
* Accept the tracked-change marks belonging to an AI-edit operation.
|
|
94
|
-
* Pass a single revisionId for inserts, standalone deletions, or formatting changes; or the
|
|
95
|
-
* full id list for a replace (one id per side). Returns false when
|
|
96
|
-
* none of the ids match anything in the doc.
|
|
97
|
-
*/
|
|
98
|
-
export declare function acceptAIEditRevision(revisionIds: number | readonly number[]): Command;
|
|
99
|
-
/**
|
|
100
|
-
* Reject the tracked-change marks belonging to an AI-edit operation.
|
|
101
|
-
* See {@link acceptAIEditRevision} for the id semantics.
|
|
102
|
-
*/
|
|
103
|
-
export declare function rejectAIEditRevision(revisionIds: number | readonly number[]): Command;
|
|
104
|
-
/** The ids of the comments a pending suggestion proposes. */
|
|
105
|
-
export declare function suggestionCommentIds(state: EditorState, suggestionId: string): number[];
|
|
106
|
-
export type SuggestionKind = "insertion" | "deletion" | "formatting" | "insertBlock" | "insertTable" | "insertRow" | "deleteRow" | "insertColumn" | "deleteColumn" | "comment";
|
|
107
|
-
/**
|
|
108
|
-
* How a suggestion is applied when accepted:
|
|
109
|
-
* - `"tracked"` — converts to a normal OOXML tracked change (`w:ins`/`w:del`,
|
|
110
|
-
* paragraph-mark `w:ins`, row/cell `w:ins`/`w:del`);
|
|
111
|
-
* - `"direct"` — no OOXML tracked representation exists (a whole inserted
|
|
112
|
-
* table), so accepting applies it directly; a suggestion that only
|
|
113
|
-
* proposes a comment is accepted as an ordinary comment;
|
|
114
|
-
* - `"mixed"` — a heterogeneous group (one `suggestionId` spanning a whole
|
|
115
|
-
* inserted table AND other edits) whose parts apply both ways. Accept still
|
|
116
|
-
* resolves the whole group in one transaction; this flag lets the host
|
|
117
|
-
* message that some parts landed directly.
|
|
118
|
-
*/
|
|
119
|
-
export type SuggestionAppliedAs = "tracked" | "direct" | "mixed";
|
|
120
|
-
export type FolioSuggestion = {
|
|
121
|
-
suggestionId: string;
|
|
122
|
-
/** Contiguous document ranges the suggestion covers, in document order. */
|
|
123
|
-
ranges: readonly {
|
|
124
|
-
from: number;
|
|
125
|
-
to: number;
|
|
126
|
-
}[];
|
|
127
|
-
/** Which kinds of change the suggestion contains (deduped, in a stable order). */
|
|
128
|
-
kinds: readonly SuggestionKind[];
|
|
129
|
-
/** How accepting this suggestion applies it (see {@link SuggestionAppliedAs}). */
|
|
130
|
-
appliedAs: SuggestionAppliedAs;
|
|
131
|
-
};
|
|
132
|
-
/**
|
|
133
|
-
* List every suggestion in the document for host consumption: its id, the
|
|
134
|
-
* contiguous ranges it covers, which kinds of change it contains, and how
|
|
135
|
-
* accepting it applies (tracked vs direct).
|
|
136
|
-
*/
|
|
137
|
-
export declare function getSuggestions(state: EditorState): FolioSuggestion[];
|
|
138
|
-
/** Physical revision IDs of every pending suggestion, in one document walk. */
|
|
139
|
-
export declare const pendingSuggestionRevisionIds: (state: EditorState) => ReadonlySet<number>;
|
|
140
|
-
/** The first owning suggestion for each physical revision, in source order. */
|
|
141
|
-
export declare const suggestionOwnersByRevision: (state: EditorState) => ReadonlyMap<number, string>;
|
|
142
|
-
/** The suggestion a revision belongs to, or `null` for an ordinary tracked change. */
|
|
143
|
-
export declare function suggestionIdOfRevision(state: EditorState, revisionId: number): string | null;
|
|
144
|
-
/**
|
|
145
|
-
* The document range covering every mark belonging to `suggestionId`, plus the
|
|
146
|
-
* revision ids those marks carry. Returns null when the suggestion is absent
|
|
147
|
-
* (already accepted/rejected, or never existed).
|
|
148
|
-
*/
|
|
149
|
-
export declare function findSuggestionRange(state: EditorState, suggestionId: string): {
|
|
150
|
-
from: number;
|
|
151
|
-
to: number;
|
|
152
|
-
revisionIds: number[];
|
|
153
|
-
} | null;
|
|
154
|
-
export type AcceptSuggestionOptions = {
|
|
155
|
-
author: string;
|
|
156
|
-
/**
|
|
157
|
-
* Date stamped on the resulting user tracked change (serialized as `w:date`);
|
|
158
|
-
* defaults to now. A malformed / non-parseable value is normalized to now, and
|
|
159
|
-
* a valid value is canonicalized to ISO 8601, so an invalid date can never be
|
|
160
|
-
* written into the document.
|
|
161
|
-
*/
|
|
162
|
-
date?: string;
|
|
163
|
-
};
|
|
164
|
-
/**
|
|
165
|
-
* Accept one suggestion: convert its inline marks and block/table node
|
|
166
|
-
* revisions into normal tracked changes authored by `author`, keeping revision
|
|
167
|
-
* ids. A whole inserted table (which OOXML cannot track) is applied directly;
|
|
168
|
-
* everything else becomes a tracked change. See {@link getSuggestions} for the
|
|
169
|
-
* per-suggestion `appliedAs`.
|
|
170
|
-
*/
|
|
171
|
-
export declare function acceptSuggestion(suggestionId: string, options: AcceptSuggestionOptions): Command;
|
|
172
|
-
/** Accept every suggestion in the document. */
|
|
173
|
-
export declare function acceptAllSuggestions(options: AcceptSuggestionOptions): Command;
|
|
174
|
-
/**
|
|
175
|
-
* Reject one suggestion: inverse-apply it in a single transaction. Runs BOTH
|
|
176
|
-
* phases so a heterogeneous group (one `suggestionId` spanning whole-node
|
|
177
|
-
* inserts AND other edits) is fully resolved:
|
|
178
|
-
* 1. inline marks and suggested `trIns`/`trDel`/`cellMarker` revisions are
|
|
179
|
-
* inverse-applied through {@link resolveChange} (delete suggested-inserted
|
|
180
|
-
* text/rows/cells, drop suggested deletions/formatting);
|
|
181
|
-
* 2. any remaining whole-node inserts (paragraph/table) are then deleted,
|
|
182
|
-
* mapped through the accumulated transaction so positions stay valid.
|
|
183
|
-
*
|
|
184
|
-
* A paragraph whole-node insert carries inline marks with the same revision id,
|
|
185
|
-
* so phase 1 empties its text and phase 2 removes the now-empty node; a whole
|
|
186
|
-
* inserted table has no matching revision, so only phase 2 removes it.
|
|
187
|
-
*/
|
|
188
|
-
export declare function rejectSuggestion(suggestionId: string): Command;
|
|
189
|
-
/** Reject every suggestion in the document. */
|
|
190
|
-
export declare function rejectAllSuggestions(): Command;
|
|
191
|
-
/**
|
|
192
|
-
* The story with every pending suggestion rejected: what a save writes, what a
|
|
193
|
-
* read of the saved package shows and what rejecting every change starts from.
|
|
194
|
-
*
|
|
195
|
-
* One rejection resolves each suggestion's revisions against a story the
|
|
196
|
-
* others still stand in. Where a paragraph break it takes out joins into, or
|
|
197
|
-
* is displaced onto, another rejected suggestion's paragraph, that suggestion
|
|
198
|
-
* is left holding a break of its own; the rejection runs again until no
|
|
199
|
-
* suggestion is left, so the story never keeps a rejected break.
|
|
200
|
-
*/
|
|
201
|
-
export declare const rejectEverySuggestion: (state: EditorState) => EditorState;
|
|
202
|
-
/** {@link rejectEverySuggestion}, with where each position of `state` ends. */
|
|
203
|
-
export declare const rejectEverySuggestionMapped: (state: EditorState) => {
|
|
204
|
-
state: EditorState;
|
|
205
|
-
mapping: Mapping;
|
|
206
|
-
};
|
|
207
|
-
type ChangeRange = {
|
|
208
|
-
from: number;
|
|
209
|
-
to: number;
|
|
210
|
-
type: "insertion" | "deletion";
|
|
211
|
-
};
|
|
212
|
-
/**
|
|
213
|
-
* Find the tracked change mark range at a given cursor position.
|
|
214
|
-
* If the cursor is inside a tracked change, returns the full extent
|
|
215
|
-
* of that mark (expanding to cover all adjacent nodes with the same
|
|
216
|
-
* revision ID). If from !== to (range selection), returns {from, to}.
|
|
217
|
-
*/
|
|
218
|
-
export declare function findChangeAtPosition(state: EditorState, from: number, to: number): {
|
|
219
|
-
from: number;
|
|
220
|
-
to: number;
|
|
221
|
-
};
|
|
222
|
-
/**
|
|
223
|
-
* Find the next tracked change after the given position. Returns the full
|
|
224
|
-
* range of the change (including adjacent text nodes that share the same
|
|
225
|
-
* insertion/deletion mark instance), not just the first text node.
|
|
226
|
-
*/
|
|
227
|
-
export declare function findNextChange(state: EditorState, startPos: number): ChangeRange | null;
|
|
228
|
-
/**
|
|
229
|
-
* Find the previous tracked change before the given position. Returns the
|
|
230
|
-
* full range of the change (including adjacent text nodes that share the
|
|
231
|
-
* same insertion/deletion mark instance), not just the last text node.
|
|
232
|
-
*/
|
|
233
|
-
export declare function findPreviousChange(state: EditorState, startPos: number): ChangeRange | null;
|
|
234
|
-
export {};
|
|
1
|
+
/** Compatibility exports for the deep comments command path. */
|
|
2
|
+
import { ParagraphBoundaryChange, addCommentMark, findChangeAtPosition, findNextChange, findParagraphBoundaryChangeAtPosition, findPreviousChange, removeCommentMark, trackedChangeEntryRevisionIds } from "../projectionReview.js";
|
|
3
|
+
import { isPPrMarkAttr, paragraphMarkWasAdded } from "../revisionCarriers.js";
|
|
4
|
+
import { TableRowRevisionAttr, findAIEditRevisionRange, isTableCellRevisionAttr, isTableRowRevisionAttr } from "../revisionRangeQueries.js";
|
|
5
|
+
import { FolioSuggestion, SuggestionAppliedAs, SuggestionKind, collectSuggestions, findSuggestionRange, getSuggestions, isSuggestionMark, mergeSegments, pendingSuggestionRevisionIds, readStructuralSuggestion, readSuggestedMarker, readSuggestedParagraphMark, readSuggestedParagraphPropertyChange, suggestedCommentOf, suggestionCommentIds, suggestionIdOfMarkRecord, suggestionIdOfRevision, suggestionOwnersByRevision } from "../suggestionQueries.js";
|
|
6
|
+
export { type FolioSuggestion, type ParagraphBoundaryChange, type SuggestionAppliedAs, type SuggestionKind, type TableRowRevisionAttr, addCommentMark, collectSuggestions, findAIEditRevisionRange, findChangeAtPosition, findNextChange, findParagraphBoundaryChangeAtPosition, findPreviousChange, findSuggestionRange, getSuggestions, isPPrMarkAttr, isSuggestionMark, isTableCellRevisionAttr, isTableRowRevisionAttr, mergeSegments, paragraphMarkWasAdded, pendingSuggestionRevisionIds, readStructuralSuggestion, readSuggestedMarker, readSuggestedParagraphMark, readSuggestedParagraphPropertyChange, removeCommentMark, suggestedCommentOf, suggestionCommentIds, suggestionIdOfMarkRecord, suggestionIdOfRevision, suggestionOwnersByRevision, trackedChangeEntryRevisionIds };
|