@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
package/dist/docx/styleParser.js
CHANGED
|
@@ -1,341 +1,15 @@
|
|
|
1
|
-
import { parseHorizontalScalePercent } from "../utils/horizontalScale.js";
|
|
2
1
|
import { mergeParagraphFormatting } from "../utils/paragraphFormattingMerge.js";
|
|
3
2
|
import { mergeStyleTextFormatting } from "../utils/textFormattingMerge.js";
|
|
4
3
|
import { parseBorderSpec } from "./borderParser.js";
|
|
5
4
|
import { resolveDefaultParagraphStyle } from "./defaultParagraphStyle.js";
|
|
6
|
-
import {
|
|
5
|
+
import { parseParagraphProperties } from "./paragraphProperties.js";
|
|
6
|
+
import { ConditionalStyleTypeSchema, StyleTypeSchema, TableAlignmentSchema, TableRowHeightRuleSchema, TableWidthTypeSchema, TextDirectionSchema, narrowEnum } from "./parserEnums.js";
|
|
7
|
+
import { RUN_PROPERTY_OWNERS, parseRunProperties } from "./runParser.js";
|
|
7
8
|
import { parseShading } from "./shadingParser.js";
|
|
9
|
+
import { findChildAnySpelling } from "./strictNames.js";
|
|
8
10
|
import { parseTableLook } from "./tableParser.js";
|
|
9
|
-
import {
|
|
10
|
-
import { findChild, findChildren, getAttribute, getLocalName, parseBooleanElement, parseNumberingLevelAttribute, parseNumericAttribute, parseOnOffAttribute, parseOnOffValue, parseTableMeasurementValue, parseXmlDocument } from "./xmlParser.js";
|
|
11
|
+
import { findChild, findChildren, getAttribute, getLocalName, parseBooleanElement, parseNumericAttribute, parseOnOffValue, parseTableMeasurementValue, parseXmlDocument } from "./xmlParser.js";
|
|
11
12
|
//#region src/docx/styleParser.ts
|
|
12
|
-
const findLastRunToggle = (rPr, localName) => findChildren(rPr, "w", localName).at(-1) ?? null;
|
|
13
|
-
/**
|
|
14
|
-
* Parse text formatting properties (w:rPr)
|
|
15
|
-
*/
|
|
16
|
-
function parseRunProperties(rPr, theme) {
|
|
17
|
-
if (!rPr) return;
|
|
18
|
-
const formatting = {};
|
|
19
|
-
const b = findLastRunToggle(rPr, "b");
|
|
20
|
-
if (b) formatting.bold = parseBooleanElement(b);
|
|
21
|
-
const bCs = findLastRunToggle(rPr, "bCs");
|
|
22
|
-
if (bCs) formatting.boldCs = parseBooleanElement(bCs);
|
|
23
|
-
const i = findLastRunToggle(rPr, "i");
|
|
24
|
-
if (i) formatting.italic = parseBooleanElement(i);
|
|
25
|
-
const iCs = findLastRunToggle(rPr, "iCs");
|
|
26
|
-
if (iCs) formatting.italicCs = parseBooleanElement(iCs);
|
|
27
|
-
const u = findChild(rPr, "w", "u");
|
|
28
|
-
if (u) {
|
|
29
|
-
const style = narrowEnum(getAttribute(u, "w", "val"), UnderlineStyleSchema);
|
|
30
|
-
if (style) {
|
|
31
|
-
formatting.underline = { style };
|
|
32
|
-
const colorVal = getAttribute(u, "w", "color");
|
|
33
|
-
const themeColor = getAttribute(u, "w", "themeColor");
|
|
34
|
-
if (colorVal || themeColor) formatting.underline.color = parseColorValue(colorVal, themeColor, getAttribute(u, "w", "themeTint"), getAttribute(u, "w", "themeShade"));
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
const strike = findLastRunToggle(rPr, "strike");
|
|
38
|
-
if (strike) formatting.strike = parseBooleanElement(strike);
|
|
39
|
-
const dstrike = findChild(rPr, "w", "dstrike");
|
|
40
|
-
if (dstrike) formatting.doubleStrike = parseBooleanElement(dstrike);
|
|
41
|
-
const vertAlign = findChild(rPr, "w", "vertAlign");
|
|
42
|
-
if (vertAlign) {
|
|
43
|
-
const val = getAttribute(vertAlign, "w", "val");
|
|
44
|
-
if (val === "superscript" || val === "subscript" || val === "baseline") formatting.vertAlign = val;
|
|
45
|
-
}
|
|
46
|
-
const smallCaps = findLastRunToggle(rPr, "smallCaps");
|
|
47
|
-
if (smallCaps) formatting.smallCaps = parseBooleanElement(smallCaps);
|
|
48
|
-
const caps = findLastRunToggle(rPr, "caps");
|
|
49
|
-
if (caps) formatting.allCaps = parseBooleanElement(caps);
|
|
50
|
-
const vanish = findLastRunToggle(rPr, "vanish");
|
|
51
|
-
if (vanish) formatting.hidden = parseBooleanElement(vanish);
|
|
52
|
-
const color = findChild(rPr, "w", "color");
|
|
53
|
-
if (color) formatting.color = parseColorValue(getAttribute(color, "w", "val"), getAttribute(color, "w", "themeColor"), getAttribute(color, "w", "themeTint"), getAttribute(color, "w", "themeShade"));
|
|
54
|
-
const highlight = findChild(rPr, "w", "highlight");
|
|
55
|
-
if (highlight) {
|
|
56
|
-
const val = narrowEnum(getAttribute(highlight, "w", "val"), HighlightColorSchema);
|
|
57
|
-
if (val) formatting.highlight = val;
|
|
58
|
-
}
|
|
59
|
-
const shd = findChild(rPr, "w", "shd");
|
|
60
|
-
if (shd) {
|
|
61
|
-
const shadingResult = parseShading(shd);
|
|
62
|
-
if (shadingResult) formatting.shading = shadingResult;
|
|
63
|
-
}
|
|
64
|
-
const sz = findChild(rPr, "w", "sz");
|
|
65
|
-
if (sz) {
|
|
66
|
-
const val = parseNumericAttribute(sz, "w", "val");
|
|
67
|
-
if (val !== void 0) formatting.fontSize = val;
|
|
68
|
-
}
|
|
69
|
-
const szCs = findChild(rPr, "w", "szCs");
|
|
70
|
-
if (szCs) {
|
|
71
|
-
const val = parseNumericAttribute(szCs, "w", "val");
|
|
72
|
-
if (val !== void 0) formatting.fontSizeCs = val;
|
|
73
|
-
}
|
|
74
|
-
const rFonts = findChild(rPr, "w", "rFonts");
|
|
75
|
-
if (rFonts) {
|
|
76
|
-
const fontFamily = {};
|
|
77
|
-
const ascii = getAttribute(rFonts, "w", "ascii");
|
|
78
|
-
if (ascii) fontFamily.ascii = ascii;
|
|
79
|
-
const hAnsi = getAttribute(rFonts, "w", "hAnsi");
|
|
80
|
-
if (hAnsi) fontFamily.hAnsi = hAnsi;
|
|
81
|
-
const eastAsia = getAttribute(rFonts, "w", "eastAsia");
|
|
82
|
-
if (eastAsia) fontFamily.eastAsia = eastAsia;
|
|
83
|
-
const csFont = getAttribute(rFonts, "w", "cs");
|
|
84
|
-
if (csFont) fontFamily.cs = csFont;
|
|
85
|
-
const hint = narrowEnum(getAttribute(rFonts, "w", "hint"), FontHintSchema);
|
|
86
|
-
if (hint) fontFamily.hint = hint;
|
|
87
|
-
const asciiTheme = narrowEnum(getAttribute(rFonts, "w", "asciiTheme"), FontThemeSchema);
|
|
88
|
-
if (asciiTheme) {
|
|
89
|
-
fontFamily.asciiTheme = asciiTheme;
|
|
90
|
-
if (theme && !fontFamily.ascii) {
|
|
91
|
-
const resolved = resolveThemeFontRef(theme, asciiTheme);
|
|
92
|
-
if (resolved) fontFamily.ascii = resolved;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
const hAnsiTheme = narrowEnum(getAttribute(rFonts, "w", "hAnsiTheme"), FontThemeSchema);
|
|
96
|
-
if (hAnsiTheme) {
|
|
97
|
-
fontFamily.hAnsiTheme = hAnsiTheme;
|
|
98
|
-
if (theme && !fontFamily.hAnsi) {
|
|
99
|
-
const resolved = resolveThemeFontRef(theme, hAnsiTheme);
|
|
100
|
-
if (resolved) fontFamily.hAnsi = resolved;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
const eastAsiaTheme = narrowEnum(getAttribute(rFonts, "w", "eastAsiaTheme"), FontThemeSchema);
|
|
104
|
-
if (eastAsiaTheme) {
|
|
105
|
-
fontFamily.eastAsiaTheme = eastAsiaTheme;
|
|
106
|
-
if (theme && !fontFamily.eastAsia) {
|
|
107
|
-
const resolved = resolveThemeFontRef(theme, eastAsiaTheme);
|
|
108
|
-
if (resolved) fontFamily.eastAsia = resolved;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
const csTheme = narrowEnum(getAttribute(rFonts, "w", "cstheme"), FontThemeSchema);
|
|
112
|
-
if (csTheme) {
|
|
113
|
-
fontFamily.csTheme = csTheme;
|
|
114
|
-
if (theme && !fontFamily.cs) {
|
|
115
|
-
const resolved = resolveThemeFontRef(theme, csTheme);
|
|
116
|
-
if (resolved) fontFamily.cs = resolved;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
formatting.fontFamily = fontFamily;
|
|
120
|
-
}
|
|
121
|
-
const lang = findChild(rPr, "w", "lang");
|
|
122
|
-
if (lang) {
|
|
123
|
-
const val = getAttribute(lang, "w", "val") || void 0;
|
|
124
|
-
const eastAsia = getAttribute(lang, "w", "eastAsia") || void 0;
|
|
125
|
-
const bidi = getAttribute(lang, "w", "bidi") || void 0;
|
|
126
|
-
if (val || eastAsia || bidi) formatting.language = {
|
|
127
|
-
...val ? { val } : {},
|
|
128
|
-
...eastAsia ? { eastAsia } : {},
|
|
129
|
-
...bidi ? { bidi } : {}
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
const spacing = findChild(rPr, "w", "spacing");
|
|
133
|
-
if (spacing) {
|
|
134
|
-
const val = parseNumericAttribute(spacing, "w", "val");
|
|
135
|
-
if (val !== void 0) formatting.spacing = val;
|
|
136
|
-
}
|
|
137
|
-
const position = findChild(rPr, "w", "position");
|
|
138
|
-
if (position) {
|
|
139
|
-
const val = parseNumericAttribute(position, "w", "val");
|
|
140
|
-
if (val !== void 0) formatting.position = val;
|
|
141
|
-
}
|
|
142
|
-
const w = findChild(rPr, "w", "w");
|
|
143
|
-
if (w) {
|
|
144
|
-
const val = parseHorizontalScalePercent(getAttribute(w, "w", "val"));
|
|
145
|
-
if (val !== void 0) formatting.scale = val;
|
|
146
|
-
}
|
|
147
|
-
const kern = findChild(rPr, "w", "kern");
|
|
148
|
-
if (kern) {
|
|
149
|
-
const val = parseNumericAttribute(kern, "w", "val");
|
|
150
|
-
if (val !== void 0) formatting.kerning = val;
|
|
151
|
-
}
|
|
152
|
-
const effect = findChild(rPr, "w", "effect");
|
|
153
|
-
if (effect) {
|
|
154
|
-
const val = narrowEnum(getAttribute(effect, "w", "val"), TextEffectSchema);
|
|
155
|
-
if (val) formatting.effect = val;
|
|
156
|
-
}
|
|
157
|
-
const em = findChild(rPr, "w", "em");
|
|
158
|
-
if (em) {
|
|
159
|
-
const val = narrowEnum(getAttribute(em, "w", "val"), EmphasisMarkSchema);
|
|
160
|
-
if (val) formatting.emphasisMark = val;
|
|
161
|
-
}
|
|
162
|
-
const emboss = findLastRunToggle(rPr, "emboss");
|
|
163
|
-
if (emboss) formatting.emboss = parseBooleanElement(emboss);
|
|
164
|
-
const imprint = findLastRunToggle(rPr, "imprint");
|
|
165
|
-
if (imprint) formatting.imprint = parseBooleanElement(imprint);
|
|
166
|
-
const outline = findLastRunToggle(rPr, "outline");
|
|
167
|
-
if (outline) formatting.outline = parseBooleanElement(outline);
|
|
168
|
-
const shadow = findLastRunToggle(rPr, "shadow");
|
|
169
|
-
if (shadow) formatting.shadow = parseBooleanElement(shadow);
|
|
170
|
-
const rtl = findChild(rPr, "w", "rtl");
|
|
171
|
-
if (rtl) formatting.rtl = parseBooleanElement(rtl);
|
|
172
|
-
const cs = findChild(rPr, "w", "cs");
|
|
173
|
-
if (cs) formatting.cs = parseBooleanElement(cs);
|
|
174
|
-
const rStyle = findChild(rPr, "w", "rStyle");
|
|
175
|
-
if (rStyle) {
|
|
176
|
-
const val = getAttribute(rStyle, "w", "val");
|
|
177
|
-
if (val) formatting.styleId = val;
|
|
178
|
-
}
|
|
179
|
-
return Object.keys(formatting).length > 0 ? formatting : void 0;
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* Parse color value from attributes
|
|
183
|
-
*/
|
|
184
|
-
function parseColorValue(rgb, themeColor, themeTint, themeShade) {
|
|
185
|
-
const color = {};
|
|
186
|
-
if (rgb && rgb !== "auto") color.rgb = rgb;
|
|
187
|
-
else if (rgb === "auto") color.auto = true;
|
|
188
|
-
const validatedThemeColor = narrowEnum(themeColor, ThemeColorSlotSchema);
|
|
189
|
-
if (validatedThemeColor) color.themeColor = validatedThemeColor;
|
|
190
|
-
if (themeTint) color.themeTint = themeTint;
|
|
191
|
-
if (themeShade) color.themeShade = themeShade;
|
|
192
|
-
return color;
|
|
193
|
-
}
|
|
194
|
-
/**
|
|
195
|
-
* Parse tab stops (w:tabs)
|
|
196
|
-
*/
|
|
197
|
-
function parseTabStops(tabs) {
|
|
198
|
-
if (!tabs) return;
|
|
199
|
-
const tabElements = findChildren(tabs, "w", "tab");
|
|
200
|
-
if (tabElements.length === 0) return;
|
|
201
|
-
const result = [];
|
|
202
|
-
for (const tab of tabElements) {
|
|
203
|
-
const pos = parseNumericAttribute(tab, "w", "pos");
|
|
204
|
-
const alignment = narrowEnum(getAttribute(tab, "w", "val"), TabStopAlignmentSchema);
|
|
205
|
-
if (pos !== void 0 && alignment) {
|
|
206
|
-
const tabStop = {
|
|
207
|
-
position: pos,
|
|
208
|
-
alignment
|
|
209
|
-
};
|
|
210
|
-
const leader = narrowEnum(getAttribute(tab, "w", "leader"), TabLeaderSchema);
|
|
211
|
-
if (leader && leader !== "none") tabStop.leader = leader;
|
|
212
|
-
result.push(tabStop);
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
return result.length > 0 ? result : void 0;
|
|
216
|
-
}
|
|
217
|
-
/**
|
|
218
|
-
* Parse paragraph formatting properties (w:pPr)
|
|
219
|
-
*/
|
|
220
|
-
function parseParagraphProperties(pPr, theme) {
|
|
221
|
-
if (!pPr) return;
|
|
222
|
-
const formatting = {};
|
|
223
|
-
const jc = findChild(pPr, "w", "jc");
|
|
224
|
-
if (jc) {
|
|
225
|
-
const val = narrowEnum(getAttribute(jc, "w", "val"), ParagraphAlignmentSchema);
|
|
226
|
-
if (val) formatting.alignment = val;
|
|
227
|
-
}
|
|
228
|
-
const bidi = findChild(pPr, "w", "bidi");
|
|
229
|
-
if (bidi) formatting.bidi = parseBooleanElement(bidi);
|
|
230
|
-
const snapToGrid = findChild(pPr, "w", "snapToGrid");
|
|
231
|
-
if (snapToGrid) formatting.snapToGrid = parseBooleanElement(snapToGrid);
|
|
232
|
-
const spacing = findChild(pPr, "w", "spacing");
|
|
233
|
-
if (spacing) {
|
|
234
|
-
const before = parseNumericAttribute(spacing, "w", "before");
|
|
235
|
-
if (before !== void 0) formatting.spaceBefore = before;
|
|
236
|
-
const after = parseNumericAttribute(spacing, "w", "after");
|
|
237
|
-
if (after !== void 0) formatting.spaceAfter = after;
|
|
238
|
-
const line = parseNumericAttribute(spacing, "w", "line");
|
|
239
|
-
if (line !== void 0) formatting.lineSpacing = line;
|
|
240
|
-
const lineRule = narrowEnum(getAttribute(spacing, "w", "lineRule"), LineSpacingRuleSchema);
|
|
241
|
-
if (lineRule) formatting.lineSpacingRule = lineRule;
|
|
242
|
-
const beforeAutospacing = parseOnOffAttribute(spacing, "w", "beforeAutospacing");
|
|
243
|
-
if (beforeAutospacing !== void 0) formatting.beforeAutospacing = beforeAutospacing;
|
|
244
|
-
const afterAutospacing = parseOnOffAttribute(spacing, "w", "afterAutospacing");
|
|
245
|
-
if (afterAutospacing !== void 0) formatting.afterAutospacing = afterAutospacing;
|
|
246
|
-
}
|
|
247
|
-
const ind = findChild(pPr, "w", "ind");
|
|
248
|
-
if (ind) {
|
|
249
|
-
const left = parseNumericAttribute(ind, "w", "left");
|
|
250
|
-
if (left !== void 0) formatting.indentLeft = left;
|
|
251
|
-
const right = parseNumericAttribute(ind, "w", "right");
|
|
252
|
-
if (right !== void 0) formatting.indentRight = right;
|
|
253
|
-
const firstLine = parseNumericAttribute(ind, "w", "firstLine");
|
|
254
|
-
if (firstLine !== void 0) formatting.indentFirstLine = firstLine;
|
|
255
|
-
const hanging = parseNumericAttribute(ind, "w", "hanging");
|
|
256
|
-
if (hanging !== void 0) {
|
|
257
|
-
formatting.indentFirstLine = -hanging;
|
|
258
|
-
formatting.hangingIndent = true;
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
const pBdr = findChild(pPr, "w", "pBdr");
|
|
262
|
-
if (pBdr) {
|
|
263
|
-
const borders = {};
|
|
264
|
-
const top = parseBorderSpec(findChild(pBdr, "w", "top"));
|
|
265
|
-
if (top) borders.top = top;
|
|
266
|
-
const bottom = parseBorderSpec(findChild(pBdr, "w", "bottom"));
|
|
267
|
-
if (bottom) borders.bottom = bottom;
|
|
268
|
-
const left = parseBorderSpec(findChild(pBdr, "w", "left"));
|
|
269
|
-
if (left) borders.left = left;
|
|
270
|
-
const right = parseBorderSpec(findChild(pBdr, "w", "right"));
|
|
271
|
-
if (right) borders.right = right;
|
|
272
|
-
const between = parseBorderSpec(findChild(pBdr, "w", "between"));
|
|
273
|
-
if (between) borders.between = between;
|
|
274
|
-
const bar = parseBorderSpec(findChild(pBdr, "w", "bar"));
|
|
275
|
-
if (bar) borders.bar = bar;
|
|
276
|
-
if (Object.keys(borders).length > 0) formatting.borders = borders;
|
|
277
|
-
}
|
|
278
|
-
const shd = findChild(pPr, "w", "shd");
|
|
279
|
-
if (shd) {
|
|
280
|
-
const shadingResult = parseShading(shd);
|
|
281
|
-
if (shadingResult) formatting.shading = shadingResult;
|
|
282
|
-
}
|
|
283
|
-
const tabs = findChild(pPr, "w", "tabs");
|
|
284
|
-
if (tabs) {
|
|
285
|
-
const tabStops = parseTabStops(tabs);
|
|
286
|
-
if (tabStops) formatting.tabs = tabStops;
|
|
287
|
-
}
|
|
288
|
-
const keepNext = findChild(pPr, "w", "keepNext");
|
|
289
|
-
if (keepNext) formatting.keepNext = parseBooleanElement(keepNext);
|
|
290
|
-
const keepLines = findChild(pPr, "w", "keepLines");
|
|
291
|
-
if (keepLines) formatting.keepLines = parseBooleanElement(keepLines);
|
|
292
|
-
const widowControl = findChild(pPr, "w", "widowControl");
|
|
293
|
-
if (widowControl) formatting.widowControl = parseBooleanElement(widowControl);
|
|
294
|
-
const pageBreakBefore = findChild(pPr, "w", "pageBreakBefore");
|
|
295
|
-
if (pageBreakBefore) formatting.pageBreakBefore = parseBooleanElement(pageBreakBefore);
|
|
296
|
-
const contextualSpacing = findChild(pPr, "w", "contextualSpacing");
|
|
297
|
-
if (contextualSpacing) formatting.contextualSpacing = parseBooleanElement(contextualSpacing);
|
|
298
|
-
const numPr = findChild(pPr, "w", "numPr");
|
|
299
|
-
if (numPr) {
|
|
300
|
-
const numId = findChild(numPr, "w", "numId");
|
|
301
|
-
const ilvl = findChild(numPr, "w", "ilvl");
|
|
302
|
-
if (numId || ilvl) {
|
|
303
|
-
formatting.numPr = {};
|
|
304
|
-
if (numId) {
|
|
305
|
-
const val = parseNumericAttribute(numId, "w", "val");
|
|
306
|
-
if (val !== void 0) formatting.numPr.numId = val;
|
|
307
|
-
}
|
|
308
|
-
if (ilvl) {
|
|
309
|
-
const val = parseNumberingLevelAttribute(ilvl);
|
|
310
|
-
if (val !== void 0) formatting.numPr.ilvl = val;
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
const outlineLvl = findChild(pPr, "w", "outlineLvl");
|
|
315
|
-
if (outlineLvl) {
|
|
316
|
-
const val = parseNumericAttribute(outlineLvl, "w", "val");
|
|
317
|
-
if (val !== void 0) formatting.outlineLevel = val;
|
|
318
|
-
}
|
|
319
|
-
const pStyle = findChild(pPr, "w", "pStyle");
|
|
320
|
-
if (pStyle) {
|
|
321
|
-
const val = getAttribute(pStyle, "w", "val");
|
|
322
|
-
if (val) formatting.styleId = val;
|
|
323
|
-
}
|
|
324
|
-
const suppressLineNumbers = findChild(pPr, "w", "suppressLineNumbers");
|
|
325
|
-
if (suppressLineNumbers) formatting.suppressLineNumbers = parseBooleanElement(suppressLineNumbers);
|
|
326
|
-
const suppressAutoHyphens = findChild(pPr, "w", "suppressAutoHyphens");
|
|
327
|
-
if (suppressAutoHyphens) formatting.suppressAutoHyphens = parseBooleanElement(suppressAutoHyphens);
|
|
328
|
-
const kinsoku = findChild(pPr, "w", "kinsoku");
|
|
329
|
-
if (kinsoku) formatting.kinsoku = parseBooleanElement(kinsoku);
|
|
330
|
-
const overflowPunct = findChild(pPr, "w", "overflowPunct");
|
|
331
|
-
if (overflowPunct) formatting.overflowPunctuation = parseBooleanElement(overflowPunct);
|
|
332
|
-
const rPr = findChild(pPr, "w", "rPr");
|
|
333
|
-
if (rPr) {
|
|
334
|
-
const runProps = parseRunProperties(rPr, theme);
|
|
335
|
-
if (runProps) formatting.runProperties = runProps;
|
|
336
|
-
}
|
|
337
|
-
return Object.keys(formatting).length > 0 ? formatting : void 0;
|
|
338
|
-
}
|
|
339
13
|
/**
|
|
340
14
|
* Parse table measurement (width/height with type)
|
|
341
15
|
*/
|
|
@@ -359,9 +33,9 @@ function parseTableBorders(tblBorders) {
|
|
|
359
33
|
if (top) borders.top = top;
|
|
360
34
|
const bottom = parseBorderSpec(findChild(tblBorders, "w", "bottom"));
|
|
361
35
|
if (bottom) borders.bottom = bottom;
|
|
362
|
-
const left = parseBorderSpec(
|
|
36
|
+
const left = parseBorderSpec(findChildAnySpelling(tblBorders, "CT_Border left"));
|
|
363
37
|
if (left) borders.left = left;
|
|
364
|
-
const right = parseBorderSpec(
|
|
38
|
+
const right = parseBorderSpec(findChildAnySpelling(tblBorders, "CT_Border right"));
|
|
365
39
|
if (right) borders.right = right;
|
|
366
40
|
const insideH = parseBorderSpec(findChild(tblBorders, "w", "insideH"));
|
|
367
41
|
if (insideH) borders.insideH = insideH;
|
|
@@ -389,9 +63,9 @@ function parseCellMargins(tblCellMar) {
|
|
|
389
63
|
if (top) margins.top = top;
|
|
390
64
|
const bottom = parseTableMeasurement(findChild(tblCellMar, "w", "bottom"));
|
|
391
65
|
if (bottom) margins.bottom = bottom;
|
|
392
|
-
const left = parseTableMeasurement(
|
|
66
|
+
const left = parseTableMeasurement(findChildAnySpelling(tblCellMar, "CT_TblWidth left"));
|
|
393
67
|
if (left) margins.left = left;
|
|
394
|
-
const right = parseTableMeasurement(
|
|
68
|
+
const right = parseTableMeasurement(findChildAnySpelling(tblCellMar, "CT_TblWidth right"));
|
|
395
69
|
if (right) margins.right = right;
|
|
396
70
|
return Object.keys(margins).length > 0 ? margins : void 0;
|
|
397
71
|
}
|
|
@@ -406,11 +80,8 @@ function parseTableProperties(tblPr, _theme) {
|
|
|
406
80
|
const widthResult = parseTableMeasurement(tblW);
|
|
407
81
|
if (widthResult) formatting.width = widthResult;
|
|
408
82
|
}
|
|
409
|
-
const
|
|
410
|
-
if (
|
|
411
|
-
const val = getAttribute(jc, "w", "val");
|
|
412
|
-
if (val === "left" || val === "center" || val === "right") formatting.justification = val;
|
|
413
|
-
}
|
|
83
|
+
const justification = narrowEnum(getAttribute(findChild(tblPr, "w", "jc"), "w", "val"), TableAlignmentSchema);
|
|
84
|
+
if (justification) formatting.justification = justification;
|
|
414
85
|
const tblCellSpacing = findChild(tblPr, "w", "tblCellSpacing");
|
|
415
86
|
if (tblCellSpacing) {
|
|
416
87
|
const cellSpacingResult = parseTableMeasurement(tblCellSpacing);
|
|
@@ -472,11 +143,8 @@ function parseTableRowProperties(trPr) {
|
|
|
472
143
|
if (tblHeader) formatting.header = parseBooleanElement(tblHeader);
|
|
473
144
|
const cantSplit = findChild(trPr, "w", "cantSplit");
|
|
474
145
|
if (cantSplit) formatting.cantSplit = parseBooleanElement(cantSplit);
|
|
475
|
-
const
|
|
476
|
-
if (
|
|
477
|
-
const val = getAttribute(jc, "w", "val");
|
|
478
|
-
if (val === "left" || val === "center" || val === "right") formatting.justification = val;
|
|
479
|
-
}
|
|
146
|
+
const justification = narrowEnum(getAttribute(findChild(trPr, "w", "jc"), "w", "val"), TableAlignmentSchema);
|
|
147
|
+
if (justification) formatting.justification = justification;
|
|
480
148
|
const hidden = findChild(trPr, "w", "hidden");
|
|
481
149
|
if (hidden) formatting.hidden = parseBooleanElement(hidden);
|
|
482
150
|
return Object.keys(formatting).length > 0 ? formatting : void 0;
|
|
@@ -514,7 +182,7 @@ function parseTableCellProperties(tcPr, _theme) {
|
|
|
514
182
|
}
|
|
515
183
|
const textDirection = findChild(tcPr, "w", "textDirection");
|
|
516
184
|
if (textDirection) {
|
|
517
|
-
const val = narrowEnum(getAttribute(textDirection, "w", "val"),
|
|
185
|
+
const val = narrowEnum(getAttribute(textDirection, "w", "val"), TextDirectionSchema);
|
|
518
186
|
if (val) formatting.textDirection = val;
|
|
519
187
|
}
|
|
520
188
|
const gridSpan = findChild(tcPr, "w", "gridSpan");
|
|
@@ -643,7 +311,7 @@ function parseStyle(styleEl, theme) {
|
|
|
643
311
|
}
|
|
644
312
|
const rPr = children.rPr;
|
|
645
313
|
if (rPr) {
|
|
646
|
-
const rPrResult = parseRunProperties(rPr, theme);
|
|
314
|
+
const rPrResult = parseRunProperties(rPr, theme, RUN_PROPERTY_OWNERS.standalone);
|
|
647
315
|
if (rPrResult) style.rPr = rPrResult;
|
|
648
316
|
}
|
|
649
317
|
const tblPr = children.tblPr;
|
|
@@ -675,7 +343,7 @@ function parseStyle(styleEl, theme) {
|
|
|
675
343
|
}
|
|
676
344
|
const condRPr = findChild(tblStylePr, "w", "rPr");
|
|
677
345
|
if (condRPr) {
|
|
678
|
-
const condRPrResult = parseRunProperties(condRPr, theme);
|
|
346
|
+
const condRPrResult = parseRunProperties(condRPr, theme, RUN_PROPERTY_OWNERS.standalone);
|
|
679
347
|
if (condRPrResult) conditionalStyle.rPr = condRPrResult;
|
|
680
348
|
}
|
|
681
349
|
const condTblPr = findChild(tblStylePr, "w", "tblPr");
|
|
@@ -709,7 +377,7 @@ function parseDocDefaults(docDefaults, theme) {
|
|
|
709
377
|
if (rPrDefault) {
|
|
710
378
|
const rPr = findChild(rPrDefault, "w", "rPr");
|
|
711
379
|
if (rPr) {
|
|
712
|
-
const rPrResult = parseRunProperties(rPr, theme);
|
|
380
|
+
const rPrResult = parseRunProperties(rPr, theme, RUN_PROPERTY_OWNERS.standalone);
|
|
713
381
|
if (rPrResult) result.rPr = rPrResult;
|
|
714
382
|
}
|
|
715
383
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { document_d_exports } from "../types/document.js";
|
|
2
2
|
import { NumberingMap } from "./numberingParser.js";
|
|
3
|
-
import { StyleMap } from "./styleParser.js";
|
|
4
3
|
import { XmlElement } from "./xmlParser.js";
|
|
4
|
+
import { StyleMap } from "./styleParser.js";
|
|
5
5
|
//#region src/docx/tableParser.d.ts
|
|
6
6
|
/**
|
|
7
7
|
* Sanity cap on `w:gridSpan` (and the derived table column count). Word's
|
|
@@ -58,6 +58,15 @@ declare function parseTableLook(lookElement: XmlElement | null): document_d_expo
|
|
|
58
58
|
*/
|
|
59
59
|
declare function parseFloatingTableProperties(tblpPrElement: XmlElement | null): document_d_exports.FloatingTableProperties | undefined;
|
|
60
60
|
declare function parseTableProperties(tblPrElement: XmlElement | null): document_d_exports.TableFormatting | undefined;
|
|
61
|
+
/**
|
|
62
|
+
* Parse a row's table property exceptions (`w:tblPrEx`).
|
|
63
|
+
*
|
|
64
|
+
* The nine children are the table's own, read by the same handlers, so an
|
|
65
|
+
* exception and the property it overrides can never be read into two different
|
|
66
|
+
* shapes. `w:tblPrExChange` is a revision rather than a property and is read by
|
|
67
|
+
* {@link parseTablePropertyExceptionChanges}.
|
|
68
|
+
*/
|
|
69
|
+
declare function parseTablePropertyExceptions(tblPrExElement: XmlElement | null): document_d_exports.TablePropertyExceptionFormatting | undefined;
|
|
61
70
|
/**
|
|
62
71
|
* Parse table row properties (w:trPr)
|
|
63
72
|
*
|
|
@@ -197,4 +206,4 @@ declare function getHeaderRows(table: document_d_exports.Table): document_d_expo
|
|
|
197
206
|
*/
|
|
198
207
|
declare function isFloatingTable(table: document_d_exports.Table): boolean;
|
|
199
208
|
//#endregion
|
|
200
|
-
export { MAX_TABLE_COLUMNS, getHeaderRows, getTableColumnCount, getTableRowCount, getTableText, hasHeaderRow, isCellHorizontallyMerged, isCellMergeContinuation, isCellMergeStart, isFloatingTable, parseCellMargins, parseConditionalFormatStyle, parseFloatingTableProperties, parseTable, parseTableBorders, parseTableCell, parseTableCellProperties, parseTableGrid, parseTableLook, parseTableMeasurement, parseTableProperties, parseTableRow, parseTableRowProperties };
|
|
209
|
+
export { MAX_TABLE_COLUMNS, getHeaderRows, getTableColumnCount, getTableRowCount, getTableText, hasHeaderRow, isCellHorizontallyMerged, isCellMergeContinuation, isCellMergeStart, isFloatingTable, parseCellMargins, parseConditionalFormatStyle, parseFloatingTableProperties, parseTable, parseTableBorders, parseTableCell, parseTableCellProperties, parseTableGrid, parseTableLook, parseTableMeasurement, parseTableProperties, parseTablePropertyExceptions, parseTableRow, parseTableRowProperties };
|