@stll/folio-core 0.45.0 → 0.47.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai-edits/apply.js +85 -43
- package/dist/ai-edits/headless.js +2 -2
- package/dist/ai-edits/read.d.ts +1 -0
- package/dist/ai-edits/read.js +1 -0
- package/dist/ai-edits/snapshot.js +32 -27
- package/dist/ai-edits/table-cell-mutations.js +15 -7
- package/dist/ai-edits/table-geometry.js +21 -18
- package/dist/ai-edits/table-template.js +2 -2
- package/dist/compare/compare.js +2 -5
- package/dist/compare/content-alignment.js +108 -12
- package/dist/compare/content-types.d.ts +8 -2
- package/dist/compare/content.js +2 -11
- package/dist/compare/plan.js +7 -4
- package/dist/compare/scenario.js +2 -5
- package/dist/compare/section-boundary-properties.js +1 -2
- package/dist/compare/types.d.ts +9 -1
- package/dist/compare/types.js +12 -1
- package/dist/compat/eigenpal.d.ts +2 -1
- package/dist/compat/eigenpal.js +2 -1
- package/dist/content-controls/checkboxDisplay.d.ts +17 -0
- package/dist/content-controls/checkboxDisplay.js +46 -0
- package/dist/content-controls/findContentControls.js +3 -1
- package/dist/content-controls/mutateContentControls.js +57 -43
- package/dist/controller/contentControlWidgetController.d.ts +1 -0
- package/dist/controller/contentControlWidgetController.js +3 -0
- package/dist/controller/hiddenEditorApi.js +3 -1
- package/dist/controller/hiddenEditorManager.d.ts +1 -1
- package/dist/controller/hiddenEditorManager.js +6 -3
- package/dist/controller/layoutPipeline.js +8 -3
- package/dist/display-list/build/buildDisplayList.js +20 -1
- package/dist/display-list/build/imagePrimitives.d.ts +4 -4
- package/dist/display-list/build/imagePrimitives.js +38 -18
- package/dist/display-list/build/pageBorderPrimitives.js +2 -1
- package/dist/display-list/build/paragraphPrimitives.js +113 -14
- package/dist/display-list/build/previewPrimitives.d.ts +10 -0
- package/dist/display-list/build/previewPrimitives.js +89 -0
- package/dist/display-list/build/strokes.d.ts +177 -8
- package/dist/display-list/build/strokes.js +167 -47
- package/dist/display-list/build/tablePrimitives.js +4 -2
- package/dist/display-list/build/textBoxPrimitives.js +6 -4
- package/dist/display-list/build/textDecorations.d.ts +15 -1
- package/dist/display-list/build/textDecorations.js +15 -1
- package/dist/display-list/dom/renderDisplayListToDom.js +11 -21
- package/dist/display-list/primitives.d.ts +13 -2
- package/dist/display-list/primitives.js +36 -1
- package/dist/display-list/types.d.ts +17 -0
- package/dist/document-operations.js +2 -1
- package/dist/docx/attributeRemainder.d.ts +76 -0
- package/dist/docx/attributeRemainder.js +111 -0
- package/dist/docx/blockContentParser.d.ts +3 -1
- package/dist/docx/blockContentParser.js +102 -106
- package/dist/docx/blockPlainText.d.ts +3 -4
- package/dist/docx/blockPlainText.js +3 -0
- package/dist/docx/borderParser.js +26 -11
- package/dist/docx/builtInStyles.d.ts +8 -16
- package/dist/docx/builtInStyles.js +54 -17
- package/dist/docx/commentAnchorIndex.d.ts +30 -0
- package/dist/docx/commentAnchorIndex.js +50 -0
- package/dist/docx/commentParser.d.ts +1 -1
- package/dist/docx/commentParser.js +56 -39
- package/dist/docx/commentRangeIntegrity.d.ts +16 -1
- package/dist/docx/commentRangeIntegrity.js +42 -1
- package/dist/docx/commentRangeJoin.d.ts +9 -0
- package/dist/docx/commentRangeJoin.js +33 -0
- package/dist/docx/commentReferenceCompletion.d.ts +9 -0
- package/dist/docx/commentReferenceCompletion.js +47 -0
- package/dist/docx/commentReferenceNormalization.js +3 -1
- package/dist/docx/commentReplyMarkers.js +11 -19
- package/dist/docx/compatibility.js +56 -41
- package/dist/docx/containerChildren.d.ts +208 -0
- package/dist/docx/containerChildren.gen.d.ts +43 -0
- package/dist/docx/containerChildren.gen.js +263 -0
- package/dist/docx/containerChildren.js +153 -0
- package/dist/docx/diagramPreview.d.ts +14 -2
- package/dist/docx/diagramPreview.js +81 -169
- package/dist/docx/documentParser.d.ts +1 -1
- package/dist/docx/documentParser.js +7 -4
- package/dist/docx/drawingAnchor.d.ts +87 -0
- package/dist/docx/drawingAnchor.js +201 -0
- package/dist/docx/drawingUtils.d.ts +43 -38
- package/dist/docx/drawingUtils.js +205 -118
- package/dist/docx/ensureParaIds.js +17 -7
- package/dist/docx/fieldParser.d.ts +1 -1
- package/dist/docx/fieldParser.js +4 -4
- package/dist/docx/fieldState.d.ts +26 -0
- package/dist/docx/fieldState.js +53 -0
- package/dist/docx/fontTableParser.js +102 -41
- package/dist/docx/footnoteParser.d.ts +1 -1
- package/dist/docx/footnoteParser.js +10 -6
- package/dist/docx/graphicFrameLocks.d.ts +16 -4
- package/dist/docx/graphicFrameLocks.js +19 -6
- package/dist/docx/groupDrawingParser.js +4 -3
- package/dist/docx/headerFooterParser.js +1 -1
- package/dist/docx/headerFooterReferenceNormalization.js +1 -0
- package/dist/docx/hyperlinkParser.d.ts +66 -9
- package/dist/docx/hyperlinkParser.js +153 -26
- package/dist/docx/imageParser.js +160 -115
- package/dist/docx/index.d.ts +2 -1
- package/dist/docx/index.js +2 -1
- package/dist/docx/inlineContentRemovals.d.ts +28 -0
- package/dist/docx/inlineContentRemovals.js +46 -0
- package/dist/docx/inlineWrapperContent.d.ts +166 -0
- package/dist/docx/inlineWrapperContent.js +165 -0
- package/dist/docx/inlineWrapperParser.d.ts +11 -0
- package/dist/docx/inlineWrapperParser.js +60 -0
- package/dist/docx/nonVisualDrawingProps.d.ts +5 -13
- package/dist/docx/normalizeBaseDirection.js +12 -1
- package/dist/docx/numberingParser.d.ts +25 -2
- package/dist/docx/numberingParser.js +264 -361
- package/dist/docx/numberingReference.d.ts +9 -16
- package/dist/docx/numberingReference.js +17 -16
- package/dist/docx/numberingReferenceNormalization.js +7 -7
- package/dist/docx/ooxmlCounterFormatter.d.ts +1 -1
- package/dist/docx/ooxmlCounterFormatter.js +4 -1
- package/dist/docx/paraIdAttribute.d.ts +111 -0
- package/dist/docx/paraIdAttribute.js +142 -0
- package/dist/docx/paragraphParser.d.ts +10 -25
- package/dist/docx/paragraphParser.js +421 -496
- package/dist/docx/paragraphProperties.d.ts +23 -0
- package/dist/docx/paragraphProperties.js +279 -0
- package/dist/docx/paragraphPropertySource.js +7 -1
- package/dist/docx/paragraphTextBoxEnrichment.d.ts +3 -2
- package/dist/docx/paragraphTextBoxEnrichment.js +20 -59
- package/dist/docx/paragraphTraversal.d.ts +14 -10
- package/dist/docx/paragraphTraversal.js +53 -52
- package/dist/docx/parseWarningMessage.js +5 -1
- package/dist/docx/parserEnums.d.ts +6 -8
- package/dist/docx/parserEnums.js +4 -6
- package/dist/docx/preservedRunContent.d.ts +32 -0
- package/dist/docx/preservedRunContent.js +96 -0
- package/dist/docx/previewBudget.d.ts +44 -23
- package/dist/docx/previewBudget.js +61 -30
- package/dist/docx/propertyElementAttributes.d.ts +178 -0
- package/dist/docx/propertyElementAttributes.js +114 -0
- package/dist/docx/renderedPageBreakNormalization.js +4 -6
- package/dist/docx/rezip.d.ts +28 -2
- package/dist/docx/rezip.js +152 -27
- package/dist/docx/runConsolidator.d.ts +42 -2
- package/dist/docx/runConsolidator.js +60 -6
- package/dist/docx/runParser.d.ts +55 -19
- package/dist/docx/runParser.js +394 -306
- package/dist/docx/runPayload.d.ts +5 -0
- package/dist/docx/runPayload.js +4 -0
- package/dist/docx/sdtProperties.d.ts +39 -5
- package/dist/docx/sdtProperties.js +205 -84
- package/dist/docx/sdtPropertiesPatch.d.ts +5 -9
- package/dist/docx/sdtPropertiesPatch.js +68 -112
- package/dist/docx/sectionParser.d.ts +1 -2
- package/dist/docx/sectionParser.js +241 -238
- package/dist/docx/selectiveSave.js +3 -2
- package/dist/docx/selectiveXmlPatch.d.ts +66 -3
- package/dist/docx/selectiveXmlPatch.js +276 -133
- package/dist/docx/serializer/blockSdtSerializer.js +2 -96
- package/dist/docx/serializer/borderSerializer.d.ts +5 -5
- package/dist/docx/serializer/borderSerializer.js +12 -10
- package/dist/docx/serializer/commentSerializer.js +5 -7
- package/dist/docx/serializer/documentSerializer.js +11 -11
- package/dist/docx/serializer/fontTableSerializer.js +31 -3
- package/dist/docx/serializer/headerFooterSerializer.js +10 -9
- package/dist/docx/serializer/markupRangeAttributes.d.ts +9 -1
- package/dist/docx/serializer/markupRangeAttributes.js +9 -1
- package/dist/docx/serializer/noteSerializer.js +11 -8
- package/dist/docx/serializer/numberingSerializer.d.ts +1 -6
- package/dist/docx/serializer/numberingSerializer.js +81 -79
- package/dist/docx/serializer/paragraphSerializer.d.ts +1 -9
- package/dist/docx/serializer/paragraphSerializer.js +156 -236
- package/dist/docx/serializer/runSerializer.d.ts +1 -5
- package/dist/docx/serializer/runSerializer.js +134 -75
- package/dist/docx/serializer/sdtPropertiesSerializer.d.ts +26 -0
- package/dist/docx/serializer/sdtPropertiesSerializer.js +111 -0
- package/dist/docx/serializer/sectionPropertiesSerializer.js +42 -49
- package/dist/docx/serializer/settingsSerializer.js +6 -4
- package/dist/docx/serializer/stylesSerializer.js +8 -11
- package/dist/docx/serializer/tableSerializer.js +283 -105
- package/dist/docx/serializer/textFormattingSerializer.d.ts +28 -4
- package/dist/docx/serializer/textFormattingSerializer.js +111 -101
- package/dist/docx/serializer/xmlUtils.d.ts +1 -1
- package/dist/docx/serializer/xmlUtils.js +1 -1
- package/dist/docx/server/createBilingualDocument.js +20 -16
- package/dist/docx/server/materializeYjsDocx.d.ts +1 -1
- package/dist/docx/server/materializeYjsDocx.js +9 -1
- package/dist/docx/server/migrateYjsAttrSchema.d.ts +55 -0
- package/dist/docx/server/migrateYjsAttrSchema.js +95 -0
- package/dist/docx/settingsParser.js +7 -4
- package/dist/docx/shadingParser.d.ts +2 -1
- package/dist/docx/shadingParser.js +43 -7
- package/dist/docx/shapeParser.js +13 -8
- package/dist/docx/strictNames.d.ts +11 -0
- package/dist/docx/strictNames.gen.d.ts +45 -0
- package/dist/docx/strictNames.gen.js +50 -0
- package/dist/docx/strictNames.js +43 -0
- package/dist/docx/strictValueEncodings.gen.js +133 -131
- package/dist/docx/styleParser.js +17 -349
- package/dist/docx/tableParser.d.ts +11 -2
- package/dist/docx/tableParser.js +665 -220
- package/dist/docx/textBoxParser.d.ts +28 -3
- package/dist/docx/textBoxParser.js +69 -9
- package/dist/docx/themeColorAttribute.d.ts +13 -0
- package/dist/docx/themeColorAttribute.js +24 -0
- package/dist/docx/trackedMoveRangeNormalization.js +2 -1
- package/dist/docx/unzip.js +5 -4
- package/dist/docx/vmlImageParser.d.ts +30 -5
- package/dist/docx/vmlImageParser.js +91 -32
- package/dist/docx/vmlPreview.js +2 -2
- package/dist/docx/wrapPolygon.d.ts +30 -0
- package/dist/docx/wrapPolygon.js +70 -0
- package/dist/docx/xmlEncoding.d.ts +5 -0
- package/dist/docx/xmlEncoding.js +12 -0
- package/dist/docx/xmlParser.d.ts +23 -1
- package/dist/docx/xmlParser.js +31 -2
- package/dist/fonts/embeddedFonts.js +3 -3
- package/dist/headless-layout.js +12 -1
- package/dist/i18n/messages/catalogs.gen.d.ts +68 -0
- package/dist/i18n/messages/catalogs.gen.js +102 -34
- package/dist/i18n/messages/messages.gen.d.ts +4 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/internal/headlessRevisionResolution.js +9 -0
- package/dist/internal/pageBreakRunSourceDescendantIndex.js +7 -2
- package/dist/internal/paragraphFormattingSerialization.d.ts +20 -9
- package/dist/internal/paragraphFormattingSerialization.js +118 -83
- package/dist/layout-bridge/convert/footnoteLayout.d.ts +1 -0
- package/dist/layout-bridge/convert/footnoteLayout.js +1 -0
- package/dist/layout-bridge/convert/headerFooterLayout.d.ts +1 -0
- package/dist/layout-bridge/convert/headerFooterLayout.js +2 -0
- package/dist/layout-bridge/convert/toFlowBlocks.d.ts +17 -12
- package/dist/layout-bridge/convert/toFlowBlocks.js +267 -101
- package/dist/layout-engine/index.d.ts +2 -2
- package/dist/layout-engine/index.js +53 -17
- package/dist/layout-engine/measure/measureBlocks.d.ts +3 -0
- package/dist/layout-engine/measure/measureBlocks.js +6 -10
- package/dist/layout-engine/measure/tableCellFloating.d.ts +2 -0
- package/dist/layout-engine/measure/tableCellFloating.js +2 -0
- package/dist/layout-engine/measure/tableCellGrid.js +2 -1
- package/dist/layout-engine/measure/tableFragmentBorderGeometry.js +2 -1
- package/dist/layout-engine/measure/tableInlinePlacement.js +2 -5
- package/dist/layout-engine/paragraphSequence.js +3 -2
- package/dist/layout-engine/renderedBreakReconciliation.js +2 -1
- package/dist/layout-engine/section-breaks.d.ts +49 -2
- package/dist/layout-engine/section-breaks.js +55 -4
- package/dist/layout-engine/types.d.ts +69 -17
- package/dist/layout-engine/types.js +16 -1
- package/dist/layout-painter/borderStroke.d.ts +18 -4
- package/dist/layout-painter/renderImage.d.ts +5 -1
- package/dist/layout-painter/renderImage.js +10 -3
- package/dist/layout-painter/renderPage.d.ts +2 -0
- package/dist/layout-painter/renderPage.js +10 -4
- package/dist/layout-painter/renderParagraph.d.ts +14 -1
- package/dist/layout-painter/renderParagraph.js +34 -28
- package/dist/layout-painter/renderTable.d.ts +4 -1
- package/dist/layout-painter/renderTable.js +22 -22
- package/dist/layout-painter/renderTextBox.js +5 -3
- package/dist/managers/autoSaveCodec.d.ts +9 -1
- package/dist/managers/autoSaveCodec.js +12 -4
- package/dist/markdown/renderBlock.js +3 -0
- package/dist/markdown/renderRuns.d.ts +1 -1
- package/dist/markdown/renderRuns.js +34 -6
- package/dist/markdown/renderTable.js +24 -6
- package/dist/markdown/trailers.js +4 -1
- package/dist/model.d.ts +3 -3
- package/dist/model.js +2 -2
- package/dist/paged-layout/sectionBlockWidths.d.ts +3 -0
- package/dist/paged-layout/sectionBlockWidths.js +26 -4
- package/dist/pdf/images.js +142 -6
- package/dist/prosemirror/attrs/index.d.ts +34 -5
- package/dist/prosemirror/attrs/index.js +639 -48
- package/dist/prosemirror/authoredTransformAttrs.d.ts +28 -0
- package/dist/prosemirror/authoredTransformAttrs.js +64 -0
- package/dist/prosemirror/bookmarkBoundaryAttrs.d.ts +9 -1
- package/dist/prosemirror/bookmarkBoundaryAttrs.js +22 -3
- package/dist/prosemirror/commands/comments.js +68 -53
- package/dist/prosemirror/commands/contentControls.js +33 -20
- package/dist/prosemirror/commands/image.d.ts +10 -3
- package/dist/prosemirror/commands/image.js +46 -29
- package/dist/prosemirror/commands/pageBreak.js +1 -1
- package/dist/prosemirror/commands/paragraph.d.ts +2 -1
- package/dist/prosemirror/commands/propertyChangeScope.d.ts +12 -4
- package/dist/prosemirror/commands/propertyChangeScope.js +22 -4
- package/dist/prosemirror/commands/sectionBreak.d.ts +33 -1
- package/dist/prosemirror/commands/sectionBreak.js +187 -11
- package/dist/prosemirror/commentReferenceAttrs.d.ts +8 -0
- package/dist/prosemirror/commentReferenceAttrs.js +33 -0
- package/dist/prosemirror/commentReferenceIntegrity.d.ts +47 -0
- package/dist/prosemirror/commentReferenceIntegrity.js +43 -0
- package/dist/prosemirror/conversion/fromProseDoc.d.ts +17 -12
- package/dist/prosemirror/conversion/fromProseDoc.js +553 -207
- package/dist/prosemirror/conversion/index.d.ts +2 -2
- package/dist/prosemirror/conversion/preservedSinkCarriers.d.ts +39 -0
- package/dist/prosemirror/conversion/preservedSinkCarriers.js +19 -0
- package/dist/prosemirror/conversion/runShadingMark.js +14 -1
- package/dist/prosemirror/conversion/sdtAttrs.d.ts +10 -1
- package/dist/prosemirror/conversion/sdtAttrs.js +19 -5
- package/dist/prosemirror/conversion/toProseDoc.d.ts +7 -9
- package/dist/prosemirror/conversion/toProseDoc.js +801 -411
- package/dist/prosemirror/emptyRangeAnchor.d.ts +53 -0
- package/dist/prosemirror/emptyRangeAnchor.js +158 -0
- package/dist/prosemirror/extensions/StarterKit.js +14 -58
- package/dist/prosemirror/extensions/core/DocExtension.js +1 -1
- package/dist/prosemirror/extensions/core/ParagraphExtension.js +21 -16
- package/dist/prosemirror/extensions/features/BaseKeymapExtension.js +48 -29
- package/dist/prosemirror/extensions/features/EmptyParagraphFormatExtension.js +3 -1
- package/dist/prosemirror/extensions/features/ImagePasteExtension.js +5 -3
- package/dist/prosemirror/extensions/features/ListExtension.js +43 -24
- package/dist/prosemirror/extensions/features/ParaIdAllocatorExtension.js +1 -0
- package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.js +4 -3
- package/dist/prosemirror/extensions/features/PasteCleanupExtension.d.ts +3 -3
- package/dist/prosemirror/extensions/features/PasteCleanupExtension.js +5 -5
- package/dist/prosemirror/extensions/features/pasteCleanup.d.ts +3 -1
- package/dist/prosemirror/extensions/features/pasteCleanup.js +56 -2
- package/dist/prosemirror/extensions/features/pastedHeadingStyles.js +5 -4
- package/dist/prosemirror/extensions/markRegistry.d.ts +65 -0
- package/dist/prosemirror/extensions/markRegistry.js +138 -0
- package/dist/prosemirror/extensions/marks/InlineWrapperExtension.d.ts +18 -0
- package/dist/prosemirror/extensions/marks/InlineWrapperExtension.js +77 -0
- package/dist/prosemirror/extensions/marks/RunIdentityExtension.d.ts +26 -0
- package/dist/prosemirror/extensions/marks/RunIdentityExtension.js +134 -0
- package/dist/prosemirror/extensions/marks/TrackedChangeExtensions.js +2 -1
- package/dist/prosemirror/extensions/marks/UnderlineExtension.js +12 -18
- package/dist/prosemirror/extensions/marks/markUtils.d.ts +2 -1
- package/dist/prosemirror/extensions/marks/markUtils.js +49 -5
- package/dist/prosemirror/extensions/nodes/BlockBookmarkBoundaryExtension.d.ts +29 -0
- package/dist/prosemirror/extensions/nodes/BlockBookmarkBoundaryExtension.js +46 -0
- package/dist/prosemirror/extensions/nodes/BlockSdtExtension.d.ts +4 -3
- package/dist/prosemirror/extensions/nodes/BlockSdtExtension.js +18 -13
- package/dist/prosemirror/extensions/nodes/BookmarkBoundaryExtension.js +28 -53
- package/dist/prosemirror/extensions/nodes/CommentReferenceExtension.d.ts +11 -0
- package/dist/prosemirror/extensions/nodes/CommentReferenceExtension.js +97 -0
- package/dist/prosemirror/extensions/nodes/FieldExtension.js +9 -7
- package/dist/prosemirror/extensions/nodes/ImageExtension.js +24 -1
- package/dist/prosemirror/extensions/nodes/MoveRangeBoundaryExtension.d.ts +11 -0
- package/dist/prosemirror/extensions/nodes/MoveRangeBoundaryExtension.js +43 -0
- package/dist/prosemirror/extensions/nodes/PreservedBlockExtension.d.ts +32 -0
- package/dist/prosemirror/extensions/nodes/PreservedBlockExtension.js +67 -0
- package/dist/prosemirror/extensions/nodes/PreservedXmlExtension.d.ts +16 -0
- package/dist/prosemirror/extensions/nodes/PreservedXmlExtension.js +60 -0
- package/dist/prosemirror/extensions/nodes/RangeAnchorExtension.d.ts +13 -0
- package/dist/prosemirror/extensions/nodes/RangeAnchorExtension.js +65 -0
- package/dist/prosemirror/extensions/nodes/SdtExtension.d.ts +3 -1
- package/dist/prosemirror/extensions/nodes/SdtExtension.js +22 -16
- package/dist/prosemirror/extensions/nodes/ShapeExtension.js +7 -0
- package/dist/prosemirror/extensions/nodes/TableExtension.js +142 -123
- package/dist/prosemirror/extensions/nodes/TextBoxExtension.js +9 -1
- package/dist/prosemirror/extensions/nodes/bookmarkBoundaryDom.d.ts +23 -0
- package/dist/prosemirror/extensions/nodes/bookmarkBoundaryDom.js +57 -0
- package/dist/prosemirror/extensions/types.d.ts +12 -3
- package/dist/prosemirror/index.d.ts +4 -2
- package/dist/prosemirror/index.js +2 -1
- package/dist/prosemirror/inlineWrapperStack.d.ts +39 -0
- package/dist/prosemirror/inlineWrapperStack.js +92 -0
- package/dist/prosemirror/listMarker.d.ts +2 -2
- package/dist/prosemirror/listMarker.js +7 -8
- package/dist/prosemirror/listRenderingAttrs.js +11 -1
- package/dist/prosemirror/listState.d.ts +62 -0
- package/dist/prosemirror/listState.js +49 -0
- package/dist/prosemirror/moveRangeBoundaryAttrs.d.ts +13 -0
- package/dist/prosemirror/moveRangeBoundaryAttrs.js +114 -0
- package/dist/prosemirror/numberedRefFields.js +4 -4
- package/dist/prosemirror/numberingAttr.d.ts +55 -0
- package/dist/prosemirror/numberingAttr.js +74 -0
- package/dist/prosemirror/outlineLevelAttr.d.ts +29 -0
- package/dist/prosemirror/outlineLevelAttr.js +42 -0
- package/dist/prosemirror/pageBreakRunProjection.d.ts +17 -7
- package/dist/prosemirror/pageBreakRunProjection.js +19 -9
- package/dist/prosemirror/paragraphFormattingProvenance.d.ts +9 -0
- package/dist/prosemirror/paragraphFormattingProvenance.js +4 -1
- package/dist/prosemirror/plugins/selectionTracker.d.ts +3 -6
- package/dist/prosemirror/plugins/selectionTracker.js +3 -10
- package/dist/prosemirror/rangeAnchorAttrs.d.ts +14 -0
- package/dist/prosemirror/rangeAnchorAttrs.js +101 -0
- package/dist/prosemirror/replacedAnnotations.d.ts +59 -0
- package/dist/prosemirror/replacedAnnotations.js +183 -0
- package/dist/prosemirror/revisionCarriers.d.ts +86 -2
- package/dist/prosemirror/revisionCarriers.js +86 -60
- package/dist/prosemirror/runFormattingInlineCarriers.d.ts +5 -1
- package/dist/prosemirror/runFormattingInlineCarriers.js +7 -1
- package/dist/prosemirror/runIdentity.d.ts +28 -0
- package/dist/prosemirror/runIdentity.js +36 -0
- package/dist/prosemirror/runStyleFormatting.js +1 -1
- package/dist/prosemirror/schema/index.d.ts +3 -3
- package/dist/prosemirror/schema/marks.d.ts +47 -4
- package/dist/prosemirror/schema/nodes.d.ts +309 -26
- package/dist/prosemirror/schema/nodes.js +16 -1
- package/dist/prosemirror/sectionCarrier.d.ts +37 -0
- package/dist/prosemirror/sectionCarrier.js +40 -0
- package/dist/prosemirror/selectionState.d.ts +3 -0
- package/dist/prosemirror/selectionState.js +4 -1
- package/dist/prosemirror/styles/resolvedStyleAttrs.d.ts +5 -4
- package/dist/prosemirror/styles/resolvedStyleAttrs.js +15 -13
- package/dist/prosemirror/tableResize.js +5 -6
- package/dist/prosemirror/trackedRunInlineAtoms.d.ts +4 -0
- package/dist/prosemirror/trackedRunInlineAtoms.js +4 -0
- package/dist/prosemirror/utils/extractTrackedChanges.d.ts +10 -11
- package/dist/prosemirror/utils/extractTrackedChanges.js +109 -92
- package/dist/prosemirror/validation.js +31 -6
- package/dist/prosemirror/yjsDocumentMetadata.d.ts +73 -0
- package/dist/prosemirror/yjsDocumentMetadata.js +592 -0
- package/dist/prosemirror/zeroWidthAnchors.js +6 -0
- package/dist/render-dom/commentAnchorAttributes.d.ts +37 -0
- package/dist/render-dom/commentAnchorAttributes.js +54 -0
- package/dist/server.d.ts +3 -1
- package/dist/server.js +3 -1
- package/dist/style-sets/extract.js +4 -4
- package/dist/style-sets/stellaStyle.js +36 -23
- package/dist/types/colors.d.ts +2 -2
- package/dist/types/content.d.ts +2 -2
- package/dist/types/documentEnumValues.d.ts +53 -26
- package/dist/types/documentEnumValues.js +72 -174
- package/dist/types/formatting.d.ts +2 -2
- package/dist/types/index.d.ts +9 -2
- package/dist/utils/borderCss.d.ts +246 -0
- package/dist/utils/borderCss.js +325 -0
- package/dist/utils/clipboard.d.ts +9 -1
- package/dist/utils/clipboard.js +27 -1
- package/dist/utils/colorResolver.d.ts +4 -3
- package/dist/utils/colorResolver.js +45 -76
- package/dist/utils/createDocument.js +24 -6
- package/dist/utils/findReplace.js +52 -10
- package/dist/utils/formatToStyle.d.ts +84 -2
- package/dist/utils/formatToStyle.js +133 -52
- package/dist/utils/headingCollector.js +3 -2
- package/dist/utils/imageLuminance.d.ts +15 -0
- package/dist/utils/imageLuminance.js +32 -0
- package/dist/utils/mergeDocumentContent.js +12 -20
- package/dist/utils/paragraphFormattingMerge.js +27 -6
- package/dist/utils/replaceText.js +1 -0
- package/dist/utils/tableOperations.d.ts +5 -3
- package/dist/utils/tableOperations.js +14 -1
- package/dist/utils/tablePlacement.d.ts +7 -0
- package/dist/utils/tablePlacement.js +14 -0
- package/dist/utils/textDirectionFlow.d.ts +15 -0
- package/dist/utils/textDirectionFlow.js +38 -0
- package/dist/utils/textFormattingMerge.js +16 -4
- package/package.json +10 -10
- package/dist/ai-edits/__fixtures__/paragraphs.d.ts +0 -17
- package/dist/ai-edits/__fixtures__/paragraphs.js +0 -33
- package/dist/compare/__fixtures__/body-sequence.d.ts +0 -119
- package/dist/compare/__fixtures__/body-sequence.js +0 -225
- package/dist/compare/__fixtures__/nested-table.d.ts +0 -16
- package/dist/compare/__fixtures__/nested-table.js +0 -50
- package/dist/compare/__fixtures__/numbered-list.d.ts +0 -34
- package/dist/compare/__fixtures__/numbered-list.js +0 -85
- package/dist/docx/blockRangeMarkers.d.ts +0 -36
- package/dist/docx/blockRangeMarkers.js +0 -59
- package/dist/docx/bookmarkPlacement.d.ts +0 -9
- package/dist/docx/bookmarkPlacement.js +0 -50
- package/dist/fonts/embeddedFontTable.d.ts +0 -45
- package/dist/fonts/embeddedFontTable.js +0 -80
- package/dist/prosemirror/extensions/marks/PageBreakRunOwnerExtension.d.ts +0 -13
- package/dist/prosemirror/extensions/marks/PageBreakRunOwnerExtension.js +0 -39
- package/dist/prosemirror/yjsParagraphSourceContract.d.ts +0 -9
- package/dist/prosemirror/yjsParagraphSourceContract.js +0 -26
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import JSZip from "jszip";
|
|
2
|
-
//#region src/compare/__fixtures__/nested-table.ts
|
|
3
|
-
/**
|
|
4
|
-
* A document that ends with a table whose last cell holds another table.
|
|
5
|
-
*
|
|
6
|
-
* The shape matters because the story's last block is then two levels deep,
|
|
7
|
-
* and a paragraph appended after the whole table has no block to anchor to
|
|
8
|
-
* that is not inside a cell. Authored here rather than committed as bytes so
|
|
9
|
-
* the structure under test is legible in the diff.
|
|
10
|
-
*/
|
|
11
|
-
const NAMESPACE = "http://schemas.openxmlformats.org/wordprocessingml/2006/main";
|
|
12
|
-
const RELATIONSHIPS = "http://schemas.openxmlformats.org/package/2006/relationships";
|
|
13
|
-
const OFFICE_RELATIONSHIPS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
|
|
14
|
-
const WORDPROCESSING = "application/vnd.openxmlformats-officedocument.wordprocessingml";
|
|
15
|
-
/**
|
|
16
|
-
* `createFolders: false` because JSZip stamps the folder entries it
|
|
17
|
-
* synthesizes with `new Date()`, which the fixed date above does not reach.
|
|
18
|
-
*/
|
|
19
|
-
const ZIP_ENTRY_OPTIONS = {
|
|
20
|
-
date: new Date(Date.UTC(2e3, 0, 1)),
|
|
21
|
-
createFolders: false
|
|
22
|
-
};
|
|
23
|
-
const paragraph = (text) => text.length === 0 ? `<w:p/>` : `<w:p><w:r><w:t xml:space="preserve">${text}</w:t></w:r></w:p>`;
|
|
24
|
-
/**
|
|
25
|
-
* A table may not be the last child of a body or a cell, so every container
|
|
26
|
-
* that ends with one is closed by a paragraph. Word writes that paragraph and
|
|
27
|
-
* usually leaves it empty; a fixture that omits it is malformed, and the
|
|
28
|
-
* comparison should be exercised against the shape real packages have.
|
|
29
|
-
*/
|
|
30
|
-
const closingParagraph = paragraph("");
|
|
31
|
-
const cell = (inner) => `<w:tc><w:tcPr><w:tcW w:w="4680" w:type="dxa"/></w:tcPr>${inner}</w:tc>`;
|
|
32
|
-
const table = (rows) => `<w:tbl><w:tblPr><w:tblW w:w="0" w:type="auto"/></w:tblPr><w:tblGrid><w:gridCol w:w="4680"/><w:gridCol w:w="4680"/></w:tblGrid>${rows.join("")}</w:tbl>`;
|
|
33
|
-
/** The nested table sits in the outer table's last cell, deep in the story. */
|
|
34
|
-
const NESTED_TABLE = table([`<w:tr>${cell(`${paragraph("The nested schedule lists the delivery dates.")}${closingParagraph}`)}</w:tr>`]);
|
|
35
|
-
const OUTER_TABLE = table([`<w:tr>${cell(paragraph("Obligations of the supplier."))}${cell(paragraph("Obligations of the buyer."))}</w:tr>`, `<w:tr>${cell(paragraph("Deliver the goods to the named place."))}${cell(`${paragraph("See the schedule below.")}${NESTED_TABLE}${closingParagraph}`)}</w:tr>`]);
|
|
36
|
-
const buildNestedTableDocx = async ({ trailingParagraph } = {}) => {
|
|
37
|
-
const body = paragraph("This agreement is made between the parties named below.") + OUTER_TABLE + (trailingParagraph === void 0 ? closingParagraph : `${paragraph(trailingParagraph)}${closingParagraph}`);
|
|
38
|
-
const parts = {
|
|
39
|
-
"[Content_Types].xml": `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/><Override PartName="/word/document.xml" ContentType="${WORDPROCESSING}.document.main+xml"/><Override PartName="/word/styles.xml" ContentType="${WORDPROCESSING}.styles+xml"/></Types>`,
|
|
40
|
-
"_rels/.rels": `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="${RELATIONSHIPS}"><Relationship Id="rId1" Type="${OFFICE_RELATIONSHIPS}/officeDocument" Target="word/document.xml"/></Relationships>`,
|
|
41
|
-
"word/_rels/document.xml.rels": `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="${RELATIONSHIPS}"><Relationship Id="rId1" Type="${OFFICE_RELATIONSHIPS}/styles" Target="styles.xml"/></Relationships>`,
|
|
42
|
-
"word/styles.xml": `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:styles xmlns:w="${NAMESPACE}"><w:style w:type="paragraph" w:default="1" w:styleId="Normal"><w:name w:val="Normal"/></w:style></w:styles>`,
|
|
43
|
-
"word/document.xml": `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:document xmlns:w="${NAMESPACE}"><w:body>${body}<w:sectPr><w:pgSz w:w="12240" w:h="15840"/><w:pgMar w:top="1440" w:right="1440" w:bottom="1440" w:left="1440"/></w:sectPr></w:body></w:document>`
|
|
44
|
-
};
|
|
45
|
-
const zip = new JSZip();
|
|
46
|
-
for (const name of Object.keys(parts).toSorted()) zip.file(name, parts[name] ?? "", ZIP_ENTRY_OPTIONS);
|
|
47
|
-
return await zip.generateAsync({ type: "arraybuffer" });
|
|
48
|
-
};
|
|
49
|
-
//#endregion
|
|
50
|
-
export { buildNestedTableDocx };
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
//#region src/compare/__fixtures__/numbered-list.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* A small multi-level numbered list, authored here rather than committed as
|
|
4
|
-
* bytes.
|
|
5
|
-
*
|
|
6
|
-
* The corpus fixtures carry no numbering at all, so a probe that says "an added
|
|
7
|
-
* list item" while editing an unnumbered paragraph is testing something else
|
|
8
|
-
* and saying it is testing numbering. Generating the package keeps its content
|
|
9
|
-
* legible in the diff and keeps the provenance trivial.
|
|
10
|
-
*/
|
|
11
|
-
/**
|
|
12
|
-
* One item: its indent level and its text. `null` is a paragraph that keeps
|
|
13
|
-
* the list style and carries no numbering.
|
|
14
|
-
*/
|
|
15
|
-
type NumberedListItem = {
|
|
16
|
-
level: number | null;
|
|
17
|
-
text: string;
|
|
18
|
-
};
|
|
19
|
-
declare const NUMBERED_LIST_ITEMS: readonly NumberedListItem[];
|
|
20
|
-
/** The same list with one item demoted one level: a level change and no text change. */
|
|
21
|
-
declare const withItemDemoted: (items: readonly NumberedListItem[], index: number) => NumberedListItem[];
|
|
22
|
-
/**
|
|
23
|
-
* The same list with one item no longer numbered: the paragraph keeps every
|
|
24
|
-
* word and stops being a list item, which is the edit a level change cannot
|
|
25
|
-
* express.
|
|
26
|
-
*/
|
|
27
|
-
declare const withItemUnnumbered: (items: readonly NumberedListItem[], index: number) => NumberedListItem[];
|
|
28
|
-
type NumberedListDocxOptions = {
|
|
29
|
-
/** `w:numFmt` for the top level. Default `"decimal"`. */
|
|
30
|
-
format?: string;
|
|
31
|
-
};
|
|
32
|
-
declare const buildNumberedListDocx: (items?: readonly NumberedListItem[], { format }?: NumberedListDocxOptions) => Promise<ArrayBuffer>;
|
|
33
|
-
//#endregion
|
|
34
|
-
export { NUMBERED_LIST_ITEMS, NumberedListDocxOptions, NumberedListItem, buildNumberedListDocx, withItemDemoted, withItemUnnumbered };
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import JSZip from "jszip";
|
|
2
|
-
//#region src/compare/__fixtures__/numbered-list.ts
|
|
3
|
-
/**
|
|
4
|
-
* A small multi-level numbered list, authored here rather than committed as
|
|
5
|
-
* bytes.
|
|
6
|
-
*
|
|
7
|
-
* The corpus fixtures carry no numbering at all, so a probe that says "an added
|
|
8
|
-
* list item" while editing an unnumbered paragraph is testing something else
|
|
9
|
-
* and saying it is testing numbering. Generating the package keeps its content
|
|
10
|
-
* legible in the diff and keeps the provenance trivial.
|
|
11
|
-
*/
|
|
12
|
-
const NAMESPACE = "http://schemas.openxmlformats.org/wordprocessingml/2006/main";
|
|
13
|
-
const RELATIONSHIPS = "http://schemas.openxmlformats.org/package/2006/relationships";
|
|
14
|
-
const OFFICE_RELATIONSHIPS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
|
|
15
|
-
const WORDPROCESSING = "application/vnd.openxmlformats-officedocument.wordprocessingml";
|
|
16
|
-
/**
|
|
17
|
-
* `createFolders: false` because JSZip stamps the folder entries it
|
|
18
|
-
* synthesizes with `new Date()`, which the fixed date above does not reach.
|
|
19
|
-
*/
|
|
20
|
-
const ZIP_ENTRY_OPTIONS = {
|
|
21
|
-
date: new Date(Date.UTC(2e3, 0, 1)),
|
|
22
|
-
createFolders: false
|
|
23
|
-
};
|
|
24
|
-
const LIST_LEVELS = 3;
|
|
25
|
-
const abstractLevels = (topLevelFormat) => Array.from({ length: LIST_LEVELS }, (_unused, level) => {
|
|
26
|
-
return `<w:lvl w:ilvl="${String(level)}"><w:start w:val="1"/><w:numFmt w:val="${level === 0 ? topLevelFormat : "lowerLetter"}"/><w:lvlText w:val="%${String(level + 1)}."/><w:lvlJc w:val="left"/></w:lvl>`;
|
|
27
|
-
}).join("");
|
|
28
|
-
const listParagraph = (level, text) => {
|
|
29
|
-
return `<w:p><w:pPr><w:pStyle w:val="ListParagraph"/>${level === null ? "" : `<w:numPr><w:ilvl w:val="${String(level)}"/><w:numId w:val="1"/></w:numPr>`}</w:pPr><w:r><w:t xml:space="preserve">${text}</w:t></w:r></w:p>`;
|
|
30
|
-
};
|
|
31
|
-
const NUMBERED_LIST_ITEMS = Object.freeze([
|
|
32
|
-
{
|
|
33
|
-
level: 0,
|
|
34
|
-
text: "The supplier shall deliver the goods to the named place."
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
level: 1,
|
|
38
|
-
text: "Delivery is complete on unloading at that place."
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
level: 1,
|
|
42
|
-
text: "Risk passes to the buyer on completion of delivery."
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
level: 0,
|
|
46
|
-
text: "The buyer shall pay within thirty days of the invoice date."
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
level: 1,
|
|
50
|
-
text: "Late payment carries interest at the statutory rate."
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
level: 0,
|
|
54
|
-
text: "Either party may terminate for material breach."
|
|
55
|
-
}
|
|
56
|
-
]);
|
|
57
|
-
/** The same list with one item demoted one level: a level change and no text change. */
|
|
58
|
-
const withItemDemoted = (items, index) => items.map((item, at) => at === index ? {
|
|
59
|
-
level: Math.min(LIST_LEVELS - 1, (item.level ?? 0) + 1),
|
|
60
|
-
text: item.text
|
|
61
|
-
} : item);
|
|
62
|
-
/**
|
|
63
|
-
* The same list with one item no longer numbered: the paragraph keeps every
|
|
64
|
-
* word and stops being a list item, which is the edit a level change cannot
|
|
65
|
-
* express.
|
|
66
|
-
*/
|
|
67
|
-
const withItemUnnumbered = (items, index) => items.map((item, at) => at === index ? {
|
|
68
|
-
level: null,
|
|
69
|
-
text: item.text
|
|
70
|
-
} : item);
|
|
71
|
-
const buildNumberedListDocx = async (items = NUMBERED_LIST_ITEMS, { format = "decimal" } = {}) => {
|
|
72
|
-
const parts = {
|
|
73
|
-
"[Content_Types].xml": `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/><Override PartName="/word/document.xml" ContentType="${WORDPROCESSING}.document.main+xml"/><Override PartName="/word/styles.xml" ContentType="${WORDPROCESSING}.styles+xml"/><Override PartName="/word/numbering.xml" ContentType="${WORDPROCESSING}.numbering+xml"/></Types>`,
|
|
74
|
-
"_rels/.rels": `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="${RELATIONSHIPS}"><Relationship Id="rId1" Type="${OFFICE_RELATIONSHIPS}/officeDocument" Target="word/document.xml"/></Relationships>`,
|
|
75
|
-
"word/_rels/document.xml.rels": `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="${RELATIONSHIPS}"><Relationship Id="rId1" Type="${OFFICE_RELATIONSHIPS}/styles" Target="styles.xml"/><Relationship Id="rId2" Type="${OFFICE_RELATIONSHIPS}/numbering" Target="numbering.xml"/></Relationships>`,
|
|
76
|
-
"word/styles.xml": `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:styles xmlns:w="${NAMESPACE}"><w:style w:type="paragraph" w:default="1" w:styleId="Normal"><w:name w:val="Normal"/></w:style><w:style w:type="paragraph" w:styleId="ListParagraph"><w:name w:val="List Paragraph"/></w:style></w:styles>`,
|
|
77
|
-
"word/numbering.xml": `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:numbering xmlns:w="${NAMESPACE}"><w:abstractNum w:abstractNumId="0">${abstractLevels(format)}</w:abstractNum><w:num w:numId="1"><w:abstractNumId w:val="0"/></w:num></w:numbering>`,
|
|
78
|
-
"word/document.xml": `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:document xmlns:w="${NAMESPACE}"><w:body>` + items.map(({ level, text }) => listParagraph(level, text)).join("") + "<w:sectPr><w:pgSz w:w=\"12240\" w:h=\"15840\"/><w:pgMar w:top=\"1440\" w:right=\"1440\" w:bottom=\"1440\" w:left=\"1440\"/></w:sectPr></w:body></w:document>"
|
|
79
|
-
};
|
|
80
|
-
const zip = new JSZip();
|
|
81
|
-
for (const name of Object.keys(parts).toSorted()) zip.file(name, parts[name] ?? "", ZIP_ENTRY_OPTIONS);
|
|
82
|
-
return await zip.generateAsync({ type: "arraybuffer" });
|
|
83
|
-
};
|
|
84
|
-
//#endregion
|
|
85
|
-
export { NUMBERED_LIST_ITEMS, buildNumberedListDocx, withItemDemoted, withItemUnnumbered };
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
//#region src/docx/blockRangeMarkers.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* Range markers that stand between two blocks.
|
|
4
|
-
*
|
|
5
|
-
* `w:body`, `w:tc`, a header and an SDT's content all admit
|
|
6
|
-
* `EG_RunLevelElts` and `EG_RangeMarkupElements` beside their paragraphs, and
|
|
7
|
-
* every block container dropped them: a `w:permStart` between two paragraphs
|
|
8
|
-
* is the whole of a document-protection range, so losing it removes the
|
|
9
|
-
* protection from the saved file without a word. folio models none of these,
|
|
10
|
-
* and their position is their meaning, so they are captured verbatim and
|
|
11
|
-
* replayed where they stood — the same treatment `w:sdt`'s sibling markers
|
|
12
|
-
* already get (MS-OE376 §2.5.2.30).
|
|
13
|
-
*
|
|
14
|
-
* Bookmarks are absent from the set on purpose: they are modelled, and the
|
|
15
|
-
* block containers already relocate them into the neighbouring paragraph.
|
|
16
|
-
*/
|
|
17
|
-
declare const isBlockRangeMarker: (localName: string) => boolean;
|
|
18
|
-
/** Hand the markers collected so far to the block they stood before. */
|
|
19
|
-
declare const attachPendingRangeMarkers: (block: {
|
|
20
|
-
rawMarkersBefore?: string;
|
|
21
|
-
}, pending: string[]) => void;
|
|
22
|
-
/**
|
|
23
|
-
* Markers after the last block ride on it, since there is no block after them.
|
|
24
|
-
* With no block at all they are dropped: a container holding markers and no
|
|
25
|
-
* content has nothing for them to delimit.
|
|
26
|
-
*/
|
|
27
|
-
declare const attachTrailingRangeMarkers: (blocks: readonly {
|
|
28
|
-
rawMarkersAfter?: string;
|
|
29
|
-
}[], pending: string[]) => void;
|
|
30
|
-
/** Wrap a serialized block in the markup that stood around it. */
|
|
31
|
-
declare const withBlockRangeMarkers: (block: {
|
|
32
|
-
rawMarkersBefore?: string;
|
|
33
|
-
rawMarkersAfter?: string;
|
|
34
|
-
}, xml: string) => string;
|
|
35
|
-
//#endregion
|
|
36
|
-
export { attachPendingRangeMarkers, attachTrailingRangeMarkers, isBlockRangeMarker, withBlockRangeMarkers };
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
//#region src/docx/blockRangeMarkers.ts
|
|
2
|
-
/**
|
|
3
|
-
* Range markers that stand between two blocks.
|
|
4
|
-
*
|
|
5
|
-
* `w:body`, `w:tc`, a header and an SDT's content all admit
|
|
6
|
-
* `EG_RunLevelElts` and `EG_RangeMarkupElements` beside their paragraphs, and
|
|
7
|
-
* every block container dropped them: a `w:permStart` between two paragraphs
|
|
8
|
-
* is the whole of a document-protection range, so losing it removes the
|
|
9
|
-
* protection from the saved file without a word. folio models none of these,
|
|
10
|
-
* and their position is their meaning, so they are captured verbatim and
|
|
11
|
-
* replayed where they stood — the same treatment `w:sdt`'s sibling markers
|
|
12
|
-
* already get (MS-OE376 §2.5.2.30).
|
|
13
|
-
*
|
|
14
|
-
* Bookmarks are absent from the set on purpose: they are modelled, and the
|
|
15
|
-
* block containers already relocate them into the neighbouring paragraph.
|
|
16
|
-
*/
|
|
17
|
-
const BLOCK_RANGE_MARKER_NAMES = /* @__PURE__ */ new Set([
|
|
18
|
-
"commentRangeEnd",
|
|
19
|
-
"commentRangeStart",
|
|
20
|
-
"customXmlDelRangeEnd",
|
|
21
|
-
"customXmlDelRangeStart",
|
|
22
|
-
"customXmlInsRangeEnd",
|
|
23
|
-
"customXmlInsRangeStart",
|
|
24
|
-
"customXmlMoveFromRangeEnd",
|
|
25
|
-
"customXmlMoveFromRangeStart",
|
|
26
|
-
"customXmlMoveToRangeEnd",
|
|
27
|
-
"customXmlMoveToRangeStart",
|
|
28
|
-
"moveFromRangeEnd",
|
|
29
|
-
"moveFromRangeStart",
|
|
30
|
-
"moveToRangeEnd",
|
|
31
|
-
"moveToRangeStart",
|
|
32
|
-
"permEnd",
|
|
33
|
-
"permStart"
|
|
34
|
-
]);
|
|
35
|
-
const isBlockRangeMarker = (localName) => BLOCK_RANGE_MARKER_NAMES.has(localName);
|
|
36
|
-
/** Hand the markers collected so far to the block they stood before. */
|
|
37
|
-
const attachPendingRangeMarkers = (block, pending) => {
|
|
38
|
-
if (pending.length === 0) return;
|
|
39
|
-
block.rawMarkersBefore = pending.join("");
|
|
40
|
-
pending.length = 0;
|
|
41
|
-
};
|
|
42
|
-
/**
|
|
43
|
-
* Markers after the last block ride on it, since there is no block after them.
|
|
44
|
-
* With no block at all they are dropped: a container holding markers and no
|
|
45
|
-
* content has nothing for them to delimit.
|
|
46
|
-
*/
|
|
47
|
-
const attachTrailingRangeMarkers = (blocks, pending) => {
|
|
48
|
-
const last = blocks.at(-1);
|
|
49
|
-
if (pending.length === 0 || last === void 0) {
|
|
50
|
-
pending.length = 0;
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
last.rawMarkersAfter = pending.join("");
|
|
54
|
-
pending.length = 0;
|
|
55
|
-
};
|
|
56
|
-
/** Wrap a serialized block in the markup that stood around it. */
|
|
57
|
-
const withBlockRangeMarkers = (block, xml) => `${block.rawMarkersBefore ?? ""}${xml}${block.rawMarkersAfter ?? ""}`;
|
|
58
|
-
//#endregion
|
|
59
|
-
export { attachPendingRangeMarkers, attachTrailingRangeMarkers, isBlockRangeMarker, withBlockRangeMarkers };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { document_d_exports } from "../types/document.js";
|
|
2
|
-
//#region src/docx/bookmarkPlacement.d.ts
|
|
3
|
-
type BookmarkMarker = document_d_exports.BookmarkStart | document_d_exports.BookmarkEnd;
|
|
4
|
-
declare const appendBookmarkMarkerToLastParagraphInBlocks: (blocks: readonly document_d_exports.BlockContent[], marker: BookmarkMarker) => boolean;
|
|
5
|
-
declare const prependBookmarkMarkersToFirstParagraphInBlocks: (blocks: readonly document_d_exports.BlockContent[], markers: readonly BookmarkMarker[]) => boolean;
|
|
6
|
-
declare const appendBookmarkMarkerToLastParagraphInCells: (cells: readonly document_d_exports.TableCell[], marker: BookmarkMarker) => boolean;
|
|
7
|
-
declare const prependBookmarkMarkersToFirstParagraphInCell: (cell: document_d_exports.TableCell, markers: readonly BookmarkMarker[]) => boolean;
|
|
8
|
-
//#endregion
|
|
9
|
-
export { BookmarkMarker, appendBookmarkMarkerToLastParagraphInBlocks, appendBookmarkMarkerToLastParagraphInCells, prependBookmarkMarkersToFirstParagraphInBlocks, prependBookmarkMarkersToFirstParagraphInCell };
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
//#region src/docx/bookmarkPlacement.ts
|
|
2
|
-
const appendBookmarkMarkerToLastParagraphInBlocks = (blocks, marker) => {
|
|
3
|
-
for (let index = blocks.length - 1; index >= 0; index -= 1) {
|
|
4
|
-
const block = blocks[index];
|
|
5
|
-
if (block && appendBookmarkMarkerToLastParagraph(block, marker)) return true;
|
|
6
|
-
}
|
|
7
|
-
return false;
|
|
8
|
-
};
|
|
9
|
-
const prependBookmarkMarkersToFirstParagraphInBlocks = (blocks, markers) => {
|
|
10
|
-
if (markers.length === 0) return true;
|
|
11
|
-
for (const block of blocks) if (prependBookmarkMarkersToFirstParagraph(block, markers)) return true;
|
|
12
|
-
return false;
|
|
13
|
-
};
|
|
14
|
-
const appendBookmarkMarkerToLastParagraphInCells = (cells, marker) => {
|
|
15
|
-
for (let index = cells.length - 1; index >= 0; index -= 1) {
|
|
16
|
-
const cell = cells[index];
|
|
17
|
-
if (cell && appendBookmarkMarkerToLastParagraphInBlocks(cell.content, marker)) return true;
|
|
18
|
-
}
|
|
19
|
-
return false;
|
|
20
|
-
};
|
|
21
|
-
const prependBookmarkMarkersToFirstParagraphInCell = (cell, markers) => prependBookmarkMarkersToFirstParagraphInBlocks(cell.content, markers);
|
|
22
|
-
const appendBookmarkMarkerToLastParagraph = (block, marker) => {
|
|
23
|
-
if (block.type === "paragraph") {
|
|
24
|
-
block.content.push(marker);
|
|
25
|
-
return true;
|
|
26
|
-
}
|
|
27
|
-
if (block.type === "table") return appendBookmarkMarkerToLastParagraphInTable(block, marker);
|
|
28
|
-
return appendBookmarkMarkerToLastParagraphInBlocks(block.content, marker);
|
|
29
|
-
};
|
|
30
|
-
const appendBookmarkMarkerToLastParagraphInTable = (table, marker) => {
|
|
31
|
-
for (let rowIndex = table.rows.length - 1; rowIndex >= 0; rowIndex -= 1) {
|
|
32
|
-
const row = table.rows[rowIndex];
|
|
33
|
-
if (row && appendBookmarkMarkerToLastParagraphInCells(row.cells, marker)) return true;
|
|
34
|
-
}
|
|
35
|
-
return false;
|
|
36
|
-
};
|
|
37
|
-
const prependBookmarkMarkersToFirstParagraph = (block, markers) => {
|
|
38
|
-
if (block.type === "paragraph") {
|
|
39
|
-
block.content.unshift(...markers);
|
|
40
|
-
return true;
|
|
41
|
-
}
|
|
42
|
-
if (block.type === "table") return prependBookmarkMarkersToFirstParagraphInTable(block, markers);
|
|
43
|
-
return prependBookmarkMarkersToFirstParagraphInBlocks(block.content, markers);
|
|
44
|
-
};
|
|
45
|
-
const prependBookmarkMarkersToFirstParagraphInTable = (table, markers) => {
|
|
46
|
-
for (const row of table.rows) for (const cell of row.cells) if (prependBookmarkMarkersToFirstParagraphInCell(cell, markers)) return true;
|
|
47
|
-
return false;
|
|
48
|
-
};
|
|
49
|
-
//#endregion
|
|
50
|
-
export { appendBookmarkMarkerToLastParagraphInBlocks, appendBookmarkMarkerToLastParagraphInCells, prependBookmarkMarkersToFirstParagraphInBlocks, prependBookmarkMarkersToFirstParagraphInCell };
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
//#region src/fonts/embeddedFontTable.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* Parses the embedded-font references out of `word/fontTable.xml`.
|
|
4
|
-
*
|
|
5
|
-
* The shared docx model (`@stll/docx-core`) keeps only the embed relationship
|
|
6
|
-
* ids and drops the `w:fontKey` GUID, which is exactly the value needed to
|
|
7
|
-
* de-obfuscate the `.odttf` binary. This parser therefore reads the font table
|
|
8
|
-
* directly and keeps the full embed reference (rel id, key, subsetted flag).
|
|
9
|
-
*
|
|
10
|
-
* Structure:
|
|
11
|
-
* ```xml
|
|
12
|
-
* <w:fonts>
|
|
13
|
-
* <w:font w:name="My Brand Sans">
|
|
14
|
-
* <w:embedRegular r:id="rId1" w:fontKey="{GUID}" w:subsetted="true"/>
|
|
15
|
-
* </w:font>
|
|
16
|
-
* </w:fonts>
|
|
17
|
-
* ```
|
|
18
|
-
*
|
|
19
|
-
* Ported from eigenpal/docx-editor (see NOTICE.md).
|
|
20
|
-
*/
|
|
21
|
-
/** A single embedded face referenced from a `w:embed*` element. */
|
|
22
|
-
type EmbeddedFontFaceRef = {
|
|
23
|
-
/** Relationship id (`r:id`) resolved via `word/_rels/fontTable.xml.rels`. */
|
|
24
|
-
relId: string;
|
|
25
|
-
/** Obfuscation key GUID (`w:fontKey`), e.g. `{XXXXXXXX-...}`. */
|
|
26
|
-
fontKey?: string;
|
|
27
|
-
/** Whether the embedded face is subsetted (`w:subsetted`). */
|
|
28
|
-
subsetted?: boolean;
|
|
29
|
-
};
|
|
30
|
-
/** One `<w:font>` entry with whichever of the four embed faces it declares. */
|
|
31
|
-
type EmbeddedFontEntry = {
|
|
32
|
-
name: string;
|
|
33
|
-
embedRegular?: EmbeddedFontFaceRef;
|
|
34
|
-
embedBold?: EmbeddedFontFaceRef;
|
|
35
|
-
embedItalic?: EmbeddedFontFaceRef;
|
|
36
|
-
embedBoldItalic?: EmbeddedFontFaceRef;
|
|
37
|
-
};
|
|
38
|
-
/**
|
|
39
|
-
* Parse `word/fontTable.xml` into the list of font entries that declare at
|
|
40
|
-
* least one embedded face. Entries with no embeds are still returned (callers
|
|
41
|
-
* filter), and missing/unparseable input yields an empty list.
|
|
42
|
-
*/
|
|
43
|
-
declare function parseEmbeddedFontTable(fontTableXml: string | null | undefined): EmbeddedFontEntry[];
|
|
44
|
-
//#endregion
|
|
45
|
-
export { EmbeddedFontEntry, EmbeddedFontFaceRef, parseEmbeddedFontTable };
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { findChild, findChildren, getAttribute, parseXmlDocument } from "../docx/xmlParser.js";
|
|
2
|
-
//#region src/fonts/embeddedFontTable.ts
|
|
3
|
-
/**
|
|
4
|
-
* Parses the embedded-font references out of `word/fontTable.xml`.
|
|
5
|
-
*
|
|
6
|
-
* The shared docx model (`@stll/docx-core`) keeps only the embed relationship
|
|
7
|
-
* ids and drops the `w:fontKey` GUID, which is exactly the value needed to
|
|
8
|
-
* de-obfuscate the `.odttf` binary. This parser therefore reads the font table
|
|
9
|
-
* directly and keeps the full embed reference (rel id, key, subsetted flag).
|
|
10
|
-
*
|
|
11
|
-
* Structure:
|
|
12
|
-
* ```xml
|
|
13
|
-
* <w:fonts>
|
|
14
|
-
* <w:font w:name="My Brand Sans">
|
|
15
|
-
* <w:embedRegular r:id="rId1" w:fontKey="{GUID}" w:subsetted="true"/>
|
|
16
|
-
* </w:font>
|
|
17
|
-
* </w:fonts>
|
|
18
|
-
* ```
|
|
19
|
-
*
|
|
20
|
-
* Ported from eigenpal/docx-editor (see NOTICE.md).
|
|
21
|
-
*/
|
|
22
|
-
/** The four `w:embed*` local names paired with the entry field they populate. */
|
|
23
|
-
const EMBED_ELEMENTS = [
|
|
24
|
-
{
|
|
25
|
-
element: "embedRegular",
|
|
26
|
-
field: "embedRegular"
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
element: "embedBold",
|
|
30
|
-
field: "embedBold"
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
element: "embedItalic",
|
|
34
|
-
field: "embedItalic"
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
element: "embedBoldItalic",
|
|
38
|
-
field: "embedBoldItalic"
|
|
39
|
-
}
|
|
40
|
-
];
|
|
41
|
-
function parseEmbed(font, localName) {
|
|
42
|
-
const el = findChild(font, "w", localName);
|
|
43
|
-
if (!el) return;
|
|
44
|
-
const relId = getAttribute(el, "r", "id");
|
|
45
|
-
if (!relId) return;
|
|
46
|
-
const ref = { relId };
|
|
47
|
-
const fontKey = getAttribute(el, "w", "fontKey");
|
|
48
|
-
if (fontKey) ref.fontKey = fontKey;
|
|
49
|
-
const subsetted = getAttribute(el, "w", "subsetted");
|
|
50
|
-
if (subsetted === "true" || subsetted === "1") ref.subsetted = true;
|
|
51
|
-
return ref;
|
|
52
|
-
}
|
|
53
|
-
function parseFontEntry(font) {
|
|
54
|
-
const name = getAttribute(font, "w", "name");
|
|
55
|
-
if (!name) return null;
|
|
56
|
-
const entry = { name };
|
|
57
|
-
for (const { element, field } of EMBED_ELEMENTS) {
|
|
58
|
-
const ref = parseEmbed(font, element);
|
|
59
|
-
if (ref) entry[field] = ref;
|
|
60
|
-
}
|
|
61
|
-
return entry;
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Parse `word/fontTable.xml` into the list of font entries that declare at
|
|
65
|
-
* least one embedded face. Entries with no embeds are still returned (callers
|
|
66
|
-
* filter), and missing/unparseable input yields an empty list.
|
|
67
|
-
*/
|
|
68
|
-
function parseEmbeddedFontTable(fontTableXml) {
|
|
69
|
-
if (!fontTableXml || fontTableXml.trim().length === 0) return [];
|
|
70
|
-
const root = parseXmlDocument(fontTableXml);
|
|
71
|
-
if (!root) return [];
|
|
72
|
-
const entries = [];
|
|
73
|
-
for (const font of findChildren(root, "w", "font")) {
|
|
74
|
-
const entry = parseFontEntry(font);
|
|
75
|
-
if (entry) entries.push(entry);
|
|
76
|
-
}
|
|
77
|
-
return entries;
|
|
78
|
-
}
|
|
79
|
-
//#endregion
|
|
80
|
-
export { parseEmbeddedFontTable };
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { MarkExtension } from "../types.js";
|
|
2
|
-
//#region src/prosemirror/extensions/marks/PageBreakRunOwnerExtension.d.ts
|
|
3
|
-
/**
|
|
4
|
-
* Editor-only identity for the authored run surrounding a page-break atom.
|
|
5
|
-
*
|
|
6
|
-
* Ordinary formatting marks cannot distinguish two adjacent source runs with
|
|
7
|
-
* identical properties. This mark is added only to a run containing an
|
|
8
|
-
* explicit page break, so every sibling carrier can be rejoined exactly on
|
|
9
|
-
* save without changing the generic run-coalescing model.
|
|
10
|
-
*/
|
|
11
|
-
declare const PageBreakRunOwnerExtension: (options?: Partial<Record<string, unknown>> | undefined) => MarkExtension;
|
|
12
|
-
//#endregion
|
|
13
|
-
export { PageBreakRunOwnerExtension };
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { expectPageBreakRunOwnerMarkAttrs } from "../../attrs/index.js";
|
|
2
|
-
import { createMarkExtension } from "../create.js";
|
|
3
|
-
//#region src/prosemirror/extensions/marks/PageBreakRunOwnerExtension.ts
|
|
4
|
-
/**
|
|
5
|
-
* Editor-only identity for the authored run surrounding a page-break atom.
|
|
6
|
-
*
|
|
7
|
-
* Ordinary formatting marks cannot distinguish two adjacent source runs with
|
|
8
|
-
* identical properties. This mark is added only to a run containing an
|
|
9
|
-
* explicit page break, so every sibling carrier can be rejoined exactly on
|
|
10
|
-
* save without changing the generic run-coalescing model.
|
|
11
|
-
*/
|
|
12
|
-
const CANONICAL_OWNER_ID = /^(?:0|[1-9]\d*)$/u;
|
|
13
|
-
const PageBreakRunOwnerExtension = createMarkExtension({
|
|
14
|
-
name: "pageBreakRunOwner",
|
|
15
|
-
schemaMarkName: "pageBreakRunOwner",
|
|
16
|
-
markSpec: {
|
|
17
|
-
attrs: { id: {} },
|
|
18
|
-
inclusive: false,
|
|
19
|
-
parseDOM: [{
|
|
20
|
-
tag: "span[data-docx-page-break-run-owner]",
|
|
21
|
-
getAttrs(dom) {
|
|
22
|
-
const rawId = dom.dataset["docxPageBreakRunOwner"];
|
|
23
|
-
if (rawId === void 0 || !CANONICAL_OWNER_ID.test(rawId)) return false;
|
|
24
|
-
const id = Number(rawId);
|
|
25
|
-
return Number.isSafeInteger(id) ? { id } : false;
|
|
26
|
-
}
|
|
27
|
-
}],
|
|
28
|
-
toDOM(mark) {
|
|
29
|
-
const { id } = expectPageBreakRunOwnerMarkAttrs(mark);
|
|
30
|
-
return [
|
|
31
|
-
"span",
|
|
32
|
-
{ "data-docx-page-break-run-owner": String(id) },
|
|
33
|
-
0
|
|
34
|
-
];
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
//#endregion
|
|
39
|
-
export { PageBreakRunOwnerExtension };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Node } from "prosemirror-model";
|
|
2
|
-
import * as Y from "yjs";
|
|
3
|
-
//#region src/prosemirror/yjsParagraphSourceContract.d.ts
|
|
4
|
-
declare const proseDocumentParagraphSourceContract: (document: Node) => string | null;
|
|
5
|
-
declare const writeYjsParagraphSourceContract: (ydoc: Y.Doc, document: Node) => void;
|
|
6
|
-
declare const readYjsParagraphSourceContract: (ydoc: Y.Doc) => string | null;
|
|
7
|
-
declare const withParagraphSourceContract: (document: Node, contract: string) => Node;
|
|
8
|
-
//#endregion
|
|
9
|
-
export { proseDocumentParagraphSourceContract, readYjsParagraphSourceContract, withParagraphSourceContract, writeYjsParagraphSourceContract };
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { PROSE_PARAGRAPH_SOURCE_CONTRACT_ATTR, getProseDocumentParagraphPropertySourceContract } from "../docx/paragraphPropertySource.js";
|
|
2
|
-
import { panic } from "better-result";
|
|
3
|
-
//#region src/prosemirror/yjsParagraphSourceContract.ts
|
|
4
|
-
const FOLIO_YJS_METADATA_MAP_NAME = "folio:document-metadata";
|
|
5
|
-
const PARAGRAPH_SOURCE_CONTRACT_KEY = "paragraphSourceContract";
|
|
6
|
-
const proseDocumentParagraphSourceContract = (document) => {
|
|
7
|
-
return getProseDocumentParagraphPropertySourceContract(document);
|
|
8
|
-
};
|
|
9
|
-
const writeYjsParagraphSourceContract = (ydoc, document) => {
|
|
10
|
-
const contract = proseDocumentParagraphSourceContract(document);
|
|
11
|
-
if (!contract) panic("Cannot seed collaboration without a paragraph-property source contract");
|
|
12
|
-
ydoc.getMap(FOLIO_YJS_METADATA_MAP_NAME).set(PARAGRAPH_SOURCE_CONTRACT_KEY, contract);
|
|
13
|
-
};
|
|
14
|
-
const readYjsParagraphSourceContract = (ydoc) => {
|
|
15
|
-
const contract = ydoc.getMap(FOLIO_YJS_METADATA_MAP_NAME).get(PARAGRAPH_SOURCE_CONTRACT_KEY);
|
|
16
|
-
return typeof contract === "string" ? contract : null;
|
|
17
|
-
};
|
|
18
|
-
const withParagraphSourceContract = (document, contract) => {
|
|
19
|
-
if (document.type.name !== "doc") panic("A paragraph-property source contract can only attach to a document node");
|
|
20
|
-
return document.type.create({
|
|
21
|
-
...document.attrs,
|
|
22
|
-
[PROSE_PARAGRAPH_SOURCE_CONTRACT_ATTR]: contract
|
|
23
|
-
}, document.content, document.marks);
|
|
24
|
-
};
|
|
25
|
-
//#endregion
|
|
26
|
-
export { proseDocumentParagraphSourceContract, readYjsParagraphSourceContract, withParagraphSourceContract, writeYjsParagraphSourceContract };
|