@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
|
@@ -1,39 +1,23 @@
|
|
|
1
|
+
import { serializePreservedAttributes } from "../docx/attributeRemainder.js";
|
|
1
2
|
import { serializeBorder } from "../docx/serializer/borderSerializer.js";
|
|
2
3
|
import { serializeShading, serializeTextFormatting } from "../docx/serializer/textFormattingSerializer.js";
|
|
3
4
|
import { intAttr } from "../docx/serializer/xmlUtils.js";
|
|
5
|
+
import { TRANSITIONAL_NAME_BY_STRICT_NAME } from "../docx/strictNames.gen.js";
|
|
4
6
|
import { sanitizeCapturedXmlElement } from "../docx/verbatimCapture.js";
|
|
5
7
|
import { NAMESPACES, OOXML_NAMESPACE_SCOPE } from "../docx/xmlParser.js";
|
|
6
|
-
import { escapeXmlAttribute } from "@stll/docx-core";
|
|
8
|
+
import { escapeXmlAttribute, serializeOnOffElement } from "@stll/docx-core";
|
|
9
|
+
import { outlineLevelStatedValue, paragraphNumberingSlots, sameEffectiveParagraphNumbering } from "@stll/docx-core/model";
|
|
10
|
+
import { serializeSequenceChildren } from "@stll/docx-core/schema";
|
|
7
11
|
//#region src/internal/paragraphFormattingSerialization.ts
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const paragraphNumberingReferencesEqual = (left, right) => {
|
|
18
|
-
const modeledLeft = modelParagraphNumberingReference(left);
|
|
19
|
-
const modeledRight = modelParagraphNumberingReference(right);
|
|
20
|
-
if (modeledLeft === null || modeledRight === null) return modeledLeft === null && modeledRight === null;
|
|
21
|
-
return modeledLeft.numId === modeledRight.numId && (modeledLeft.ilvl ?? 0) === (modeledRight.ilvl ?? 0);
|
|
22
|
-
};
|
|
23
|
-
/** Compare the authored `w:numPr` attributes, including an absent `w:ilvl`. */
|
|
24
|
-
const sameAuthoredParagraphNumberingReference = (left, right) => {
|
|
25
|
-
const modeledLeft = modelParagraphNumberingReference(left);
|
|
26
|
-
const modeledRight = modelParagraphNumberingReference(right);
|
|
27
|
-
if (modeledLeft === null || modeledRight === null) return modeledLeft === null && modeledRight === null;
|
|
28
|
-
return modeledLeft.numId === modeledRight.numId && modeledLeft.ilvl === modeledRight.ilvl;
|
|
29
|
-
};
|
|
30
|
-
/** Whether resolved numbering still belongs to the paragraph's style tier. */
|
|
31
|
-
const isStyleSourcedParagraphNumbering = (numPr, numPrFromStyle) => numPr != null && numPrFromStyle != null && paragraphNumberingReferencesEqual(numPr, numPrFromStyle);
|
|
32
|
-
const serializeToggle = (name, value) => {
|
|
33
|
-
if (value === true) return `<w:${name}/>`;
|
|
34
|
-
if (value === false) return `<w:${name} w:val="0"/>`;
|
|
35
|
-
return "";
|
|
36
|
-
};
|
|
12
|
+
/**
|
|
13
|
+
* Whether resolved numbering still belongs to the paragraph's style tier.
|
|
14
|
+
*
|
|
15
|
+
* Effective equality, not stated: the resolved field carries the level the
|
|
16
|
+
* cascade supplied even where the style stated none, and a paragraph whose
|
|
17
|
+
* numbering came wholly from its style must still not emit a direct
|
|
18
|
+
* `<w:numPr>`.
|
|
19
|
+
*/
|
|
20
|
+
const isStyleSourcedParagraphNumbering = (numPr, numPrFromStyle) => numPr != null && numPrFromStyle != null && sameEffectiveParagraphNumbering(numPr, numPrFromStyle);
|
|
37
21
|
const serializeParagraphBorders = (borders) => {
|
|
38
22
|
if (!borders) return "";
|
|
39
23
|
const { top, left, bottom, right, between, bar } = borders;
|
|
@@ -50,10 +34,10 @@ const serializeParagraphBorders = (borders) => {
|
|
|
50
34
|
const serializeTabStops = (tabs) => {
|
|
51
35
|
if (!tabs || tabs.length === 0) return "";
|
|
52
36
|
return `<w:tabs>${tabs.map((tab) => {
|
|
53
|
-
const { alignment, position, leader } = tab;
|
|
37
|
+
const { alignment, position, leader, preservedAttributes } = tab;
|
|
54
38
|
const attrs = [`w:val="${alignment}"`, `w:pos="${intAttr(position)}"`];
|
|
55
39
|
if (leader && leader !== "none") attrs.push(`w:leader="${leader}"`);
|
|
56
|
-
return `<w:tab ${attrs.join(" ")}/>`;
|
|
40
|
+
return `<w:tab ${serializePreservedAttributes(attrs, preservedAttributes).join(" ")}/>`;
|
|
57
41
|
}).join("")}</w:tabs>`;
|
|
58
42
|
};
|
|
59
43
|
const serializeSpacing = (formatting) => {
|
|
@@ -64,18 +48,29 @@ const serializeSpacing = (formatting) => {
|
|
|
64
48
|
if (formatting.lineSpacingRule) attrs.push(`w:lineRule="${formatting.lineSpacingRule}"`);
|
|
65
49
|
if (formatting.beforeAutospacing !== void 0) attrs.push(`w:beforeAutospacing="${formatting.beforeAutospacing ? "1" : "0"}"`);
|
|
66
50
|
if (formatting.afterAutospacing !== void 0) attrs.push(`w:afterAutospacing="${formatting.afterAutospacing ? "1" : "0"}"`);
|
|
67
|
-
|
|
51
|
+
const written = serializePreservedAttributes(attrs, formatting.spacingPreservedAttributes);
|
|
52
|
+
return written.length === 0 ? "" : `<w:spacing ${written.join(" ")}/>`;
|
|
68
53
|
};
|
|
54
|
+
/**
|
|
55
|
+
* The edge names folio writes, from the table the census reads.
|
|
56
|
+
*
|
|
57
|
+
* A Strict producer spells these `@w:start` and `@w:end`; folio writes one
|
|
58
|
+
* spelling, and taking it from the generated table is what keeps the writer and
|
|
59
|
+
* the survival law's equivalence from drifting apart.
|
|
60
|
+
*/
|
|
61
|
+
const INDENT_LEFT = TRANSITIONAL_NAME_BY_STRICT_NAME["CT_Ind @start"];
|
|
62
|
+
const INDENT_RIGHT = TRANSITIONAL_NAME_BY_STRICT_NAME["CT_Ind @end"];
|
|
69
63
|
const serializeIndentation = (formatting) => {
|
|
70
64
|
const attrs = [];
|
|
71
|
-
if (formatting.indentLeft !== void 0) attrs.push(`w
|
|
72
|
-
if (formatting.indentRight !== void 0) attrs.push(`w
|
|
65
|
+
if (formatting.indentLeft !== void 0) attrs.push(`w:${INDENT_LEFT}="${intAttr(formatting.indentLeft)}"`);
|
|
66
|
+
if (formatting.indentRight !== void 0) attrs.push(`w:${INDENT_RIGHT}="${intAttr(formatting.indentRight)}"`);
|
|
73
67
|
if (formatting.indentFirstLine !== void 0) {
|
|
74
68
|
const attribute = formatting.hangingIndent ? "hanging" : "firstLine";
|
|
75
69
|
const value = formatting.hangingIndent ? Math.abs(formatting.indentFirstLine) : formatting.indentFirstLine;
|
|
76
70
|
attrs.push(`w:${attribute}="${intAttr(value)}"`);
|
|
77
71
|
}
|
|
78
|
-
|
|
72
|
+
const written = serializePreservedAttributes(attrs, formatting.indentPreservedAttributes);
|
|
73
|
+
return written.length === 0 ? "" : `<w:ind ${written.join(" ")}/>`;
|
|
79
74
|
};
|
|
80
75
|
/**
|
|
81
76
|
* `w:numPr`, with the tracked record of the numbering it replaced.
|
|
@@ -88,10 +83,10 @@ const serializeIndentation = (formatting) => {
|
|
|
88
83
|
* it last in `CT_NumPr`, after `w:ilvl` and `w:numId`.
|
|
89
84
|
*/
|
|
90
85
|
const serializeNumbering = (numPr, numberingChangeXml) => {
|
|
91
|
-
const
|
|
86
|
+
const slots = numPr === void 0 ? {} : paragraphNumberingSlots(numPr);
|
|
92
87
|
const parts = [];
|
|
93
|
-
if (
|
|
94
|
-
if (
|
|
88
|
+
if (slots.ilvl !== void 0) parts.push(`<w:ilvl w:val="${intAttr(slots.ilvl)}"/>`);
|
|
89
|
+
if (slots.numId !== void 0) parts.push(`<w:numId w:val="${intAttr(slots.numId)}"/>`);
|
|
95
90
|
const change = replayableNumberingChangeXml(numberingChangeXml);
|
|
96
91
|
if (change !== null) parts.push(change);
|
|
97
92
|
return parts.length === 0 ? "" : `<w:numPr>${parts.join("")}</w:numPr>`;
|
|
@@ -105,7 +100,7 @@ const replayableNumberingChangeXml = (numberingChangeXml) => sanitizeCapturedXml
|
|
|
105
100
|
});
|
|
106
101
|
const serializeFrameProperties = (frame) => {
|
|
107
102
|
if (!frame) return "";
|
|
108
|
-
const { dropCap, lines, width, height, hSpace, vSpace, hAnchor, vAnchor, x, y, xAlign, yAlign, wrap } = frame;
|
|
103
|
+
const { dropCap, lines, width, height, hSpace, vSpace, hAnchor, vAnchor, x, y, xAlign, yAlign, wrap, preservedAttributes } = frame;
|
|
109
104
|
const attrs = [];
|
|
110
105
|
if (dropCap) attrs.push(`w:dropCap="${dropCap}"`);
|
|
111
106
|
if (lines !== void 0) attrs.push(`w:lines="${intAttr(lines)}"`);
|
|
@@ -120,16 +115,35 @@ const serializeFrameProperties = (frame) => {
|
|
|
120
115
|
if (xAlign) attrs.push(`w:xAlign="${xAlign}"`);
|
|
121
116
|
if (yAlign) attrs.push(`w:yAlign="${yAlign}"`);
|
|
122
117
|
if (wrap) attrs.push(`w:wrap="${wrap}"`);
|
|
123
|
-
|
|
118
|
+
const written = serializePreservedAttributes(attrs, preservedAttributes);
|
|
119
|
+
return written.length === 0 ? "" : `<w:framePr ${written.join(" ")}/>`;
|
|
124
120
|
};
|
|
125
121
|
const modelSpacingProvenance = (spacingExplicit) => {
|
|
126
122
|
if (spacingExplicit) {
|
|
127
123
|
const { before: _before, after: _after } = spacingExplicit;
|
|
128
124
|
}
|
|
129
125
|
};
|
|
130
|
-
const
|
|
131
|
-
|
|
132
|
-
|
|
126
|
+
const MARK_PROPERTIES_EMPTY = "<w:rPr/>";
|
|
127
|
+
/**
|
|
128
|
+
* The paragraph mark's `w:rPr`, without its element, as the one `w:rPr` writer
|
|
129
|
+
* composes it.
|
|
130
|
+
*
|
|
131
|
+
* Three answers rather than two: `undefined` when the mark carried no property
|
|
132
|
+
* set, `""` when it carried an empty one, and the inner markup otherwise.
|
|
133
|
+
* Collapsing the middle case onto the first is what dropped `<w:rPr/>`: the
|
|
134
|
+
* element is optional, so writing one is not the same as writing none, and on
|
|
135
|
+
* the paragraph mark it is the slot a revision on the mark lives in.
|
|
136
|
+
*
|
|
137
|
+
* The caller re-wraps it with the mark's own revision in front, so this side
|
|
138
|
+
* hands back the inner markup rather than the element. `w:specVanish` travels
|
|
139
|
+
* as an owned child instead of being appended, because `EG_RPrBase` declares
|
|
140
|
+
* it between `w:eastAsianLayout` and `w:oMath` rather than last.
|
|
141
|
+
*/
|
|
142
|
+
const paragraphMarkPropertiesInner = (runProperties, runInWithNext) => {
|
|
143
|
+
const xml = serializeTextFormatting(runProperties, runInWithNext === void 0 ? [] : [["specVanish", serializeOnOffElement(runInWithNext, "specVanish")]]);
|
|
144
|
+
if (xml === "") return;
|
|
145
|
+
if (xml === MARK_PROPERTIES_EMPTY) return "";
|
|
146
|
+
return xml.slice(7, -8);
|
|
133
147
|
};
|
|
134
148
|
/**
|
|
135
149
|
* Resolve paragraph formatting into its exact fallback `w:pPr` instructions.
|
|
@@ -138,48 +152,69 @@ const extractRunPropertiesInnerXml = (runPropertiesXml) => {
|
|
|
138
152
|
*/
|
|
139
153
|
const modelParagraphFormattingEmission = (input) => {
|
|
140
154
|
if (!input) return {};
|
|
141
|
-
const { alignment, bidi, kinsoku, overflowPunctuation, spaceBefore, spaceAfter, lineSpacing, lineSpacingRule, snapToGrid, beforeAutospacing, afterAutospacing, spacingExplicit, indentLeft, indentRight, indentFirstLine, hangingIndent, borders, shading, tabs, keepNext, keepLines, widowControl, pageBreakBefore, contextualSpacing, numPr, numPrFromStyle, numberingChangeXml, outlineLevel, styleId, frame, suppressLineNumbers, suppressAutoHyphens, runProperties, runInWithNext } = input;
|
|
155
|
+
const { alignment, bidi, kinsoku, overflowPunctuation, spaceBefore, spaceAfter, lineSpacing, lineSpacingRule, snapToGrid, beforeAutospacing, afterAutospacing, spacingExplicit, spacingPreservedAttributes, indentLeft, indentRight, indentFirstLine, hangingIndent, indentPreservedAttributes, borders, shading, tabs, keepNext, keepLines, widowControl, pageBreakBefore, contextualSpacing, numPr, numPrFromStyle, numberingChangeXml, outlineLevel, styleId, frame, suppressLineNumbers, suppressAutoHyphens, runProperties, runInWithNext, preserved } = input;
|
|
142
156
|
modelSpacingProvenance(spacingExplicit);
|
|
143
|
-
const propertiesXml =
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
157
|
+
const propertiesXml = serializeSequenceChildren({
|
|
158
|
+
container: "paragraph-properties",
|
|
159
|
+
preserved,
|
|
160
|
+
modelled: [
|
|
161
|
+
["pStyle", styleId ? `<w:pStyle w:val="${escapeXmlAttribute(styleId)}"/>` : ""],
|
|
162
|
+
["keepNext", serializeOnOffElement(keepNext, "keepNext")],
|
|
163
|
+
["keepLines", serializeOnOffElement(keepLines, "keepLines")],
|
|
164
|
+
["pageBreakBefore", serializeOnOffElement(pageBreakBefore, "pageBreakBefore")],
|
|
165
|
+
["framePr", serializeFrameProperties(frame)],
|
|
166
|
+
["widowControl", serializeOnOffElement(widowControl, "widowControl")],
|
|
167
|
+
["numPr", isStyleSourcedParagraphNumbering(numPr, numPrFromStyle) ? serializeNumbering(void 0, numberingChangeXml) : serializeNumbering(numPr, numberingChangeXml)],
|
|
168
|
+
["suppressLineNumbers", serializeOnOffElement(suppressLineNumbers, "suppressLineNumbers")],
|
|
169
|
+
["pBdr", serializeParagraphBorders(borders)],
|
|
170
|
+
["shd", serializeShading(shading)],
|
|
171
|
+
["tabs", serializeTabStops(tabs)],
|
|
172
|
+
["suppressAutoHyphens", serializeOnOffElement(suppressAutoHyphens, "suppressAutoHyphens")],
|
|
173
|
+
["kinsoku", serializeOnOffElement(kinsoku, "kinsoku")],
|
|
174
|
+
["overflowPunct", serializeOnOffElement(overflowPunctuation, "overflowPunct")],
|
|
175
|
+
["bidi", serializeOnOffElement(bidi, "bidi")],
|
|
176
|
+
["snapToGrid", serializeOnOffElement(snapToGrid, "snapToGrid")],
|
|
177
|
+
["spacing", serializeSpacing({
|
|
178
|
+
spaceBefore,
|
|
179
|
+
spaceAfter,
|
|
180
|
+
lineSpacing,
|
|
181
|
+
lineSpacingRule,
|
|
182
|
+
beforeAutospacing,
|
|
183
|
+
afterAutospacing,
|
|
184
|
+
spacingPreservedAttributes
|
|
185
|
+
})],
|
|
186
|
+
["ind", serializeIndentation({
|
|
187
|
+
indentLeft,
|
|
188
|
+
indentRight,
|
|
189
|
+
indentFirstLine,
|
|
190
|
+
hangingIndent,
|
|
191
|
+
indentPreservedAttributes
|
|
192
|
+
})],
|
|
193
|
+
["contextualSpacing", serializeOnOffElement(contextualSpacing, "contextualSpacing")],
|
|
194
|
+
["jc", alignment ? `<w:jc w:val="${alignment}"/>` : ""],
|
|
195
|
+
["outlineLvl", outlineLevel === void 0 ? "" : `<w:outlineLvl w:val="${outlineLevelStatedValue(outlineLevel)}"/>`]
|
|
196
|
+
]
|
|
197
|
+
}).join("");
|
|
198
|
+
const paragraphMarkPropertiesInnerXml = paragraphMarkPropertiesInner(runProperties, runInWithNext);
|
|
179
199
|
const emission = {};
|
|
180
200
|
if (propertiesXml) emission.propertiesXml = propertiesXml;
|
|
181
|
-
if (paragraphMarkPropertiesInnerXml) emission.paragraphMarkPropertiesInnerXml = paragraphMarkPropertiesInnerXml;
|
|
201
|
+
if (paragraphMarkPropertiesInnerXml !== void 0) emission.paragraphMarkPropertiesInnerXml = paragraphMarkPropertiesInnerXml;
|
|
182
202
|
return emission;
|
|
183
203
|
};
|
|
204
|
+
/** Serialize the shared `w:pPr` shape in schema order for all four owners. */
|
|
205
|
+
const serializeParagraphPropertySet = ({ formatting, markPropertiesPrefixXml = "", sectionPropertiesXml = "", propertyChangesXml = [] }) => {
|
|
206
|
+
const modeled = modelParagraphFormattingEmission(formatting);
|
|
207
|
+
const markProperties = modeled.paragraphMarkPropertiesInnerXml;
|
|
208
|
+
const markInner = `${markPropertiesPrefixXml}${markProperties ?? ""}`;
|
|
209
|
+
let markXml = "";
|
|
210
|
+
if (markPropertiesPrefixXml !== "" || markProperties !== void 0) markXml = markInner === "" ? "<w:rPr/>" : `<w:rPr>${markInner}</w:rPr>`;
|
|
211
|
+
const inner = [
|
|
212
|
+
modeled.propertiesXml ?? "",
|
|
213
|
+
markXml,
|
|
214
|
+
sectionPropertiesXml,
|
|
215
|
+
...propertyChangesXml
|
|
216
|
+
].join("");
|
|
217
|
+
return inner === "" ? "" : `<w:pPr>${inner}</w:pPr>`;
|
|
218
|
+
};
|
|
184
219
|
//#endregion
|
|
185
|
-
export { isStyleSourcedParagraphNumbering, modelParagraphFormattingEmission,
|
|
220
|
+
export { isStyleSourcedParagraphNumbering, modelParagraphFormattingEmission, serializeParagraphPropertySet };
|
|
@@ -6,6 +6,7 @@ type MeasureBlocksFn = (blocks: FlowBlock[], contentWidth: number) => Measure[];
|
|
|
6
6
|
type ConvertFootnoteOptions = {
|
|
7
7
|
styles?: document_d_exports.StyleDefinitions | null;
|
|
8
8
|
theme?: document_d_exports.Theme | null;
|
|
9
|
+
defaultSize?: number;
|
|
9
10
|
fontAlternates?: ToFlowBlocksOptions["fontAlternates"];
|
|
10
11
|
measureBlocks?: MeasureBlocksFn;
|
|
11
12
|
/** Document-wide `w:defaultTabStop` in twips — forwarded to toFlowBlocks. */
|
|
@@ -197,6 +197,7 @@ function convertFootnoteToContent(footnote, displayNumber, contentWidth, options
|
|
|
197
197
|
if (options.theme !== void 0) proseOptions.theme = options.theme;
|
|
198
198
|
const pmDoc = footnoteToProseDoc(footnote.content, proseOptions);
|
|
199
199
|
const flowOptions = {};
|
|
200
|
+
if (options.defaultSize !== void 0) flowOptions.defaultSize = options.defaultSize;
|
|
200
201
|
if (options.styles) flowOptions.styles = options.styles;
|
|
201
202
|
if (options.theme !== void 0) flowOptions.theme = options.theme;
|
|
202
203
|
if (options.fontAlternates !== void 0) flowOptions.fontAlternates = options.fontAlternates;
|
|
@@ -47,6 +47,7 @@ declare function calculateHeaderFooterBodyTopClearance(blocks: FlowBlock[], flow
|
|
|
47
47
|
type ConvertHeaderFooterOptions = {
|
|
48
48
|
styles?: document_d_exports.StyleDefinitions | null;
|
|
49
49
|
theme?: document_d_exports.Theme | null;
|
|
50
|
+
defaultSize?: number;
|
|
50
51
|
fontAlternates?: ToFlowBlocksOptions["fontAlternates"];
|
|
51
52
|
measureBlocks: MeasureBlocksFn;
|
|
52
53
|
/** Document-wide `w:defaultTabStop` in twips — forwarded to toFlowBlocks. */
|
|
@@ -359,6 +359,7 @@ function convertHeaderFooterToContent(headerFooter, contentWidth, metrics, optio
|
|
|
359
359
|
if (options.theme !== void 0) proseDocOptions.theme = options.theme;
|
|
360
360
|
const pmDoc = headerFooter.watermarkBlockIndex === void 0 ? headerFooterToProseDoc(headerFooter.content, proseDocOptions) : headerFooterToProseDocWithDetachedWatermarkHost(headerFooter, proseDocOptions);
|
|
361
361
|
const flowOptions = {};
|
|
362
|
+
if (options.defaultSize !== void 0) flowOptions.defaultSize = options.defaultSize;
|
|
362
363
|
if (options.styles) flowOptions.styles = options.styles;
|
|
363
364
|
if (options.theme !== void 0) flowOptions.theme = options.theme;
|
|
364
365
|
if (options.fontAlternates !== void 0) flowOptions.fontAlternates = options.fontAlternates;
|
|
@@ -383,6 +384,7 @@ function convertHeaderFooterToContent(headerFooter, contentWidth, metrics, optio
|
|
|
383
384
|
function convertHeaderFooterPmDocToContent(pmDoc, contentWidth, metrics, options) {
|
|
384
385
|
if (!pmDoc || pmDoc.content.size === 0) return;
|
|
385
386
|
const flowOptions = {};
|
|
387
|
+
if (options.defaultSize !== void 0) flowOptions.defaultSize = options.defaultSize;
|
|
386
388
|
if (options.styles) flowOptions.styles = options.styles;
|
|
387
389
|
if (options.theme !== void 0) flowOptions.theme = options.theme;
|
|
388
390
|
if (options.fontAlternates !== void 0) flowOptions.fontAlternates = options.fontAlternates;
|
|
@@ -69,25 +69,30 @@ type ToFlowBlocksOptions = {
|
|
|
69
69
|
/** Line pitch for the final body section, whose properties live outside the PM body. */
|
|
70
70
|
finalSectionDocumentGridLinePitchTwips?: number;
|
|
71
71
|
};
|
|
72
|
+
/**
|
|
73
|
+
* Word's layout fallback when an imported OOXML style hierarchy never supplies
|
|
74
|
+
* `w:sz`. ECMA-376 deliberately leaves that terminal fallback to the consumer;
|
|
75
|
+
* this value matches Word and is therefore applied by the DOCX composition
|
|
76
|
+
* roots, while standalone ProseMirror documents keep the layout engine's 11pt
|
|
77
|
+
* default.
|
|
78
|
+
*/
|
|
79
|
+
declare const WORD_UNSPECIFIED_FONT_SIZE = 10;
|
|
72
80
|
/**
|
|
73
81
|
* Reset the block ID counter (useful for testing).
|
|
74
82
|
*/
|
|
75
83
|
declare function resetBlockIdCounter(): void;
|
|
84
|
+
/** A parsed border, or the same shape read off ProseMirror attributes. */
|
|
85
|
+
type ConvertibleBorder = {
|
|
86
|
+
style?: document_d_exports.BorderStyleValue;
|
|
87
|
+
size?: number;
|
|
88
|
+
space?: number;
|
|
89
|
+
color?: document_d_exports.ColorValue;
|
|
90
|
+
};
|
|
76
91
|
/**
|
|
77
92
|
* Convert an OOXML BorderSpec to a layout-engine BorderStyle.
|
|
78
93
|
* Shared by paragraph borders, cell borders, and header/footer borders.
|
|
79
94
|
*/
|
|
80
|
-
declare function convertBorderSpecToLayout(border:
|
|
81
|
-
style?: string;
|
|
82
|
-
size?: number;
|
|
83
|
-
space?: number;
|
|
84
|
-
color?: {
|
|
85
|
-
rgb?: string;
|
|
86
|
-
themeColor?: string;
|
|
87
|
-
themeTint?: string;
|
|
88
|
-
themeShade?: string;
|
|
89
|
-
};
|
|
90
|
-
}, theme?: document_d_exports.Theme | null): BorderStyle | undefined;
|
|
95
|
+
declare function convertBorderSpecToLayout(border: ConvertibleBorder, theme?: document_d_exports.Theme | null): BorderStyle | undefined;
|
|
91
96
|
/**
|
|
92
97
|
* Convert a ProseMirror document to FlowBlock array.
|
|
93
98
|
*
|
|
@@ -96,4 +101,4 @@ declare function convertBorderSpecToLayout(border: {
|
|
|
96
101
|
*/
|
|
97
102
|
declare function toFlowBlocks(doc: Node, options?: ToFlowBlocksOptions): FlowBlock[];
|
|
98
103
|
//#endregion
|
|
99
|
-
export { ToFlowBlocksOptions, convertBorderSpecToLayout, formatCounter, resetBlockIdCounter, resolveListTemplate, toFlowBlocks };
|
|
104
|
+
export { ToFlowBlocksOptions, WORD_UNSPECIFIED_FONT_SIZE, convertBorderSpecToLayout, formatCounter, resetBlockIdCounter, resolveListTemplate, toFlowBlocks };
|