@stll/folio-core 0.53.0 → 0.54.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/ai-edits/apply.js +415 -166
- package/dist/ai-edits/batch-claims.d.ts +21 -6
- package/dist/ai-edits/batch-claims.js +47 -16
- package/dist/ai-edits/headless.d.ts +20 -0
- package/dist/ai-edits/headless.js +140 -11
- package/dist/ai-edits/pending-suggestions.js +1 -1
- package/dist/ai-edits/read.d.ts +5 -3
- package/dist/ai-edits/read.js +97 -47
- package/dist/ai-edits/revisionStretches.d.ts +17 -0
- package/dist/ai-edits/revisionStretches.js +80 -0
- package/dist/ai-edits/snapshot.js +3 -2
- package/dist/ai-edits/table-cell-mutations.d.ts +3 -1
- package/dist/ai-edits/table-cell-mutations.js +2 -1
- package/dist/ai-edits/table-row-column-mutations.d.ts +6 -1
- package/dist/ai-edits/table-row-column-mutations.js +27 -10
- package/dist/compare/content-alignment.d.ts +5 -1
- package/dist/compare/content-alignment.js +39 -32
- package/dist/compare/inline-provenance.js +1 -1
- package/dist/controller/layoutPipeline.js +3 -2
- package/dist/docx/archiveInflation.d.ts +127 -0
- package/dist/docx/archiveInflation.js +181 -0
- package/dist/docx/metadataPrivacy.js +24 -1
- package/dist/docx/noteReferenceMark.d.ts +15 -0
- package/dist/docx/noteReferenceMark.js +48 -0
- package/dist/docx/paragraphParser.js +5 -3
- package/dist/docx/paragraphPropertySource.d.ts +1 -1
- package/dist/docx/paragraphPropertySource.js +4 -2
- package/dist/docx/parser.js +2 -2
- package/dist/docx/rezip.js +4 -2
- package/dist/docx/selectiveXmlPatch.d.ts +3 -1
- package/dist/docx/selectiveXmlPatch.js +81 -3
- package/dist/docx/server/boundedArchive.d.ts +8 -13
- package/dist/docx/server/boundedArchive.js +70 -59
- package/dist/docx/server/extractDocxText.d.ts +8 -2
- package/dist/docx/server/extractDocxText.js +2 -2
- package/dist/docx/server/validateDocxConformance.d.ts +1 -1
- package/dist/docx/server/validateDocxConformance.js +1 -0
- package/dist/docx/unzip.d.ts +19 -2
- package/dist/docx/unzip.js +135 -24
- package/dist/docx/verticalMergeProjection.d.ts +17 -0
- package/dist/docx/verticalMergeProjection.js +120 -0
- package/dist/fonts/embeddedFonts.js +1 -1
- package/dist/i18n/messages/catalogs.gen.d.ts +34 -34
- package/dist/i18n/messages/catalogs.gen.js +34 -34
- package/dist/i18n/messages/messages.gen.d.ts +2 -2
- package/dist/internal/wholeStoryRevisionResolution.js +95 -25
- package/dist/layout-engine/measure/measureParagraph.js +2 -2
- package/dist/layout-engine/measure/paragraphMeasureShared.d.ts +12 -1
- package/dist/layout-engine/measure/paragraphMeasureShared.js +14 -1
- package/dist/markdown/escape.d.ts +2 -2
- package/dist/markdown/escape.js +4 -5
- package/dist/markdown/renderBlock.js +91 -25
- package/dist/markdown/renderRuns.d.ts +10 -1
- package/dist/markdown/renderRuns.js +320 -59
- package/dist/prosemirror/clearRunColor.d.ts +6 -0
- package/dist/prosemirror/clearRunColor.js +46 -0
- package/dist/prosemirror/commands/comments.js +62 -22
- package/dist/prosemirror/commands/formatPainter.js +1 -1
- package/dist/prosemirror/commands/hyperlink.js +2 -1
- package/dist/prosemirror/commands/propertyChangeScope.d.ts +3 -2
- package/dist/prosemirror/commands/propertyChangeScope.js +28 -4
- package/dist/prosemirror/commands/resolveAllTableChanges.js +40 -41
- package/dist/prosemirror/commands/resolveParagraphProperties.js +33 -8
- package/dist/prosemirror/commands/tableCellMergeResolution.d.ts +7 -1
- package/dist/prosemirror/commands/tableCellMergeResolution.js +39 -20
- package/dist/prosemirror/commands/tableMergeFoldDecisions.d.ts +61 -0
- package/dist/prosemirror/commands/tableMergeFoldDecisions.js +79 -0
- package/dist/prosemirror/containerFinalParagraph.d.ts +11 -5
- package/dist/prosemirror/containerFinalParagraph.js +7 -6
- package/dist/prosemirror/conversion/fromProseDoc.d.ts +2 -13
- package/dist/prosemirror/conversion/fromProseDoc.js +12 -590
- package/dist/prosemirror/conversion/toProseDoc.d.ts +1 -13
- package/dist/prosemirror/conversion/toProseDoc.js +28 -262
- package/dist/prosemirror/documentSchema.d.ts +8 -0
- package/dist/prosemirror/documentSchema.js +18 -0
- package/dist/prosemirror/extensions/StarterKit.js +2 -0
- package/dist/prosemirror/extensions/core/ParagraphExtension.js +104 -63
- package/dist/prosemirror/extensions/features/BaseKeymapExtension.js +1 -1
- package/dist/prosemirror/extensions/features/EmptyParagraphFormatExtension.js +24 -3
- package/dist/prosemirror/extensions/features/JoinedRunStyleExtension.d.ts +20 -0
- package/dist/prosemirror/extensions/features/JoinedRunStyleExtension.js +43 -0
- package/dist/prosemirror/extensions/features/ListExtension.js +10 -9
- package/dist/prosemirror/extensions/features/pastedHeadingStyles.js +1 -1
- package/dist/prosemirror/extensions/features/pastedHtmlLists.js +2 -4
- package/dist/prosemirror/extensions/marks/FootnoteRefExtension.js +14 -8
- package/dist/prosemirror/extensions/marks/HyperlinkExtension.js +8 -4
- package/dist/prosemirror/extensions/marks/StrikeExtension.js +2 -2
- package/dist/prosemirror/extensions/marks/SubscriptExtension.js +2 -2
- package/dist/prosemirror/extensions/marks/SuperscriptExtension.js +2 -2
- package/dist/prosemirror/extensions/marks/TextColorExtension.js +4 -3
- package/dist/prosemirror/extensions/marks/markUtils.d.ts +8 -6
- package/dist/prosemirror/extensions/marks/markUtils.js +17 -8
- package/dist/prosemirror/extensions/marks/noteReferenceDeletion.d.ts +3 -1
- package/dist/prosemirror/extensions/marks/noteReferenceDeletion.js +12 -1
- package/dist/prosemirror/extensions/nodes/CommentReferenceExtension.js +2 -2
- package/dist/prosemirror/extensions/nodes/HardBreakExtension.js +5 -3
- package/dist/prosemirror/extensions/nodes/TableExtension.js +104 -210
- package/dist/prosemirror/extensions/types.d.ts +7 -0
- package/dist/prosemirror/hyperlinkRemoval.d.ts +9 -0
- package/dist/prosemirror/hyperlinkRemoval.js +129 -0
- package/dist/prosemirror/index.d.ts +2 -1
- package/dist/prosemirror/index.js +2 -1
- package/dist/prosemirror/listNumbering.d.ts +3 -21
- package/dist/prosemirror/listNumbering.js +24 -39
- package/dist/prosemirror/listRendering.d.ts +29 -0
- package/dist/prosemirror/listRendering.js +26 -0
- package/dist/prosemirror/markupViewNotes.d.ts +8 -0
- package/dist/prosemirror/markupViewNotes.js +49 -0
- package/dist/prosemirror/markupViewProjection.d.ts +3 -1
- package/dist/prosemirror/markupViewProjection.js +7 -2
- package/dist/prosemirror/noteReferenceReview.d.ts +77 -0
- package/dist/prosemirror/noteReferenceReview.js +332 -0
- package/dist/prosemirror/paragraphIndentation.js +5 -2
- package/dist/prosemirror/paragraphMarkJoin.d.ts +6 -4
- package/dist/prosemirror/paragraphMarkJoin.js +21 -19
- package/dist/prosemirror/paragraphPropertyCarry.d.ts +64 -0
- package/dist/prosemirror/paragraphPropertyCarry.js +155 -0
- package/dist/prosemirror/plugins/documentStyleState.d.ts +26 -0
- package/dist/prosemirror/plugins/documentStyleState.js +32 -0
- package/dist/prosemirror/plugins/documentStyles.d.ts +2 -21
- package/dist/prosemirror/plugins/documentStyles.js +66 -29
- package/dist/prosemirror/plugins/index.d.ts +2 -1
- package/dist/prosemirror/plugins/index.js +2 -1
- package/dist/prosemirror/plugins/paragraphStyleResolution.d.ts +15 -0
- package/dist/prosemirror/plugins/paragraphStyleResolution.js +230 -0
- package/dist/prosemirror/plugins/suggestionMode.d.ts +12 -2
- package/dist/prosemirror/plugins/suggestionMode.js +387 -28
- package/dist/prosemirror/plugins/templateDirectives.d.ts +6 -0
- package/dist/prosemirror/plugins/templateDirectives.js +21 -7
- package/dist/prosemirror/plugins/templatePreviewValues.js +14 -21
- package/dist/prosemirror/rebaseParagraphRunFormatting.d.ts +22 -2
- package/dist/prosemirror/rebaseParagraphRunFormatting.js +39 -13
- package/dist/prosemirror/rebaseParagraphRuns.d.ts +36 -0
- package/dist/prosemirror/rebaseParagraphRuns.js +99 -0
- package/dist/prosemirror/runFormattingFromMarks.d.ts +18 -0
- package/dist/prosemirror/runFormattingFromMarks.js +567 -0
- package/dist/prosemirror/runFormattingReconciliation.js +10 -9
- package/dist/prosemirror/schema/nodes.d.ts +2 -0
- package/dist/prosemirror/styles/paragraphStyleCascade.d.ts +59 -0
- package/dist/prosemirror/styles/paragraphStyleCascade.js +145 -0
- package/dist/prosemirror/styles/resolvedStyleAttrs.d.ts +21 -2
- package/dist/prosemirror/styles/resolvedStyleAttrs.js +38 -1
- package/dist/prosemirror/styles/tableStyleRegions.d.ts +31 -0
- package/dist/prosemirror/styles/tableStyleRegions.js +55 -0
- package/dist/prosemirror/tableCellPaste.d.ts +74 -0
- package/dist/prosemirror/tableCellPaste.js +525 -0
- package/dist/prosemirror/tableGridMutation.d.ts +53 -14
- package/dist/prosemirror/tableGridMutation.js +166 -18
- package/dist/prosemirror/tableRunIn.d.ts +51 -0
- package/dist/prosemirror/tableRunIn.js +165 -0
- package/dist/prosemirror/textInput.js +11 -2
- package/dist/prosemirror/trackedRevisionPath.d.ts +17 -0
- package/dist/prosemirror/trackedRevisionPath.js +32 -0
- package/dist/server.d.ts +2 -2
- package/package.json +6 -6
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { isCellMergeContinuation, isCellMergeStart, isTableCellMergeRevisionContinuation } from "../../docx/tableParser.js";
|
|
2
|
+
import { tableCellHasMeaningfulContent } from "../../docx/verticalMergeProjection.js";
|
|
3
|
+
import { expectTableCellAttrs } from "../attrs/index.js";
|
|
4
|
+
import { standaloneTableCellFromProseMirror } from "../conversion/fromProseDoc.js";
|
|
5
|
+
import { panic } from "better-result";
|
|
6
|
+
import { TableMap } from "prosemirror-tables";
|
|
7
|
+
//#region src/prosemirror/commands/tableMergeFoldDecisions.ts
|
|
8
|
+
/** Resolve raw merge states without converting unrelated table revisions. */
|
|
9
|
+
const tableMergeFoldDecisions = ({ table, mode, revisionSet }) => {
|
|
10
|
+
const decisions = /* @__PURE__ */ new Map();
|
|
11
|
+
const origins = /* @__PURE__ */ new Set();
|
|
12
|
+
const invalid = /* @__PURE__ */ new Set();
|
|
13
|
+
const map = TableMap.get(table);
|
|
14
|
+
const visited = /* @__PURE__ */ new Set();
|
|
15
|
+
for (const [index, position] of map.map.entries()) {
|
|
16
|
+
if (visited.has(position)) continue;
|
|
17
|
+
visited.add(position);
|
|
18
|
+
const cell = table.nodeAt(position);
|
|
19
|
+
if (cell?.attrs["cellMarker"]?.kind !== "merge") continue;
|
|
20
|
+
const marker = expectTableCellAttrs(cell).cellMarker;
|
|
21
|
+
if (marker?.kind !== "merge" || revisionSet !== null && !revisionSet.has(marker.info.revisionId)) continue;
|
|
22
|
+
const continues = isTableCellMergeRevisionContinuation(mode === "accept" ? marker.verticalMerge : marker.verticalMergeOriginal);
|
|
23
|
+
decisions.set(position, continues && (mode === "reject" || !tableCellHasMeaningfulContent(standaloneTableCellFromProseMirror(cell))));
|
|
24
|
+
if (!continues) continue;
|
|
25
|
+
if (Math.floor(index / map.width) === 0) {
|
|
26
|
+
invalid.add(position);
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
const abovePosition = map.map[index - map.width];
|
|
30
|
+
if (abovePosition === void 0) return panic("Merge resolution lost its origin");
|
|
31
|
+
const above = table.nodeAt(abovePosition);
|
|
32
|
+
if (!above) return panic("Merge resolution lost its origin");
|
|
33
|
+
const rectangle = map.findCell(position);
|
|
34
|
+
const aboveRectangle = map.findCell(abovePosition);
|
|
35
|
+
if (rectangle.left !== aboveRectangle.left || rectangle.right !== aboveRectangle.right || rectangle.top !== aboveRectangle.bottom) {
|
|
36
|
+
invalid.add(position);
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
const aboveMarker = expectTableCellAttrs(above).cellMarker;
|
|
40
|
+
const aboveContinues = aboveMarker?.kind === "merge" && (revisionSet === null || revisionSet.has(aboveMarker.info.revisionId)) && isTableCellMergeRevisionContinuation(mode === "accept" ? aboveMarker.verticalMerge : aboveMarker.verticalMergeOriginal);
|
|
41
|
+
const aboveModel = standaloneTableCellFromProseMirror(above);
|
|
42
|
+
if (mode === "accept" && (aboveContinues && decisions.get(abovePosition) === false || isCellMergeContinuation(aboveModel) && tableCellHasMeaningfulContent(aboveModel))) decisions.set(position, false);
|
|
43
|
+
if (aboveContinues || isCellMergeContinuation(aboveModel) || isCellMergeStart(aboveModel)) continue;
|
|
44
|
+
origins.add(abovePosition);
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
folds: decisions,
|
|
48
|
+
origins,
|
|
49
|
+
invalid
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
/** Persist an implicit merge origin even when reader rules retain its continuation. */
|
|
53
|
+
const resolvedTableMergeOriginAttrs = (cell) => ({
|
|
54
|
+
...cell.attrs,
|
|
55
|
+
_originalFormatting: {
|
|
56
|
+
...expectTableCellAttrs(cell)._originalFormatting,
|
|
57
|
+
vMerge: "restart"
|
|
58
|
+
},
|
|
59
|
+
_preserveVMergeRestart: true
|
|
60
|
+
});
|
|
61
|
+
/** A retained continuation must save the merge state the reviewer resolved. */
|
|
62
|
+
const resolvedVisibleTableCellMergeAttrs = ({ cell, mode, origin }) => {
|
|
63
|
+
const attrs = expectTableCellAttrs(cell);
|
|
64
|
+
const marker = attrs.cellMarker;
|
|
65
|
+
if (marker?.kind !== "merge") return panic("Cell has no merge revision");
|
|
66
|
+
const continuation = mode === "accept" ? marker.verticalMerge : marker.verticalMergeOriginal;
|
|
67
|
+
const formatting = { ...attrs._originalFormatting };
|
|
68
|
+
if (origin) formatting.vMerge = "restart";
|
|
69
|
+
else if (isTableCellMergeRevisionContinuation(continuation)) formatting.vMerge = "continue";
|
|
70
|
+
else delete formatting.vMerge;
|
|
71
|
+
return {
|
|
72
|
+
...cell.attrs,
|
|
73
|
+
cellMarker: null,
|
|
74
|
+
_originalFormatting: formatting,
|
|
75
|
+
_preserveVMergeRestart: origin
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
//#endregion
|
|
79
|
+
export { resolvedTableMergeOriginAttrs, resolvedVisibleTableCellMergeAttrs, tableMergeFoldDecisions };
|
|
@@ -28,18 +28,24 @@ declare const finalParagraphsOf: (doc: Node, paragraphTypeName: string) => {
|
|
|
28
28
|
position: number;
|
|
29
29
|
node: Node;
|
|
30
30
|
}[];
|
|
31
|
+
type AddedBreakCarrierBeforeOptions = {
|
|
32
|
+
at: ResolvedPos;
|
|
33
|
+
paragraphTypeName: string;
|
|
34
|
+
canCrossTable?: (table: Node) => boolean;
|
|
35
|
+
};
|
|
31
36
|
/**
|
|
32
37
|
* The paragraph an added break can rotate BACK onto from the one at `at`: the
|
|
33
38
|
* paragraph the run of inserted ones was appended after.
|
|
34
39
|
*
|
|
35
40
|
* The walk crosses the inserted paragraphs — their own marks stay where they
|
|
36
41
|
* are, and only which paragraph is left markless changes — and stops at the
|
|
37
|
-
* first one whose mark is free.
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
42
|
+
* first one whose mark is free. A table blocks the walk unless the caller
|
|
43
|
+
* authorizes a wholly inserted table: rejecting it removes that barrier too.
|
|
44
|
+
* `null` when there is no carrier: a table the caller cannot cross, a
|
|
45
|
+
* paragraph whose mark the rotation must not overwrite, or a container whose
|
|
46
|
+
* every paragraph is new.
|
|
41
47
|
*/
|
|
42
|
-
declare const addedBreakCarrierBefore: (at
|
|
48
|
+
declare const addedBreakCarrierBefore: ({ at, paragraphTypeName, canCrossTable }: AddedBreakCarrierBeforeOptions) => {
|
|
43
49
|
position: number;
|
|
44
50
|
node: Node;
|
|
45
51
|
} | null;
|
|
@@ -66,18 +66,19 @@ const marksAnAddedBreak = (node) => {
|
|
|
66
66
|
*
|
|
67
67
|
* The walk crosses the inserted paragraphs — their own marks stay where they
|
|
68
68
|
* are, and only which paragraph is left markless changes — and stops at the
|
|
69
|
-
* first one whose mark is free.
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
69
|
+
* first one whose mark is free. A table blocks the walk unless the caller
|
|
70
|
+
* authorizes a wholly inserted table: rejecting it removes that barrier too.
|
|
71
|
+
* `null` when there is no carrier: a table the caller cannot cross, a
|
|
72
|
+
* paragraph whose mark the rotation must not overwrite, or a container whose
|
|
73
|
+
* every paragraph is new.
|
|
73
74
|
*/
|
|
74
|
-
const addedBreakCarrierBefore = (at, paragraphTypeName) => {
|
|
75
|
+
const addedBreakCarrierBefore = ({ at, paragraphTypeName, canCrossTable }) => {
|
|
75
76
|
let position = at.pos;
|
|
76
77
|
for (let index = at.index() - 1; index >= 0; index--) {
|
|
77
78
|
const sibling = at.parent.child(index);
|
|
78
79
|
position -= sibling.nodeSize;
|
|
79
80
|
if (sibling.type.name !== paragraphTypeName) {
|
|
80
|
-
if (isAContainerChild(sibling, paragraphTypeName)) return null;
|
|
81
|
+
if (isAContainerChild(sibling, paragraphTypeName) && !canCrossTable?.(sibling)) return null;
|
|
81
82
|
continue;
|
|
82
83
|
}
|
|
83
84
|
if (sibling.attrs["pPrMark"] == null) return {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { document_d_exports } from "../../types/document.js";
|
|
2
2
|
import { TableAttrs, TableCellAttrs, TableRowAttrs } from "../schema/nodes.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { marksToTextFormatting } from "../runFormattingFromMarks.js";
|
|
4
|
+
import { Node } from "prosemirror-model";
|
|
5
5
|
//#region src/prosemirror/conversion/fromProseDoc.d.ts
|
|
6
6
|
/**
|
|
7
7
|
* Whether a record the editor did not change may come back from the base
|
|
@@ -21,17 +21,6 @@ type FromProseDocOptions = {
|
|
|
21
21
|
};
|
|
22
22
|
/** Convert a ProseMirror document to the document model. */
|
|
23
23
|
declare function fromProseDoc(pmDoc: Node, baseDocument?: document_d_exports.Document, { reuse }?: FromProseDocOptions): document_d_exports.Document;
|
|
24
|
-
/**
|
|
25
|
-
* Convert ProseMirror marks to TextFormatting
|
|
26
|
-
*/
|
|
27
|
-
type MarksToTextFormattingOptions = {
|
|
28
|
-
baseParagraphFormatting?: document_d_exports.TextFormatting | undefined;
|
|
29
|
-
inheritedFormatting?: document_d_exports.TextFormatting | undefined;
|
|
30
|
-
paragraphMarkFormatting?: document_d_exports.TextFormatting | undefined;
|
|
31
|
-
paragraphMarkPrecedesStyle?: boolean | undefined;
|
|
32
|
-
styleResolver?: RunStyleResolver | null | undefined;
|
|
33
|
-
};
|
|
34
|
-
declare function marksToTextFormatting(marks: readonly Mark[], options?: MarksToTextFormattingOptions): document_d_exports.TextFormatting;
|
|
35
24
|
declare function tableAttrsToFormatting(attrs: TableAttrs): document_d_exports.TableFormatting | undefined;
|
|
36
25
|
/**
|
|
37
26
|
* Convert ProseMirror table row attrs to TableRowFormatting
|