@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
|
@@ -1,19 +1,188 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CssBorderStyle } from "../../utils/borderCss.js";
|
|
2
2
|
import { DisplayStroke, DisplayStrokePattern } from "../types.js";
|
|
3
|
+
import { PresetLineDashVal, UnderlineStyle } from "@stll/docx-core/model";
|
|
3
4
|
//#region src/display-list/build/strokes.d.ts
|
|
4
|
-
|
|
5
|
+
/** A pattern, or the absence of a line: an edge that paints nothing. */
|
|
6
|
+
type StrokePattern = DisplayStrokePattern | "none";
|
|
7
|
+
type BorderInput = {
|
|
8
|
+
color?: string | undefined;
|
|
9
|
+
style?: CssBorderStyle | undefined;
|
|
10
|
+
width?: number | undefined;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Every CSS `border-style` folio paints, as a display-list pattern.
|
|
14
|
+
*
|
|
15
|
+
* The bevelled keywords have no display-list pattern, and Word draws
|
|
16
|
+
* `threeDEmboss`/`threeDEngrave` as a plain line where the shading is
|
|
17
|
+
* unavailable, so they stroke solid.
|
|
18
|
+
*/
|
|
19
|
+
declare const CSS_BORDER_STROKE_PATTERNS: {
|
|
20
|
+
readonly none: "none";
|
|
21
|
+
readonly solid: "solid";
|
|
22
|
+
readonly double: "double";
|
|
23
|
+
readonly dotted: "dotted";
|
|
24
|
+
readonly dashed: "dashed";
|
|
25
|
+
readonly groove: "solid";
|
|
26
|
+
readonly ridge: "solid";
|
|
27
|
+
readonly inset: "solid";
|
|
28
|
+
readonly outset: "solid";
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Every `ST_PresetLineDashVal` member, as a display-list pattern.
|
|
32
|
+
*
|
|
33
|
+
* DrawingML distinguishes dash length (`lgDash`) and the system patterns
|
|
34
|
+
* (`sysDash`) from the plain ones; a display list has three periodic patterns,
|
|
35
|
+
* so the distinction collapses to dotted or dashed. It collapses here, once,
|
|
36
|
+
* rather than at whichever consumer happened to know the spelling.
|
|
37
|
+
*/
|
|
38
|
+
declare const PRESET_DASH_STROKE_PATTERNS: {
|
|
39
|
+
readonly solid: "solid";
|
|
40
|
+
readonly dot: "dotted";
|
|
41
|
+
readonly dash: "dashed";
|
|
42
|
+
readonly lgDash: "dashed";
|
|
43
|
+
readonly dashDot: "dashed";
|
|
44
|
+
readonly lgDashDot: "dashed";
|
|
45
|
+
readonly lgDashDotDot: "dashed";
|
|
46
|
+
readonly sysDash: "dashed";
|
|
47
|
+
readonly sysDot: "dotted";
|
|
48
|
+
readonly sysDashDot: "dashed";
|
|
49
|
+
readonly sysDashDotDot: "dashed";
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Every `ST_Underline` member the model carries, one row per member.
|
|
53
|
+
*
|
|
54
|
+
* The three fields are one decision and belong on one line: `wavyDouble` is
|
|
55
|
+
* Word's two waves, which is the `wavy` pattern drawn twice rather than the
|
|
56
|
+
* `double` pattern, so a reader who has the pattern without the count has half
|
|
57
|
+
* the member. `double` is one stroke, because the display list's `double`
|
|
58
|
+
* pattern already carries the second rule and the gap between them. CSS can
|
|
59
|
+
* draw neither two waves nor `words`, so the editor approximates them; the page
|
|
60
|
+
* and the PDF do not have to.
|
|
61
|
+
*
|
|
62
|
+
* Word draws `thick` and the seven `*Heavy` members at twice the rule the font
|
|
63
|
+
* asks for, and the rest at the plain rule. Without the weight the display list
|
|
64
|
+
* strokes every member at the plain thickness, so `dottedHeavy` and `dotted`
|
|
65
|
+
* come out as the same line on the page and in the PDF while the editor draws
|
|
66
|
+
* them apart. The DOM spells this same weight as a
|
|
67
|
+
* `text-decoration-thickness` length (`utils/formatToStyle.ts`), so which
|
|
68
|
+
* members are heavy is decided here and nowhere else.
|
|
69
|
+
*
|
|
70
|
+
* `none` states no decoration: a run whose underline says so paints nothing,
|
|
71
|
+
* and its weight and stroke count are the plain ones by default rather than by
|
|
72
|
+
* decision.
|
|
73
|
+
*/
|
|
74
|
+
declare const UNDERLINE_STROKES: {
|
|
75
|
+
readonly none: {
|
|
76
|
+
readonly pattern: "none";
|
|
77
|
+
readonly weight: 1;
|
|
78
|
+
readonly strokes: 1;
|
|
79
|
+
};
|
|
80
|
+
readonly single: {
|
|
81
|
+
readonly pattern: "solid";
|
|
82
|
+
readonly weight: 1;
|
|
83
|
+
readonly strokes: 1;
|
|
84
|
+
};
|
|
85
|
+
readonly words: {
|
|
86
|
+
readonly pattern: "solid";
|
|
87
|
+
readonly weight: 1;
|
|
88
|
+
readonly strokes: 1;
|
|
89
|
+
};
|
|
90
|
+
readonly double: {
|
|
91
|
+
readonly pattern: "double";
|
|
92
|
+
readonly weight: 1;
|
|
93
|
+
readonly strokes: 1;
|
|
94
|
+
};
|
|
95
|
+
readonly thick: {
|
|
96
|
+
readonly pattern: "solid";
|
|
97
|
+
readonly weight: 2;
|
|
98
|
+
readonly strokes: 1;
|
|
99
|
+
};
|
|
100
|
+
readonly dotted: {
|
|
101
|
+
readonly pattern: "dotted";
|
|
102
|
+
readonly weight: 1;
|
|
103
|
+
readonly strokes: 1;
|
|
104
|
+
};
|
|
105
|
+
readonly dottedHeavy: {
|
|
106
|
+
readonly pattern: "dotted";
|
|
107
|
+
readonly weight: 2;
|
|
108
|
+
readonly strokes: 1;
|
|
109
|
+
};
|
|
110
|
+
readonly dash: {
|
|
111
|
+
readonly pattern: "dashed";
|
|
112
|
+
readonly weight: 1;
|
|
113
|
+
readonly strokes: 1;
|
|
114
|
+
};
|
|
115
|
+
readonly dashedHeavy: {
|
|
116
|
+
readonly pattern: "dashed";
|
|
117
|
+
readonly weight: 2;
|
|
118
|
+
readonly strokes: 1;
|
|
119
|
+
};
|
|
120
|
+
readonly dashLong: {
|
|
121
|
+
readonly pattern: "dashed";
|
|
122
|
+
readonly weight: 1;
|
|
123
|
+
readonly strokes: 1;
|
|
124
|
+
};
|
|
125
|
+
readonly dashLongHeavy: {
|
|
126
|
+
readonly pattern: "dashed";
|
|
127
|
+
readonly weight: 2;
|
|
128
|
+
readonly strokes: 1;
|
|
129
|
+
};
|
|
130
|
+
readonly dotDash: {
|
|
131
|
+
readonly pattern: "dashed";
|
|
132
|
+
readonly weight: 1;
|
|
133
|
+
readonly strokes: 1;
|
|
134
|
+
};
|
|
135
|
+
readonly dashDotHeavy: {
|
|
136
|
+
readonly pattern: "dashed";
|
|
137
|
+
readonly weight: 2;
|
|
138
|
+
readonly strokes: 1;
|
|
139
|
+
};
|
|
140
|
+
readonly dotDotDash: {
|
|
141
|
+
readonly pattern: "dashed";
|
|
142
|
+
readonly weight: 1;
|
|
143
|
+
readonly strokes: 1;
|
|
144
|
+
};
|
|
145
|
+
readonly dashDotDotHeavy: {
|
|
146
|
+
readonly pattern: "dashed";
|
|
147
|
+
readonly weight: 2;
|
|
148
|
+
readonly strokes: 1;
|
|
149
|
+
};
|
|
150
|
+
readonly wave: {
|
|
151
|
+
readonly pattern: "wavy";
|
|
152
|
+
readonly weight: 1;
|
|
153
|
+
readonly strokes: 1;
|
|
154
|
+
};
|
|
155
|
+
readonly wavyHeavy: {
|
|
156
|
+
readonly pattern: "wavy";
|
|
157
|
+
readonly weight: 2;
|
|
158
|
+
readonly strokes: 1;
|
|
159
|
+
};
|
|
160
|
+
readonly wavyDouble: {
|
|
161
|
+
readonly pattern: "wavy";
|
|
162
|
+
readonly weight: 1;
|
|
163
|
+
readonly strokes: 2;
|
|
164
|
+
};
|
|
165
|
+
};
|
|
5
166
|
type ResolveStrokeResult = {
|
|
6
167
|
readonly stroke?: DisplayStroke;
|
|
7
168
|
/** The authored colour, when it could not be parsed. Report it, do not paint. */
|
|
8
169
|
readonly unresolvedColor?: string;
|
|
9
170
|
};
|
|
10
171
|
/**
|
|
11
|
-
* Turn an authored border into a paintable stroke. `undefined` stroke means
|
|
12
|
-
* "draw nothing": an explicit `none
|
|
13
|
-
*
|
|
172
|
+
* Turn an authored CSS border into a paintable stroke. `undefined` stroke means
|
|
173
|
+
* "draw nothing": an explicit `none` style, a non-positive width, or a colour
|
|
174
|
+
* this producer cannot resolve.
|
|
14
175
|
*/
|
|
15
176
|
declare const resolveBorderStroke: (border: BorderInput) => ResolveStrokeResult;
|
|
16
|
-
|
|
17
|
-
|
|
177
|
+
type OutlineInput = {
|
|
178
|
+
color?: string;
|
|
179
|
+
dash?: PresetLineDashVal;
|
|
180
|
+
width?: number;
|
|
181
|
+
};
|
|
182
|
+
/** Turn a shape or text-box outline into a paintable stroke. */
|
|
183
|
+
declare const resolveOutlineStroke: (outline: OutlineInput) => ResolveStrokeResult;
|
|
184
|
+
declare const underlinePattern: (style: UnderlineStyle | undefined) => StrokePattern;
|
|
185
|
+
declare const underlineWeight: (style: UnderlineStyle | undefined) => number;
|
|
186
|
+
declare const underlineStrokeCount: (style: UnderlineStyle | undefined) => number;
|
|
18
187
|
//#endregion
|
|
19
|
-
export { ResolveStrokeResult,
|
|
188
|
+
export { CSS_BORDER_STROKE_PATTERNS, PRESET_DASH_STROKE_PATTERNS, ResolveStrokeResult, UNDERLINE_STROKES, resolveBorderStroke, resolveOutlineStroke, underlinePattern, underlineStrokeCount, underlineWeight };
|
|
@@ -1,58 +1,164 @@
|
|
|
1
1
|
import { resolveCssBorderStroke } from "../../layout-painter/borderStroke.js";
|
|
2
2
|
import { parseDisplayColor } from "./colors.js";
|
|
3
|
+
import "./textDecorations.js";
|
|
3
4
|
//#region src/display-list/build/strokes.ts
|
|
4
5
|
/**
|
|
5
|
-
*
|
|
6
|
+
* Every CSS `border-style` folio paints, as a display-list pattern.
|
|
6
7
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* and a PDF strokes 0.4pt natively, so the authored fractional width and the
|
|
11
|
-
* plain colour survive here. Everything else (colour/style/width defaults) is
|
|
12
|
-
* taken from the painter's helper so the two cannot drift.
|
|
8
|
+
* The bevelled keywords have no display-list pattern, and Word draws
|
|
9
|
+
* `threeDEmboss`/`threeDEngrave` as a plain line where the shading is
|
|
10
|
+
* unavailable, so they stroke solid.
|
|
13
11
|
*/
|
|
14
|
-
|
|
15
|
-
* CSS `border-style` and the raw OOXML `w:val` names both reach
|
|
16
|
-
* `BorderStyle.style` (the bridge maps most, `renderParagraph` maps the rest),
|
|
17
|
-
* so both vocabularies are resolved here. Everything decorative that folio does
|
|
18
|
-
* not draw degrades to a plain line, matching how Word degrades on a platform
|
|
19
|
-
* without the specialised glyphs.
|
|
20
|
-
*/
|
|
21
|
-
const STROKE_PATTERN_BY_STYLE = {
|
|
12
|
+
const CSS_BORDER_STROKE_PATTERNS = {
|
|
22
13
|
none: "none",
|
|
23
|
-
nil: "none",
|
|
24
|
-
hidden: "none",
|
|
25
14
|
solid: "solid",
|
|
26
|
-
single: "solid",
|
|
27
|
-
thick: "solid",
|
|
28
|
-
inset: "solid",
|
|
29
|
-
outset: "solid",
|
|
30
|
-
ridge: "solid",
|
|
31
|
-
groove: "solid",
|
|
32
15
|
double: "double",
|
|
33
16
|
dotted: "dotted",
|
|
34
|
-
dotdash: "dashed",
|
|
35
|
-
dotdotdash: "dashed",
|
|
36
17
|
dashed: "dashed",
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
wave: "wavy",
|
|
42
|
-
wavydouble: "double"
|
|
18
|
+
groove: "solid",
|
|
19
|
+
ridge: "solid",
|
|
20
|
+
inset: "solid",
|
|
21
|
+
outset: "solid"
|
|
43
22
|
};
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
23
|
+
/**
|
|
24
|
+
* Every `ST_PresetLineDashVal` member, as a display-list pattern.
|
|
25
|
+
*
|
|
26
|
+
* DrawingML distinguishes dash length (`lgDash`) and the system patterns
|
|
27
|
+
* (`sysDash`) from the plain ones; a display list has three periodic patterns,
|
|
28
|
+
* so the distinction collapses to dotted or dashed. It collapses here, once,
|
|
29
|
+
* rather than at whichever consumer happened to know the spelling.
|
|
30
|
+
*/
|
|
31
|
+
const PRESET_DASH_STROKE_PATTERNS = {
|
|
32
|
+
solid: "solid",
|
|
33
|
+
dot: "dotted",
|
|
34
|
+
dash: "dashed",
|
|
35
|
+
lgDash: "dashed",
|
|
36
|
+
dashDot: "dashed",
|
|
37
|
+
lgDashDot: "dashed",
|
|
38
|
+
lgDashDotDot: "dashed",
|
|
39
|
+
sysDash: "dashed",
|
|
40
|
+
sysDot: "dotted",
|
|
41
|
+
sysDashDot: "dashed",
|
|
42
|
+
sysDashDotDot: "dashed"
|
|
48
43
|
};
|
|
49
44
|
/**
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
45
|
+
* Every `ST_Underline` member the model carries, one row per member.
|
|
46
|
+
*
|
|
47
|
+
* The three fields are one decision and belong on one line: `wavyDouble` is
|
|
48
|
+
* Word's two waves, which is the `wavy` pattern drawn twice rather than the
|
|
49
|
+
* `double` pattern, so a reader who has the pattern without the count has half
|
|
50
|
+
* the member. `double` is one stroke, because the display list's `double`
|
|
51
|
+
* pattern already carries the second rule and the gap between them. CSS can
|
|
52
|
+
* draw neither two waves nor `words`, so the editor approximates them; the page
|
|
53
|
+
* and the PDF do not have to.
|
|
54
|
+
*
|
|
55
|
+
* Word draws `thick` and the seven `*Heavy` members at twice the rule the font
|
|
56
|
+
* asks for, and the rest at the plain rule. Without the weight the display list
|
|
57
|
+
* strokes every member at the plain thickness, so `dottedHeavy` and `dotted`
|
|
58
|
+
* come out as the same line on the page and in the PDF while the editor draws
|
|
59
|
+
* them apart. The DOM spells this same weight as a
|
|
60
|
+
* `text-decoration-thickness` length (`utils/formatToStyle.ts`), so which
|
|
61
|
+
* members are heavy is decided here and nowhere else.
|
|
62
|
+
*
|
|
63
|
+
* `none` states no decoration: a run whose underline says so paints nothing,
|
|
64
|
+
* and its weight and stroke count are the plain ones by default rather than by
|
|
65
|
+
* decision.
|
|
53
66
|
*/
|
|
54
|
-
const
|
|
55
|
-
|
|
67
|
+
const UNDERLINE_STROKES = {
|
|
68
|
+
none: {
|
|
69
|
+
pattern: "none",
|
|
70
|
+
weight: 1,
|
|
71
|
+
strokes: 1
|
|
72
|
+
},
|
|
73
|
+
single: {
|
|
74
|
+
pattern: "solid",
|
|
75
|
+
weight: 1,
|
|
76
|
+
strokes: 1
|
|
77
|
+
},
|
|
78
|
+
words: {
|
|
79
|
+
pattern: "solid",
|
|
80
|
+
weight: 1,
|
|
81
|
+
strokes: 1
|
|
82
|
+
},
|
|
83
|
+
double: {
|
|
84
|
+
pattern: "double",
|
|
85
|
+
weight: 1,
|
|
86
|
+
strokes: 1
|
|
87
|
+
},
|
|
88
|
+
thick: {
|
|
89
|
+
pattern: "solid",
|
|
90
|
+
weight: 2,
|
|
91
|
+
strokes: 1
|
|
92
|
+
},
|
|
93
|
+
dotted: {
|
|
94
|
+
pattern: "dotted",
|
|
95
|
+
weight: 1,
|
|
96
|
+
strokes: 1
|
|
97
|
+
},
|
|
98
|
+
dottedHeavy: {
|
|
99
|
+
pattern: "dotted",
|
|
100
|
+
weight: 2,
|
|
101
|
+
strokes: 1
|
|
102
|
+
},
|
|
103
|
+
dash: {
|
|
104
|
+
pattern: "dashed",
|
|
105
|
+
weight: 1,
|
|
106
|
+
strokes: 1
|
|
107
|
+
},
|
|
108
|
+
dashedHeavy: {
|
|
109
|
+
pattern: "dashed",
|
|
110
|
+
weight: 2,
|
|
111
|
+
strokes: 1
|
|
112
|
+
},
|
|
113
|
+
dashLong: {
|
|
114
|
+
pattern: "dashed",
|
|
115
|
+
weight: 1,
|
|
116
|
+
strokes: 1
|
|
117
|
+
},
|
|
118
|
+
dashLongHeavy: {
|
|
119
|
+
pattern: "dashed",
|
|
120
|
+
weight: 2,
|
|
121
|
+
strokes: 1
|
|
122
|
+
},
|
|
123
|
+
dotDash: {
|
|
124
|
+
pattern: "dashed",
|
|
125
|
+
weight: 1,
|
|
126
|
+
strokes: 1
|
|
127
|
+
},
|
|
128
|
+
dashDotHeavy: {
|
|
129
|
+
pattern: "dashed",
|
|
130
|
+
weight: 2,
|
|
131
|
+
strokes: 1
|
|
132
|
+
},
|
|
133
|
+
dotDotDash: {
|
|
134
|
+
pattern: "dashed",
|
|
135
|
+
weight: 1,
|
|
136
|
+
strokes: 1
|
|
137
|
+
},
|
|
138
|
+
dashDotDotHeavy: {
|
|
139
|
+
pattern: "dashed",
|
|
140
|
+
weight: 2,
|
|
141
|
+
strokes: 1
|
|
142
|
+
},
|
|
143
|
+
wave: {
|
|
144
|
+
pattern: "wavy",
|
|
145
|
+
weight: 1,
|
|
146
|
+
strokes: 1
|
|
147
|
+
},
|
|
148
|
+
wavyHeavy: {
|
|
149
|
+
pattern: "wavy",
|
|
150
|
+
weight: 2,
|
|
151
|
+
strokes: 1
|
|
152
|
+
},
|
|
153
|
+
wavyDouble: {
|
|
154
|
+
pattern: "wavy",
|
|
155
|
+
weight: 1,
|
|
156
|
+
strokes: 2
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
/** What a border with a width but no style paints: the CSS initial. */
|
|
160
|
+
const DEFAULT_PATTERN = "solid";
|
|
161
|
+
const strokeWith = (border, pattern) => {
|
|
56
162
|
if (pattern === "none") return {};
|
|
57
163
|
const css = resolveCssBorderStroke(border);
|
|
58
164
|
const isSubPixelEncoded = css.color.startsWith("color-mix");
|
|
@@ -68,11 +174,25 @@ const resolveBorderStroke = (border) => {
|
|
|
68
174
|
pattern
|
|
69
175
|
} };
|
|
70
176
|
};
|
|
71
|
-
/**
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
177
|
+
/**
|
|
178
|
+
* Turn an authored CSS border into a paintable stroke. `undefined` stroke means
|
|
179
|
+
* "draw nothing": an explicit `none` style, a non-positive width, or a colour
|
|
180
|
+
* this producer cannot resolve.
|
|
181
|
+
*/
|
|
182
|
+
const resolveBorderStroke = (border) => strokeWith(border, border.style === void 0 ? DEFAULT_PATTERN : CSS_BORDER_STROKE_PATTERNS[border.style]);
|
|
183
|
+
/** Turn a shape or text-box outline into a paintable stroke. */
|
|
184
|
+
const resolveOutlineStroke = (outline) => strokeWith({
|
|
185
|
+
color: outline.color,
|
|
186
|
+
width: outline.width
|
|
187
|
+
}, outline.dash === void 0 ? DEFAULT_PATTERN : PRESET_DASH_STROKE_PATTERNS[outline.dash]);
|
|
188
|
+
/**
|
|
189
|
+
* An authored underline's row. An undefined member is a `w:u` with no `w:val`,
|
|
190
|
+
* which Word draws as the plain single rule, so it resolves to that member's
|
|
191
|
+
* row rather than to a default per field.
|
|
192
|
+
*/
|
|
193
|
+
const underlineStrokes = (style) => style === void 0 ? UNDERLINE_STROKES.single : UNDERLINE_STROKES[style];
|
|
194
|
+
const underlinePattern = (style) => underlineStrokes(style).pattern;
|
|
195
|
+
const underlineWeight = (style) => underlineStrokes(style).weight;
|
|
196
|
+
const underlineStrokeCount = (style) => underlineStrokes(style).strokes;
|
|
77
197
|
//#endregion
|
|
78
|
-
export {
|
|
198
|
+
export { CSS_BORDER_STROKE_PATTERNS, PRESET_DASH_STROKE_PATTERNS, UNDERLINE_STROKES, resolveBorderStroke, resolveOutlineStroke, underlinePattern, underlineStrokeCount, underlineWeight };
|
|
@@ -2,6 +2,8 @@ import { createTableCellFlowState, placeTableCellBlock } from "../../layout-engi
|
|
|
2
2
|
import { buildTableCellGrid, buildTableCellPlacements, getSourceCellAt } from "../../layout-engine/measure/tableCellGrid.js";
|
|
3
3
|
import { tableFragmentBottomBorders } from "../../layout-engine/measure/tableFragmentBorderGeometry.js";
|
|
4
4
|
import { resolveTableCellPadding } from "../../layout-engine/types.js";
|
|
5
|
+
import { cellTextRotationDegrees } from "../../layout-painter/renderTable.js";
|
|
6
|
+
import { paintsCssBorder } from "../../utils/borderCss.js";
|
|
5
7
|
import { HIT_REGION_KINDS } from "../primitives.js";
|
|
6
8
|
import { parseDisplayColor } from "./colors.js";
|
|
7
9
|
import { paintImageFragment } from "./imagePrimitives.js";
|
|
@@ -25,7 +27,7 @@ import { UNSUPPORTED_CONSTRUCT } from "./unsupported.js";
|
|
|
25
27
|
* engineering a gradient.
|
|
26
28
|
*/
|
|
27
29
|
/** A cell edge is "visible" for collapse purposes on style alone, as the painter decides it. */
|
|
28
|
-
const hasVisibleBorder = (border) => border !== void 0 && border.style
|
|
30
|
+
const hasVisibleBorder = (border) => border !== void 0 && paintsCssBorder(border.style);
|
|
29
31
|
const strokeFor = (border, context, label) => {
|
|
30
32
|
if (!hasVisibleBorder(border) || !border) return;
|
|
31
33
|
const { stroke, unresolvedColor } = resolveBorderStroke(border);
|
|
@@ -97,7 +99,7 @@ const paintCell = ({ composer, cell, cellMeasure, box, context, paintTextBox, si
|
|
|
97
99
|
const contentXPx = box.xPx + widths.left + padding.left;
|
|
98
100
|
const contentYPx = box.yPx + widths.top + padding.top;
|
|
99
101
|
const contentWidthPx = Math.max(0, cellMeasure.width - padding.left - padding.right);
|
|
100
|
-
if (cell.textDirection
|
|
102
|
+
if (cellTextRotationDegrees(cell.textDirection) !== 0) context.unsupported.report(UNSUPPORTED_CONSTRUCT.verticalCellText, context.pageIndex, `w:textDirection ${cell.textDirection} paints horizontally`);
|
|
101
103
|
composer.push(primitives);
|
|
102
104
|
primitives.length = 0;
|
|
103
105
|
paintCellBlocks({
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { layoutTextBoxContent } from "../../layout-engine/measure/textBoxParagraphLayout.js";
|
|
2
2
|
import { DEFAULT_TEXTBOX_MARGINS } from "../../layout-engine/types.js";
|
|
3
|
+
import { presetDashForOutlineAttr } from "../../types/documentEnumValues.js";
|
|
3
4
|
import { hasHorizontalFlip, hasVerticalFlip, parseRotationDegrees } from "../../utils/rotationBoundingBox.js";
|
|
4
5
|
import { HIT_REGION_KINDS } from "../primitives.js";
|
|
5
6
|
import { parseDisplayColor } from "./colors.js";
|
|
6
7
|
import { paintParagraphFragment } from "./paragraphPrimitives.js";
|
|
7
8
|
import { blockRegion, createPageComposer } from "./regions.js";
|
|
8
|
-
import {
|
|
9
|
+
import { resolveOutlineStroke } from "./strokes.js";
|
|
9
10
|
import { paintTableBlock } from "./tablePrimitives.js";
|
|
10
11
|
import { UNSUPPORTED_CONSTRUCT } from "./unsupported.js";
|
|
11
12
|
//#region src/display-list/build/textBoxPrimitives.ts
|
|
@@ -65,10 +66,11 @@ const paintUnrotatedTextBoxFragment = ({ composer, fragment, block, measure, con
|
|
|
65
66
|
else context.unsupported.report(UNSUPPORTED_CONSTRUCT.unresolvedColor, context.pageIndex, `text box fill ${block.fillColor}`);
|
|
66
67
|
}
|
|
67
68
|
let outlineWidthPx = 0;
|
|
68
|
-
|
|
69
|
-
|
|
69
|
+
const outlineDash = presetDashForOutlineAttr(block.outlineStyle) ?? "solid";
|
|
70
|
+
if (block.outlineWidth !== void 0 && block.outlineWidth > 0 && outlineDash !== "none") {
|
|
71
|
+
const { stroke, unresolvedColor } = resolveOutlineStroke({
|
|
70
72
|
width: block.outlineWidth,
|
|
71
|
-
|
|
73
|
+
dash: outlineDash,
|
|
72
74
|
color: block.outlineColor ?? "#000000"
|
|
73
75
|
});
|
|
74
76
|
if (unresolvedColor !== void 0) context.unsupported.report(UNSUPPORTED_CONSTRUCT.unresolvedColor, context.pageIndex, `text box outline ${unresolvedColor}`);
|
|
@@ -20,10 +20,24 @@ declare const UNDERLINE_OFFSET_RATIO = 0.1;
|
|
|
20
20
|
/** Underline thickness as a fraction of the em, floored so a hairline stays visible. */
|
|
21
21
|
declare const UNDERLINE_THICKNESS_RATIO: number;
|
|
22
22
|
declare const MIN_DECORATION_THICKNESS_PX = 1;
|
|
23
|
+
/**
|
|
24
|
+
* What an underline member's thickness is a multiple of the plain one.
|
|
25
|
+
*
|
|
26
|
+
* `thick` and the `*Heavy` members differ from their plain counterparts in
|
|
27
|
+
* weight only, and Word draws that weight as twice the plain rule. The number
|
|
28
|
+
* lives here rather than at either renderer because both read it: a member's
|
|
29
|
+
* row states it (`strokes.ts:UNDERLINE_STROKES`), the display list multiplies
|
|
30
|
+
* the stroke by it and the DOM spells the same row's weight as a
|
|
31
|
+
* `text-decoration-thickness` length
|
|
32
|
+
* (`formatToStyle.ts:underlineDecorationCss`). Two copies would let the page
|
|
33
|
+
* and the editor draw the same member at two weights.
|
|
34
|
+
*/
|
|
35
|
+
declare const PLAIN_UNDERLINE_WEIGHT = 1;
|
|
36
|
+
declare const HEAVY_UNDERLINE_WEIGHT = 2;
|
|
23
37
|
/** Distance above the baseline to the centre of the strikethrough, as a fraction of the em. */
|
|
24
38
|
declare const STRIKETHROUGH_OFFSET_RATIO = 0.28;
|
|
25
39
|
declare const underlineThicknessPx: (fontSizePx: number) => number;
|
|
26
40
|
declare const underlineCenterYPx: (baselineYPx: number, fontSizePx: number) => number;
|
|
27
41
|
declare const strikethroughCenterYPx: (baselineYPx: number, fontSizePx: number) => number;
|
|
28
42
|
//#endregion
|
|
29
|
-
export { MIN_DECORATION_THICKNESS_PX, STRIKETHROUGH_OFFSET_RATIO, UNDERLINE_OFFSET_RATIO, UNDERLINE_THICKNESS_RATIO, strikethroughCenterYPx, underlineCenterYPx, underlineThicknessPx };
|
|
43
|
+
export { HEAVY_UNDERLINE_WEIGHT, MIN_DECORATION_THICKNESS_PX, PLAIN_UNDERLINE_WEIGHT, STRIKETHROUGH_OFFSET_RATIO, UNDERLINE_OFFSET_RATIO, UNDERLINE_THICKNESS_RATIO, strikethroughCenterYPx, underlineCenterYPx, underlineThicknessPx };
|
|
@@ -20,10 +20,24 @@ const UNDERLINE_OFFSET_RATIO = .1;
|
|
|
20
20
|
/** Underline thickness as a fraction of the em, floored so a hairline stays visible. */
|
|
21
21
|
const UNDERLINE_THICKNESS_RATIO = 1 / 14;
|
|
22
22
|
const MIN_DECORATION_THICKNESS_PX = 1;
|
|
23
|
+
/**
|
|
24
|
+
* What an underline member's thickness is a multiple of the plain one.
|
|
25
|
+
*
|
|
26
|
+
* `thick` and the `*Heavy` members differ from their plain counterparts in
|
|
27
|
+
* weight only, and Word draws that weight as twice the plain rule. The number
|
|
28
|
+
* lives here rather than at either renderer because both read it: a member's
|
|
29
|
+
* row states it (`strokes.ts:UNDERLINE_STROKES`), the display list multiplies
|
|
30
|
+
* the stroke by it and the DOM spells the same row's weight as a
|
|
31
|
+
* `text-decoration-thickness` length
|
|
32
|
+
* (`formatToStyle.ts:underlineDecorationCss`). Two copies would let the page
|
|
33
|
+
* and the editor draw the same member at two weights.
|
|
34
|
+
*/
|
|
35
|
+
const PLAIN_UNDERLINE_WEIGHT = 1;
|
|
36
|
+
const HEAVY_UNDERLINE_WEIGHT = 2;
|
|
23
37
|
/** Distance above the baseline to the centre of the strikethrough, as a fraction of the em. */
|
|
24
38
|
const STRIKETHROUGH_OFFSET_RATIO = .28;
|
|
25
39
|
const underlineThicknessPx = (fontSizePx) => Math.max(1, fontSizePx * UNDERLINE_THICKNESS_RATIO);
|
|
26
40
|
const underlineCenterYPx = (baselineYPx, fontSizePx) => baselineYPx + fontSizePx * UNDERLINE_OFFSET_RATIO;
|
|
27
41
|
const strikethroughCenterYPx = (baselineYPx, fontSizePx) => baselineYPx - fontSizePx * STRIKETHROUGH_OFFSET_RATIO;
|
|
28
42
|
//#endregion
|
|
29
|
-
export { MIN_DECORATION_THICKNESS_PX, STRIKETHROUGH_OFFSET_RATIO, UNDERLINE_OFFSET_RATIO, UNDERLINE_THICKNESS_RATIO, strikethroughCenterYPx, underlineCenterYPx, underlineThicknessPx };
|
|
43
|
+
export { HEAVY_UNDERLINE_WEIGHT, MIN_DECORATION_THICKNESS_PX, PLAIN_UNDERLINE_WEIGHT, STRIKETHROUGH_OFFSET_RATIO, UNDERLINE_OFFSET_RATIO, UNDERLINE_THICKNESS_RATIO, strikethroughCenterYPx, underlineCenterYPx, underlineThicknessPx };
|
|
@@ -2,7 +2,7 @@ import { writeCommentAnchorIds } from "../../render-dom/commentAnchorAttributes.
|
|
|
2
2
|
import { bytesToDataUrl } from "../../utils/base64.js";
|
|
3
3
|
import { imageLuminanceFilter } from "../../utils/imageLuminance.js";
|
|
4
4
|
import { anchorTargetAttrs } from "../../utils/urlSecurity.js";
|
|
5
|
-
import { STROKE_DASH_FACTORS, walkRegions } from "../primitives.js";
|
|
5
|
+
import { STROKE_DASH_FACTORS, strokeCrossExtentPx, walkRegions } from "../primitives.js";
|
|
6
6
|
import { panic } from "better-result";
|
|
7
7
|
//#region src/display-list/dom/renderDisplayListToDom.ts
|
|
8
8
|
/**
|
|
@@ -162,24 +162,6 @@ const VERTICAL_BAR_AXES = {
|
|
|
162
162
|
main: "to bottom",
|
|
163
163
|
cross: "to right"
|
|
164
164
|
};
|
|
165
|
-
/**
|
|
166
|
-
* How far a stroke reaches across its path. A dash pattern stays within the
|
|
167
|
-
* thickness; `double` spans two lines plus the shared gap, and `wavy` the peak
|
|
168
|
-
* to peak amplitude plus the thickness the curve itself is drawn with.
|
|
169
|
-
*/
|
|
170
|
-
const strokeCrossExtentPx = (stroke) => {
|
|
171
|
-
switch (stroke.pattern) {
|
|
172
|
-
case "solid":
|
|
173
|
-
case "dashed":
|
|
174
|
-
case "dotted": return stroke.thicknessPx;
|
|
175
|
-
case "double": return stroke.thicknessPx * 3;
|
|
176
|
-
case "wavy": return stroke.thicknessPx * 3;
|
|
177
|
-
default: {
|
|
178
|
-
const unreachable = stroke.pattern;
|
|
179
|
-
panic(`renderDisplayListToDom: unhandled stroke pattern ${JSON.stringify(unreachable)}`);
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
};
|
|
183
165
|
const repeatingBars = (color, axis, barPx, gapPx) => `repeating-linear-gradient(${axis}, ${color} 0px, ${color} ${barPx}px, transparent ${barPx}px, transparent ${barPx + gapPx}px)`;
|
|
184
166
|
const strokeBackground = (stroke, axes) => {
|
|
185
167
|
const color = cssColor(stroke.color);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DisplayColor, DisplayGlyphRun, DisplayHitRegion, DisplayPrimitive } from "./types.js";
|
|
1
|
+
import { DisplayColor, DisplayGlyphRun, DisplayHitRegion, DisplayPrimitive, DisplayStroke } from "./types.js";
|
|
2
2
|
import { hasCursiveLetter, joinsAcrossBoundary } from "../utils/cursiveJoining.js";
|
|
3
3
|
import { hasComplexScript, isComplexScriptCodePoint } from "../utils/scriptSegments.js";
|
|
4
4
|
//#region src/display-list/primitives.d.ts
|
|
@@ -56,6 +56,17 @@ declare const DOUBLE_STROKE_GAP_FACTOR = 1;
|
|
|
56
56
|
*/
|
|
57
57
|
declare const WAVY_STROKE_PERIOD_FACTOR = 6;
|
|
58
58
|
declare const WAVY_STROKE_AMPLITUDE_FACTOR = 2;
|
|
59
|
+
/**
|
|
60
|
+
* How far a stroke reaches across its path: the band it occupies, centred on
|
|
61
|
+
* the path. A dash pattern stays within the thickness; `double` spans two rules
|
|
62
|
+
* plus the gap between them, and `wavy` the peak-to-peak amplitude plus the
|
|
63
|
+
* thickness the curve itself is drawn with.
|
|
64
|
+
*
|
|
65
|
+
* The DOM backend sizes an element with it and the producer stacks `wavyDouble`
|
|
66
|
+
* with it, so two strokes meant to clear each other are pushed apart by exactly
|
|
67
|
+
* the band the backend then paints.
|
|
68
|
+
*/
|
|
69
|
+
declare const strokeCrossExtentPx: (stroke: DisplayStroke) => number;
|
|
59
70
|
declare const BLACK: DisplayColor;
|
|
60
71
|
declare const WHITE: DisplayColor;
|
|
61
72
|
/**
|
|
@@ -93,4 +104,4 @@ type RegionVisitor = {
|
|
|
93
104
|
};
|
|
94
105
|
declare const walkRegions: (primitives: readonly DisplayPrimitive[], regions: readonly DisplayHitRegion[], visitor: RegionVisitor) => void;
|
|
95
106
|
//#endregion
|
|
96
|
-
export { BLACK, DISPLAY_PRIMITIVE_KINDS, DOUBLE_STROKE_GAP_FACTOR, HIT_REGION_KINDS, RegionVisitor, STROKE_DASH_FACTORS, WAVY_STROKE_AMPLITUDE_FACTOR, WAVY_STROKE_PERIOD_FACTOR, WHITE, glyphCellOffsetsPx, hasComplexScript, hasCursiveLetter, isComplexScriptCodePoint, joinsAcrossBoundary, walkRegions };
|
|
107
|
+
export { BLACK, DISPLAY_PRIMITIVE_KINDS, DOUBLE_STROKE_GAP_FACTOR, HIT_REGION_KINDS, RegionVisitor, STROKE_DASH_FACTORS, WAVY_STROKE_AMPLITUDE_FACTOR, WAVY_STROKE_PERIOD_FACTOR, WHITE, glyphCellOffsetsPx, hasComplexScript, hasCursiveLetter, isComplexScriptCodePoint, joinsAcrossBoundary, strokeCrossExtentPx, walkRegions };
|
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
import { hasCursiveLetter, joinsAcrossBoundary } from "../utils/cursiveJoining.js";
|
|
2
2
|
import { hasComplexScript, isComplexScriptCodePoint } from "../utils/scriptSegments.js";
|
|
3
|
+
import { panic } from "better-result";
|
|
3
4
|
//#region src/display-list/primitives.ts
|
|
4
5
|
/**
|
|
6
|
+
* Runtime companions of the paint IR.
|
|
7
|
+
*
|
|
8
|
+
* `types.ts` is pure data by rule, so what a backend needs at runtime lives
|
|
9
|
+
* here instead: the discriminator list a coverage test enumerates, the two
|
|
10
|
+
* colours every producer resolves a theme variable to, the stroke geometry
|
|
11
|
+
* both backends draw from, and the rule that turns a run's advances into a
|
|
12
|
+
* position per code point. A rule two backends must agree on belongs in one
|
|
13
|
+
* module, not in one copy each. Nothing here carries a layout fact, which is
|
|
14
|
+
* why a backend may take a runtime edge to it and not to `types.ts`.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
5
17
|
* Left edge of every code point of a run, as an offset from the run's `xPx`.
|
|
6
18
|
*
|
|
7
19
|
* One implementation for both backends. The ordering rule is prose in
|
|
@@ -71,6 +83,29 @@ const DOUBLE_STROKE_GAP_FACTOR = 1;
|
|
|
71
83
|
*/
|
|
72
84
|
const WAVY_STROKE_PERIOD_FACTOR = 6;
|
|
73
85
|
const WAVY_STROKE_AMPLITUDE_FACTOR = 2;
|
|
86
|
+
/**
|
|
87
|
+
* How far a stroke reaches across its path: the band it occupies, centred on
|
|
88
|
+
* the path. A dash pattern stays within the thickness; `double` spans two rules
|
|
89
|
+
* plus the gap between them, and `wavy` the peak-to-peak amplitude plus the
|
|
90
|
+
* thickness the curve itself is drawn with.
|
|
91
|
+
*
|
|
92
|
+
* The DOM backend sizes an element with it and the producer stacks `wavyDouble`
|
|
93
|
+
* with it, so two strokes meant to clear each other are pushed apart by exactly
|
|
94
|
+
* the band the backend then paints.
|
|
95
|
+
*/
|
|
96
|
+
const strokeCrossExtentPx = (stroke) => {
|
|
97
|
+
switch (stroke.pattern) {
|
|
98
|
+
case "solid":
|
|
99
|
+
case "dashed":
|
|
100
|
+
case "dotted": return stroke.thicknessPx;
|
|
101
|
+
case "double": return stroke.thicknessPx * 3;
|
|
102
|
+
case "wavy": return stroke.thicknessPx * 3;
|
|
103
|
+
default: {
|
|
104
|
+
const unreachable = stroke.pattern;
|
|
105
|
+
panic(`strokeCrossExtentPx: unhandled stroke pattern ${JSON.stringify(unreachable)}`);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
};
|
|
74
109
|
const BLACK = {
|
|
75
110
|
r: 0,
|
|
76
111
|
g: 0,
|
|
@@ -124,4 +159,4 @@ const walkRegions = (primitives, regions, visitor) => {
|
|
|
124
159
|
visit(0, primitives.length, regions);
|
|
125
160
|
};
|
|
126
161
|
//#endregion
|
|
127
|
-
export { BLACK, DISPLAY_PRIMITIVE_KINDS, DOUBLE_STROKE_GAP_FACTOR, HIT_REGION_KINDS, STROKE_DASH_FACTORS, WAVY_STROKE_AMPLITUDE_FACTOR, WAVY_STROKE_PERIOD_FACTOR, WHITE, glyphCellOffsetsPx, hasComplexScript, hasCursiveLetter, isComplexScriptCodePoint, joinsAcrossBoundary, walkRegions };
|
|
162
|
+
export { BLACK, DISPLAY_PRIMITIVE_KINDS, DOUBLE_STROKE_GAP_FACTOR, HIT_REGION_KINDS, STROKE_DASH_FACTORS, WAVY_STROKE_AMPLITUDE_FACTOR, WAVY_STROKE_PERIOD_FACTOR, WHITE, glyphCellOffsetsPx, hasComplexScript, hasCursiveLetter, isComplexScriptCodePoint, joinsAcrossBoundary, strokeCrossExtentPx, walkRegions };
|