@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
|
@@ -16,7 +16,7 @@ const visitParagraphRuns = (paragraph, visit) => {
|
|
|
16
16
|
case "moveFrom":
|
|
17
17
|
case "moveTo":
|
|
18
18
|
case "inlineSdt":
|
|
19
|
-
case "
|
|
19
|
+
case "inlineWrapper":
|
|
20
20
|
for (const child of content.content) visitParagraphContent(child);
|
|
21
21
|
return;
|
|
22
22
|
case "complexField":
|
|
@@ -32,7 +32,8 @@ const visitParagraphRuns = (paragraph, visit) => {
|
|
|
32
32
|
case "moveFromRangeEnd":
|
|
33
33
|
case "moveToRangeStart":
|
|
34
34
|
case "moveToRangeEnd":
|
|
35
|
-
case "mathEquation":
|
|
35
|
+
case "mathEquation":
|
|
36
|
+
case "preservedInline": return;
|
|
36
37
|
default: return content;
|
|
37
38
|
}
|
|
38
39
|
};
|
|
@@ -69,7 +70,7 @@ const visitInlineContentSlots = (paragraph, visit) => {
|
|
|
69
70
|
case "deletion":
|
|
70
71
|
case "moveFrom":
|
|
71
72
|
case "moveTo":
|
|
72
|
-
case "
|
|
73
|
+
case "inlineWrapper":
|
|
73
74
|
visitContent(item.content);
|
|
74
75
|
break;
|
|
75
76
|
case "run":
|
|
@@ -83,41 +84,57 @@ const visitInlineContentSlots = (paragraph, visit) => {
|
|
|
83
84
|
case "moveFromRangeEnd":
|
|
84
85
|
case "moveToRangeStart":
|
|
85
86
|
case "moveToRangeEnd":
|
|
86
|
-
case "mathEquation":
|
|
87
|
+
case "mathEquation":
|
|
88
|
+
case "preservedInline": break;
|
|
87
89
|
default: panic(`Unsupported paragraph content: ${JSON.stringify(item)}`);
|
|
88
90
|
}
|
|
89
91
|
}
|
|
90
92
|
};
|
|
91
93
|
visitContent(paragraph.content);
|
|
92
94
|
};
|
|
95
|
+
/** What the walk does below a record it has just visited. */
|
|
96
|
+
const BLOCK_TREE_DESCENT = {
|
|
97
|
+
descend: "descend",
|
|
98
|
+
prune: "prune"
|
|
99
|
+
};
|
|
93
100
|
/**
|
|
94
|
-
*
|
|
101
|
+
* Every record a block tree owns in document order: a paragraph, table, and
|
|
102
|
+
* table row. These are the records that carry authored state by identity.
|
|
95
103
|
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
104
|
+
* A block container is not always reached through a block. `w:txbxContent`
|
|
105
|
+
* hangs off a shape inside a run, so a walk that recurses on block children
|
|
106
|
+
* alone enters the body, a cell and an `w:sdt` and never enters a text box:
|
|
107
|
+
* every record inside one is then invisible to whatever the walk is deciding.
|
|
98
108
|
*/
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
109
|
+
const visitBlockTreeRecords = (blocks, visit) => {
|
|
110
|
+
const visitParagraph = (paragraph) => {
|
|
111
|
+
if (visit(paragraph) === BLOCK_TREE_DESCENT.prune) return;
|
|
112
|
+
visitParagraphRuns(paragraph, (run) => {
|
|
113
|
+
for (const content of run.content) if (content.type === "shape" && content.shape.textBody) visitBlocks(content.shape.textBody.content);
|
|
114
|
+
});
|
|
115
|
+
};
|
|
116
|
+
const visitBlocks = (nested) => {
|
|
117
|
+
for (const block of nested) switch (block.type) {
|
|
118
|
+
case "paragraph":
|
|
119
|
+
visitParagraph(block);
|
|
120
|
+
break;
|
|
121
|
+
case "table":
|
|
122
|
+
if (visit(block) === BLOCK_TREE_DESCENT.prune) break;
|
|
123
|
+
for (const row of block.rows) {
|
|
124
|
+
if (visit(row) === BLOCK_TREE_DESCENT.prune) continue;
|
|
125
|
+
for (const cell of row.cells) visitBlocks(cell.content);
|
|
126
|
+
}
|
|
127
|
+
break;
|
|
128
|
+
case "blockSdt":
|
|
129
|
+
visitBlocks(block.content);
|
|
130
|
+
break;
|
|
131
|
+
case "preservedBlock":
|
|
132
|
+
case "bookmarkStart":
|
|
133
|
+
case "bookmarkEnd": break;
|
|
134
|
+
default: panic(`Unsupported block content: ${JSON.stringify(block)}`);
|
|
118
135
|
}
|
|
119
|
-
|
|
120
|
-
|
|
136
|
+
};
|
|
137
|
+
visitBlocks(blocks);
|
|
121
138
|
};
|
|
122
139
|
const visitDocxParagraphs = ({ documentBody, headers, footers, footnotes, endnotes }, visit) => {
|
|
123
140
|
const seenParagraphs = /* @__PURE__ */ new WeakSet();
|
|
@@ -125,30 +142,14 @@ const visitDocxParagraphs = ({ documentBody, headers, footers, footnotes, endnot
|
|
|
125
142
|
if (seenParagraphs.has(paragraph)) return;
|
|
126
143
|
seenParagraphs.add(paragraph);
|
|
127
144
|
visit(paragraph);
|
|
128
|
-
visitParagraphRuns(paragraph, visitRun);
|
|
129
|
-
};
|
|
130
|
-
const visitRun = (run) => {
|
|
131
|
-
for (const content of run.content) {
|
|
132
|
-
if (content.type !== "shape" || !content.shape.textBody) continue;
|
|
133
|
-
for (const block of content.shape.textBody.content) visitBlock(block);
|
|
134
|
-
}
|
|
135
|
-
};
|
|
136
|
-
const visitTable = (table) => {
|
|
137
|
-
for (const row of table.rows) for (const cell of row.cells) visitBlocks(cell.content);
|
|
138
|
-
};
|
|
139
|
-
const visitBlock = (block) => {
|
|
140
|
-
if (block.type === "paragraph") {
|
|
141
|
-
visitParagraph(block);
|
|
142
|
-
return;
|
|
143
|
-
}
|
|
144
|
-
if (block.type === "table") {
|
|
145
|
-
visitTable(block);
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
|
-
visitBlocks(block.content);
|
|
149
145
|
};
|
|
150
146
|
const visitBlocks = (blocks) => {
|
|
151
|
-
|
|
147
|
+
visitBlockTreeRecords(blocks, (record) => {
|
|
148
|
+
if (record.type !== "paragraph") return BLOCK_TREE_DESCENT.descend;
|
|
149
|
+
if (seenParagraphs.has(record)) return BLOCK_TREE_DESCENT.prune;
|
|
150
|
+
visitParagraph(record);
|
|
151
|
+
return BLOCK_TREE_DESCENT.descend;
|
|
152
|
+
});
|
|
152
153
|
};
|
|
153
154
|
visitBlocks(documentBody.content);
|
|
154
155
|
for (const section of documentBody.sections ?? []) visitBlocks(section.content);
|
|
@@ -156,7 +157,7 @@ const visitDocxParagraphs = ({ documentBody, headers, footers, footnotes, endnot
|
|
|
156
157
|
for (const footer of footers?.values() ?? []) visitBlocks(footer.content);
|
|
157
158
|
for (const footnote of footnotes ?? []) visitBlocks(footnote.content);
|
|
158
159
|
for (const endnote of endnotes ?? []) visitBlocks(endnote.content);
|
|
159
|
-
for (const comment of documentBody.comments ?? [])
|
|
160
|
+
for (const comment of documentBody.comments ?? []) visitBlocks(comment.content);
|
|
160
161
|
};
|
|
161
162
|
//#endregion
|
|
162
|
-
export {
|
|
163
|
+
export { BLOCK_TREE_DESCENT, visitBlockTreeRecords, visitDocxParagraphs, visitInlineContentSlots, visitParagraphRuns };
|
|
@@ -34,9 +34,13 @@ const PARSE_WARNING_MESSAGES = {
|
|
|
34
34
|
[PARSE_WARNING_CODES.unbalancedMoveRange]: (warning) => `Removed ${plural(warning.count, "unbalanced tracked move range marker")}.`,
|
|
35
35
|
[PARSE_WARNING_CODES.headerFooterTypeOutsideEnum]: (warning) => `Read header/footer type${quoted(warning.value)} as "default"${where(warning)}; ST_HdrFtr is even, default or first.`,
|
|
36
36
|
[PARSE_WARNING_CODES.unrecognisedOnOffValue]: (warning) => `Ignored on/off value${quoted(warning.value)}${where(warning)}; ST_OnOff is 1, 0, true, false, on or off.`,
|
|
37
|
+
[PARSE_WARNING_CODES.unrecognisedThemeColor]: (warning) => `Kept theme colour${quoted(warning.value)}${where(warning)} without painting it; ST_ThemeColor does not enumerate it.`,
|
|
37
38
|
[PARSE_WARNING_CODES.borderWithoutValue]: (warning) => `Read a border with no w:val${where(warning)} as having no border style.`,
|
|
39
|
+
[PARSE_WARNING_CODES.borderStyleOutsideEnum]: (warning) => `Kept border style${quoted(warning.value)} verbatim${where(warning)}; ST_Border does not declare it.`,
|
|
40
|
+
[PARSE_WARNING_CODES.outlineDashOutsideEnum]: (warning) => `Kept outline dash${quoted(warning.value)} verbatim${where(warning)}; ST_PresetLineDashVal does not declare it.`,
|
|
38
41
|
[PARSE_WARNING_CODES.styleSetDuplicateStyleId]: (warning) => `Dropped a style repeating the id${quoted(warning.value)} another style in the set already defines.`,
|
|
39
|
-
[PARSE_WARNING_CODES.styleSetInitialStyleMissing]: (warning) => `The style set names initial paragraph style${quoted(warning.value)}, which it does not contain; used the set's default instead${where(warning)}
|
|
42
|
+
[PARSE_WARNING_CODES.styleSetInitialStyleMissing]: (warning) => `The style set names initial paragraph style${quoted(warning.value)}, which it does not contain; used the set's default instead${where(warning)}.`,
|
|
43
|
+
[PARSE_WARNING_CODES.pageBreakProjectionApproximated]: (warning) => `${warning.detail ?? "An explicit page break is laid out approximately"}${where(warning)}.`
|
|
40
44
|
};
|
|
41
45
|
const formatParseWarning = (warning) => PARSE_WARNING_MESSAGES[warning.code](warning);
|
|
42
46
|
const formatParseWarnings = (warnings) => warnings.map(formatParseWarning);
|
|
@@ -7,17 +7,15 @@ import * as v from "valibot";
|
|
|
7
7
|
* no `as` at the call site.
|
|
8
8
|
*/
|
|
9
9
|
declare const narrowEnum: <T extends string>(value: string | null | undefined, schema: v.PicklistSchema<readonly T[], undefined>) => T | undefined;
|
|
10
|
-
declare const ThemeColorSlotSchema: v.PicklistSchema<readonly ["dk1", "lt1", "dk2", "lt2", "accent1", "accent2", "accent3", "accent4", "accent5", "accent6", "hlink", "folHlink", "background1", "text1", "background2", "text2"], undefined>;
|
|
11
|
-
declare const BorderStyleSchema: v.PicklistSchema<readonly ["none", "single", "double", "dotted", "dashed", "thick", "triple", "thinThickSmallGap", "thickThinSmallGap", "thinThickMediumGap", "thickThinMediumGap", "thinThickLargeGap", "thickThinLargeGap", "wave", "doubleWave", "dashSmallGap", "dashDotStroked", "threeDEmboss", "threeDEngrave", "outset", "inset", "nil"], undefined>;
|
|
12
10
|
declare const UnderlineStyleSchema: v.PicklistSchema<readonly ["none", "single", "words", "double", "thick", "dotted", "dottedHeavy", "dash", "dashedHeavy", "dashLong", "dashLongHeavy", "dotDash", "dashDotHeavy", "dotDotDash", "dashDotDotHeavy", "wave", "wavyHeavy", "wavyDouble"], undefined>;
|
|
13
11
|
declare const HighlightColorSchema: v.PicklistSchema<readonly ["black", "blue", "cyan", "darkBlue", "darkCyan", "darkGray", "darkGreen", "darkMagenta", "darkRed", "darkYellow", "green", "lightGray", "magenta", "none", "red", "white", "yellow"], undefined>;
|
|
14
12
|
declare const TextEffectSchema: v.PicklistSchema<readonly ["none", "blinkBackground", "lights", "antsBlack", "antsRed", "shimmer", "sparkle"], undefined>;
|
|
15
13
|
declare const EmphasisMarkSchema: v.PicklistSchema<readonly ["none", "dot", "comma", "circle", "underDot"], undefined>;
|
|
16
14
|
declare const FontThemeSchema: v.PicklistSchema<readonly ["majorAscii", "majorHAnsi", "majorEastAsia", "majorBidi", "minorAscii", "minorHAnsi", "minorEastAsia", "minorBidi"], undefined>;
|
|
17
15
|
declare const FontHintSchema: v.PicklistSchema<readonly ["default", "eastAsia", "cs"], undefined>;
|
|
18
|
-
declare const ParagraphAlignmentSchema: v.PicklistSchema<readonly ["
|
|
16
|
+
declare const ParagraphAlignmentSchema: v.PicklistSchema<readonly ["start", "center", "end", "both", "mediumKashida", "distribute", "numTab", "highKashida", "lowKashida", "thaiDistribute", "left", "right"], undefined>;
|
|
19
17
|
declare const LineSpacingRuleSchema: v.PicklistSchema<readonly ["auto", "exact", "atLeast"], undefined>;
|
|
20
|
-
declare const TabStopAlignmentSchema: v.PicklistSchema<readonly ["
|
|
18
|
+
declare const TabStopAlignmentSchema: v.PicklistSchema<readonly ["clear", "start", "center", "end", "decimal", "bar", "num", "left", "right"], undefined>;
|
|
21
19
|
declare const TabLeaderSchema: v.PicklistSchema<readonly ["none", "dot", "hyphen", "underscore", "heavy", "middleDot"], undefined>;
|
|
22
20
|
declare const PositionalTabRelativeToSchema: v.PicklistSchema<readonly ["margin", "indent"], undefined>;
|
|
23
21
|
declare const PositionalTabAlignmentSchema: v.PicklistSchema<readonly ["left", "center", "right"], undefined>;
|
|
@@ -29,9 +27,10 @@ declare const SdtLockSchema: v.PicklistSchema<readonly ["sdtLocked", "contentLoc
|
|
|
29
27
|
declare const FieldTypeSchema: v.PicklistSchema<readonly ["PAGE", "NUMPAGES", "NUMWORDS", "NUMCHARS", "DATE", "TIME", "CREATEDATE", "SAVEDATE", "PRINTDATE", "AUTHOR", "TITLE", "SUBJECT", "KEYWORDS", "COMMENTS", "FILENAME", "FILESIZE", "TEMPLATE", "DOCPROPERTY", "DOCVARIABLE", "REF", "PAGEREF", "NOTEREF", "HYPERLINK", "TOC", "TOA", "INDEX", "SEQ", "STYLEREF", "AUTONUM", "AUTONUMLGL", "AUTONUMOUT", "LISTNUM", "IF", "MERGEFIELD", "NEXT", "NEXTIF", "ASK", "SET", "QUOTE", "INCLUDETEXT", "INCLUDEPICTURE", "SYMBOL", "ADVANCE", "EDITTIME", "REVNUM", "SECTION", "SECTIONPAGES", "USERADDRESS", "USERNAME", "USERINITIALS", "UNKNOWN"], undefined>;
|
|
30
28
|
declare const StyleTypeSchema: v.PicklistSchema<readonly ["paragraph", "character", "numbering", "table"], undefined>;
|
|
31
29
|
declare const ConditionalStyleTypeSchema: v.PicklistSchema<readonly ["band1Horz", "band1Vert", "band2Horz", "band2Vert", "firstCol", "firstRow", "lastCol", "lastRow", "neCell", "nwCell", "seCell", "swCell", "wholeTable"], undefined>;
|
|
30
|
+
declare const TableAlignmentSchema: v.PicklistSchema<readonly ["center", "end", "left", "right", "start"], undefined>;
|
|
32
31
|
declare const TableWidthTypeSchema: v.PicklistSchema<readonly ["auto", "dxa", "nil", "pct"], undefined>;
|
|
33
32
|
declare const TableRowHeightRuleSchema: v.PicklistSchema<readonly ["auto", "atLeast", "exact"], undefined>;
|
|
34
|
-
declare const
|
|
33
|
+
declare const TextDirectionSchema: v.PicklistSchema<readonly ["tb", "rl", "lr", "tbV", "rlV", "lrV", "btLr", "lrTb", "lrTbV", "tbLrV", "tbRl", "tbRlV"], undefined>;
|
|
35
34
|
declare const ShadingPatternSchema: v.PicklistSchema<readonly ["clear", "solid", "horzStripe", "vertStripe", "reverseDiagStripe", "diagStripe", "horzCross", "diagCross", "thinHorzStripe", "thinVertStripe", "thinReverseDiagStripe", "thinDiagStripe", "thinHorzCross", "thinDiagCross", "pct5", "pct10", "pct12", "pct15", "pct20", "pct25", "pct30", "pct35", "pct37", "pct40", "pct45", "pct50", "pct55", "pct60", "pct62", "pct65", "pct70", "pct75", "pct80", "pct85", "pct87", "pct90", "pct95", "nil"], undefined>;
|
|
36
35
|
declare const FloatingTableXSpecSchema: v.PicklistSchema<readonly ["left", "center", "right", "inside", "outside"], undefined>;
|
|
37
36
|
declare const FloatingTableYSpecSchema: v.PicklistSchema<readonly ["top", "center", "bottom", "inside", "outside", "inline"], undefined>;
|
|
@@ -40,9 +39,8 @@ declare const ImageHorizontalAlignmentSchema: v.PicklistSchema<readonly ["left",
|
|
|
40
39
|
declare const ImageVerticalRelativeToSchema: v.PicklistSchema<readonly ["insideMargin", "line", "margin", "outsideMargin", "page", "paragraph", "topMargin", "bottomMargin"], undefined>;
|
|
41
40
|
declare const ImageVerticalAlignmentSchema: v.PicklistSchema<readonly ["top", "bottom", "center", "inside", "outside"], undefined>;
|
|
42
41
|
declare const ImageWrapTextSchema: v.PicklistSchema<readonly ["bothSides", "left", "right", "largest"], undefined>;
|
|
43
|
-
declare const ShapeOutlineStyleSchema: v.PicklistSchema<readonly ["solid", "dot", "dash", "lgDash", "dashDot", "lgDashDot", "lgDashDotDot", "sysDot", "sysDash", "sysDashDot", "sysDashDotDot"], undefined>;
|
|
44
42
|
declare const ShapeTypeSchema: v.PicklistSchema<readonly ["rect", "roundRect", "ellipse", "triangle", "rtTriangle", "parallelogram", "trapezoid", "pentagon", "hexagon", "heptagon", "octagon", "decagon", "dodecagon", "star4", "star5", "star6", "star7", "star8", "star10", "star12", "star16", "star24", "star32", "line", "straightConnector1", "bentConnector2", "bentConnector3", "bentConnector4", "bentConnector5", "curvedConnector2", "curvedConnector3", "curvedConnector4", "curvedConnector5", "rightArrow", "leftArrow", "upArrow", "downArrow", "leftRightArrow", "upDownArrow", "quadArrow", "leftRightUpArrow", "bentArrow", "uturnArrow", "leftUpArrow", "bentUpArrow", "curvedRightArrow", "curvedLeftArrow", "curvedUpArrow", "curvedDownArrow", "stripedRightArrow", "notchedRightArrow", "homePlate", "chevron", "rightArrowCallout", "downArrowCallout", "leftArrowCallout", "upArrowCallout", "leftRightArrowCallout", "quadArrowCallout", "circularArrow", "flowChartProcess", "flowChartAlternateProcess", "flowChartDecision", "flowChartInputOutput", "flowChartPredefinedProcess", "flowChartInternalStorage", "flowChartDocument", "flowChartMultidocument", "flowChartTerminator", "flowChartPreparation", "flowChartManualInput", "flowChartManualOperation", "flowChartConnector", "flowChartOffpageConnector", "flowChartPunchedCard", "flowChartPunchedTape", "flowChartSummingJunction", "flowChartOr", "flowChartCollate", "flowChartSort", "flowChartExtract", "flowChartMerge", "flowChartOnlineStorage", "flowChartDelay", "flowChartMagneticTape", "flowChartMagneticDisk", "flowChartMagneticDrum", "flowChartDisplay", "wedgeRectCallout", "wedgeRoundRectCallout", "wedgeEllipseCallout", "cloudCallout", "borderCallout1", "borderCallout2", "borderCallout3", "accentCallout1", "accentCallout2", "accentCallout3", "callout1", "callout2", "callout3", "accentBorderCallout1", "accentBorderCallout2", "accentBorderCallout3", "actionButtonBlank", "actionButtonHome", "actionButtonHelp", "actionButtonInformation", "actionButtonBackPrevious", "actionButtonForwardNext", "actionButtonBeginning", "actionButtonEnd", "actionButtonReturn", "actionButtonDocument", "actionButtonSound", "actionButtonMovie", "irregularSeal1", "irregularSeal2", "frame", "halfFrame", "corner", "diagStripe", "chord", "arc", "bracketPair", "bracePair", "leftBracket", "rightBracket", "leftBrace", "rightBrace", "can", "cube", "bevel", "donut", "noSmoking", "blockArc", "foldedCorner", "smileyFace", "heart", "lightningBolt", "sun", "moon", "cloud", "snip1Rect", "snip2SameRect", "snip2DiagRect", "snipRoundRect", "round1Rect", "round2SameRect", "round2DiagRect", "plaque", "teardrop", "mathPlus", "mathMinus", "mathMultiply", "mathDivide", "mathEqual", "mathNotEqual", "gear6", "gear9", "funnel", "pieWedge", "pie", "leftCircularArrow", "leftRightCircularArrow", "swooshArrow", "textBox"], undefined>;
|
|
45
|
-
declare const NumberFormatSchema: v.PicklistSchema<readonly ["decimal", "upperRoman", "lowerRoman", "upperLetter", "lowerLetter", "ordinal", "cardinalText", "ordinalText", "hex", "chicago", "ideographDigital", "japaneseCounting", "aiueo", "iroha", "decimalFullWidth", "decimalHalfWidth", "japaneseLegal", "japaneseDigitalTenThousand", "decimalEnclosedCircle", "decimalFullWidth2", "aiueoFullWidth", "irohaFullWidth", "decimalZero", "
|
|
43
|
+
declare const NumberFormatSchema: v.PicklistSchema<readonly ["decimal", "upperRoman", "lowerRoman", "upperLetter", "lowerLetter", "ordinal", "cardinalText", "ordinalText", "hex", "chicago", "ideographDigital", "japaneseCounting", "aiueo", "iroha", "decimalFullWidth", "decimalHalfWidth", "japaneseLegal", "japaneseDigitalTenThousand", "decimalEnclosedCircle", "decimalFullWidth2", "aiueoFullWidth", "irohaFullWidth", "decimalZero", "bullet", "ganada", "chosung", "decimalEnclosedFullstop", "decimalEnclosedParen", "decimalEnclosedCircleChinese", "ideographEnclosedCircle", "ideographTraditional", "ideographZodiac", "ideographZodiacTraditional", "taiwaneseCounting", "ideographLegalTraditional", "taiwaneseCountingThousand", "taiwaneseDigital", "chineseCounting", "chineseLegalSimplified", "chineseCountingThousand", "koreanDigital", "koreanCounting", "koreanLegal", "koreanDigital2", "vietnameseCounting", "russianLower", "russianUpper", "none", "numberInDash", "hebrew1", "hebrew2", "arabicAlpha", "arabicAbjad", "hindiVowels", "hindiConsonants", "hindiNumbers", "hindiCounting", "thaiLetters", "thaiNumbers", "thaiCounting", "bahtText", "dollarText", "custom"], undefined>;
|
|
46
44
|
declare const LevelSuffixSchema: v.PicklistSchema<readonly ["tab", "space", "nothing"], undefined>;
|
|
47
45
|
//#endregion
|
|
48
|
-
export {
|
|
46
|
+
export { ConditionalStyleTypeSchema, EmphasisMarkSchema, FieldTypeSchema, FloatingTableXSpecSchema, FloatingTableYSpecSchema, FontHintSchema, FontThemeSchema, FrameWrapSchema, FrameXAlignSchema, FrameYAlignSchema, HighlightColorSchema, ImageHorizontalAlignmentSchema, ImageHorizontalRelativeToSchema, ImageVerticalAlignmentSchema, ImageVerticalRelativeToSchema, ImageWrapTextSchema, LevelSuffixSchema, LineSpacingRuleSchema, NumberFormatSchema, ParagraphAlignmentSchema, PositionalTabAlignmentSchema, PositionalTabLeaderSchema, PositionalTabRelativeToSchema, SdtLockSchema, ShadingPatternSchema, ShapeTypeSchema, StyleTypeSchema, TabLeaderSchema, TabStopAlignmentSchema, TableAlignmentSchema, TableRowHeightRuleSchema, TableWidthTypeSchema, TextDirectionSchema, TextEffectSchema, UnderlineStyleSchema, narrowEnum };
|
package/dist/docx/parserEnums.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CONDITIONAL_STYLE_TYPE_VALUES, EMPHASIS_MARK_VALUES, FIELD_TYPE_VALUES, FLOATING_TABLE_X_SPEC_VALUES, FLOATING_TABLE_Y_SPEC_VALUES, FONT_HINT_VALUES, FONT_THEME_VALUES, FRAME_WRAP_VALUES, FRAME_X_ALIGN_VALUES, FRAME_Y_ALIGN_VALUES, HIGHLIGHT_COLOR_VALUES, IMAGE_HORIZONTAL_ALIGNMENT_VALUES, IMAGE_HORIZONTAL_RELATIVE_TO_VALUES, IMAGE_VERTICAL_ALIGNMENT_VALUES, IMAGE_VERTICAL_RELATIVE_TO_VALUES, IMAGE_WRAP_TEXT_VALUES, LEVEL_SUFFIX_VALUES, LINE_SPACING_RULE_VALUES, NUMBER_FORMAT_VALUES, PARAGRAPH_ALIGNMENT_VALUES, POSITIONAL_TAB_ALIGNMENT_VALUES, POSITIONAL_TAB_LEADER_VALUES, POSITIONAL_TAB_RELATIVE_TO_VALUES, SDT_LOCK_VALUES, SHADING_PATTERN_VALUES, SHAPE_TYPE_VALUES, STYLE_TYPE_VALUES, TABLE_JUSTIFICATION_VALUES, TABLE_ROW_HEIGHT_RULE_VALUES, TABLE_WIDTH_TYPE_VALUES, TAB_LEADER_VALUES, TAB_STOP_ALIGNMENT_VALUES, TEXT_DIRECTION_VALUES, TEXT_EFFECT_VALUES, UNDERLINE_STYLE_VALUES } from "../types/documentEnumValues.js";
|
|
2
2
|
import * as v from "valibot";
|
|
3
3
|
//#region src/docx/parserEnums.ts
|
|
4
4
|
/**
|
|
@@ -33,8 +33,6 @@ const narrowEnum = (value, schema) => {
|
|
|
33
33
|
const result = v.safeParse(schema, value);
|
|
34
34
|
return result.success ? result.output : void 0;
|
|
35
35
|
};
|
|
36
|
-
const ThemeColorSlotSchema = v.picklist(THEME_COLOR_SLOT_VALUES);
|
|
37
|
-
const BorderStyleSchema = v.picklist(BORDER_STYLE_VALUES);
|
|
38
36
|
const UnderlineStyleSchema = v.picklist(UNDERLINE_STYLE_VALUES);
|
|
39
37
|
const HighlightColorSchema = v.picklist(HIGHLIGHT_COLOR_VALUES);
|
|
40
38
|
const TextEffectSchema = v.picklist(TEXT_EFFECT_VALUES);
|
|
@@ -55,9 +53,10 @@ const SdtLockSchema = v.picklist(SDT_LOCK_VALUES);
|
|
|
55
53
|
const FieldTypeSchema = v.picklist(FIELD_TYPE_VALUES);
|
|
56
54
|
const StyleTypeSchema = v.picklist(STYLE_TYPE_VALUES);
|
|
57
55
|
const ConditionalStyleTypeSchema = v.picklist(CONDITIONAL_STYLE_TYPE_VALUES);
|
|
56
|
+
const TableAlignmentSchema = v.picklist(TABLE_JUSTIFICATION_VALUES);
|
|
58
57
|
const TableWidthTypeSchema = v.picklist(TABLE_WIDTH_TYPE_VALUES);
|
|
59
58
|
const TableRowHeightRuleSchema = v.picklist(TABLE_ROW_HEIGHT_RULE_VALUES);
|
|
60
|
-
const
|
|
59
|
+
const TextDirectionSchema = v.picklist(TEXT_DIRECTION_VALUES);
|
|
61
60
|
const ShadingPatternSchema = v.picklist(SHADING_PATTERN_VALUES);
|
|
62
61
|
const FloatingTableXSpecSchema = v.picklist(FLOATING_TABLE_X_SPEC_VALUES);
|
|
63
62
|
const FloatingTableYSpecSchema = v.picklist(FLOATING_TABLE_Y_SPEC_VALUES);
|
|
@@ -66,9 +65,8 @@ const ImageHorizontalAlignmentSchema = v.picklist(IMAGE_HORIZONTAL_ALIGNMENT_VAL
|
|
|
66
65
|
const ImageVerticalRelativeToSchema = v.picklist(IMAGE_VERTICAL_RELATIVE_TO_VALUES);
|
|
67
66
|
const ImageVerticalAlignmentSchema = v.picklist(IMAGE_VERTICAL_ALIGNMENT_VALUES);
|
|
68
67
|
const ImageWrapTextSchema = v.picklist(IMAGE_WRAP_TEXT_VALUES);
|
|
69
|
-
const ShapeOutlineStyleSchema = v.picklist(SHAPE_OUTLINE_STYLE_VALUES);
|
|
70
68
|
const ShapeTypeSchema = v.picklist(SHAPE_TYPE_VALUES);
|
|
71
69
|
const NumberFormatSchema = v.picklist(NUMBER_FORMAT_VALUES);
|
|
72
70
|
const LevelSuffixSchema = v.picklist(LEVEL_SUFFIX_VALUES);
|
|
73
71
|
//#endregion
|
|
74
|
-
export {
|
|
72
|
+
export { ConditionalStyleTypeSchema, EmphasisMarkSchema, FieldTypeSchema, FloatingTableXSpecSchema, FloatingTableYSpecSchema, FontHintSchema, FontThemeSchema, FrameWrapSchema, FrameXAlignSchema, FrameYAlignSchema, HighlightColorSchema, ImageHorizontalAlignmentSchema, ImageHorizontalRelativeToSchema, ImageVerticalAlignmentSchema, ImageVerticalRelativeToSchema, ImageWrapTextSchema, LevelSuffixSchema, LineSpacingRuleSchema, NumberFormatSchema, ParagraphAlignmentSchema, PositionalTabAlignmentSchema, PositionalTabLeaderSchema, PositionalTabRelativeToSchema, SdtLockSchema, ShadingPatternSchema, ShapeTypeSchema, StyleTypeSchema, TabLeaderSchema, TabStopAlignmentSchema, TableAlignmentSchema, TableRowHeightRuleSchema, TableWidthTypeSchema, TextDirectionSchema, TextEffectSchema, UnderlineStyleSchema, narrowEnum };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { document_d_exports } from "../types/document.js";
|
|
2
|
+
import { XmlElement } from "./xmlParser.js";
|
|
3
|
+
//#region src/docx/preservedRunContent.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* The visible text a preserved run child contributes, or `""` when it shows
|
|
6
|
+
* nothing. Unknown markup contributes nothing on purpose: guessing at the text
|
|
7
|
+
* of an element folio has never seen would put invented words in a document.
|
|
8
|
+
*/
|
|
9
|
+
declare const preservedRunChildText: (element: XmlElement) => string;
|
|
10
|
+
/**
|
|
11
|
+
* Capture one unmodelled run child.
|
|
12
|
+
*
|
|
13
|
+
* `captureVerbatimXml` materialises exactly the namespace bindings the
|
|
14
|
+
* fragment's own prefixes need and leaves the canonical ones to the rebuilt
|
|
15
|
+
* root, so ordinary `w:` markup comes back byte for byte while a foreign
|
|
16
|
+
* prefix still arrives bound. Copying the whole root scope onto the fragment
|
|
17
|
+
* instead would rewrite every capture with declarations it does not use.
|
|
18
|
+
*/
|
|
19
|
+
declare const preserveRunChild: (element: XmlElement) => document_d_exports.PreservedXmlContent;
|
|
20
|
+
/**
|
|
21
|
+
* One capture from the shared dispatcher's sink, as a member of the
|
|
22
|
+
* container's own inline union.
|
|
23
|
+
*
|
|
24
|
+
* The sink holds markup the schema does not declare for the container at all,
|
|
25
|
+
* so nothing is known about it beyond its bytes: `text` is empty because a
|
|
26
|
+
* name folio has never seen shows nothing folio can read.
|
|
27
|
+
*/
|
|
28
|
+
declare const preservedInlineCapture: (xml: string) => document_d_exports.PreservedInline;
|
|
29
|
+
/** Capture one unmodelled inline child of a paragraph or an inline wrapper. */
|
|
30
|
+
declare const preserveInlineChild: (element: XmlElement) => document_d_exports.PreservedInline;
|
|
31
|
+
//#endregion
|
|
32
|
+
export { preserveInlineChild, preserveRunChild, preservedInlineCapture, preservedRunChildText };
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { captureVerbatimXml } from "./verbatimCapture.js";
|
|
2
|
+
import { findChildrenByLocalName, getChildElements, getLocalName, getTextContent } from "./xmlParser.js";
|
|
3
|
+
//#region src/docx/preservedRunContent.ts
|
|
4
|
+
/**
|
|
5
|
+
* Where a preserved run child hides text a reader sees, by local name: the
|
|
6
|
+
* child elements whose `w:t` descendants are on the line rather than above,
|
|
7
|
+
* beside, or nowhere.
|
|
8
|
+
*
|
|
9
|
+
* `w:ruby` is the whole list today. Its `w:rt` is the annotation printed above
|
|
10
|
+
* the base and is not the sentence's text; its `w:rubyBase` is.
|
|
11
|
+
*/
|
|
12
|
+
const VISIBLE_TEXT_CHILDREN = /* @__PURE__ */ new Map([["ruby", ["rubyBase"]]]);
|
|
13
|
+
/** Cap on the text one preserved child contributes, mirroring `w:t` handling. */
|
|
14
|
+
const MAX_PRESERVED_TEXT_LENGTH = 1e5;
|
|
15
|
+
const collectTextContent = (element, into) => {
|
|
16
|
+
for (const child of getChildElements(element)) {
|
|
17
|
+
if (getLocalName(child.name) === "t") {
|
|
18
|
+
into.push(getTextContent(child));
|
|
19
|
+
continue;
|
|
20
|
+
}
|
|
21
|
+
collectTextContent(child, into);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* The visible text a preserved run child contributes, or `""` when it shows
|
|
26
|
+
* nothing. Unknown markup contributes nothing on purpose: guessing at the text
|
|
27
|
+
* of an element folio has never seen would put invented words in a document.
|
|
28
|
+
*/
|
|
29
|
+
const preservedRunChildText = (element) => {
|
|
30
|
+
const sources = VISIBLE_TEXT_CHILDREN.get(getLocalName(element.name));
|
|
31
|
+
if (sources === void 0) return "";
|
|
32
|
+
const parts = [];
|
|
33
|
+
for (const localName of sources) for (const source of findChildrenByLocalName(element, localName)) collectTextContent(source, parts);
|
|
34
|
+
return parts.join("").slice(0, MAX_PRESERVED_TEXT_LENGTH);
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Capture one unmodelled run child.
|
|
38
|
+
*
|
|
39
|
+
* `captureVerbatimXml` materialises exactly the namespace bindings the
|
|
40
|
+
* fragment's own prefixes need and leaves the canonical ones to the rebuilt
|
|
41
|
+
* root, so ordinary `w:` markup comes back byte for byte while a foreign
|
|
42
|
+
* prefix still arrives bound. Copying the whole root scope onto the fragment
|
|
43
|
+
* instead would rewrite every capture with declarations it does not use.
|
|
44
|
+
*/
|
|
45
|
+
const preserveRunChild = (element) => ({
|
|
46
|
+
type: "preservedXml",
|
|
47
|
+
xml: captureVerbatimXml(element),
|
|
48
|
+
text: preservedRunChildText(element)
|
|
49
|
+
});
|
|
50
|
+
/**
|
|
51
|
+
* Where an unmodelled *inline* child hides text a reader sees, by local name.
|
|
52
|
+
*
|
|
53
|
+
* `w:customXml` and `w:smartTag` are transparent wrappers (ECMA-376 §17.5.1,
|
|
54
|
+
* §17.5.1.9): their content is ordinary inline content, so their `w:t`
|
|
55
|
+
* descendants are on the line. A `w:hyperlink` and a `w:fldSimple` are here
|
|
56
|
+
* for the same reason and only in one place — inside another link or another
|
|
57
|
+
* field, where folio captures the inner one rather than modelling the nesting.
|
|
58
|
+
* Their runs print like any other; a capture that kept the markup and not the
|
|
59
|
+
* words would take a linked clause off the page.
|
|
60
|
+
*
|
|
61
|
+
* Every other inline child folio captures — `w:permStart`, `w:proofErr` and
|
|
62
|
+
* the custom-XML revision ranges — is an empty marker, and an element folio
|
|
63
|
+
* has never seen contributes nothing on purpose, because guessing at its text
|
|
64
|
+
* would put invented words in a document.
|
|
65
|
+
*/
|
|
66
|
+
const VISIBLE_TEXT_INLINE_CHILDREN = /* @__PURE__ */ new Set([
|
|
67
|
+
"customXml",
|
|
68
|
+
"fldSimple",
|
|
69
|
+
"hyperlink",
|
|
70
|
+
"smartTag"
|
|
71
|
+
]);
|
|
72
|
+
/**
|
|
73
|
+
* One capture from the shared dispatcher's sink, as a member of the
|
|
74
|
+
* container's own inline union.
|
|
75
|
+
*
|
|
76
|
+
* The sink holds markup the schema does not declare for the container at all,
|
|
77
|
+
* so nothing is known about it beyond its bytes: `text` is empty because a
|
|
78
|
+
* name folio has never seen shows nothing folio can read.
|
|
79
|
+
*/
|
|
80
|
+
const preservedInlineCapture = (xml) => ({
|
|
81
|
+
type: "preservedInline",
|
|
82
|
+
xml,
|
|
83
|
+
text: ""
|
|
84
|
+
});
|
|
85
|
+
/** Capture one unmodelled inline child of a paragraph or an inline wrapper. */
|
|
86
|
+
const preserveInlineChild = (element) => {
|
|
87
|
+
const parts = [];
|
|
88
|
+
if (VISIBLE_TEXT_INLINE_CHILDREN.has(getLocalName(element.name))) collectTextContent(element, parts);
|
|
89
|
+
return {
|
|
90
|
+
type: "preservedInline",
|
|
91
|
+
xml: captureVerbatimXml(element),
|
|
92
|
+
text: parts.join("").slice(0, MAX_PRESERVED_TEXT_LENGTH)
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
//#endregion
|
|
96
|
+
export { preserveInlineChild, preserveRunChild, preservedInlineCapture, preservedRunChildText };
|
|
@@ -15,44 +15,65 @@
|
|
|
15
15
|
* would have stopped the other charging for it without anything failing. The
|
|
16
16
|
* table below is that agreement written once, and a producer builds its image
|
|
17
17
|
* out of the entry the budget matches against.
|
|
18
|
+
*
|
|
19
|
+
* An entry says what backs the preview, because that decides what there is to
|
|
20
|
+
* agree on. A source-backed preview is image data in `src`, recognized by the
|
|
21
|
+
* strings its producer stamps on it and charged by the character. A
|
|
22
|
+
* descriptor-backed preview is no picture at all, so it carries none of those
|
|
23
|
+
* strings: a table that offered them would be offering a cap over nothing and
|
|
24
|
+
* a prefix nothing can start with.
|
|
18
25
|
*/
|
|
19
|
-
|
|
26
|
+
type PreviewKindName = "vmlShape" | "wpGroup" | "smartArt";
|
|
20
27
|
declare const PREVIEW_KINDS: {
|
|
21
28
|
/** A VML shape folio renders rather than projects (`v:shape`, `v:rect`, ...). */
|
|
22
29
|
readonly vmlShape: {
|
|
30
|
+
readonly backing: "source";
|
|
23
31
|
readonly mimeType: "image/svg+xml";
|
|
24
32
|
readonly filename: "vml-shape-preview.svg";
|
|
25
33
|
readonly srcPrefix: "data:image/svg+xml;charset=utf-8,";
|
|
26
34
|
readonly maxPackageCharacters: number;
|
|
27
35
|
};
|
|
28
36
|
/**
|
|
29
|
-
* A
|
|
37
|
+
* A WordprocessingGroup (`wpg:wgp`) folio renders rather than projects.
|
|
30
38
|
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
39
|
+
* The group's shapes, their text and any picture they carry are drawn into
|
|
40
|
+
* one SVG, so a package with many groups retains as much generated text as a
|
|
41
|
+
* package of VML shapes does, from a producer bounded per drawing the same
|
|
42
|
+
* way. It was missing from this table, which is not a preview with a generous
|
|
43
|
+
* cap but a preview with none: the matcher below never named it, so no
|
|
44
|
+
* package was ever charged for one.
|
|
45
|
+
*/
|
|
46
|
+
readonly wpGroup: {
|
|
47
|
+
readonly backing: "source";
|
|
48
|
+
readonly mimeType: "image/svg+xml";
|
|
49
|
+
readonly filename: "wordprocessing-group.svg";
|
|
50
|
+
readonly srcPrefix: "data:image/svg+xml;charset=utf-8,";
|
|
51
|
+
readonly maxPackageCharacters: number;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* A SmartArt diagram: its extent filled with one flat rectangle per shape.
|
|
37
55
|
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* it
|
|
43
|
-
*
|
|
44
|
-
* to
|
|
56
|
+
* It used to be a raster in `src`, because the display list decoded only
|
|
57
|
+
* base64 PNG and JPEG and a vector preview would have been missing from
|
|
58
|
+
* every backend but the DOM. That cost 7.3 MB of data URL per diagram
|
|
59
|
+
* whatever the package weighed, up to 51.3 MB in one corpus package, because
|
|
60
|
+
* it followed the extent the author chose rather than anything the drawing
|
|
61
|
+
* contained. It is a `PreviewDescriptor` now, which both backends draw, and
|
|
62
|
+
* the bound on it is the shape cap the parse applies to the description.
|
|
45
63
|
*/
|
|
46
64
|
readonly smartArt: {
|
|
47
|
-
readonly
|
|
48
|
-
readonly filename: "smartart-preview.png";
|
|
49
|
-
readonly srcPrefix: "data:image/png;base64,";
|
|
50
|
-
readonly maxPackageCharacters: number;
|
|
65
|
+
readonly backing: "descriptor";
|
|
51
66
|
};
|
|
52
67
|
};
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
68
|
+
/** The kinds a package charges: those whose preview is image data it retains. */
|
|
69
|
+
type SourceBackedKindName = { [Name in PreviewKindName]: (typeof PREVIEW_KINDS)[Name]["backing"] extends "source" ? Name : never; }[PreviewKindName];
|
|
70
|
+
/**
|
|
71
|
+
* Per-kind allowances for one package, defaulting to the table's caps.
|
|
72
|
+
*
|
|
73
|
+
* Only a source-backed kind has an allowance: there is no number that would
|
|
74
|
+
* change what the budget does to a descriptor.
|
|
75
|
+
*/
|
|
76
|
+
type PreviewBudgetOverrides = Partial<Record<SourceBackedKindName, number>>;
|
|
56
77
|
/**
|
|
57
78
|
* Charge every generated preview in the model against its kind's allowance and
|
|
58
79
|
* drop the `src` of those past it. Dropping leaves the image in place with its
|
|
@@ -61,4 +82,4 @@ type PreviewBudgetOverrides = Partial<Record<PreviewKindName, number>>;
|
|
|
61
82
|
*/
|
|
62
83
|
declare const enforcePackagePreviewBudget: (root: unknown, overrides?: PreviewBudgetOverrides) => void;
|
|
63
84
|
//#endregion
|
|
64
|
-
export { PREVIEW_KINDS, PreviewBudgetOverrides,
|
|
85
|
+
export { PREVIEW_KINDS, PreviewBudgetOverrides, enforcePackagePreviewBudget };
|