@stll/folio-core 0.46.0 → 0.47.1
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.d.ts +17 -1
- package/dist/ai-edits/apply.js +31 -27
- package/dist/ai-edits/headless.d.ts +9 -2
- package/dist/ai-edits/headless.js +5 -3
- 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 -1
- package/dist/compare/content-alignment.js +192 -46
- package/dist/compare/content-types.d.ts +8 -2
- package/dist/compare/content.js +2 -11
- package/dist/compare/plan.js +7 -4
- package/dist/compare/section-boundary-properties.js +1 -2
- package/dist/content-controls/checkboxDisplay.d.ts +8 -2
- package/dist/content-controls/checkboxDisplay.js +11 -5
- package/dist/content-controls/mutateContentControls.js +41 -42
- package/dist/controller/layoutPipeline.js +8 -3
- package/dist/display-list/build/buildDisplayList.js +7 -7
- package/dist/display-list/build/imagePrimitives.d.ts +4 -4
- package/dist/display-list/build/imagePrimitives.js +38 -20
- package/dist/display-list/build/pageBorderPrimitives.js +2 -1
- package/dist/display-list/build/paragraphPrimitives.js +93 -13
- package/dist/display-list/build/previewPrimitives.d.ts +10 -0
- package/dist/display-list/build/previewPrimitives.js +89 -0
- package/dist/display-list/build/strokes.d.ts +177 -8
- package/dist/display-list/build/strokes.js +167 -47
- package/dist/display-list/build/tablePrimitives.js +4 -2
- package/dist/display-list/build/textBoxPrimitives.js +6 -4
- package/dist/display-list/build/textDecorations.d.ts +15 -1
- package/dist/display-list/build/textDecorations.js +15 -1
- package/dist/display-list/dom/renderDisplayListToDom.js +1 -19
- package/dist/display-list/primitives.d.ts +13 -2
- package/dist/display-list/primitives.js +36 -1
- package/dist/document-operations.d.ts +9 -2
- package/dist/document-operations.js +5 -3
- package/dist/docx/attributeRemainder.d.ts +34 -1
- package/dist/docx/attributeRemainder.js +49 -3
- package/dist/docx/blockContentParser.d.ts +2 -0
- package/dist/docx/blockContentParser.js +39 -67
- package/dist/docx/blockPlainText.js +3 -1
- package/dist/docx/borderParser.js +26 -11
- package/dist/docx/builtInStyles.d.ts +8 -16
- package/dist/docx/builtInStyles.js +54 -17
- package/dist/docx/commentAnchorIndex.js +1 -1
- package/dist/docx/commentParser.js +3 -3
- package/dist/docx/commentRangeIntegrity.js +1 -1
- package/dist/docx/commentRangeJoin.js +1 -1
- package/dist/docx/commentReferenceNormalization.js +3 -2
- package/dist/docx/commentReplyMarkers.js +1 -1
- package/dist/docx/compatibility.js +56 -42
- package/dist/docx/containerChildren.d.ts +110 -13
- package/dist/docx/containerChildren.gen.d.ts +16 -1
- package/dist/docx/containerChildren.gen.js +18 -1
- package/dist/docx/containerChildren.js +63 -13
- package/dist/docx/diagramPreview.d.ts +14 -2
- package/dist/docx/diagramPreview.js +81 -169
- package/dist/docx/documentParser.js +4 -1
- package/dist/docx/drawingAnchor.d.ts +87 -0
- package/dist/docx/drawingAnchor.js +201 -0
- package/dist/docx/drawingUtils.d.ts +43 -38
- package/dist/docx/drawingUtils.js +205 -118
- package/dist/docx/fontTableParser.js +102 -41
- package/dist/docx/footnoteParser.js +10 -6
- package/dist/docx/groupDrawingParser.js +4 -3
- package/dist/docx/headerFooterReferenceNormalization.js +1 -1
- package/dist/docx/hyperlinkParser.d.ts +45 -7
- package/dist/docx/hyperlinkParser.js +126 -57
- package/dist/docx/imageParser.js +127 -107
- package/dist/docx/index.d.ts +2 -1
- package/dist/docx/index.js +2 -1
- package/dist/docx/inlineContentRemovals.d.ts +28 -0
- package/dist/docx/inlineContentRemovals.js +46 -0
- package/dist/docx/inlineWrapperContent.d.ts +84 -3
- package/dist/docx/inlineWrapperContent.js +85 -4
- package/dist/docx/inlineWrapperParser.d.ts +11 -0
- package/dist/docx/inlineWrapperParser.js +60 -0
- package/dist/docx/nonVisualDrawingProps.d.ts +5 -13
- package/dist/docx/normalizeBaseDirection.js +4 -2
- package/dist/docx/numberingParser.d.ts +25 -2
- package/dist/docx/numberingParser.js +264 -361
- package/dist/docx/numberingReference.d.ts +9 -16
- package/dist/docx/numberingReference.js +17 -16
- package/dist/docx/numberingReferenceNormalization.js +7 -7
- package/dist/docx/ooxmlCounterFormatter.d.ts +1 -1
- package/dist/docx/ooxmlCounterFormatter.js +4 -1
- package/dist/docx/paraIdAttribute.d.ts +91 -1
- package/dist/docx/paraIdAttribute.js +79 -1
- package/dist/docx/paragraphParser.d.ts +9 -24
- package/dist/docx/paragraphParser.js +212 -396
- package/dist/docx/paragraphProperties.d.ts +23 -0
- package/dist/docx/paragraphProperties.js +279 -0
- package/dist/docx/paragraphPropertySource.js +2 -0
- package/dist/docx/paragraphTextBoxEnrichment.d.ts +2 -1
- package/dist/docx/paragraphTextBoxEnrichment.js +14 -7
- package/dist/docx/paragraphTraversal.d.ts +14 -10
- package/dist/docx/paragraphTraversal.js +47 -49
- package/dist/docx/parseWarningMessage.js +3 -0
- package/dist/docx/parserEnums.d.ts +6 -8
- package/dist/docx/parserEnums.js +4 -6
- package/dist/docx/preservedRunContent.js +16 -6
- package/dist/docx/previewBudget.d.ts +44 -23
- package/dist/docx/previewBudget.js +61 -30
- package/dist/docx/propertyElementAttributes.d.ts +178 -0
- package/dist/docx/propertyElementAttributes.js +114 -0
- package/dist/docx/renderedPageBreakNormalization.js +2 -2
- package/dist/docx/rezip.d.ts +28 -2
- package/dist/docx/rezip.js +78 -9
- package/dist/docx/runConsolidator.d.ts +42 -2
- package/dist/docx/runConsolidator.js +60 -6
- package/dist/docx/runParser.d.ts +54 -18
- package/dist/docx/runParser.js +379 -295
- package/dist/docx/runPayload.d.ts +5 -0
- package/dist/docx/runPayload.js +4 -0
- package/dist/docx/sdtProperties.d.ts +39 -5
- package/dist/docx/sdtProperties.js +205 -84
- package/dist/docx/sdtPropertiesPatch.d.ts +5 -9
- package/dist/docx/sdtPropertiesPatch.js +68 -112
- package/dist/docx/sectionParser.d.ts +1 -2
- package/dist/docx/sectionParser.js +236 -240
- package/dist/docx/selectiveSave.js +3 -2
- package/dist/docx/selectiveXmlPatch.d.ts +21 -2
- package/dist/docx/selectiveXmlPatch.js +195 -99
- package/dist/docx/serializer/blockSdtSerializer.js +2 -96
- package/dist/docx/serializer/borderSerializer.d.ts +5 -5
- package/dist/docx/serializer/borderSerializer.js +10 -8
- package/dist/docx/serializer/documentSerializer.js +3 -0
- package/dist/docx/serializer/fontTableSerializer.js +31 -3
- package/dist/docx/serializer/headerFooterSerializer.js +3 -0
- package/dist/docx/serializer/markupRangeAttributes.d.ts +9 -1
- package/dist/docx/serializer/markupRangeAttributes.js +9 -1
- package/dist/docx/serializer/noteSerializer.js +3 -0
- package/dist/docx/serializer/numberingSerializer.d.ts +1 -6
- package/dist/docx/serializer/numberingSerializer.js +81 -79
- package/dist/docx/serializer/paragraphSerializer.d.ts +1 -9
- package/dist/docx/serializer/paragraphSerializer.js +88 -188
- package/dist/docx/serializer/runSerializer.d.ts +1 -5
- package/dist/docx/serializer/runSerializer.js +109 -59
- package/dist/docx/serializer/sdtPropertiesSerializer.d.ts +26 -0
- package/dist/docx/serializer/sdtPropertiesSerializer.js +111 -0
- package/dist/docx/serializer/sectionPropertiesSerializer.js +34 -45
- package/dist/docx/serializer/settingsSerializer.js +6 -4
- package/dist/docx/serializer/stylesSerializer.js +8 -11
- package/dist/docx/serializer/tableSerializer.js +268 -100
- package/dist/docx/serializer/textFormattingSerializer.d.ts +28 -4
- package/dist/docx/serializer/textFormattingSerializer.js +111 -101
- package/dist/docx/serializer/xmlUtils.d.ts +1 -1
- package/dist/docx/serializer/xmlUtils.js +1 -1
- package/dist/docx/server/createBilingualDocument.js +18 -16
- package/dist/docx/server/migrateYjsAttrSchema.js +3 -3
- package/dist/docx/settingsParser.js +7 -4
- package/dist/docx/shadingParser.d.ts +2 -1
- package/dist/docx/shadingParser.js +43 -7
- package/dist/docx/shapeParser.js +8 -3
- package/dist/docx/strictNames.d.ts +11 -0
- package/dist/docx/strictNames.gen.d.ts +45 -0
- package/dist/docx/strictNames.gen.js +50 -0
- package/dist/docx/strictNames.js +43 -0
- package/dist/docx/strictValueEncodings.gen.js +133 -131
- package/dist/docx/styleParser.js +17 -349
- package/dist/docx/tableParser.d.ts +10 -1
- package/dist/docx/tableParser.js +505 -181
- package/dist/docx/textBoxParser.d.ts +3 -1
- package/dist/docx/textBoxParser.js +18 -8
- package/dist/docx/themeColorAttribute.d.ts +13 -0
- package/dist/docx/themeColorAttribute.js +24 -0
- package/dist/docx/trackedMoveRangeNormalization.js +2 -1
- package/dist/docx/vmlImageParser.d.ts +13 -4
- package/dist/docx/vmlImageParser.js +74 -31
- package/dist/docx/vmlPreview.js +2 -2
- package/dist/docx/wrapPolygon.d.ts +30 -0
- package/dist/docx/wrapPolygon.js +70 -0
- package/dist/docx/xmlParser.d.ts +14 -1
- package/dist/docx/xmlParser.js +18 -2
- package/dist/fonts/embeddedFonts.js +3 -3
- package/dist/headless-layout.js +2 -0
- package/dist/i18n/messages/catalogs.gen.d.ts +68 -0
- package/dist/i18n/messages/catalogs.gen.js +102 -34
- package/dist/i18n/messages/messages.gen.d.ts +4 -0
- package/dist/internal/headlessRevisionResolution.js +9 -0
- package/dist/internal/pageBreakRunSourceDescendantIndex.js +3 -1
- package/dist/internal/paragraphFormattingSerialization.d.ts +20 -9
- package/dist/internal/paragraphFormattingSerialization.js +118 -83
- package/dist/layout-bridge/convert/footnoteLayout.d.ts +1 -0
- package/dist/layout-bridge/convert/footnoteLayout.js +1 -0
- package/dist/layout-bridge/convert/headerFooterLayout.d.ts +1 -0
- package/dist/layout-bridge/convert/headerFooterLayout.js +2 -0
- package/dist/layout-bridge/convert/toFlowBlocks.d.ts +17 -12
- package/dist/layout-bridge/convert/toFlowBlocks.js +177 -101
- package/dist/layout-engine/index.d.ts +2 -2
- package/dist/layout-engine/index.js +53 -17
- package/dist/layout-engine/measure/measureBlocks.d.ts +3 -0
- package/dist/layout-engine/measure/measureBlocks.js +6 -10
- package/dist/layout-engine/measure/tableCellGrid.js +2 -1
- package/dist/layout-engine/measure/tableFragmentBorderGeometry.js +2 -1
- package/dist/layout-engine/measure/tableInlinePlacement.js +2 -5
- package/dist/layout-engine/paragraphSequence.js +3 -2
- package/dist/layout-engine/renderedBreakReconciliation.js +2 -1
- package/dist/layout-engine/section-breaks.d.ts +49 -2
- package/dist/layout-engine/section-breaks.js +55 -4
- package/dist/layout-engine/types.d.ts +47 -17
- package/dist/layout-engine/types.js +16 -1
- package/dist/layout-painter/borderStroke.d.ts +18 -4
- package/dist/layout-painter/renderPage.js +6 -4
- package/dist/layout-painter/renderParagraph.d.ts +2 -1
- package/dist/layout-painter/renderParagraph.js +13 -26
- package/dist/layout-painter/renderTable.d.ts +4 -1
- package/dist/layout-painter/renderTable.js +22 -22
- package/dist/layout-painter/renderTextBox.js +5 -3
- package/dist/markdown/renderBlock.js +3 -1
- package/dist/markdown/renderRuns.js +7 -2
- package/dist/markdown/renderTable.js +2 -1
- package/dist/model.d.ts +3 -3
- package/dist/model.js +2 -2
- package/dist/paged-layout/sectionBlockWidths.d.ts +3 -0
- package/dist/paged-layout/sectionBlockWidths.js +26 -4
- package/dist/prosemirror/attrs/index.d.ts +22 -4
- package/dist/prosemirror/attrs/index.js +498 -60
- package/dist/prosemirror/bookmarkBoundaryAttrs.d.ts +9 -1
- package/dist/prosemirror/bookmarkBoundaryAttrs.js +22 -3
- package/dist/prosemirror/commands/comments.js +68 -53
- package/dist/prosemirror/commands/contentControls.js +24 -19
- package/dist/prosemirror/commands/image.d.ts +1 -1
- package/dist/prosemirror/commands/image.js +4 -1
- package/dist/prosemirror/commands/paragraph.d.ts +2 -1
- package/dist/prosemirror/commands/propertyChangeScope.d.ts +12 -4
- package/dist/prosemirror/commands/propertyChangeScope.js +22 -4
- package/dist/prosemirror/commands/sectionBreak.d.ts +33 -1
- package/dist/prosemirror/commands/sectionBreak.js +187 -11
- package/dist/prosemirror/conversion/fromProseDoc.d.ts +18 -2
- package/dist/prosemirror/conversion/fromProseDoc.js +330 -183
- package/dist/prosemirror/conversion/index.d.ts +2 -2
- package/dist/prosemirror/conversion/preservedSinkCarriers.d.ts +39 -0
- package/dist/prosemirror/conversion/preservedSinkCarriers.js +19 -0
- package/dist/prosemirror/conversion/runShadingMark.js +14 -1
- package/dist/prosemirror/conversion/sdtAttrs.d.ts +10 -1
- package/dist/prosemirror/conversion/sdtAttrs.js +19 -5
- package/dist/prosemirror/conversion/toProseDoc.js +371 -141
- package/dist/prosemirror/emptyRangeAnchor.d.ts +53 -0
- package/dist/prosemirror/emptyRangeAnchor.js +158 -0
- package/dist/prosemirror/extensions/StarterKit.js +8 -2
- package/dist/prosemirror/extensions/core/DocExtension.js +1 -1
- package/dist/prosemirror/extensions/core/ParagraphExtension.js +19 -15
- package/dist/prosemirror/extensions/features/BaseKeymapExtension.js +3 -2
- package/dist/prosemirror/extensions/features/ListExtension.js +43 -24
- package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.js +4 -3
- package/dist/prosemirror/extensions/features/PasteCleanupExtension.d.ts +3 -3
- package/dist/prosemirror/extensions/features/PasteCleanupExtension.js +5 -5
- package/dist/prosemirror/extensions/features/pasteCleanup.d.ts +3 -1
- package/dist/prosemirror/extensions/features/pasteCleanup.js +56 -2
- package/dist/prosemirror/extensions/features/pastedHeadingStyles.js +5 -4
- package/dist/prosemirror/extensions/markRegistry.d.ts +26 -2
- package/dist/prosemirror/extensions/markRegistry.js +73 -10
- package/dist/prosemirror/extensions/marks/InlineWrapperExtension.js +17 -3
- package/dist/prosemirror/extensions/marks/RunIdentityExtension.d.ts +26 -0
- package/dist/prosemirror/extensions/marks/RunIdentityExtension.js +134 -0
- package/dist/prosemirror/extensions/marks/TrackedChangeExtensions.js +2 -1
- package/dist/prosemirror/extensions/marks/UnderlineExtension.js +12 -18
- package/dist/prosemirror/extensions/marks/markUtils.js +2 -1
- package/dist/prosemirror/extensions/nodes/BlockBookmarkBoundaryExtension.d.ts +29 -0
- package/dist/prosemirror/extensions/nodes/BlockBookmarkBoundaryExtension.js +46 -0
- package/dist/prosemirror/extensions/nodes/BlockSdtExtension.d.ts +4 -3
- package/dist/prosemirror/extensions/nodes/BlockSdtExtension.js +18 -13
- package/dist/prosemirror/extensions/nodes/BookmarkBoundaryExtension.js +28 -53
- package/dist/prosemirror/extensions/nodes/CommentReferenceExtension.js +10 -0
- package/dist/prosemirror/extensions/nodes/ImageExtension.js +8 -1
- package/dist/prosemirror/extensions/nodes/MoveRangeBoundaryExtension.d.ts +11 -0
- package/dist/prosemirror/extensions/nodes/MoveRangeBoundaryExtension.js +43 -0
- package/dist/prosemirror/extensions/nodes/RangeAnchorExtension.d.ts +13 -0
- package/dist/prosemirror/extensions/nodes/RangeAnchorExtension.js +65 -0
- package/dist/prosemirror/extensions/nodes/SdtExtension.d.ts +3 -1
- package/dist/prosemirror/extensions/nodes/SdtExtension.js +22 -16
- package/dist/prosemirror/extensions/nodes/ShapeExtension.js +4 -0
- package/dist/prosemirror/extensions/nodes/TableExtension.js +141 -123
- package/dist/prosemirror/extensions/nodes/TextBoxExtension.js +4 -0
- package/dist/prosemirror/extensions/nodes/bookmarkBoundaryDom.d.ts +23 -0
- package/dist/prosemirror/extensions/nodes/bookmarkBoundaryDom.js +57 -0
- package/dist/prosemirror/extensions/types.d.ts +12 -3
- package/dist/prosemirror/index.d.ts +4 -2
- package/dist/prosemirror/index.js +2 -1
- package/dist/prosemirror/inlineWrapperStack.js +20 -3
- package/dist/prosemirror/listMarker.d.ts +2 -2
- package/dist/prosemirror/listMarker.js +7 -8
- package/dist/prosemirror/listRenderingAttrs.js +11 -1
- package/dist/prosemirror/listState.d.ts +62 -0
- package/dist/prosemirror/listState.js +49 -0
- package/dist/prosemirror/moveRangeBoundaryAttrs.d.ts +13 -0
- package/dist/prosemirror/moveRangeBoundaryAttrs.js +114 -0
- package/dist/prosemirror/numberedRefFields.js +4 -4
- package/dist/prosemirror/numberingAttr.d.ts +55 -0
- package/dist/prosemirror/numberingAttr.js +74 -0
- package/dist/prosemirror/outlineLevelAttr.d.ts +29 -0
- package/dist/prosemirror/outlineLevelAttr.js +42 -0
- package/dist/prosemirror/paragraphFormattingProvenance.d.ts +9 -0
- package/dist/prosemirror/paragraphFormattingProvenance.js +4 -1
- package/dist/prosemirror/plugins/selectionTracker.d.ts +3 -6
- package/dist/prosemirror/plugins/selectionTracker.js +3 -10
- package/dist/prosemirror/rangeAnchorAttrs.d.ts +14 -0
- package/dist/prosemirror/rangeAnchorAttrs.js +101 -0
- package/dist/prosemirror/replacedAnnotations.d.ts +1 -1
- package/dist/prosemirror/replacedAnnotations.js +24 -6
- package/dist/prosemirror/revisionCarriers.d.ts +86 -2
- package/dist/prosemirror/revisionCarriers.js +86 -60
- package/dist/prosemirror/runFormattingInlineCarriers.d.ts +2 -0
- package/dist/prosemirror/runFormattingInlineCarriers.js +2 -0
- package/dist/prosemirror/runIdentity.d.ts +28 -0
- package/dist/prosemirror/runIdentity.js +36 -0
- package/dist/prosemirror/runStyleFormatting.js +1 -1
- package/dist/prosemirror/schema/index.d.ts +2 -2
- package/dist/prosemirror/schema/marks.d.ts +23 -4
- package/dist/prosemirror/schema/nodes.d.ts +220 -24
- package/dist/prosemirror/sectionCarrier.d.ts +37 -0
- package/dist/prosemirror/sectionCarrier.js +40 -0
- package/dist/prosemirror/selectionState.d.ts +3 -0
- package/dist/prosemirror/selectionState.js +4 -1
- package/dist/prosemirror/styles/resolvedStyleAttrs.d.ts +5 -4
- package/dist/prosemirror/styles/resolvedStyleAttrs.js +15 -13
- package/dist/prosemirror/tableResize.js +5 -6
- package/dist/prosemirror/trackedRunInlineAtoms.d.ts +2 -0
- package/dist/prosemirror/trackedRunInlineAtoms.js +2 -0
- package/dist/prosemirror/utils/extractTrackedChanges.d.ts +10 -11
- package/dist/prosemirror/utils/extractTrackedChanges.js +109 -92
- package/dist/prosemirror/validation.js +17 -6
- package/dist/prosemirror/yjsDocumentMetadata.d.ts +2 -2
- package/dist/prosemirror/yjsDocumentMetadata.js +428 -7
- package/dist/prosemirror/zeroWidthAnchors.js +4 -0
- package/dist/style-sets/extract.js +4 -4
- package/dist/style-sets/stellaStyle.js +36 -23
- package/dist/types/colors.d.ts +2 -2
- package/dist/types/content.d.ts +2 -2
- package/dist/types/documentEnumValues.d.ts +53 -26
- package/dist/types/documentEnumValues.js +72 -174
- package/dist/types/formatting.d.ts +2 -2
- package/dist/types/index.d.ts +9 -2
- package/dist/utils/borderCss.d.ts +246 -0
- package/dist/utils/borderCss.js +325 -0
- package/dist/utils/colorResolver.d.ts +4 -3
- package/dist/utils/colorResolver.js +45 -76
- package/dist/utils/createDocument.js +24 -6
- package/dist/utils/findReplace.js +52 -10
- package/dist/utils/formatToStyle.d.ts +84 -2
- package/dist/utils/formatToStyle.js +133 -52
- package/dist/utils/headingCollector.js +3 -2
- package/dist/utils/mergeDocumentContent.js +5 -3
- package/dist/utils/paragraphFormattingMerge.js +27 -6
- package/dist/utils/replaceText.js +1 -1
- package/dist/utils/tableOperations.d.ts +5 -3
- package/dist/utils/tableOperations.js +14 -1
- package/dist/utils/tablePlacement.d.ts +7 -0
- package/dist/utils/tablePlacement.js +14 -0
- package/dist/utils/textDirectionFlow.d.ts +15 -0
- package/dist/utils/textDirectionFlow.js +38 -0
- package/dist/utils/textFormattingMerge.js +16 -4
- package/package.json +10 -10
- package/dist/ai-edits/__fixtures__/paragraphs.d.ts +0 -17
- package/dist/ai-edits/__fixtures__/paragraphs.js +0 -33
- package/dist/compare/__fixtures__/body-sequence.d.ts +0 -119
- package/dist/compare/__fixtures__/body-sequence.js +0 -225
- package/dist/compare/__fixtures__/nested-table.d.ts +0 -16
- package/dist/compare/__fixtures__/nested-table.js +0 -50
- package/dist/compare/__fixtures__/numbered-list.d.ts +0 -34
- package/dist/compare/__fixtures__/numbered-list.js +0 -85
- package/dist/docx/bookmarkPlacement.d.ts +0 -9
- package/dist/docx/bookmarkPlacement.js +0 -52
- package/dist/fonts/embeddedFontTable.d.ts +0 -45
- package/dist/fonts/embeddedFontTable.js +0 -80
- package/dist/prosemirror/extensions/marks/PageBreakRunOwnerExtension.d.ts +0 -13
- package/dist/prosemirror/extensions/marks/PageBreakRunOwnerExtension.js +0 -39
|
@@ -19,7 +19,7 @@ const visitCommentMarkers = (blocks, visit) => {
|
|
|
19
19
|
for (const row of block.rows) for (const cell of row.cells) visitBlocks(cell.content);
|
|
20
20
|
return;
|
|
21
21
|
}
|
|
22
|
-
if (block.type
|
|
22
|
+
if (block.type !== "blockSdt") return;
|
|
23
23
|
visitBlocks(block.content);
|
|
24
24
|
};
|
|
25
25
|
const visitBlocks = (nested) => {
|
|
@@ -3,7 +3,7 @@ import { CAPTURE, dispatchChildren } from "./containerChildren.js";
|
|
|
3
3
|
import { PARA_ID_NAMESPACE_URIS, paraIdAttribute, paraIdParentAttribute } from "./paraIdAttribute.js";
|
|
4
4
|
import { parseParagraph } from "./paragraphParser.js";
|
|
5
5
|
import { cloneParagraphWithPropertySource } from "./paragraphPropertySource.js";
|
|
6
|
-
import { parseRunProperties } from "./runParser.js";
|
|
6
|
+
import { RUN_PROPERTY_OWNERS, parseRunProperties } from "./runParser.js";
|
|
7
7
|
import { findChild, getAttribute, getAttributeByNamespaceUri, getChildElements, getLocalName, parseOnOffValue, parseXml } from "./xmlParser.js";
|
|
8
8
|
import { PARSE_WARNING_CODES } from "@stll/docx-core/model";
|
|
9
9
|
//#region src/docx/commentParser.ts
|
|
@@ -36,7 +36,7 @@ const normalizeFirstCommentParagraph = (paragraphElement, paragraph, theme) => {
|
|
|
36
36
|
const firstContentElement = getChildElements(paragraphElement).find((element) => getLocalName(element.name) !== "pPr");
|
|
37
37
|
if (!firstContentElement || getLocalName(firstContentElement.name) !== "r" || !findChild(firstContentElement, "w", "annotationRef")) return { paragraph };
|
|
38
38
|
const runProperties = findChild(firstContentElement, "w", "rPr");
|
|
39
|
-
const annotationReferenceFormatting = normalizeAnnotationReferenceFormatting(runProperties ? parseRunProperties(runProperties, theme) : void 0);
|
|
39
|
+
const annotationReferenceFormatting = normalizeAnnotationReferenceFormatting(runProperties ? parseRunProperties(runProperties, theme, RUN_PROPERTY_OWNERS.standalone) : void 0);
|
|
40
40
|
const firstParsedContent = paragraph.content.at(0);
|
|
41
41
|
return {
|
|
42
42
|
paragraph: firstParsedContent?.type === "run" && firstParsedContent.content.every((item) => item.type === "preservedXml" && item.text === "") ? cloneParagraphWithPropertySource(paragraph, { content: paragraph.content.slice(1) }) : paragraph,
|
|
@@ -140,7 +140,7 @@ function parseComments(commentsXml, styles, theme, rels, media, commentsExtensib
|
|
|
140
140
|
const preserved = dispatchChildren({
|
|
141
141
|
element: child,
|
|
142
142
|
container: "w:comment",
|
|
143
|
-
|
|
143
|
+
capturePosition: () => paragraphs.length,
|
|
144
144
|
handlers: {
|
|
145
145
|
p: (contentChild) => {
|
|
146
146
|
const paragraph = parseParagraph(contentChild, styles, theme, null, rels, media);
|
|
@@ -147,7 +147,7 @@ const withoutOrphanBlockMarkers = (blocks, validCommentIds) => {
|
|
|
147
147
|
const withoutOrphanBlockMarker = (block, validCommentIds) => {
|
|
148
148
|
if (block.type === "paragraph") return withoutOrphanParagraphMarkers(block, validCommentIds);
|
|
149
149
|
if (block.type === "table") return withoutOrphanTableMarkers(block, validCommentIds);
|
|
150
|
-
if (block.type
|
|
150
|
+
if (block.type !== "blockSdt") return block;
|
|
151
151
|
const content = withoutOrphanBlockMarkers(block.content, validCommentIds);
|
|
152
152
|
if (!content) return block;
|
|
153
153
|
return {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { visitCommentMarkers } from "./commentAnchorIndex.js";
|
|
2
|
-
import { InlineContentRemovals } from "./
|
|
2
|
+
import { InlineContentRemovals } from "./inlineContentRemovals.js";
|
|
3
3
|
//#region src/docx/commentRangeJoin.ts
|
|
4
4
|
/**
|
|
5
5
|
* Collapse each comment's range markers to its first start and its last end.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { InlineContentRemovals
|
|
1
|
+
import { InlineContentRemovals } from "./inlineContentRemovals.js";
|
|
2
|
+
import { visitInlineContentSlots } from "./paragraphTraversal.js";
|
|
2
3
|
import { PARSE_WARNING_CODES } from "@stll/docx-core/model";
|
|
3
4
|
//#region src/docx/commentReferenceNormalization.ts
|
|
4
5
|
/** The codes this normalisation is reported under, owned here, not at the caller. */
|
|
@@ -39,7 +40,7 @@ const normalizeCommentReferences = ({ documentBody, comments, headers, footers,
|
|
|
39
40
|
normalizeTable(block);
|
|
40
41
|
return;
|
|
41
42
|
}
|
|
42
|
-
if (block.type
|
|
43
|
+
if (block.type !== "blockSdt") return;
|
|
43
44
|
normalizeBlocks(block.content);
|
|
44
45
|
};
|
|
45
46
|
const normalizeBlocks = (blocks) => {
|
|
@@ -25,7 +25,7 @@ const eachParagraph = (blocks, visit) => {
|
|
|
25
25
|
for (const row of block.rows ?? []) for (const cell of row.cells ?? []) eachParagraph(cell.content ?? [], visit);
|
|
26
26
|
continue;
|
|
27
27
|
}
|
|
28
|
-
if (block.type
|
|
28
|
+
if (block.type !== "blockSdt") continue;
|
|
29
29
|
eachParagraph(block.content ?? [], visit);
|
|
30
30
|
}
|
|
31
31
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DRAWING_SAFETY_CLASSES, classifyDrawingSafety } from "./imageRawXml.js";
|
|
2
|
+
import { panic } from "better-result";
|
|
2
3
|
import { DOCX_CONFORMANCE_CLASSES } from "@stll/docx-core/model";
|
|
3
4
|
//#region src/docx/compatibility.ts
|
|
4
5
|
/**
|
|
@@ -97,7 +98,7 @@ function inspectBlocks(blocks, context) {
|
|
|
97
98
|
});
|
|
98
99
|
continue;
|
|
99
100
|
}
|
|
100
|
-
if (block.type
|
|
101
|
+
if (block.type !== "blockSdt") continue;
|
|
101
102
|
inspectBlocks(block.content, {
|
|
102
103
|
part: context.part,
|
|
103
104
|
path: `${blockPath}.content`,
|
|
@@ -114,53 +115,66 @@ function inspectParagraphContent(content, context) {
|
|
|
114
115
|
...context,
|
|
115
116
|
path: `${context.path}[${itemIndex}]`
|
|
116
117
|
};
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
118
|
+
switch (item.type) {
|
|
119
|
+
case "run":
|
|
120
|
+
inspectRun(item, itemContext);
|
|
121
|
+
continue;
|
|
122
|
+
case "hyperlink":
|
|
123
|
+
inspectHyperlink(item, itemContext);
|
|
124
|
+
continue;
|
|
125
|
+
case "inlineSdt":
|
|
126
|
+
case "inlineWrapper":
|
|
127
|
+
case "insertion":
|
|
128
|
+
case "deletion":
|
|
129
|
+
case "moveFrom":
|
|
130
|
+
case "moveTo":
|
|
131
|
+
case "simpleField":
|
|
132
|
+
inspectParagraphContent(item.content, {
|
|
133
|
+
...itemContext,
|
|
134
|
+
path: `${itemContext.path}.content`
|
|
135
|
+
});
|
|
136
|
+
continue;
|
|
137
|
+
case "complexField":
|
|
138
|
+
for (const [runIndex, run] of item.fieldCode.entries()) inspectRun(run, {
|
|
139
|
+
...itemContext,
|
|
140
|
+
path: `${itemContext.path}.fieldCode[${runIndex}]`
|
|
141
|
+
});
|
|
142
|
+
for (const [runIndex, run] of item.fieldResult.entries()) inspectRun(run, {
|
|
143
|
+
...itemContext,
|
|
144
|
+
path: `${itemContext.path}.fieldResult[${runIndex}]`
|
|
145
|
+
});
|
|
146
|
+
continue;
|
|
147
|
+
case "bookmarkStart":
|
|
148
|
+
case "bookmarkEnd":
|
|
149
|
+
case "commentRangeStart":
|
|
150
|
+
case "commentRangeEnd":
|
|
151
|
+
case "commentReference":
|
|
152
|
+
case "moveFromRangeStart":
|
|
153
|
+
case "moveFromRangeEnd":
|
|
154
|
+
case "moveToRangeStart":
|
|
155
|
+
case "moveToRangeEnd":
|
|
156
|
+
case "mathEquation":
|
|
157
|
+
case "preservedInline": continue;
|
|
158
|
+
default: panic(`Unsupported paragraph content: ${JSON.stringify(item)}`);
|
|
131
159
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
...itemContext,
|
|
142
|
-
path: `${itemContext.path}.content`
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
function inspectHyperlink(hyperlink, context) {
|
|
163
|
+
for (const [childIndex, child] of hyperlink.children.entries()) {
|
|
164
|
+
const path = `${context.path}.children[${childIndex}]`;
|
|
165
|
+
if (child.type === "run") {
|
|
166
|
+
inspectRun(child, {
|
|
167
|
+
...context,
|
|
168
|
+
path
|
|
143
169
|
});
|
|
144
170
|
continue;
|
|
145
171
|
}
|
|
146
|
-
if (
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
});
|
|
151
|
-
for (const [runIndex, run] of item.fieldResult.entries()) inspectRun(run, {
|
|
152
|
-
...itemContext,
|
|
153
|
-
path: `${itemContext.path}.fieldResult[${runIndex}]`
|
|
154
|
-
});
|
|
155
|
-
}
|
|
172
|
+
if (child.type === "inlineWrapper") inspectParagraphContent(child.content, {
|
|
173
|
+
...context,
|
|
174
|
+
path: `${path}.content`
|
|
175
|
+
});
|
|
156
176
|
}
|
|
157
177
|
}
|
|
158
|
-
function inspectHyperlink(hyperlink, context) {
|
|
159
|
-
for (const [childIndex, child] of hyperlink.children.entries()) if (child.type === "run") inspectRun(child, {
|
|
160
|
-
...context,
|
|
161
|
-
path: `${context.path}.children[${childIndex}]`
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
178
|
function inspectRun(run, context) {
|
|
165
179
|
for (const [contentIndex, content] of run.content.entries()) {
|
|
166
180
|
if (content.type !== "drawing") continue;
|
|
@@ -1,9 +1,30 @@
|
|
|
1
1
|
import { XmlElement } from "./xmlParser.js";
|
|
2
2
|
import { DeclaredChild, DispatchedContainer } from "./containerChildren.gen.js";
|
|
3
|
-
import { PreservedMarkup } from "@stll/docx-core/model";
|
|
3
|
+
import { PreservedChild, PreservedMarkup } from "@stll/docx-core/model";
|
|
4
|
+
import { SequenceContainer } from "@stll/docx-core/schema";
|
|
4
5
|
//#region src/docx/containerChildren.d.ts
|
|
5
6
|
/** Keep this child's markup verbatim, in place. */
|
|
6
7
|
declare const CAPTURE = "capture";
|
|
8
|
+
/**
|
|
9
|
+
* What a handler answers with: nothing when it took a typed value, and
|
|
10
|
+
* {@link CAPTURE} when it took none, so the child's bytes are kept instead.
|
|
11
|
+
*
|
|
12
|
+
* `<w:tblLayout/>` states no layout and `<w:jc w:val="end"/>` states a value a
|
|
13
|
+
* reader's enumeration does not admit. Both used to fall off the end of the
|
|
14
|
+
* walk, and neither can be decided by name: a map keyed by name cannot list
|
|
15
|
+
* the values a reader will refuse, only the names it has never heard of.
|
|
16
|
+
*/
|
|
17
|
+
declare const keptUnless: (taken: boolean) => typeof CAPTURE | undefined;
|
|
18
|
+
declare const OWNED_ELSEWHERE = "owned-elsewhere";
|
|
19
|
+
/**
|
|
20
|
+
* Who reads a child this walk skips: `<module>#<export>`.
|
|
21
|
+
*
|
|
22
|
+
* The module is a file under `packages/core/src/docx/` without its extension,
|
|
23
|
+
* and the export is the function that reads the child off the container
|
|
24
|
+
* element. Both halves are resolved by `scripts/container-ownership.test.ts`,
|
|
25
|
+
* which imports every one of them.
|
|
26
|
+
*/
|
|
27
|
+
type ChildOwnerRef = `${string}#${string}`;
|
|
7
28
|
/**
|
|
8
29
|
* Another reader owns this child, and re-emits it.
|
|
9
30
|
*
|
|
@@ -11,8 +32,46 @@ declare const CAPTURE = "capture";
|
|
|
11
32
|
* under a run, lifted out by the paragraph parser. Capturing one of these as
|
|
12
33
|
* well would write it twice, so the disposition has to be stated rather than
|
|
13
34
|
* left to a bare `break`.
|
|
35
|
+
*
|
|
36
|
+
* A capture and a handler are verified by running them: the survival law
|
|
37
|
+
* exercises the pair and reports what came back. This one is a claim about a
|
|
38
|
+
* *different module*, and nothing ran it. `w:tr/w:tblPrEx` carried it while
|
|
39
|
+
* the container contract recorded the same pair as never parsed, and the two
|
|
40
|
+
* statements sat side by side without contradicting each other. So the claim
|
|
41
|
+
* names its owner, `ownedElsewhere` registers it where a check can read it,
|
|
42
|
+
* and `scripts/lib/container-survival/ownership.ts` refuses a contract that
|
|
43
|
+
* records an owned pair as never parsed or lost with its container.
|
|
44
|
+
*
|
|
45
|
+
* The container and the child are on the value rather than inferred from the
|
|
46
|
+
* key, and {@link ChildHandlers} binds them to it: an entry that names a child
|
|
47
|
+
* other than the one it is filed under does not compile.
|
|
14
48
|
*/
|
|
15
|
-
|
|
49
|
+
type OwnedElsewhere<Container extends DispatchedContainer = DispatchedContainer, Child extends string = string> = {
|
|
50
|
+
readonly disposition: typeof OWNED_ELSEWHERE;
|
|
51
|
+
readonly container: Container;
|
|
52
|
+
readonly child: Child;
|
|
53
|
+
readonly reader: ChildOwnerRef;
|
|
54
|
+
};
|
|
55
|
+
/** One handler map's claim that another reader owns one of its children. */
|
|
56
|
+
type ChildOwnerClaim = {
|
|
57
|
+
readonly container: DispatchedContainer;
|
|
58
|
+
readonly child: string;
|
|
59
|
+
readonly reader: ChildOwnerRef;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Every owner a handler map has claimed so far.
|
|
63
|
+
*
|
|
64
|
+
* A claim is registered when `ownedElsewhere` is called, so a module that is
|
|
65
|
+
* never imported contributes none. The checks that read this therefore load
|
|
66
|
+
* the claiming modules first, by scanning the sources for the call rather than
|
|
67
|
+
* by keeping a list beside them.
|
|
68
|
+
*/
|
|
69
|
+
declare const ownedElsewhereClaims: () => readonly ChildOwnerClaim[];
|
|
70
|
+
/** State that another reader takes this child, and who. */
|
|
71
|
+
declare const ownedElsewhere: <Container extends DispatchedContainer, Child extends DeclaredChild<Container>>(claim: ChildOwnerClaim & {
|
|
72
|
+
container: Container;
|
|
73
|
+
child: Child;
|
|
74
|
+
}) => OwnedElsewhere<Container, Child>;
|
|
16
75
|
/**
|
|
17
76
|
* This child goes with the wrapper folio does not keep.
|
|
18
77
|
*
|
|
@@ -24,15 +83,27 @@ declare const OWNED_ELSEWHERE = "owned-elsewhere";
|
|
|
24
83
|
* difference between this and a `default` that says nothing.
|
|
25
84
|
*/
|
|
26
85
|
declare const DROPPED_WITH_ITS_WRAPPER = "dropped-with-its-wrapper";
|
|
27
|
-
/**
|
|
28
|
-
|
|
86
|
+
/**
|
|
87
|
+
* What a container does with one declared child.
|
|
88
|
+
*
|
|
89
|
+
* A handler that reads the child may hand it back by returning {@link CAPTURE}
|
|
90
|
+
* — "I looked and took nothing from this, so keep the bytes". A property set
|
|
91
|
+
* needs it: `<w:cols/>` states no column count, `<w:jc w:val="end"/>` states a
|
|
92
|
+
* value the reader's enumeration does not admit, and a handler that turns
|
|
93
|
+
* neither into a typed value leaves the element with nowhere to go. Deciding
|
|
94
|
+
* it by the outcome rather than by the name is what makes the decision total:
|
|
95
|
+
* the map cannot list the values a reader will refuse.
|
|
96
|
+
*/
|
|
97
|
+
type ChildDisposition<Container extends DispatchedContainer = DispatchedContainer, Child extends string = string> = ((child: XmlElement) => typeof CAPTURE | void) | typeof CAPTURE | typeof DROPPED_WITH_ITS_WRAPPER | OwnedElsewhere<Container, Child>;
|
|
29
98
|
/**
|
|
30
99
|
* A total decision per declared child.
|
|
31
100
|
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
101
|
+
* Total, never `Partial`: a partial map lets a new declared child land without
|
|
102
|
+
* a decision, which is the drop this module exists to prevent. The value's
|
|
103
|
+
* type is keyed by the child it is filed under, so an {@link ownedElsewhere}
|
|
104
|
+
* entry cannot name a different child than the one it decides.
|
|
34
105
|
*/
|
|
35
|
-
type ChildHandlers<Container extends DispatchedContainer> = Readonly<
|
|
106
|
+
type ChildHandlers<Container extends DispatchedContainer> = Readonly<{ [Child in DeclaredChild<Container>]: ChildDisposition<Container, Child>; }>;
|
|
36
107
|
type DispatchChildrenOptions<Container extends DispatchedContainer> = {
|
|
37
108
|
/** The container element, as the source wrote it. */
|
|
38
109
|
element: XmlElement;
|
|
@@ -40,10 +111,17 @@ type DispatchChildrenOptions<Container extends DispatchedContainer> = {
|
|
|
40
111
|
container: Container;
|
|
41
112
|
handlers: ChildHandlers<Container>;
|
|
42
113
|
/**
|
|
43
|
-
*
|
|
44
|
-
* captured child
|
|
114
|
+
* Where a capture belongs among the caller's children, called once per
|
|
115
|
+
* captured child.
|
|
116
|
+
*
|
|
117
|
+
* A container that models one kind of child answers with how many it holds
|
|
118
|
+
* right now, so the capture lands after the siblings already read. A
|
|
119
|
+
* container whose content model is a fixed sequence answers with the child's
|
|
120
|
+
* own ordinal in that sequence, because there the position is decided by the
|
|
121
|
+
* name rather than by what happened to be read first; see
|
|
122
|
+
* {@link sequencePositions}.
|
|
45
123
|
*/
|
|
46
|
-
|
|
124
|
+
capturePosition: (child: XmlElement) => number;
|
|
47
125
|
/**
|
|
48
126
|
* Dispositions for names the container's content model does not declare.
|
|
49
127
|
*
|
|
@@ -93,7 +171,7 @@ declare const transitionalNamespaceOf: (namespace: string) => string;
|
|
|
93
171
|
* none — an empty record is never written, so a fully modelled container
|
|
94
172
|
* stays byte-identical in the model.
|
|
95
173
|
*/
|
|
96
|
-
declare const dispatchChildren: <Container extends DispatchedContainer>({ element, handlers,
|
|
174
|
+
declare const dispatchChildren: <Container extends DispatchedContainer>({ element, handlers, capturePosition, undeclared, undeclaredNamespaces }: DispatchChildrenOptions<Container>) => PreservedMarkup | undefined;
|
|
97
175
|
/**
|
|
98
176
|
* Put a container's modelled children back with its preserved ones between
|
|
99
177
|
* them, in source position.
|
|
@@ -104,8 +182,27 @@ declare const dispatchChildren: <Container extends DispatchedContainer>({ elemen
|
|
|
104
182
|
*
|
|
105
183
|
* @param wrap turns one capture's markup into whatever the caller's list holds
|
|
106
184
|
*/
|
|
107
|
-
declare const withPreservedChildren: <Item>(modelled: readonly Item[], preserved:
|
|
185
|
+
declare const withPreservedChildren: <Item, Child extends PreservedChild = PreservedChild>(modelled: readonly Item[], preserved: {
|
|
186
|
+
children?: Child[];
|
|
187
|
+
} | undefined, wrap: (xml: string, child: Child) => Item) => Item[];
|
|
108
188
|
/** {@link withPreservedChildren} for a caller that already holds markup. */
|
|
109
189
|
declare const serializeWithPreservedChildren: (modelled: readonly string[], preserved: PreservedMarkup | undefined) => string;
|
|
190
|
+
/**
|
|
191
|
+
* Where each child sits in a container whose content model is one flat sequence.
|
|
192
|
+
*
|
|
193
|
+
* A property set is that container: `CT_TblPr` and `CT_SectPr` are sequences
|
|
194
|
+
* of optional singletons, so a child's position is a property of its name and
|
|
195
|
+
* the generated list is the order. That is what the sink records for them,
|
|
196
|
+
* rather than a count of modelled siblings: the count is a mirror of whichever
|
|
197
|
+
* properties folio models today, and it moves under the capture the moment one
|
|
198
|
+
* more of them is modelled.
|
|
199
|
+
*
|
|
200
|
+
* An undeclared child — a foreign namespace, an `mc:` construct, a name a
|
|
201
|
+
* later revision of the format adds — has no place in the sequence, so it
|
|
202
|
+
* takes the place of the last declared child before it and comes back beside
|
|
203
|
+
* the same neighbour. One before every declared child takes position `-1`,
|
|
204
|
+
* ahead of the sequence's first slot.
|
|
205
|
+
*/
|
|
206
|
+
declare const sequencePositions: <Container extends SequenceContainer>(container: Container, element: XmlElement) => ((child: XmlElement) => number);
|
|
110
207
|
//#endregion
|
|
111
|
-
export { CAPTURE, ChildDisposition, ChildHandlers, DROPPED_WITH_ITS_WRAPPER,
|
|
208
|
+
export { CAPTURE, ChildDisposition, ChildHandlers, ChildOwnerClaim, ChildOwnerRef, DROPPED_WITH_ITS_WRAPPER, OwnedElsewhere, dispatchChildren, keptUnless, ownedElsewhere, ownedElsewhereClaims, sequencePositions, serializeWithPreservedChildren, transitionalNamespaceOf, withPreservedChildren };
|
|
@@ -12,10 +12,25 @@
|
|
|
12
12
|
* bun run generate:container-children
|
|
13
13
|
*/
|
|
14
14
|
declare const CONTAINER_CHILDREN: {
|
|
15
|
+
readonly "w:numbering": readonly ["numPicBullet", "abstractNum", "num", "numIdMacAtCleanup"];
|
|
16
|
+
readonly "w:abstractNum": readonly ["nsid", "multiLevelType", "tmpl", "name", "styleLink", "numStyleLink", "lvl"];
|
|
17
|
+
readonly "w:lvl": readonly ["start", "numFmt", "lvlRestart", "pStyle", "isLgl", "suff", "lvlText", "lvlPicBulletId", "legacy", "lvlJc", "pPr", "rPr"];
|
|
18
|
+
readonly "w:num": readonly ["abstractNumId", "lvlOverride"];
|
|
19
|
+
readonly "w:lvlOverride": readonly ["startOverride", "lvl"];
|
|
20
|
+
readonly "paragraph-properties": readonly ["pStyle", "keepNext", "keepLines", "pageBreakBefore", "framePr", "widowControl", "numPr", "suppressLineNumbers", "pBdr", "shd", "tabs", "suppressAutoHyphens", "kinsoku", "wordWrap", "overflowPunct", "topLinePunct", "autoSpaceDE", "autoSpaceDN", "bidi", "adjustRightInd", "snapToGrid", "spacing", "ind", "contextualSpacing", "mirrorIndents", "suppressOverlap", "jc", "textDirection", "textAlignment", "textboxTightWrap", "outlineLvl", "divId", "cnfStyle", "rPr", "sectPr", "pPrChange"];
|
|
21
|
+
readonly "table-properties": readonly ["tblStyle", "tblpPr", "tblOverlap", "bidiVisual", "tblStyleRowBandSize", "tblStyleColBandSize", "tblW", "jc", "tblCellSpacing", "tblInd", "tblBorders", "shd", "tblLayout", "tblCellMar", "tblLook", "tblCaption", "tblDescription", "tblPrChange"];
|
|
22
|
+
readonly "table-property-exceptions": readonly ["tblW", "jc", "tblCellSpacing", "tblInd", "tblBorders", "shd", "tblLayout", "tblCellMar", "tblLook", "tblPrExChange"];
|
|
23
|
+
readonly "row-properties": readonly ["cnfStyle", "divId", "gridBefore", "gridAfter", "wBefore", "wAfter", "cantSplit", "trHeight", "tblHeader", "tblCellSpacing", "jc", "hidden", "ins", "del", "trPrChange"];
|
|
24
|
+
readonly "cell-properties": readonly ["cnfStyle", "tcW", "gridSpan", "hMerge", "vMerge", "tcBorders", "shd", "noWrap", "tcMar", "textDirection", "tcFitText", "vAlign", "hideMark", "headers", "cellIns", "cellDel", "cellMerge", "tcPrChange"];
|
|
25
|
+
readonly "run-properties": readonly ["ins", "del", "moveFrom", "moveTo", "rStyle", "rFonts", "b", "bCs", "i", "iCs", "caps", "smallCaps", "strike", "dstrike", "outline", "shadow", "emboss", "imprint", "noProof", "snapToGrid", "vanish", "webHidden", "color", "spacing", "w", "kern", "position", "sz", "szCs", "highlight", "u", "effect", "bdr", "shd", "fitText", "vertAlign", "rtl", "cs", "em", "lang", "eastAsianLayout", "specVanish", "oMath", "rPrChange"];
|
|
26
|
+
readonly "content-control-properties": readonly ["rPr", "alias", "tag", "id", "lock", "placeholder", "temporary", "showingPlcHdr", "dataBinding", "label", "tabIndex", "equation", "comboBox", "date", "docPartObj", "docPartList", "dropDownList", "picture", "richText", "text", "citation", "group", "bibliography"];
|
|
27
|
+
readonly "section-properties": readonly ["headerReference", "footerReference", "footnotePr", "endnotePr", "type", "pgSz", "pgMar", "paperSrc", "pgBorders", "lnNumType", "pgNumType", "cols", "formProt", "vAlign", "noEndnote", "titlePg", "textDirection", "bidi", "rtlGutter", "docGrid", "printerSettings", "sectPrChange"];
|
|
15
28
|
readonly "w:comment": readonly ["altChunk", "bookmarkEnd", "bookmarkStart", "commentRangeEnd", "commentRangeStart", "customXml", "customXmlDelRangeEnd", "customXmlDelRangeStart", "customXmlInsRangeEnd", "customXmlInsRangeStart", "customXmlMoveFromRangeEnd", "customXmlMoveFromRangeStart", "customXmlMoveToRangeEnd", "customXmlMoveToRangeStart", "del", "ins", "moveFrom", "moveFromRangeEnd", "moveFromRangeStart", "moveTo", "moveToRangeEnd", "moveToRangeStart", "p", "permEnd", "permStart", "proofErr", "sdt", "tbl"];
|
|
16
|
-
readonly "run-level-content": readonly ["bdo", "bookmarkEnd", "bookmarkStart", "commentRangeEnd", "commentRangeStart", "customXml", "customXmlDelRangeEnd", "customXmlDelRangeStart", "customXmlInsRangeEnd", "customXmlInsRangeStart", "customXmlMoveFromRangeEnd", "customXmlMoveFromRangeStart", "customXmlMoveToRangeEnd", "customXmlMoveToRangeStart", "del", "dir", "fldSimple", "hyperlink", "ins", "moveFrom", "moveFromRangeEnd", "moveFromRangeStart", "moveTo", "moveToRangeEnd", "moveToRangeStart", "pPr", "permEnd", "permStart", "proofErr", "r", "sdt", "smartTag", "smartTagPr", "subDoc"];
|
|
29
|
+
readonly "run-level-content": readonly ["bdo", "bookmarkEnd", "bookmarkStart", "commentRangeEnd", "commentRangeStart", "customXml", "customXmlDelRangeEnd", "customXmlDelRangeStart", "customXmlInsRangeEnd", "customXmlInsRangeStart", "customXmlMoveFromRangeEnd", "customXmlMoveFromRangeStart", "customXmlMoveToRangeEnd", "customXmlMoveToRangeStart", "customXmlPr", "del", "dir", "fldSimple", "hyperlink", "ins", "moveFrom", "moveFromRangeEnd", "moveFromRangeStart", "moveTo", "moveToRangeEnd", "moveToRangeStart", "pPr", "permEnd", "permStart", "proofErr", "r", "sdt", "smartTag", "smartTagPr", "subDoc"];
|
|
17
30
|
readonly "table-content": readonly ["bookmarkEnd", "bookmarkStart", "commentRangeEnd", "commentRangeStart", "customXml", "customXmlDelRangeEnd", "customXmlDelRangeStart", "customXmlInsRangeEnd", "customXmlInsRangeStart", "customXmlMoveFromRangeEnd", "customXmlMoveFromRangeStart", "customXmlMoveToRangeEnd", "customXmlMoveToRangeStart", "customXmlPr", "del", "ins", "moveFrom", "moveFromRangeEnd", "moveFromRangeStart", "moveTo", "moveToRangeEnd", "moveToRangeStart", "permEnd", "permStart", "proofErr", "sdt", "tblGrid", "tblPr", "tr"];
|
|
18
31
|
readonly "row-content": readonly ["bookmarkEnd", "bookmarkStart", "commentRangeEnd", "commentRangeStart", "customXml", "customXmlDelRangeEnd", "customXmlDelRangeStart", "customXmlInsRangeEnd", "customXmlInsRangeStart", "customXmlMoveFromRangeEnd", "customXmlMoveFromRangeStart", "customXmlMoveToRangeEnd", "customXmlMoveToRangeStart", "del", "ins", "moveFrom", "moveFromRangeEnd", "moveFromRangeStart", "moveTo", "moveToRangeEnd", "moveToRangeStart", "permEnd", "permStart", "proofErr", "sdt", "tblPrEx", "tc", "tr", "trPr"];
|
|
32
|
+
readonly "w:fonts": readonly ["font"];
|
|
33
|
+
readonly "w:font": readonly ["altName", "charset", "embedBold", "embedBoldItalic", "embedItalic", "embedRegular", "family", "notTrueType", "panose1", "pitch", "sig"];
|
|
19
34
|
readonly "w:hyperlink": readonly ["bdo", "bookmarkEnd", "bookmarkStart", "commentRangeEnd", "commentRangeStart", "customXml", "customXmlDelRangeEnd", "customXmlDelRangeStart", "customXmlInsRangeEnd", "customXmlInsRangeStart", "customXmlMoveFromRangeEnd", "customXmlMoveFromRangeStart", "customXmlMoveToRangeEnd", "customXmlMoveToRangeStart", "del", "dir", "fldSimple", "hyperlink", "ins", "moveFrom", "moveFromRangeEnd", "moveFromRangeStart", "moveTo", "moveToRangeEnd", "moveToRangeStart", "permEnd", "permStart", "proofErr", "r", "sdt", "smartTag", "subDoc"];
|
|
20
35
|
readonly "w:fldSimple": readonly ["bdo", "bookmarkEnd", "bookmarkStart", "commentRangeEnd", "commentRangeStart", "customXml", "customXmlDelRangeEnd", "customXmlDelRangeStart", "customXmlInsRangeEnd", "customXmlInsRangeStart", "customXmlMoveFromRangeEnd", "customXmlMoveFromRangeStart", "customXmlMoveToRangeEnd", "customXmlMoveToRangeStart", "del", "dir", "fldData", "fldSimple", "hyperlink", "ins", "moveFrom", "moveFromRangeEnd", "moveFromRangeStart", "moveTo", "moveToRangeEnd", "moveToRangeStart", "permEnd", "permStart", "proofErr", "r", "sdt", "smartTag", "subDoc"];
|
|
21
36
|
readonly "block-content": readonly ["altChunk", "bookmarkEnd", "bookmarkStart", "commentRangeEnd", "commentRangeStart", "customXml", "customXmlDelRangeEnd", "customXmlDelRangeStart", "customXmlInsRangeEnd", "customXmlInsRangeStart", "customXmlMoveFromRangeEnd", "customXmlMoveFromRangeStart", "customXmlMoveToRangeEnd", "customXmlMoveToRangeStart", "del", "ins", "moveFrom", "moveFromRangeEnd", "moveFromRangeStart", "moveTo", "moveToRangeEnd", "moveToRangeStart", "p", "permEnd", "permStart", "proofErr", "sdt", "sectPr", "tbl", "tcPr"];
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SEQUENCE_CHILDREN } from "@stll/docx-core/schema";
|
|
1
2
|
//#region src/docx/containerChildren.gen.ts
|
|
2
3
|
/**
|
|
3
4
|
* GENERATED FILE — do not edit.
|
|
@@ -57,6 +58,7 @@ const CONTAINER_CHILDREN = {
|
|
|
57
58
|
"customXmlMoveFromRangeStart",
|
|
58
59
|
"customXmlMoveToRangeEnd",
|
|
59
60
|
"customXmlMoveToRangeStart",
|
|
61
|
+
"customXmlPr",
|
|
60
62
|
"del",
|
|
61
63
|
"dir",
|
|
62
64
|
"fldSimple",
|
|
@@ -140,6 +142,20 @@ const CONTAINER_CHILDREN = {
|
|
|
140
142
|
"tr",
|
|
141
143
|
"trPr"
|
|
142
144
|
],
|
|
145
|
+
"w:fonts": ["font"],
|
|
146
|
+
"w:font": [
|
|
147
|
+
"altName",
|
|
148
|
+
"charset",
|
|
149
|
+
"embedBold",
|
|
150
|
+
"embedBoldItalic",
|
|
151
|
+
"embedItalic",
|
|
152
|
+
"embedRegular",
|
|
153
|
+
"family",
|
|
154
|
+
"notTrueType",
|
|
155
|
+
"panose1",
|
|
156
|
+
"pitch",
|
|
157
|
+
"sig"
|
|
158
|
+
],
|
|
143
159
|
"w:hyperlink": [
|
|
144
160
|
"bdo",
|
|
145
161
|
"bookmarkEnd",
|
|
@@ -240,7 +256,8 @@ const CONTAINER_CHILDREN = {
|
|
|
240
256
|
"sectPr",
|
|
241
257
|
"tbl",
|
|
242
258
|
"tcPr"
|
|
243
|
-
]
|
|
259
|
+
],
|
|
260
|
+
...SEQUENCE_CHILDREN
|
|
244
261
|
};
|
|
245
262
|
//#endregion
|
|
246
263
|
export { CONTAINER_CHILDREN };
|
|
@@ -1,18 +1,39 @@
|
|
|
1
1
|
import { TRANSITIONAL_NAMESPACE_BY_STRICT_URI } from "./strictValueEncodings.gen.js";
|
|
2
2
|
import { captureVerbatimXml } from "./verbatimCapture.js";
|
|
3
3
|
import { WORDPROCESSINGML_NAMESPACE_URIS, getChildElements, getLocalName, getNamespaceUri } from "./xmlParser.js";
|
|
4
|
+
import { SEQUENCE_CHILDREN } from "@stll/docx-core/schema";
|
|
4
5
|
//#region src/docx/containerChildren.ts
|
|
5
6
|
/** Keep this child's markup verbatim, in place. */
|
|
6
7
|
const CAPTURE = "capture";
|
|
7
8
|
/**
|
|
8
|
-
*
|
|
9
|
+
* What a handler answers with: nothing when it took a typed value, and
|
|
10
|
+
* {@link CAPTURE} when it took none, so the child's bytes are kept instead.
|
|
9
11
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
12
|
+
* `<w:tblLayout/>` states no layout and `<w:jc w:val="end"/>` states a value a
|
|
13
|
+
* reader's enumeration does not admit. Both used to fall off the end of the
|
|
14
|
+
* walk, and neither can be decided by name: a map keyed by name cannot list
|
|
15
|
+
* the values a reader will refuse, only the names it has never heard of.
|
|
14
16
|
*/
|
|
17
|
+
const keptUnless = (taken) => taken ? void 0 : CAPTURE;
|
|
15
18
|
const OWNED_ELSEWHERE = "owned-elsewhere";
|
|
19
|
+
const CLAIMS = /* @__PURE__ */ new Map();
|
|
20
|
+
/**
|
|
21
|
+
* Every owner a handler map has claimed so far.
|
|
22
|
+
*
|
|
23
|
+
* A claim is registered when `ownedElsewhere` is called, so a module that is
|
|
24
|
+
* never imported contributes none. The checks that read this therefore load
|
|
25
|
+
* the claiming modules first, by scanning the sources for the call rather than
|
|
26
|
+
* by keeping a list beside them.
|
|
27
|
+
*/
|
|
28
|
+
const ownedElsewhereClaims = () => [...CLAIMS.values()];
|
|
29
|
+
/** State that another reader takes this child, and who. */
|
|
30
|
+
const ownedElsewhere = (claim) => {
|
|
31
|
+
CLAIMS.set(`${claim.container}/${claim.child}#${claim.reader}`, claim);
|
|
32
|
+
return {
|
|
33
|
+
disposition: OWNED_ELSEWHERE,
|
|
34
|
+
...claim
|
|
35
|
+
};
|
|
36
|
+
};
|
|
16
37
|
/**
|
|
17
38
|
* This child goes with the wrapper folio does not keep.
|
|
18
39
|
*
|
|
@@ -45,11 +66,11 @@ const transitionalNamespaceOf = (namespace) => TRANSITIONAL_NAMESPACE_BY_STRICT_
|
|
|
45
66
|
* none — an empty record is never written, so a fully modelled container
|
|
46
67
|
* stays byte-identical in the model.
|
|
47
68
|
*/
|
|
48
|
-
const dispatchChildren = ({ element, handlers,
|
|
69
|
+
const dispatchChildren = ({ element, handlers, capturePosition, undeclared, undeclaredNamespaces }) => {
|
|
49
70
|
const children = [];
|
|
50
71
|
const capture = (child) => {
|
|
51
72
|
children.push({
|
|
52
|
-
index:
|
|
73
|
+
index: capturePosition(child),
|
|
53
74
|
xml: captureVerbatimXml(child)
|
|
54
75
|
});
|
|
55
76
|
};
|
|
@@ -64,8 +85,8 @@ const dispatchChildren = ({ element, handlers, modelledCount, undeclared, undecl
|
|
|
64
85
|
capture(child);
|
|
65
86
|
continue;
|
|
66
87
|
}
|
|
67
|
-
if (
|
|
68
|
-
disposition(child);
|
|
88
|
+
if (typeof disposition !== "function") continue;
|
|
89
|
+
if (disposition(child) === "capture") capture(child);
|
|
69
90
|
}
|
|
70
91
|
return children.length === 0 ? void 0 : { children };
|
|
71
92
|
};
|
|
@@ -83,14 +104,15 @@ const withPreservedChildren = (modelled, preserved, wrap) => {
|
|
|
83
104
|
const captures = preserved?.children;
|
|
84
105
|
if (captures === void 0 || captures.length === 0) return [...modelled];
|
|
85
106
|
const byIndex = /* @__PURE__ */ new Map();
|
|
86
|
-
for (const
|
|
107
|
+
for (const child of captures) {
|
|
108
|
+
const { index, xml } = child;
|
|
87
109
|
const slot = Math.min(Math.max(index, 0), modelled.length);
|
|
88
110
|
const bucket = byIndex.get(slot);
|
|
89
111
|
if (bucket) {
|
|
90
|
-
bucket.push(wrap(xml));
|
|
112
|
+
bucket.push(wrap(xml, child));
|
|
91
113
|
continue;
|
|
92
114
|
}
|
|
93
|
-
byIndex.set(slot, [wrap(xml)]);
|
|
115
|
+
byIndex.set(slot, [wrap(xml, child)]);
|
|
94
116
|
}
|
|
95
117
|
const items = [];
|
|
96
118
|
for (const [index, item] of modelled.entries()) items.push(...byIndex.get(index) ?? [], item);
|
|
@@ -99,5 +121,33 @@ const withPreservedChildren = (modelled, preserved, wrap) => {
|
|
|
99
121
|
};
|
|
100
122
|
/** {@link withPreservedChildren} for a caller that already holds markup. */
|
|
101
123
|
const serializeWithPreservedChildren = (modelled, preserved) => withPreservedChildren(modelled, preserved, (xml) => xml).join("");
|
|
124
|
+
/**
|
|
125
|
+
* Where each child sits in a container whose content model is one flat sequence.
|
|
126
|
+
*
|
|
127
|
+
* A property set is that container: `CT_TblPr` and `CT_SectPr` are sequences
|
|
128
|
+
* of optional singletons, so a child's position is a property of its name and
|
|
129
|
+
* the generated list is the order. That is what the sink records for them,
|
|
130
|
+
* rather than a count of modelled siblings: the count is a mirror of whichever
|
|
131
|
+
* properties folio models today, and it moves under the capture the moment one
|
|
132
|
+
* more of them is modelled.
|
|
133
|
+
*
|
|
134
|
+
* An undeclared child — a foreign namespace, an `mc:` construct, a name a
|
|
135
|
+
* later revision of the format adds — has no place in the sequence, so it
|
|
136
|
+
* takes the place of the last declared child before it and comes back beside
|
|
137
|
+
* the same neighbour. One before every declared child takes position `-1`,
|
|
138
|
+
* ahead of the sequence's first slot.
|
|
139
|
+
*/
|
|
140
|
+
const sequencePositions = (container, element) => {
|
|
141
|
+
const declared = SEQUENCE_CHILDREN[container];
|
|
142
|
+
const positions = /* @__PURE__ */ new Map();
|
|
143
|
+
let previous = -1;
|
|
144
|
+
for (const child of getChildElements(element)) {
|
|
145
|
+
const namespace = getNamespaceUri(child);
|
|
146
|
+
const at = namespace === void 0 || WORDPROCESSINGML_NAMESPACE_URIS.has(namespace) ? declared.indexOf(getLocalName(child.name)) : -1;
|
|
147
|
+
if (at !== -1) previous = at;
|
|
148
|
+
positions.set(child, at === -1 ? previous : at);
|
|
149
|
+
}
|
|
150
|
+
return (child) => positions.get(child) ?? -1;
|
|
151
|
+
};
|
|
102
152
|
//#endregion
|
|
103
|
-
export { CAPTURE, DROPPED_WITH_ITS_WRAPPER,
|
|
153
|
+
export { CAPTURE, DROPPED_WITH_ITS_WRAPPER, dispatchChildren, keptUnless, ownedElsewhere, ownedElsewhereClaims, sequencePositions, serializeWithPreservedChildren, transitionalNamespaceOf, withPreservedChildren };
|
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
import { document_d_exports } from "../types/document.js";
|
|
2
2
|
import { XmlElement } from "./xmlParser.js";
|
|
3
3
|
//#region src/docx/diagramPreview.d.ts
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* How many `dsp:sp` a preview describes at most.
|
|
6
|
+
*
|
|
7
|
+
* The bound is on the description rather than on any picture built from it:
|
|
8
|
+
* the shapes are what a backend draws, and a drawing with ten thousand of them
|
|
9
|
+
* is a drawing folio summarises rather than reproduces.
|
|
10
|
+
*/
|
|
11
|
+
declare const MAX_PREVIEW_SHAPES = 128;
|
|
12
|
+
/**
|
|
13
|
+
* Describe a diagram drawing, without drawing it.
|
|
14
|
+
*
|
|
15
|
+
* Deliberately simple and bounded; it is never an editable diagram projection.
|
|
16
|
+
*/
|
|
5
17
|
declare const parseDiagramPreview: (drawing: XmlElement, rels: document_d_exports.RelationshipMap | undefined, media: Map<string, document_d_exports.MediaFile> | undefined) => document_d_exports.Image | null;
|
|
6
18
|
//#endregion
|
|
7
|
-
export { parseDiagramPreview };
|
|
19
|
+
export { MAX_PREVIEW_SHAPES, parseDiagramPreview };
|