@stll/folio-core 0.45.0 → 0.47.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.js +85 -43
- package/dist/ai-edits/headless.js +2 -2
- package/dist/ai-edits/read.d.ts +1 -0
- package/dist/ai-edits/read.js +1 -0
- package/dist/ai-edits/snapshot.js +32 -27
- package/dist/ai-edits/table-cell-mutations.js +15 -7
- package/dist/ai-edits/table-geometry.js +21 -18
- package/dist/ai-edits/table-template.js +2 -2
- package/dist/compare/compare.js +2 -5
- package/dist/compare/content-alignment.js +108 -12
- package/dist/compare/content-types.d.ts +8 -2
- package/dist/compare/content.js +2 -11
- package/dist/compare/plan.js +7 -4
- package/dist/compare/scenario.js +2 -5
- package/dist/compare/section-boundary-properties.js +1 -2
- package/dist/compare/types.d.ts +9 -1
- package/dist/compare/types.js +12 -1
- package/dist/compat/eigenpal.d.ts +2 -1
- package/dist/compat/eigenpal.js +2 -1
- package/dist/content-controls/checkboxDisplay.d.ts +17 -0
- package/dist/content-controls/checkboxDisplay.js +46 -0
- package/dist/content-controls/findContentControls.js +3 -1
- package/dist/content-controls/mutateContentControls.js +57 -43
- package/dist/controller/contentControlWidgetController.d.ts +1 -0
- package/dist/controller/contentControlWidgetController.js +3 -0
- package/dist/controller/hiddenEditorApi.js +3 -1
- package/dist/controller/hiddenEditorManager.d.ts +1 -1
- package/dist/controller/hiddenEditorManager.js +6 -3
- package/dist/controller/layoutPipeline.js +8 -3
- package/dist/display-list/build/buildDisplayList.js +20 -1
- package/dist/display-list/build/imagePrimitives.d.ts +4 -4
- package/dist/display-list/build/imagePrimitives.js +38 -18
- package/dist/display-list/build/pageBorderPrimitives.js +2 -1
- package/dist/display-list/build/paragraphPrimitives.js +113 -14
- package/dist/display-list/build/previewPrimitives.d.ts +10 -0
- package/dist/display-list/build/previewPrimitives.js +89 -0
- package/dist/display-list/build/strokes.d.ts +177 -8
- package/dist/display-list/build/strokes.js +167 -47
- package/dist/display-list/build/tablePrimitives.js +4 -2
- package/dist/display-list/build/textBoxPrimitives.js +6 -4
- package/dist/display-list/build/textDecorations.d.ts +15 -1
- package/dist/display-list/build/textDecorations.js +15 -1
- package/dist/display-list/dom/renderDisplayListToDom.js +11 -21
- package/dist/display-list/primitives.d.ts +13 -2
- package/dist/display-list/primitives.js +36 -1
- package/dist/display-list/types.d.ts +17 -0
- package/dist/document-operations.js +2 -1
- package/dist/docx/attributeRemainder.d.ts +76 -0
- package/dist/docx/attributeRemainder.js +111 -0
- package/dist/docx/blockContentParser.d.ts +3 -1
- package/dist/docx/blockContentParser.js +102 -106
- package/dist/docx/blockPlainText.d.ts +3 -4
- package/dist/docx/blockPlainText.js +3 -0
- package/dist/docx/borderParser.js +26 -11
- package/dist/docx/builtInStyles.d.ts +8 -16
- package/dist/docx/builtInStyles.js +54 -17
- package/dist/docx/commentAnchorIndex.d.ts +30 -0
- package/dist/docx/commentAnchorIndex.js +50 -0
- package/dist/docx/commentParser.d.ts +1 -1
- package/dist/docx/commentParser.js +56 -39
- package/dist/docx/commentRangeIntegrity.d.ts +16 -1
- package/dist/docx/commentRangeIntegrity.js +42 -1
- package/dist/docx/commentRangeJoin.d.ts +9 -0
- package/dist/docx/commentRangeJoin.js +33 -0
- package/dist/docx/commentReferenceCompletion.d.ts +9 -0
- package/dist/docx/commentReferenceCompletion.js +47 -0
- package/dist/docx/commentReferenceNormalization.js +3 -1
- package/dist/docx/commentReplyMarkers.js +11 -19
- package/dist/docx/compatibility.js +56 -41
- package/dist/docx/containerChildren.d.ts +208 -0
- package/dist/docx/containerChildren.gen.d.ts +43 -0
- package/dist/docx/containerChildren.gen.js +263 -0
- package/dist/docx/containerChildren.js +153 -0
- package/dist/docx/diagramPreview.d.ts +14 -2
- package/dist/docx/diagramPreview.js +81 -169
- package/dist/docx/documentParser.d.ts +1 -1
- package/dist/docx/documentParser.js +7 -4
- package/dist/docx/drawingAnchor.d.ts +87 -0
- package/dist/docx/drawingAnchor.js +201 -0
- package/dist/docx/drawingUtils.d.ts +43 -38
- package/dist/docx/drawingUtils.js +205 -118
- package/dist/docx/ensureParaIds.js +17 -7
- package/dist/docx/fieldParser.d.ts +1 -1
- package/dist/docx/fieldParser.js +4 -4
- package/dist/docx/fieldState.d.ts +26 -0
- package/dist/docx/fieldState.js +53 -0
- package/dist/docx/fontTableParser.js +102 -41
- package/dist/docx/footnoteParser.d.ts +1 -1
- package/dist/docx/footnoteParser.js +10 -6
- package/dist/docx/graphicFrameLocks.d.ts +16 -4
- package/dist/docx/graphicFrameLocks.js +19 -6
- package/dist/docx/groupDrawingParser.js +4 -3
- package/dist/docx/headerFooterParser.js +1 -1
- package/dist/docx/headerFooterReferenceNormalization.js +1 -0
- package/dist/docx/hyperlinkParser.d.ts +66 -9
- package/dist/docx/hyperlinkParser.js +153 -26
- package/dist/docx/imageParser.js +160 -115
- package/dist/docx/index.d.ts +2 -1
- package/dist/docx/index.js +2 -1
- package/dist/docx/inlineContentRemovals.d.ts +28 -0
- package/dist/docx/inlineContentRemovals.js +46 -0
- package/dist/docx/inlineWrapperContent.d.ts +166 -0
- package/dist/docx/inlineWrapperContent.js +165 -0
- package/dist/docx/inlineWrapperParser.d.ts +11 -0
- package/dist/docx/inlineWrapperParser.js +60 -0
- package/dist/docx/nonVisualDrawingProps.d.ts +5 -13
- package/dist/docx/normalizeBaseDirection.js +12 -1
- package/dist/docx/numberingParser.d.ts +25 -2
- package/dist/docx/numberingParser.js +264 -361
- package/dist/docx/numberingReference.d.ts +9 -16
- package/dist/docx/numberingReference.js +17 -16
- package/dist/docx/numberingReferenceNormalization.js +7 -7
- package/dist/docx/ooxmlCounterFormatter.d.ts +1 -1
- package/dist/docx/ooxmlCounterFormatter.js +4 -1
- package/dist/docx/paraIdAttribute.d.ts +111 -0
- package/dist/docx/paraIdAttribute.js +142 -0
- package/dist/docx/paragraphParser.d.ts +10 -25
- package/dist/docx/paragraphParser.js +421 -496
- package/dist/docx/paragraphProperties.d.ts +23 -0
- package/dist/docx/paragraphProperties.js +279 -0
- package/dist/docx/paragraphPropertySource.js +7 -1
- package/dist/docx/paragraphTextBoxEnrichment.d.ts +3 -2
- package/dist/docx/paragraphTextBoxEnrichment.js +20 -59
- package/dist/docx/paragraphTraversal.d.ts +14 -10
- package/dist/docx/paragraphTraversal.js +53 -52
- package/dist/docx/parseWarningMessage.js +5 -1
- package/dist/docx/parserEnums.d.ts +6 -8
- package/dist/docx/parserEnums.js +4 -6
- package/dist/docx/preservedRunContent.d.ts +32 -0
- package/dist/docx/preservedRunContent.js +96 -0
- package/dist/docx/previewBudget.d.ts +44 -23
- package/dist/docx/previewBudget.js +61 -30
- package/dist/docx/propertyElementAttributes.d.ts +178 -0
- package/dist/docx/propertyElementAttributes.js +114 -0
- package/dist/docx/renderedPageBreakNormalization.js +4 -6
- package/dist/docx/rezip.d.ts +28 -2
- package/dist/docx/rezip.js +152 -27
- package/dist/docx/runConsolidator.d.ts +42 -2
- package/dist/docx/runConsolidator.js +60 -6
- package/dist/docx/runParser.d.ts +55 -19
- package/dist/docx/runParser.js +394 -306
- package/dist/docx/runPayload.d.ts +5 -0
- package/dist/docx/runPayload.js +4 -0
- package/dist/docx/sdtProperties.d.ts +39 -5
- package/dist/docx/sdtProperties.js +205 -84
- package/dist/docx/sdtPropertiesPatch.d.ts +5 -9
- package/dist/docx/sdtPropertiesPatch.js +68 -112
- package/dist/docx/sectionParser.d.ts +1 -2
- package/dist/docx/sectionParser.js +241 -238
- package/dist/docx/selectiveSave.js +3 -2
- package/dist/docx/selectiveXmlPatch.d.ts +66 -3
- package/dist/docx/selectiveXmlPatch.js +276 -133
- package/dist/docx/serializer/blockSdtSerializer.js +2 -96
- package/dist/docx/serializer/borderSerializer.d.ts +5 -5
- package/dist/docx/serializer/borderSerializer.js +12 -10
- package/dist/docx/serializer/commentSerializer.js +5 -7
- package/dist/docx/serializer/documentSerializer.js +11 -11
- package/dist/docx/serializer/fontTableSerializer.js +31 -3
- package/dist/docx/serializer/headerFooterSerializer.js +10 -9
- package/dist/docx/serializer/markupRangeAttributes.d.ts +9 -1
- package/dist/docx/serializer/markupRangeAttributes.js +9 -1
- package/dist/docx/serializer/noteSerializer.js +11 -8
- package/dist/docx/serializer/numberingSerializer.d.ts +1 -6
- package/dist/docx/serializer/numberingSerializer.js +81 -79
- package/dist/docx/serializer/paragraphSerializer.d.ts +1 -9
- package/dist/docx/serializer/paragraphSerializer.js +156 -236
- package/dist/docx/serializer/runSerializer.d.ts +1 -5
- package/dist/docx/serializer/runSerializer.js +134 -75
- package/dist/docx/serializer/sdtPropertiesSerializer.d.ts +26 -0
- package/dist/docx/serializer/sdtPropertiesSerializer.js +111 -0
- package/dist/docx/serializer/sectionPropertiesSerializer.js +42 -49
- package/dist/docx/serializer/settingsSerializer.js +6 -4
- package/dist/docx/serializer/stylesSerializer.js +8 -11
- package/dist/docx/serializer/tableSerializer.js +283 -105
- package/dist/docx/serializer/textFormattingSerializer.d.ts +28 -4
- package/dist/docx/serializer/textFormattingSerializer.js +111 -101
- package/dist/docx/serializer/xmlUtils.d.ts +1 -1
- package/dist/docx/serializer/xmlUtils.js +1 -1
- package/dist/docx/server/createBilingualDocument.js +20 -16
- package/dist/docx/server/materializeYjsDocx.d.ts +1 -1
- package/dist/docx/server/materializeYjsDocx.js +9 -1
- package/dist/docx/server/migrateYjsAttrSchema.d.ts +55 -0
- package/dist/docx/server/migrateYjsAttrSchema.js +95 -0
- package/dist/docx/settingsParser.js +7 -4
- package/dist/docx/shadingParser.d.ts +2 -1
- package/dist/docx/shadingParser.js +43 -7
- package/dist/docx/shapeParser.js +13 -8
- package/dist/docx/strictNames.d.ts +11 -0
- package/dist/docx/strictNames.gen.d.ts +45 -0
- package/dist/docx/strictNames.gen.js +50 -0
- package/dist/docx/strictNames.js +43 -0
- package/dist/docx/strictValueEncodings.gen.js +133 -131
- package/dist/docx/styleParser.js +17 -349
- package/dist/docx/tableParser.d.ts +11 -2
- package/dist/docx/tableParser.js +665 -220
- package/dist/docx/textBoxParser.d.ts +28 -3
- package/dist/docx/textBoxParser.js +69 -9
- package/dist/docx/themeColorAttribute.d.ts +13 -0
- package/dist/docx/themeColorAttribute.js +24 -0
- package/dist/docx/trackedMoveRangeNormalization.js +2 -1
- package/dist/docx/unzip.js +5 -4
- package/dist/docx/vmlImageParser.d.ts +30 -5
- package/dist/docx/vmlImageParser.js +91 -32
- package/dist/docx/vmlPreview.js +2 -2
- package/dist/docx/wrapPolygon.d.ts +30 -0
- package/dist/docx/wrapPolygon.js +70 -0
- package/dist/docx/xmlEncoding.d.ts +5 -0
- package/dist/docx/xmlEncoding.js +12 -0
- package/dist/docx/xmlParser.d.ts +23 -1
- package/dist/docx/xmlParser.js +31 -2
- package/dist/fonts/embeddedFonts.js +3 -3
- package/dist/headless-layout.js +12 -1
- package/dist/i18n/messages/catalogs.gen.d.ts +68 -0
- package/dist/i18n/messages/catalogs.gen.js +102 -34
- package/dist/i18n/messages/messages.gen.d.ts +4 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/internal/headlessRevisionResolution.js +9 -0
- package/dist/internal/pageBreakRunSourceDescendantIndex.js +7 -2
- package/dist/internal/paragraphFormattingSerialization.d.ts +20 -9
- package/dist/internal/paragraphFormattingSerialization.js +118 -83
- package/dist/layout-bridge/convert/footnoteLayout.d.ts +1 -0
- package/dist/layout-bridge/convert/footnoteLayout.js +1 -0
- package/dist/layout-bridge/convert/headerFooterLayout.d.ts +1 -0
- package/dist/layout-bridge/convert/headerFooterLayout.js +2 -0
- package/dist/layout-bridge/convert/toFlowBlocks.d.ts +17 -12
- package/dist/layout-bridge/convert/toFlowBlocks.js +267 -101
- package/dist/layout-engine/index.d.ts +2 -2
- package/dist/layout-engine/index.js +53 -17
- package/dist/layout-engine/measure/measureBlocks.d.ts +3 -0
- package/dist/layout-engine/measure/measureBlocks.js +6 -10
- package/dist/layout-engine/measure/tableCellFloating.d.ts +2 -0
- package/dist/layout-engine/measure/tableCellFloating.js +2 -0
- package/dist/layout-engine/measure/tableCellGrid.js +2 -1
- package/dist/layout-engine/measure/tableFragmentBorderGeometry.js +2 -1
- package/dist/layout-engine/measure/tableInlinePlacement.js +2 -5
- package/dist/layout-engine/paragraphSequence.js +3 -2
- package/dist/layout-engine/renderedBreakReconciliation.js +2 -1
- package/dist/layout-engine/section-breaks.d.ts +49 -2
- package/dist/layout-engine/section-breaks.js +55 -4
- package/dist/layout-engine/types.d.ts +69 -17
- package/dist/layout-engine/types.js +16 -1
- package/dist/layout-painter/borderStroke.d.ts +18 -4
- package/dist/layout-painter/renderImage.d.ts +5 -1
- package/dist/layout-painter/renderImage.js +10 -3
- package/dist/layout-painter/renderPage.d.ts +2 -0
- package/dist/layout-painter/renderPage.js +10 -4
- package/dist/layout-painter/renderParagraph.d.ts +14 -1
- package/dist/layout-painter/renderParagraph.js +34 -28
- package/dist/layout-painter/renderTable.d.ts +4 -1
- package/dist/layout-painter/renderTable.js +22 -22
- package/dist/layout-painter/renderTextBox.js +5 -3
- package/dist/managers/autoSaveCodec.d.ts +9 -1
- package/dist/managers/autoSaveCodec.js +12 -4
- package/dist/markdown/renderBlock.js +3 -0
- package/dist/markdown/renderRuns.d.ts +1 -1
- package/dist/markdown/renderRuns.js +34 -6
- package/dist/markdown/renderTable.js +24 -6
- package/dist/markdown/trailers.js +4 -1
- package/dist/model.d.ts +3 -3
- package/dist/model.js +2 -2
- package/dist/paged-layout/sectionBlockWidths.d.ts +3 -0
- package/dist/paged-layout/sectionBlockWidths.js +26 -4
- package/dist/pdf/images.js +142 -6
- package/dist/prosemirror/attrs/index.d.ts +34 -5
- package/dist/prosemirror/attrs/index.js +639 -48
- package/dist/prosemirror/authoredTransformAttrs.d.ts +28 -0
- package/dist/prosemirror/authoredTransformAttrs.js +64 -0
- package/dist/prosemirror/bookmarkBoundaryAttrs.d.ts +9 -1
- package/dist/prosemirror/bookmarkBoundaryAttrs.js +22 -3
- package/dist/prosemirror/commands/comments.js +68 -53
- package/dist/prosemirror/commands/contentControls.js +33 -20
- package/dist/prosemirror/commands/image.d.ts +10 -3
- package/dist/prosemirror/commands/image.js +46 -29
- package/dist/prosemirror/commands/pageBreak.js +1 -1
- package/dist/prosemirror/commands/paragraph.d.ts +2 -1
- package/dist/prosemirror/commands/propertyChangeScope.d.ts +12 -4
- package/dist/prosemirror/commands/propertyChangeScope.js +22 -4
- package/dist/prosemirror/commands/sectionBreak.d.ts +33 -1
- package/dist/prosemirror/commands/sectionBreak.js +187 -11
- package/dist/prosemirror/commentReferenceAttrs.d.ts +8 -0
- package/dist/prosemirror/commentReferenceAttrs.js +33 -0
- package/dist/prosemirror/commentReferenceIntegrity.d.ts +47 -0
- package/dist/prosemirror/commentReferenceIntegrity.js +43 -0
- package/dist/prosemirror/conversion/fromProseDoc.d.ts +17 -12
- package/dist/prosemirror/conversion/fromProseDoc.js +553 -207
- package/dist/prosemirror/conversion/index.d.ts +2 -2
- package/dist/prosemirror/conversion/preservedSinkCarriers.d.ts +39 -0
- package/dist/prosemirror/conversion/preservedSinkCarriers.js +19 -0
- package/dist/prosemirror/conversion/runShadingMark.js +14 -1
- package/dist/prosemirror/conversion/sdtAttrs.d.ts +10 -1
- package/dist/prosemirror/conversion/sdtAttrs.js +19 -5
- package/dist/prosemirror/conversion/toProseDoc.d.ts +7 -9
- package/dist/prosemirror/conversion/toProseDoc.js +801 -411
- package/dist/prosemirror/emptyRangeAnchor.d.ts +53 -0
- package/dist/prosemirror/emptyRangeAnchor.js +158 -0
- package/dist/prosemirror/extensions/StarterKit.js +14 -58
- package/dist/prosemirror/extensions/core/DocExtension.js +1 -1
- package/dist/prosemirror/extensions/core/ParagraphExtension.js +21 -16
- package/dist/prosemirror/extensions/features/BaseKeymapExtension.js +48 -29
- package/dist/prosemirror/extensions/features/EmptyParagraphFormatExtension.js +3 -1
- package/dist/prosemirror/extensions/features/ImagePasteExtension.js +5 -3
- package/dist/prosemirror/extensions/features/ListExtension.js +43 -24
- package/dist/prosemirror/extensions/features/ParaIdAllocatorExtension.js +1 -0
- package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.js +4 -3
- package/dist/prosemirror/extensions/features/PasteCleanupExtension.d.ts +3 -3
- package/dist/prosemirror/extensions/features/PasteCleanupExtension.js +5 -5
- package/dist/prosemirror/extensions/features/pasteCleanup.d.ts +3 -1
- package/dist/prosemirror/extensions/features/pasteCleanup.js +56 -2
- package/dist/prosemirror/extensions/features/pastedHeadingStyles.js +5 -4
- package/dist/prosemirror/extensions/markRegistry.d.ts +65 -0
- package/dist/prosemirror/extensions/markRegistry.js +138 -0
- package/dist/prosemirror/extensions/marks/InlineWrapperExtension.d.ts +18 -0
- package/dist/prosemirror/extensions/marks/InlineWrapperExtension.js +77 -0
- package/dist/prosemirror/extensions/marks/RunIdentityExtension.d.ts +26 -0
- package/dist/prosemirror/extensions/marks/RunIdentityExtension.js +134 -0
- package/dist/prosemirror/extensions/marks/TrackedChangeExtensions.js +2 -1
- package/dist/prosemirror/extensions/marks/UnderlineExtension.js +12 -18
- package/dist/prosemirror/extensions/marks/markUtils.d.ts +2 -1
- package/dist/prosemirror/extensions/marks/markUtils.js +49 -5
- package/dist/prosemirror/extensions/nodes/BlockBookmarkBoundaryExtension.d.ts +29 -0
- package/dist/prosemirror/extensions/nodes/BlockBookmarkBoundaryExtension.js +46 -0
- package/dist/prosemirror/extensions/nodes/BlockSdtExtension.d.ts +4 -3
- package/dist/prosemirror/extensions/nodes/BlockSdtExtension.js +18 -13
- package/dist/prosemirror/extensions/nodes/BookmarkBoundaryExtension.js +28 -53
- package/dist/prosemirror/extensions/nodes/CommentReferenceExtension.d.ts +11 -0
- package/dist/prosemirror/extensions/nodes/CommentReferenceExtension.js +97 -0
- package/dist/prosemirror/extensions/nodes/FieldExtension.js +9 -7
- package/dist/prosemirror/extensions/nodes/ImageExtension.js +24 -1
- package/dist/prosemirror/extensions/nodes/MoveRangeBoundaryExtension.d.ts +11 -0
- package/dist/prosemirror/extensions/nodes/MoveRangeBoundaryExtension.js +43 -0
- package/dist/prosemirror/extensions/nodes/PreservedBlockExtension.d.ts +32 -0
- package/dist/prosemirror/extensions/nodes/PreservedBlockExtension.js +67 -0
- package/dist/prosemirror/extensions/nodes/PreservedXmlExtension.d.ts +16 -0
- package/dist/prosemirror/extensions/nodes/PreservedXmlExtension.js +60 -0
- package/dist/prosemirror/extensions/nodes/RangeAnchorExtension.d.ts +13 -0
- package/dist/prosemirror/extensions/nodes/RangeAnchorExtension.js +65 -0
- package/dist/prosemirror/extensions/nodes/SdtExtension.d.ts +3 -1
- package/dist/prosemirror/extensions/nodes/SdtExtension.js +22 -16
- package/dist/prosemirror/extensions/nodes/ShapeExtension.js +7 -0
- package/dist/prosemirror/extensions/nodes/TableExtension.js +142 -123
- package/dist/prosemirror/extensions/nodes/TextBoxExtension.js +9 -1
- package/dist/prosemirror/extensions/nodes/bookmarkBoundaryDom.d.ts +23 -0
- package/dist/prosemirror/extensions/nodes/bookmarkBoundaryDom.js +57 -0
- package/dist/prosemirror/extensions/types.d.ts +12 -3
- package/dist/prosemirror/index.d.ts +4 -2
- package/dist/prosemirror/index.js +2 -1
- package/dist/prosemirror/inlineWrapperStack.d.ts +39 -0
- package/dist/prosemirror/inlineWrapperStack.js +92 -0
- package/dist/prosemirror/listMarker.d.ts +2 -2
- package/dist/prosemirror/listMarker.js +7 -8
- package/dist/prosemirror/listRenderingAttrs.js +11 -1
- package/dist/prosemirror/listState.d.ts +62 -0
- package/dist/prosemirror/listState.js +49 -0
- package/dist/prosemirror/moveRangeBoundaryAttrs.d.ts +13 -0
- package/dist/prosemirror/moveRangeBoundaryAttrs.js +114 -0
- package/dist/prosemirror/numberedRefFields.js +4 -4
- package/dist/prosemirror/numberingAttr.d.ts +55 -0
- package/dist/prosemirror/numberingAttr.js +74 -0
- package/dist/prosemirror/outlineLevelAttr.d.ts +29 -0
- package/dist/prosemirror/outlineLevelAttr.js +42 -0
- package/dist/prosemirror/pageBreakRunProjection.d.ts +17 -7
- package/dist/prosemirror/pageBreakRunProjection.js +19 -9
- package/dist/prosemirror/paragraphFormattingProvenance.d.ts +9 -0
- package/dist/prosemirror/paragraphFormattingProvenance.js +4 -1
- package/dist/prosemirror/plugins/selectionTracker.d.ts +3 -6
- package/dist/prosemirror/plugins/selectionTracker.js +3 -10
- package/dist/prosemirror/rangeAnchorAttrs.d.ts +14 -0
- package/dist/prosemirror/rangeAnchorAttrs.js +101 -0
- package/dist/prosemirror/replacedAnnotations.d.ts +59 -0
- package/dist/prosemirror/replacedAnnotations.js +183 -0
- package/dist/prosemirror/revisionCarriers.d.ts +86 -2
- package/dist/prosemirror/revisionCarriers.js +86 -60
- package/dist/prosemirror/runFormattingInlineCarriers.d.ts +5 -1
- package/dist/prosemirror/runFormattingInlineCarriers.js +7 -1
- package/dist/prosemirror/runIdentity.d.ts +28 -0
- package/dist/prosemirror/runIdentity.js +36 -0
- package/dist/prosemirror/runStyleFormatting.js +1 -1
- package/dist/prosemirror/schema/index.d.ts +3 -3
- package/dist/prosemirror/schema/marks.d.ts +47 -4
- package/dist/prosemirror/schema/nodes.d.ts +309 -26
- package/dist/prosemirror/schema/nodes.js +16 -1
- package/dist/prosemirror/sectionCarrier.d.ts +37 -0
- package/dist/prosemirror/sectionCarrier.js +40 -0
- package/dist/prosemirror/selectionState.d.ts +3 -0
- package/dist/prosemirror/selectionState.js +4 -1
- package/dist/prosemirror/styles/resolvedStyleAttrs.d.ts +5 -4
- package/dist/prosemirror/styles/resolvedStyleAttrs.js +15 -13
- package/dist/prosemirror/tableResize.js +5 -6
- package/dist/prosemirror/trackedRunInlineAtoms.d.ts +4 -0
- package/dist/prosemirror/trackedRunInlineAtoms.js +4 -0
- package/dist/prosemirror/utils/extractTrackedChanges.d.ts +10 -11
- package/dist/prosemirror/utils/extractTrackedChanges.js +109 -92
- package/dist/prosemirror/validation.js +31 -6
- package/dist/prosemirror/yjsDocumentMetadata.d.ts +73 -0
- package/dist/prosemirror/yjsDocumentMetadata.js +592 -0
- package/dist/prosemirror/zeroWidthAnchors.js +6 -0
- package/dist/render-dom/commentAnchorAttributes.d.ts +37 -0
- package/dist/render-dom/commentAnchorAttributes.js +54 -0
- package/dist/server.d.ts +3 -1
- package/dist/server.js +3 -1
- package/dist/style-sets/extract.js +4 -4
- package/dist/style-sets/stellaStyle.js +36 -23
- package/dist/types/colors.d.ts +2 -2
- package/dist/types/content.d.ts +2 -2
- package/dist/types/documentEnumValues.d.ts +53 -26
- package/dist/types/documentEnumValues.js +72 -174
- package/dist/types/formatting.d.ts +2 -2
- package/dist/types/index.d.ts +9 -2
- package/dist/utils/borderCss.d.ts +246 -0
- package/dist/utils/borderCss.js +325 -0
- package/dist/utils/clipboard.d.ts +9 -1
- package/dist/utils/clipboard.js +27 -1
- package/dist/utils/colorResolver.d.ts +4 -3
- package/dist/utils/colorResolver.js +45 -76
- package/dist/utils/createDocument.js +24 -6
- package/dist/utils/findReplace.js +52 -10
- package/dist/utils/formatToStyle.d.ts +84 -2
- package/dist/utils/formatToStyle.js +133 -52
- package/dist/utils/headingCollector.js +3 -2
- package/dist/utils/imageLuminance.d.ts +15 -0
- package/dist/utils/imageLuminance.js +32 -0
- package/dist/utils/mergeDocumentContent.js +12 -20
- package/dist/utils/paragraphFormattingMerge.js +27 -6
- package/dist/utils/replaceText.js +1 -0
- package/dist/utils/tableOperations.d.ts +5 -3
- package/dist/utils/tableOperations.js +14 -1
- package/dist/utils/tablePlacement.d.ts +7 -0
- package/dist/utils/tablePlacement.js +14 -0
- package/dist/utils/textDirectionFlow.d.ts +15 -0
- package/dist/utils/textDirectionFlow.js +38 -0
- package/dist/utils/textFormattingMerge.js +16 -4
- package/package.json +10 -10
- package/dist/ai-edits/__fixtures__/paragraphs.d.ts +0 -17
- package/dist/ai-edits/__fixtures__/paragraphs.js +0 -33
- package/dist/compare/__fixtures__/body-sequence.d.ts +0 -119
- package/dist/compare/__fixtures__/body-sequence.js +0 -225
- package/dist/compare/__fixtures__/nested-table.d.ts +0 -16
- package/dist/compare/__fixtures__/nested-table.js +0 -50
- package/dist/compare/__fixtures__/numbered-list.d.ts +0 -34
- package/dist/compare/__fixtures__/numbered-list.js +0 -85
- package/dist/docx/blockRangeMarkers.d.ts +0 -36
- package/dist/docx/blockRangeMarkers.js +0 -59
- package/dist/docx/bookmarkPlacement.d.ts +0 -9
- package/dist/docx/bookmarkPlacement.js +0 -50
- package/dist/fonts/embeddedFontTable.d.ts +0 -45
- package/dist/fonts/embeddedFontTable.js +0 -80
- package/dist/prosemirror/extensions/marks/PageBreakRunOwnerExtension.d.ts +0 -13
- package/dist/prosemirror/extensions/marks/PageBreakRunOwnerExtension.js +0 -39
- package/dist/prosemirror/yjsParagraphSourceContract.d.ts +0 -9
- package/dist/prosemirror/yjsParagraphSourceContract.js +0 -26
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { document_d_exports } from "../types/document.js";
|
|
2
|
+
import { Node } from "prosemirror-model";
|
|
3
|
+
//#region src/prosemirror/sectionCarrier.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* `ST_SectionMark` in full (§17.18.77). The list is total over the model union:
|
|
6
|
+
* `sectionBreakTypeOf` returns a record's `SectionStart` as a
|
|
7
|
+
* `SectionBreakType`, so a member missing here fails to compile rather than
|
|
8
|
+
* going typeless to every reader. Which members the *insert* commands offer is
|
|
9
|
+
* a separate, narrower question (`InsertableSectionBreak`).
|
|
10
|
+
*/
|
|
11
|
+
declare const SECTION_BREAK_TYPES: readonly ["nextPage", "nextColumn", "continuous", "evenPage", "oddPage"];
|
|
12
|
+
/** A section start a `w:sectPr` can state. */
|
|
13
|
+
type SectionBreakType = (typeof SECTION_BREAK_TYPES)[number];
|
|
14
|
+
/** A break type read off an untrusted boundary (a `data-` attribute, a snapshot). */
|
|
15
|
+
declare const parseSectionBreakType: (value: unknown) => SectionBreakType | null;
|
|
16
|
+
/** The section record a paragraph holds, or `null` when it ends no section. */
|
|
17
|
+
declare const sectionPropertiesOf: (paragraph: Node) => document_d_exports.SectionProperties | null;
|
|
18
|
+
/**
|
|
19
|
+
* The break type a section record states, or `null` when it states none.
|
|
20
|
+
*
|
|
21
|
+
* The single derivation every reader goes through. Every producer of a record
|
|
22
|
+
* already validated `w:type` against the enumeration (the parser, the insert
|
|
23
|
+
* commands, the Yjs migration's `parseSectionBreakType`), so the field needs no
|
|
24
|
+
* second check here; declaring the narrower return type is what proves
|
|
25
|
+
* `SECTION_BREAK_TYPES` still covers the model union.
|
|
26
|
+
*/
|
|
27
|
+
declare const sectionBreakTypeOf: (properties: document_d_exports.SectionProperties | null | undefined) => SectionBreakType | null;
|
|
28
|
+
/**
|
|
29
|
+
* Mint the one record a newly inserted break carries.
|
|
30
|
+
*
|
|
31
|
+
* A minted record states only its type: every other setting of the new section
|
|
32
|
+
* is inherited from the section that follows it, which is what a reader of the
|
|
33
|
+
* package does with a `w:sectPr` that omits them.
|
|
34
|
+
*/
|
|
35
|
+
declare const mintSectionProperties: (breakType: SectionBreakType) => document_d_exports.SectionProperties;
|
|
36
|
+
//#endregion
|
|
37
|
+
export { SECTION_BREAK_TYPES, SectionBreakType, mintSectionProperties, parseSectionBreakType, sectionBreakTypeOf, sectionPropertiesOf };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
//#region src/prosemirror/sectionCarrier.ts
|
|
2
|
+
/**
|
|
3
|
+
* `ST_SectionMark` in full (§17.18.77). The list is total over the model union:
|
|
4
|
+
* `sectionBreakTypeOf` returns a record's `SectionStart` as a
|
|
5
|
+
* `SectionBreakType`, so a member missing here fails to compile rather than
|
|
6
|
+
* going typeless to every reader. Which members the *insert* commands offer is
|
|
7
|
+
* a separate, narrower question (`InsertableSectionBreak`).
|
|
8
|
+
*/
|
|
9
|
+
const SECTION_BREAK_TYPES = [
|
|
10
|
+
"nextPage",
|
|
11
|
+
"nextColumn",
|
|
12
|
+
"continuous",
|
|
13
|
+
"evenPage",
|
|
14
|
+
"oddPage"
|
|
15
|
+
];
|
|
16
|
+
const isSectionBreakType = (value) => SECTION_BREAK_TYPES.some((type) => type === value);
|
|
17
|
+
/** A break type read off an untrusted boundary (a `data-` attribute, a snapshot). */
|
|
18
|
+
const parseSectionBreakType = (value) => isSectionBreakType(value) ? value : null;
|
|
19
|
+
/** The section record a paragraph holds, or `null` when it ends no section. */
|
|
20
|
+
const sectionPropertiesOf = (paragraph) => paragraph.attrs["_sectionProperties"] ?? null;
|
|
21
|
+
/**
|
|
22
|
+
* The break type a section record states, or `null` when it states none.
|
|
23
|
+
*
|
|
24
|
+
* The single derivation every reader goes through. Every producer of a record
|
|
25
|
+
* already validated `w:type` against the enumeration (the parser, the insert
|
|
26
|
+
* commands, the Yjs migration's `parseSectionBreakType`), so the field needs no
|
|
27
|
+
* second check here; declaring the narrower return type is what proves
|
|
28
|
+
* `SECTION_BREAK_TYPES` still covers the model union.
|
|
29
|
+
*/
|
|
30
|
+
const sectionBreakTypeOf = (properties) => properties?.sectionStart ?? null;
|
|
31
|
+
/**
|
|
32
|
+
* Mint the one record a newly inserted break carries.
|
|
33
|
+
*
|
|
34
|
+
* A minted record states only its type: every other setting of the new section
|
|
35
|
+
* is inherited from the section that follows it, which is what a reader of the
|
|
36
|
+
* package does with a `w:sectPr` that omits them.
|
|
37
|
+
*/
|
|
38
|
+
const mintSectionProperties = (breakType) => ({ sectionStart: breakType });
|
|
39
|
+
//#endregion
|
|
40
|
+
export { SECTION_BREAK_TYPES, mintSectionProperties, parseSectionBreakType, sectionBreakTypeOf, sectionPropertiesOf };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { document_d_exports } from "../types/document.js";
|
|
2
|
+
import { ListState } from "./listState.js";
|
|
2
3
|
import { EditorState } from "prosemirror-state";
|
|
3
4
|
//#region src/prosemirror/selectionState.d.ts
|
|
4
5
|
/**
|
|
@@ -21,6 +22,8 @@ type SelectionSnapshot = {
|
|
|
21
22
|
startParagraphIndex: number;
|
|
22
23
|
/** End paragraph index */
|
|
23
24
|
endParagraphIndex: number;
|
|
25
|
+
/** Which list the selection is in, resolved against the numbering definitions. */
|
|
26
|
+
listState: ListState;
|
|
24
27
|
};
|
|
25
28
|
/** Compatibility name for the public toolbar selection contract. */
|
|
26
29
|
type SelectionState = SelectionSnapshot;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { FONT_THEME_VALUES } from "../types/documentEnumValues.js";
|
|
2
2
|
import { expectFontFamilyMarkAttrs, expectFontSizeMarkAttrs, expectHighlightMarkAttrs, expectParagraphAttrs, expectStrikeMarkAttrs, expectTextColorMarkAttrs, expectUnderlineMarkAttrs } from "./attrs/index.js";
|
|
3
|
+
import { resolveListState } from "./listState.js";
|
|
3
4
|
import { directionIsRtl } from "./paragraphDirection.js";
|
|
5
|
+
import { getDocumentNumbering } from "./plugins/documentNumbering.js";
|
|
4
6
|
import { collectMarksInRange } from "./selectionMarks.js";
|
|
5
7
|
//#region src/prosemirror/selectionState.ts
|
|
6
8
|
const isFontTheme = (value) => value !== void 0 && FONT_THEME_VALUES.some((theme) => theme === value);
|
|
@@ -43,7 +45,8 @@ function extractSelectionSnapshot(state) {
|
|
|
43
45
|
paragraphFormatting,
|
|
44
46
|
styleId,
|
|
45
47
|
startParagraphIndex,
|
|
46
|
-
endParagraphIndex
|
|
48
|
+
endParagraphIndex,
|
|
49
|
+
listState: resolveListState(getDocumentNumbering(state), paragraphFormatting.numPr)
|
|
47
50
|
};
|
|
48
51
|
}
|
|
49
52
|
/** Compatibility entry point used by existing React and Vue integrations. */
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ParagraphAttrsPatch } from "../schema/nodes.js";
|
|
1
2
|
import { ResolvedParagraphStyle } from "./styleResolver.js";
|
|
2
3
|
import { NumberingMap } from "../../docx/numberingParser.js";
|
|
3
4
|
//#region src/prosemirror/styles/resolvedStyleAttrs.d.ts
|
|
@@ -11,7 +12,7 @@ type ResolvedStyleIdentity = {
|
|
|
11
12
|
* style's properties (e.g. a heading's spacing) never leak through. Returns
|
|
12
13
|
* a partial attrs object to merge over the paragraph's existing attrs.
|
|
13
14
|
*/
|
|
14
|
-
declare function paragraphAttrsFromResolvedStyle(resolved: ResolvedParagraphStyle, identity: ResolvedStyleIdentity):
|
|
15
|
+
declare function paragraphAttrsFromResolvedStyle(resolved: ResolvedParagraphStyle, identity: ResolvedStyleIdentity): ParagraphAttrsPatch;
|
|
15
16
|
/**
|
|
16
17
|
* The list attrs a style's `w:pPr/w:numPr` controls (numbering reference plus
|
|
17
18
|
* the baked marker-rendering attrs that `toProseDoc` normally derives from
|
|
@@ -30,18 +31,18 @@ declare function paragraphAttrsFromResolvedStyle(resolved: ResolvedParagraphStyl
|
|
|
30
31
|
* paragraph's inline LISTNUM fields, which the picker has no view of. A
|
|
31
32
|
* subsequent save + reload re-derives them from the document content.
|
|
32
33
|
*/
|
|
33
|
-
declare function listAttrsFromResolvedStyle(resolved: ResolvedParagraphStyle, numbering: NumberingMap | null | undefined):
|
|
34
|
+
declare function listAttrsFromResolvedStyle(resolved: ResolvedParagraphStyle, numbering: NumberingMap | null | undefined): ParagraphAttrsPatch | null;
|
|
34
35
|
/** Project one resolved numbering level into the complete editor attr group. */
|
|
35
36
|
declare function listAttrsFromNumbering(numPr: {
|
|
36
37
|
numId: number;
|
|
37
38
|
ilvl: number;
|
|
38
|
-
}, numbering: NumberingMap | null | undefined):
|
|
39
|
+
}, numbering: NumberingMap | null | undefined): ParagraphAttrsPatch;
|
|
39
40
|
/** Recompute every level-dependent attr when a paragraph changes list level. */
|
|
40
41
|
declare function listLevelAttrPatch(attrs: {
|
|
41
42
|
listImplicitChildLevelAdvances?: number | null;
|
|
42
43
|
}, numPr: {
|
|
43
44
|
numId: number;
|
|
44
45
|
ilvl: number;
|
|
45
|
-
}, numbering: NumberingMap | null | undefined):
|
|
46
|
+
}, numbering: NumberingMap | null | undefined): ParagraphAttrsPatch;
|
|
46
47
|
//#endregion
|
|
47
48
|
export { listAttrsFromNumbering, listAttrsFromResolvedStyle, listLevelAttrPatch, paragraphAttrsFromResolvedStyle };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { computeListRendering, numberingLevelHasMarkerSlot } from "../../docx/numberingParser.js";
|
|
2
|
-
import {
|
|
2
|
+
import { paragraphNumberingReference } from "../../docx/numberingReference.js";
|
|
3
3
|
import { tableOfContentsStyleLevel } from "../../utils/tableOfContentsStyle.js";
|
|
4
4
|
import { setAutospacingBaseValue } from "../autospacingBase.js";
|
|
5
5
|
import { CLEARED_LIST_RENDERING_ATTRS } from "../listMarker.js";
|
|
6
6
|
import { listRenderingAttrPatch } from "../listRenderingAttrs.js";
|
|
7
|
+
import { paragraphNumberingAttr } from "../numberingAttr.js";
|
|
7
8
|
import { styleResolvedParagraphFormatting } from "../paragraphFormattingProvenance.js";
|
|
8
9
|
//#region src/prosemirror/styles/resolvedStyleAttrs.ts
|
|
9
10
|
/**
|
|
@@ -77,22 +78,23 @@ function autospacingBaseFromResolvedParagraphFormatting(ppr) {
|
|
|
77
78
|
*/
|
|
78
79
|
function listAttrsFromResolvedStyle(resolved, numbering) {
|
|
79
80
|
const numPr = resolved.paragraphFormatting?.numPr;
|
|
80
|
-
if (
|
|
81
|
+
if (numPr?.kind !== "reference") return null;
|
|
82
|
+
const { numId, ilvl = 0 } = numPr;
|
|
81
83
|
const attrs = listAttrsFromNumbering({
|
|
82
|
-
numId
|
|
83
|
-
ilvl
|
|
84
|
+
numId,
|
|
85
|
+
ilvl
|
|
84
86
|
}, numbering);
|
|
85
|
-
const level = numbering?.getLevel(
|
|
86
|
-
attrs
|
|
87
|
-
numId
|
|
88
|
-
ilvl
|
|
89
|
-
};
|
|
87
|
+
const level = numbering?.getLevel(numId, ilvl);
|
|
88
|
+
attrs.numPrFromStyle = paragraphNumberingAttr(paragraphNumberingReference({
|
|
89
|
+
numId,
|
|
90
|
+
ilvl
|
|
91
|
+
}));
|
|
90
92
|
const ppr = resolved.paragraphFormatting;
|
|
91
93
|
if (level?.pPr) {
|
|
92
|
-
if (ppr?.indentLeft === void 0 && level.pPr.indentLeft !== void 0) attrs
|
|
94
|
+
if (ppr?.indentLeft === void 0 && level.pPr.indentLeft !== void 0) attrs.indentLeft = level.pPr.indentLeft;
|
|
93
95
|
if (!(ppr?.indentFirstLine !== void 0 || ppr?.hangingIndent !== void 0) && numberingLevelHasMarkerSlot(level)) {
|
|
94
|
-
if (level.pPr.indentFirstLine !== void 0) attrs
|
|
95
|
-
if (level.pPr.hangingIndent !== void 0) attrs
|
|
96
|
+
if (level.pPr.indentFirstLine !== void 0) attrs.indentFirstLine = level.pPr.indentFirstLine;
|
|
97
|
+
if (level.pPr.hangingIndent !== void 0) attrs.hangingIndent = level.pPr.hangingIndent;
|
|
96
98
|
}
|
|
97
99
|
}
|
|
98
100
|
return attrs;
|
|
@@ -106,7 +108,7 @@ function listAttrsFromNumbering(numPr, numbering) {
|
|
|
106
108
|
const rendering = numbering ? computeListRendering(targetNumPr, numbering) : null;
|
|
107
109
|
return {
|
|
108
110
|
...CLEARED_LIST_RENDERING_ATTRS,
|
|
109
|
-
numPr: targetNumPr,
|
|
111
|
+
numPr: paragraphNumberingAttr(paragraphNumberingReference(targetNumPr)),
|
|
110
112
|
...rendering && listRenderingAttrPatch(rendering)
|
|
111
113
|
};
|
|
112
114
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { mergeTableCellAttrs } from "./attrs/index.js";
|
|
1
2
|
//#region src/prosemirror/tableResize.ts
|
|
2
3
|
/** 1px ≈ 15 twips at 96dpi (20 twips/pt × 72pt/in ÷ 96px/in). */
|
|
3
4
|
const TWIPS_PER_PIXEL = 15;
|
|
@@ -88,12 +89,11 @@ function commitColumnResize(view, opts) {
|
|
|
88
89
|
const colspan = cell.attrs["colspan"] || 1;
|
|
89
90
|
if (cellColIdx === colIdx || cellColIdx === colIdx + 1) {
|
|
90
91
|
const newWidth = cellColIdx === colIdx ? newLeft : newRight;
|
|
91
|
-
tr.setNodeMarkup(tr.mapping.map(cellOffset), void 0, {
|
|
92
|
-
...cell.attrs,
|
|
92
|
+
tr.setNodeMarkup(tr.mapping.map(cellOffset), void 0, mergeTableCellAttrs(cell, {
|
|
93
93
|
width: newWidth,
|
|
94
94
|
widthType: "dxa",
|
|
95
95
|
colwidth: null
|
|
96
|
-
});
|
|
96
|
+
}));
|
|
97
97
|
}
|
|
98
98
|
cellOffset += cell.nodeSize;
|
|
99
99
|
cellColIdx += colspan;
|
|
@@ -145,12 +145,11 @@ function commitRightEdgeResize(view, opts) {
|
|
|
145
145
|
let cellColIdx = 0;
|
|
146
146
|
row.forEach((cell) => {
|
|
147
147
|
const colspan = cell.attrs["colspan"] || 1;
|
|
148
|
-
if (cellColIdx === colIdx) tr.setNodeMarkup(tr.mapping.map(cellOffset), void 0, {
|
|
149
|
-
...cell.attrs,
|
|
148
|
+
if (cellColIdx === colIdx) tr.setNodeMarkup(tr.mapping.map(cellOffset), void 0, mergeTableCellAttrs(cell, {
|
|
150
149
|
width: newWidth,
|
|
151
150
|
widthType: "dxa",
|
|
152
151
|
colwidth: null
|
|
153
|
-
});
|
|
152
|
+
}));
|
|
154
153
|
cellOffset += cell.nodeSize;
|
|
155
154
|
cellColIdx += colspan;
|
|
156
155
|
});
|
|
@@ -11,11 +11,15 @@ type TrackedRunInlineAtomDisposition = "carry" | "field-carrier" | "outside-wrap
|
|
|
11
11
|
*/
|
|
12
12
|
declare const TRACKED_RUN_INLINE_ATOM_DISPOSITIONS: Readonly<{
|
|
13
13
|
readonly bookmarkBoundary: "carry";
|
|
14
|
+
readonly commentReference: "transparent";
|
|
14
15
|
readonly field: "field-carrier";
|
|
15
16
|
readonly hardBreak: "carry";
|
|
16
17
|
readonly image: "carry";
|
|
17
18
|
readonly math: "carry";
|
|
19
|
+
readonly moveRangeBoundary: "transparent";
|
|
18
20
|
readonly pageBreakRun: "page-break-carrier";
|
|
21
|
+
readonly preservedXml: "carry";
|
|
22
|
+
readonly rangeAnchor: "transparent";
|
|
19
23
|
readonly renderedPageBreak: "transparent";
|
|
20
24
|
readonly shape: "carry";
|
|
21
25
|
readonly structuredField: "carry";
|
|
@@ -10,11 +10,15 @@ import { panic } from "better-result";
|
|
|
10
10
|
*/
|
|
11
11
|
const TRACKED_RUN_INLINE_ATOM_DISPOSITIONS = Object.freeze({
|
|
12
12
|
bookmarkBoundary: "carry",
|
|
13
|
+
commentReference: "transparent",
|
|
13
14
|
field: "field-carrier",
|
|
14
15
|
hardBreak: "carry",
|
|
15
16
|
image: "carry",
|
|
16
17
|
math: "carry",
|
|
18
|
+
moveRangeBoundary: "transparent",
|
|
17
19
|
pageBreakRun: "page-break-carrier",
|
|
20
|
+
preservedXml: "carry",
|
|
21
|
+
rangeAnchor: "transparent",
|
|
18
22
|
renderedPageBreak: "transparent",
|
|
19
23
|
shape: "carry",
|
|
20
24
|
structuredField: "carry",
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PropertyRevisionCarrier } from "../revisionCarriers.js";
|
|
1
2
|
import { EditorState } from "prosemirror-state";
|
|
2
3
|
//#region src/prosemirror/utils/extractTrackedChanges.d.ts
|
|
3
4
|
/**
|
|
@@ -20,18 +21,16 @@ type TrackedChangeEntry = {
|
|
|
20
21
|
* - `paragraphMarkInsertion` / `paragraphMarkDeletion` — Enter /
|
|
21
22
|
* Backspace produced a tracked paragraph break (`<w:pPr><w:rPr><w:ins/>` /
|
|
22
23
|
* `<w:del/>`).
|
|
23
|
-
* - `
|
|
24
|
-
*
|
|
25
|
-
* - `
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
* - `tablePropertiesChanged` — table-level formatting
|
|
32
|
-
* (`<w:tblPrChange>`).
|
|
24
|
+
* - `rowInserted` / `rowDeleted` — table row authored / removed
|
|
25
|
+
* (`<w:trPr><w:ins/>` / `<w:del/>`).
|
|
26
|
+
* - `cellInserted` / `cellDeleted` / `cellMerged` — per-cell structural
|
|
27
|
+
* revisions (`<w:cellIns>` / `<w:cellDel>` / `<w:cellMerge>`).
|
|
28
|
+
* - {@link PropertyRevisionCarrier} — a tracked property revision carried on
|
|
29
|
+
* a node's attrs (`<w:pPrChange>`, `<w:sectPrChange>`, `<w:tblPrChange>`,
|
|
30
|
+
* `<w:tblPrExChange>`, `<w:trPrChange>`, `<w:tcPrChange>`). The set comes
|
|
31
|
+
* from the site table, not from a list kept here.
|
|
33
32
|
*/
|
|
34
|
-
type: "insertion" | "deletion" | "replacement" | "runPropertiesChanged" | "paragraphMarkInsertion" | "paragraphMarkDeletion" | "
|
|
33
|
+
type: "insertion" | "deletion" | "replacement" | "runPropertiesChanged" | "paragraphMarkInsertion" | "paragraphMarkDeletion" | "rowInserted" | "rowDeleted" | "cellInserted" | "cellDeleted" | "cellMerged" | "tableInserted" | "tableDeleted" | PropertyRevisionCarrier;
|
|
35
34
|
/**
|
|
36
35
|
* Affected text. For inline types this is the run's text; for
|
|
37
36
|
* structural types it's the surrounding paragraph / cell content
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { expectRunPropertyChangeMarkAttrs } from "../attrs/index.js";
|
|
2
|
+
import { nodePropertyRevisionSites, propertyRevisionMetadata, propertyRevisionRecords } from "../revisionCarriers.js";
|
|
2
3
|
import { getTableCellMergeChange } from "../tableCellMergeRevision.js";
|
|
3
4
|
//#region src/prosemirror/utils/extractTrackedChanges.ts
|
|
4
5
|
const EMPTY_RESULT = {
|
|
@@ -71,19 +72,6 @@ function extractTrackedChanges(state) {
|
|
|
71
72
|
to: pos + node.nodeSize,
|
|
72
73
|
revisionId: del.revisionId
|
|
73
74
|
});
|
|
74
|
-
const pPrChange = node.attrs["pPrChange"];
|
|
75
|
-
if (Array.isArray(pPrChange)) for (const entry of pPrChange) {
|
|
76
|
-
if (!entry?.info || typeof entry.info.id !== "number") continue;
|
|
77
|
-
raw.push({
|
|
78
|
-
type: "paragraphPropertiesChanged",
|
|
79
|
-
text: node.textContent || "",
|
|
80
|
-
author: entry.info.author || "",
|
|
81
|
-
date: entry.info.date ?? void 0,
|
|
82
|
-
from: pos,
|
|
83
|
-
to: pos + node.nodeSize,
|
|
84
|
-
revisionId: entry.info.id
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
75
|
}
|
|
88
76
|
if (node.type.name === "tableRow") {
|
|
89
77
|
const trIns = node.attrs["trIns"];
|
|
@@ -122,19 +110,6 @@ function extractTrackedChanges(state) {
|
|
|
122
110
|
entry
|
|
123
111
|
});
|
|
124
112
|
}
|
|
125
|
-
const trPrChange = node.attrs["trPrChange"];
|
|
126
|
-
if (Array.isArray(trPrChange)) for (const entry of trPrChange) {
|
|
127
|
-
if (!entry?.info || typeof entry.info.id !== "number") continue;
|
|
128
|
-
raw.push({
|
|
129
|
-
type: "rowPropertiesChanged",
|
|
130
|
-
text: node.textContent || "",
|
|
131
|
-
author: entry.info.author || "",
|
|
132
|
-
date: entry.info.date ?? void 0,
|
|
133
|
-
from: pos,
|
|
134
|
-
to: pos + node.nodeSize,
|
|
135
|
-
revisionId: entry.info.id
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
113
|
}
|
|
139
114
|
if (node.type.name === "tableCell" || node.type.name === "tableHeader") {
|
|
140
115
|
const cellMarker = node.attrs["cellMarker"];
|
|
@@ -168,34 +143,8 @@ function extractTrackedChanges(state) {
|
|
|
168
143
|
revisionId: change.info.id
|
|
169
144
|
});
|
|
170
145
|
}
|
|
171
|
-
const tcPrChange = node.attrs["tcPrChange"];
|
|
172
|
-
if (Array.isArray(tcPrChange)) for (const entry of tcPrChange) {
|
|
173
|
-
if (!entry?.info || typeof entry.info.id !== "number") continue;
|
|
174
|
-
raw.push({
|
|
175
|
-
type: "cellPropertiesChanged",
|
|
176
|
-
text: node.textContent || "",
|
|
177
|
-
author: entry.info.author || "",
|
|
178
|
-
date: entry.info.date ?? void 0,
|
|
179
|
-
from: pos,
|
|
180
|
-
to: pos + node.nodeSize,
|
|
181
|
-
revisionId: entry.info.id
|
|
182
|
-
});
|
|
183
|
-
}
|
|
184
146
|
}
|
|
185
147
|
if (node.type.name === "table") {
|
|
186
|
-
const tblPrChange = node.attrs["tblPrChange"];
|
|
187
|
-
if (Array.isArray(tblPrChange)) for (const entry of tblPrChange) {
|
|
188
|
-
if (!entry?.info || typeof entry.info.id !== "number") continue;
|
|
189
|
-
raw.push({
|
|
190
|
-
type: "tablePropertiesChanged",
|
|
191
|
-
text: "",
|
|
192
|
-
author: entry.info.author || "",
|
|
193
|
-
date: entry.info.date ?? void 0,
|
|
194
|
-
from: pos,
|
|
195
|
-
to: pos + node.nodeSize,
|
|
196
|
-
revisionId: entry.info.id
|
|
197
|
-
});
|
|
198
|
-
}
|
|
199
148
|
const firstRow = node.firstChild;
|
|
200
149
|
const firstIns = firstRow?.attrs["trIns"];
|
|
201
150
|
const firstDel = firstRow?.attrs["trDel"];
|
|
@@ -239,6 +188,19 @@ function extractTrackedChanges(state) {
|
|
|
239
188
|
}
|
|
240
189
|
}
|
|
241
190
|
}
|
|
191
|
+
for (const site of nodePropertyRevisionSites(node.type.name)) for (const record of propertyRevisionRecords(node, site)) {
|
|
192
|
+
const metadata = propertyRevisionMetadata(record.info);
|
|
193
|
+
if (!metadata) continue;
|
|
194
|
+
raw.push({
|
|
195
|
+
type: site.carrier,
|
|
196
|
+
text: node.textContent || "",
|
|
197
|
+
author: metadata.author,
|
|
198
|
+
date: metadata.date ?? void 0,
|
|
199
|
+
from: pos,
|
|
200
|
+
to: pos + node.nodeSize,
|
|
201
|
+
revisionId: metadata.id
|
|
202
|
+
});
|
|
203
|
+
}
|
|
242
204
|
if (!node.isInline) return;
|
|
243
205
|
let inlineText;
|
|
244
206
|
if (node.isText) inlineText = node.text || "";
|
|
@@ -293,39 +255,81 @@ function extractTrackedChanges(state) {
|
|
|
293
255
|
const rid = meta.revisions.values().next().value;
|
|
294
256
|
commentToRevision.set(cid, rid);
|
|
295
257
|
}
|
|
296
|
-
const
|
|
297
|
-
tableInserted:
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
rowDeleted:
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
258
|
+
const STRUCTURAL_COALESCING = {
|
|
259
|
+
tableInserted: {
|
|
260
|
+
type: "coalesce",
|
|
261
|
+
family: "insertion",
|
|
262
|
+
priority: 6
|
|
263
|
+
},
|
|
264
|
+
tableDeleted: {
|
|
265
|
+
type: "coalesce",
|
|
266
|
+
family: "deletion",
|
|
267
|
+
priority: 6
|
|
268
|
+
},
|
|
269
|
+
tablePropertiesChanged: {
|
|
270
|
+
type: "coalesce",
|
|
271
|
+
family: "properties",
|
|
272
|
+
priority: 5
|
|
273
|
+
},
|
|
274
|
+
tablePropertyExceptionsChanged: { type: "separate" },
|
|
275
|
+
rowInserted: {
|
|
276
|
+
type: "coalesce",
|
|
277
|
+
family: "insertion",
|
|
278
|
+
priority: 4
|
|
279
|
+
},
|
|
280
|
+
rowDeleted: {
|
|
281
|
+
type: "coalesce",
|
|
282
|
+
family: "deletion",
|
|
283
|
+
priority: 4
|
|
284
|
+
},
|
|
285
|
+
rowPropertiesChanged: {
|
|
286
|
+
type: "coalesce",
|
|
287
|
+
family: "properties",
|
|
288
|
+
priority: 4
|
|
289
|
+
},
|
|
290
|
+
cellInserted: {
|
|
291
|
+
type: "coalesce",
|
|
292
|
+
family: "insertion",
|
|
293
|
+
priority: 3
|
|
294
|
+
},
|
|
295
|
+
cellDeleted: {
|
|
296
|
+
type: "coalesce",
|
|
297
|
+
family: "deletion",
|
|
298
|
+
priority: 3
|
|
299
|
+
},
|
|
300
|
+
cellMerged: {
|
|
301
|
+
type: "coalesce",
|
|
302
|
+
family: "merge",
|
|
303
|
+
priority: 3
|
|
304
|
+
},
|
|
305
|
+
cellPropertiesChanged: {
|
|
306
|
+
type: "coalesce",
|
|
307
|
+
family: "properties",
|
|
308
|
+
priority: 3
|
|
309
|
+
},
|
|
310
|
+
paragraphMarkInsertion: {
|
|
311
|
+
type: "coalesce",
|
|
312
|
+
family: "insertion",
|
|
313
|
+
priority: 2
|
|
314
|
+
},
|
|
315
|
+
paragraphMarkDeletion: {
|
|
316
|
+
type: "coalesce",
|
|
317
|
+
family: "deletion",
|
|
318
|
+
priority: 2
|
|
319
|
+
},
|
|
320
|
+
paragraphPropertiesChanged: {
|
|
321
|
+
type: "coalesce",
|
|
322
|
+
family: "properties",
|
|
323
|
+
priority: 2
|
|
324
|
+
},
|
|
325
|
+
sectionPropertiesChanged: { type: "separate" },
|
|
326
|
+
runPropertiesChanged: {
|
|
327
|
+
type: "coalesce",
|
|
328
|
+
family: "properties",
|
|
329
|
+
priority: 1
|
|
330
|
+
}
|
|
327
331
|
};
|
|
328
|
-
const isStructuralType = (
|
|
332
|
+
const isStructuralType = (type) => type !== "insertion" && type !== "deletion" && type !== "replacement";
|
|
329
333
|
const slotByKey = /* @__PURE__ */ new Map();
|
|
330
334
|
const ordered = [];
|
|
331
335
|
const mergeIds = (survivor, dropped) => {
|
|
@@ -340,18 +344,31 @@ function extractTrackedChanges(state) {
|
|
|
340
344
|
ordered.push(entry);
|
|
341
345
|
continue;
|
|
342
346
|
}
|
|
343
|
-
const
|
|
347
|
+
const policy = STRUCTURAL_COALESCING[entry.type];
|
|
348
|
+
if (policy.type === "separate") {
|
|
349
|
+
ordered.push(entry);
|
|
350
|
+
continue;
|
|
351
|
+
}
|
|
352
|
+
const key = `${policy.family}|${entry.author}|${entry.date ?? ""}`;
|
|
344
353
|
const slot = slotByKey.get(key);
|
|
345
354
|
if (slot === void 0) {
|
|
346
|
-
slotByKey.set(key,
|
|
355
|
+
slotByKey.set(key, {
|
|
356
|
+
index: ordered.push(entry) - 1,
|
|
357
|
+
priority: policy.priority
|
|
358
|
+
});
|
|
347
359
|
continue;
|
|
348
360
|
}
|
|
349
|
-
const existing = ordered[slot];
|
|
350
|
-
if (
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
361
|
+
const existing = ordered[slot.index];
|
|
362
|
+
if (policy.priority > slot.priority) {
|
|
363
|
+
ordered[slot.index] = {
|
|
364
|
+
...entry,
|
|
365
|
+
coalescedRevisionIds: mergeIds(entry, existing)
|
|
366
|
+
};
|
|
367
|
+
slotByKey.set(key, {
|
|
368
|
+
index: slot.index,
|
|
369
|
+
priority: policy.priority
|
|
370
|
+
});
|
|
371
|
+
} else ordered[slot.index] = {
|
|
355
372
|
...existing,
|
|
356
373
|
coalescedRevisionIds: mergeIds(existing, entry)
|
|
357
374
|
};
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import { readBlockSdtAttrs, readCharacterSpacingMarkAttrs, readCharacterStyleMarkAttrs, readCommentMarkAttrs, readEmphasisMarkAttrs, readFieldAttrs, readFontFamilyMarkAttrs, readFontSizeMarkAttrs, readFootnoteRefMarkAttrs, readHardBreakAttrs, readHighlightMarkAttrs, readHyperlinkMarkAttrs, readImageAttrs, readLanguageMarkAttrs, readMathAttrs, readPageBreakRunAttrs,
|
|
1
|
+
import { readBlockSdtAttrs, readCharacterSpacingMarkAttrs, readCharacterStyleMarkAttrs, readCommentMarkAttrs, readEmphasisMarkAttrs, readFieldAttrs, readFontFamilyMarkAttrs, readFontSizeMarkAttrs, readFootnoteRefMarkAttrs, readHardBreakAttrs, readHighlightMarkAttrs, readHyperlinkMarkAttrs, readImageAttrs, readInlineWrapperMarkAttrs, readLanguageMarkAttrs, readMathAttrs, readPageBreakRunAttrs, readParagraphAttrs, readPreservedBlockAttrs, readPreservedXmlAttrs, readRunFormattingOverrideMarkAttrs, readRunIdentityMarkAttrs, readRunPropertyChangeMarkAttrs, readRunShadingMarkAttrs, readSdtAttrs, readShapeAttrs, readStrikeMarkAttrs, readSymbolAttrs, readTabAttrs, readTableAttrs, readTableCellAttrs, readTableRowAttrs, readTextBoxAttrs, readTextColorMarkAttrs, readTextEffectMarkAttrs, readTrackedChangeMarkAttrs, readUnderlineMarkAttrs } from "./attrs/index.js";
|
|
2
2
|
import { readBookmarkBoundaryAttrs } from "./bookmarkBoundaryAttrs.js";
|
|
3
|
+
import { readCommentReferenceAttrs } from "./commentReferenceAttrs.js";
|
|
4
|
+
import { INLINE_WRAPPER_MARK_NAME } from "./extensions/marks/InlineWrapperExtension.js";
|
|
5
|
+
import { readMoveRangeBoundaryAttrs } from "./moveRangeBoundaryAttrs.js";
|
|
6
|
+
import { readRangeAnchorAttrs } from "./rangeAnchorAttrs.js";
|
|
3
7
|
import { readTextBoxAnchorAttrs } from "./textBoxAnchorAttrs.js";
|
|
4
8
|
//#region src/prosemirror/validation.ts
|
|
5
9
|
var ProseMirrorDocumentValidationError = class extends Error {
|
|
@@ -83,7 +87,7 @@ const validateBookmarkBoundaryStructure = (doc, issues) => {
|
|
|
83
87
|
path: bookmarkPath
|
|
84
88
|
});
|
|
85
89
|
}
|
|
86
|
-
if (node.type.name === "bookmarkBoundary") {
|
|
90
|
+
if (node.type.name === "bookmarkBoundary" || node.type.name === "blockBookmarkBoundary") {
|
|
87
91
|
const result = readBookmarkBoundaryAttrs(node);
|
|
88
92
|
if (result.ok) {
|
|
89
93
|
const attrs = result.value;
|
|
@@ -140,14 +144,30 @@ const validateNodeAttrs = (node, path, issues) => {
|
|
|
140
144
|
case "pageBreak":
|
|
141
145
|
case "renderedPageBreak": return;
|
|
142
146
|
case "bookmarkBoundary":
|
|
147
|
+
case "blockBookmarkBoundary":
|
|
143
148
|
appendAttrIssues(path, readBookmarkBoundaryAttrs(node), issues);
|
|
144
149
|
return;
|
|
150
|
+
case "commentReference":
|
|
151
|
+
appendAttrIssues(path, readCommentReferenceAttrs(node), issues);
|
|
152
|
+
return;
|
|
153
|
+
case "rangeAnchor":
|
|
154
|
+
appendAttrIssues(path, readRangeAnchorAttrs(node), issues);
|
|
155
|
+
return;
|
|
156
|
+
case "moveRangeBoundary":
|
|
157
|
+
appendAttrIssues(path, readMoveRangeBoundaryAttrs(node), issues);
|
|
158
|
+
return;
|
|
145
159
|
case "tab":
|
|
146
160
|
appendAttrIssues(path, readTabAttrs(node), issues);
|
|
147
161
|
return;
|
|
148
162
|
case "symbol":
|
|
149
163
|
appendAttrIssues(path, readSymbolAttrs(node), issues);
|
|
150
164
|
return;
|
|
165
|
+
case "preservedXml":
|
|
166
|
+
appendAttrIssues(path, readPreservedXmlAttrs(node), issues);
|
|
167
|
+
return;
|
|
168
|
+
case "preservedBlock":
|
|
169
|
+
appendAttrIssues(path, readPreservedBlockAttrs(node), issues);
|
|
170
|
+
return;
|
|
151
171
|
case "hardBreak":
|
|
152
172
|
appendAttrIssues(path, readHardBreakAttrs(node), issues);
|
|
153
173
|
return;
|
|
@@ -184,6 +204,8 @@ const validateNodeAttrs = (node, path, issues) => {
|
|
|
184
204
|
if (fieldAttrs.ok) {
|
|
185
205
|
const hasStructuredHyperlink = node.content.content.some((child) => child.marks.some((mark) => mark.type.name === "hyperlink"));
|
|
186
206
|
const hasPageBreakCarrier = node.content.content.some((child) => child.type.name === "pageBreakRun");
|
|
207
|
+
const hasPreservedCapture = node.content.content.some((child) => child.type.name === "preservedXml");
|
|
208
|
+
const hasInlineWrapper = node.content.content.some((child) => child.marks.some((mark) => mark.type.name === INLINE_WRAPPER_MARK_NAME));
|
|
187
209
|
if (fieldAttrs.value.fieldKind === "complex" && !hasPageBreakCarrier) issues.push({
|
|
188
210
|
path: `${path}.content`,
|
|
189
211
|
message: "Complex fields cannot contain structured result children."
|
|
@@ -192,9 +214,9 @@ const validateNodeAttrs = (node, path, issues) => {
|
|
|
192
214
|
path: `${path}.content`,
|
|
193
215
|
message: "Complex field results cannot contain hyperlink content."
|
|
194
216
|
});
|
|
195
|
-
else if (!hasStructuredHyperlink && !hasPageBreakCarrier) issues.push({
|
|
217
|
+
else if (!hasStructuredHyperlink && !hasPageBreakCarrier && !hasPreservedCapture && !hasInlineWrapper) issues.push({
|
|
196
218
|
path: `${path}.content`,
|
|
197
|
-
message: "Structured simple fields require hyperlink content."
|
|
219
|
+
message: "Structured simple fields require hyperlink, page-break, preserved or wrapper content."
|
|
198
220
|
});
|
|
199
221
|
node.forEach((child, _offset, index) => {
|
|
200
222
|
const childPath = `${path}.content[${index}]`;
|
|
@@ -305,8 +327,8 @@ const validateMarks = (marks, path, issues) => {
|
|
|
305
327
|
case "runPropertyChange":
|
|
306
328
|
appendAttrIssues(markPath, readRunPropertyChangeMarkAttrs(mark), issues);
|
|
307
329
|
continue;
|
|
308
|
-
case "
|
|
309
|
-
appendAttrIssues(markPath,
|
|
330
|
+
case "runIdentity":
|
|
331
|
+
appendAttrIssues(markPath, readRunIdentityMarkAttrs(mark), issues);
|
|
310
332
|
continue;
|
|
311
333
|
case "runFormattingOverride":
|
|
312
334
|
appendAttrIssues(markPath, readRunFormattingOverrideMarkAttrs(mark), issues);
|
|
@@ -314,6 +336,9 @@ const validateMarks = (marks, path, issues) => {
|
|
|
314
336
|
case "hyperlink":
|
|
315
337
|
appendAttrIssues(markPath, readHyperlinkMarkAttrs(mark), issues);
|
|
316
338
|
continue;
|
|
339
|
+
case "inlineWrapper":
|
|
340
|
+
appendAttrIssues(markPath, readInlineWrapperMarkAttrs(mark), issues);
|
|
341
|
+
continue;
|
|
317
342
|
default: issues.push({
|
|
318
343
|
path: `${markPath}.type.name`,
|
|
319
344
|
message: `Unsupported ProseMirror mark type ${mark.type.name}.`
|