@stll/folio-core 0.52.0 → 0.54.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/README.md +23 -0
- package/dist/ai-edits/apply.d.ts +26 -1
- package/dist/ai-edits/apply.js +1779 -141
- package/dist/ai-edits/batch-claims.d.ts +145 -0
- package/dist/ai-edits/batch-claims.js +275 -0
- package/dist/ai-edits/blockRange.js +9 -3
- package/dist/ai-edits/character-boundaries.d.ts +43 -0
- package/dist/ai-edits/character-boundaries.js +95 -0
- package/dist/ai-edits/clean-text.d.ts +33 -3
- package/dist/ai-edits/clean-text.js +52 -6
- package/dist/ai-edits/comment-lifecycle.d.ts +18 -0
- package/dist/ai-edits/comment-lifecycle.js +52 -0
- package/dist/ai-edits/headless.d.ts +91 -7
- package/dist/ai-edits/headless.js +520 -51
- package/dist/ai-edits/index.d.ts +2 -1
- package/dist/ai-edits/index.js +2 -1
- package/dist/ai-edits/minimal-replacement.d.ts +21 -6
- package/dist/ai-edits/minimal-replacement.js +134 -15
- package/dist/ai-edits/newListNumbering.d.ts +23 -0
- package/dist/ai-edits/newListNumbering.js +94 -0
- package/dist/ai-edits/note-references.d.ts +96 -0
- package/dist/ai-edits/note-references.js +139 -0
- package/dist/ai-edits/pending-suggestions.d.ts +79 -0
- package/dist/ai-edits/pending-suggestions.js +306 -0
- package/dist/ai-edits/read.d.ts +6 -4
- package/dist/ai-edits/read.js +113 -50
- package/dist/ai-edits/result-validation.d.ts +29 -0
- package/dist/ai-edits/result-validation.js +164 -0
- package/dist/ai-edits/revisionStretches.d.ts +17 -0
- package/dist/ai-edits/revisionStretches.js +80 -0
- package/dist/ai-edits/snapshot.d.ts +36 -3
- package/dist/ai-edits/snapshot.js +180 -25
- package/dist/ai-edits/table-cell-mutations.d.ts +4 -2
- package/dist/ai-edits/table-cell-mutations.js +6 -2
- package/dist/ai-edits/table-geometry.d.ts +1 -1
- package/dist/ai-edits/table-row-column-mutations.d.ts +44 -17
- package/dist/ai-edits/table-row-column-mutations.js +86 -34
- package/dist/ai-edits/types.d.ts +155 -16
- package/dist/compare/compare.d.ts +1 -1
- package/dist/compare/compare.js +65 -16
- package/dist/compare/content-alignment.d.ts +5 -1
- package/dist/compare/content-alignment.js +52 -34
- package/dist/compare/content-types.d.ts +7 -0
- package/dist/compare/content.d.ts +4 -1
- package/dist/compare/content.js +6 -1
- package/dist/compare/formatting.js +2 -1
- package/dist/compare/inline-atoms.d.ts +21 -4
- package/dist/compare/inline-atoms.js +138 -16
- package/dist/compare/inline-provenance.js +1 -1
- package/dist/compare/plan.js +10 -5
- package/dist/compare/scenario.js +14 -3
- package/dist/compare/section-boundary-properties.js +1 -1
- package/dist/compare/types.d.ts +4 -2
- package/dist/compare/types.js +2 -1
- package/dist/compare/verification.d.ts +1 -1
- package/dist/compare/verification.js +15 -3
- package/dist/controller/committedLayoutDiff.d.ts +25 -0
- package/dist/controller/committedLayoutDiff.js +71 -0
- package/dist/controller/contentControlWidgetController.d.ts +1 -1
- package/dist/controller/folioEditor.d.ts +1 -1
- package/dist/controller/fontReadiness.d.ts +70 -3
- package/dist/controller/fontReadiness.js +100 -10
- package/dist/controller/headerFooterEditorManager.js +6 -1
- package/dist/controller/layoutPipeline.d.ts +12 -10
- package/dist/controller/layoutPipeline.js +65 -11
- package/dist/controller/layoutRunOptions.d.ts +24 -0
- package/dist/controller/layoutRunOptions.js +17 -0
- package/dist/controller/layoutScheduler.d.ts +19 -14
- package/dist/controller/layoutScheduler.js +15 -12
- package/dist/controller/layoutSession.d.ts +26 -2
- package/dist/controller/layoutSession.js +1 -1
- package/dist/controller/noteEditorManager.js +8 -3
- package/dist/document-operations.d.ts +11 -2
- package/dist/document-operations.js +230 -21
- package/dist/docx/altChunk.d.ts +8 -0
- package/dist/docx/altChunk.js +17 -0
- package/dist/docx/archiveInflation.d.ts +127 -0
- package/dist/docx/archiveInflation.js +181 -0
- package/dist/docx/attributeRemainder.d.ts +1 -1
- package/dist/docx/blockContentParser.d.ts +64 -1
- package/dist/docx/blockContentParser.js +17 -4
- package/dist/docx/blockCustomXmlShell.d.ts +7 -0
- package/dist/docx/blockCustomXmlShell.js +14 -0
- package/dist/docx/blockPlainText.js +7 -0
- package/dist/docx/commentAnchorIndex.js +1 -1
- package/dist/docx/commentRangeIntegrity.js +8 -3
- package/dist/docx/commentReferenceNormalization.js +1 -1
- package/dist/docx/commentReplyMarkers.js +20 -1
- package/dist/docx/compatibility.d.ts +1 -1
- package/dist/docx/compatibility.js +34 -13
- package/dist/docx/containerChildren.gen.d.ts +1 -1
- package/dist/docx/containerChildren.gen.js +1 -0
- package/dist/docx/documentParser.js +12 -12
- package/dist/docx/drawingIdNormalization.d.ts +3 -1
- package/dist/docx/drawingIdNormalization.js +6 -1
- package/dist/docx/ensureParaIds.js +119 -97
- package/dist/docx/footnoteParser.js +8 -4
- package/dist/docx/headerFooterParser.js +3 -3
- package/dist/docx/headerFooterReferenceNormalization.d.ts +20 -1
- package/dist/docx/headerFooterReferenceNormalization.js +52 -27
- package/dist/docx/hyperlinkParser.d.ts +1 -1
- package/dist/docx/index.d.ts +1 -1
- package/dist/docx/listNumberingInstances.d.ts +59 -0
- package/dist/docx/listNumberingInstances.js +249 -0
- package/dist/docx/metadataPrivacy.js +24 -1
- package/dist/docx/normalizeBaseDirection.js +2 -1
- package/dist/docx/noteReferenceMark.d.ts +15 -0
- package/dist/docx/noteReferenceMark.js +48 -0
- package/dist/docx/opaqueCarrier.d.ts +7 -0
- package/dist/docx/opaqueCarrier.js +38 -0
- package/dist/docx/packageParts.js +4 -1
- package/dist/docx/paragraphParser.js +96 -27
- package/dist/docx/paragraphPropertySource.d.ts +4 -2
- package/dist/docx/paragraphPropertySource.js +10 -2
- package/dist/docx/paragraphTraversal.js +1 -0
- package/dist/docx/parseWarningMessage.js +4 -1
- package/dist/docx/parser.js +175 -22
- package/dist/docx/rezip.js +31 -7
- package/dist/docx/sdtProperties.js +1 -1
- package/dist/docx/sdtPropertiesPatch.js +3 -0
- package/dist/docx/selectiveSave.js +16 -9
- package/dist/docx/selectiveXmlPatch.d.ts +3 -1
- package/dist/docx/selectiveXmlPatch.js +186 -39
- package/dist/docx/serializer/blockCustomXmlSerializer.d.ts +5 -0
- package/dist/docx/serializer/blockCustomXmlSerializer.js +4 -0
- package/dist/docx/serializer/documentSerializer.js +2 -0
- package/dist/docx/serializer/headerFooterSerializer.js +2 -0
- package/dist/docx/serializer/noteSerializer.js +3 -1
- package/dist/docx/serializer/paragraphSerializer.js +33 -9
- package/dist/docx/serializer/tableSerializer.js +25 -38
- package/dist/docx/server/boundedArchive.d.ts +8 -13
- package/dist/docx/server/boundedArchive.js +70 -59
- package/dist/docx/server/createBilingualDocument.js +3 -3
- package/dist/docx/server/extractDocxText.d.ts +8 -2
- package/dist/docx/server/extractDocxText.js +2 -2
- package/dist/docx/server/validateDocxConformance.d.ts +1 -1
- package/dist/docx/server/validateDocxConformance.js +1 -0
- package/dist/docx/tableParser.d.ts +157 -1
- package/dist/docx/tableParser.js +89 -10
- package/dist/docx/textBoxParser.js +1 -1
- package/dist/docx/unzip.d.ts +20 -2
- package/dist/docx/unzip.js +136 -25
- package/dist/docx/wordprocessingPrefixes.d.ts +78 -0
- package/dist/docx/wordprocessingPrefixes.js +286 -0
- package/dist/fonts/embeddedFonts.js +1 -1
- package/dist/i18n/messages/catalogs.gen.d.ts +170 -34
- package/dist/i18n/messages/catalogs.gen.js +187 -51
- package/dist/i18n/messages/messages.gen.d.ts +10 -2
- package/dist/internal/compare/inline-presentation.d.ts +2 -1
- package/dist/internal/compare/inline-presentation.js +11 -10
- package/dist/internal/headlessRevisionResolutionGuard.d.ts +2 -8
- package/dist/internal/headlessRevisionResolutionGuard.js +2 -11
- package/dist/internal/indexedPositionMap.d.ts +11 -0
- package/dist/internal/indexedPositionMap.js +42 -0
- package/dist/internal/pageBreakRunSourceDescendantIndex.js +2 -1
- package/dist/internal/revisionResolutionEdits.d.ts +13 -0
- package/dist/internal/revisionResolutionEdits.js +19 -0
- package/dist/internal/revisionResolutionInline.d.ts +24 -0
- package/dist/internal/{headlessRevisionResolution.js → revisionResolutionInline.js} +61 -43
- package/dist/internal/revisionResolutionStep.d.ts +34 -0
- package/dist/internal/revisionResolutionStep.js +282 -0
- package/dist/internal/revisionResolutionTracking.d.ts +11 -0
- package/dist/internal/revisionResolutionTracking.js +124 -0
- package/dist/internal/wholeStoryRevisionResolution.d.ts +56 -0
- package/dist/internal/wholeStoryRevisionResolution.js +600 -0
- package/dist/layout-bridge/convert/markupViewFlow.d.ts +20 -0
- package/dist/layout-bridge/convert/markupViewFlow.js +123 -0
- package/dist/layout-bridge/convert/tableConversion.js +1 -1
- package/dist/layout-bridge/convert/toFlowBlocks.js +10 -1
- package/dist/layout-engine/layoutInstrumentation.d.ts +9 -1
- package/dist/layout-engine/layoutInstrumentation.js +4 -1
- package/dist/layout-engine/measure/cache.d.ts +18 -1
- package/dist/layout-engine/measure/cache.js +31 -1
- package/dist/layout-engine/measure/font-metrics.worker.js +3 -7
- package/dist/layout-engine/measure/measureContainer.js +7 -47
- package/dist/layout-engine/measure/measureHelpers.d.ts +6 -1
- package/dist/layout-engine/measure/measureHelpers.js +22 -2
- package/dist/layout-engine/measure/measureParagraph.js +2 -2
- package/dist/layout-engine/measure/measureWorker.js +2 -3
- package/dist/layout-engine/measure/measureWorkerProtocol.d.ts +6 -7
- package/dist/layout-engine/measure/measureWorkerProtocol.js +1 -2
- package/dist/layout-engine/measure/paragraphMeasureShared.d.ts +12 -1
- package/dist/layout-engine/measure/paragraphMeasureShared.js +14 -1
- package/dist/layout-engine/types.d.ts +6 -0
- package/dist/layout-painter/renderPage.js +1 -0
- package/dist/layout-painter/renderParagraph.js +1 -1
- package/dist/managers/ContextMenuManager.js +5 -2
- package/dist/managers/types.d.ts +3 -0
- package/dist/markdown/escape.d.ts +2 -2
- package/dist/markdown/escape.js +4 -5
- package/dist/markdown/fromMarkdown.js +2 -1
- package/dist/markdown/internals.d.ts +11 -1
- package/dist/markdown/internals.js +24 -3
- package/dist/markdown/renderBlock.js +121 -25
- package/dist/markdown/renderParagraph.d.ts +13 -1
- package/dist/markdown/renderParagraph.js +85 -38
- package/dist/markdown/renderRuns.d.ts +10 -1
- package/dist/markdown/renderRuns.js +323 -69
- package/dist/markdown/renderTable.js +24 -12
- package/dist/markdown/trailers.js +2 -2
- package/dist/markdown/types.d.ts +29 -7
- package/dist/paged-layout/incrementalMeasure.d.ts +1 -2
- package/dist/paged-layout/incrementalMeasure.js +1 -9
- package/dist/paged-layout/transactionDirtyRange.d.ts +1 -3
- package/dist/paged-layout/transactionDirtyRange.js +29 -41
- package/dist/panel-layout.d.ts +83 -0
- package/dist/panel-layout.js +96 -0
- package/dist/prosemirror/anchoredTextBoxes.d.ts +37 -0
- package/dist/prosemirror/anchoredTextBoxes.js +156 -0
- package/dist/prosemirror/attrs/index.d.ts +6 -2
- package/dist/prosemirror/attrs/index.js +172 -1
- package/dist/prosemirror/clearRunColor.d.ts +6 -0
- package/dist/prosemirror/clearRunColor.js +46 -0
- package/dist/prosemirror/commands/comments.d.ts +7 -8
- package/dist/prosemirror/commands/comments.js +281 -212
- package/dist/prosemirror/commands/contentControls.d.ts +1 -1
- package/dist/prosemirror/commands/formatPainter.d.ts +1 -1
- package/dist/prosemirror/commands/formatPainter.js +1 -1
- package/dist/prosemirror/commands/formatting.d.ts +1 -1
- package/dist/prosemirror/commands/hyperlink.js +2 -1
- package/dist/prosemirror/commands/index.d.ts +2 -2
- package/dist/prosemirror/commands/index.js +2 -2
- package/dist/prosemirror/commands/paragraph.d.ts +7 -1
- package/dist/prosemirror/commands/paragraph.js +9 -1
- package/dist/prosemirror/commands/paragraphBookmarkJoin.d.ts +13 -0
- package/dist/prosemirror/commands/paragraphBookmarkJoin.js +22 -0
- package/dist/prosemirror/commands/pastePlainText.d.ts +1 -1
- package/dist/prosemirror/commands/propertyChangeScope.d.ts +3 -2
- package/dist/prosemirror/commands/propertyChangeScope.js +24 -3
- package/dist/prosemirror/commands/resolveAllTableChanges.d.ts +40 -0
- package/dist/prosemirror/commands/resolveAllTableChanges.js +620 -0
- package/dist/prosemirror/commands/resolveNodePropertyChangeAttrs.d.ts +15 -0
- package/dist/prosemirror/commands/resolveNodePropertyChangeAttrs.js +46 -0
- package/dist/prosemirror/commands/resolveParagraphProperties.d.ts +16 -0
- package/dist/prosemirror/commands/resolveParagraphProperties.js +73 -0
- package/dist/prosemirror/commands/sectionBreak.js +2 -1
- package/dist/prosemirror/commands/tableCellMergeResolution.d.ts +15 -2
- package/dist/prosemirror/commands/tableCellMergeResolution.js +23 -7
- package/dist/prosemirror/containerFinalParagraph.d.ts +11 -5
- package/dist/prosemirror/containerFinalParagraph.js +7 -6
- package/dist/prosemirror/contentControlRevisions.d.ts +1 -1
- package/dist/prosemirror/conversion/fromProseDoc.d.ts +2 -13
- package/dist/prosemirror/conversion/fromProseDoc.js +177 -605
- package/dist/prosemirror/conversion/toProseDoc.d.ts +4 -11
- package/dist/prosemirror/conversion/toProseDoc.js +70 -154
- package/dist/prosemirror/documentSchema.d.ts +8 -0
- package/dist/prosemirror/documentSchema.js +18 -0
- package/dist/prosemirror/emptyFieldResultRuns.d.ts +18 -0
- package/dist/prosemirror/emptyFieldResultRuns.js +33 -0
- package/dist/prosemirror/extensions/ExtensionManager.d.ts +1 -1
- package/dist/prosemirror/extensions/ExtensionManager.js +3 -1
- package/dist/prosemirror/extensions/StarterKit.js +5 -1
- package/dist/prosemirror/extensions/core/DocExtension.js +1 -1
- package/dist/prosemirror/extensions/core/ParagraphExtension.js +116 -63
- package/dist/prosemirror/extensions/features/BaseKeymapExtension.js +4 -1
- package/dist/prosemirror/extensions/features/EmptyParagraphFormatExtension.js +24 -3
- package/dist/prosemirror/extensions/features/JoinedRunStyleExtension.d.ts +20 -0
- package/dist/prosemirror/extensions/features/JoinedRunStyleExtension.js +43 -0
- package/dist/prosemirror/extensions/features/ListExtension.js +167 -128
- package/dist/prosemirror/extensions/features/ParaIdAllocatorExtension.d.ts +19 -2
- package/dist/prosemirror/extensions/features/ParaIdAllocatorExtension.js +33 -20
- package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.d.ts +31 -2
- package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.js +270 -99
- package/dist/prosemirror/extensions/features/PasteCleanupExtension.js +3 -2
- package/dist/prosemirror/extensions/features/pasteCleanup.js +2 -1
- package/dist/prosemirror/extensions/features/pastedHeadingStyles.js +1 -1
- package/dist/prosemirror/extensions/features/pastedHtmlLists.d.ts +12 -0
- package/dist/prosemirror/extensions/features/pastedHtmlLists.js +124 -0
- package/dist/prosemirror/extensions/marks/FootnoteRefExtension.js +33 -11
- package/dist/prosemirror/extensions/marks/HyperlinkExtension.js +8 -4
- package/dist/prosemirror/extensions/marks/RunIdentityExtension.d.ts +21 -18
- package/dist/prosemirror/extensions/marks/RunIdentityExtension.js +37 -17
- package/dist/prosemirror/extensions/marks/StrikeExtension.js +2 -2
- package/dist/prosemirror/extensions/marks/SubscriptExtension.js +2 -2
- package/dist/prosemirror/extensions/marks/SuperscriptExtension.js +2 -2
- package/dist/prosemirror/extensions/marks/TextColorExtension.js +4 -3
- package/dist/prosemirror/extensions/marks/markUtils.d.ts +15 -8
- package/dist/prosemirror/extensions/marks/markUtils.js +25 -10
- package/dist/prosemirror/extensions/marks/noteReferenceDeletion.d.ts +12 -0
- package/dist/prosemirror/extensions/marks/noteReferenceDeletion.js +46 -0
- package/dist/prosemirror/extensions/nodes/BlockCustomXmlExtension.d.ts +6 -0
- package/dist/prosemirror/extensions/nodes/BlockCustomXmlExtension.js +52 -0
- package/dist/prosemirror/extensions/nodes/CommentReferenceExtension.js +2 -2
- package/dist/prosemirror/extensions/nodes/FieldExtension.d.ts +3 -3
- package/dist/prosemirror/extensions/nodes/FieldExtension.js +50 -15
- package/dist/prosemirror/extensions/nodes/HardBreakExtension.js +5 -3
- package/dist/prosemirror/extensions/nodes/PreservedBlockExtension.js +4 -1
- package/dist/prosemirror/extensions/nodes/TableExtension.d.ts +1 -1
- package/dist/prosemirror/extensions/nodes/TableExtension.js +121 -226
- package/dist/prosemirror/extensions/types.d.ts +11 -1
- package/dist/prosemirror/findReplaceSelection.js +1 -1
- package/dist/prosemirror/hyperlinkRemoval.d.ts +9 -0
- package/dist/prosemirror/hyperlinkRemoval.js +129 -0
- package/dist/prosemirror/index.d.ts +5 -3
- package/dist/prosemirror/index.js +5 -3
- package/dist/prosemirror/indexedNodeLookup.d.ts +17 -0
- package/dist/prosemirror/indexedNodeLookup.js +103 -0
- package/dist/prosemirror/listAutoformatMarkers.d.ts +19 -0
- package/dist/prosemirror/listAutoformatMarkers.js +98 -0
- package/dist/prosemirror/listInstanceReferences.d.ts +12 -0
- package/dist/prosemirror/listInstanceReferences.js +72 -0
- package/dist/prosemirror/listLabels.d.ts +24 -0
- package/dist/prosemirror/listLabels.js +111 -0
- package/dist/prosemirror/listNumbering.d.ts +92 -0
- package/dist/prosemirror/listNumbering.js +330 -0
- package/dist/prosemirror/listRendering.d.ts +27 -0
- package/dist/prosemirror/listRendering.js +27 -0
- package/dist/prosemirror/listRenderingAttrs.d.ts +11 -2
- package/dist/prosemirror/listRenderingAttrs.js +8 -1
- package/dist/prosemirror/markupViewNotes.d.ts +8 -0
- package/dist/prosemirror/markupViewNotes.js +49 -0
- package/dist/prosemirror/markupViewProjection.d.ts +97 -0
- package/dist/prosemirror/markupViewProjection.js +88 -0
- package/dist/prosemirror/noteReferenceReview.d.ts +77 -0
- package/dist/prosemirror/noteReferenceReview.js +332 -0
- package/dist/prosemirror/numberingAttr.d.ts +9 -1
- package/dist/prosemirror/numberingAttr.js +9 -1
- package/dist/prosemirror/outlineLevelAttr.js +1 -1
- package/dist/prosemirror/paragraphIndentation.d.ts +10 -1
- package/dist/prosemirror/paragraphIndentation.js +32 -7
- package/dist/prosemirror/paragraphMarkJoin.d.ts +21 -0
- package/dist/prosemirror/paragraphMarkJoin.js +26 -0
- package/dist/prosemirror/paragraphPropertyCarry.d.ts +64 -0
- package/dist/prosemirror/paragraphPropertyCarry.js +158 -0
- package/dist/prosemirror/plugins/createDocScanPlugin.d.ts +1 -1
- package/dist/prosemirror/plugins/documentNumbering.d.ts +27 -1
- package/dist/prosemirror/plugins/documentNumbering.js +97 -11
- package/dist/prosemirror/plugins/documentStyleState.d.ts +26 -0
- package/dist/prosemirror/plugins/documentStyleState.js +32 -0
- package/dist/prosemirror/plugins/documentStyles.d.ts +3 -13
- package/dist/prosemirror/plugins/documentStyles.js +67 -17
- package/dist/prosemirror/plugins/index.d.ts +2 -1
- package/dist/prosemirror/plugins/index.js +2 -1
- package/dist/prosemirror/plugins/paragraphStyleResolution.d.ts +15 -0
- package/dist/prosemirror/plugins/paragraphStyleResolution.js +230 -0
- package/dist/prosemirror/plugins/suggestionMode.d.ts +27 -3
- package/dist/prosemirror/plugins/suggestionMode.js +490 -63
- package/dist/prosemirror/plugins/templateDirectives.d.ts +1 -1
- package/dist/prosemirror/plugins/transactionInvariants.d.ts +32 -0
- package/dist/prosemirror/plugins/transactionInvariants.js +86 -0
- package/dist/prosemirror/positionSweep.d.ts +24 -0
- package/dist/prosemirror/positionSweep.js +222 -0
- package/dist/prosemirror/rebaseParagraphRunFormatting.d.ts +23 -3
- package/dist/prosemirror/rebaseParagraphRunFormatting.js +39 -13
- package/dist/prosemirror/rebaseParagraphRuns.d.ts +36 -0
- package/dist/prosemirror/rebaseParagraphRuns.js +99 -0
- package/dist/prosemirror/rejoinRunCarriers.d.ts +1 -1
- package/dist/prosemirror/replacedAnnotations.d.ts +33 -1
- package/dist/prosemirror/replacedAnnotations.js +170 -1
- package/dist/prosemirror/runFormattingFromMarks.d.ts +18 -0
- package/dist/prosemirror/runFormattingFromMarks.js +567 -0
- package/dist/prosemirror/runFormattingInlineCarriers.d.ts +1 -1
- package/dist/prosemirror/runFormattingReconciliation.js +10 -9
- package/dist/prosemirror/schema/index.d.ts +2 -2
- package/dist/prosemirror/schema/index.js +3 -0
- package/dist/prosemirror/schema/nodes.d.ts +44 -11
- package/dist/prosemirror/sectionMarkEdits.d.ts +20 -0
- package/dist/prosemirror/sectionMarkEdits.js +59 -0
- package/dist/prosemirror/storyListNumbering.d.ts +17 -0
- package/dist/prosemirror/storyListNumbering.js +102 -0
- package/dist/prosemirror/styles/paragraphStyleCascade.d.ts +59 -0
- package/dist/prosemirror/styles/paragraphStyleCascade.js +145 -0
- package/dist/prosemirror/styles/resolvedStyleAttrs.d.ts +21 -2
- package/dist/prosemirror/styles/resolvedStyleAttrs.js +38 -1
- package/dist/prosemirror/styles/tableStyleRegions.d.ts +31 -0
- package/dist/prosemirror/styles/tableStyleRegions.js +55 -0
- package/dist/prosemirror/tableCellPaste.d.ts +74 -0
- package/dist/prosemirror/tableCellPaste.js +525 -0
- package/dist/prosemirror/tableGridMutation.d.ts +87 -2
- package/dist/prosemirror/tableGridMutation.js +255 -2
- package/dist/prosemirror/tableRunIn.d.ts +51 -0
- package/dist/prosemirror/tableRunIn.js +165 -0
- package/dist/prosemirror/textInput.js +11 -2
- package/dist/prosemirror/trackedRevisionPath.d.ts +17 -0
- package/dist/prosemirror/trackedRevisionPath.js +32 -0
- package/dist/prosemirror/validation.js +5 -1
- package/dist/redline.js +93 -9
- package/dist/render-dom/BodySelectionOverlay.d.ts +4 -1
- package/dist/render-dom/BodySelectionOverlay.js +3 -2
- package/dist/server.d.ts +2 -2
- package/dist/utils/findReplace.js +2 -2
- package/dist/utils/mergeDocumentContent.js +1 -1
- package/dist/utils/noteReferenceLabels.d.ts +36 -0
- package/dist/utils/noteReferenceLabels.js +32 -0
- package/dist/utils/replaceText.js +1 -1
- package/dist/version-comparison.d.ts +1 -0
- package/dist/version-comparison.js +1 -0
- package/package.json +6 -5
- package/dist/internal/headlessRevisionResolution.d.ts +0 -23
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
import { indexedPositionMap } from "./indexedPositionMap.js";
|
|
2
|
+
import { panic } from "better-result";
|
|
3
|
+
import { Step, StepMap, StepResult } from "prosemirror-transform";
|
|
4
|
+
//#region src/internal/revisionResolutionStep.ts
|
|
5
|
+
const mapThrough = (position, assoc, maps) => {
|
|
6
|
+
let mapped = position;
|
|
7
|
+
let deleted = false;
|
|
8
|
+
let deletedBefore = false;
|
|
9
|
+
let deletedAfter = false;
|
|
10
|
+
let deletedAcross = false;
|
|
11
|
+
for (const map of maps) {
|
|
12
|
+
const result = map.mapResult(mapped, assoc);
|
|
13
|
+
mapped = result.pos;
|
|
14
|
+
deleted ||= result.deleted;
|
|
15
|
+
deletedBefore ||= result.deletedBefore;
|
|
16
|
+
deletedAfter ||= result.deletedAfter;
|
|
17
|
+
deletedAcross ||= result.deletedAcross;
|
|
18
|
+
}
|
|
19
|
+
return {
|
|
20
|
+
pos: mapped,
|
|
21
|
+
deleted,
|
|
22
|
+
deletedBefore,
|
|
23
|
+
deletedAfter,
|
|
24
|
+
deletedAcross
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
const chainedMap = (maps) => ({
|
|
28
|
+
map: (position, assoc = 1) => mapThrough(position, assoc, maps).pos,
|
|
29
|
+
mapResult: (position, assoc = 1) => mapThrough(position, assoc, maps)
|
|
30
|
+
});
|
|
31
|
+
const replaySteps = (doc, steps) => {
|
|
32
|
+
let current = doc;
|
|
33
|
+
for (const step of steps) {
|
|
34
|
+
const result = step.apply(current);
|
|
35
|
+
if (!result.doc) return result;
|
|
36
|
+
current = result.doc;
|
|
37
|
+
}
|
|
38
|
+
return StepResult.ok(current);
|
|
39
|
+
};
|
|
40
|
+
const isValidMapRanges = (value) => {
|
|
41
|
+
if (!Array.isArray(value) || value.length % 3 !== 0) return false;
|
|
42
|
+
let previousEnd = 0;
|
|
43
|
+
let delta = 0;
|
|
44
|
+
for (let index = 0; index < value.length; index += 3) {
|
|
45
|
+
const start = value.at(index);
|
|
46
|
+
const oldSize = value.at(index + 1);
|
|
47
|
+
const newSize = value.at(index + 2);
|
|
48
|
+
if (!Number.isSafeInteger(start) || !Number.isSafeInteger(oldSize) || !Number.isSafeInteger(newSize) || start < previousEnd || oldSize < 0 || newSize < 0) return false;
|
|
49
|
+
const oldEnd = start + oldSize;
|
|
50
|
+
const newStart = start + delta;
|
|
51
|
+
const newEnd = newStart + newSize;
|
|
52
|
+
if (!Number.isSafeInteger(oldEnd) || !Number.isSafeInteger(newStart) || !Number.isSafeInteger(newEnd) || !Number.isSafeInteger(newEnd - oldEnd) || newStart < 0) return false;
|
|
53
|
+
previousEnd = oldEnd;
|
|
54
|
+
delta = newEnd - oldEnd;
|
|
55
|
+
}
|
|
56
|
+
return true;
|
|
57
|
+
};
|
|
58
|
+
const indexedStepMapResult = (map) => {
|
|
59
|
+
const changes = [];
|
|
60
|
+
map.forEach((oldStart, oldEnd, newStart, newEnd) => {
|
|
61
|
+
changes.push({
|
|
62
|
+
oldStart,
|
|
63
|
+
oldEnd,
|
|
64
|
+
newStart,
|
|
65
|
+
newEnd
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
return (position, assoc) => {
|
|
69
|
+
let low = 0;
|
|
70
|
+
let high = changes.length;
|
|
71
|
+
while (low < high) {
|
|
72
|
+
const middle = Math.floor((low + high) / 2);
|
|
73
|
+
const change = changes[middle];
|
|
74
|
+
if (change && change.oldEnd < position) low = middle + 1;
|
|
75
|
+
else high = middle;
|
|
76
|
+
}
|
|
77
|
+
const change = changes[low];
|
|
78
|
+
if (change && change.oldStart <= position) {
|
|
79
|
+
const oldSize = change.oldEnd - change.oldStart;
|
|
80
|
+
let side = assoc;
|
|
81
|
+
if (oldSize > 0 && position === change.oldStart) side = -1;
|
|
82
|
+
else if (oldSize > 0 && position === change.oldEnd) side = 1;
|
|
83
|
+
return {
|
|
84
|
+
pos: side < 0 ? change.newStart : change.newEnd,
|
|
85
|
+
deleted: assoc < 0 ? position !== change.oldStart : position !== change.oldEnd
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
const previous = changes[low - 1];
|
|
89
|
+
return {
|
|
90
|
+
pos: position + (previous ? previous.newEnd - previous.oldEnd : 0),
|
|
91
|
+
deleted: false
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
/** Compose by retaining precisely the source positions that survive both maps. */
|
|
96
|
+
const composeRevisionResolutionMaps = (first, second) => {
|
|
97
|
+
const firstResult = indexedStepMapResult(first);
|
|
98
|
+
const secondResult = indexedStepMapResult(second);
|
|
99
|
+
const inverseFirst = indexedPositionMap(first.invert());
|
|
100
|
+
const firstBreakpoints = [0];
|
|
101
|
+
const secondBreakpoints = [];
|
|
102
|
+
let lastSecondBoundary;
|
|
103
|
+
const projectSecondBoundary = (position) => {
|
|
104
|
+
if (position === lastSecondBoundary) return;
|
|
105
|
+
secondBreakpoints.push(inverseFirst(position, -1), inverseFirst(position, 1));
|
|
106
|
+
lastSecondBoundary = position;
|
|
107
|
+
};
|
|
108
|
+
first.forEach((oldStart, oldEnd) => {
|
|
109
|
+
firstBreakpoints.push(oldStart, oldEnd);
|
|
110
|
+
});
|
|
111
|
+
second.forEach((oldStart, oldEnd) => {
|
|
112
|
+
projectSecondBoundary(oldStart);
|
|
113
|
+
projectSecondBoundary(oldEnd);
|
|
114
|
+
});
|
|
115
|
+
const breakpoints = [];
|
|
116
|
+
let firstIndex = 0;
|
|
117
|
+
let secondIndex = 0;
|
|
118
|
+
while (firstIndex < firstBreakpoints.length || secondIndex < secondBreakpoints.length) {
|
|
119
|
+
const firstPosition = firstBreakpoints[firstIndex];
|
|
120
|
+
const secondPosition = secondBreakpoints[secondIndex];
|
|
121
|
+
const takeFirst = secondPosition === void 0 || firstPosition !== void 0 && firstPosition <= secondPosition;
|
|
122
|
+
const position = takeFirst ? firstPosition : secondPosition;
|
|
123
|
+
if (takeFirst) firstIndex++;
|
|
124
|
+
else secondIndex++;
|
|
125
|
+
if (position !== void 0 && breakpoints.at(-1) !== position) breakpoints.push(position);
|
|
126
|
+
}
|
|
127
|
+
const through = (position, assoc) => {
|
|
128
|
+
const earlier = firstResult(position, assoc);
|
|
129
|
+
const later = secondResult(earlier.pos, assoc);
|
|
130
|
+
return {
|
|
131
|
+
pos: later.pos,
|
|
132
|
+
deleted: earlier.deleted || later.deleted
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
const ranges = [];
|
|
136
|
+
let oldEnd = 0;
|
|
137
|
+
let newEnd = 0;
|
|
138
|
+
const anchor = (position, mapped) => {
|
|
139
|
+
if (position > oldEnd || mapped > newEnd) ranges.push(oldEnd, position - oldEnd, mapped - newEnd);
|
|
140
|
+
oldEnd = position;
|
|
141
|
+
newEnd = mapped;
|
|
142
|
+
};
|
|
143
|
+
for (let index = 0; index < breakpoints.length; index++) {
|
|
144
|
+
const position = breakpoints[index];
|
|
145
|
+
if (position === void 0) continue;
|
|
146
|
+
const left = through(position, -1);
|
|
147
|
+
const right = through(position, 1);
|
|
148
|
+
if (!left.deleted && !right.deleted) {
|
|
149
|
+
anchor(position, Math.min(left.pos, right.pos));
|
|
150
|
+
anchor(position, Math.max(left.pos, right.pos));
|
|
151
|
+
} else if (!left.deleted) anchor(position, left.pos);
|
|
152
|
+
else if (!right.deleted) anchor(position, right.pos);
|
|
153
|
+
const next = breakpoints[index + 1];
|
|
154
|
+
if (next === void 0) break;
|
|
155
|
+
const middle = (position + next) / 2;
|
|
156
|
+
const surviving = through(middle, 1);
|
|
157
|
+
if (!surviving.deleted) {
|
|
158
|
+
const offset = surviving.pos - middle;
|
|
159
|
+
anchor(position, position + offset);
|
|
160
|
+
oldEnd = next;
|
|
161
|
+
newEnd = next + offset;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
return new StepMap(ranges);
|
|
165
|
+
};
|
|
166
|
+
/** One transaction step for a bulk resolution, with a granular position map. */
|
|
167
|
+
var RevisionResolutionStep = class RevisionResolutionStep extends Step {
|
|
168
|
+
materializedSteps;
|
|
169
|
+
beforeDoc;
|
|
170
|
+
afterDoc;
|
|
171
|
+
positionMap;
|
|
172
|
+
deferredInverse;
|
|
173
|
+
constructor({ beforeDoc, afterDoc, steps, positionMap, deferredInverse }) {
|
|
174
|
+
super();
|
|
175
|
+
this.beforeDoc = beforeDoc;
|
|
176
|
+
this.afterDoc = afterDoc;
|
|
177
|
+
this.positionMap = positionMap;
|
|
178
|
+
this.deferredInverse = deferredInverse ?? null;
|
|
179
|
+
this.materializedSteps = deferredInverse ? null : steps;
|
|
180
|
+
}
|
|
181
|
+
steps() {
|
|
182
|
+
if (this.materializedSteps) return this.materializedSteps;
|
|
183
|
+
const deferred = this.deferredInverse;
|
|
184
|
+
if (!deferred) return panic("Revision resolution has no inverse steps");
|
|
185
|
+
let doc = deferred.doc;
|
|
186
|
+
const inverse = [];
|
|
187
|
+
for (const step of deferred.steps) {
|
|
188
|
+
inverse.push(step.invert(doc));
|
|
189
|
+
const result = step.apply(doc);
|
|
190
|
+
if (!result.doc) return panic(result.failed ?? "Revision resolution cannot invert a failed step");
|
|
191
|
+
doc = result.doc;
|
|
192
|
+
}
|
|
193
|
+
this.materializedSteps = inverse.reverse();
|
|
194
|
+
return inverse;
|
|
195
|
+
}
|
|
196
|
+
apply(doc) {
|
|
197
|
+
if (doc === this.beforeDoc && this.afterDoc) return StepResult.ok(this.afterDoc);
|
|
198
|
+
return replaySteps(doc, this.steps());
|
|
199
|
+
}
|
|
200
|
+
getMap() {
|
|
201
|
+
return this.positionMap;
|
|
202
|
+
}
|
|
203
|
+
invert(doc) {
|
|
204
|
+
if (doc === this.beforeDoc && this.afterDoc) return new RevisionResolutionStep({
|
|
205
|
+
beforeDoc: this.afterDoc,
|
|
206
|
+
afterDoc: doc,
|
|
207
|
+
steps: [],
|
|
208
|
+
positionMap: this.positionMap.invert(),
|
|
209
|
+
deferredInverse: {
|
|
210
|
+
doc,
|
|
211
|
+
steps: this.steps()
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
let current = doc;
|
|
215
|
+
const inverse = [];
|
|
216
|
+
for (const step of this.steps()) {
|
|
217
|
+
inverse.push(step.invert(current));
|
|
218
|
+
const result = step.apply(current);
|
|
219
|
+
if (!result.doc) return panic(result.failed ?? "Revision resolution cannot invert a failed step");
|
|
220
|
+
current = result.doc;
|
|
221
|
+
}
|
|
222
|
+
return new RevisionResolutionStep({
|
|
223
|
+
beforeDoc: current,
|
|
224
|
+
afterDoc: doc,
|
|
225
|
+
steps: inverse.reverse(),
|
|
226
|
+
positionMap: this.positionMap.invert()
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
map(mapping) {
|
|
230
|
+
const original = this.steps();
|
|
231
|
+
const mapped = [];
|
|
232
|
+
const inverseOriginalMaps = [];
|
|
233
|
+
const mappedMaps = [];
|
|
234
|
+
for (const step of original) {
|
|
235
|
+
const through = chainedMap([
|
|
236
|
+
...inverseOriginalMaps.toReversed(),
|
|
237
|
+
mapping,
|
|
238
|
+
...mappedMaps
|
|
239
|
+
]);
|
|
240
|
+
const rebased = step.map(through);
|
|
241
|
+
if (rebased) {
|
|
242
|
+
mapped.push(rebased);
|
|
243
|
+
mappedMaps.push(rebased.getMap());
|
|
244
|
+
}
|
|
245
|
+
inverseOriginalMaps.push(step.getMap().invert());
|
|
246
|
+
}
|
|
247
|
+
if (mapped.length === 0) return null;
|
|
248
|
+
let positionMap = StepMap.empty;
|
|
249
|
+
for (const step of mapped) positionMap = composeRevisionResolutionMaps(positionMap, step.getMap());
|
|
250
|
+
return new RevisionResolutionStep({
|
|
251
|
+
beforeDoc: null,
|
|
252
|
+
afterDoc: null,
|
|
253
|
+
steps: mapped,
|
|
254
|
+
positionMap
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
toJSON() {
|
|
258
|
+
const mapRanges = [];
|
|
259
|
+
this.positionMap.forEach((oldStart, oldEnd, newStart, newEnd) => {
|
|
260
|
+
mapRanges.push(oldStart, oldEnd - oldStart, newEnd - newStart);
|
|
261
|
+
});
|
|
262
|
+
return {
|
|
263
|
+
stepType: "folioRevisionResolution",
|
|
264
|
+
steps: this.steps().map((step) => step.toJSON()),
|
|
265
|
+
mapRanges
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
static fromJSON(schema, json) {
|
|
269
|
+
if (typeof json !== "object" || json === null || !("steps" in json) || !("mapRanges" in json)) throw new RangeError("Invalid revision resolution step JSON");
|
|
270
|
+
const { steps, mapRanges } = json;
|
|
271
|
+
if (!Array.isArray(steps) || !isValidMapRanges(mapRanges)) throw new RangeError("Invalid revision resolution step JSON");
|
|
272
|
+
return new RevisionResolutionStep({
|
|
273
|
+
beforeDoc: null,
|
|
274
|
+
afterDoc: null,
|
|
275
|
+
steps: steps.map((step) => Step.fromJSON(schema, step)),
|
|
276
|
+
positionMap: new StepMap(mapRanges)
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
Step.jsonID("folioRevisionResolution", RevisionResolutionStep);
|
|
281
|
+
//#endregion
|
|
282
|
+
export { RevisionResolutionStep, composeRevisionResolutionMaps };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { resolveWholeStory } from "./wholeStoryRevisionResolution.js";
|
|
2
|
+
//#region src/internal/revisionResolutionTracking.d.ts
|
|
3
|
+
type Resolution = ReturnType<typeof resolveWholeStory>;
|
|
4
|
+
type Range = {
|
|
5
|
+
from: number;
|
|
6
|
+
to: number;
|
|
7
|
+
};
|
|
8
|
+
/** Map the three resolution phases to precise ranges in the finished story. */
|
|
9
|
+
declare const finalRevisionParagraphRanges: (result: Resolution) => Range[];
|
|
10
|
+
//#endregion
|
|
11
|
+
export { finalRevisionParagraphRanges };
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { indexedPositionMap } from "./indexedPositionMap.js";
|
|
2
|
+
import { panic } from "better-result";
|
|
3
|
+
//#region src/internal/revisionResolutionTracking.ts
|
|
4
|
+
const paragraphSizes = (table) => {
|
|
5
|
+
const sizes = /* @__PURE__ */ new Map();
|
|
6
|
+
table.descendants((node, position) => {
|
|
7
|
+
if (node.type.name === "table") return false;
|
|
8
|
+
if (node.type.name === "paragraph") {
|
|
9
|
+
sizes.set(position + 1, node.nodeSize);
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
return true;
|
|
13
|
+
});
|
|
14
|
+
return sizes;
|
|
15
|
+
};
|
|
16
|
+
/** Map the three resolution phases to precise ranges in the finished story. */
|
|
17
|
+
const finalRevisionParagraphRanges = (result) => {
|
|
18
|
+
const tableNodes = new Set(result.tableRanges.map(({ node }) => node));
|
|
19
|
+
const finalTablePositions = /* @__PURE__ */ new Map();
|
|
20
|
+
result.resolved.descendants((node, position) => {
|
|
21
|
+
if (tableNodes.has(node)) finalTablePositions.set(node, position);
|
|
22
|
+
return true;
|
|
23
|
+
});
|
|
24
|
+
const tables = result.tableRanges.map((table) => {
|
|
25
|
+
const finalPosition = finalTablePositions.get(table.node) ?? null;
|
|
26
|
+
const sourceSizes = paragraphSizes(table.inputNode);
|
|
27
|
+
const finalSizes = finalPosition === null ? /* @__PURE__ */ new Map() : paragraphSizes(table.node);
|
|
28
|
+
const paragraphs = table.paragraphOffsets.map(({ source, final }) => {
|
|
29
|
+
const sourceSize = sourceSizes.get(source);
|
|
30
|
+
const finalSize = finalSizes.get(final);
|
|
31
|
+
if (sourceSize === void 0 || finalPosition !== null && finalSize === void 0) return panic("Resolved table paragraph offsets are inconsistent");
|
|
32
|
+
return {
|
|
33
|
+
source,
|
|
34
|
+
sourceEnd: source + sourceSize,
|
|
35
|
+
final,
|
|
36
|
+
finalEnd: final + (finalSize ?? 0)
|
|
37
|
+
};
|
|
38
|
+
});
|
|
39
|
+
paragraphs.sort((left, right) => left.source - right.source);
|
|
40
|
+
return {
|
|
41
|
+
...table,
|
|
42
|
+
finalPosition,
|
|
43
|
+
parent: null,
|
|
44
|
+
paragraphs,
|
|
45
|
+
mapInput: indexedPositionMap(table.inputMap)
|
|
46
|
+
};
|
|
47
|
+
}).sort((left, right) => left.position - right.position || right.sourceNodeSize - left.sourceNodeSize);
|
|
48
|
+
const tableStack = [];
|
|
49
|
+
for (const table of tables) {
|
|
50
|
+
for (;;) {
|
|
51
|
+
const enclosing = tableStack.at(-1);
|
|
52
|
+
if (!enclosing || table.position < enclosing.position + enclosing.sourceNodeSize) break;
|
|
53
|
+
tableStack.pop();
|
|
54
|
+
}
|
|
55
|
+
table.parent = tableStack.at(-1) ?? null;
|
|
56
|
+
tableStack.push(table);
|
|
57
|
+
}
|
|
58
|
+
const mapInline = indexedPositionMap(result.inlineMap);
|
|
59
|
+
const mapStructure = indexedPositionMap(result.structuralMap);
|
|
60
|
+
const finalRanges = [];
|
|
61
|
+
const tableContaining = (range) => {
|
|
62
|
+
let low = 0;
|
|
63
|
+
let high = tables.length;
|
|
64
|
+
while (low < high) {
|
|
65
|
+
const middle = Math.floor((low + high) / 2);
|
|
66
|
+
const candidate = tables.at(middle);
|
|
67
|
+
if (candidate && candidate.position <= range.from) low = middle + 1;
|
|
68
|
+
else high = middle;
|
|
69
|
+
}
|
|
70
|
+
let table = low === 0 ? null : tables.at(low - 1) ?? null;
|
|
71
|
+
while (table && range.to > table.position + table.sourceNodeSize) table = table.parent;
|
|
72
|
+
return table;
|
|
73
|
+
};
|
|
74
|
+
const mapAfterInlineRange = ({ from, to }) => {
|
|
75
|
+
if (to <= from) return;
|
|
76
|
+
const owningTable = tableContaining({
|
|
77
|
+
from,
|
|
78
|
+
to
|
|
79
|
+
});
|
|
80
|
+
if (owningTable) {
|
|
81
|
+
if (owningTable.finalPosition === null) return;
|
|
82
|
+
const relativeFrom = owningTable.mapInput(from - owningTable.position, 1);
|
|
83
|
+
const relativeTo = owningTable.mapInput(to - owningTable.position, -1);
|
|
84
|
+
let low = 0;
|
|
85
|
+
let high = owningTable.paragraphs.length;
|
|
86
|
+
while (low < high) {
|
|
87
|
+
const middle = Math.floor((low + high) / 2);
|
|
88
|
+
const candidate = owningTable.paragraphs.at(middle);
|
|
89
|
+
if (candidate && candidate.sourceEnd <= relativeFrom) low = middle + 1;
|
|
90
|
+
else high = middle;
|
|
91
|
+
}
|
|
92
|
+
for (let index = low; index < owningTable.paragraphs.length; index++) {
|
|
93
|
+
const paragraph = owningTable.paragraphs.at(index);
|
|
94
|
+
if (!paragraph || paragraph.source >= relativeTo) break;
|
|
95
|
+
finalRanges.push({
|
|
96
|
+
from: owningTable.finalPosition + paragraph.final,
|
|
97
|
+
to: owningTable.finalPosition + paragraph.finalEnd
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
const finalFrom = mapStructure(from, 1);
|
|
103
|
+
const finalTo = mapStructure(to, -1);
|
|
104
|
+
if (finalTo > finalFrom) finalRanges.push({
|
|
105
|
+
from: finalFrom,
|
|
106
|
+
to: finalTo
|
|
107
|
+
});
|
|
108
|
+
};
|
|
109
|
+
for (const range of result.changedRanges) mapAfterInlineRange({
|
|
110
|
+
from: mapInline(range.from, 1),
|
|
111
|
+
to: mapInline(range.to, -1)
|
|
112
|
+
});
|
|
113
|
+
for (const range of result.structuralRanges) mapAfterInlineRange(range);
|
|
114
|
+
for (const table of tables) {
|
|
115
|
+
if (table.finalPosition === null) continue;
|
|
116
|
+
for (const range of table.ranges) finalRanges.push({
|
|
117
|
+
from: table.finalPosition + range.from,
|
|
118
|
+
to: table.finalPosition + range.to
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
return finalRanges;
|
|
122
|
+
};
|
|
123
|
+
//#endregion
|
|
124
|
+
export { finalRevisionParagraphRanges };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { RunStyleResolver } from "../prosemirror/runStyleFormatting.js";
|
|
2
|
+
import { NumberingMap } from "../docx/numberingParser.js";
|
|
3
|
+
import { RemovedSectionReference } from "./sectionEndpointResolution.js";
|
|
4
|
+
import { RevisionResolutionMode } from "./revisionResolutionInline.js";
|
|
5
|
+
import { Node } from "prosemirror-model";
|
|
6
|
+
import { Mapping, Step, StepMap } from "prosemirror-transform";
|
|
7
|
+
//#region src/internal/wholeStoryRevisionResolution.d.ts
|
|
8
|
+
/** Resolve a story in linear passes, without rebuilding its root per revision. */
|
|
9
|
+
type ResolveWholeStoryOptions = {
|
|
10
|
+
doc: Node;
|
|
11
|
+
mode: RevisionResolutionMode;
|
|
12
|
+
styleResolver: RunStyleResolver | null;
|
|
13
|
+
numbering: NumberingMap | null;
|
|
14
|
+
};
|
|
15
|
+
declare const resolveWholeStory: ({ doc, mode, styleResolver, numbering }: ResolveWholeStoryOptions) => {
|
|
16
|
+
resolved: Node;
|
|
17
|
+
mapping: Mapping;
|
|
18
|
+
positionMap: StepMap;
|
|
19
|
+
steps: Step[];
|
|
20
|
+
changedRanges: {
|
|
21
|
+
from: number;
|
|
22
|
+
to: number;
|
|
23
|
+
}[];
|
|
24
|
+
inlineMap: StepMap;
|
|
25
|
+
tableRanges: {
|
|
26
|
+
node: Node;
|
|
27
|
+
inputNode: Node;
|
|
28
|
+
sourceNodeSize: number;
|
|
29
|
+
position: number;
|
|
30
|
+
inputMap: StepMap;
|
|
31
|
+
positionMap: StepMap;
|
|
32
|
+
ranges: readonly {
|
|
33
|
+
from: number;
|
|
34
|
+
to: number;
|
|
35
|
+
}[];
|
|
36
|
+
paragraphOffsets: readonly {
|
|
37
|
+
source: number;
|
|
38
|
+
final: number;
|
|
39
|
+
}[];
|
|
40
|
+
}[];
|
|
41
|
+
transfers: {
|
|
42
|
+
displacedToken: string | null;
|
|
43
|
+
selectedToken: string | null;
|
|
44
|
+
}[];
|
|
45
|
+
structuralRanges: {
|
|
46
|
+
from: number;
|
|
47
|
+
to: number;
|
|
48
|
+
}[];
|
|
49
|
+
structuralMap: StepMap;
|
|
50
|
+
structural: boolean;
|
|
51
|
+
failed: boolean;
|
|
52
|
+
removedEndpointCount: number;
|
|
53
|
+
removedReferences: RemovedSectionReference[];
|
|
54
|
+
};
|
|
55
|
+
//#endregion
|
|
56
|
+
export { resolveWholeStory };
|