@stll/folio-core 0.67.0 → 0.69.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/apply.d.ts +9 -1
- package/dist/ai-edits/apply.js +94 -8
- package/dist/ai-edits/headless.d.ts +36 -21
- package/dist/ai-edits/headless.js +106 -36
- package/dist/ai-edits/index.d.ts +2 -2
- package/dist/ai-edits/newListNumbering.d.ts +14 -1
- package/dist/ai-edits/newListNumbering.js +24 -1
- package/dist/ai-edits/note-references.d.ts +6 -0
- package/dist/ai-edits/note-references.js +7 -1
- package/dist/ai-edits/pending-suggestions.js +2 -2
- package/dist/ai-edits/read.d.ts +19 -0
- package/dist/ai-edits/snapshot.d.ts +6 -0
- package/dist/ai-edits/snapshot.js +8 -3
- package/dist/ai-edits/types.d.ts +9 -1
- package/dist/ai-suggestions/apply.js +13 -4
- package/dist/compare/compare.js +2 -1
- package/dist/compare/inserted-resource-snapshot.d.ts +4 -1
- package/dist/compare/inserted-resource-snapshot.js +7 -3
- package/dist/controller/canonicalClipboard.js +31 -14
- package/dist/controller/canonicalComposition.js +35 -6
- package/dist/controller/canonicalInlineProjection.d.ts +35 -10
- package/dist/controller/canonicalInlineProjection.js +192 -28
- package/dist/controller/canonicalInput.d.ts +2 -1
- package/dist/controller/canonicalInput.js +32 -7
- package/dist/controller/canonicalListRendering.d.ts +2 -1
- package/dist/controller/canonicalListRendering.js +1 -1
- package/dist/controller/canonicalLockGuard.d.ts +23 -0
- package/dist/controller/canonicalLockGuard.js +133 -0
- package/dist/controller/canonicalProjectionBlocks.d.ts +79 -0
- package/dist/controller/canonicalProjectionBlocks.js +75 -0
- package/dist/controller/canonicalPublicOperations.d.ts +12 -4
- package/dist/controller/canonicalPublicOperations.js +676 -46
- package/dist/controller/canonicalSeedContent.d.ts +12 -0
- package/dist/controller/canonicalSeedContent.js +131 -0
- package/dist/controller/canonicalSession.d.ts +133 -21
- package/dist/controller/canonicalSession.js +738 -205
- package/dist/controller/canonicalSourceNormalization.d.ts +21 -0
- package/dist/controller/canonicalSourceNormalization.js +148 -0
- package/dist/controller/canonicalStoryEditor.d.ts +4 -3
- package/dist/controller/canonicalStoryEditor.js +20 -15
- package/dist/controller/canonicalStructure.d.ts +2 -1
- package/dist/controller/canonicalStructure.js +129 -7
- package/dist/controller/contentControlWidgetController.d.ts +5 -0
- package/dist/controller/contentControlWidgetController.js +13 -1
- package/dist/controller/folioEditor.js +4 -0
- package/dist/controller/headerFooterEditorManager.d.ts +7 -2
- package/dist/controller/headerFooterEditorManager.js +11 -6
- package/dist/controller/hiddenEditorApi.d.ts +17 -2
- package/dist/controller/hiddenEditorApi.js +4 -0
- package/dist/controller/hiddenEditorManager.d.ts +11 -3
- package/dist/controller/hiddenEditorManager.js +157 -48
- package/dist/controller/layoutPipeline.js +50 -16
- package/dist/controller/layoutSession.d.ts +3 -0
- package/dist/controller/layoutSession.js +3 -1
- package/dist/controller/noteEditorManager.d.ts +7 -2
- package/dist/controller/noteEditorManager.js +11 -6
- package/dist/display-list/build/pageFurniture.js +41 -19
- package/dist/display-list/build/tablePrimitives.js +23 -4
- package/dist/display-list/dom/renderDisplayListToDom.js +13 -11
- package/dist/document-operations.d.ts +9 -1
- package/dist/document-operations.js +4 -3
- package/dist/docx/blockContentParser.d.ts +7 -3
- package/dist/docx/blockContentParser.js +2 -3
- package/dist/docx/blockPlainText.js +2 -0
- package/dist/docx/bookmarkRangeJoin.d.ts +6 -0
- package/dist/docx/bookmarkRangeJoin.js +43 -0
- package/dist/docx/canonicalSave.js +11 -2
- package/dist/docx/canonicalSessionInput.d.ts +5 -1
- package/dist/docx/canonicalSessionInput.js +7 -2
- package/dist/docx/commentAnchorIndex.d.ts +40 -5
- package/dist/docx/commentAnchorIndex.js +94 -12
- package/dist/docx/commentRangeIntegrity.js +30 -24
- package/dist/docx/commentRangeJoin.d.ts +4 -0
- package/dist/docx/commentRangeJoin.js +26 -12
- package/dist/docx/commentReferenceCompletion.js +5 -4
- package/dist/docx/commentReferenceNormalization.js +40 -18
- package/dist/docx/compatibility.js +9 -2
- package/dist/docx/containerChildren.js +22 -1
- package/dist/docx/contentTypeRegistry.js +1 -1
- package/dist/docx/encryption/compoundFile.js +9 -1
- package/dist/docx/encryption/encryptionInfo.js +16 -2
- package/dist/docx/ensureParaIds.js +46 -7
- package/dist/docx/ensureUniqueControlIds.d.ts +25 -0
- package/dist/docx/ensureUniqueControlIds.js +110 -0
- package/dist/docx/headerFooterVerbatim.d.ts +7 -0
- package/dist/docx/headerFooterVerbatim.js +13 -2
- package/dist/docx/hostCommentThreads.d.ts +27 -0
- package/dist/docx/hostCommentThreads.js +72 -0
- package/dist/docx/hyperlinkParser.js +9 -2
- package/dist/docx/inlineWrapperContent.d.ts +8 -1
- package/dist/docx/inlineWrapperContent.js +9 -2
- package/dist/docx/listMarkerComputation.d.ts +35 -1
- package/dist/docx/listMarkerComputation.js +39 -1
- package/dist/docx/listModelNormalization.d.ts +44 -1
- package/dist/docx/listModelNormalization.js +226 -96
- package/dist/docx/listNumberingInstances.d.ts +1 -1
- package/dist/docx/listNumberingInstances.js +2 -2
- package/dist/docx/markupRangeMarker.d.ts +14 -0
- package/dist/docx/markupRangeMarker.js +15 -1
- package/dist/docx/metadataPrivacy.js +43 -22
- package/dist/docx/normalizeBaseDirection.js +3 -1
- package/dist/docx/numberingIds.d.ts +6 -0
- package/dist/docx/numberingIds.js +6 -1
- package/dist/docx/numberingReferenceNormalization.d.ts +4 -0
- package/dist/docx/numberingReferenceNormalization.js +12 -2
- package/dist/docx/paragraphParser.js +159 -48
- package/dist/docx/paragraphPropertySource.d.ts +29 -0
- package/dist/docx/paragraphPropertySource.js +106 -16
- package/dist/docx/paragraphTextBoxEnrichment.js +2 -1
- package/dist/docx/paragraphTraversal.js +2 -0
- package/dist/docx/parseWarningMessage.js +2 -1
- package/dist/docx/parser.js +8 -0
- package/dist/docx/removeHeaderFooterParts.js +1 -1
- package/dist/docx/renderedPageBreakNormalization.js +1 -1
- package/dist/docx/reviewProvenanceDiagnostics.d.ts +7 -0
- package/dist/docx/reviewProvenanceDiagnostics.js +39 -0
- package/dist/docx/reviewResolutionProvenance.d.ts +29 -3
- package/dist/docx/reviewResolutionProvenance.js +171 -33
- package/dist/docx/rezip.d.ts +6 -0
- package/dist/docx/rezip.js +38 -21
- package/dist/docx/selectiveSave.js +6 -10
- package/dist/docx/selectiveXmlPatch.d.ts +5 -4
- package/dist/docx/selectiveXmlPatch.js +11 -7
- package/dist/docx/serializer/documentSerializer.js +5 -2
- package/dist/docx/serializer/headerFooterSerializer.js +3 -1
- package/dist/docx/serializer/markupRangeAttributes.d.ts +6 -1
- package/dist/docx/serializer/markupRangeAttributes.js +6 -1
- package/dist/docx/serializer/noteSerializer.d.ts +17 -4
- package/dist/docx/serializer/noteSerializer.js +23 -16
- package/dist/docx/serializer/paragraphSerializer.js +56 -12
- package/dist/docx/serializer/partNamespaces.d.ts +1 -1
- package/dist/docx/serializer/partNamespaces.js +1 -1
- package/dist/docx/serializer/runSerializer.d.ts +1 -3
- package/dist/docx/serializer/runSerializer.js +2 -2
- package/dist/docx/serializer/tableSerializer.d.ts +4 -0
- package/dist/docx/serializer/tableSerializer.js +4 -2
- package/dist/docx/server/applyDocxXmlPatchProposal.js +8 -4
- package/dist/docx/server/build.d.ts +1 -1
- package/dist/docx/server/createBilingualDocument.js +27 -5
- package/dist/docx/server/migrateYjsAttrSchema.js +4 -0
- package/dist/docx/sessionListPruning.d.ts +2 -0
- package/dist/docx/sessionListPruning.js +50 -0
- package/dist/docx/splitRevisionPieces.d.ts +10 -0
- package/dist/docx/splitRevisionPieces.js +14 -0
- package/dist/docx/storyBlockReplay.js +19 -2
- package/dist/docx/structuralXmlPatch.js +44 -11
- package/dist/docx/tableParser.d.ts +6 -2
- package/dist/docx/tableParser.js +2 -3
- package/dist/docx/textBoxContentParser.d.ts +11 -0
- package/dist/docx/textBoxContentParser.js +51 -0
- package/dist/docx/textBoxParser.d.ts +0 -5
- package/dist/docx/textBoxParser.js +1 -23
- package/dist/docx/verticalMergeProjection.js +1 -1
- package/dist/docx/xmlParser.d.ts +1 -1
- package/dist/docx/xmlParser.js +2 -3
- package/dist/fonts/fontsourceFaces.d.ts +2 -8
- package/dist/fonts/fontsourceFaces.js +1 -7
- package/dist/i18n/messages/ar.gen.js +3 -0
- package/dist/i18n/messages/catalogs.gen.d.ts +51 -0
- package/dist/i18n/messages/catalogs.gen.js +51 -0
- package/dist/i18n/messages/cs.gen.js +3 -0
- package/dist/i18n/messages/de.gen.js +3 -0
- package/dist/i18n/messages/en.gen.js +3 -0
- package/dist/i18n/messages/es.gen.js +3 -0
- package/dist/i18n/messages/et.gen.js +3 -0
- package/dist/i18n/messages/fr.gen.js +3 -0
- package/dist/i18n/messages/he.gen.js +3 -0
- package/dist/i18n/messages/hi.gen.js +3 -0
- package/dist/i18n/messages/hu.gen.js +3 -0
- package/dist/i18n/messages/lt.gen.js +3 -0
- package/dist/i18n/messages/lv.gen.js +3 -0
- package/dist/i18n/messages/messages.gen.d.ts +3 -0
- package/dist/i18n/messages/pl.gen.js +3 -0
- package/dist/i18n/messages/pt-BR.gen.js +3 -0
- package/dist/i18n/messages/sk.gen.js +3 -0
- package/dist/i18n/messages/tr.gen.js +3 -0
- package/dist/i18n/messages/zh-CN.gen.js +3 -0
- package/dist/internal/acceptedBlockProjection.js +2 -0
- package/dist/internal/pageBreakRunDescendantIndex.d.ts +7 -2
- package/dist/internal/pageBreakRunDescendantIndex.js +12 -3
- package/dist/internal/pageBreakRunSourceDescendantIndex.d.ts +5 -0
- package/dist/internal/pageBreakRunSourceDescendantIndex.js +5 -0
- package/dist/internal/revisionResolutionInline.js +1 -2
- package/dist/internal/subtreeHolds.d.ts +12 -0
- package/dist/internal/subtreeHolds.js +25 -0
- package/dist/internal/wholeStoryRevisionResolution.js +1 -1
- package/dist/layout-bridge/cellSelectionHighlight.js +3 -3
- package/dist/layout-bridge/convert/flowBlockPostprocessing.js +20 -12
- package/dist/layout-bridge/convert/flowConversionShared.d.ts +15 -1
- package/dist/layout-bridge/convert/flowConversionShared.js +9 -1
- package/dist/layout-bridge/convert/paragraphAttrs.d.ts +15 -4
- package/dist/layout-bridge/convert/paragraphAttrs.js +11 -4
- package/dist/layout-bridge/convert/paragraphBlockCache.d.ts +26 -0
- package/dist/layout-bridge/convert/paragraphBlockCache.js +137 -0
- package/dist/layout-bridge/convert/paragraphConversion.d.ts +12 -2
- package/dist/layout-bridge/convert/paragraphConversion.js +37 -5
- package/dist/layout-bridge/convert/paragraphRuns.d.ts +2 -2
- package/dist/layout-bridge/convert/sectionBoundaries.js +16 -0
- package/dist/layout-bridge/convert/tableConversion.js +19 -8
- package/dist/layout-bridge/convert/toFlowBlocks.js +144 -15
- package/dist/layout-bridge/convert/topLevelConversion.d.ts +74 -0
- package/dist/layout-bridge/convert/topLevelConversion.js +109 -0
- package/dist/layout-bridge/dom/clickToPositionDom.js +41 -40
- package/dist/layout-bridge/dom/findBodyPmSpans.js +4 -3
- package/dist/layout-bridge/dom/findHfPmSpans.js +10 -15
- package/dist/layout-bridge/dom/imeCaretAnchor.d.ts +8 -0
- package/dist/layout-bridge/dom/imeCaretAnchor.js +71 -7
- package/dist/layout-bridge/dom/textStreamDom.js +3 -2
- package/dist/layout-bridge/engine/blockIndex.d.ts +7 -0
- package/dist/layout-bridge/engine/blockIndex.js +12 -0
- package/dist/layout-bridge/engine/hitTest.js +9 -10
- package/dist/layout-bridge/engine/selectionRects.js +6 -6
- package/dist/layout-bridge/headerFooterLayout.js +12 -11
- package/dist/layout-bridge/tableInsertHover.js +2 -1
- package/dist/layout-engine/footnoteContinuation.d.ts +36 -0
- package/dist/layout-engine/footnoteContinuation.js +210 -0
- package/dist/layout-engine/index.d.ts +2 -2
- package/dist/layout-engine/index.js +7 -2
- package/dist/layout-engine/measure/cache.d.ts +2 -0
- package/dist/layout-engine/measure/cache.js +16 -6
- package/dist/layout-engine/measure/measureParagraph.js +1 -1
- package/dist/layout-engine/measure/paragraphKeyMemo.d.ts +8 -0
- package/dist/layout-engine/measure/paragraphKeyMemo.js +92 -0
- package/dist/layout-engine/tableLayout.js +29 -5
- package/dist/layout-engine/tableRowBreak.d.ts +36 -0
- package/dist/layout-engine/tableRowBreak.js +43 -1
- package/dist/layout-engine/types.d.ts +42 -1
- package/dist/layout-painter/imageLayout.js +2 -1
- package/dist/layout-painter/pageShellStyles.d.ts +10 -0
- package/dist/layout-painter/pageShellStyles.js +32 -0
- package/dist/layout-painter/reconcileRenderedContent.d.ts +19 -0
- package/dist/layout-painter/reconcileRenderedContent.js +117 -0
- package/dist/layout-painter/renderFragment.js +4 -6
- package/dist/layout-painter/renderImage.js +2 -2
- package/dist/layout-painter/renderPage.d.ts +4 -4
- package/dist/layout-painter/renderPage.js +54 -46
- package/dist/layout-painter/renderParagraph.js +3 -3
- package/dist/layout-painter/renderTable.js +16 -16
- package/dist/layout-painter/renderTextBox.js +2 -2
- package/dist/layout-painter/sdtBoundary.js +3 -2
- package/dist/managers/AutoSaveManager.d.ts +5 -1
- package/dist/managers/FindReplaceManager.js +3 -10
- package/dist/markdown/escape.d.ts +20 -1
- package/dist/markdown/escape.js +43 -1
- package/dist/markdown/renderBlock.js +4 -1
- package/dist/markdown/renderParagraph.js +13 -27
- package/dist/markdown/renderTable.js +6 -2
- package/dist/markdown/trailers.js +1 -0
- package/dist/paged-layout/blockGeometry.js +3 -2
- package/dist/paged-layout/editorScrollRoot.d.ts +9 -0
- package/dist/paged-layout/editorScrollRoot.js +10 -1
- package/dist/paged-layout/rangeProjection.js +5 -4
- package/dist/paged-layout/scrollToPmPosition.js +3 -3
- package/dist/paged-layout/selectionViewportRect.d.ts +6 -0
- package/dist/paged-layout/selectionViewportRect.js +8 -2
- package/dist/pdf/images.d.ts +17 -1
- package/dist/pdf/images.js +22 -4
- package/dist/pdf/writePdf.js +4 -2
- package/dist/prosemirror/attrs/index.js +2 -0
- package/dist/prosemirror/canonicalCommands.d.ts +39 -1
- package/dist/prosemirror/canonicalTableCommands.d.ts +28 -0
- package/dist/prosemirror/canonicalTableCommands.js +362 -0
- package/dist/prosemirror/commands/comments.d.ts +30 -2
- package/dist/prosemirror/commands/comments.js +189 -18
- package/dist/prosemirror/commands/formatting.d.ts +1 -1
- package/dist/prosemirror/commands/index.d.ts +1 -1
- package/dist/prosemirror/commentIdAllocator.js +2 -2
- package/dist/prosemirror/commentRangeBoundaryAttrs.d.ts +6 -0
- package/dist/prosemirror/commentRangeBoundaryAttrs.js +9 -3
- package/dist/prosemirror/commentRecords.d.ts +137 -0
- package/dist/prosemirror/commentRecords.js +400 -0
- package/dist/prosemirror/commentReferenceIntegrity.js +3 -4
- package/dist/prosemirror/conversion/fromProseDoc.d.ts +2 -0
- package/dist/prosemirror/conversion/fromProseDoc.js +85 -34
- package/dist/prosemirror/conversion/index.d.ts +2 -2
- package/dist/prosemirror/conversion/toProseDoc.d.ts +140 -4
- package/dist/prosemirror/conversion/toProseDoc.js +432 -76
- package/dist/prosemirror/extensions/StarterKit.js +2 -0
- package/dist/prosemirror/extensions/core/DocExtension.js +1 -1
- package/dist/prosemirror/extensions/features/AutoBidiDetectionExtension.d.ts +1 -1
- package/dist/prosemirror/extensions/features/JoinedRunStyleExtension.d.ts +1 -1
- package/dist/prosemirror/extensions/features/ParaIdAllocatorExtension.d.ts +1 -1
- package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.d.ts +23 -1
- package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.js +61 -32
- package/dist/prosemirror/extensions/features/pastedHtmlLists.js +5 -4
- package/dist/prosemirror/extensions/marks/CommentExtension.js +8 -3
- package/dist/prosemirror/extensions/nodes/BlockCommentRangeBoundaryExtension.d.ts +4 -0
- package/dist/prosemirror/extensions/nodes/BlockCommentRangeBoundaryExtension.js +49 -0
- package/dist/prosemirror/extensions/nodes/CommentReferenceExtension.js +3 -1
- package/dist/prosemirror/extensions/nodes/ImageExtension.js +12 -3
- package/dist/prosemirror/extensions/nodes/TableExtension.js +32 -31
- package/dist/prosemirror/extensions/nodes/TextBoxExtension.js +1 -1
- package/dist/prosemirror/index.d.ts +3 -3
- package/dist/prosemirror/listLabels.js +3 -2
- package/dist/prosemirror/listNumbering.d.ts +6 -0
- package/dist/prosemirror/listNumbering.js +12 -9
- package/dist/prosemirror/lockedControls.d.ts +13 -0
- package/dist/prosemirror/lockedControls.js +106 -0
- package/dist/prosemirror/markupViewProjection.js +1 -1
- package/dist/prosemirror/nativeSelection.d.ts +33 -0
- package/dist/prosemirror/nativeSelection.js +74 -0
- package/dist/prosemirror/noteReferenceReview.js +2 -2
- package/dist/prosemirror/numberedRefFields.d.ts +2 -0
- package/dist/prosemirror/numberedRefFields.js +16 -5
- package/dist/prosemirror/paragraphMarkJoin.d.ts +6 -8
- package/dist/prosemirror/paragraphMarkJoin.js +155 -16
- package/dist/prosemirror/plugins/contentControlWidgets.js +2 -2
- package/dist/prosemirror/plugins/documentNumbering.js +37 -15
- package/dist/prosemirror/plugins/suggestionMode.js +33 -10
- package/dist/prosemirror/plugins/templatePreviewValues.js +16 -1
- package/dist/prosemirror/rebaseParagraphRuns.js +1 -1
- package/dist/prosemirror/replacedAnnotations.js +1 -0
- package/dist/prosemirror/runFormattingFromMarks.d.ts +0 -1
- package/dist/prosemirror/runFormattingFromMarks.js +2 -4
- package/dist/prosemirror/runFormattingReconciliation.js +2 -2
- package/dist/prosemirror/runIdentityAcrossRevisions.d.ts +23 -1
- package/dist/prosemirror/runIdentityAcrossRevisions.js +57 -8
- package/dist/prosemirror/runPropertyChangeResolution.js +1 -2
- package/dist/prosemirror/runStyleFormatting.d.ts +14 -4
- package/dist/prosemirror/runStyleFormatting.js +16 -13
- package/dist/prosemirror/schema/marks.d.ts +13 -1
- package/dist/prosemirror/storyListNumbering.js +7 -2
- package/dist/prosemirror/styles/paragraphStyleCascade.js +2 -2
- package/dist/prosemirror/tableResize.d.ts +10 -9
- package/dist/prosemirror/tableResize.js +60 -49
- package/dist/prosemirror/textInput.d.ts +30 -1
- package/dist/prosemirror/textInput.js +144 -17
- package/dist/prosemirror/utils/visualLineNavigation.js +20 -18
- package/dist/prosemirror/validation.d.ts +19 -0
- package/dist/prosemirror/validation.js +79 -5
- package/dist/redline.js +23 -9
- package/dist/render-dom/HeaderFooterSelectionOverlay.js +5 -4
- package/dist/render-dom/RenderedDomContext.js +7 -6
- package/dist/server.d.ts +2 -2
- package/dist/style-sets/extract.js +2 -2
- package/dist/types/canonicalCapabilities.d.ts +38 -16
- package/dist/types/canonicalCapabilities.js +21 -18
- package/dist/utils/cssString.d.ts +7 -0
- package/dist/utils/cssString.js +9 -0
- package/dist/utils/findMatchView.js +4 -3
- package/dist/utils/fontResolver.js +4 -1
- package/dist/utils/formatToStyle.d.ts +1 -1
- package/dist/utils/mergeDocumentContent.js +2 -2
- package/dist/utils/paintedPositions.d.ts +60 -0
- package/dist/utils/paintedPositions.js +101 -0
- package/dist/utils/replaceText.d.ts +11 -0
- package/dist/utils/replaceText.js +39 -7
- package/dist/version-comparison.d.ts +9 -1
- package/dist/version-comparison.js +11 -5
- package/package.json +2 -3
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { document_d_exports } from "../types/document.js";
|
|
2
|
+
/**
|
|
3
|
+
* Why the session cannot hold these stories of `document`, or `null`: the
|
|
4
|
+
* first block it cannot hold, else the first paragraph whose content it
|
|
5
|
+
* cannot hold, in each story in turn.
|
|
6
|
+
*/
|
|
7
|
+
export declare const unsupportedSeedReason: (document: document_d_exports.Document, stories?: import("@stll/docx-core/ops").OpStory[]) => string | null;
|
|
8
|
+
/**
|
|
9
|
+
* The same verdict from one walk of every story, judging nothing once: the
|
|
10
|
+
* reference the block judgments above must equal.
|
|
11
|
+
*/
|
|
12
|
+
export declare const unsupportedSeedReasonWholeDocument: (document: document_d_exports.Document, stories?: import("@stll/docx-core/ops").OpStory[]) => string | null;
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { canonicalInlineSourceIssue } from "./canonicalInlineProjection.js";
|
|
2
|
+
import { OP_STORIES, commentDocumentIssue, documentStories, findStoryBody } from "@stll/docx-core/ops";
|
|
3
|
+
// src/controller/canonicalSeedContent.ts
|
|
4
|
+
const STRUCTURE_ISSUE = "Canonical sessions currently require paragraphs, tables and supported inline atoms.";
|
|
5
|
+
const REVIEW_CARRIER_ISSUE = "Canonical sessions currently require plain paragraphs and supported inline atoms.";
|
|
6
|
+
/** Range markers may open or close between blocks; they hold no text. */
|
|
7
|
+
const BETWEEN_BLOCK_MARKERS = /* @__PURE__ */ new Set([
|
|
8
|
+
"commentRangeStart",
|
|
9
|
+
"commentRangeEnd",
|
|
10
|
+
"bookmarkStart",
|
|
11
|
+
"bookmarkEnd",
|
|
12
|
+
"moveFromRangeStart",
|
|
13
|
+
"moveFromRangeEnd",
|
|
14
|
+
"moveToRangeStart",
|
|
15
|
+
"moveToRangeEnd"
|
|
16
|
+
]);
|
|
17
|
+
const issuesIn = (block) => {
|
|
18
|
+
const paragraphs = [];
|
|
19
|
+
const collect = (blocks) => {
|
|
20
|
+
for (const child of blocks) {
|
|
21
|
+
if (child.type === "paragraph") {
|
|
22
|
+
paragraphs.push(child);
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
if (BETWEEN_BLOCK_MARKERS.has(child.type)) continue;
|
|
26
|
+
if (child.type === "preservedBlock") continue;
|
|
27
|
+
if (child.type === "blockSdt") {
|
|
28
|
+
const issue = collect(child.content);
|
|
29
|
+
if (issue !== null) return issue;
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
if (child.type !== "table") return STRUCTURE_ISSUE;
|
|
33
|
+
for (const row of child.rows) for (const cell of row.cells) {
|
|
34
|
+
const issue = collect(cell.content);
|
|
35
|
+
if (issue !== null) return issue;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return null;
|
|
39
|
+
};
|
|
40
|
+
const structure = collect([block]);
|
|
41
|
+
let paragraph = null;
|
|
42
|
+
for (const candidate of paragraphs) {
|
|
43
|
+
paragraph = candidate.reviewCarrier === void 0 ? canonicalInlineSourceIssue(candidate.content) : REVIEW_CARRIER_ISSUE;
|
|
44
|
+
if (paragraph !== null) break;
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
structure,
|
|
48
|
+
paragraph
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
const blockIssues = /* @__PURE__ */ new WeakMap();
|
|
52
|
+
const issuesOf = (block) => {
|
|
53
|
+
let issues = blockIssues.get(block);
|
|
54
|
+
if (issues === void 0) {
|
|
55
|
+
issues = issuesIn(block);
|
|
56
|
+
blockIssues.set(block, issues);
|
|
57
|
+
}
|
|
58
|
+
return issues;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Why the session cannot hold these stories of `document`, or `null`: the
|
|
62
|
+
* first block it cannot hold, else the first paragraph whose content it
|
|
63
|
+
* cannot hold, in each story in turn.
|
|
64
|
+
*/
|
|
65
|
+
const unsupportedSeedReason = (document, stories = documentStories(document)) => {
|
|
66
|
+
const commentIssue = commentDocumentIssue(document, "all");
|
|
67
|
+
if (commentIssue !== void 0) return commentIssue;
|
|
68
|
+
for (const story of stories) {
|
|
69
|
+
const body = findStoryBody(document, story);
|
|
70
|
+
if (story !== OP_STORIES.MAIN && (story.kind === "footnote" || story.kind === "endnote")) {
|
|
71
|
+
const note = (story.kind === "footnote" ? document.package.footnotes : document.package.endnotes)?.find(({ id }) => id === story.id);
|
|
72
|
+
if (note?.noteType !== void 0 && note.noteType !== "normal") continue;
|
|
73
|
+
}
|
|
74
|
+
const content = body?.content;
|
|
75
|
+
if (!content || content.length === 0) return "Canonical sessions require a nonempty paragraph story.";
|
|
76
|
+
const issues = content.map(issuesOf);
|
|
77
|
+
const structure = issues.find((issue) => issue.structure !== null);
|
|
78
|
+
if (structure !== void 0) return structure.structure;
|
|
79
|
+
const paragraph = issues.find((issue) => issue.paragraph !== null);
|
|
80
|
+
if (paragraph !== void 0) return paragraph.paragraph;
|
|
81
|
+
}
|
|
82
|
+
return null;
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* The same verdict from one walk of every story, judging nothing once: the
|
|
86
|
+
* reference the block judgments above must equal.
|
|
87
|
+
*/
|
|
88
|
+
const unsupportedSeedReasonWholeDocument = (document, stories = documentStories(document)) => {
|
|
89
|
+
const commentIssue = commentDocumentIssue(document, "all");
|
|
90
|
+
if (commentIssue !== void 0) return commentIssue;
|
|
91
|
+
for (const story of stories) {
|
|
92
|
+
const body = findStoryBody(document, story);
|
|
93
|
+
if (story !== OP_STORIES.MAIN && (story.kind === "footnote" || story.kind === "endnote")) {
|
|
94
|
+
const note = (story.kind === "footnote" ? document.package.footnotes : document.package.endnotes)?.find(({ id }) => id === story.id);
|
|
95
|
+
if (note?.noteType !== void 0 && note.noteType !== "normal") continue;
|
|
96
|
+
}
|
|
97
|
+
const content = body?.content;
|
|
98
|
+
if (!content || content.length === 0) return "Canonical sessions require a nonempty paragraph story.";
|
|
99
|
+
const paragraphs = [];
|
|
100
|
+
const collect = (blocks) => {
|
|
101
|
+
for (const block of blocks) {
|
|
102
|
+
if (block.type === "paragraph") {
|
|
103
|
+
paragraphs.push(block);
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
if (block.type === "commentRangeStart" || block.type === "commentRangeEnd" || block.type === "bookmarkStart" || block.type === "bookmarkEnd" || block.type === "moveFromRangeStart" || block.type === "moveFromRangeEnd" || block.type === "moveToRangeStart" || block.type === "moveToRangeEnd") continue;
|
|
107
|
+
if (block.type === "preservedBlock") continue;
|
|
108
|
+
if (block.type === "blockSdt") {
|
|
109
|
+
const issue = collect(block.content);
|
|
110
|
+
if (issue !== null) return issue;
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
if (block.type !== "table") return "Canonical sessions currently require paragraphs, tables and supported inline atoms.";
|
|
114
|
+
for (const row of block.rows) for (const cell of row.cells) {
|
|
115
|
+
const issue = collect(cell.content);
|
|
116
|
+
if (issue !== null) return issue;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return null;
|
|
120
|
+
};
|
|
121
|
+
const blockIssue = collect(content);
|
|
122
|
+
if (blockIssue !== null) return blockIssue;
|
|
123
|
+
for (const paragraph of paragraphs) {
|
|
124
|
+
if (paragraph.reviewCarrier !== void 0) return "Canonical sessions currently require plain paragraphs and supported inline atoms.";
|
|
125
|
+
const issue = canonicalInlineSourceIssue(paragraph.content);
|
|
126
|
+
if (issue !== null) return issue;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return null;
|
|
130
|
+
};
|
|
131
|
+
export { unsupportedSeedReason, unsupportedSeedReasonWholeDocument };
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { document_d_exports } from "../types/document.js";
|
|
2
|
-
import {
|
|
2
|
+
import { CanonicalRefusalGround } from "../types/canonicalCapabilities.js";
|
|
3
|
+
import { CommentMarkerCache } from "../docx/commentAnchorIndex.js";
|
|
4
|
+
import { ListNormalizationCache } from "../docx/listModelNormalization.js";
|
|
5
|
+
import { ProjectionBlockCache } from "../prosemirror/conversion/toProseDoc.js";
|
|
3
6
|
import { CanonicalSaveSnapshot } from "../types/canonicalSave.js";
|
|
4
|
-
import {
|
|
7
|
+
import { InlineProjectionCache } from "./canonicalInlineProjection.js";
|
|
8
|
+
import { ParagraphAddress, ParagraphIdIndex, ProjectedBlock, StoryProjectionFacts } from "./canonicalProjectionBlocks.js";
|
|
9
|
+
import { CanonicalSourceRestore } from "./canonicalSourceNormalization.js";
|
|
5
10
|
import { Node } from "prosemirror-model";
|
|
6
11
|
import { EditorState, Transaction } from "prosemirror-state";
|
|
7
12
|
import { Err, Ok, Result, TaggedErrorClass } from "better-result";
|
|
@@ -9,8 +14,8 @@ import { DocumentOp, EditorIntent, OpStory, TextPosition, TouchedBlocks } from "
|
|
|
9
14
|
declare const CanonicalSessionErrorBase: TaggedErrorClass<"CanonicalSessionError">;
|
|
10
15
|
export declare class CanonicalSessionError extends CanonicalSessionErrorBase<{
|
|
11
16
|
message: string;
|
|
12
|
-
gap: CanonicalGap;
|
|
13
17
|
reason: "refused" | "noChange";
|
|
18
|
+
ground: CanonicalRefusalGround;
|
|
14
19
|
}> {}
|
|
15
20
|
export type CanonicalSelection = {
|
|
16
21
|
type: "text" | "inlineNode" | "cell" | "all";
|
|
@@ -25,34 +30,105 @@ export type CanonicalSessionMode = {
|
|
|
25
30
|
author: string;
|
|
26
31
|
};
|
|
27
32
|
export declare const CANONICAL_PROJECTION_META = "folioCanonicalProjection";
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
source: document_d_exports.Paragraph;
|
|
36
|
-
};
|
|
33
|
+
/**
|
|
34
|
+
* Which source gap an editor position names where invisible markers (comment
|
|
35
|
+
* ranges, bookmarks, permission ranges, proofing marks) share it: a caret
|
|
36
|
+
* takes the gap typed text takes (the seam's own gap); `afterMarkers` takes the
|
|
37
|
+
* seam's last gap and `beforeMarkers` its first.
|
|
38
|
+
*/
|
|
39
|
+
export type CanonicalAddressEdge = "caret" | "afterMarkers" | "beforeMarkers";
|
|
37
40
|
type CanonicalProjectionOptions = {
|
|
38
41
|
doc: Node;
|
|
39
|
-
paragraphs: readonly ParagraphAddress[];
|
|
40
42
|
story: OpStory;
|
|
43
|
+
/** The story's blocks the projection was made from. */
|
|
44
|
+
content: readonly document_d_exports.BlockContent[];
|
|
45
|
+
/** One per top-level node of `doc`, in order. */
|
|
46
|
+
blocks: readonly ProjectedBlock[];
|
|
47
|
+
index: ParagraphIdIndex;
|
|
48
|
+
facts: StoryProjectionFacts;
|
|
49
|
+
/**
|
|
50
|
+
* Whether the next projection may keep this one's blocks: each top-level
|
|
51
|
+
* node was projected from the story block at its index alone, and no two
|
|
52
|
+
* source paragraphs share an id.
|
|
53
|
+
*/
|
|
54
|
+
reusable: boolean;
|
|
41
55
|
};
|
|
42
56
|
/** Paragraph gaps bind logical units and source zero-width ordinals to PM positions. */
|
|
43
57
|
declare class CanonicalProjection {
|
|
44
58
|
readonly doc: Node;
|
|
45
59
|
readonly story: OpStory;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
60
|
+
readonly content: readonly document_d_exports.BlockContent[];
|
|
61
|
+
readonly blocks: readonly ProjectedBlock[];
|
|
62
|
+
readonly index: ParagraphIdIndex;
|
|
63
|
+
readonly facts: StoryProjectionFacts;
|
|
64
|
+
readonly reusable: boolean;
|
|
65
|
+
/** Where each top-level node starts. */
|
|
66
|
+
private readonly starts;
|
|
67
|
+
private readonly addresses;
|
|
68
|
+
constructor(options: CanonicalProjectionOptions,
|
|
69
|
+
/** What a projection of an equal document already worked out. */
|
|
70
|
+
held?: {
|
|
71
|
+
starts: readonly number[];
|
|
72
|
+
addresses: Map<string, ParagraphAddress>;
|
|
73
|
+
});
|
|
74
|
+
/**
|
|
75
|
+
* The same projection held as `doc`, a document equal to this one's. A
|
|
76
|
+
* commit's transaction ends on a document equal to the projection it staged,
|
|
77
|
+
* sharing the blocks it left; holding that document lets the next commit see
|
|
78
|
+
* the state it was given is the projection without comparing every node.
|
|
79
|
+
*/
|
|
80
|
+
heldAs(doc: Node): CanonicalProjection;
|
|
81
|
+
private addressOf;
|
|
82
|
+
/** The paragraph whose content holds `position`, its ends included. */
|
|
83
|
+
private paragraphAround;
|
|
84
|
+
addressAt(position: number, edge?: CanonicalAddressEdge): Result<TextPosition, CanonicalSessionError>;
|
|
85
|
+
/**
|
|
86
|
+
* The source gaps a selection from `from` to `to` replaces between. Its
|
|
87
|
+
* edges stay inside the markers beside them, so replacing exactly the
|
|
88
|
+
* words a comment covers keeps the comment on the new text. A selection of
|
|
89
|
+
* a paragraph's whole text takes that paragraph's markers with it: an edge
|
|
90
|
+
* at the very start of a paragraph whose text the selection covers to its
|
|
91
|
+
* end reaches before the markers there, and an edge at the very end of a
|
|
92
|
+
* paragraph the selection covers from its start reaches after them, so a
|
|
93
|
+
* comment on nothing but the replaced text is emptied, as removing the
|
|
94
|
+
* text would empty it.
|
|
95
|
+
*/
|
|
96
|
+
rangeEdgesAt(from: number, to: number): {
|
|
97
|
+
start: CanonicalAddressEdge;
|
|
98
|
+
end: CanonicalAddressEdge;
|
|
99
|
+
};
|
|
100
|
+
inputAddressAt(position: number, edge?: CanonicalAddressEdge): Result<TextPosition, CanonicalSessionError>;
|
|
51
101
|
positionAt(address: TextPosition): Result<number, CanonicalSessionError>;
|
|
52
102
|
selectionAt(state: EditorState): Result<CanonicalSelection, CanonicalSessionError>;
|
|
103
|
+
/** The first paragraph the projection addresses, in document order. */
|
|
104
|
+
get firstParagraph(): ParagraphAddress | undefined;
|
|
53
105
|
paragraph(blockId: string): ParagraphAddress | undefined;
|
|
106
|
+
/** The paragraph whose node starts at `before`. */
|
|
107
|
+
paragraphStartingAt(before: number): ParagraphAddress | undefined;
|
|
54
108
|
nextParagraphInContainer(blockId: string): ParagraphAddress | undefined;
|
|
55
109
|
}
|
|
110
|
+
/** A session's projection pieces, reused by every projection of its stories. */
|
|
111
|
+
type StoryProjectionCaches = {
|
|
112
|
+
/** The main story's converted blocks. */
|
|
113
|
+
blocks: ProjectionBlockCache;
|
|
114
|
+
/** Each paragraph's gaps, by its source and editor node. */
|
|
115
|
+
inline: InlineProjectionCache;
|
|
116
|
+
/** Each story's normalized list rendering, by block and the counters before it. */
|
|
117
|
+
lists: ListNormalizationCache;
|
|
118
|
+
/** Each paragraph's comment markers, by its source. */
|
|
119
|
+
comments: CommentMarkerCache;
|
|
120
|
+
};
|
|
121
|
+
export declare const newStoryProjectionCaches: () => StoryProjectionCaches;
|
|
122
|
+
type ProjectStoryOptions = {
|
|
123
|
+
document: document_d_exports.Document;
|
|
124
|
+
styles: document_d_exports.StyleDefinitions | null | undefined;
|
|
125
|
+
story?: OpStory;
|
|
126
|
+
/** What earlier projections converted, kept by its session. */
|
|
127
|
+
caches?: StoryProjectionCaches;
|
|
128
|
+
/** A projection of the story whose top-level blocks this one may keep. */
|
|
129
|
+
previous?: CanonicalProjection;
|
|
130
|
+
};
|
|
131
|
+
declare const project: ({ document, styles, story, caches, previous }: ProjectStoryOptions) => Result<CanonicalProjection, CanonicalSessionError>;
|
|
56
132
|
/** Input intent, never projection-step adjacency, determines the journal partition. */
|
|
57
133
|
export type CanonicalInputSemantic = "typing" | "deleteBackward" | "deleteForward" | "paste" | "composition" | "replacement" | "structure";
|
|
58
134
|
export type CanonicalCommit = {
|
|
@@ -64,6 +140,8 @@ export type CanonicalCommit = {
|
|
|
64
140
|
touched: TouchedBlocks;
|
|
65
141
|
version: number;
|
|
66
142
|
origin: CanonicalOrigin;
|
|
143
|
+
/** Revisions a content control lock held back; they stay pending. */
|
|
144
|
+
lockHeld?: readonly number[];
|
|
67
145
|
/** Publish only after every projection/plugin transaction has been accepted. */
|
|
68
146
|
publish: () => Result<void, CanonicalSessionError>;
|
|
69
147
|
};
|
|
@@ -83,6 +161,9 @@ type CanonicalSessionSeedOptions = {
|
|
|
83
161
|
document: document_d_exports.Document;
|
|
84
162
|
projection: CanonicalProjection;
|
|
85
163
|
styles: document_d_exports.StyleDefinitions | null | undefined;
|
|
164
|
+
/** Stories the session reads in its own spelling, given back as read while unedited. */
|
|
165
|
+
sourceRestores?: readonly CanonicalSourceRestore[];
|
|
166
|
+
caches: StoryProjectionCaches;
|
|
86
167
|
};
|
|
87
168
|
type CanonicalReplaceTextInput = {
|
|
88
169
|
from: number;
|
|
@@ -117,7 +198,10 @@ declare class CanonicalSession {
|
|
|
117
198
|
private lifecycle;
|
|
118
199
|
private readonly undone;
|
|
119
200
|
private readonly styles;
|
|
120
|
-
|
|
201
|
+
private readonly sourceRestores;
|
|
202
|
+
/** What earlier projections converted, reused by every later one. */
|
|
203
|
+
private readonly caches;
|
|
204
|
+
constructor({ document, projection, styles, sourceRestores, caches }: CanonicalSessionSeedOptions);
|
|
121
205
|
/** Render only the committed comment projection while provisional IME blocks document snapshots. */
|
|
122
206
|
getCommittedComments(): document_d_exports.Comment[];
|
|
123
207
|
setMode(mode: CanonicalSessionMode): void;
|
|
@@ -136,7 +220,11 @@ declare class CanonicalSession {
|
|
|
136
220
|
get document(): document_d_exports.Document;
|
|
137
221
|
captureSaveSnapshot(): CanonicalSaveSnapshot;
|
|
138
222
|
get projection(): CanonicalProjection;
|
|
223
|
+
/** The caret the last published edit returned, when the editor shows it at `position`. */
|
|
224
|
+
private editCaretAt;
|
|
139
225
|
get selection(): CanonicalSelection | null;
|
|
226
|
+
/** Every paragraph identity this session has read or minted, live or retired. */
|
|
227
|
+
get reservedBlockIds(): ReadonlySet<string>;
|
|
140
228
|
get version(): number;
|
|
141
229
|
get canUndo(): boolean;
|
|
142
230
|
get canRedo(): boolean;
|
|
@@ -146,6 +234,15 @@ declare class CanonicalSession {
|
|
|
146
234
|
endComposition(): void;
|
|
147
235
|
private checkState;
|
|
148
236
|
prepareReplace(state: EditorState, { from, to, text, story, semantic, compositionPhase, time }: CanonicalReplaceTextInput): Result<CanonicalCommit, CanonicalSessionError>;
|
|
237
|
+
/**
|
|
238
|
+
* A structural edit over selected cells: each selected cell is cleared and
|
|
239
|
+
* the edit happens at the start of the first, as the editor's own command
|
|
240
|
+
* does over a cell selection. One commit, so one undo step.
|
|
241
|
+
*/
|
|
242
|
+
prepareCellSelectionStructure(state: EditorState, structure: (at: TextPosition) => EditorIntent, { resourceOps, semantic }?: {
|
|
243
|
+
resourceOps?: readonly DocumentOp[];
|
|
244
|
+
semantic?: CanonicalInputSemantic;
|
|
245
|
+
}): Result<CanonicalCommit, CanonicalSessionError>;
|
|
149
246
|
prepareIntent(state: EditorState, intent: EditorIntent): Result<CanonicalCommit, CanonicalSessionError>;
|
|
150
247
|
prepareIntents(state: EditorState, { intents, resourceOps, semantic }: {
|
|
151
248
|
intents: readonly EditorIntent[];
|
|
@@ -156,9 +253,24 @@ declare class CanonicalSession {
|
|
|
156
253
|
private prepareJournalledOps;
|
|
157
254
|
prepareSplit(state: EditorState): Result<CanonicalCommit, CanonicalSessionError>;
|
|
158
255
|
prepareJoin(state: EditorState, direction: "backward" | "forward"): Result<CanonicalCommit, CanonicalSessionError>;
|
|
159
|
-
prepareResolve(state: EditorState, { revisionIds, resolution }: {
|
|
256
|
+
prepareResolve(state: EditorState, { revisionIds, resolution, before }: {
|
|
160
257
|
revisionIds: readonly number[];
|
|
161
258
|
resolution: "accept" | "reject";
|
|
259
|
+
/** Operations applied ahead of the resolution, in the same commit. */
|
|
260
|
+
before?: readonly DocumentOp[];
|
|
261
|
+
}): Result<CanonicalCommit, CanonicalSessionError>;
|
|
262
|
+
/**
|
|
263
|
+
* Accept or reject one pending suggestion. Rejecting it rejects its
|
|
264
|
+
* revisions and removes the comments it proposes. Accepting it adopts its
|
|
265
|
+
* revisions as ordinary tracked changes by `author`, keeping their ids, as
|
|
266
|
+
* the editor does: the change then waits for review like any other. Its
|
|
267
|
+
* comments stay as ordinary comments.
|
|
268
|
+
*/
|
|
269
|
+
prepareSuggestion(state: EditorState, { suggestionId, resolution, author, date }: {
|
|
270
|
+
suggestionId: string;
|
|
271
|
+
resolution: "accept" | "reject";
|
|
272
|
+
author: string;
|
|
273
|
+
date: string;
|
|
162
274
|
}): Result<CanonicalCommit, CanonicalSessionError>;
|
|
163
275
|
projectStory(story: OpStory): Result<CanonicalProjection, CanonicalSessionError>;
|
|
164
276
|
prepareOperations(state: EditorState, ops: readonly DocumentOp[]): Result<CanonicalCommit, CanonicalSessionError>;
|
|
@@ -173,4 +285,4 @@ export declare const deletionRange: (state: EditorState, direction: "backward" |
|
|
|
173
285
|
from: number;
|
|
174
286
|
to: number;
|
|
175
287
|
}, CanonicalSessionError>;
|
|
176
|
-
export type
|
|
288
|
+
export { type CanonicalProjection, type CanonicalSession, project as projectCanonicalStory };
|