@stll/folio-core 0.63.0 → 0.64.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 +5 -4
- package/dist/ai-edits/headless.js +10 -67
- package/dist/compare/content.d.ts +7 -7
- package/dist/compare/content.js +6 -3
- package/dist/compare/types.d.ts +15 -14
- package/dist/compare/types.js +14 -7
- package/dist/content-controls/errors.d.ts +7 -6
- package/dist/content-controls/errors.js +6 -3
- package/dist/controller/canonicalComments.d.ts +4 -3
- package/dist/controller/canonicalComments.js +2 -1
- package/dist/controller/canonicalInlineProjection.d.ts +3 -3
- package/dist/controller/canonicalInlineProjection.js +2 -1
- package/dist/controller/canonicalListRendering.d.ts +5 -3
- package/dist/controller/canonicalPublicOperations.js +2 -1
- package/dist/controller/canonicalSession.d.ts +5 -5
- package/dist/controller/canonicalSession.js +2 -1
- package/dist/controller/hiddenEditorManager.d.ts +3 -2
- package/dist/controller/hiddenEditorManager.js +2 -1
- package/dist/document-operations.d.ts +5 -4
- package/dist/document-operations.js +4 -2
- package/dist/docx/appVersionNormalization.d.ts +3 -2
- package/dist/docx/appVersionNormalization.js +2 -1
- package/dist/docx/attributeRemainder.d.ts +3 -2
- package/dist/docx/attributeRemainder.js +2 -1
- package/dist/docx/canonicalResourceSave.d.ts +3 -2
- package/dist/docx/canonicalResourceSave.js +2 -1
- package/dist/docx/canonicalSave.d.ts +6 -4
- package/dist/docx/canonicalSave.js +2 -1
- package/dist/docx/canonicalSessionInput.d.ts +4 -3
- package/dist/docx/canonicalSessionInput.js +2 -1
- package/dist/docx/encryption/errors.d.ts +3 -2
- package/dist/docx/encryption/errors.js +2 -1
- package/dist/docx/ensureParaIds.d.ts +3 -2
- package/dist/docx/ensureParaIds.js +2 -1
- package/dist/docx/headerFooterVerbatim.d.ts +2 -2
- package/dist/docx/imageParser.d.ts +1 -1
- package/dist/docx/index.d.ts +1 -0
- package/dist/docx/linkedSdtPreservation.d.ts +5 -3
- package/dist/docx/linkedSdtPreservation.js +2 -1
- package/dist/docx/metadataPrivacy.d.ts +5 -4
- package/dist/docx/metadataPrivacy.js +4 -2
- package/dist/docx/numericIdAllocator.js +2 -1
- package/dist/docx/paragraphPropertySource.d.ts +3 -2
- package/dist/docx/paragraphPropertySource.js +2 -1
- package/dist/docx/parser.d.ts +3 -2
- package/dist/docx/parser.js +2 -1
- package/dist/docx/reviewResolutionProvenance.d.ts +3 -2
- package/dist/docx/reviewResolutionProvenance.js +2 -1
- package/dist/docx/revisionIdNormalization.d.ts +3 -2
- package/dist/docx/revisionIdNormalization.js +2 -1
- package/dist/docx/rezip.d.ts +5 -4
- package/dist/docx/rezip.js +4 -2
- package/dist/docx/sectionReferenceHistory.d.ts +3 -2
- package/dist/docx/sectionReferenceHistory.js +2 -1
- package/dist/docx/serializer/paragraphSerializer.js +6 -3
- package/dist/docx/serializer/partNamespaces.d.ts +3 -2
- package/dist/docx/serializer/partNamespaces.js +2 -1
- package/dist/docx/server/applyDocxXmlPatchProposal.d.ts +5 -4
- package/dist/docx/server/applyDocxXmlPatchProposal.js +4 -2
- package/dist/docx/server/boundedArchive.d.ts +3 -2
- package/dist/docx/server/boundedArchive.js +2 -1
- package/dist/docx/server/build.d.ts +3 -2
- package/dist/docx/server/build.js +2 -1
- package/dist/docx/server/createBilingualDocument.d.ts +3 -2
- package/dist/docx/server/createBilingualDocument.js +4 -2
- package/dist/docx/server/evaluateDocxXmlPatchProposal.d.ts +5 -4
- package/dist/docx/server/evaluateDocxXmlPatchProposal.js +4 -2
- package/dist/docx/server/inspectDocxPackage.d.ts +3 -2
- package/dist/docx/server/inspectDocxPackage.js +2 -1
- package/dist/docx/server/materializeYjsDocx.d.ts +3 -2
- package/dist/docx/server/materializeYjsDocx.js +2 -1
- package/dist/docx/server/migrateYjsAttrSchema.d.ts +3 -3
- package/dist/docx/server/migrateYjsAttrSchema.js +2 -1
- package/dist/docx/tableParser.d.ts +4 -4
- package/dist/docx/verbatimCapture.d.ts +3 -2
- package/dist/docx/verbatimCapture.js +2 -1
- package/dist/docx/xmlResourceLimits.d.ts +3 -2
- package/dist/docx/xmlResourceLimits.js +5 -2
- package/dist/export-pdf.d.ts +3 -3
- package/dist/export-pdf.js +2 -1
- package/dist/fonts/headlessMeasure.d.ts +3 -3
- package/dist/fonts/headlessMeasure.js +2 -1
- package/dist/fonts/sfnt/parse.d.ts +3 -3
- package/dist/fonts/sfnt/parse.js +2 -1
- package/dist/fonts/sfnt/subset.d.ts +3 -3
- package/dist/fonts/sfnt/subset.js +2 -1
- package/dist/fonts/sfnt/tables.d.ts +3 -3
- package/dist/fonts/sfnt/tables.js +2 -1
- package/dist/fonts/sfnt/woff.d.ts +3 -3
- package/dist/fonts/sfnt/woff.js +2 -1
- package/dist/headless-layout.d.ts +3 -3
- package/dist/headless-layout.js +2 -1
- package/dist/layout-engine/measure/font-metrics.worker.js +2 -1
- package/dist/layout-engine/measure/hyphenationDictionaries.d.ts +3 -20
- package/dist/layout-engine/measure/hyphenationDictionaries.js +2 -1
- package/dist/layout-engine/section-breaks.d.ts +1 -1
- package/dist/layout-painter/renderPage.d.ts +6 -0
- package/dist/layout-painter/renderPage.js +83 -47
- package/dist/paged-layout/editorScrollRoot.d.ts +4 -0
- package/dist/paged-layout/editorScrollRoot.js +11 -3
- package/dist/paged-layout/scrollToPmPosition.js +41 -51
- package/dist/pdf/fonts.js +2 -1
- package/dist/pdf/images.d.ts +3 -3
- package/dist/pdf/images.js +2 -1
- package/dist/pdf/paint.d.ts +3 -3
- package/dist/pdf/paint.js +2 -1
- package/dist/pdf/writePdf.d.ts +3 -3
- package/dist/pdf/writePdf.js +2 -1
- package/dist/prosemirror/canonicalCommands.d.ts +9 -9
- package/dist/prosemirror/commands/tableMergeFoldDecisions.d.ts +15 -14
- package/dist/prosemirror/commentIdAllocator.d.ts +3 -2
- package/dist/prosemirror/commentIdAllocator.js +2 -1
- package/dist/prosemirror/conversion/fromProseDoc.js +4 -2
- package/dist/prosemirror/extensions/core/DocExtension.d.ts +0 -3
- package/dist/prosemirror/extensions/core/HistoryExtension.d.ts +0 -3
- package/dist/prosemirror/extensions/core/TextExtension.d.ts +0 -3
- package/dist/prosemirror/extensions/features/AutoBidiDetectionExtension.d.ts +2 -2
- package/dist/prosemirror/extensions/features/BidiShortcutExtension.d.ts +0 -10
- package/dist/prosemirror/extensions/features/ContentControlWidgetsExtension.d.ts +0 -10
- package/dist/prosemirror/extensions/features/DropCursorExtension.d.ts +0 -6
- package/dist/prosemirror/extensions/features/EmptyParagraphFormatExtension.d.ts +4 -4
- package/dist/prosemirror/extensions/features/GapCursorExtension.d.ts +0 -13
- package/dist/prosemirror/extensions/features/ImageDragExtension.d.ts +0 -9
- package/dist/prosemirror/extensions/features/ImagePasteExtension.d.ts +0 -6
- package/dist/prosemirror/extensions/features/JoinedRunStyleExtension.d.ts +0 -14
- package/dist/prosemirror/extensions/features/ParaIdAllocatorExtension.d.ts +3 -2
- package/dist/prosemirror/extensions/features/ParaIdAllocatorExtension.js +77 -46
- package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.d.ts +2 -2
- package/dist/prosemirror/extensions/features/PasteCleanupExtension.d.ts +0 -17
- package/dist/prosemirror/extensions/features/PasteStyleInlinerExtension.d.ts +0 -14
- package/dist/prosemirror/extensions/marks/AllCapsExtension.d.ts +0 -3
- package/dist/prosemirror/extensions/marks/BoldExtension.d.ts +0 -3
- package/dist/prosemirror/extensions/marks/CharacterSpacingExtension.d.ts +0 -8
- package/dist/prosemirror/extensions/marks/CharacterStyleExtension.d.ts +0 -14
- package/dist/prosemirror/extensions/marks/CommentExtension.d.ts +0 -6
- package/dist/prosemirror/extensions/marks/FontFamilyExtension.d.ts +0 -3
- package/dist/prosemirror/extensions/marks/FontSizeExtension.d.ts +0 -3
- package/dist/prosemirror/extensions/marks/FootnoteRefExtension.d.ts +0 -5
- package/dist/prosemirror/extensions/marks/HiddenTextExtension.d.ts +0 -17
- package/dist/prosemirror/extensions/marks/InlineWrapperExtension.d.ts +0 -12
- package/dist/prosemirror/extensions/marks/ItalicExtension.d.ts +0 -3
- package/dist/prosemirror/extensions/marks/SmallCapsExtension.d.ts +0 -3
- package/dist/prosemirror/extensions/marks/StrikeExtension.d.ts +0 -3
- package/dist/prosemirror/extensions/marks/SubscriptExtension.d.ts +0 -3
- package/dist/prosemirror/extensions/marks/SuperscriptExtension.d.ts +0 -3
- package/dist/prosemirror/extensions/marks/TextColorExtension.d.ts +0 -3
- package/dist/prosemirror/extensions/marks/TextEffectsExtensions.d.ts +0 -6
- package/dist/prosemirror/extensions/marks/TrackedChangeExtensions.d.ts +0 -7
- package/dist/prosemirror/extensions/marks/UnderlineExtension.d.ts +0 -3
- package/dist/prosemirror/extensions/marks/markUtils.d.ts +8 -7
- package/dist/prosemirror/extensions/nodes/BlockBookmarkBoundaryExtension.d.ts +0 -22
- package/dist/prosemirror/extensions/nodes/BlockMoveRangeBoundaryExtension.d.ts +0 -14
- package/dist/prosemirror/extensions/nodes/BlockSdtExtension.d.ts +0 -17
- package/dist/prosemirror/extensions/nodes/BookmarkBoundaryExtension.d.ts +0 -1
- package/dist/prosemirror/extensions/nodes/FieldExtension.d.ts +0 -8
- package/dist/prosemirror/extensions/nodes/HardBreakExtension.d.ts +0 -3
- package/dist/prosemirror/extensions/nodes/HorizontalRuleExtension.d.ts +0 -3
- package/dist/prosemirror/extensions/nodes/ImageExtension.d.ts +0 -3
- package/dist/prosemirror/extensions/nodes/MathExtension.d.ts +0 -7
- package/dist/prosemirror/extensions/nodes/MoveRangeBoundaryExtension.d.ts +0 -1
- package/dist/prosemirror/extensions/nodes/PageBreakExtension.d.ts +0 -3
- package/dist/prosemirror/extensions/nodes/PageBreakRunExtension.d.ts +0 -1
- package/dist/prosemirror/extensions/nodes/PreservedBlockExtension.d.ts +0 -25
- package/dist/prosemirror/extensions/nodes/PreservedXmlExtension.d.ts +0 -9
- package/dist/prosemirror/extensions/nodes/RangeAnchorExtension.d.ts +0 -1
- package/dist/prosemirror/extensions/nodes/RenderedPageBreakExtension.d.ts +0 -1
- package/dist/prosemirror/extensions/nodes/SdtExtension.d.ts +0 -6
- package/dist/prosemirror/extensions/nodes/TabExtension.d.ts +0 -3
- package/dist/prosemirror/extensions/nodes/TextBoxAnchorExtension.d.ts +0 -7
- package/dist/prosemirror/hyperlinkRemoval.d.ts +3 -2
- package/dist/prosemirror/hyperlinkRemoval.js +2 -1
- package/dist/prosemirror/markupViewProjection.d.ts +3 -3
- package/dist/prosemirror/noteReferenceOccurrences.d.ts +6 -5
- package/dist/prosemirror/noteReferenceOccurrences.js +4 -2
- package/dist/prosemirror/numberingAttr.d.ts +5 -5
- package/dist/prosemirror/plugins/aiCitationDecorations.d.ts +4 -4
- package/dist/prosemirror/plugins/aiSuggestionDecorations.d.ts +4 -4
- package/dist/prosemirror/plugins/anonymizationDecorations.d.ts +2 -2
- package/dist/prosemirror/plugins/autocompleteSuggestion.d.ts +2 -2
- package/dist/prosemirror/plugins/contentControlWidgets.d.ts +4 -4
- package/dist/prosemirror/plugins/documentStyleState.d.ts +4 -4
- package/dist/prosemirror/plugins/revisionIds.d.ts +3 -2
- package/dist/prosemirror/plugins/revisionIds.js +2 -1
- package/dist/prosemirror/plugins/selectionTracker.d.ts +2 -2
- package/dist/prosemirror/plugins/suggestionMode.d.ts +2 -2
- package/dist/prosemirror/plugins/templateDirectives.d.ts +5 -5
- package/dist/prosemirror/plugins/templatePreviewValues.d.ts +4 -4
- package/dist/prosemirror/plugins/templateSlashMenu.d.ts +2 -2
- package/dist/prosemirror/preservedXmlReview.d.ts +2 -2
- package/dist/prosemirror/runStyleFormatting.d.ts +7 -7
- package/dist/prosemirror/schema/index.d.ts +2 -1
- package/dist/prosemirror/schema/index.js +0 -7
- package/dist/prosemirror/styles/styleResolver.d.ts +1 -1
- package/dist/prosemirror/textInput.d.ts +3 -2
- package/dist/prosemirror/yjsDocumentMetadata.d.ts +8 -8
- package/dist/prosemirror/yjsDocumentMetadata.js +6 -3
- package/dist/redline.d.ts +5 -4
- package/dist/redline.js +4 -2
- package/dist/redlineOperationLimit.d.ts +3 -2
- package/dist/redlineOperationLimit.js +2 -1
- package/dist/render-dom/commentAnchorAttributes.d.ts +1 -1
- package/dist/shaping/shaper.d.ts +3 -21
- package/dist/shaping/shaper.js +2 -1
- package/dist/utils/clipboard.d.ts +2 -2
- package/dist/utils/clipboard.js +2 -2
- package/dist/utils/formatToStyle.d.ts +1 -1
- package/dist/utils/headingCollector.d.ts +7 -0
- package/dist/utils/headingCollector.js +9 -1
- package/dist/utils/outlineHeadings.d.ts +20 -0
- package/dist/utils/outlineHeadings.js +43 -0
- package/dist/utils/units.d.ts +1 -1
- package/dist/version-comparison.d.ts +3 -2
- package/dist/version-comparison.js +2 -1
- package/package.json +3 -3
|
@@ -11,6 +11,7 @@ import { FolioReviewChange, FolioReviewChangeKind } from "./read.js";
|
|
|
11
11
|
import { FolioStoryTable } from "./snapshot.js";
|
|
12
12
|
import { TableGeometryPairing } from "./table-geometry.js";
|
|
13
13
|
import { Node } from "prosemirror-model";
|
|
14
|
+
import { TaggedErrorClass } from "better-result";
|
|
14
15
|
//#region src/ai-edits/headless.d.ts
|
|
15
16
|
/** Options for {@link FolioDocxReviewer.fromBuffer}. */
|
|
16
17
|
export type FolioDocxReviewerOptions = {
|
|
@@ -134,13 +135,13 @@ export type FolioReviewedStory = {
|
|
|
134
135
|
text: string;
|
|
135
136
|
changes: FolioReviewChange[];
|
|
136
137
|
};
|
|
137
|
-
declare const
|
|
138
|
-
export declare class UnsupportedFolioReviewedViewError extends
|
|
138
|
+
declare const UnsupportedFolioReviewedViewErrorBase: TaggedErrorClass<"UnsupportedFolioReviewedViewError">;
|
|
139
|
+
export declare class UnsupportedFolioReviewedViewError extends UnsupportedFolioReviewedViewErrorBase<{
|
|
139
140
|
message: string;
|
|
140
141
|
receivedView: unknown;
|
|
141
142
|
}> {}
|
|
142
|
-
declare const
|
|
143
|
-
export declare class FolioDocumentStoryNotFoundError extends
|
|
143
|
+
declare const FolioDocumentStoryNotFoundErrorBase: TaggedErrorClass<"FolioDocumentStoryNotFoundError">;
|
|
144
|
+
export declare class FolioDocumentStoryNotFoundError extends FolioDocumentStoryNotFoundErrorBase<{
|
|
144
145
|
message: string;
|
|
145
146
|
story: FolioEditableDocumentStoryHandle;
|
|
146
147
|
}> {}
|
|
@@ -12,7 +12,6 @@ import { isSeparatorEndnote, isSeparatorFootnote } from "../docx/footnoteParser.
|
|
|
12
12
|
import { normalizeListModelRendering } from "../docx/listModelNormalization.js";
|
|
13
13
|
import { createNumberingIdAllocator } from "../docx/numberingIds.js";
|
|
14
14
|
import { getCachedNumberingMap } from "../docx/numberingParser.js";
|
|
15
|
-
import { recreateProseNodeWithParagraphPropertySource, transferProseParagraphPropertySource } from "../docx/paragraphPropertySource.js";
|
|
16
15
|
import { visitDocxParagraphs } from "../docx/paragraphTraversal.js";
|
|
17
16
|
import { parseDocx } from "../docx/parser.js";
|
|
18
17
|
import { createReply } from "../docx/replyToComment.js";
|
|
@@ -30,6 +29,7 @@ import { allocateCommentId, createCommentIdAllocator, seedCommentAllocator } fro
|
|
|
30
29
|
import { fromProseDoc, proseDocToBlocks } from "../prosemirror/conversion/fromProseDoc.js";
|
|
31
30
|
import { footnoteToProseDoc, headerFooterToProseDoc, toProseDoc } from "../prosemirror/conversion/toProseDoc.js";
|
|
32
31
|
import { ensureBaseDirectionInState } from "../prosemirror/extensions/features/AutoBidiDetectionExtension.js";
|
|
32
|
+
import { ensureParaIdsInDoc } from "../prosemirror/extensions/features/ParaIdAllocatorExtension.js";
|
|
33
33
|
import { getChangedParagraphIds, getTrackedSectionEndpointRemoval, hasStructuralChanges, hasUntrackedChanges } from "../prosemirror/extensions/features/ParagraphChangeTrackerExtension.js";
|
|
34
34
|
import { completeNumberingForDoc } from "../prosemirror/listInstanceReferences.js";
|
|
35
35
|
import "../prosemirror/listMarker.js";
|
|
@@ -42,7 +42,6 @@ import { sectionPropertiesOf } from "../prosemirror/sectionCarrier.js";
|
|
|
42
42
|
import { storyListNumbering } from "../prosemirror/storyListNumbering.js";
|
|
43
43
|
import { collapseEmptyTextBoxHosts } from "../prosemirror/textBoxHostCollapse.js";
|
|
44
44
|
import { canonicalJson } from "../utils/canonicalJson.js";
|
|
45
|
-
import { deterministicHexId } from "../utils/hexId.js";
|
|
46
45
|
import { buildAnnotatedBlockTextWithNoteReferences } from "./clean-text.js";
|
|
47
46
|
import { anchoredCommentIdsInBlocks, anchoredCommentIdsInProseDoc, coveredCommentIdsInProseDoc, withoutLostCommentThreads } from "./comment-lifecycle.js";
|
|
48
47
|
import { noteReferenceEditsAllowed } from "./note-references.js";
|
|
@@ -55,7 +54,6 @@ import { matchTableGeometry } from "./table-geometry.js";
|
|
|
55
54
|
import { tableTemplateCanCrossPackageLosslessly } from "./table-template.js";
|
|
56
55
|
import { TaggedError, panic } from "better-result";
|
|
57
56
|
import { REVIEW_CARRIERS, finalizeParagraphFormatting, numberingLevelEntries, setDocumentBodyComments } from "@stll/docx-core/model";
|
|
58
|
-
import { Fragment } from "prosemirror-model";
|
|
59
57
|
import { reconcileDocumentPartRelationships } from "@stll/docx-core/ops";
|
|
60
58
|
import { EditorState } from "prosemirror-state";
|
|
61
59
|
import JSZip from "jszip";
|
|
@@ -87,79 +85,24 @@ const createReviewerComment = ({ id, text, author, date }) => ({
|
|
|
87
85
|
date: date ?? (/* @__PURE__ */ new Date()).toISOString(),
|
|
88
86
|
content: [commentTextParagraph(text)]
|
|
89
87
|
});
|
|
90
|
-
/**
|
|
91
|
-
* Assign a stable `w14:paraId` to every body paragraph that lacks one (or
|
|
92
|
-
* duplicates an earlier id), derived deterministically from the paragraph's
|
|
93
|
-
* text plus its document ordinal. Re-parsing the SAME bytes mints the SAME ids,
|
|
94
|
-
* so the block ids a snapshot exposes are reproducible across
|
|
95
|
-
* {@link FolioDocxReviewer.fromBuffer} calls — the documented "snapshot on one
|
|
96
|
-
* parse, apply on another" flow resolves instead of skipping every op as a
|
|
97
|
-
* stale anchor. Word-authored paraIds are preserved; only gaps and collisions
|
|
98
|
-
* get a fresh id.
|
|
99
|
-
*
|
|
100
|
-
* The shared `ParaIdAllocatorExtension` mints RANDOM ids (correct for freshly
|
|
101
|
-
* typed paragraphs in the live editor); this load-time pass is deterministic so
|
|
102
|
-
* a paraId-less corpus document anchors reproducibly.
|
|
103
|
-
*
|
|
104
|
-
* Rebuilding only the changed branches, like {@link ensureParaIdsInDoc}, keeps
|
|
105
|
-
* the pass linear in paragraph count. Seeding through a transaction instead
|
|
106
|
-
* costs one `setNodeMarkup` step per paragraph, and both halves of that are
|
|
107
|
-
* quadratic: every step rebuilds the containing fragment, and the plugin
|
|
108
|
-
* `appendTransaction` chain rescans the accumulated step maps. Because the pass
|
|
109
|
-
* runs before the state exists, no history, mapping, or change-tracking
|
|
110
|
-
* semantics depend on it.
|
|
111
|
-
*/
|
|
112
|
-
const ensureDeterministicParaIdsInDoc = (doc) => {
|
|
113
|
-
const seen = /* @__PURE__ */ new Set();
|
|
114
|
-
let ordinal = 0;
|
|
115
|
-
const rewrite = (parent) => {
|
|
116
|
-
let changed = false;
|
|
117
|
-
const children = [];
|
|
118
|
-
parent.forEach((child) => {
|
|
119
|
-
let next = child;
|
|
120
|
-
if (child.type.name === "paragraph") {
|
|
121
|
-
ordinal += 1;
|
|
122
|
-
const existing = child.attrs["paraId"];
|
|
123
|
-
if (typeof existing === "string" && existing.length > 0 && !seen.has(existing)) seen.add(existing);
|
|
124
|
-
else {
|
|
125
|
-
let paraId = deterministicHexId(`${child.textContent}:${ordinal}`);
|
|
126
|
-
for (let salt = 1; seen.has(paraId); salt++) paraId = deterministicHexId(`${child.textContent}:${ordinal}:${salt}`);
|
|
127
|
-
seen.add(paraId);
|
|
128
|
-
next = recreateProseNodeWithParagraphPropertySource(child, { attrs: {
|
|
129
|
-
...child.attrs,
|
|
130
|
-
paraId,
|
|
131
|
-
idStability: "positional"
|
|
132
|
-
} });
|
|
133
|
-
}
|
|
134
|
-
const paraId = next.attrs["paraId"];
|
|
135
|
-
if (typeof paraId === "string") transferProseParagraphPropertySource(next, child, paraId);
|
|
136
|
-
} else if (child.childCount > 0) {
|
|
137
|
-
const content = rewrite(child);
|
|
138
|
-
if (content !== child.content) next = recreateProseNodeWithParagraphPropertySource(child, { content });
|
|
139
|
-
}
|
|
140
|
-
if (next !== child) changed = true;
|
|
141
|
-
children.push(next);
|
|
142
|
-
});
|
|
143
|
-
return changed ? Fragment.fromArray(children) : parent.content;
|
|
144
|
-
};
|
|
145
|
-
const content = rewrite(doc);
|
|
146
|
-
return content === doc.content ? doc : recreateProseNodeWithParagraphPropertySource(doc, { content });
|
|
147
|
-
};
|
|
148
88
|
const FOLIO_REVIEWED_VIEWS = Object.freeze([
|
|
149
89
|
"original",
|
|
150
90
|
"current-markup",
|
|
151
91
|
"final"
|
|
152
92
|
]);
|
|
153
93
|
const FOLIO_RESOLVED_REVIEWED_VIEWS = Object.freeze(["original", "final"]);
|
|
154
|
-
|
|
155
|
-
var
|
|
94
|
+
const UnsupportedFolioReviewedViewErrorBase = TaggedError("UnsupportedFolioReviewedViewError");
|
|
95
|
+
var UnsupportedFolioReviewedViewError = class extends UnsupportedFolioReviewedViewErrorBase {};
|
|
96
|
+
const FolioDocumentStoryNotFoundErrorBase = TaggedError("FolioDocumentStoryNotFoundError");
|
|
97
|
+
var FolioDocumentStoryNotFoundError = class extends FolioDocumentStoryNotFoundErrorBase {};
|
|
156
98
|
const FOLIO_RESOLVED_STORY_SERIALIZATION_MISMATCHES = Object.freeze({
|
|
157
99
|
storyMissing: "story-missing",
|
|
158
100
|
revisionMarkupRemains: "revision-markup-remains",
|
|
159
101
|
textProjection: "text-projection",
|
|
160
102
|
blockProjection: "block-projection"
|
|
161
103
|
});
|
|
162
|
-
|
|
104
|
+
const FolioResolvedStorySerializationErrorBase = TaggedError("FolioResolvedStorySerializationError");
|
|
105
|
+
var FolioResolvedStorySerializationError = class extends FolioResolvedStorySerializationErrorBase {};
|
|
163
106
|
/** Blocks whose id folio minted, because the package names no id for them. */
|
|
164
107
|
const mintedBlockOrdinals = (snapshot) => {
|
|
165
108
|
const ordinals = /* @__PURE__ */ new Set();
|
|
@@ -660,7 +603,7 @@ var FolioDocxReviewer = class FolioDocxReviewer {
|
|
|
660
603
|
const plugins = createHeadlessPlugins(baseDocument.package.styles, baseDocument.package.numbering);
|
|
661
604
|
const state = ensureBaseDirectionInState(EditorState.create({
|
|
662
605
|
schema,
|
|
663
|
-
doc:
|
|
606
|
+
doc: ensureParaIdsInDoc(toProseDoc(baseDocument)),
|
|
664
607
|
plugins
|
|
665
608
|
}));
|
|
666
609
|
return new FolioDocxReviewer({
|
|
@@ -1999,7 +1942,7 @@ var FolioDocxReviewer = class FolioDocxReviewer {
|
|
|
1999
1942
|
...this.baseDocument.package.theme !== void 0 && { theme: this.baseDocument.package.theme }
|
|
2000
1943
|
};
|
|
2001
1944
|
const storyDoc = story.type === "header" || story.type === "footer" ? headerFooterToProseDoc(source.content, conversionOptions) : footnoteToProseDoc(source.content, conversionOptions);
|
|
2002
|
-
return
|
|
1945
|
+
return ensureParaIdsInDoc(storyDoc);
|
|
2003
1946
|
}
|
|
2004
1947
|
requireEditableStoryState(story) {
|
|
2005
1948
|
const state = this.getEditableStoryState(story);
|
|
@@ -2093,7 +2036,7 @@ var FolioDocxReviewer = class FolioDocxReviewer {
|
|
|
2093
2036
|
(story.type === "header" ? this.importedHeaders : this.importedFooters).set(relationshipId, empty);
|
|
2094
2037
|
const state = ensureBaseDirectionInState(EditorState.create({
|
|
2095
2038
|
schema,
|
|
2096
|
-
doc:
|
|
2039
|
+
doc: ensureParaIdsInDoc(headerFooterToProseDoc(empty.content)),
|
|
2097
2040
|
plugins: createHeadlessPlugins(this.baseDocument.package.styles, this.baseDocument.package.numbering)
|
|
2098
2041
|
}));
|
|
2099
2042
|
this.secondaryStoryStates.set(headerFooterStoryKey(handle), {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FolioContentBlock, FolioContentBlockIdentity, FolioContentFormatRange, FolioContentIdStability, FolioContentParagraphIndentation, FolioContentParagraphSpacing, FolioContentSnapshot, FolioContentStatedNumbering } from "./content-types.js";
|
|
2
2
|
import { WordDiffGranularity, createWordDiffSession } from "../ai-edits/word-diff.js";
|
|
3
3
|
import { FolioContentAlignmentStep, FolioContentAlignmentWorkSession } from "./content-alignment.js";
|
|
4
|
-
import { Result } from "better-result";
|
|
4
|
+
import { Result, TaggedErrorClass } from "better-result";
|
|
5
5
|
//#region src/compare/content.d.ts
|
|
6
6
|
/** Hard resource ceilings for one representation-neutral comparison. */
|
|
7
7
|
export declare const FOLIO_CONTENT_COMPARISON_LIMITS: Readonly<{
|
|
@@ -17,15 +17,15 @@ export declare const FOLIO_CONTENT_COMPARISON_LIMITS: Readonly<{
|
|
|
17
17
|
readonly attributeCodeUnitsPerSnapshot: 8000000;
|
|
18
18
|
}>;
|
|
19
19
|
export type FolioContentComparisonLimit = keyof typeof FOLIO_CONTENT_COMPARISON_LIMITS;
|
|
20
|
-
declare const
|
|
21
|
-
export declare class InvalidFolioContentComparisonError extends
|
|
20
|
+
declare const InvalidFolioContentComparisonErrorBase: TaggedErrorClass<"InvalidFolioContentComparisonError">;
|
|
21
|
+
export declare class InvalidFolioContentComparisonError extends InvalidFolioContentComparisonErrorBase<{
|
|
22
22
|
message: string;
|
|
23
23
|
input: "options" | "base" | "revised";
|
|
24
24
|
blockIndex?: number;
|
|
25
25
|
field: string;
|
|
26
26
|
}> {}
|
|
27
|
-
declare const
|
|
28
|
-
export declare class FolioContentComparisonLimitError extends
|
|
27
|
+
declare const FolioContentComparisonLimitErrorBase: TaggedErrorClass<"FolioContentComparisonLimitError">;
|
|
28
|
+
export declare class FolioContentComparisonLimitError extends FolioContentComparisonLimitErrorBase<{
|
|
29
29
|
message: string;
|
|
30
30
|
input: "base" | "revised" | "result";
|
|
31
31
|
limit: FolioContentComparisonLimit;
|
|
@@ -34,8 +34,8 @@ export declare class FolioContentComparisonLimitError extends FolioContentCompar
|
|
|
34
34
|
blockIndex?: number;
|
|
35
35
|
field?: string;
|
|
36
36
|
}> {}
|
|
37
|
-
declare const
|
|
38
|
-
export declare class FolioContentInlinePresentationProjectionError extends
|
|
37
|
+
declare const FolioContentInlinePresentationProjectionErrorBase: TaggedErrorClass<"FolioContentInlinePresentationProjectionError">;
|
|
38
|
+
export declare class FolioContentInlinePresentationProjectionError extends FolioContentInlinePresentationProjectionErrorBase<{
|
|
39
39
|
message: string;
|
|
40
40
|
side: "base" | "revised" | "both";
|
|
41
41
|
baseBlockId: string;
|
package/dist/compare/content.js
CHANGED
|
@@ -43,9 +43,12 @@ const MOVE_SIMILARITY_THRESHOLD = .8;
|
|
|
43
43
|
const MAX_MOVE_PROFILE_TOKENS = 16384;
|
|
44
44
|
/** Bound source code units copied into one edited-move token profile. */
|
|
45
45
|
const MAX_MOVE_PROFILE_CODE_UNITS = 1048576;
|
|
46
|
-
|
|
47
|
-
var
|
|
48
|
-
|
|
46
|
+
const InvalidFolioContentComparisonErrorBase = TaggedError("InvalidFolioContentComparisonError");
|
|
47
|
+
var InvalidFolioContentComparisonError = class extends InvalidFolioContentComparisonErrorBase {};
|
|
48
|
+
const FolioContentComparisonLimitErrorBase = TaggedError("FolioContentComparisonLimitError");
|
|
49
|
+
var FolioContentComparisonLimitError = class extends FolioContentComparisonLimitErrorBase {};
|
|
50
|
+
const FolioContentInlinePresentationProjectionErrorBase = TaggedError("FolioContentInlinePresentationProjectionError");
|
|
51
|
+
var FolioContentInlinePresentationProjectionError = class extends FolioContentInlinePresentationProjectionErrorBase {};
|
|
49
52
|
/** Authored outline identity, including the distinction between heading and body text. */
|
|
50
53
|
const sameFolioContentOutlineLevel = (left, right) => left?.kind === right?.kind && (left?.kind !== "heading" || right?.kind === "heading" && left.level === right.level);
|
|
51
54
|
const createContentComparisonWorkSession = (granularity) => ({
|
package/dist/compare/types.d.ts
CHANGED
|
@@ -3,7 +3,12 @@ import { FolioAIBlockParagraphProperties, FolioAIBlockTableLocation, FolioAIEdit
|
|
|
3
3
|
import { WordDiffGranularity } from "../ai-edits/word-diff.js";
|
|
4
4
|
import { FolioDocumentStoryHandle, FolioNumberingLevel } from "../ai-edits/headless.js";
|
|
5
5
|
import { CompareVerification, CompareVerificationCause, CompareVerificationFailure, CompareVerificationInvariant, FinalParagraphMarkRevision } from "./verification.js";
|
|
6
|
+
import { TaggedErrorClass } from "better-result";
|
|
6
7
|
//#region src/compare/types.d.ts
|
|
8
|
+
declare const CompareDocxFinalParagraphMarkErrorBase: TaggedErrorClass<"CompareDocxFinalParagraphMarkError">;
|
|
9
|
+
declare const CompareDocxOperationLimitErrorBase: TaggedErrorClass<"CompareDocxOperationLimitError">;
|
|
10
|
+
declare const CompareDocxRoundTripErrorBase: TaggedErrorClass<"CompareDocxRoundTripError">;
|
|
11
|
+
declare const CompareDocxApplyErrorBase: TaggedErrorClass<"CompareDocxApplyError">;
|
|
7
12
|
/** Revision encoding requested for the generated package. */
|
|
8
13
|
export declare const COMPARE_REVISION_FORMATS: readonly ["word", "folio-exact"];
|
|
9
14
|
export type CompareRevisionFormat = (typeof COMPARE_REVISION_FORMATS)[number];
|
|
@@ -264,36 +269,34 @@ export type CompareResult = {
|
|
|
264
269
|
compatibility: CompareCompatibility;
|
|
265
270
|
unsupported: readonly CompareUnsupportedPart[];
|
|
266
271
|
};
|
|
267
|
-
declare const
|
|
268
|
-
export declare class InvalidCompareDocxOptionsError extends
|
|
272
|
+
declare const InvalidCompareDocxOptionsErrorBase: TaggedErrorClass<"InvalidCompareDocxOptionsError">;
|
|
273
|
+
export declare class InvalidCompareDocxOptionsError extends InvalidCompareDocxOptionsErrorBase<{
|
|
269
274
|
message: string;
|
|
270
275
|
option: "timestamp" | "revisionFormat";
|
|
271
276
|
receivedValue: unknown;
|
|
272
277
|
}> {}
|
|
273
|
-
declare const
|
|
274
|
-
export declare class CompareDocxParseError extends
|
|
278
|
+
declare const CompareDocxParseErrorBase: TaggedErrorClass<"CompareDocxParseError">;
|
|
279
|
+
export declare class CompareDocxParseError extends CompareDocxParseErrorBase<{
|
|
275
280
|
message: string;
|
|
276
281
|
side: "base" | "target";
|
|
277
282
|
cause: unknown;
|
|
278
283
|
}> {}
|
|
279
|
-
declare const CompareDocxApplyError_base: import("better-result").TaggedErrorClass<"CompareDocxApplyError">;
|
|
280
284
|
/**
|
|
281
285
|
* The applier refused at least one derived operation, so accepting the result
|
|
282
286
|
* would not reproduce the target. Reported instead of returning a package that
|
|
283
287
|
* silently under-represents the difference.
|
|
284
288
|
*/
|
|
285
|
-
export declare class CompareDocxApplyError extends
|
|
289
|
+
export declare class CompareDocxApplyError extends CompareDocxApplyErrorBase<{
|
|
286
290
|
message: string;
|
|
287
291
|
skipped: readonly FolioAIEditSkippedOperation[];
|
|
288
292
|
}> {}
|
|
289
|
-
declare const CompareDocxRoundTripError_base: import("better-result").TaggedErrorClass<"CompareDocxRoundTripError">;
|
|
290
293
|
/**
|
|
291
294
|
* The generated tracked changes do not accept back to the target. Raised by
|
|
292
295
|
* the self-check {@link compareDocx} runs before returning: a redline that
|
|
293
296
|
* quietly loses part of the difference is worse than no redline, so the
|
|
294
297
|
* mismatch is surfaced instead of the document.
|
|
295
298
|
*/
|
|
296
|
-
export declare class CompareDocxRoundTripError extends
|
|
299
|
+
export declare class CompareDocxRoundTripError extends CompareDocxRoundTripErrorBase<{
|
|
297
300
|
message: string;
|
|
298
301
|
story: FolioDocumentStoryHandle;
|
|
299
302
|
/** The invariant that did not hold, and what diverged under it. */
|
|
@@ -307,14 +310,13 @@ export declare class CompareDocxRoundTripError extends CompareDocxRoundTripError
|
|
|
307
310
|
*/
|
|
308
311
|
failures: readonly CompareVerificationFailure[];
|
|
309
312
|
}> {}
|
|
310
|
-
declare const CompareDocxOperationLimitError_base: import("better-result").TaggedErrorClass<"CompareDocxOperationLimitError">;
|
|
311
313
|
/** The difference needs more operations than the engine will generate. */
|
|
312
|
-
export declare class CompareDocxOperationLimitError extends
|
|
314
|
+
export declare class CompareDocxOperationLimitError extends CompareDocxOperationLimitErrorBase<{
|
|
313
315
|
message: string;
|
|
314
316
|
limit: number;
|
|
315
317
|
}> {}
|
|
316
|
-
declare const
|
|
317
|
-
export declare class CompareDocxSerializeError extends
|
|
318
|
+
declare const CompareDocxSerializeErrorBase: TaggedErrorClass<"CompareDocxSerializeError">;
|
|
319
|
+
export declare class CompareDocxSerializeError extends CompareDocxSerializeErrorBase<{
|
|
318
320
|
message: string;
|
|
319
321
|
cause: unknown;
|
|
320
322
|
}> {}
|
|
@@ -326,7 +328,6 @@ export declare class CompareDocxSerializeError extends CompareDocxSerializeError
|
|
|
326
328
|
* every distinct save failure into a single undiagnosable row.
|
|
327
329
|
*/
|
|
328
330
|
export declare const compareDocxSerializeError: (context: string, cause: unknown) => CompareDocxSerializeError;
|
|
329
|
-
declare const CompareDocxFinalParagraphMarkError_base: import("better-result").TaggedErrorClass<"CompareDocxFinalParagraphMarkError">;
|
|
330
331
|
/**
|
|
331
332
|
* A container's final paragraph mark carries a revision, so the package would
|
|
332
333
|
* not open, or would open carrying one no reader can resolve.
|
|
@@ -338,7 +339,7 @@ declare const CompareDocxFinalParagraphMarkError_base: import("better-result").T
|
|
|
338
339
|
* under either `onUnverified` setting: there is no redline to emit when a
|
|
339
340
|
* consumer refuses the file.
|
|
340
341
|
*/
|
|
341
|
-
export declare class CompareDocxFinalParagraphMarkError extends
|
|
342
|
+
export declare class CompareDocxFinalParagraphMarkError extends CompareDocxFinalParagraphMarkErrorBase<{
|
|
342
343
|
message: string;
|
|
343
344
|
/** Every container that carries one, each named structurally. */
|
|
344
345
|
revisions: readonly FinalParagraphMarkRevision[];
|
package/dist/compare/types.js
CHANGED
|
@@ -4,6 +4,10 @@ import { TaggedError } from "better-result";
|
|
|
4
4
|
* Public vocabulary of {@link ./compare.compareDocx}: the change list, the
|
|
5
5
|
* options that pin its output, and the failures it reports.
|
|
6
6
|
*/
|
|
7
|
+
const CompareDocxFinalParagraphMarkErrorBase = TaggedError("CompareDocxFinalParagraphMarkError");
|
|
8
|
+
const CompareDocxOperationLimitErrorBase = TaggedError("CompareDocxOperationLimitError");
|
|
9
|
+
const CompareDocxRoundTripErrorBase = TaggedError("CompareDocxRoundTripError");
|
|
10
|
+
const CompareDocxApplyErrorBase = TaggedError("CompareDocxApplyError");
|
|
7
11
|
/** Revision encoding requested for the generated package. */
|
|
8
12
|
const COMPARE_REVISION_FORMATS = ["word", "folio-exact"];
|
|
9
13
|
/** Why a part of the package is absent from `changes`. */
|
|
@@ -13,24 +17,27 @@ const COMPARE_UNSUPPORTED_REASONS = Object.freeze([
|
|
|
13
17
|
"story-not-editable",
|
|
14
18
|
"unsupported-content"
|
|
15
19
|
]);
|
|
16
|
-
|
|
17
|
-
var
|
|
20
|
+
const InvalidCompareDocxOptionsErrorBase = TaggedError("InvalidCompareDocxOptionsError");
|
|
21
|
+
var InvalidCompareDocxOptionsError = class extends InvalidCompareDocxOptionsErrorBase {};
|
|
22
|
+
const CompareDocxParseErrorBase = TaggedError("CompareDocxParseError");
|
|
23
|
+
var CompareDocxParseError = class extends CompareDocxParseErrorBase {};
|
|
18
24
|
/**
|
|
19
25
|
* The applier refused at least one derived operation, so accepting the result
|
|
20
26
|
* would not reproduce the target. Reported instead of returning a package that
|
|
21
27
|
* silently under-represents the difference.
|
|
22
28
|
*/
|
|
23
|
-
var CompareDocxApplyError = class extends
|
|
29
|
+
var CompareDocxApplyError = class extends CompareDocxApplyErrorBase {};
|
|
24
30
|
/**
|
|
25
31
|
* The generated tracked changes do not accept back to the target. Raised by
|
|
26
32
|
* the self-check {@link compareDocx} runs before returning: a redline that
|
|
27
33
|
* quietly loses part of the difference is worse than no redline, so the
|
|
28
34
|
* mismatch is surfaced instead of the document.
|
|
29
35
|
*/
|
|
30
|
-
var CompareDocxRoundTripError = class extends
|
|
36
|
+
var CompareDocxRoundTripError = class extends CompareDocxRoundTripErrorBase {};
|
|
31
37
|
/** The difference needs more operations than the engine will generate. */
|
|
32
|
-
var CompareDocxOperationLimitError = class extends
|
|
33
|
-
|
|
38
|
+
var CompareDocxOperationLimitError = class extends CompareDocxOperationLimitErrorBase {};
|
|
39
|
+
const CompareDocxSerializeErrorBase = TaggedError("CompareDocxSerializeError");
|
|
40
|
+
var CompareDocxSerializeError = class extends CompareDocxSerializeErrorBase {};
|
|
34
41
|
/**
|
|
35
42
|
* A serialize failure whose message names the reason.
|
|
36
43
|
*
|
|
@@ -53,6 +60,6 @@ const compareDocxSerializeError = (context, cause) => new CompareDocxSerializeEr
|
|
|
53
60
|
* under either `onUnverified` setting: there is no redline to emit when a
|
|
54
61
|
* consumer refuses the file.
|
|
55
62
|
*/
|
|
56
|
-
var CompareDocxFinalParagraphMarkError = class extends
|
|
63
|
+
var CompareDocxFinalParagraphMarkError = class extends CompareDocxFinalParagraphMarkErrorBase {};
|
|
57
64
|
//#endregion
|
|
58
65
|
export { COMPARE_REVISION_FORMATS, COMPARE_UNSUPPORTED_REASONS, CompareDocxApplyError, CompareDocxFinalParagraphMarkError, CompareDocxOperationLimitError, CompareDocxParseError, CompareDocxRoundTripError, CompareDocxSerializeError, InvalidCompareDocxOptionsError, compareDocxSerializeError };
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import { document_d_exports } from "../types/document.js";
|
|
2
|
+
import { TaggedErrorClass } from "better-result";
|
|
2
3
|
//#region src/content-controls/errors.d.ts
|
|
3
|
-
declare const
|
|
4
|
+
declare const ContentControlTypeErrorBase: TaggedErrorClass<"ContentControlTypeError">;
|
|
5
|
+
declare const ContentControlBoundErrorBase: TaggedErrorClass<"ContentControlBoundError">;
|
|
6
|
+
declare const ContentControlLockedErrorBase: TaggedErrorClass<"ContentControlLockedError">;
|
|
4
7
|
/**
|
|
5
8
|
* Refused because the target control's `w:lock` forbids the requested
|
|
6
9
|
* mutation. Caller can override with `{ force: true }` if they understand
|
|
7
10
|
* the consequences (overrides apply per call, not per document).
|
|
8
11
|
*/
|
|
9
|
-
export declare class ContentControlLockedError extends
|
|
12
|
+
export declare class ContentControlLockedError extends ContentControlLockedErrorBase<{
|
|
10
13
|
message: string;
|
|
11
14
|
lock: NonNullable<document_d_exports.SdtProperties["lock"]>;
|
|
12
15
|
tag?: string;
|
|
13
16
|
alias?: string;
|
|
14
17
|
}> {}
|
|
15
|
-
declare const ContentControlBoundError_base: import("better-result").TaggedErrorClass<"ContentControlBoundError">;
|
|
16
18
|
/**
|
|
17
19
|
* Refused because the target control is bound to a `<w:dataBinding>`.
|
|
18
20
|
*
|
|
@@ -27,20 +29,19 @@ declare const ContentControlBoundError_base: import("better-result").TaggedError
|
|
|
27
29
|
* Reference: python-docx #965, Aspose forum thread on removing custom
|
|
28
30
|
* XML mapping before content updates.
|
|
29
31
|
*/
|
|
30
|
-
export declare class ContentControlBoundError extends
|
|
32
|
+
export declare class ContentControlBoundError extends ContentControlBoundErrorBase<{
|
|
31
33
|
message: string;
|
|
32
34
|
xpath: string;
|
|
33
35
|
storeItemID?: string;
|
|
34
36
|
tag?: string;
|
|
35
37
|
alias?: string;
|
|
36
38
|
}> {}
|
|
37
|
-
declare const ContentControlTypeError_base: import("better-result").TaggedErrorClass<"ContentControlTypeError">;
|
|
38
39
|
/**
|
|
39
40
|
* Refused because the requested operation does not make sense for the
|
|
40
41
|
* control's type — e.g. setting free text on a checkbox, or unwrapping a
|
|
41
42
|
* `w15:repeatingSection` (which would orphan its row items).
|
|
42
43
|
*/
|
|
43
|
-
export declare class ContentControlTypeError extends
|
|
44
|
+
export declare class ContentControlTypeError extends ContentControlTypeErrorBase<{
|
|
44
45
|
message: string;
|
|
45
46
|
sdtType: document_d_exports.SdtProperties["sdtType"];
|
|
46
47
|
reason: string;
|
|
@@ -5,12 +5,15 @@ import { TaggedError } from "better-result";
|
|
|
5
5
|
* refuses a mutation throws one of these; consumers can either bubble the
|
|
6
6
|
* error or retry with `{ force: true }`.
|
|
7
7
|
*/
|
|
8
|
+
const ContentControlTypeErrorBase = TaggedError("ContentControlTypeError");
|
|
9
|
+
const ContentControlBoundErrorBase = TaggedError("ContentControlBoundError");
|
|
10
|
+
const ContentControlLockedErrorBase = TaggedError("ContentControlLockedError");
|
|
8
11
|
/**
|
|
9
12
|
* Refused because the target control's `w:lock` forbids the requested
|
|
10
13
|
* mutation. Caller can override with `{ force: true }` if they understand
|
|
11
14
|
* the consequences (overrides apply per call, not per document).
|
|
12
15
|
*/
|
|
13
|
-
var ContentControlLockedError = class extends
|
|
16
|
+
var ContentControlLockedError = class extends ContentControlLockedErrorBase {};
|
|
14
17
|
/**
|
|
15
18
|
* Refused because the target control is bound to a `<w:dataBinding>`.
|
|
16
19
|
*
|
|
@@ -25,12 +28,12 @@ var ContentControlLockedError = class extends TaggedError("ContentControlLockedE
|
|
|
25
28
|
* Reference: python-docx #965, Aspose forum thread on removing custom
|
|
26
29
|
* XML mapping before content updates.
|
|
27
30
|
*/
|
|
28
|
-
var ContentControlBoundError = class extends
|
|
31
|
+
var ContentControlBoundError = class extends ContentControlBoundErrorBase {};
|
|
29
32
|
/**
|
|
30
33
|
* Refused because the requested operation does not make sense for the
|
|
31
34
|
* control's type — e.g. setting free text on a checkbox, or unwrapping a
|
|
32
35
|
* `w15:repeatingSection` (which would orphan its row items).
|
|
33
36
|
*/
|
|
34
|
-
var ContentControlTypeError = class extends
|
|
37
|
+
var ContentControlTypeError = class extends ContentControlTypeErrorBase {};
|
|
35
38
|
//#endregion
|
|
36
39
|
export { ContentControlBoundError, ContentControlLockedError, ContentControlTypeError };
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { document_d_exports } from "../types/document.js";
|
|
2
2
|
import { CANONICAL_GAP } from "../types/canonicalCapabilities.js";
|
|
3
3
|
import { Comment } from "../types/content.js";
|
|
4
|
+
import { Err, Ok, TaggedErrorClass } from "better-result";
|
|
4
5
|
import { CreateCommentOp, DocumentOp } from "@stll/docx-core/ops";
|
|
5
6
|
//#region src/controller/canonicalComments.d.ts
|
|
6
|
-
declare const
|
|
7
|
-
export declare class CanonicalCommentError extends
|
|
7
|
+
declare const CanonicalCommentErrorBase: TaggedErrorClass<"CanonicalCommentError">;
|
|
8
|
+
export declare class CanonicalCommentError extends CanonicalCommentErrorBase<{
|
|
8
9
|
message: string;
|
|
9
10
|
gap: typeof CANONICAL_GAP.comments;
|
|
10
11
|
}> {}
|
|
@@ -31,7 +32,7 @@ type CompileCanonicalCommentsOptions = {
|
|
|
31
32
|
document: document_d_exports.Document;
|
|
32
33
|
command: CanonicalCommentCommand;
|
|
33
34
|
};
|
|
34
|
-
export declare const compileCanonicalComments: ({ document, command }: CompileCanonicalCommentsOptions) =>
|
|
35
|
+
export declare const compileCanonicalComments: ({ document, command }: CompileCanonicalCommentsOptions) => Err<never, CanonicalCommentError> | Ok<{
|
|
35
36
|
ops: DocumentOp[];
|
|
36
37
|
document: document_d_exports.Document;
|
|
37
38
|
commentId: number | undefined;
|
|
@@ -4,7 +4,8 @@ import { Result, TaggedError } from "better-result";
|
|
|
4
4
|
import { DOCUMENT_OP_TYPES, allocateCommentAnchorIds, applyDocumentOps, packageParagraphIds } from "@stll/docx-core/ops";
|
|
5
5
|
//#region src/controller/canonicalComments.ts
|
|
6
6
|
/** The one semantic compiler for canonical sidebar, controlled and public comments. */
|
|
7
|
-
|
|
7
|
+
const CanonicalCommentErrorBase = TaggedError("CanonicalCommentError");
|
|
8
|
+
var CanonicalCommentError = class extends CanonicalCommentErrorBase {};
|
|
8
9
|
const refuse = (message) => Result.err(new CanonicalCommentError({
|
|
9
10
|
message,
|
|
10
11
|
gap: CANONICAL_GAP.comments
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { document_d_exports } from "../types/document.js";
|
|
2
2
|
import { Node } from "prosemirror-model";
|
|
3
|
-
import { Result } from "better-result";
|
|
3
|
+
import { Result, TaggedErrorClass } from "better-result";
|
|
4
4
|
//#region src/controller/canonicalInlineProjection.d.ts
|
|
5
5
|
export declare const CANONICAL_SOURCE_INLINE_POLICIES: {
|
|
6
6
|
readonly run: "container";
|
|
@@ -62,8 +62,8 @@ export declare const CANONICAL_NATIVE_INLINE_POLICIES: {
|
|
|
62
62
|
readonly renderedPageBreak: "refused";
|
|
63
63
|
readonly sdt: "refused";
|
|
64
64
|
};
|
|
65
|
-
declare const
|
|
66
|
-
declare class InlineProjectionError extends
|
|
65
|
+
declare const InlineProjectionErrorBase: TaggedErrorClass<"InlineProjectionError">;
|
|
66
|
+
declare class InlineProjectionError extends InlineProjectionErrorBase<{
|
|
67
67
|
message: string;
|
|
68
68
|
}> {}
|
|
69
69
|
/** Every source variant makes a decision before conversion can discard its positions. */
|
|
@@ -72,7 +72,8 @@ const CANONICAL_NATIVE_INLINE_POLICIES = {
|
|
|
72
72
|
sdt: "refused"
|
|
73
73
|
};
|
|
74
74
|
const nativePolicies = new Map(Object.entries(CANONICAL_NATIVE_INLINE_POLICIES));
|
|
75
|
-
|
|
75
|
+
const InlineProjectionErrorBase = TaggedError("InlineProjectionError");
|
|
76
|
+
var InlineProjectionError = class extends InlineProjectionErrorBase {};
|
|
76
77
|
const refuse = (message) => Result.err(new InlineProjectionError({ message }));
|
|
77
78
|
/** Every source variant makes a decision before conversion can discard its positions. */
|
|
78
79
|
const canonicalInlineSourceIssue = (items, context = "paragraph") => {
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { DocumentOp } from "./canonicalOperations.js";
|
|
2
|
+
import { Document } from "@stll/docx-core";
|
|
1
3
|
//#region src/controller/canonicalListRendering.d.ts
|
|
2
4
|
/** Canonical edits share list model normalization with the headless projection. */
|
|
3
|
-
export declare const normalizeCanonicalListRendering: (document:
|
|
4
|
-
document:
|
|
5
|
-
inverse:
|
|
5
|
+
export declare const normalizeCanonicalListRendering: (document: Document) => {
|
|
6
|
+
document: Document;
|
|
7
|
+
inverse: DocumentOp[];
|
|
6
8
|
};
|
|
7
9
|
//#endregion
|
|
@@ -96,7 +96,8 @@ const compilePublicIntents = ({ document, intents, mode, author, date, nextRevis
|
|
|
96
96
|
nextRevisionId
|
|
97
97
|
});
|
|
98
98
|
};
|
|
99
|
-
|
|
99
|
+
const CanonicalPublicOperationResolutionErrorBase = TaggedError("CanonicalPublicOperationResolutionError");
|
|
100
|
+
var CanonicalPublicOperationResolutionError = class extends CanonicalPublicOperationResolutionErrorBase {};
|
|
100
101
|
const canonicalPublicStory = (story) => {
|
|
101
102
|
if (story === "main") return story;
|
|
102
103
|
switch (story.type) {
|
|
@@ -4,11 +4,11 @@ import { CanonicalSaveSnapshot } from "../types/canonicalSave.js";
|
|
|
4
4
|
import { CanonicalInlineGap } from "./canonicalInlineProjection.js";
|
|
5
5
|
import { Node } from "prosemirror-model";
|
|
6
6
|
import { EditorState, Transaction } from "prosemirror-state";
|
|
7
|
-
import { Result } from "better-result";
|
|
7
|
+
import { Err, Ok, Result, TaggedErrorClass } from "better-result";
|
|
8
8
|
import { DocumentOp, EditorIntent, OpStory, TextPosition, TouchedBlocks } from "@stll/docx-core/ops";
|
|
9
9
|
//#region src/controller/canonicalSession.d.ts
|
|
10
|
-
declare const
|
|
11
|
-
export declare class CanonicalSessionError extends
|
|
10
|
+
declare const CanonicalSessionErrorBase: TaggedErrorClass<"CanonicalSessionError">;
|
|
11
|
+
export declare class CanonicalSessionError extends CanonicalSessionErrorBase<{
|
|
12
12
|
message: string;
|
|
13
13
|
gap: CanonicalGap;
|
|
14
14
|
reason: "refused" | "noChange";
|
|
@@ -76,7 +76,7 @@ type PublishCanonicalProjectionOptions = {
|
|
|
76
76
|
session: CanonicalSession;
|
|
77
77
|
};
|
|
78
78
|
/** The model publishes only after PM and every plugin accept its exact projection. */
|
|
79
|
-
export declare const publishCanonicalProjection: ({ state, commit, session }: PublishCanonicalProjectionOptions) =>
|
|
79
|
+
export declare const publishCanonicalProjection: ({ state, commit, session }: PublishCanonicalProjectionOptions) => Err<never, CanonicalSessionError> | Ok<{
|
|
80
80
|
state: EditorState;
|
|
81
81
|
transactions: readonly Transaction[];
|
|
82
82
|
}, never>;
|
|
@@ -120,7 +120,7 @@ declare class CanonicalSession {
|
|
|
120
120
|
private readonly styles;
|
|
121
121
|
constructor({ document, projection, styles }: CanonicalSessionSeedOptions);
|
|
122
122
|
/** Render only the committed comment projection while provisional IME blocks document snapshots. */
|
|
123
|
-
getCommittedComments():
|
|
123
|
+
getCommittedComments(): document_d_exports.Comment[];
|
|
124
124
|
setMode(mode: CanonicalSessionMode): void;
|
|
125
125
|
hasStyle(styleId: string): boolean;
|
|
126
126
|
private advanceBlockId;
|
|
@@ -19,7 +19,8 @@ import { CellSelection } from "prosemirror-tables";
|
|
|
19
19
|
import { DOCUMENT_OP_REFUSAL_REASONS, DOCUMENT_OP_TYPES, OP_STORIES, applyDocumentOp, applyDocumentOps, combineEdits, commentDocumentIssue, compileEditorIntent, createEditorIntentIdAllocator, documentStories, editorParagraphGroups, findStoryBody, normalizeForOps, packageParagraphIds, paragraphIdsIn, sameStory, survivingComments, validateOpsDocument } from "@stll/docx-core/ops";
|
|
20
20
|
import { AllSelection, NodeSelection, Selection, TextSelection } from "prosemirror-state";
|
|
21
21
|
//#region src/controller/canonicalSession.ts
|
|
22
|
-
|
|
22
|
+
const CanonicalSessionErrorBase = TaggedError("CanonicalSessionError");
|
|
23
|
+
var CanonicalSessionError = class extends CanonicalSessionErrorBase {};
|
|
23
24
|
const refuse = (message) => Result.err(new CanonicalSessionError({
|
|
24
25
|
gap: CANONICAL_GAP.dispatch,
|
|
25
26
|
message,
|
|
@@ -6,13 +6,14 @@ import { HiddenEditorStateReason } from "../layout-engine/layoutInstrumentation.
|
|
|
6
6
|
import { ExtensionManager } from "../prosemirror/extensions/ExtensionManager.js";
|
|
7
7
|
import { RemoteSelection } from "../types/remote-selection.js";
|
|
8
8
|
import { EditorState, Plugin, Transaction } from "prosemirror-state";
|
|
9
|
+
import { TaggedErrorClass } from "better-result";
|
|
9
10
|
import { EditorView } from "prosemirror-view";
|
|
10
11
|
import * as Yjs from "yjs";
|
|
11
12
|
import { XmlFragment } from "yjs";
|
|
12
13
|
import * as YProseMirror from "y-prosemirror";
|
|
13
14
|
//#region src/controller/hiddenEditorManager.d.ts
|
|
14
|
-
declare const
|
|
15
|
-
export declare class CanonicalSessionRefusalError extends
|
|
15
|
+
declare const CanonicalSessionRefusalErrorBase: TaggedErrorClass<"CanonicalSessionRefusalError">;
|
|
16
|
+
export declare class CanonicalSessionRefusalError extends CanonicalSessionRefusalErrorBase<{
|
|
16
17
|
gap: CanonicalGap;
|
|
17
18
|
message: string;
|
|
18
19
|
}> {}
|
|
@@ -33,7 +33,8 @@ import { OP_STORIES, freshCommentId } from "@stll/docx-core/ops";
|
|
|
33
33
|
import { EditorState, Plugin } from "prosemirror-state";
|
|
34
34
|
import { EditorView } from "prosemirror-view";
|
|
35
35
|
//#region src/controller/hiddenEditorManager.ts
|
|
36
|
-
|
|
36
|
+
const CanonicalSessionRefusalErrorBase = TaggedError("CanonicalSessionRefusalError");
|
|
37
|
+
var CanonicalSessionRefusalError = class extends CanonicalSessionRefusalErrorBase {};
|
|
37
38
|
const normalizeSeedState = (state) => ensureBaseDirectionInState(ensureParaIdsInState(state));
|
|
38
39
|
const normalizeLocalSeedState = (state) => ensureBaseDirectionInState(state);
|
|
39
40
|
const isObjectRecord = (value) => typeof value === "object" && value !== null;
|