@stll/folio-core 0.46.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 +26 -24
- package/dist/ai-edits/headless.js +1 -1
- 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/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/section-boundary-properties.js +1 -2
- package/dist/content-controls/checkboxDisplay.d.ts +8 -2
- package/dist/content-controls/checkboxDisplay.js +11 -5
- package/dist/content-controls/mutateContentControls.js +41 -42
- package/dist/controller/layoutPipeline.js +8 -3
- package/dist/display-list/build/buildDisplayList.js +7 -7
- package/dist/display-list/build/imagePrimitives.d.ts +4 -4
- package/dist/display-list/build/imagePrimitives.js +38 -20
- package/dist/display-list/build/pageBorderPrimitives.js +2 -1
- package/dist/display-list/build/paragraphPrimitives.js +93 -13
- 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 +1 -19
- package/dist/display-list/primitives.d.ts +13 -2
- package/dist/display-list/primitives.js +36 -1
- package/dist/document-operations.js +2 -1
- package/dist/docx/attributeRemainder.d.ts +34 -1
- package/dist/docx/attributeRemainder.js +49 -3
- package/dist/docx/blockContentParser.d.ts +2 -0
- package/dist/docx/blockContentParser.js +39 -67
- package/dist/docx/blockPlainText.js +3 -1
- 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.js +1 -1
- package/dist/docx/commentParser.js +3 -3
- package/dist/docx/commentRangeIntegrity.js +1 -1
- package/dist/docx/commentRangeJoin.js +1 -1
- package/dist/docx/commentReferenceNormalization.js +3 -2
- package/dist/docx/commentReplyMarkers.js +1 -1
- package/dist/docx/compatibility.js +56 -42
- package/dist/docx/containerChildren.d.ts +110 -13
- package/dist/docx/containerChildren.gen.d.ts +16 -1
- package/dist/docx/containerChildren.gen.js +18 -1
- package/dist/docx/containerChildren.js +63 -13
- package/dist/docx/diagramPreview.d.ts +14 -2
- package/dist/docx/diagramPreview.js +81 -169
- package/dist/docx/documentParser.js +4 -1
- 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/fontTableParser.js +102 -41
- package/dist/docx/footnoteParser.js +10 -6
- package/dist/docx/groupDrawingParser.js +4 -3
- package/dist/docx/headerFooterReferenceNormalization.js +1 -1
- package/dist/docx/hyperlinkParser.d.ts +45 -7
- package/dist/docx/hyperlinkParser.js +126 -57
- package/dist/docx/imageParser.js +127 -107
- 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 +84 -3
- package/dist/docx/inlineWrapperContent.js +85 -4
- 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 +4 -2
- 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 +91 -1
- package/dist/docx/paraIdAttribute.js +79 -1
- package/dist/docx/paragraphParser.d.ts +9 -24
- package/dist/docx/paragraphParser.js +212 -396
- package/dist/docx/paragraphProperties.d.ts +23 -0
- package/dist/docx/paragraphProperties.js +279 -0
- package/dist/docx/paragraphPropertySource.js +2 -0
- package/dist/docx/paragraphTextBoxEnrichment.d.ts +2 -1
- package/dist/docx/paragraphTextBoxEnrichment.js +14 -7
- package/dist/docx/paragraphTraversal.d.ts +14 -10
- package/dist/docx/paragraphTraversal.js +47 -49
- package/dist/docx/parseWarningMessage.js +3 -0
- package/dist/docx/parserEnums.d.ts +6 -8
- package/dist/docx/parserEnums.js +4 -6
- package/dist/docx/preservedRunContent.js +16 -6
- 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 +2 -2
- package/dist/docx/rezip.d.ts +28 -2
- package/dist/docx/rezip.js +78 -9
- package/dist/docx/runConsolidator.d.ts +42 -2
- package/dist/docx/runConsolidator.js +60 -6
- package/dist/docx/runParser.d.ts +54 -18
- package/dist/docx/runParser.js +379 -295
- 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 +236 -240
- package/dist/docx/selectiveSave.js +3 -2
- package/dist/docx/selectiveXmlPatch.d.ts +21 -2
- package/dist/docx/selectiveXmlPatch.js +195 -99
- package/dist/docx/serializer/blockSdtSerializer.js +2 -96
- package/dist/docx/serializer/borderSerializer.d.ts +5 -5
- package/dist/docx/serializer/borderSerializer.js +10 -8
- package/dist/docx/serializer/documentSerializer.js +3 -0
- package/dist/docx/serializer/fontTableSerializer.js +31 -3
- package/dist/docx/serializer/headerFooterSerializer.js +3 -0
- package/dist/docx/serializer/markupRangeAttributes.d.ts +9 -1
- package/dist/docx/serializer/markupRangeAttributes.js +9 -1
- package/dist/docx/serializer/noteSerializer.js +3 -0
- 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 +88 -188
- package/dist/docx/serializer/runSerializer.d.ts +1 -5
- package/dist/docx/serializer/runSerializer.js +109 -59
- package/dist/docx/serializer/sdtPropertiesSerializer.d.ts +26 -0
- package/dist/docx/serializer/sdtPropertiesSerializer.js +111 -0
- package/dist/docx/serializer/sectionPropertiesSerializer.js +34 -45
- package/dist/docx/serializer/settingsSerializer.js +6 -4
- package/dist/docx/serializer/stylesSerializer.js +8 -11
- package/dist/docx/serializer/tableSerializer.js +268 -100
- 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 +18 -16
- package/dist/docx/server/migrateYjsAttrSchema.js +3 -3
- 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 +8 -3
- 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 +10 -1
- package/dist/docx/tableParser.js +505 -181
- package/dist/docx/textBoxParser.d.ts +3 -1
- package/dist/docx/textBoxParser.js +18 -8
- 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/vmlImageParser.d.ts +13 -4
- package/dist/docx/vmlImageParser.js +74 -31
- 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/xmlParser.d.ts +14 -1
- package/dist/docx/xmlParser.js +18 -2
- package/dist/fonts/embeddedFonts.js +3 -3
- package/dist/headless-layout.js +2 -0
- 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/internal/headlessRevisionResolution.js +9 -0
- package/dist/internal/pageBreakRunSourceDescendantIndex.js +3 -1
- 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 +177 -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/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 +47 -17
- package/dist/layout-engine/types.js +16 -1
- package/dist/layout-painter/borderStroke.d.ts +18 -4
- package/dist/layout-painter/renderPage.js +6 -4
- package/dist/layout-painter/renderParagraph.d.ts +2 -1
- package/dist/layout-painter/renderParagraph.js +13 -26
- 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/markdown/renderBlock.js +3 -1
- package/dist/markdown/renderRuns.js +7 -2
- package/dist/markdown/renderTable.js +2 -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/prosemirror/attrs/index.d.ts +22 -4
- package/dist/prosemirror/attrs/index.js +498 -60
- 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 +24 -19
- package/dist/prosemirror/commands/image.d.ts +1 -1
- package/dist/prosemirror/commands/image.js +4 -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/conversion/fromProseDoc.d.ts +18 -2
- package/dist/prosemirror/conversion/fromProseDoc.js +330 -183
- 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.js +371 -141
- package/dist/prosemirror/emptyRangeAnchor.d.ts +53 -0
- package/dist/prosemirror/emptyRangeAnchor.js +158 -0
- package/dist/prosemirror/extensions/StarterKit.js +8 -2
- package/dist/prosemirror/extensions/core/DocExtension.js +1 -1
- package/dist/prosemirror/extensions/core/ParagraphExtension.js +19 -15
- package/dist/prosemirror/extensions/features/BaseKeymapExtension.js +3 -2
- package/dist/prosemirror/extensions/features/ListExtension.js +43 -24
- 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 +26 -2
- package/dist/prosemirror/extensions/markRegistry.js +73 -10
- package/dist/prosemirror/extensions/marks/InlineWrapperExtension.js +17 -3
- 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.js +2 -1
- 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.js +10 -0
- package/dist/prosemirror/extensions/nodes/ImageExtension.js +8 -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/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 +4 -0
- package/dist/prosemirror/extensions/nodes/TableExtension.js +141 -123
- package/dist/prosemirror/extensions/nodes/TextBoxExtension.js +4 -0
- 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.js +20 -3
- 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/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 +1 -1
- package/dist/prosemirror/replacedAnnotations.js +24 -6
- package/dist/prosemirror/revisionCarriers.d.ts +86 -2
- package/dist/prosemirror/revisionCarriers.js +86 -60
- package/dist/prosemirror/runFormattingInlineCarriers.d.ts +2 -0
- package/dist/prosemirror/runFormattingInlineCarriers.js +2 -0
- 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 +2 -2
- package/dist/prosemirror/schema/marks.d.ts +23 -4
- package/dist/prosemirror/schema/nodes.d.ts +220 -24
- 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 +2 -0
- package/dist/prosemirror/trackedRunInlineAtoms.js +2 -0
- package/dist/prosemirror/utils/extractTrackedChanges.d.ts +10 -11
- package/dist/prosemirror/utils/extractTrackedChanges.js +109 -92
- package/dist/prosemirror/validation.js +17 -6
- package/dist/prosemirror/yjsDocumentMetadata.d.ts +2 -2
- package/dist/prosemirror/yjsDocumentMetadata.js +428 -7
- package/dist/prosemirror/zeroWidthAnchors.js +4 -0
- 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/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/mergeDocumentContent.js +5 -3
- package/dist/utils/paragraphFormattingMerge.js +27 -6
- package/dist/utils/replaceText.js +1 -1
- 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/bookmarkPlacement.d.ts +0 -9
- package/dist/docx/bookmarkPlacement.js +0 -52
- 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
|
@@ -10,11 +10,11 @@ import { getParagraphFragmentPmRange } from "./paragraphFragmentRange.js";
|
|
|
10
10
|
import { collapseParagraphSpacing, getParagraphSpacingAfter, getParagraphSpacingBefore, isEmptyParagraph, paragraphsShareStyle, resolveEffectiveParagraphSpacingTree } from "./paragraphSpacing.js";
|
|
11
11
|
import { assertExhaustiveFlowBlock, findPageIndexContainingPmPos } from "./pmPageIndex.js";
|
|
12
12
|
import { INITIAL_RENDERED_BREAK_STATE, PAGE_ADVANCE, reconcileAfterBlock, reconcileBreakBeforeBlock, recordReflowBoundary } from "./renderedBreakReconciliation.js";
|
|
13
|
-
import { applyPendingToActive, createInitialSectionState, getEffectiveColumns, getEffectiveMargins, getEffectivePageSize, normalizeSectionBreakType, scheduleSectionBreak } from "./section-breaks.js";
|
|
13
|
+
import { applyPendingToActive, createInitialSectionState, getEffectiveColumns, getEffectiveMargins, getEffectivePageSize, normalizeSectionBreakType, physicalColumnRegionIsShared, scheduleSectionBreak } from "./section-breaks.js";
|
|
14
14
|
import { applySectionVerticalAlignment } from "./sectionVerticalAlignment.js";
|
|
15
15
|
import { buildTableRowBreakInfo, getRowContinuationSkip, snapRowBreak } from "./tableRowBreak.js";
|
|
16
16
|
import { bandFragmentX, bandTopContentY, isPageFrameRelativeAnchor } from "./textBoxFlow.js";
|
|
17
|
-
import { DEFAULT_TEXTBOX_MARGINS, DEFAULT_TEXTBOX_WIDTH, FOOTNOTE_ENTRY_MARGIN_BOTTOM, FOOTNOTE_FALLBACK_LINE_HEIGHT, FOOTNOTE_SEPARATOR_HEIGHT, floatingTextBoxReservesBand, floatingTextBoxWrapsText, getTableRowLeadingWidth, isFloatingImageRun, isFloatingTextBoxBlock, isTextWrappingFloatingImageRun, resolveTableCellPadding, resolveTableWidthPx, tableColumnsArePinned } from "./types.js";
|
|
17
|
+
import { DEFAULT_TEXTBOX_MARGINS, DEFAULT_TEXTBOX_WIDTH, FOOTNOTE_ENTRY_MARGIN_BOTTOM, FOOTNOTE_FALLBACK_LINE_HEIGHT, FOOTNOTE_SEPARATOR_HEIGHT, floatingTextBoxReservesBand, floatingTextBoxWrapsText, getTableRowLeadingWidth, isFloatingImageRun, isFloatingTextBoxBlock, isListNumPr, isTextWrappingFloatingImageRun, resolveTableCellPadding, resolveTableWidthPx, tableColumnsArePinned } from "./types.js";
|
|
18
18
|
import { panic } from "better-result";
|
|
19
19
|
//#region src/layout-engine/index.ts
|
|
20
20
|
/**
|
|
@@ -979,13 +979,45 @@ function isPagePinnedBandTextBox(block) {
|
|
|
979
979
|
return isPageFrameRelativeAnchor(block.position?.vertical?.relativeTo);
|
|
980
980
|
}
|
|
981
981
|
/**
|
|
982
|
+
* Start the next section in the current page region, below the outgoing
|
|
983
|
+
* content.
|
|
984
|
+
*
|
|
985
|
+
* ECMA-376 §17.6.22: a `continuous` break normally keeps the current page
|
|
986
|
+
* geometry and defers the new size/margins to the next natural page break. But
|
|
987
|
+
* a break that changes page size or orientation cannot share a physical sheet
|
|
988
|
+
* with the preceding section, so Word and LibreOffice promote it to a page
|
|
989
|
+
* break (eigenpal/docx-editor#841).
|
|
990
|
+
*
|
|
991
|
+
* Compare against the last laid-out page without materializing one: a break
|
|
992
|
+
* before any content has no sheet to share, so it defers (the first content
|
|
993
|
+
* then opens a page with the new geometry) rather than stranding a blank
|
|
994
|
+
* leading page.
|
|
995
|
+
*/
|
|
996
|
+
function startSectionInPlace(paginator, nextSectionConfig, nextSectionIndex) {
|
|
997
|
+
const currentPage = paginator.states.at(-1)?.page;
|
|
998
|
+
const nextSize = nextSectionConfig.pageSize;
|
|
999
|
+
const pageSizeChanges = currentPage != null && (Math.round(nextSize.w) !== Math.round(currentPage.size.w) || Math.round(nextSize.h) !== Math.round(currentPage.size.h));
|
|
1000
|
+
if (nextSectionIndex !== void 0) paginator.startSection({
|
|
1001
|
+
sectionIndex: nextSectionIndex,
|
|
1002
|
+
pageNumbering: nextSectionConfig.pageNumbering,
|
|
1003
|
+
placement: pageSizeChanges ? SECTION_START_PLACEMENT.NEXT_PAGE : SECTION_START_PLACEMENT.CONTINUOUS
|
|
1004
|
+
});
|
|
1005
|
+
if (pageSizeChanges) {
|
|
1006
|
+
paginator.updatePageLayout(nextSize, nextSectionConfig.margins);
|
|
1007
|
+
if (!paginator.retargetCurrentBlankPage()) paginator.forcePageBreak({ coalesceBlankPage: true });
|
|
1008
|
+
return;
|
|
1009
|
+
}
|
|
1010
|
+
paginator.updatePageLayout(nextSize, nextSectionConfig.margins, false);
|
|
1011
|
+
paginator.retargetCurrentBlankPage();
|
|
1012
|
+
}
|
|
1013
|
+
/**
|
|
982
1014
|
* Handle a section break block.
|
|
983
1015
|
* @param block - The section break block (current section's properties)
|
|
984
1016
|
* @param paginator - The paginator instance
|
|
985
1017
|
* @param nextSectionConfig - Page layout for the NEXT section
|
|
986
1018
|
* @param nextSectionType - Break type of the NEXT section (how it starts relative to current)
|
|
987
1019
|
*/
|
|
988
|
-
function handleSectionBreak(_block, paginator, nextSectionConfig, nextSectionType
|
|
1020
|
+
function handleSectionBreak(_block, paginator, nextSectionConfig, nextSectionType, nextSectionIndex) {
|
|
989
1021
|
switch (nextSectionType) {
|
|
990
1022
|
case "nextPage":
|
|
991
1023
|
paginator.updatePageLayout(nextSectionConfig.pageSize, nextSectionConfig.margins);
|
|
@@ -1013,27 +1045,31 @@ function handleSectionBreak(_block, paginator, nextSectionConfig, nextSectionTyp
|
|
|
1013
1045
|
});
|
|
1014
1046
|
if (!paginator.retargetCurrentBlankPage()) panic("Odd-page section target must be blank");
|
|
1015
1047
|
break;
|
|
1016
|
-
case "
|
|
1048
|
+
case "nextColumn": {
|
|
1017
1049
|
const currentPage = paginator.states.at(-1)?.page;
|
|
1018
|
-
|
|
1019
|
-
|
|
1050
|
+
if (currentPage === void 0 || !physicalColumnRegionIsShared({
|
|
1051
|
+
pageSize: currentPage.size,
|
|
1052
|
+
margins: currentPage.margins,
|
|
1053
|
+
columns: paginator.columns
|
|
1054
|
+
}, nextSectionConfig)) {
|
|
1055
|
+
startSectionInPlace(paginator, nextSectionConfig, nextSectionIndex);
|
|
1056
|
+
break;
|
|
1057
|
+
}
|
|
1020
1058
|
if (nextSectionIndex !== void 0) paginator.startSection({
|
|
1021
1059
|
sectionIndex: nextSectionIndex,
|
|
1022
1060
|
pageNumbering: nextSectionConfig.pageNumbering,
|
|
1023
|
-
placement:
|
|
1061
|
+
placement: SECTION_START_PLACEMENT.CONTINUOUS
|
|
1024
1062
|
});
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
} else {
|
|
1029
|
-
paginator.updatePageLayout(nextSize, nextSectionConfig.margins, false);
|
|
1030
|
-
paginator.retargetCurrentBlankPage();
|
|
1031
|
-
}
|
|
1032
|
-
break;
|
|
1063
|
+
paginator.updatePageLayout(nextSectionConfig.pageSize, nextSectionConfig.margins, false);
|
|
1064
|
+
paginator.forceColumnBreak();
|
|
1065
|
+
return;
|
|
1033
1066
|
}
|
|
1034
|
-
|
|
1067
|
+
case "continuous":
|
|
1068
|
+
startSectionInPlace(paginator, nextSectionConfig, nextSectionIndex);
|
|
1069
|
+
break;
|
|
1070
|
+
default:
|
|
1035
1071
|
}
|
|
1036
1072
|
paginator.updateColumns(nextSectionConfig.columns ?? DEFAULT_COLUMNS);
|
|
1037
1073
|
}
|
|
1038
1074
|
//#endregion
|
|
1039
|
-
export { DEFAULT_TEXTBOX_MARGINS, DEFAULT_TEXTBOX_WIDTH, FOOTNOTE_ENTRY_MARGIN_BOTTOM, FOOTNOTE_FALLBACK_LINE_HEIGHT, FOOTNOTE_SEPARATOR_HEIGHT, applyContextualSpacing, applyPendingToActive, assertExhaustiveFlowBlock, calculateChainHeight, collectSectionConfigs, computeKeepNextChains, createInitialSectionState, createPaginator, findPageIndexContainingPmPos, floatingTextBoxReservesBand, floatingTextBoxWrapsText, getEffectiveColumns, getEffectiveMargins, getEffectivePageSize, getHeaderRowsHeight, getMidChainIndices, getTableRowLeadingWidth, hasKeepLines, hasPageBreakBefore, isFloatingImageRun, isFloatingTextBoxBlock, isTextWrappingFloatingImageRun, layoutDocument, resolveSectionHeaderFooterRefs, resolveTableCellPadding, resolveTableWidthPx, scheduleSectionBreak, tableColumnsArePinned };
|
|
1075
|
+
export { DEFAULT_TEXTBOX_MARGINS, DEFAULT_TEXTBOX_WIDTH, FOOTNOTE_ENTRY_MARGIN_BOTTOM, FOOTNOTE_FALLBACK_LINE_HEIGHT, FOOTNOTE_SEPARATOR_HEIGHT, applyContextualSpacing, applyPendingToActive, assertExhaustiveFlowBlock, calculateChainHeight, collectSectionConfigs, computeKeepNextChains, createInitialSectionState, createPaginator, findPageIndexContainingPmPos, floatingTextBoxReservesBand, floatingTextBoxWrapsText, getEffectiveColumns, getEffectiveMargins, getEffectivePageSize, getHeaderRowsHeight, getMidChainIndices, getTableRowLeadingWidth, hasKeepLines, hasPageBreakBefore, isFloatingImageRun, isFloatingTextBoxBlock, isListNumPr, isTextWrappingFloatingImageRun, layoutDocument, resolveSectionHeaderFooterRefs, resolveTableCellPadding, resolveTableWidthPx, scheduleSectionBreak, tableColumnsArePinned };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { FlowBlock, Measure, TableBlock, TableMeasure, TextBoxBlock, TextBoxMeasure } from "../types.js";
|
|
2
|
+
import { SectionStartAdvance } from "../section-breaks.js";
|
|
2
3
|
import { FloatingImageZone } from "./floatingZones.js";
|
|
3
4
|
import "./measureParagraph.js";
|
|
4
5
|
//#region src/layout-engine/measure/measureBlocks.d.ts
|
|
@@ -28,6 +29,8 @@ type BandPageGeometry = {
|
|
|
28
29
|
columnIndex?: number | number[];
|
|
29
30
|
/** Authored flow-column count for each block's section. */
|
|
30
31
|
columnCount?: number | number[];
|
|
32
|
+
/** Resolved paginator transition at each section-break block. */
|
|
33
|
+
sectionAdvances?: readonly (SectionStartAdvance | undefined)[];
|
|
31
34
|
};
|
|
32
35
|
/**
|
|
33
36
|
* Measure a block based on its type.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { hasPageBreakBefore } from "../keep-together.js";
|
|
2
2
|
import { recordMeasureBlock, recordMeasureBlockError } from "../layoutInstrumentation.js";
|
|
3
3
|
import { isParagraphFrameTextBox } from "../paragraphFrame.js";
|
|
4
|
-
import {
|
|
4
|
+
import { sectionStartAdvanceOf } from "../section-breaks.js";
|
|
5
5
|
import { bandFragmentX, bandTopContentY, isPageFrameRelativeAnchor } from "../textBoxFlow.js";
|
|
6
6
|
import { getTextBoxGroupId } from "../textBoxGroup.js";
|
|
7
7
|
import { DEFAULT_TEXTBOX_MARGINS, floatingTextBoxReservesBand, floatingTextBoxWrapsText, resolveTableCellPadding, resolveTableWidthPx, tableColumnsArePinned } from "../types.js";
|
|
@@ -589,12 +589,6 @@ function measureTextBoxBlock(tb, fieldValues) {
|
|
|
589
589
|
innerMeasures
|
|
590
590
|
};
|
|
591
591
|
}
|
|
592
|
-
function isNextPageSectionBreak(block) {
|
|
593
|
-
return block.kind === "sectionBreak" && normalizeSectionBreakType(block.type) !== "continuous";
|
|
594
|
-
}
|
|
595
|
-
function isContinuousSectionBreak(block) {
|
|
596
|
-
return block.kind === "sectionBreak" && normalizeSectionBreakType(block.type) === "continuous";
|
|
597
|
-
}
|
|
598
592
|
/**
|
|
599
593
|
* Measure all blocks with floating image support.
|
|
600
594
|
*
|
|
@@ -657,6 +651,7 @@ function measureBlocks(blocks, contentWidth, marginTop = 0, pageGeometry, fieldV
|
|
|
657
651
|
const defaultPhysicalMarginTop = Array.isArray(physicalMarginTopInput) ? physicalMarginTopInput[0] ?? 0 : physicalMarginTopInput;
|
|
658
652
|
const columnIndexInput = pageGeometry?.columnIndex ?? 0;
|
|
659
653
|
const columnCountInput = pageGeometry?.columnCount ?? 1;
|
|
654
|
+
const sectionAdvances = pageGeometry?.sectionAdvances;
|
|
660
655
|
return blocks.map((block, blockIndex) => {
|
|
661
656
|
recordMeasureBlock(blockIndex, block);
|
|
662
657
|
const blockWidth = Array.isArray(contentWidth) ? contentWidth[blockIndex] ?? defaultWidth : contentWidth;
|
|
@@ -664,13 +659,14 @@ function measureBlocks(blocks, contentWidth, marginTop = 0, pageGeometry, fieldV
|
|
|
664
659
|
const blockContentTop = perBlockNumberValue(physicalMarginTopInput, blockIndex, defaultPhysicalMarginTop);
|
|
665
660
|
const blockColumnIndex = perBlockNumberValue(columnIndexInput, blockIndex, 0);
|
|
666
661
|
const blockColumnCount = perBlockNumberValue(columnCountInput, blockIndex, 1);
|
|
667
|
-
|
|
662
|
+
const sectionAdvance = sectionAdvances?.[blockIndex] ?? (block.kind === "sectionBreak" ? sectionStartAdvanceOf(block.type) : void 0);
|
|
663
|
+
if (block.kind === "pageBreak" || sectionAdvance === "page" || hasPageBreakBefore(block)) {
|
|
668
664
|
activeZones = [];
|
|
669
665
|
activeTablePageRects = [];
|
|
670
666
|
cumulativeY = 0;
|
|
671
667
|
pageRelativeY = 0;
|
|
672
668
|
columnRegionMaxBottom = 0;
|
|
673
|
-
} else if (block.kind === "columnBreak") {
|
|
669
|
+
} else if (block.kind === "columnBreak" || sectionAdvance === "column") {
|
|
674
670
|
if (blockColumnIndex + 1 >= blockColumnCount) {
|
|
675
671
|
activeZones = [];
|
|
676
672
|
activeTablePageRects = [];
|
|
@@ -708,7 +704,7 @@ function measureBlocks(blocks, contentWidth, marginTop = 0, pageGeometry, fieldV
|
|
|
708
704
|
cumulativeY += measure.totalHeight;
|
|
709
705
|
pageRelativeY += measure.totalHeight;
|
|
710
706
|
}
|
|
711
|
-
if (
|
|
707
|
+
if (sectionAdvance === "region") {
|
|
712
708
|
const nextSectionY = Math.max(pageRelativeY, columnRegionMaxBottom);
|
|
713
709
|
cumulativeY = nextSectionY;
|
|
714
710
|
pageRelativeY = nextSectionY;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { paintsCssBorder } from "../../utils/borderCss.js";
|
|
1
2
|
//#region src/layout-engine/measure/tableCellGrid.ts
|
|
2
3
|
const buildTableCellGrid = (rows, columnCount) => {
|
|
3
4
|
const occupiedColumnsByRow = /* @__PURE__ */ new Map();
|
|
@@ -59,7 +60,7 @@ const buildTableCellPlacements = ({ grid, columnWidths, bidi }) => {
|
|
|
59
60
|
const getTableCellVerticalBorderHeight = (grid, cell, rowIndex) => {
|
|
60
61
|
const sourceColumn = cell ? getSourceCellColumn(grid, cell) : void 0;
|
|
61
62
|
const aboveBottom = (sourceColumn === void 0 ? void 0 : getSourceCellAt(grid, rowIndex - 1, sourceColumn))?.borders?.bottom;
|
|
62
|
-
const aboveOwnsEdge = aboveBottom !== void 0 && aboveBottom.style
|
|
63
|
+
const aboveOwnsEdge = aboveBottom !== void 0 && paintsCssBorder(aboveBottom.style);
|
|
63
64
|
return (rowIndex === 0 || !aboveOwnsEdge ? cell?.borders?.top?.width ?? 0 : 0) + (cell?.borders?.bottom?.width ?? 0);
|
|
64
65
|
};
|
|
65
66
|
const firstAvailableColumn = (occupiedColumns, startingColumn) => {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { paintsCssBorder } from "../../utils/borderCss.js";
|
|
1
2
|
import { buildTableCellGrid, buildTableCellPlacements } from "./tableCellGrid.js";
|
|
2
3
|
//#region src/layout-engine/measure/tableFragmentBorderGeometry.ts
|
|
3
|
-
const isVisible = (border) => border !== void 0 && border.style
|
|
4
|
+
const isVisible = (border) => border !== void 0 && paintsCssBorder(border.style);
|
|
4
5
|
const tableFragmentBottomBorders = ({ fragment, block, measure, placements: suppliedPlacements }) => {
|
|
5
6
|
if (fragment.continuesOnNext !== true || fragment.bottomClip === void 0) return [];
|
|
6
7
|
const splitRow = block.rows.at(fragment.toRow - 1);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { resolveTablePlacementAlignment } from "../../utils/tablePlacement.js";
|
|
1
2
|
import { resolveTableCellPadding } from "../types.js";
|
|
2
3
|
//#region src/layout-engine/measure/tableInlinePlacement.ts
|
|
3
4
|
/**
|
|
@@ -17,12 +18,8 @@ const resolveTableInlinePlacement = (table, rowJustification) => {
|
|
|
17
18
|
const logicalJustification = rowJustification ?? table.justification ?? "left";
|
|
18
19
|
if (logicalJustification === "center") return { alignment: "center" };
|
|
19
20
|
const offset = logicalJustification === "left" ? (table.indent ?? 0) - leadingEdgeCompensation(table) : 0;
|
|
20
|
-
if (table.bidi !== true) return {
|
|
21
|
-
alignment: logicalJustification,
|
|
22
|
-
offset
|
|
23
|
-
};
|
|
24
21
|
return {
|
|
25
|
-
alignment: logicalJustification ===
|
|
22
|
+
alignment: resolveTablePlacementAlignment(logicalJustification, table.bidi === true),
|
|
26
23
|
offset
|
|
27
24
|
};
|
|
28
25
|
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { sameStatedParagraphNumbering } from "@stll/docx-core/model";
|
|
1
2
|
//#region src/layout-engine/paragraphSequence.ts
|
|
2
3
|
const continuesNumberedSequence = (previous, current) => {
|
|
3
4
|
if (previous?.kind !== "paragraph" || current.kind !== "paragraph") return false;
|
|
4
5
|
const previousNumPr = previous.attrs?.numPr;
|
|
5
6
|
const currentNumPr = current.attrs?.numPr;
|
|
6
|
-
if (previousNumPr?.
|
|
7
|
-
return previousNumPr
|
|
7
|
+
if (previousNumPr?.kind !== "reference" || currentNumPr?.kind !== "reference") return false;
|
|
8
|
+
return sameStatedParagraphNumbering(previousNumPr, currentNumPr);
|
|
8
9
|
};
|
|
9
10
|
const continuesTabbedParagraphSequence = (previous, current) => {
|
|
10
11
|
if (previous?.kind !== "paragraph" || current.kind !== "paragraph") return false;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { paintsCssBorder } from "../utils/borderCss.js";
|
|
1
2
|
import { continuesNumberedSequence, continuesTabbedParagraphSequence } from "./paragraphSequence.js";
|
|
2
3
|
//#region src/layout-engine/renderedBreakReconciliation.ts
|
|
3
4
|
const INITIAL_RENDERED_BREAK_STATE = { type: "noPageAdvance" };
|
|
@@ -98,7 +99,7 @@ const isPaginationEmptyParagraph = (block) => !hasVisibleEmptyParagraphDecoratio
|
|
|
98
99
|
const hasVisibleEmptyParagraphDecoration = (block) => {
|
|
99
100
|
if (block.attrs?.listMarker !== void 0 && block.attrs.listMarker.length > 0 && block.attrs.listMarkerHidden !== true) return true;
|
|
100
101
|
if (block.attrs?.shading) return true;
|
|
101
|
-
return Object.values(block.attrs?.borders ?? {}).some((border) => border !== void 0 && border.style
|
|
102
|
+
return Object.values(block.attrs?.borders ?? {}).some((border) => border !== void 0 && paintsCssBorder(border.style) && border.width !== 0);
|
|
102
103
|
};
|
|
103
104
|
const pageHasVisibleBodyContent = (page, blocksById) => {
|
|
104
105
|
for (const fragment of page.fragments) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ColumnLayout, PageMargins, SectionBreakBlock } from "./types.js";
|
|
2
|
+
import { SectionStart } from "@stll/docx-core/model";
|
|
2
3
|
//#region src/layout-engine/section-breaks.d.ts
|
|
3
4
|
/**
|
|
4
5
|
* State tracking for sections during layout.
|
|
@@ -53,8 +54,54 @@ type BreakDecision = {
|
|
|
53
54
|
/** Required page parity (even or odd). */
|
|
54
55
|
requiredParity?: "even" | "odd";
|
|
55
56
|
};
|
|
57
|
+
/** `w:sectPr` may omit `w:type`; §17.6.22's omitted value is `nextPage`. */
|
|
56
58
|
declare const DEFAULT_SECTION_BREAK_TYPE = "nextPage";
|
|
57
|
-
|
|
59
|
+
/**
|
|
60
|
+
* The section start a boundary states, with the omitted value resolved.
|
|
61
|
+
*
|
|
62
|
+
* Absence is a reading the specification gives; a value outside
|
|
63
|
+
* `ST_SectionMark` is not, so it panics rather than resolving to the same
|
|
64
|
+
* default and hiding whichever producer invented it.
|
|
65
|
+
*/
|
|
66
|
+
declare function normalizeSectionBreakType(sectionStart: SectionBreakBlock["type"]): SectionStart;
|
|
67
|
+
/**
|
|
68
|
+
* What a section start does to the page it begins on.
|
|
69
|
+
*
|
|
70
|
+
* - `page`: it opens a new sheet.
|
|
71
|
+
* - `column`: it begins in the next column of the region it shares with the
|
|
72
|
+
* outgoing section (§17.18.77), and opens a sheet only when that region has
|
|
73
|
+
* no further column.
|
|
74
|
+
* - `region`: it begins in place, below the outgoing content.
|
|
75
|
+
*/
|
|
76
|
+
declare const SECTION_START_ADVANCE: {
|
|
77
|
+
readonly nextPage: "page";
|
|
78
|
+
readonly evenPage: "page";
|
|
79
|
+
readonly oddPage: "page";
|
|
80
|
+
readonly nextColumn: "column";
|
|
81
|
+
readonly continuous: "region";
|
|
82
|
+
};
|
|
83
|
+
type SectionStartAdvance = (typeof SECTION_START_ADVANCE)[SectionStart];
|
|
84
|
+
/** The disposition of the section starting at a boundary. Total over `ST_SectionMark`. */
|
|
85
|
+
declare const sectionStartAdvanceOf: (sectionStart: SectionBreakBlock["type"]) => SectionStartAdvance;
|
|
86
|
+
/**
|
|
87
|
+
* Whether a section start can continue into the column region the outgoing
|
|
88
|
+
* section occupies: it needs a further column, and the incoming section has to
|
|
89
|
+
* repeat the geometry rather than redefine it.
|
|
90
|
+
*/
|
|
91
|
+
declare const columnRegionIsShared: (active: ColumnLayout, next: ColumnLayout | undefined) => boolean;
|
|
92
|
+
type PhysicalColumnRegion = {
|
|
93
|
+
pageSize: {
|
|
94
|
+
w: number;
|
|
95
|
+
h: number;
|
|
96
|
+
};
|
|
97
|
+
margins: PageMargins;
|
|
98
|
+
columns: ColumnLayout;
|
|
99
|
+
};
|
|
100
|
+
type CandidatePhysicalColumnRegion = Omit<PhysicalColumnRegion, "columns"> & {
|
|
101
|
+
columns?: ColumnLayout;
|
|
102
|
+
};
|
|
103
|
+
/** Whether two sections describe the same physical column region on a sheet. */
|
|
104
|
+
declare const physicalColumnRegionIsShared: (active: PhysicalColumnRegion, next: CandidatePhysicalColumnRegion) => boolean;
|
|
58
105
|
/**
|
|
59
106
|
* Create initial section state from default options.
|
|
60
107
|
*/
|
|
@@ -94,4 +141,4 @@ declare function getEffectivePageSize(state: SectionState): {
|
|
|
94
141
|
*/
|
|
95
142
|
declare function getEffectiveColumns(state: SectionState): ColumnLayout;
|
|
96
143
|
//#endregion
|
|
97
|
-
export { BreakDecision, DEFAULT_SECTION_BREAK_TYPE, SectionState, applyPendingToActive, createInitialSectionState, getEffectiveColumns, getEffectiveMargins, getEffectivePageSize, normalizeSectionBreakType, scheduleSectionBreak };
|
|
144
|
+
export { BreakDecision, DEFAULT_SECTION_BREAK_TYPE, SectionStartAdvance, SectionState, applyPendingToActive, columnRegionIsShared, createInitialSectionState, getEffectiveColumns, getEffectiveMargins, getEffectivePageSize, normalizeSectionBreakType, physicalColumnRegionIsShared, scheduleSectionBreak, sectionStartAdvanceOf };
|
|
@@ -1,16 +1,66 @@
|
|
|
1
|
+
import { panic } from "better-result";
|
|
1
2
|
//#region src/layout-engine/section-breaks.ts
|
|
2
3
|
/**
|
|
4
|
+
* Section Breaks - Handle page layout changes at section boundaries
|
|
5
|
+
*
|
|
6
|
+
* Sections in DOCX can have different page sizes, margins, columns, and orientations.
|
|
7
|
+
* This module manages the state transitions between sections during layout.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
3
10
|
* Default single-column layout.
|
|
4
11
|
*/
|
|
5
12
|
const DEFAULT_COLUMNS = {
|
|
6
13
|
count: 1,
|
|
7
14
|
gap: 0
|
|
8
15
|
};
|
|
16
|
+
/** `w:sectPr` may omit `w:type`; §17.6.22's omitted value is `nextPage`. */
|
|
9
17
|
const DEFAULT_SECTION_BREAK_TYPE = "nextPage";
|
|
10
|
-
|
|
11
|
-
|
|
18
|
+
/**
|
|
19
|
+
* The section start a boundary states, with the omitted value resolved.
|
|
20
|
+
*
|
|
21
|
+
* Absence is a reading the specification gives; a value outside
|
|
22
|
+
* `ST_SectionMark` is not, so it panics rather than resolving to the same
|
|
23
|
+
* default and hiding whichever producer invented it.
|
|
24
|
+
*/
|
|
25
|
+
function normalizeSectionBreakType(sectionStart) {
|
|
26
|
+
switch (sectionStart) {
|
|
27
|
+
case void 0: return DEFAULT_SECTION_BREAK_TYPE;
|
|
28
|
+
case "nextPage":
|
|
29
|
+
case "nextColumn":
|
|
30
|
+
case "continuous":
|
|
31
|
+
case "evenPage":
|
|
32
|
+
case "oddPage": return sectionStart;
|
|
33
|
+
default: return panic(`Section break: "${String(sectionStart)}" is not an ST_SectionMark member`);
|
|
34
|
+
}
|
|
12
35
|
}
|
|
13
36
|
/**
|
|
37
|
+
* What a section start does to the page it begins on.
|
|
38
|
+
*
|
|
39
|
+
* - `page`: it opens a new sheet.
|
|
40
|
+
* - `column`: it begins in the next column of the region it shares with the
|
|
41
|
+
* outgoing section (§17.18.77), and opens a sheet only when that region has
|
|
42
|
+
* no further column.
|
|
43
|
+
* - `region`: it begins in place, below the outgoing content.
|
|
44
|
+
*/
|
|
45
|
+
const SECTION_START_ADVANCE = {
|
|
46
|
+
nextPage: "page",
|
|
47
|
+
evenPage: "page",
|
|
48
|
+
oddPage: "page",
|
|
49
|
+
nextColumn: "column",
|
|
50
|
+
continuous: "region"
|
|
51
|
+
};
|
|
52
|
+
/** The disposition of the section starting at a boundary. Total over `ST_SectionMark`. */
|
|
53
|
+
const sectionStartAdvanceOf = (sectionStart) => SECTION_START_ADVANCE[normalizeSectionBreakType(sectionStart)];
|
|
54
|
+
const sameTrack = (left, right) => left === void 0 || right === void 0 ? left === right : left.length === right.length && left.every((value, index) => value === right[index]);
|
|
55
|
+
/**
|
|
56
|
+
* Whether a section start can continue into the column region the outgoing
|
|
57
|
+
* section occupies: it needs a further column, and the incoming section has to
|
|
58
|
+
* repeat the geometry rather than redefine it.
|
|
59
|
+
*/
|
|
60
|
+
const columnRegionIsShared = (active, next) => active.count > 1 && next !== void 0 && next.count === active.count && next.gap === active.gap && sameTrack(active.widths, next.widths) && sameTrack(active.gaps, next.gaps);
|
|
61
|
+
/** Whether two sections describe the same physical column region on a sheet. */
|
|
62
|
+
const physicalColumnRegionIsShared = (active, next) => Math.round(active.pageSize.w) === Math.round(next.pageSize.w) && Math.round(active.pageSize.h) === Math.round(next.pageSize.h) && active.margins.top === next.margins.top && active.margins.right === next.margins.right && active.margins.bottom === next.margins.bottom && active.margins.left === next.margins.left && columnRegionIsShared(active.columns, next.columns);
|
|
63
|
+
/**
|
|
14
64
|
* Create initial section state from default options.
|
|
15
65
|
*/
|
|
16
66
|
function createInitialSectionState(margins, pageSize, columns) {
|
|
@@ -102,7 +152,8 @@ function scheduleSectionBreak(block, state, _baseMargins) {
|
|
|
102
152
|
},
|
|
103
153
|
state: next
|
|
104
154
|
};
|
|
105
|
-
|
|
155
|
+
case "nextColumn":
|
|
156
|
+
case "continuous":
|
|
106
157
|
if (columnsChanging) {
|
|
107
158
|
next.pendingColumns = getColumnConfig();
|
|
108
159
|
return {
|
|
@@ -183,4 +234,4 @@ function getEffectiveColumns(state) {
|
|
|
183
234
|
return state.pendingColumns ?? state.activeColumns;
|
|
184
235
|
}
|
|
185
236
|
//#endregion
|
|
186
|
-
export { DEFAULT_SECTION_BREAK_TYPE, applyPendingToActive, createInitialSectionState, getEffectiveColumns, getEffectiveMargins, getEffectivePageSize, normalizeSectionBreakType, scheduleSectionBreak };
|
|
237
|
+
export { DEFAULT_SECTION_BREAK_TYPE, applyPendingToActive, columnRegionIsShared, createInitialSectionState, getEffectiveColumns, getEffectiveMargins, getEffectivePageSize, normalizeSectionBreakType, physicalColumnRegionIsShared, scheduleSectionBreak, sectionStartAdvanceOf };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { OutlineStyleAttr } from "../types/documentEnumValues.js";
|
|
2
|
-
import {
|
|
2
|
+
import { CssBorderStyle } from "../utils/borderCss.js";
|
|
3
|
+
import { ImagePosition, ImageWrap, InlineWrapper, NumberFormat, OutlineLevel, ParagraphNumberingOverride, PreviewDescriptor, SdtProperties, SdtType, SectionStart, ShapeTextBody, TableCellFormatting, TableWidthType, UnderlineStyle, VerticalAlign } from "@stll/docx-core/model";
|
|
3
4
|
declare namespace types_d_exports {
|
|
4
|
-
export { BlockId, BorderStyle, CellBorderSpec, CellBorders, ColumnBreakBlock, ColumnBreakMeasure, ColumnLayout, DEFAULT_TEXTBOX_MARGINS, DEFAULT_TEXTBOX_WIDTH, DocumentPosition, FOOTNOTE_ENTRY_MARGIN_BOTTOM, FOOTNOTE_FALLBACK_LINE_HEIGHT, FOOTNOTE_SEPARATOR_HEIGHT, FieldRun, FloatingTablePosition, FlowBlock, FootnoteContent, Fragment, FragmentBase, HeaderFooterContent, HeaderFooterContentHeights, HeaderFooterLayout, HitTestResult, HyperlinkInfo, ImageBlock, ImageFragment, ImageMeasure, ImageRun, ImageRunPosition, Layout, LayoutOptions, LineBreakRun, ListMarkerFormatting,
|
|
5
|
+
export { BlockId, BorderStyle, CellBorderSpec, CellBorders, ColumnBreakBlock, ColumnBreakMeasure, ColumnLayout, DEFAULT_TEXTBOX_MARGINS, DEFAULT_TEXTBOX_WIDTH, DocumentPosition, FOOTNOTE_ENTRY_MARGIN_BOTTOM, FOOTNOTE_FALLBACK_LINE_HEIGHT, FOOTNOTE_SEPARATOR_HEIGHT, FieldRun, FloatingTablePosition, FlowBlock, FootnoteContent, Fragment, FragmentBase, HeaderFooterContent, HeaderFooterContentHeights, HeaderFooterLayout, HitTestResult, HyperlinkInfo, ImageBlock, ImageFragment, ImageMeasure, ImageRun, ImageRunPosition, Layout, LayoutOptions, LineBreakRun, ListMarkerFormatting, MathRun, Measure, MeasuredLine, Page, PageBreakBlock, PageBreakMeasure, PageHeaderFooterRefs, PageMargins, ParagraphAttrs, ParagraphBlock, ParagraphBorders, ParagraphFragment, ParagraphIndent, ParagraphMeasure, ParagraphSpacing, RenderedPageBreakRun, Run, RunFormatting, SdtGroup, SectionBreakBlock, SectionBreakMeasure, SectionPageNumbering, TabAlignment, TabRun, TabStop, TableBlock, TableCell, TableCellMeasure, TableFragment, TableMeasure, TableRow, TableRowMeasure, TextBoxBlock, TextBoxFlowAttrs, TextBoxFragment, TextBoxMeasure, TextRun, floatingTextBoxReservesBand, floatingTextBoxWrapsText, getTableRowLeadingWidth, isFloatingImageRun, isFloatingTextBoxBlock, isListNumPr, isTextWrappingFloatingImageRun, resolveTableCellPadding, resolveTableWidthPx, tableColumnsArePinned };
|
|
5
6
|
}
|
|
6
7
|
/**
|
|
7
8
|
* Unique identifier for a block in the document.
|
|
@@ -14,8 +15,13 @@ type BlockId = string | number;
|
|
|
14
15
|
type RunFormatting = {
|
|
15
16
|
bold?: boolean;
|
|
16
17
|
italic?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* `w:u`: `true` for a plain underline, or the authored `ST_Underline` member
|
|
20
|
+
* and colour. The style is the model's union, not a CSS
|
|
21
|
+
* `text-decoration-style`: the painter translates it.
|
|
22
|
+
*/
|
|
17
23
|
underline?: boolean | {
|
|
18
|
-
style?:
|
|
24
|
+
style?: UnderlineStyle;
|
|
19
25
|
color?: string;
|
|
20
26
|
};
|
|
21
27
|
strike?: boolean;
|
|
@@ -67,6 +73,8 @@ type RunFormatting = {
|
|
|
67
73
|
bidi?: string;
|
|
68
74
|
};
|
|
69
75
|
fontSize?: number;
|
|
76
|
+
/** The imported deletion already resolved its pre-change style hierarchy. */
|
|
77
|
+
usesHistoricalFormatting?: true;
|
|
70
78
|
letterSpacing?: number;
|
|
71
79
|
superscript?: boolean;
|
|
72
80
|
subscript?: boolean;
|
|
@@ -215,6 +223,8 @@ type ImageRunPosition = {
|
|
|
215
223
|
type ImageRun = {
|
|
216
224
|
kind: "image";
|
|
217
225
|
src: string;
|
|
226
|
+
/** Set instead of `src` for a drawing with no image data; see {@link ImageBlock.preview}. */
|
|
227
|
+
preview?: PreviewDescriptor;
|
|
218
228
|
width: number;
|
|
219
229
|
height: number;
|
|
220
230
|
alt?: string;
|
|
@@ -260,7 +270,7 @@ type ImageRun = {
|
|
|
260
270
|
/** CSS border color. eigenpal #1096. */
|
|
261
271
|
borderColor?: string;
|
|
262
272
|
/** CSS border style. eigenpal #1096. */
|
|
263
|
-
borderStyle?:
|
|
273
|
+
borderStyle?: CssBorderStyle;
|
|
264
274
|
/** Whether this picture is itself a tracked insertion (`<w:ins>`). eigenpal #641. */
|
|
265
275
|
isInsertion?: boolean;
|
|
266
276
|
/** Whether this picture is itself a tracked deletion (`<w:del>`). eigenpal #641. */
|
|
@@ -367,7 +377,7 @@ type TabStop = {
|
|
|
367
377
|
* Border specification for paragraphs.
|
|
368
378
|
*/
|
|
369
379
|
type BorderStyle = {
|
|
370
|
-
style?:
|
|
380
|
+
style?: CssBorderStyle;
|
|
371
381
|
width?: number;
|
|
372
382
|
color?: string;
|
|
373
383
|
space?: number;
|
|
@@ -384,12 +394,19 @@ type ParagraphBorders = {
|
|
|
384
394
|
bar?: BorderStyle;
|
|
385
395
|
};
|
|
386
396
|
/**
|
|
387
|
-
*
|
|
397
|
+
* Whether a paragraph states numbering at all.
|
|
398
|
+
*
|
|
399
|
+
* `null` is the ProseMirror attr's absent state and `undefined` the model's,
|
|
400
|
+
* so both mean the same thing here. It says nothing about what the statement
|
|
401
|
+
* resolves to: a cancellation is a statement, and which arm it is belongs to
|
|
402
|
+
* a `switch`, not to this one.
|
|
403
|
+
*
|
|
404
|
+
* Stated equality has one owner too, and it is
|
|
405
|
+
* {@link sameStatedParagraphNumbering}: the marker tier and the layout tier
|
|
406
|
+
* used to hold byte-identical copies under different names, and an equality
|
|
407
|
+
* that drifts is how a list silently renumbers.
|
|
388
408
|
*/
|
|
389
|
-
|
|
390
|
-
numId?: number;
|
|
391
|
-
ilvl?: number;
|
|
392
|
-
};
|
|
409
|
+
declare const isListNumPr: (value: ParagraphNumberingOverride | null | undefined) => value is ParagraphNumberingOverride;
|
|
393
410
|
/**
|
|
394
411
|
* Paragraph block attributes.
|
|
395
412
|
*/
|
|
@@ -425,8 +442,8 @@ type ParagraphAttrs = {
|
|
|
425
442
|
};
|
|
426
443
|
useLegacyEthiopicAmharicRules?: boolean;
|
|
427
444
|
};
|
|
428
|
-
/** OOXML outline level (`w:outlineLvl`),
|
|
429
|
-
outlineLevel?:
|
|
445
|
+
/** The stated OOXML outline level (`w:outlineLvl`), heading or body text. */
|
|
446
|
+
outlineLevel?: OutlineLevel;
|
|
430
447
|
spacing?: ParagraphSpacing;
|
|
431
448
|
/** Whether this paragraph participates in the active section line grid. */
|
|
432
449
|
snapToGrid?: boolean;
|
|
@@ -482,7 +499,7 @@ type ParagraphAttrs = {
|
|
|
482
499
|
suppressEmptyParagraphHeight?: boolean;
|
|
483
500
|
/** Reserve the reference extra line advance for a story-leading empty level-0 outline paragraph. */
|
|
484
501
|
reserveEmptyOutlineHeight?: boolean;
|
|
485
|
-
numPr?:
|
|
502
|
+
numPr?: ParagraphNumberingOverride;
|
|
486
503
|
listMarker?: string;
|
|
487
504
|
listIsBullet?: boolean;
|
|
488
505
|
listMarkerHidden?: boolean;
|
|
@@ -564,7 +581,7 @@ type ParagraphBlock = {
|
|
|
564
581
|
type CellBorderSpec = {
|
|
565
582
|
width?: number;
|
|
566
583
|
color?: string;
|
|
567
|
-
style?:
|
|
584
|
+
style?: CssBorderStyle;
|
|
568
585
|
};
|
|
569
586
|
/**
|
|
570
587
|
* Cell borders (all four sides).
|
|
@@ -688,6 +705,12 @@ type ImageBlock = {
|
|
|
688
705
|
kind: "image";
|
|
689
706
|
id: BlockId;
|
|
690
707
|
src: string;
|
|
708
|
+
/**
|
|
709
|
+
* Set instead of `src` for a drawing with no image data: the display list
|
|
710
|
+
* rasterises it when it interns it. `src` is then empty, and a block with
|
|
711
|
+
* neither paints nothing, as before.
|
|
712
|
+
*/
|
|
713
|
+
preview?: PreviewDescriptor;
|
|
691
714
|
width: number;
|
|
692
715
|
height: number;
|
|
693
716
|
alt?: string;
|
|
@@ -724,7 +747,7 @@ type ImageBlock = {
|
|
|
724
747
|
/** CSS border color. eigenpal #1096. */
|
|
725
748
|
borderColor?: string;
|
|
726
749
|
/** CSS border style. eigenpal #1096. */
|
|
727
|
-
borderStyle?:
|
|
750
|
+
borderStyle?: CssBorderStyle;
|
|
728
751
|
pmStart?: number;
|
|
729
752
|
pmEnd?: number;
|
|
730
753
|
};
|
|
@@ -734,7 +757,14 @@ type ImageBlock = {
|
|
|
734
757
|
type SectionBreakBlock = {
|
|
735
758
|
kind: "sectionBreak";
|
|
736
759
|
id: BlockId;
|
|
737
|
-
|
|
760
|
+
/**
|
|
761
|
+
* How the section starting at this boundary begins (`w:sectPr/w:type`,
|
|
762
|
+
* §17.6.22). `SectionStart` is `ST_SectionMark` in full, so the bridge hands
|
|
763
|
+
* the parsed value straight through: a member the layout does not model
|
|
764
|
+
* fails the paginator's exhaustiveness check instead of being cast in.
|
|
765
|
+
* Absent means `nextPage`; `normalizeSectionBreakType` owns that reading.
|
|
766
|
+
*/
|
|
767
|
+
type?: SectionStart;
|
|
738
768
|
pageSize?: {
|
|
739
769
|
w: number;
|
|
740
770
|
h: number;
|
|
@@ -1460,4 +1490,4 @@ declare function resolveTableWidthPx(width: number | undefined, widthType: Table
|
|
|
1460
1490
|
/** Return the leading visual offset for a row with omitted grid columns. */
|
|
1461
1491
|
declare const getTableRowLeadingWidth: (row: TableRow, columnWidths: readonly number[]) => number;
|
|
1462
1492
|
//#endregion
|
|
1463
|
-
export { BlockId, BorderStyle, CellBorderSpec, CellBorders, ColumnBreakBlock, ColumnBreakMeasure, ColumnLayout, DEFAULT_TEXTBOX_MARGINS, DEFAULT_TEXTBOX_WIDTH, DocumentPosition, FOOTNOTE_ENTRY_MARGIN_BOTTOM, FOOTNOTE_FALLBACK_LINE_HEIGHT, FOOTNOTE_SEPARATOR_HEIGHT, FieldRun, FloatingTablePosition, FlowBlock, FootnoteContent, Fragment, FragmentBase, HeaderFooterContent, HeaderFooterContentHeights, HeaderFooterLayout, HitTestResult, HyperlinkInfo, ImageBlock, ImageFragment, ImageMeasure, ImageRun, ImageRunPosition, Layout, LayoutOptions, LineBreakRun, ListMarkerFormatting,
|
|
1493
|
+
export { BlockId, BorderStyle, CellBorderSpec, CellBorders, ColumnBreakBlock, ColumnBreakMeasure, ColumnLayout, DEFAULT_TEXTBOX_MARGINS, DEFAULT_TEXTBOX_WIDTH, DocumentPosition, FOOTNOTE_ENTRY_MARGIN_BOTTOM, FOOTNOTE_FALLBACK_LINE_HEIGHT, FOOTNOTE_SEPARATOR_HEIGHT, FieldRun, FloatingTablePosition, FlowBlock, FootnoteContent, Fragment, FragmentBase, HeaderFooterContent, HeaderFooterContentHeights, HeaderFooterLayout, HitTestResult, HyperlinkInfo, ImageBlock, ImageFragment, ImageMeasure, ImageRun, ImageRunPosition, Layout, LayoutOptions, LineBreakRun, ListMarkerFormatting, MathRun, Measure, MeasuredLine, Page, PageBreakBlock, PageBreakMeasure, PageHeaderFooterRefs, PageMargins, ParagraphAttrs, ParagraphBlock, ParagraphBorders, ParagraphFragment, ParagraphIndent, ParagraphMeasure, ParagraphSpacing, RenderedPageBreakRun, Run, RunFormatting, SdtGroup, SectionBreakBlock, SectionBreakMeasure, SectionPageNumbering, TabAlignment, TabRun, TabStop, TableBlock, TableCell, TableCellMeasure, TableFragment, TableMeasure, TableRow, TableRowMeasure, TextBoxBlock, TextBoxFlowAttrs, TextBoxFragment, TextBoxMeasure, TextRun, floatingTextBoxReservesBand, floatingTextBoxWrapsText, getTableRowLeadingWidth, isFloatingImageRun, isFloatingTextBoxBlock, isListNumPr, isTextWrappingFloatingImageRun, resolveTableCellPadding, resolveTableWidthPx, tableColumnsArePinned, types_d_exports };
|
|
@@ -12,11 +12,26 @@ var types_exports = /* @__PURE__ */ __exportAll({
|
|
|
12
12
|
getTableRowLeadingWidth: () => getTableRowLeadingWidth,
|
|
13
13
|
isFloatingImageRun: () => isFloatingImageRun,
|
|
14
14
|
isFloatingTextBoxBlock: () => isFloatingTextBoxBlock,
|
|
15
|
+
isListNumPr: () => isListNumPr,
|
|
15
16
|
isTextWrappingFloatingImageRun: () => isTextWrappingFloatingImageRun,
|
|
16
17
|
resolveTableCellPadding: () => resolveTableCellPadding,
|
|
17
18
|
resolveTableWidthPx: () => resolveTableWidthPx,
|
|
18
19
|
tableColumnsArePinned: () => tableColumnsArePinned
|
|
19
20
|
});
|
|
21
|
+
/**
|
|
22
|
+
* Whether a paragraph states numbering at all.
|
|
23
|
+
*
|
|
24
|
+
* `null` is the ProseMirror attr's absent state and `undefined` the model's,
|
|
25
|
+
* so both mean the same thing here. It says nothing about what the statement
|
|
26
|
+
* resolves to: a cancellation is a statement, and which arm it is belongs to
|
|
27
|
+
* a `switch`, not to this one.
|
|
28
|
+
*
|
|
29
|
+
* Stated equality has one owner too, and it is
|
|
30
|
+
* {@link sameStatedParagraphNumbering}: the marker tier and the layout tier
|
|
31
|
+
* used to hold byte-identical copies under different names, and an equality
|
|
32
|
+
* that drifts is how a list silently renumbers.
|
|
33
|
+
*/
|
|
34
|
+
const isListNumPr = (value) => value !== void 0 && value !== null;
|
|
20
35
|
const DEFAULT_TABLE_CELL_PADDING = {
|
|
21
36
|
top: 0,
|
|
22
37
|
right: 7,
|
|
@@ -175,4 +190,4 @@ const getTableRowLeadingWidth = (row, columnWidths) => {
|
|
|
175
190
|
return columnWidths.slice(0, row.gridBefore ?? 0).reduce((sum, columnWidth) => sum + columnWidth, 0);
|
|
176
191
|
};
|
|
177
192
|
//#endregion
|
|
178
|
-
export { DEFAULT_TEXTBOX_MARGINS, DEFAULT_TEXTBOX_WIDTH, FOOTNOTE_ENTRY_MARGIN_BOTTOM, FOOTNOTE_FALLBACK_LINE_HEIGHT, FOOTNOTE_SEPARATOR_HEIGHT, floatingTextBoxReservesBand, floatingTextBoxWrapsText, getTableRowLeadingWidth, isFloatingImageRun, isFloatingTextBoxBlock, isTextWrappingFloatingImageRun, resolveTableCellPadding, resolveTableWidthPx, tableColumnsArePinned, types_exports };
|
|
193
|
+
export { DEFAULT_TEXTBOX_MARGINS, DEFAULT_TEXTBOX_WIDTH, FOOTNOTE_ENTRY_MARGIN_BOTTOM, FOOTNOTE_FALLBACK_LINE_HEIGHT, FOOTNOTE_SEPARATOR_HEIGHT, floatingTextBoxReservesBand, floatingTextBoxWrapsText, getTableRowLeadingWidth, isFloatingImageRun, isFloatingTextBoxBlock, isListNumPr, isTextWrappingFloatingImageRun, resolveTableCellPadding, resolveTableWidthPx, tableColumnsArePinned, types_exports };
|
|
@@ -1,8 +1,22 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CssBorderStyle } from "../utils/borderCss.js";
|
|
2
|
+
import { ParagraphBorders } from "../layout-engine/types.js";
|
|
2
3
|
//#region src/layout-painter/borderStroke.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* A CSS border to paint.
|
|
6
|
+
*
|
|
7
|
+
* `style` is the CSS keyword, never an `ST_Border` member and never a
|
|
8
|
+
* DrawingML dash: an outline's dash is translated by `cssBorderStyleForDash`
|
|
9
|
+
* before it reaches a border shorthand, because `border: 1px sysDash #000`
|
|
10
|
+
* invalidates the whole declaration.
|
|
11
|
+
*/
|
|
12
|
+
type BorderStroke = {
|
|
13
|
+
color?: string | undefined;
|
|
14
|
+
style?: CssBorderStyle | undefined;
|
|
15
|
+
width?: number | undefined;
|
|
16
|
+
};
|
|
3
17
|
type CssBorderStroke = {
|
|
4
18
|
color: string;
|
|
5
|
-
style:
|
|
19
|
+
style: CssBorderStyle;
|
|
6
20
|
width: number;
|
|
7
21
|
};
|
|
8
22
|
/**
|
|
@@ -10,8 +24,8 @@ type CssBorderStroke = {
|
|
|
10
24
|
* fractional border width to one device pixel, so its color carries the
|
|
11
25
|
* fractional coverage while layout keeps the authored width.
|
|
12
26
|
*/
|
|
13
|
-
declare const resolveCssBorderStroke: (border:
|
|
14
|
-
declare const borderStrokeToCss: (border:
|
|
27
|
+
declare const resolveCssBorderStroke: (border: BorderStroke) => CssBorderStroke;
|
|
28
|
+
declare const borderStrokeToCss: (border: BorderStroke) => string;
|
|
15
29
|
type ParagraphBorderHorizontalOutsets = {
|
|
16
30
|
left: number;
|
|
17
31
|
right: number;
|