@stll/folio-core 0.45.0 → 0.47.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai-edits/apply.js +85 -43
- package/dist/ai-edits/headless.js +2 -2
- package/dist/ai-edits/read.d.ts +1 -0
- package/dist/ai-edits/read.js +1 -0
- package/dist/ai-edits/snapshot.js +32 -27
- package/dist/ai-edits/table-cell-mutations.js +15 -7
- package/dist/ai-edits/table-geometry.js +21 -18
- package/dist/ai-edits/table-template.js +2 -2
- package/dist/compare/compare.js +2 -5
- package/dist/compare/content-alignment.js +108 -12
- package/dist/compare/content-types.d.ts +8 -2
- package/dist/compare/content.js +2 -11
- package/dist/compare/plan.js +7 -4
- package/dist/compare/scenario.js +2 -5
- package/dist/compare/section-boundary-properties.js +1 -2
- package/dist/compare/types.d.ts +9 -1
- package/dist/compare/types.js +12 -1
- package/dist/compat/eigenpal.d.ts +2 -1
- package/dist/compat/eigenpal.js +2 -1
- package/dist/content-controls/checkboxDisplay.d.ts +17 -0
- package/dist/content-controls/checkboxDisplay.js +46 -0
- package/dist/content-controls/findContentControls.js +3 -1
- package/dist/content-controls/mutateContentControls.js +57 -43
- package/dist/controller/contentControlWidgetController.d.ts +1 -0
- package/dist/controller/contentControlWidgetController.js +3 -0
- package/dist/controller/hiddenEditorApi.js +3 -1
- package/dist/controller/hiddenEditorManager.d.ts +1 -1
- package/dist/controller/hiddenEditorManager.js +6 -3
- package/dist/controller/layoutPipeline.js +8 -3
- package/dist/display-list/build/buildDisplayList.js +20 -1
- package/dist/display-list/build/imagePrimitives.d.ts +4 -4
- package/dist/display-list/build/imagePrimitives.js +38 -18
- package/dist/display-list/build/pageBorderPrimitives.js +2 -1
- package/dist/display-list/build/paragraphPrimitives.js +113 -14
- package/dist/display-list/build/previewPrimitives.d.ts +10 -0
- package/dist/display-list/build/previewPrimitives.js +89 -0
- package/dist/display-list/build/strokes.d.ts +177 -8
- package/dist/display-list/build/strokes.js +167 -47
- package/dist/display-list/build/tablePrimitives.js +4 -2
- package/dist/display-list/build/textBoxPrimitives.js +6 -4
- package/dist/display-list/build/textDecorations.d.ts +15 -1
- package/dist/display-list/build/textDecorations.js +15 -1
- package/dist/display-list/dom/renderDisplayListToDom.js +11 -21
- package/dist/display-list/primitives.d.ts +13 -2
- package/dist/display-list/primitives.js +36 -1
- package/dist/display-list/types.d.ts +17 -0
- package/dist/document-operations.js +2 -1
- package/dist/docx/attributeRemainder.d.ts +76 -0
- package/dist/docx/attributeRemainder.js +111 -0
- package/dist/docx/blockContentParser.d.ts +3 -1
- package/dist/docx/blockContentParser.js +102 -106
- package/dist/docx/blockPlainText.d.ts +3 -4
- package/dist/docx/blockPlainText.js +3 -0
- package/dist/docx/borderParser.js +26 -11
- package/dist/docx/builtInStyles.d.ts +8 -16
- package/dist/docx/builtInStyles.js +54 -17
- package/dist/docx/commentAnchorIndex.d.ts +30 -0
- package/dist/docx/commentAnchorIndex.js +50 -0
- package/dist/docx/commentParser.d.ts +1 -1
- package/dist/docx/commentParser.js +56 -39
- package/dist/docx/commentRangeIntegrity.d.ts +16 -1
- package/dist/docx/commentRangeIntegrity.js +42 -1
- package/dist/docx/commentRangeJoin.d.ts +9 -0
- package/dist/docx/commentRangeJoin.js +33 -0
- package/dist/docx/commentReferenceCompletion.d.ts +9 -0
- package/dist/docx/commentReferenceCompletion.js +47 -0
- package/dist/docx/commentReferenceNormalization.js +3 -1
- package/dist/docx/commentReplyMarkers.js +11 -19
- package/dist/docx/compatibility.js +56 -41
- package/dist/docx/containerChildren.d.ts +208 -0
- package/dist/docx/containerChildren.gen.d.ts +43 -0
- package/dist/docx/containerChildren.gen.js +263 -0
- package/dist/docx/containerChildren.js +153 -0
- package/dist/docx/diagramPreview.d.ts +14 -2
- package/dist/docx/diagramPreview.js +81 -169
- package/dist/docx/documentParser.d.ts +1 -1
- package/dist/docx/documentParser.js +7 -4
- package/dist/docx/drawingAnchor.d.ts +87 -0
- package/dist/docx/drawingAnchor.js +201 -0
- package/dist/docx/drawingUtils.d.ts +43 -38
- package/dist/docx/drawingUtils.js +205 -118
- package/dist/docx/ensureParaIds.js +17 -7
- package/dist/docx/fieldParser.d.ts +1 -1
- package/dist/docx/fieldParser.js +4 -4
- package/dist/docx/fieldState.d.ts +26 -0
- package/dist/docx/fieldState.js +53 -0
- package/dist/docx/fontTableParser.js +102 -41
- package/dist/docx/footnoteParser.d.ts +1 -1
- package/dist/docx/footnoteParser.js +10 -6
- package/dist/docx/graphicFrameLocks.d.ts +16 -4
- package/dist/docx/graphicFrameLocks.js +19 -6
- package/dist/docx/groupDrawingParser.js +4 -3
- package/dist/docx/headerFooterParser.js +1 -1
- package/dist/docx/headerFooterReferenceNormalization.js +1 -0
- package/dist/docx/hyperlinkParser.d.ts +66 -9
- package/dist/docx/hyperlinkParser.js +153 -26
- package/dist/docx/imageParser.js +160 -115
- package/dist/docx/index.d.ts +2 -1
- package/dist/docx/index.js +2 -1
- package/dist/docx/inlineContentRemovals.d.ts +28 -0
- package/dist/docx/inlineContentRemovals.js +46 -0
- package/dist/docx/inlineWrapperContent.d.ts +166 -0
- package/dist/docx/inlineWrapperContent.js +165 -0
- package/dist/docx/inlineWrapperParser.d.ts +11 -0
- package/dist/docx/inlineWrapperParser.js +60 -0
- package/dist/docx/nonVisualDrawingProps.d.ts +5 -13
- package/dist/docx/normalizeBaseDirection.js +12 -1
- package/dist/docx/numberingParser.d.ts +25 -2
- package/dist/docx/numberingParser.js +264 -361
- package/dist/docx/numberingReference.d.ts +9 -16
- package/dist/docx/numberingReference.js +17 -16
- package/dist/docx/numberingReferenceNormalization.js +7 -7
- package/dist/docx/ooxmlCounterFormatter.d.ts +1 -1
- package/dist/docx/ooxmlCounterFormatter.js +4 -1
- package/dist/docx/paraIdAttribute.d.ts +111 -0
- package/dist/docx/paraIdAttribute.js +142 -0
- package/dist/docx/paragraphParser.d.ts +10 -25
- package/dist/docx/paragraphParser.js +421 -496
- package/dist/docx/paragraphProperties.d.ts +23 -0
- package/dist/docx/paragraphProperties.js +279 -0
- package/dist/docx/paragraphPropertySource.js +7 -1
- package/dist/docx/paragraphTextBoxEnrichment.d.ts +3 -2
- package/dist/docx/paragraphTextBoxEnrichment.js +20 -59
- package/dist/docx/paragraphTraversal.d.ts +14 -10
- package/dist/docx/paragraphTraversal.js +53 -52
- package/dist/docx/parseWarningMessage.js +5 -1
- package/dist/docx/parserEnums.d.ts +6 -8
- package/dist/docx/parserEnums.js +4 -6
- package/dist/docx/preservedRunContent.d.ts +32 -0
- package/dist/docx/preservedRunContent.js +96 -0
- package/dist/docx/previewBudget.d.ts +44 -23
- package/dist/docx/previewBudget.js +61 -30
- package/dist/docx/propertyElementAttributes.d.ts +178 -0
- package/dist/docx/propertyElementAttributes.js +114 -0
- package/dist/docx/renderedPageBreakNormalization.js +4 -6
- package/dist/docx/rezip.d.ts +28 -2
- package/dist/docx/rezip.js +152 -27
- package/dist/docx/runConsolidator.d.ts +42 -2
- package/dist/docx/runConsolidator.js +60 -6
- package/dist/docx/runParser.d.ts +55 -19
- package/dist/docx/runParser.js +394 -306
- package/dist/docx/runPayload.d.ts +5 -0
- package/dist/docx/runPayload.js +4 -0
- package/dist/docx/sdtProperties.d.ts +39 -5
- package/dist/docx/sdtProperties.js +205 -84
- package/dist/docx/sdtPropertiesPatch.d.ts +5 -9
- package/dist/docx/sdtPropertiesPatch.js +68 -112
- package/dist/docx/sectionParser.d.ts +1 -2
- package/dist/docx/sectionParser.js +241 -238
- package/dist/docx/selectiveSave.js +3 -2
- package/dist/docx/selectiveXmlPatch.d.ts +66 -3
- package/dist/docx/selectiveXmlPatch.js +276 -133
- package/dist/docx/serializer/blockSdtSerializer.js +2 -96
- package/dist/docx/serializer/borderSerializer.d.ts +5 -5
- package/dist/docx/serializer/borderSerializer.js +12 -10
- package/dist/docx/serializer/commentSerializer.js +5 -7
- package/dist/docx/serializer/documentSerializer.js +11 -11
- package/dist/docx/serializer/fontTableSerializer.js +31 -3
- package/dist/docx/serializer/headerFooterSerializer.js +10 -9
- package/dist/docx/serializer/markupRangeAttributes.d.ts +9 -1
- package/dist/docx/serializer/markupRangeAttributes.js +9 -1
- package/dist/docx/serializer/noteSerializer.js +11 -8
- package/dist/docx/serializer/numberingSerializer.d.ts +1 -6
- package/dist/docx/serializer/numberingSerializer.js +81 -79
- package/dist/docx/serializer/paragraphSerializer.d.ts +1 -9
- package/dist/docx/serializer/paragraphSerializer.js +156 -236
- package/dist/docx/serializer/runSerializer.d.ts +1 -5
- package/dist/docx/serializer/runSerializer.js +134 -75
- package/dist/docx/serializer/sdtPropertiesSerializer.d.ts +26 -0
- package/dist/docx/serializer/sdtPropertiesSerializer.js +111 -0
- package/dist/docx/serializer/sectionPropertiesSerializer.js +42 -49
- package/dist/docx/serializer/settingsSerializer.js +6 -4
- package/dist/docx/serializer/stylesSerializer.js +8 -11
- package/dist/docx/serializer/tableSerializer.js +283 -105
- package/dist/docx/serializer/textFormattingSerializer.d.ts +28 -4
- package/dist/docx/serializer/textFormattingSerializer.js +111 -101
- package/dist/docx/serializer/xmlUtils.d.ts +1 -1
- package/dist/docx/serializer/xmlUtils.js +1 -1
- package/dist/docx/server/createBilingualDocument.js +20 -16
- package/dist/docx/server/materializeYjsDocx.d.ts +1 -1
- package/dist/docx/server/materializeYjsDocx.js +9 -1
- package/dist/docx/server/migrateYjsAttrSchema.d.ts +55 -0
- package/dist/docx/server/migrateYjsAttrSchema.js +95 -0
- package/dist/docx/settingsParser.js +7 -4
- package/dist/docx/shadingParser.d.ts +2 -1
- package/dist/docx/shadingParser.js +43 -7
- package/dist/docx/shapeParser.js +13 -8
- package/dist/docx/strictNames.d.ts +11 -0
- package/dist/docx/strictNames.gen.d.ts +45 -0
- package/dist/docx/strictNames.gen.js +50 -0
- package/dist/docx/strictNames.js +43 -0
- package/dist/docx/strictValueEncodings.gen.js +133 -131
- package/dist/docx/styleParser.js +17 -349
- package/dist/docx/tableParser.d.ts +11 -2
- package/dist/docx/tableParser.js +665 -220
- package/dist/docx/textBoxParser.d.ts +28 -3
- package/dist/docx/textBoxParser.js +69 -9
- package/dist/docx/themeColorAttribute.d.ts +13 -0
- package/dist/docx/themeColorAttribute.js +24 -0
- package/dist/docx/trackedMoveRangeNormalization.js +2 -1
- package/dist/docx/unzip.js +5 -4
- package/dist/docx/vmlImageParser.d.ts +30 -5
- package/dist/docx/vmlImageParser.js +91 -32
- package/dist/docx/vmlPreview.js +2 -2
- package/dist/docx/wrapPolygon.d.ts +30 -0
- package/dist/docx/wrapPolygon.js +70 -0
- package/dist/docx/xmlEncoding.d.ts +5 -0
- package/dist/docx/xmlEncoding.js +12 -0
- package/dist/docx/xmlParser.d.ts +23 -1
- package/dist/docx/xmlParser.js +31 -2
- package/dist/fonts/embeddedFonts.js +3 -3
- package/dist/headless-layout.js +12 -1
- package/dist/i18n/messages/catalogs.gen.d.ts +68 -0
- package/dist/i18n/messages/catalogs.gen.js +102 -34
- package/dist/i18n/messages/messages.gen.d.ts +4 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/internal/headlessRevisionResolution.js +9 -0
- package/dist/internal/pageBreakRunSourceDescendantIndex.js +7 -2
- package/dist/internal/paragraphFormattingSerialization.d.ts +20 -9
- package/dist/internal/paragraphFormattingSerialization.js +118 -83
- package/dist/layout-bridge/convert/footnoteLayout.d.ts +1 -0
- package/dist/layout-bridge/convert/footnoteLayout.js +1 -0
- package/dist/layout-bridge/convert/headerFooterLayout.d.ts +1 -0
- package/dist/layout-bridge/convert/headerFooterLayout.js +2 -0
- package/dist/layout-bridge/convert/toFlowBlocks.d.ts +17 -12
- package/dist/layout-bridge/convert/toFlowBlocks.js +267 -101
- package/dist/layout-engine/index.d.ts +2 -2
- package/dist/layout-engine/index.js +53 -17
- package/dist/layout-engine/measure/measureBlocks.d.ts +3 -0
- package/dist/layout-engine/measure/measureBlocks.js +6 -10
- package/dist/layout-engine/measure/tableCellFloating.d.ts +2 -0
- package/dist/layout-engine/measure/tableCellFloating.js +2 -0
- package/dist/layout-engine/measure/tableCellGrid.js +2 -1
- package/dist/layout-engine/measure/tableFragmentBorderGeometry.js +2 -1
- package/dist/layout-engine/measure/tableInlinePlacement.js +2 -5
- package/dist/layout-engine/paragraphSequence.js +3 -2
- package/dist/layout-engine/renderedBreakReconciliation.js +2 -1
- package/dist/layout-engine/section-breaks.d.ts +49 -2
- package/dist/layout-engine/section-breaks.js +55 -4
- package/dist/layout-engine/types.d.ts +69 -17
- package/dist/layout-engine/types.js +16 -1
- package/dist/layout-painter/borderStroke.d.ts +18 -4
- package/dist/layout-painter/renderImage.d.ts +5 -1
- package/dist/layout-painter/renderImage.js +10 -3
- package/dist/layout-painter/renderPage.d.ts +2 -0
- package/dist/layout-painter/renderPage.js +10 -4
- package/dist/layout-painter/renderParagraph.d.ts +14 -1
- package/dist/layout-painter/renderParagraph.js +34 -28
- package/dist/layout-painter/renderTable.d.ts +4 -1
- package/dist/layout-painter/renderTable.js +22 -22
- package/dist/layout-painter/renderTextBox.js +5 -3
- package/dist/managers/autoSaveCodec.d.ts +9 -1
- package/dist/managers/autoSaveCodec.js +12 -4
- package/dist/markdown/renderBlock.js +3 -0
- package/dist/markdown/renderRuns.d.ts +1 -1
- package/dist/markdown/renderRuns.js +34 -6
- package/dist/markdown/renderTable.js +24 -6
- package/dist/markdown/trailers.js +4 -1
- package/dist/model.d.ts +3 -3
- package/dist/model.js +2 -2
- package/dist/paged-layout/sectionBlockWidths.d.ts +3 -0
- package/dist/paged-layout/sectionBlockWidths.js +26 -4
- package/dist/pdf/images.js +142 -6
- package/dist/prosemirror/attrs/index.d.ts +34 -5
- package/dist/prosemirror/attrs/index.js +639 -48
- package/dist/prosemirror/authoredTransformAttrs.d.ts +28 -0
- package/dist/prosemirror/authoredTransformAttrs.js +64 -0
- package/dist/prosemirror/bookmarkBoundaryAttrs.d.ts +9 -1
- package/dist/prosemirror/bookmarkBoundaryAttrs.js +22 -3
- package/dist/prosemirror/commands/comments.js +68 -53
- package/dist/prosemirror/commands/contentControls.js +33 -20
- package/dist/prosemirror/commands/image.d.ts +10 -3
- package/dist/prosemirror/commands/image.js +46 -29
- package/dist/prosemirror/commands/pageBreak.js +1 -1
- package/dist/prosemirror/commands/paragraph.d.ts +2 -1
- package/dist/prosemirror/commands/propertyChangeScope.d.ts +12 -4
- package/dist/prosemirror/commands/propertyChangeScope.js +22 -4
- package/dist/prosemirror/commands/sectionBreak.d.ts +33 -1
- package/dist/prosemirror/commands/sectionBreak.js +187 -11
- package/dist/prosemirror/commentReferenceAttrs.d.ts +8 -0
- package/dist/prosemirror/commentReferenceAttrs.js +33 -0
- package/dist/prosemirror/commentReferenceIntegrity.d.ts +47 -0
- package/dist/prosemirror/commentReferenceIntegrity.js +43 -0
- package/dist/prosemirror/conversion/fromProseDoc.d.ts +17 -12
- package/dist/prosemirror/conversion/fromProseDoc.js +553 -207
- package/dist/prosemirror/conversion/index.d.ts +2 -2
- package/dist/prosemirror/conversion/preservedSinkCarriers.d.ts +39 -0
- package/dist/prosemirror/conversion/preservedSinkCarriers.js +19 -0
- package/dist/prosemirror/conversion/runShadingMark.js +14 -1
- package/dist/prosemirror/conversion/sdtAttrs.d.ts +10 -1
- package/dist/prosemirror/conversion/sdtAttrs.js +19 -5
- package/dist/prosemirror/conversion/toProseDoc.d.ts +7 -9
- package/dist/prosemirror/conversion/toProseDoc.js +801 -411
- package/dist/prosemirror/emptyRangeAnchor.d.ts +53 -0
- package/dist/prosemirror/emptyRangeAnchor.js +158 -0
- package/dist/prosemirror/extensions/StarterKit.js +14 -58
- package/dist/prosemirror/extensions/core/DocExtension.js +1 -1
- package/dist/prosemirror/extensions/core/ParagraphExtension.js +21 -16
- package/dist/prosemirror/extensions/features/BaseKeymapExtension.js +48 -29
- package/dist/prosemirror/extensions/features/EmptyParagraphFormatExtension.js +3 -1
- package/dist/prosemirror/extensions/features/ImagePasteExtension.js +5 -3
- package/dist/prosemirror/extensions/features/ListExtension.js +43 -24
- package/dist/prosemirror/extensions/features/ParaIdAllocatorExtension.js +1 -0
- package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.js +4 -3
- package/dist/prosemirror/extensions/features/PasteCleanupExtension.d.ts +3 -3
- package/dist/prosemirror/extensions/features/PasteCleanupExtension.js +5 -5
- package/dist/prosemirror/extensions/features/pasteCleanup.d.ts +3 -1
- package/dist/prosemirror/extensions/features/pasteCleanup.js +56 -2
- package/dist/prosemirror/extensions/features/pastedHeadingStyles.js +5 -4
- package/dist/prosemirror/extensions/markRegistry.d.ts +65 -0
- package/dist/prosemirror/extensions/markRegistry.js +138 -0
- package/dist/prosemirror/extensions/marks/InlineWrapperExtension.d.ts +18 -0
- package/dist/prosemirror/extensions/marks/InlineWrapperExtension.js +77 -0
- package/dist/prosemirror/extensions/marks/RunIdentityExtension.d.ts +26 -0
- package/dist/prosemirror/extensions/marks/RunIdentityExtension.js +134 -0
- package/dist/prosemirror/extensions/marks/TrackedChangeExtensions.js +2 -1
- package/dist/prosemirror/extensions/marks/UnderlineExtension.js +12 -18
- package/dist/prosemirror/extensions/marks/markUtils.d.ts +2 -1
- package/dist/prosemirror/extensions/marks/markUtils.js +49 -5
- package/dist/prosemirror/extensions/nodes/BlockBookmarkBoundaryExtension.d.ts +29 -0
- package/dist/prosemirror/extensions/nodes/BlockBookmarkBoundaryExtension.js +46 -0
- package/dist/prosemirror/extensions/nodes/BlockSdtExtension.d.ts +4 -3
- package/dist/prosemirror/extensions/nodes/BlockSdtExtension.js +18 -13
- package/dist/prosemirror/extensions/nodes/BookmarkBoundaryExtension.js +28 -53
- package/dist/prosemirror/extensions/nodes/CommentReferenceExtension.d.ts +11 -0
- package/dist/prosemirror/extensions/nodes/CommentReferenceExtension.js +97 -0
- package/dist/prosemirror/extensions/nodes/FieldExtension.js +9 -7
- package/dist/prosemirror/extensions/nodes/ImageExtension.js +24 -1
- package/dist/prosemirror/extensions/nodes/MoveRangeBoundaryExtension.d.ts +11 -0
- package/dist/prosemirror/extensions/nodes/MoveRangeBoundaryExtension.js +43 -0
- package/dist/prosemirror/extensions/nodes/PreservedBlockExtension.d.ts +32 -0
- package/dist/prosemirror/extensions/nodes/PreservedBlockExtension.js +67 -0
- package/dist/prosemirror/extensions/nodes/PreservedXmlExtension.d.ts +16 -0
- package/dist/prosemirror/extensions/nodes/PreservedXmlExtension.js +60 -0
- package/dist/prosemirror/extensions/nodes/RangeAnchorExtension.d.ts +13 -0
- package/dist/prosemirror/extensions/nodes/RangeAnchorExtension.js +65 -0
- package/dist/prosemirror/extensions/nodes/SdtExtension.d.ts +3 -1
- package/dist/prosemirror/extensions/nodes/SdtExtension.js +22 -16
- package/dist/prosemirror/extensions/nodes/ShapeExtension.js +7 -0
- package/dist/prosemirror/extensions/nodes/TableExtension.js +142 -123
- package/dist/prosemirror/extensions/nodes/TextBoxExtension.js +9 -1
- package/dist/prosemirror/extensions/nodes/bookmarkBoundaryDom.d.ts +23 -0
- package/dist/prosemirror/extensions/nodes/bookmarkBoundaryDom.js +57 -0
- package/dist/prosemirror/extensions/types.d.ts +12 -3
- package/dist/prosemirror/index.d.ts +4 -2
- package/dist/prosemirror/index.js +2 -1
- package/dist/prosemirror/inlineWrapperStack.d.ts +39 -0
- package/dist/prosemirror/inlineWrapperStack.js +92 -0
- package/dist/prosemirror/listMarker.d.ts +2 -2
- package/dist/prosemirror/listMarker.js +7 -8
- package/dist/prosemirror/listRenderingAttrs.js +11 -1
- package/dist/prosemirror/listState.d.ts +62 -0
- package/dist/prosemirror/listState.js +49 -0
- package/dist/prosemirror/moveRangeBoundaryAttrs.d.ts +13 -0
- package/dist/prosemirror/moveRangeBoundaryAttrs.js +114 -0
- package/dist/prosemirror/numberedRefFields.js +4 -4
- package/dist/prosemirror/numberingAttr.d.ts +55 -0
- package/dist/prosemirror/numberingAttr.js +74 -0
- package/dist/prosemirror/outlineLevelAttr.d.ts +29 -0
- package/dist/prosemirror/outlineLevelAttr.js +42 -0
- package/dist/prosemirror/pageBreakRunProjection.d.ts +17 -7
- package/dist/prosemirror/pageBreakRunProjection.js +19 -9
- package/dist/prosemirror/paragraphFormattingProvenance.d.ts +9 -0
- package/dist/prosemirror/paragraphFormattingProvenance.js +4 -1
- package/dist/prosemirror/plugins/selectionTracker.d.ts +3 -6
- package/dist/prosemirror/plugins/selectionTracker.js +3 -10
- package/dist/prosemirror/rangeAnchorAttrs.d.ts +14 -0
- package/dist/prosemirror/rangeAnchorAttrs.js +101 -0
- package/dist/prosemirror/replacedAnnotations.d.ts +59 -0
- package/dist/prosemirror/replacedAnnotations.js +183 -0
- package/dist/prosemirror/revisionCarriers.d.ts +86 -2
- package/dist/prosemirror/revisionCarriers.js +86 -60
- package/dist/prosemirror/runFormattingInlineCarriers.d.ts +5 -1
- package/dist/prosemirror/runFormattingInlineCarriers.js +7 -1
- package/dist/prosemirror/runIdentity.d.ts +28 -0
- package/dist/prosemirror/runIdentity.js +36 -0
- package/dist/prosemirror/runStyleFormatting.js +1 -1
- package/dist/prosemirror/schema/index.d.ts +3 -3
- package/dist/prosemirror/schema/marks.d.ts +47 -4
- package/dist/prosemirror/schema/nodes.d.ts +309 -26
- package/dist/prosemirror/schema/nodes.js +16 -1
- package/dist/prosemirror/sectionCarrier.d.ts +37 -0
- package/dist/prosemirror/sectionCarrier.js +40 -0
- package/dist/prosemirror/selectionState.d.ts +3 -0
- package/dist/prosemirror/selectionState.js +4 -1
- package/dist/prosemirror/styles/resolvedStyleAttrs.d.ts +5 -4
- package/dist/prosemirror/styles/resolvedStyleAttrs.js +15 -13
- package/dist/prosemirror/tableResize.js +5 -6
- package/dist/prosemirror/trackedRunInlineAtoms.d.ts +4 -0
- package/dist/prosemirror/trackedRunInlineAtoms.js +4 -0
- package/dist/prosemirror/utils/extractTrackedChanges.d.ts +10 -11
- package/dist/prosemirror/utils/extractTrackedChanges.js +109 -92
- package/dist/prosemirror/validation.js +31 -6
- package/dist/prosemirror/yjsDocumentMetadata.d.ts +73 -0
- package/dist/prosemirror/yjsDocumentMetadata.js +592 -0
- package/dist/prosemirror/zeroWidthAnchors.js +6 -0
- package/dist/render-dom/commentAnchorAttributes.d.ts +37 -0
- package/dist/render-dom/commentAnchorAttributes.js +54 -0
- package/dist/server.d.ts +3 -1
- package/dist/server.js +3 -1
- package/dist/style-sets/extract.js +4 -4
- package/dist/style-sets/stellaStyle.js +36 -23
- package/dist/types/colors.d.ts +2 -2
- package/dist/types/content.d.ts +2 -2
- package/dist/types/documentEnumValues.d.ts +53 -26
- package/dist/types/documentEnumValues.js +72 -174
- package/dist/types/formatting.d.ts +2 -2
- package/dist/types/index.d.ts +9 -2
- package/dist/utils/borderCss.d.ts +246 -0
- package/dist/utils/borderCss.js +325 -0
- package/dist/utils/clipboard.d.ts +9 -1
- package/dist/utils/clipboard.js +27 -1
- package/dist/utils/colorResolver.d.ts +4 -3
- package/dist/utils/colorResolver.js +45 -76
- package/dist/utils/createDocument.js +24 -6
- package/dist/utils/findReplace.js +52 -10
- package/dist/utils/formatToStyle.d.ts +84 -2
- package/dist/utils/formatToStyle.js +133 -52
- package/dist/utils/headingCollector.js +3 -2
- package/dist/utils/imageLuminance.d.ts +15 -0
- package/dist/utils/imageLuminance.js +32 -0
- package/dist/utils/mergeDocumentContent.js +12 -20
- package/dist/utils/paragraphFormattingMerge.js +27 -6
- package/dist/utils/replaceText.js +1 -0
- package/dist/utils/tableOperations.d.ts +5 -3
- package/dist/utils/tableOperations.js +14 -1
- package/dist/utils/tablePlacement.d.ts +7 -0
- package/dist/utils/tablePlacement.js +14 -0
- package/dist/utils/textDirectionFlow.d.ts +15 -0
- package/dist/utils/textDirectionFlow.js +38 -0
- package/dist/utils/textFormattingMerge.js +16 -4
- package/package.json +10 -10
- package/dist/ai-edits/__fixtures__/paragraphs.d.ts +0 -17
- package/dist/ai-edits/__fixtures__/paragraphs.js +0 -33
- package/dist/compare/__fixtures__/body-sequence.d.ts +0 -119
- package/dist/compare/__fixtures__/body-sequence.js +0 -225
- package/dist/compare/__fixtures__/nested-table.d.ts +0 -16
- package/dist/compare/__fixtures__/nested-table.js +0 -50
- package/dist/compare/__fixtures__/numbered-list.d.ts +0 -34
- package/dist/compare/__fixtures__/numbered-list.js +0 -85
- package/dist/docx/blockRangeMarkers.d.ts +0 -36
- package/dist/docx/blockRangeMarkers.js +0 -59
- package/dist/docx/bookmarkPlacement.d.ts +0 -9
- package/dist/docx/bookmarkPlacement.js +0 -50
- package/dist/fonts/embeddedFontTable.d.ts +0 -45
- package/dist/fonts/embeddedFontTable.js +0 -80
- package/dist/prosemirror/extensions/marks/PageBreakRunOwnerExtension.d.ts +0 -13
- package/dist/prosemirror/extensions/marks/PageBreakRunOwnerExtension.js +0 -39
- package/dist/prosemirror/yjsParagraphSourceContract.d.ts +0 -9
- package/dist/prosemirror/yjsParagraphSourceContract.js +0 -26
|
@@ -1,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;
|
|
@@ -99,6 +107,20 @@ type RunFormatting = {
|
|
|
99
107
|
* RTL; the painter sets `dir="ltr"` so style/paragraph RTL does not leak in.
|
|
100
108
|
*/
|
|
101
109
|
rtl?: boolean;
|
|
110
|
+
/**
|
|
111
|
+
* The bidirectional wrapper (`w:bdo` / `w:dir`) the run was authored inside,
|
|
112
|
+
* when it was inside one. An override switches the bidirectional algorithm
|
|
113
|
+
* off for its content, which is what makes a Latin word inside an `rtl`
|
|
114
|
+
* override read backwards; an embedding opens a level and leaves the
|
|
115
|
+
* algorithm on. `direction` is the wrapper's own `w:val`, absent when the
|
|
116
|
+
* wrapper states none.
|
|
117
|
+
*
|
|
118
|
+
* Distinct from `rtl`, which is the run's own `w:rtl` property: the wrapper
|
|
119
|
+
* is a container the author wrote around the run, not a property of it.
|
|
120
|
+
*/
|
|
121
|
+
bidiWrapper?: Omit<Extract<InlineWrapper, {
|
|
122
|
+
kind: "bidi";
|
|
123
|
+
}>, "type" | "kind" | "content">;
|
|
102
124
|
/**
|
|
103
125
|
* Text effect animation hint (w:effect). Word 2013+ no longer animates,
|
|
104
126
|
* but the painter emits `docx-text-effect-<name>` plus `data-effect` so
|
|
@@ -201,6 +223,8 @@ type ImageRunPosition = {
|
|
|
201
223
|
type ImageRun = {
|
|
202
224
|
kind: "image";
|
|
203
225
|
src: string;
|
|
226
|
+
/** Set instead of `src` for a drawing with no image data; see {@link ImageBlock.preview}. */
|
|
227
|
+
preview?: PreviewDescriptor;
|
|
204
228
|
width: number;
|
|
205
229
|
height: number;
|
|
206
230
|
alt?: string;
|
|
@@ -212,6 +236,10 @@ type ImageRun = {
|
|
|
212
236
|
* eigenpal #424 (opacity render pipeline).
|
|
213
237
|
*/
|
|
214
238
|
opacity?: number;
|
|
239
|
+
/** DrawingML picture brightness as a signed percentage. */
|
|
240
|
+
brightness?: number;
|
|
241
|
+
/** DrawingML picture contrast as a signed percentage. */
|
|
242
|
+
contrast?: number;
|
|
215
243
|
/** Position for floating/anchored images */
|
|
216
244
|
position?: ImageRunPosition;
|
|
217
245
|
/** Whether a table-cell anchor uses the cell as its positioning scope. Undefined defaults true. */
|
|
@@ -242,7 +270,7 @@ type ImageRun = {
|
|
|
242
270
|
/** CSS border color. eigenpal #1096. */
|
|
243
271
|
borderColor?: string;
|
|
244
272
|
/** CSS border style. eigenpal #1096. */
|
|
245
|
-
borderStyle?:
|
|
273
|
+
borderStyle?: CssBorderStyle;
|
|
246
274
|
/** Whether this picture is itself a tracked insertion (`<w:ins>`). eigenpal #641. */
|
|
247
275
|
isInsertion?: boolean;
|
|
248
276
|
/** Whether this picture is itself a tracked deletion (`<w:del>`). eigenpal #641. */
|
|
@@ -349,7 +377,7 @@ type TabStop = {
|
|
|
349
377
|
* Border specification for paragraphs.
|
|
350
378
|
*/
|
|
351
379
|
type BorderStyle = {
|
|
352
|
-
style?:
|
|
380
|
+
style?: CssBorderStyle;
|
|
353
381
|
width?: number;
|
|
354
382
|
color?: string;
|
|
355
383
|
space?: number;
|
|
@@ -366,12 +394,19 @@ type ParagraphBorders = {
|
|
|
366
394
|
bar?: BorderStyle;
|
|
367
395
|
};
|
|
368
396
|
/**
|
|
369
|
-
*
|
|
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.
|
|
370
408
|
*/
|
|
371
|
-
|
|
372
|
-
numId?: number;
|
|
373
|
-
ilvl?: number;
|
|
374
|
-
};
|
|
409
|
+
declare const isListNumPr: (value: ParagraphNumberingOverride | null | undefined) => value is ParagraphNumberingOverride;
|
|
375
410
|
/**
|
|
376
411
|
* Paragraph block attributes.
|
|
377
412
|
*/
|
|
@@ -407,8 +442,8 @@ type ParagraphAttrs = {
|
|
|
407
442
|
};
|
|
408
443
|
useLegacyEthiopicAmharicRules?: boolean;
|
|
409
444
|
};
|
|
410
|
-
/** OOXML outline level (`w:outlineLvl`),
|
|
411
|
-
outlineLevel?:
|
|
445
|
+
/** The stated OOXML outline level (`w:outlineLvl`), heading or body text. */
|
|
446
|
+
outlineLevel?: OutlineLevel;
|
|
412
447
|
spacing?: ParagraphSpacing;
|
|
413
448
|
/** Whether this paragraph participates in the active section line grid. */
|
|
414
449
|
snapToGrid?: boolean;
|
|
@@ -464,7 +499,7 @@ type ParagraphAttrs = {
|
|
|
464
499
|
suppressEmptyParagraphHeight?: boolean;
|
|
465
500
|
/** Reserve the reference extra line advance for a story-leading empty level-0 outline paragraph. */
|
|
466
501
|
reserveEmptyOutlineHeight?: boolean;
|
|
467
|
-
numPr?:
|
|
502
|
+
numPr?: ParagraphNumberingOverride;
|
|
468
503
|
listMarker?: string;
|
|
469
504
|
listIsBullet?: boolean;
|
|
470
505
|
listMarkerHidden?: boolean;
|
|
@@ -546,7 +581,7 @@ type ParagraphBlock = {
|
|
|
546
581
|
type CellBorderSpec = {
|
|
547
582
|
width?: number;
|
|
548
583
|
color?: string;
|
|
549
|
-
style?:
|
|
584
|
+
style?: CssBorderStyle;
|
|
550
585
|
};
|
|
551
586
|
/**
|
|
552
587
|
* Cell borders (all four sides).
|
|
@@ -670,6 +705,12 @@ type ImageBlock = {
|
|
|
670
705
|
kind: "image";
|
|
671
706
|
id: BlockId;
|
|
672
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;
|
|
673
714
|
width: number;
|
|
674
715
|
height: number;
|
|
675
716
|
alt?: string;
|
|
@@ -681,6 +722,10 @@ type ImageBlock = {
|
|
|
681
722
|
* eigenpal #424 (opacity render pipeline).
|
|
682
723
|
*/
|
|
683
724
|
opacity?: number;
|
|
725
|
+
/** DrawingML picture brightness as a signed percentage. */
|
|
726
|
+
brightness?: number;
|
|
727
|
+
/** DrawingML picture contrast as a signed percentage. */
|
|
728
|
+
contrast?: number;
|
|
684
729
|
anchor?: {
|
|
685
730
|
isAnchored?: boolean;
|
|
686
731
|
offsetH?: number;
|
|
@@ -702,7 +747,7 @@ type ImageBlock = {
|
|
|
702
747
|
/** CSS border color. eigenpal #1096. */
|
|
703
748
|
borderColor?: string;
|
|
704
749
|
/** CSS border style. eigenpal #1096. */
|
|
705
|
-
borderStyle?:
|
|
750
|
+
borderStyle?: CssBorderStyle;
|
|
706
751
|
pmStart?: number;
|
|
707
752
|
pmEnd?: number;
|
|
708
753
|
};
|
|
@@ -712,7 +757,14 @@ type ImageBlock = {
|
|
|
712
757
|
type SectionBreakBlock = {
|
|
713
758
|
kind: "sectionBreak";
|
|
714
759
|
id: BlockId;
|
|
715
|
-
|
|
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;
|
|
716
768
|
pageSize?: {
|
|
717
769
|
w: number;
|
|
718
770
|
h: number;
|
|
@@ -1438,4 +1490,4 @@ declare function resolveTableWidthPx(width: number | undefined, widthType: Table
|
|
|
1438
1490
|
/** Return the leading visual offset for a row with omitted grid columns. */
|
|
1439
1491
|
declare const getTableRowLeadingWidth: (row: TableRow, columnWidths: readonly number[]) => number;
|
|
1440
1492
|
//#endregion
|
|
1441
|
-
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;
|
|
@@ -15,6 +15,8 @@ declare const IMAGE_CLASS_NAMES: {
|
|
|
15
15
|
*/
|
|
16
16
|
type ImageVisualAttrs = {
|
|
17
17
|
opacity?: number;
|
|
18
|
+
brightness?: number;
|
|
19
|
+
contrast?: number;
|
|
18
20
|
cropTop?: number;
|
|
19
21
|
cropRight?: number;
|
|
20
22
|
cropBottom?: number;
|
|
@@ -43,6 +45,8 @@ declare function applyImageBorder(element: HTMLElement, border: ImageBorderAttrs
|
|
|
43
45
|
*/
|
|
44
46
|
declare function hasImageVisualAttrs(v: ImageVisualAttrs): boolean;
|
|
45
47
|
declare function hasImageCrop(v: ImageVisualAttrs): boolean;
|
|
48
|
+
/** Apply non-geometric opacity and luminance effects to an image element. */
|
|
49
|
+
declare function applyImageColorAttrs(img: HTMLImageElement, v: ImageVisualAttrs): void;
|
|
46
50
|
/**
|
|
47
51
|
* Apply an OOXML `<a:srcRect>` crop to an `<img>` whose parent already has
|
|
48
52
|
* `overflow: hidden` and is sized to the *visible* (cropped) dimensions
|
|
@@ -96,4 +100,4 @@ type RenderImageFragmentOptions = {
|
|
|
96
100
|
*/
|
|
97
101
|
declare function renderImageFragment(fragment: ImageFragment, block: ImageBlock, _measure: ImageMeasure, _context: RenderContext, options?: RenderImageFragmentOptions): HTMLElement;
|
|
98
102
|
//#endregion
|
|
99
|
-
export { IMAGE_CLASS_NAMES, ImageBorderAttrs, ImageVisualAttrs, RenderImageFragmentOptions, applyImageBorder, applyImageVisualAttrs, hasImageCrop, hasImageVisualAttrs, renderImageFragment, wrapImageWithCrop };
|
|
103
|
+
export { IMAGE_CLASS_NAMES, ImageBorderAttrs, ImageVisualAttrs, RenderImageFragmentOptions, applyImageBorder, applyImageColorAttrs, applyImageVisualAttrs, hasImageCrop, hasImageVisualAttrs, renderImageFragment, wrapImageWithCrop };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { imageLuminanceFilter } from "../utils/imageLuminance.js";
|
|
1
2
|
import { applySanitizedImageSrc } from "../utils/sanitizeImageSrc.js";
|
|
2
3
|
import { anchorTargetAttrs, sanitizeExternalUrl } from "../utils/urlSecurity.js";
|
|
3
4
|
//#region src/layout-painter/renderImage.ts
|
|
@@ -32,11 +33,17 @@ function applyImageBorder(element, border) {
|
|
|
32
33
|
*/
|
|
33
34
|
function hasImageVisualAttrs(v) {
|
|
34
35
|
if (v.opacity != null && v.opacity < 1) return true;
|
|
35
|
-
return hasImageCrop(v);
|
|
36
|
+
return imageLuminanceFilter(v) !== void 0 || hasImageCrop(v);
|
|
36
37
|
}
|
|
37
38
|
function hasImageCrop(v) {
|
|
38
39
|
return Boolean(v.cropTop || v.cropRight || v.cropBottom || v.cropLeft);
|
|
39
40
|
}
|
|
41
|
+
/** Apply non-geometric opacity and luminance effects to an image element. */
|
|
42
|
+
function applyImageColorAttrs(img, v) {
|
|
43
|
+
if (v.opacity != null && v.opacity < 1) img.style.opacity = String(Math.max(0, v.opacity));
|
|
44
|
+
const filter = imageLuminanceFilter(v);
|
|
45
|
+
if (filter !== void 0) img.style.filter = filter;
|
|
46
|
+
}
|
|
40
47
|
/**
|
|
41
48
|
* Apply an OOXML `<a:srcRect>` crop to an `<img>` whose parent already has
|
|
42
49
|
* `overflow: hidden` and is sized to the *visible* (cropped) dimensions
|
|
@@ -58,7 +65,7 @@ function hasImageCrop(v) {
|
|
|
58
65
|
* call for plain images.
|
|
59
66
|
*/
|
|
60
67
|
function applyImageVisualAttrs(img, v) {
|
|
61
|
-
|
|
68
|
+
applyImageColorAttrs(img, v);
|
|
62
69
|
const top = v.cropTop ?? 0;
|
|
63
70
|
const right = v.cropRight ?? 0;
|
|
64
71
|
const bottom = v.cropBottom ?? 0;
|
|
@@ -159,4 +166,4 @@ function renderImageFragment(fragment, block, _measure, _context, options = {})
|
|
|
159
166
|
return containerEl;
|
|
160
167
|
}
|
|
161
168
|
//#endregion
|
|
162
|
-
export { IMAGE_CLASS_NAMES, applyImageBorder, applyImageVisualAttrs, hasImageCrop, hasImageVisualAttrs, renderImageFragment, wrapImageWithCrop };
|
|
169
|
+
export { IMAGE_CLASS_NAMES, applyImageBorder, applyImageColorAttrs, applyImageVisualAttrs, hasImageCrop, hasImageVisualAttrs, renderImageFragment, wrapImageWithCrop };
|
|
@@ -19,6 +19,8 @@ type PageFloatingImage = {
|
|
|
19
19
|
* opaque. eigenpal #424 (opacity render pipeline).
|
|
20
20
|
*/
|
|
21
21
|
opacity?: number;
|
|
22
|
+
brightness?: number;
|
|
23
|
+
contrast?: number;
|
|
22
24
|
/** Which side: 'left' for left margin, 'right' for right margin */
|
|
23
25
|
side: "left" | "right";
|
|
24
26
|
/** X position relative to content area (0 = left edge of content) */
|
|
@@ -3,6 +3,7 @@ import { rectsToFloatingZones } from "../layout-engine/measure/floatingZones.js"
|
|
|
3
3
|
import { measureParagraph } from "../layout-engine/measure/measureParagraph.js";
|
|
4
4
|
import { resolveTableInlineOffset } from "../layout-engine/measure/tableInlinePlacement.js";
|
|
5
5
|
import { floatingTextBoxReservesBand, floatingTextBoxWrapsText, isFloatingImageRun, isFloatingTextBoxBlock, isTextWrappingFloatingImageRun } from "../layout-engine/types.js";
|
|
6
|
+
import { cssBorderStyle } from "../utils/borderCss.js";
|
|
6
7
|
import { resolveFontFamily } from "../utils/fontResolver.js";
|
|
7
8
|
import { borderToStyle } from "../utils/formatToStyle.js";
|
|
8
9
|
import { normalizeHorizontalScalePercent } from "../utils/horizontalScale.js";
|
|
@@ -17,6 +18,7 @@ import { renderTextBoxFragment } from "./renderTextBox.js";
|
|
|
17
18
|
import { emuToPixels } from "./renderUtils.js";
|
|
18
19
|
import { renderWatermarkLayer } from "./renderWatermark.js";
|
|
19
20
|
import { panic } from "better-result";
|
|
21
|
+
import { statesNoBorder } from "@stll/docx-core/model";
|
|
20
22
|
//#region src/layout-painter/renderPage.ts
|
|
21
23
|
/**
|
|
22
24
|
* Page Renderer
|
|
@@ -76,13 +78,13 @@ function pageBorderSpacePx(border) {
|
|
|
76
78
|
* exact stroke they will see on screen.
|
|
77
79
|
*/
|
|
78
80
|
function pageBorderWidthPx(border) {
|
|
79
|
-
if (!border || border.style
|
|
81
|
+
if (!border || statesNoBorder(border.style)) return 0;
|
|
80
82
|
const widthPx = border.size !== void 0 && border.size !== 0 ? eighthsToPixels(border.size) : 1;
|
|
81
83
|
const floored = Math.max(1, widthPx);
|
|
82
|
-
return border.style === "double" ? Math.max(3, floored) : floored;
|
|
84
|
+
return cssBorderStyle(border.style) === "double" ? Math.max(3, floored) : floored;
|
|
83
85
|
}
|
|
84
86
|
function applyPageBorderSide(element, border, side, theme) {
|
|
85
|
-
if (!border || border.style
|
|
87
|
+
if (!border || statesNoBorder(border.style)) return;
|
|
86
88
|
const styles = borderToStyle(border, side, theme);
|
|
87
89
|
for (const [key, value] of Object.entries(styles)) element.style[key] = String(value);
|
|
88
90
|
const styleKey = `border${side}Style`;
|
|
@@ -100,7 +102,7 @@ function renderPageBorderOverlay(page, options, doc) {
|
|
|
100
102
|
pb.bottom,
|
|
101
103
|
pb.left,
|
|
102
104
|
pb.right
|
|
103
|
-
].some((border) => border
|
|
105
|
+
].some((border) => border !== void 0 && !statesNoBorder(border.style))) return null;
|
|
104
106
|
const offsetFrom = pb.offsetFrom ?? "text";
|
|
105
107
|
const topOffset = pageBorderSpacePx(pb.top);
|
|
106
108
|
const rightOffset = pageBorderSpacePx(pb.right);
|
|
@@ -371,6 +373,8 @@ function extractFloatingImagesFromParagraph(block, fragmentY, geometry) {
|
|
|
371
373
|
...imgRun.alt !== void 0 ? { alt: imgRun.alt } : {},
|
|
372
374
|
...imgRun.transform !== void 0 ? { transform: imgRun.transform } : {},
|
|
373
375
|
...imgRun.opacity != null ? { opacity: imgRun.opacity } : {},
|
|
376
|
+
...imgRun.brightness != null ? { brightness: imgRun.brightness } : {},
|
|
377
|
+
...imgRun.contrast != null ? { contrast: imgRun.contrast } : {},
|
|
374
378
|
side,
|
|
375
379
|
x,
|
|
376
380
|
y,
|
|
@@ -460,6 +464,8 @@ function renderHeaderFooterContent(content, context, options, layout) {
|
|
|
460
464
|
height: run.height,
|
|
461
465
|
...run.alt !== void 0 ? { alt: run.alt } : {},
|
|
462
466
|
...run.opacity != null ? { opacity: run.opacity } : {},
|
|
467
|
+
...run.brightness != null ? { brightness: run.brightness } : {},
|
|
468
|
+
...run.contrast != null ? { contrast: run.contrast } : {},
|
|
463
469
|
...run.pmStart !== void 0 ? { pmStart: run.pmStart } : {},
|
|
464
470
|
...run.pmEnd !== void 0 ? { pmEnd: run.pmEnd } : {},
|
|
465
471
|
paragraphY: paragraphStartY,
|
|
@@ -30,6 +30,18 @@ type RenderParagraphOptions = {
|
|
|
30
30
|
renderedInlineImageKeys?: Set<string>;
|
|
31
31
|
};
|
|
32
32
|
declare function getRenderableTextColor(run: TextRun | TabRun): string | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* How CSS spells each bidirectional wrapper: an override switches the
|
|
35
|
+
* bidirectional algorithm off for its content, an embedding opens a level and
|
|
36
|
+
* leaves it on.
|
|
37
|
+
*
|
|
38
|
+
* Both painters write the keyword from here, so the DOM painter and the
|
|
39
|
+
* display list cannot spell the pair differently.
|
|
40
|
+
*/
|
|
41
|
+
declare const UNICODE_BIDI_BY_WRAPPER_CONTROL: {
|
|
42
|
+
readonly override: "bidi-override";
|
|
43
|
+
readonly embedding: "embed";
|
|
44
|
+
};
|
|
33
45
|
/**
|
|
34
46
|
* Get leader character for tab
|
|
35
47
|
*/
|
|
@@ -122,6 +134,7 @@ type RenderLineOptions = {
|
|
|
122
134
|
* @returns The line DOM element
|
|
123
135
|
*/
|
|
124
136
|
declare function renderLine(block: ParagraphBlock, line: MeasuredLine, alignment: "left" | "center" | "right" | "justify" | undefined, doc: Document, options?: RenderLineOptions): HTMLElement;
|
|
137
|
+
declare const paragraphHasTrackedChanges: (block: ParagraphBlock) => boolean;
|
|
125
138
|
/**
|
|
126
139
|
* Render a paragraph fragment
|
|
127
140
|
*
|
|
@@ -134,4 +147,4 @@ declare function renderLine(block: ParagraphBlock, line: MeasuredLine, alignment
|
|
|
134
147
|
*/
|
|
135
148
|
declare function renderParagraphFragment(fragment: ParagraphFragment, block: ParagraphBlock, measure: ParagraphMeasure, context: RenderContext, options?: RenderParagraphOptions): HTMLElement;
|
|
136
149
|
//#endregion
|
|
137
|
-
export { PARAGRAPH_CLASS_NAMES, RenderParagraphOptions, getLeaderChar, getRenderableTextColor, renderLine, renderParagraphFragment, sliceRunsForLine, splitCollapsibleLineEdgeSpaces, splitTextRunsByEastAsia, startsAfterSoftWrap };
|
|
150
|
+
export { PARAGRAPH_CLASS_NAMES, RenderParagraphOptions, UNICODE_BIDI_BY_WRAPPER_CONTROL, getLeaderChar, getRenderableTextColor, paragraphHasTrackedChanges, renderLine, renderParagraphFragment, sliceRunsForLine, splitCollapsibleLineEdgeSpaces, splitTextRunsByEastAsia, startsAfterSoftWrap };
|
|
@@ -8,9 +8,11 @@ import { DOCX_SCRIPT_FONT_SCALE } from "../layout-engine/measure/measureHelpers.
|
|
|
8
8
|
import { calculateTabWidth } from "../layout-engine/measure/tabCalculator.js";
|
|
9
9
|
import { FONT_KERNING_MODE, countCompressibleSpaces, getFontKerningMode, getRunFontKerningMode, toPaintedText } from "../layout-engine/measure/textMeasurementPolicy.js";
|
|
10
10
|
import { isFloatingImageRun } from "../layout-engine/types.js";
|
|
11
|
+
import { writeCommentAnchorIds } from "../render-dom/commentAnchorAttributes.js";
|
|
11
12
|
import { AUTHOR_COLORS, getAuthorColorIdx } from "../utils/authorColors.js";
|
|
12
13
|
import { resolveFontFamily } from "../utils/fontResolver.js";
|
|
13
14
|
import "../utils/fontWeights.js";
|
|
15
|
+
import { underlineDecorationCss } from "../utils/formatToStyle.js";
|
|
14
16
|
import { getHorizontalScaleFactor } from "../utils/horizontalScale.js";
|
|
15
17
|
import { resolvePhysicalParagraphInlineLayout } from "../utils/paragraphInlineLayout.js";
|
|
16
18
|
import { inlineImageBoundingBox, parseRotationDegrees, rotatedBoundingBox } from "../utils/rotationBoundingBox.js";
|
|
@@ -20,7 +22,7 @@ import { anchorTargetAttrs, sanitizeExternalUrl } from "../utils/urlSecurity.js"
|
|
|
20
22
|
import { borderStrokeToCss, resolveParagraphBorderHorizontalOutsets } from "./borderStroke.js";
|
|
21
23
|
import { planCursiveJoiners, withCursiveJoiners } from "./cursiveJoiners.js";
|
|
22
24
|
import { getAutomaticTextColorForBackground, setAuthoredBackgroundColor, setAuthoredTextColor } from "./documentColors.js";
|
|
23
|
-
import { applyImageBorder, applyImageVisualAttrs, hasImageCrop, hasImageVisualAttrs, wrapImageWithCrop } from "./renderImage.js";
|
|
25
|
+
import { applyImageBorder, applyImageColorAttrs, applyImageVisualAttrs, hasImageCrop, hasImageVisualAttrs, wrapImageWithCrop } from "./renderImage.js";
|
|
24
26
|
import { resolveImageLineAlign } from "./renderUtils.js";
|
|
25
27
|
import { applySdtDataAttrs } from "./sdtBoundary.js";
|
|
26
28
|
//#region src/layout-painter/renderParagraph.ts
|
|
@@ -164,6 +166,18 @@ function applyHorizontalScaleTransform(element, horizontalScale) {
|
|
|
164
166
|
element.style.transformOrigin = "left center";
|
|
165
167
|
}
|
|
166
168
|
/**
|
|
169
|
+
* How CSS spells each bidirectional wrapper: an override switches the
|
|
170
|
+
* bidirectional algorithm off for its content, an embedding opens a level and
|
|
171
|
+
* leaves it on.
|
|
172
|
+
*
|
|
173
|
+
* Both painters write the keyword from here, so the DOM painter and the
|
|
174
|
+
* display list cannot spell the pair differently.
|
|
175
|
+
*/
|
|
176
|
+
const UNICODE_BIDI_BY_WRAPPER_CONTROL = {
|
|
177
|
+
override: "bidi-override",
|
|
178
|
+
embedding: "embed"
|
|
179
|
+
};
|
|
180
|
+
/**
|
|
167
181
|
* Apply text run styles to an element
|
|
168
182
|
*/
|
|
169
183
|
function applyRunStyles(element, run) {
|
|
@@ -192,6 +206,10 @@ function applyRunStyles(element, run) {
|
|
|
192
206
|
}
|
|
193
207
|
if (run.rtl === true) element.dir = RIGHT_TO_LEFT_DIRECTION;
|
|
194
208
|
else if (run.rtl === false) element.dir = LEFT_TO_RIGHT_DIRECTION;
|
|
209
|
+
if (run.bidiWrapper) {
|
|
210
|
+
element.style.unicodeBidi = UNICODE_BIDI_BY_WRAPPER_CONTROL[run.bidiWrapper.control];
|
|
211
|
+
if (run.bidiWrapper.direction !== void 0 && run.rtl === void 0) element.dir = run.bidiWrapper.direction === "rtl" ? RIGHT_TO_LEFT_DIRECTION : LEFT_TO_RIGHT_DIRECTION;
|
|
212
|
+
}
|
|
195
213
|
if (run.textEffect) {
|
|
196
214
|
element.classList.add("docx-text-effect", `docx-text-effect-${run.textEffect}`);
|
|
197
215
|
element.dataset["effect"] = run.textEffect;
|
|
@@ -221,14 +239,15 @@ function applyRunStyles(element, run) {
|
|
|
221
239
|
const decorations = [];
|
|
222
240
|
let explicitDecorationStyle = false;
|
|
223
241
|
if (run.underline) {
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
if (run.underline.color) element.style.textDecorationColor = run.underline.color;
|
|
242
|
+
const authored = typeof run.underline === "object" ? run.underline.style : void 0;
|
|
243
|
+
const underline = authored === void 0 ? void 0 : underlineDecorationCss(authored);
|
|
244
|
+
if ((underline === void 0 || underline.decorationStyle !== void 0) && !isNoteReferenceRun(run)) decorations.push("underline");
|
|
245
|
+
if (underline?.decorationStyle !== void 0) {
|
|
246
|
+
element.style.textDecorationStyle = underline.decorationStyle;
|
|
247
|
+
explicitDecorationStyle = true;
|
|
231
248
|
}
|
|
249
|
+
if (underline?.decorationThickness !== void 0) element.style.textDecorationThickness = underline.decorationThickness;
|
|
250
|
+
if (typeof run.underline === "object" && run.underline.color) element.style.textDecorationColor = run.underline.color;
|
|
232
251
|
}
|
|
233
252
|
if (run.strike) decorations.push("line-through");
|
|
234
253
|
if (run.hidden) {
|
|
@@ -238,7 +257,7 @@ function applyRunStyles(element, run) {
|
|
|
238
257
|
if (run.commentIds && run.commentIds.length > 0) {
|
|
239
258
|
element.style.backgroundColor = "rgba(255, 212, 0, 0.08)";
|
|
240
259
|
element.style.borderBottom = "1px solid rgba(180, 130, 0, 0.24)";
|
|
241
|
-
element
|
|
260
|
+
writeCommentAnchorIds(element, run.commentIds);
|
|
242
261
|
}
|
|
243
262
|
if (run.isInsertion) {
|
|
244
263
|
const authorIdx = getAuthorColorIdx(run.changeAuthor ?? "");
|
|
@@ -492,6 +511,7 @@ function renderInlineImageRun(run, doc) {
|
|
|
492
511
|
img.style.transform = run.transform;
|
|
493
512
|
img.style.transformOrigin = "center center";
|
|
494
513
|
}
|
|
514
|
+
applyImageColorAttrs(img, run);
|
|
495
515
|
if (!hasImageCrop(run)) applyImageBorder(img, run);
|
|
496
516
|
const rotation = parseRotationDegrees(run.transform);
|
|
497
517
|
if (rotation !== 0) {
|
|
@@ -558,6 +578,7 @@ function renderBlockImage(run, doc) {
|
|
|
558
578
|
img.style.transform = run.transform;
|
|
559
579
|
img.style.transformOrigin = "center center";
|
|
560
580
|
}
|
|
581
|
+
applyImageColorAttrs(img, run);
|
|
561
582
|
if (!hasImageCrop(run)) applyImageBorder(img, run);
|
|
562
583
|
const rotation = parseRotationDegrees(run.transform);
|
|
563
584
|
if (rotation !== 0) {
|
|
@@ -1432,6 +1453,7 @@ function bordersFormGroup(a, b) {
|
|
|
1432
1453
|
if (!a || !b) return false;
|
|
1433
1454
|
return bordersEqual(a.top, b.top) && bordersEqual(a.bottom, b.bottom) && bordersEqual(a.left, b.left) && bordersEqual(a.right, b.right) && bordersEqual(a.between, b.between);
|
|
1434
1455
|
}
|
|
1456
|
+
const paragraphHasTrackedChanges = (block) => block.attrs?.listMarkerRevision !== void 0 || block.runs.some((run) => run.kind !== "lineBreak" && (run.isInsertion === true || run.isDeletion === true));
|
|
1435
1457
|
/**
|
|
1436
1458
|
* Render a paragraph fragment
|
|
1437
1459
|
*
|
|
@@ -1451,6 +1473,7 @@ function renderParagraphFragment(fragment, block, measure, context, options = {}
|
|
|
1451
1473
|
if (block.paraId) fragmentEl.dataset["paraId"] = block.paraId;
|
|
1452
1474
|
fragmentEl.dataset["fromLine"] = String(fragment.fromLine);
|
|
1453
1475
|
fragmentEl.dataset["toLine"] = String(fragment.toLine);
|
|
1476
|
+
if (paragraphHasTrackedChanges(block)) fragmentEl.dataset["trackedChanges"] = "true";
|
|
1454
1477
|
applyPmPositions(fragmentEl, fragment.pmStart, fragment.pmEnd);
|
|
1455
1478
|
applySdtDataAttrs(fragmentEl, fragment.sdtGroups);
|
|
1456
1479
|
if (fragment.continuesFromPrev) fragmentEl.dataset["continuesFromPrev"] = "true";
|
|
@@ -1467,25 +1490,8 @@ function renderParagraphFragment(fragment, block, measure, context, options = {}
|
|
|
1467
1490
|
const indent = block.attrs?.indent;
|
|
1468
1491
|
const borders = block.attrs?.borders;
|
|
1469
1492
|
if (borders) {
|
|
1470
|
-
const borderStyleToCss = (style) => {
|
|
1471
|
-
switch (style) {
|
|
1472
|
-
case "single": return "solid";
|
|
1473
|
-
case "double": return "double";
|
|
1474
|
-
case "dotted": return "dotted";
|
|
1475
|
-
case "dashed": return "dashed";
|
|
1476
|
-
case "thick": return "solid";
|
|
1477
|
-
case "wave": return "wavy";
|
|
1478
|
-
case "dashSmallGap": return "dashed";
|
|
1479
|
-
case "nil":
|
|
1480
|
-
case "none": return "none";
|
|
1481
|
-
default: return "solid";
|
|
1482
|
-
}
|
|
1483
|
-
};
|
|
1484
1493
|
fragmentEl.style.boxSizing = "border-box";
|
|
1485
|
-
const borderToCss = (border) => borderStrokeToCss(
|
|
1486
|
-
...border,
|
|
1487
|
-
style: borderStyleToCss(border.style)
|
|
1488
|
-
});
|
|
1494
|
+
const borderToCss = (border) => borderStrokeToCss(border);
|
|
1489
1495
|
const groupedWithPrev = bordersFormGroup(options.prevBorders, borders);
|
|
1490
1496
|
const groupedWithNext = bordersFormGroup(borders, options.nextBorders);
|
|
1491
1497
|
const renderedTopBorder = groupedWithPrev ? borders.between : borders.top;
|
|
@@ -1667,4 +1673,4 @@ function renderListMarker({ marker, inlineWidth, visualOffset, doc, formatting,
|
|
|
1667
1673
|
return span;
|
|
1668
1674
|
}
|
|
1669
1675
|
//#endregion
|
|
1670
|
-
export { PARAGRAPH_CLASS_NAMES, getLeaderChar, getRenderableTextColor, renderLine, renderParagraphFragment, sliceRunsForLine, splitCollapsibleLineEdgeSpaces, splitTextRunsByEastAsia, startsAfterSoftWrap };
|
|
1676
|
+
export { PARAGRAPH_CLASS_NAMES, UNICODE_BIDI_BY_WRAPPER_CONTROL, getLeaderChar, getRenderableTextColor, paragraphHasTrackedChanges, renderLine, renderParagraphFragment, sliceRunsForLine, splitCollapsibleLineEdgeSpaces, splitTextRunsByEastAsia, startsAfterSoftWrap };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { TableBlock, TableFragment, TableMeasure } from "../layout-engine/types.js";
|
|
2
2
|
import { RenderContext } from "./renderUtils.js";
|
|
3
3
|
import { PageGeometry } from "./anchoredImagePosition.js";
|
|
4
|
+
import { TextDirection } from "@stll/docx-core/model";
|
|
4
5
|
//#region src/layout-painter/renderTable.d.ts
|
|
5
6
|
/**
|
|
6
7
|
* CSS class names for table elements
|
|
@@ -15,6 +16,8 @@ declare const TABLE_CLASS_NAMES: {
|
|
|
15
16
|
tableEdgeHandleBottom: string;
|
|
16
17
|
tableEdgeHandleRight: string;
|
|
17
18
|
};
|
|
19
|
+
/** The quarter turn a cell's `w:textDirection` puts on its content. */
|
|
20
|
+
declare const cellTextRotationDegrees: (direction: TextDirection | undefined) => number;
|
|
18
21
|
/**
|
|
19
22
|
* Options for rendering a table fragment
|
|
20
23
|
*/
|
|
@@ -38,4 +41,4 @@ declare function renderNestedTable(block: TableBlock, measure: TableMeasure, con
|
|
|
38
41
|
*/
|
|
39
42
|
declare function renderTableFragment(fragment: TableFragment, block: TableBlock, measure: TableMeasure, context: RenderContext, options?: RenderTableFragmentOptions): HTMLElement;
|
|
40
43
|
//#endregion
|
|
41
|
-
export { RenderTableFragmentOptions, TABLE_CLASS_NAMES, renderNestedTable, renderTableFragment };
|
|
44
|
+
export { RenderTableFragmentOptions, TABLE_CLASS_NAMES, cellTextRotationDegrees, renderNestedTable, renderTableFragment };
|