@stll/folio-core 0.46.0 → 0.47.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai-edits/apply.d.ts +17 -1
- package/dist/ai-edits/apply.js +31 -27
- package/dist/ai-edits/headless.d.ts +9 -2
- package/dist/ai-edits/headless.js +5 -3
- package/dist/ai-edits/read.d.ts +1 -0
- package/dist/ai-edits/read.js +1 -0
- package/dist/ai-edits/snapshot.js +32 -27
- package/dist/ai-edits/table-cell-mutations.js +15 -7
- package/dist/ai-edits/table-geometry.js +21 -18
- package/dist/ai-edits/table-template.js +2 -2
- package/dist/compare/compare.js +2 -1
- package/dist/compare/content-alignment.js +192 -46
- package/dist/compare/content-types.d.ts +8 -2
- package/dist/compare/content.js +2 -11
- package/dist/compare/plan.js +7 -4
- package/dist/compare/section-boundary-properties.js +1 -2
- package/dist/content-controls/checkboxDisplay.d.ts +8 -2
- package/dist/content-controls/checkboxDisplay.js +11 -5
- package/dist/content-controls/mutateContentControls.js +41 -42
- package/dist/controller/layoutPipeline.js +8 -3
- package/dist/display-list/build/buildDisplayList.js +7 -7
- package/dist/display-list/build/imagePrimitives.d.ts +4 -4
- package/dist/display-list/build/imagePrimitives.js +38 -20
- package/dist/display-list/build/pageBorderPrimitives.js +2 -1
- package/dist/display-list/build/paragraphPrimitives.js +93 -13
- package/dist/display-list/build/previewPrimitives.d.ts +10 -0
- package/dist/display-list/build/previewPrimitives.js +89 -0
- package/dist/display-list/build/strokes.d.ts +177 -8
- package/dist/display-list/build/strokes.js +167 -47
- package/dist/display-list/build/tablePrimitives.js +4 -2
- package/dist/display-list/build/textBoxPrimitives.js +6 -4
- package/dist/display-list/build/textDecorations.d.ts +15 -1
- package/dist/display-list/build/textDecorations.js +15 -1
- package/dist/display-list/dom/renderDisplayListToDom.js +1 -19
- package/dist/display-list/primitives.d.ts +13 -2
- package/dist/display-list/primitives.js +36 -1
- package/dist/document-operations.d.ts +9 -2
- package/dist/document-operations.js +5 -3
- package/dist/docx/attributeRemainder.d.ts +34 -1
- package/dist/docx/attributeRemainder.js +49 -3
- package/dist/docx/blockContentParser.d.ts +2 -0
- package/dist/docx/blockContentParser.js +39 -67
- package/dist/docx/blockPlainText.js +3 -1
- package/dist/docx/borderParser.js +26 -11
- package/dist/docx/builtInStyles.d.ts +8 -16
- package/dist/docx/builtInStyles.js +54 -17
- package/dist/docx/commentAnchorIndex.js +1 -1
- package/dist/docx/commentParser.js +3 -3
- package/dist/docx/commentRangeIntegrity.js +1 -1
- package/dist/docx/commentRangeJoin.js +1 -1
- package/dist/docx/commentReferenceNormalization.js +3 -2
- package/dist/docx/commentReplyMarkers.js +1 -1
- package/dist/docx/compatibility.js +56 -42
- package/dist/docx/containerChildren.d.ts +110 -13
- package/dist/docx/containerChildren.gen.d.ts +16 -1
- package/dist/docx/containerChildren.gen.js +18 -1
- package/dist/docx/containerChildren.js +63 -13
- package/dist/docx/diagramPreview.d.ts +14 -2
- package/dist/docx/diagramPreview.js +81 -169
- package/dist/docx/documentParser.js +4 -1
- package/dist/docx/drawingAnchor.d.ts +87 -0
- package/dist/docx/drawingAnchor.js +201 -0
- package/dist/docx/drawingUtils.d.ts +43 -38
- package/dist/docx/drawingUtils.js +205 -118
- package/dist/docx/fontTableParser.js +102 -41
- package/dist/docx/footnoteParser.js +10 -6
- package/dist/docx/groupDrawingParser.js +4 -3
- package/dist/docx/headerFooterReferenceNormalization.js +1 -1
- package/dist/docx/hyperlinkParser.d.ts +45 -7
- package/dist/docx/hyperlinkParser.js +126 -57
- package/dist/docx/imageParser.js +127 -107
- package/dist/docx/index.d.ts +2 -1
- package/dist/docx/index.js +2 -1
- package/dist/docx/inlineContentRemovals.d.ts +28 -0
- package/dist/docx/inlineContentRemovals.js +46 -0
- package/dist/docx/inlineWrapperContent.d.ts +84 -3
- package/dist/docx/inlineWrapperContent.js +85 -4
- package/dist/docx/inlineWrapperParser.d.ts +11 -0
- package/dist/docx/inlineWrapperParser.js +60 -0
- package/dist/docx/nonVisualDrawingProps.d.ts +5 -13
- package/dist/docx/normalizeBaseDirection.js +4 -2
- package/dist/docx/numberingParser.d.ts +25 -2
- package/dist/docx/numberingParser.js +264 -361
- package/dist/docx/numberingReference.d.ts +9 -16
- package/dist/docx/numberingReference.js +17 -16
- package/dist/docx/numberingReferenceNormalization.js +7 -7
- package/dist/docx/ooxmlCounterFormatter.d.ts +1 -1
- package/dist/docx/ooxmlCounterFormatter.js +4 -1
- package/dist/docx/paraIdAttribute.d.ts +91 -1
- package/dist/docx/paraIdAttribute.js +79 -1
- package/dist/docx/paragraphParser.d.ts +9 -24
- package/dist/docx/paragraphParser.js +212 -396
- package/dist/docx/paragraphProperties.d.ts +23 -0
- package/dist/docx/paragraphProperties.js +279 -0
- package/dist/docx/paragraphPropertySource.js +2 -0
- package/dist/docx/paragraphTextBoxEnrichment.d.ts +2 -1
- package/dist/docx/paragraphTextBoxEnrichment.js +14 -7
- package/dist/docx/paragraphTraversal.d.ts +14 -10
- package/dist/docx/paragraphTraversal.js +47 -49
- package/dist/docx/parseWarningMessage.js +3 -0
- package/dist/docx/parserEnums.d.ts +6 -8
- package/dist/docx/parserEnums.js +4 -6
- package/dist/docx/preservedRunContent.js +16 -6
- package/dist/docx/previewBudget.d.ts +44 -23
- package/dist/docx/previewBudget.js +61 -30
- package/dist/docx/propertyElementAttributes.d.ts +178 -0
- package/dist/docx/propertyElementAttributes.js +114 -0
- package/dist/docx/renderedPageBreakNormalization.js +2 -2
- package/dist/docx/rezip.d.ts +28 -2
- package/dist/docx/rezip.js +78 -9
- package/dist/docx/runConsolidator.d.ts +42 -2
- package/dist/docx/runConsolidator.js +60 -6
- package/dist/docx/runParser.d.ts +54 -18
- package/dist/docx/runParser.js +379 -295
- package/dist/docx/runPayload.d.ts +5 -0
- package/dist/docx/runPayload.js +4 -0
- package/dist/docx/sdtProperties.d.ts +39 -5
- package/dist/docx/sdtProperties.js +205 -84
- package/dist/docx/sdtPropertiesPatch.d.ts +5 -9
- package/dist/docx/sdtPropertiesPatch.js +68 -112
- package/dist/docx/sectionParser.d.ts +1 -2
- package/dist/docx/sectionParser.js +236 -240
- package/dist/docx/selectiveSave.js +3 -2
- package/dist/docx/selectiveXmlPatch.d.ts +21 -2
- package/dist/docx/selectiveXmlPatch.js +195 -99
- package/dist/docx/serializer/blockSdtSerializer.js +2 -96
- package/dist/docx/serializer/borderSerializer.d.ts +5 -5
- package/dist/docx/serializer/borderSerializer.js +10 -8
- package/dist/docx/serializer/documentSerializer.js +3 -0
- package/dist/docx/serializer/fontTableSerializer.js +31 -3
- package/dist/docx/serializer/headerFooterSerializer.js +3 -0
- package/dist/docx/serializer/markupRangeAttributes.d.ts +9 -1
- package/dist/docx/serializer/markupRangeAttributes.js +9 -1
- package/dist/docx/serializer/noteSerializer.js +3 -0
- package/dist/docx/serializer/numberingSerializer.d.ts +1 -6
- package/dist/docx/serializer/numberingSerializer.js +81 -79
- package/dist/docx/serializer/paragraphSerializer.d.ts +1 -9
- package/dist/docx/serializer/paragraphSerializer.js +88 -188
- package/dist/docx/serializer/runSerializer.d.ts +1 -5
- package/dist/docx/serializer/runSerializer.js +109 -59
- package/dist/docx/serializer/sdtPropertiesSerializer.d.ts +26 -0
- package/dist/docx/serializer/sdtPropertiesSerializer.js +111 -0
- package/dist/docx/serializer/sectionPropertiesSerializer.js +34 -45
- package/dist/docx/serializer/settingsSerializer.js +6 -4
- package/dist/docx/serializer/stylesSerializer.js +8 -11
- package/dist/docx/serializer/tableSerializer.js +268 -100
- package/dist/docx/serializer/textFormattingSerializer.d.ts +28 -4
- package/dist/docx/serializer/textFormattingSerializer.js +111 -101
- package/dist/docx/serializer/xmlUtils.d.ts +1 -1
- package/dist/docx/serializer/xmlUtils.js +1 -1
- package/dist/docx/server/createBilingualDocument.js +18 -16
- package/dist/docx/server/migrateYjsAttrSchema.js +3 -3
- package/dist/docx/settingsParser.js +7 -4
- package/dist/docx/shadingParser.d.ts +2 -1
- package/dist/docx/shadingParser.js +43 -7
- package/dist/docx/shapeParser.js +8 -3
- package/dist/docx/strictNames.d.ts +11 -0
- package/dist/docx/strictNames.gen.d.ts +45 -0
- package/dist/docx/strictNames.gen.js +50 -0
- package/dist/docx/strictNames.js +43 -0
- package/dist/docx/strictValueEncodings.gen.js +133 -131
- package/dist/docx/styleParser.js +17 -349
- package/dist/docx/tableParser.d.ts +10 -1
- package/dist/docx/tableParser.js +505 -181
- package/dist/docx/textBoxParser.d.ts +3 -1
- package/dist/docx/textBoxParser.js +18 -8
- package/dist/docx/themeColorAttribute.d.ts +13 -0
- package/dist/docx/themeColorAttribute.js +24 -0
- package/dist/docx/trackedMoveRangeNormalization.js +2 -1
- package/dist/docx/vmlImageParser.d.ts +13 -4
- package/dist/docx/vmlImageParser.js +74 -31
- package/dist/docx/vmlPreview.js +2 -2
- package/dist/docx/wrapPolygon.d.ts +30 -0
- package/dist/docx/wrapPolygon.js +70 -0
- package/dist/docx/xmlParser.d.ts +14 -1
- package/dist/docx/xmlParser.js +18 -2
- package/dist/fonts/embeddedFonts.js +3 -3
- package/dist/headless-layout.js +2 -0
- package/dist/i18n/messages/catalogs.gen.d.ts +68 -0
- package/dist/i18n/messages/catalogs.gen.js +102 -34
- package/dist/i18n/messages/messages.gen.d.ts +4 -0
- package/dist/internal/headlessRevisionResolution.js +9 -0
- package/dist/internal/pageBreakRunSourceDescendantIndex.js +3 -1
- package/dist/internal/paragraphFormattingSerialization.d.ts +20 -9
- package/dist/internal/paragraphFormattingSerialization.js +118 -83
- package/dist/layout-bridge/convert/footnoteLayout.d.ts +1 -0
- package/dist/layout-bridge/convert/footnoteLayout.js +1 -0
- package/dist/layout-bridge/convert/headerFooterLayout.d.ts +1 -0
- package/dist/layout-bridge/convert/headerFooterLayout.js +2 -0
- package/dist/layout-bridge/convert/toFlowBlocks.d.ts +17 -12
- package/dist/layout-bridge/convert/toFlowBlocks.js +177 -101
- package/dist/layout-engine/index.d.ts +2 -2
- package/dist/layout-engine/index.js +53 -17
- package/dist/layout-engine/measure/measureBlocks.d.ts +3 -0
- package/dist/layout-engine/measure/measureBlocks.js +6 -10
- package/dist/layout-engine/measure/tableCellGrid.js +2 -1
- package/dist/layout-engine/measure/tableFragmentBorderGeometry.js +2 -1
- package/dist/layout-engine/measure/tableInlinePlacement.js +2 -5
- package/dist/layout-engine/paragraphSequence.js +3 -2
- package/dist/layout-engine/renderedBreakReconciliation.js +2 -1
- package/dist/layout-engine/section-breaks.d.ts +49 -2
- package/dist/layout-engine/section-breaks.js +55 -4
- package/dist/layout-engine/types.d.ts +47 -17
- package/dist/layout-engine/types.js +16 -1
- package/dist/layout-painter/borderStroke.d.ts +18 -4
- package/dist/layout-painter/renderPage.js +6 -4
- package/dist/layout-painter/renderParagraph.d.ts +2 -1
- package/dist/layout-painter/renderParagraph.js +13 -26
- package/dist/layout-painter/renderTable.d.ts +4 -1
- package/dist/layout-painter/renderTable.js +22 -22
- package/dist/layout-painter/renderTextBox.js +5 -3
- package/dist/markdown/renderBlock.js +3 -1
- package/dist/markdown/renderRuns.js +7 -2
- package/dist/markdown/renderTable.js +2 -1
- package/dist/model.d.ts +3 -3
- package/dist/model.js +2 -2
- package/dist/paged-layout/sectionBlockWidths.d.ts +3 -0
- package/dist/paged-layout/sectionBlockWidths.js +26 -4
- package/dist/prosemirror/attrs/index.d.ts +22 -4
- package/dist/prosemirror/attrs/index.js +498 -60
- package/dist/prosemirror/bookmarkBoundaryAttrs.d.ts +9 -1
- package/dist/prosemirror/bookmarkBoundaryAttrs.js +22 -3
- package/dist/prosemirror/commands/comments.js +68 -53
- package/dist/prosemirror/commands/contentControls.js +24 -19
- package/dist/prosemirror/commands/image.d.ts +1 -1
- package/dist/prosemirror/commands/image.js +4 -1
- package/dist/prosemirror/commands/paragraph.d.ts +2 -1
- package/dist/prosemirror/commands/propertyChangeScope.d.ts +12 -4
- package/dist/prosemirror/commands/propertyChangeScope.js +22 -4
- package/dist/prosemirror/commands/sectionBreak.d.ts +33 -1
- package/dist/prosemirror/commands/sectionBreak.js +187 -11
- package/dist/prosemirror/conversion/fromProseDoc.d.ts +18 -2
- package/dist/prosemirror/conversion/fromProseDoc.js +330 -183
- package/dist/prosemirror/conversion/index.d.ts +2 -2
- package/dist/prosemirror/conversion/preservedSinkCarriers.d.ts +39 -0
- package/dist/prosemirror/conversion/preservedSinkCarriers.js +19 -0
- package/dist/prosemirror/conversion/runShadingMark.js +14 -1
- package/dist/prosemirror/conversion/sdtAttrs.d.ts +10 -1
- package/dist/prosemirror/conversion/sdtAttrs.js +19 -5
- package/dist/prosemirror/conversion/toProseDoc.js +371 -141
- package/dist/prosemirror/emptyRangeAnchor.d.ts +53 -0
- package/dist/prosemirror/emptyRangeAnchor.js +158 -0
- package/dist/prosemirror/extensions/StarterKit.js +8 -2
- package/dist/prosemirror/extensions/core/DocExtension.js +1 -1
- package/dist/prosemirror/extensions/core/ParagraphExtension.js +19 -15
- package/dist/prosemirror/extensions/features/BaseKeymapExtension.js +3 -2
- package/dist/prosemirror/extensions/features/ListExtension.js +43 -24
- package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.js +4 -3
- package/dist/prosemirror/extensions/features/PasteCleanupExtension.d.ts +3 -3
- package/dist/prosemirror/extensions/features/PasteCleanupExtension.js +5 -5
- package/dist/prosemirror/extensions/features/pasteCleanup.d.ts +3 -1
- package/dist/prosemirror/extensions/features/pasteCleanup.js +56 -2
- package/dist/prosemirror/extensions/features/pastedHeadingStyles.js +5 -4
- package/dist/prosemirror/extensions/markRegistry.d.ts +26 -2
- package/dist/prosemirror/extensions/markRegistry.js +73 -10
- package/dist/prosemirror/extensions/marks/InlineWrapperExtension.js +17 -3
- package/dist/prosemirror/extensions/marks/RunIdentityExtension.d.ts +26 -0
- package/dist/prosemirror/extensions/marks/RunIdentityExtension.js +134 -0
- package/dist/prosemirror/extensions/marks/TrackedChangeExtensions.js +2 -1
- package/dist/prosemirror/extensions/marks/UnderlineExtension.js +12 -18
- package/dist/prosemirror/extensions/marks/markUtils.js +2 -1
- package/dist/prosemirror/extensions/nodes/BlockBookmarkBoundaryExtension.d.ts +29 -0
- package/dist/prosemirror/extensions/nodes/BlockBookmarkBoundaryExtension.js +46 -0
- package/dist/prosemirror/extensions/nodes/BlockSdtExtension.d.ts +4 -3
- package/dist/prosemirror/extensions/nodes/BlockSdtExtension.js +18 -13
- package/dist/prosemirror/extensions/nodes/BookmarkBoundaryExtension.js +28 -53
- package/dist/prosemirror/extensions/nodes/CommentReferenceExtension.js +10 -0
- package/dist/prosemirror/extensions/nodes/ImageExtension.js +8 -1
- package/dist/prosemirror/extensions/nodes/MoveRangeBoundaryExtension.d.ts +11 -0
- package/dist/prosemirror/extensions/nodes/MoveRangeBoundaryExtension.js +43 -0
- package/dist/prosemirror/extensions/nodes/RangeAnchorExtension.d.ts +13 -0
- package/dist/prosemirror/extensions/nodes/RangeAnchorExtension.js +65 -0
- package/dist/prosemirror/extensions/nodes/SdtExtension.d.ts +3 -1
- package/dist/prosemirror/extensions/nodes/SdtExtension.js +22 -16
- package/dist/prosemirror/extensions/nodes/ShapeExtension.js +4 -0
- package/dist/prosemirror/extensions/nodes/TableExtension.js +141 -123
- package/dist/prosemirror/extensions/nodes/TextBoxExtension.js +4 -0
- package/dist/prosemirror/extensions/nodes/bookmarkBoundaryDom.d.ts +23 -0
- package/dist/prosemirror/extensions/nodes/bookmarkBoundaryDom.js +57 -0
- package/dist/prosemirror/extensions/types.d.ts +12 -3
- package/dist/prosemirror/index.d.ts +4 -2
- package/dist/prosemirror/index.js +2 -1
- package/dist/prosemirror/inlineWrapperStack.js +20 -3
- package/dist/prosemirror/listMarker.d.ts +2 -2
- package/dist/prosemirror/listMarker.js +7 -8
- package/dist/prosemirror/listRenderingAttrs.js +11 -1
- package/dist/prosemirror/listState.d.ts +62 -0
- package/dist/prosemirror/listState.js +49 -0
- package/dist/prosemirror/moveRangeBoundaryAttrs.d.ts +13 -0
- package/dist/prosemirror/moveRangeBoundaryAttrs.js +114 -0
- package/dist/prosemirror/numberedRefFields.js +4 -4
- package/dist/prosemirror/numberingAttr.d.ts +55 -0
- package/dist/prosemirror/numberingAttr.js +74 -0
- package/dist/prosemirror/outlineLevelAttr.d.ts +29 -0
- package/dist/prosemirror/outlineLevelAttr.js +42 -0
- package/dist/prosemirror/paragraphFormattingProvenance.d.ts +9 -0
- package/dist/prosemirror/paragraphFormattingProvenance.js +4 -1
- package/dist/prosemirror/plugins/selectionTracker.d.ts +3 -6
- package/dist/prosemirror/plugins/selectionTracker.js +3 -10
- package/dist/prosemirror/rangeAnchorAttrs.d.ts +14 -0
- package/dist/prosemirror/rangeAnchorAttrs.js +101 -0
- package/dist/prosemirror/replacedAnnotations.d.ts +1 -1
- package/dist/prosemirror/replacedAnnotations.js +24 -6
- package/dist/prosemirror/revisionCarriers.d.ts +86 -2
- package/dist/prosemirror/revisionCarriers.js +86 -60
- package/dist/prosemirror/runFormattingInlineCarriers.d.ts +2 -0
- package/dist/prosemirror/runFormattingInlineCarriers.js +2 -0
- package/dist/prosemirror/runIdentity.d.ts +28 -0
- package/dist/prosemirror/runIdentity.js +36 -0
- package/dist/prosemirror/runStyleFormatting.js +1 -1
- package/dist/prosemirror/schema/index.d.ts +2 -2
- package/dist/prosemirror/schema/marks.d.ts +23 -4
- package/dist/prosemirror/schema/nodes.d.ts +220 -24
- package/dist/prosemirror/sectionCarrier.d.ts +37 -0
- package/dist/prosemirror/sectionCarrier.js +40 -0
- package/dist/prosemirror/selectionState.d.ts +3 -0
- package/dist/prosemirror/selectionState.js +4 -1
- package/dist/prosemirror/styles/resolvedStyleAttrs.d.ts +5 -4
- package/dist/prosemirror/styles/resolvedStyleAttrs.js +15 -13
- package/dist/prosemirror/tableResize.js +5 -6
- package/dist/prosemirror/trackedRunInlineAtoms.d.ts +2 -0
- package/dist/prosemirror/trackedRunInlineAtoms.js +2 -0
- package/dist/prosemirror/utils/extractTrackedChanges.d.ts +10 -11
- package/dist/prosemirror/utils/extractTrackedChanges.js +109 -92
- package/dist/prosemirror/validation.js +17 -6
- package/dist/prosemirror/yjsDocumentMetadata.d.ts +2 -2
- package/dist/prosemirror/yjsDocumentMetadata.js +428 -7
- package/dist/prosemirror/zeroWidthAnchors.js +4 -0
- package/dist/style-sets/extract.js +4 -4
- package/dist/style-sets/stellaStyle.js +36 -23
- package/dist/types/colors.d.ts +2 -2
- package/dist/types/content.d.ts +2 -2
- package/dist/types/documentEnumValues.d.ts +53 -26
- package/dist/types/documentEnumValues.js +72 -174
- package/dist/types/formatting.d.ts +2 -2
- package/dist/types/index.d.ts +9 -2
- package/dist/utils/borderCss.d.ts +246 -0
- package/dist/utils/borderCss.js +325 -0
- package/dist/utils/colorResolver.d.ts +4 -3
- package/dist/utils/colorResolver.js +45 -76
- package/dist/utils/createDocument.js +24 -6
- package/dist/utils/findReplace.js +52 -10
- package/dist/utils/formatToStyle.d.ts +84 -2
- package/dist/utils/formatToStyle.js +133 -52
- package/dist/utils/headingCollector.js +3 -2
- package/dist/utils/mergeDocumentContent.js +5 -3
- package/dist/utils/paragraphFormattingMerge.js +27 -6
- package/dist/utils/replaceText.js +1 -1
- package/dist/utils/tableOperations.d.ts +5 -3
- package/dist/utils/tableOperations.js +14 -1
- package/dist/utils/tablePlacement.d.ts +7 -0
- package/dist/utils/tablePlacement.js +14 -0
- package/dist/utils/textDirectionFlow.d.ts +15 -0
- package/dist/utils/textDirectionFlow.js +38 -0
- package/dist/utils/textFormattingMerge.js +16 -4
- package/package.json +10 -10
- package/dist/ai-edits/__fixtures__/paragraphs.d.ts +0 -17
- package/dist/ai-edits/__fixtures__/paragraphs.js +0 -33
- package/dist/compare/__fixtures__/body-sequence.d.ts +0 -119
- package/dist/compare/__fixtures__/body-sequence.js +0 -225
- package/dist/compare/__fixtures__/nested-table.d.ts +0 -16
- package/dist/compare/__fixtures__/nested-table.js +0 -50
- package/dist/compare/__fixtures__/numbered-list.d.ts +0 -34
- package/dist/compare/__fixtures__/numbered-list.js +0 -85
- package/dist/docx/bookmarkPlacement.d.ts +0 -9
- package/dist/docx/bookmarkPlacement.js +0 -52
- package/dist/fonts/embeddedFontTable.d.ts +0 -45
- package/dist/fonts/embeddedFontTable.js +0 -80
- package/dist/prosemirror/extensions/marks/PageBreakRunOwnerExtension.d.ts +0 -13
- package/dist/prosemirror/extensions/marks/PageBreakRunOwnerExtension.js +0 -39
package/dist/ai-edits/apply.d.ts
CHANGED
|
@@ -57,6 +57,8 @@ type ApplyFolioAIEditOperationsOptions = {
|
|
|
57
57
|
* still describes a table by its cell texts.
|
|
58
58
|
*/
|
|
59
59
|
tableTemplates?: FolioTableTemplates;
|
|
60
|
+
/** What a replacement does with a background the text it replaces carries. */
|
|
61
|
+
replacementBackground?: FolioReplacementBackground;
|
|
60
62
|
};
|
|
61
63
|
/**
|
|
62
64
|
* How an apply batch cuts the redline for a replacement. Word-level by
|
|
@@ -68,6 +70,20 @@ type ApplyFolioAIEditOperationsOptions = {
|
|
|
68
70
|
type FolioWordDiffOptions = {
|
|
69
71
|
granularity?: WordDiffGranularity;
|
|
70
72
|
};
|
|
73
|
+
/**
|
|
74
|
+
* What a replacement does with a highlight or `w:shd` the text it replaces
|
|
75
|
+
* carries.
|
|
76
|
+
*
|
|
77
|
+
* `clear` is the authoring default: text typed over a highlighted placeholder
|
|
78
|
+
* is new text, and keeping the marker that said "fill this in" would carry it
|
|
79
|
+
* into the finished document. `keep` is for a caller that states the
|
|
80
|
+
* replacement's own run properties rather than letting it inherit them — a
|
|
81
|
+
* comparison reproducing a revised document holds the properties that document
|
|
82
|
+
* has, and clearing them first records a run-property change it takes straight
|
|
83
|
+
* back, which reaches the reader as a revision whose before and after are the
|
|
84
|
+
* same.
|
|
85
|
+
*/
|
|
86
|
+
type FolioReplacementBackground = "clear" | "keep";
|
|
71
87
|
/**
|
|
72
88
|
* An apply result plus where the batch left the revision-id counter.
|
|
73
89
|
*
|
|
@@ -88,4 +104,4 @@ type FolioAIEditApplyOutcome = FolioAIEditApplyResult & {
|
|
|
88
104
|
declare const applyFolioAIEditOperations: (options: ApplyFolioAIEditOperationsOptions) => FolioAIEditApplyOutcome;
|
|
89
105
|
declare const previewFolioAIEditOperations: (options: ApplyFolioAIEditOperationsOptions) => FolioAIEditApplyOutcome;
|
|
90
106
|
//#endregion
|
|
91
|
-
export { FolioAIEditApplyOutcome, FolioAIEditView, FolioRevisionStamp, FolioWordDiffOptions, applyFolioAIEditOperations, previewFolioAIEditOperations };
|
|
107
|
+
export { FolioAIEditApplyOutcome, FolioAIEditView, FolioReplacementBackground, FolioRevisionStamp, FolioWordDiffOptions, applyFolioAIEditOperations, previewFolioAIEditOperations };
|
package/dist/ai-edits/apply.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { paragraphNumberingReference, paragraphNumberingReferenceId } from "../docx/numberingReference.js";
|
|
1
2
|
import { formattingEquals } from "../docx/runConsolidator.js";
|
|
2
3
|
import { expectParagraphAttrs, expectRunPropertyChangeMarkAttrs } from "../prosemirror/attrs/index.js";
|
|
3
4
|
import { hasSerializableParagraphPropertyChange, paragraphPropertiesSnapshot } from "../prosemirror/commands/propertyChangeScope.js";
|
|
@@ -5,6 +6,7 @@ import { addedBreakCarrierBefore, finalParagraphsOf, paragraphEndsItsContainer }
|
|
|
5
6
|
import { requestDeterministicParaIds } from "../prosemirror/extensions/features/ParaIdAllocatorExtension.js";
|
|
6
7
|
import { markStructuralChange } from "../prosemirror/extensions/features/ParagraphChangeTrackerExtension.js";
|
|
7
8
|
import { CLEARED_LIST_RENDERING_ATTRS } from "../prosemirror/listMarker.js";
|
|
9
|
+
import { paragraphNumberingAttr, readParagraphNumberingAttr } from "../prosemirror/numberingAttr.js";
|
|
8
10
|
import { directParagraphAlignment } from "../prosemirror/paragraphAlignment.js";
|
|
9
11
|
import { directParagraphIndentation, paragraphIndentationAttrPatch, paragraphIndentationEqual, paragraphIndentationFromFormatting, withDirectParagraphIndentation } from "../prosemirror/paragraphIndentation.js";
|
|
10
12
|
import { directParagraphSpacing, paragraphSpacingAttrPatch, paragraphSpacingEqual, paragraphSpacingFromFormatting, withDirectParagraphSpacing } from "../prosemirror/paragraphSpacing.js";
|
|
@@ -188,26 +190,25 @@ const paragraphPropertiesPatch = ({ node, properties, resolvedFormattingFromStyl
|
|
|
188
190
|
ilvl: properties.numbering.level
|
|
189
191
|
}, numbering));
|
|
190
192
|
if (properties.listLevel === null) {
|
|
191
|
-
patch["numPr"] = { numId: properties.numbering.numId };
|
|
193
|
+
patch["numPr"] = paragraphNumberingAttr(paragraphNumberingReference({ numId: properties.numbering.numId }));
|
|
192
194
|
patch["numPrFromStyle"] = null;
|
|
193
195
|
}
|
|
194
196
|
}
|
|
195
|
-
else if (properties.listLevel !== void 0) {
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
numId,
|
|
197
|
+
else if (properties.listLevel !== void 0) if (properties.listLevel === null) {
|
|
198
|
+
patch["numPr"] = null;
|
|
199
|
+
Object.assign(patch, CLEARED_LIST_RENDERING_ATTRS);
|
|
200
|
+
} else {
|
|
201
|
+
const numId = paragraphNumberingReferenceId(readParagraphNumberingAttr(node.attrs["numPr"]) ?? void 0);
|
|
202
|
+
if (numId === void 0) {
|
|
203
|
+
patch["numPr"] = paragraphNumberingAttr({
|
|
204
|
+
kind: "levelOnly",
|
|
204
205
|
ilvl: properties.listLevel
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
}
|
|
206
|
+
});
|
|
207
|
+
Object.assign(patch, CLEARED_LIST_RENDERING_ATTRS);
|
|
208
|
+
} else Object.assign(patch, listLevelAttrPatch(attrs, {
|
|
209
|
+
numId,
|
|
210
|
+
ilvl: properties.listLevel
|
|
211
|
+
}, numbering));
|
|
211
212
|
}
|
|
212
213
|
if (properties.alignment !== void 0 && (styleChanged || (currentDirectAlignment ?? null) !== properties.alignment)) {
|
|
213
214
|
originalFormatting ??= {};
|
|
@@ -577,8 +578,8 @@ const formattingChangesForAuthoredFormatting = (authoredFormatting, formatting)
|
|
|
577
578
|
}
|
|
578
579
|
return changes;
|
|
579
580
|
};
|
|
580
|
-
const clearReplacementBackground = ({ tr, schema, from, to, mode, revisionIdSeed, author, date, initials, suggestionId = null, styleResolver }) => {
|
|
581
|
-
if (![schema.marks["highlight"], schema.marks["runShading"]].some((markType) => markType !== void 0 && tr.doc.rangeHasMark(from, to, markType))) return {
|
|
581
|
+
const clearReplacementBackground = ({ tr, schema, from, to, mode, replacementBackground, revisionIdSeed, author, date, initials, suggestionId = null, styleResolver }) => {
|
|
582
|
+
if (!(replacementBackground === "clear" && [schema.marks["highlight"], schema.marks["runShading"]].some((markType) => markType !== void 0 && tr.doc.rangeHasMark(from, to, markType)))) return {
|
|
582
583
|
type: "applied",
|
|
583
584
|
transaction: tr,
|
|
584
585
|
revisionIds: [],
|
|
@@ -1152,23 +1153,24 @@ const buildInsertedParagraphs = ({ item, schema, formattingFromStyle, mode, auth
|
|
|
1152
1153
|
ilvl: explicitNumbering.level
|
|
1153
1154
|
}, numbering));
|
|
1154
1155
|
if (listLevel === null) {
|
|
1155
|
-
attrs["numPr"] = { numId: explicitNumbering.numId };
|
|
1156
|
+
attrs["numPr"] = paragraphNumberingAttr(paragraphNumberingReference({ numId: explicitNumbering.numId }));
|
|
1156
1157
|
attrs["numPrFromStyle"] = null;
|
|
1157
1158
|
}
|
|
1158
1159
|
} else if (listLevel === null) {
|
|
1159
1160
|
attrs["numPr"] = null;
|
|
1160
1161
|
Object.assign(attrs, CLEARED_LIST_RENDERING_ATTRS);
|
|
1161
1162
|
} else if (typeof listLevel === "number") {
|
|
1162
|
-
const
|
|
1163
|
-
|
|
1164
|
-
|
|
1163
|
+
const numId = paragraphNumberingReferenceId(readParagraphNumberingAttr(Reflect.get(baseAttrs, "numPr")) ?? void 0);
|
|
1164
|
+
if (numId === void 0) {
|
|
1165
|
+
attrs["numPr"] = paragraphNumberingAttr({
|
|
1166
|
+
kind: "levelOnly",
|
|
1167
|
+
ilvl: listLevel
|
|
1168
|
+
});
|
|
1169
|
+
Object.assign(attrs, CLEARED_LIST_RENDERING_ATTRS);
|
|
1170
|
+
} else Object.assign(attrs, listLevelAttrPatch(operation.inheritFormatting === false ? {} : expectParagraphAttrs(item.blockNode), {
|
|
1165
1171
|
numId,
|
|
1166
1172
|
ilvl: listLevel
|
|
1167
1173
|
}, numbering));
|
|
1168
|
-
else {
|
|
1169
|
-
attrs["numPr"] = { ilvl: listLevel };
|
|
1170
|
-
Object.assign(attrs, CLEARED_LIST_RENDERING_ATTRS);
|
|
1171
|
-
}
|
|
1172
1174
|
}
|
|
1173
1175
|
}
|
|
1174
1176
|
if (formatsParagraph && operation.styleId !== void 0) {
|
|
@@ -1239,7 +1241,7 @@ const buildInsertedParagraphs = ({ item, schema, formattingFromStyle, mode, auth
|
|
|
1239
1241
|
nextRevisionId
|
|
1240
1242
|
};
|
|
1241
1243
|
};
|
|
1242
|
-
const applyFolioAIEditOperationsInternal = ({ view, snapshot, operations, mode = "tracked-changes", author = "AI", initials, createCommentId, revisionStamp, revisionIdSeed, wordDiff, wordDiffMode = "bounded", tableTemplates }) => {
|
|
1244
|
+
const applyFolioAIEditOperationsInternal = ({ view, snapshot, operations, mode = "tracked-changes", author = "AI", initials, createCommentId, revisionStamp, revisionIdSeed, wordDiff, wordDiffMode = "bounded", tableTemplates, replacementBackground = "clear" }) => {
|
|
1243
1245
|
const applied = [];
|
|
1244
1246
|
const skipped = [];
|
|
1245
1247
|
const normalizations = [];
|
|
@@ -1530,6 +1532,7 @@ const applyFolioAIEditOperationsInternal = ({ view, snapshot, operations, mode =
|
|
|
1530
1532
|
from: item.from,
|
|
1531
1533
|
to: item.to,
|
|
1532
1534
|
mode,
|
|
1535
|
+
replacementBackground,
|
|
1533
1536
|
revisionIdSeed: revisionIdBackgroundSeed,
|
|
1534
1537
|
author,
|
|
1535
1538
|
date,
|
|
@@ -1657,6 +1660,7 @@ const applyFolioAIEditOperationsInternal = ({ view, snapshot, operations, mode =
|
|
|
1657
1660
|
from: item.from,
|
|
1658
1661
|
to: item.to,
|
|
1659
1662
|
mode,
|
|
1663
|
+
replacementBackground,
|
|
1660
1664
|
revisionIdSeed: revisionIdBackgroundSeed,
|
|
1661
1665
|
author,
|
|
1662
1666
|
date,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { document_d_exports } from "../types/document.js";
|
|
2
2
|
import { FolioTableTemplates } from "./table-template.js";
|
|
3
3
|
import { FolioAIBlock, FolioAIEditApplyMode, FolioAIEditApplyResult, FolioAIEditOperation, FolioAIEditSnapshot } from "./types.js";
|
|
4
|
-
import { FolioRevisionStamp, FolioWordDiffOptions } from "./apply.js";
|
|
4
|
+
import { FolioReplacementBackground, FolioRevisionStamp, FolioWordDiffOptions } from "./apply.js";
|
|
5
5
|
import { ImportReferencedStyleDefinitionsResult } from "../compare/style-resources.js";
|
|
6
6
|
import { InlineProvenanceTargetOptions } from "../compare/inline-provenance.js";
|
|
7
7
|
import { MatchInlineAtomsOptions } from "../compare/inline-atoms.js";
|
|
@@ -124,6 +124,13 @@ type FolioApplyDocumentOperationsToStoryOptions = FolioApplyDocumentOperationsOp
|
|
|
124
124
|
* every table, row and cell property on the way.
|
|
125
125
|
*/
|
|
126
126
|
tableTemplates?: FolioTableTemplates;
|
|
127
|
+
/**
|
|
128
|
+
* What a replacement in the batch does with a highlight or `w:shd` the text
|
|
129
|
+
* it replaces carries. Clearing it is the authoring default; a caller that
|
|
130
|
+
* states the replacement's own run properties — `compareDocx` reproducing
|
|
131
|
+
* the target document — keeps them instead.
|
|
132
|
+
*/
|
|
133
|
+
replacementBackground?: FolioReplacementBackground;
|
|
127
134
|
};
|
|
128
135
|
type FolioHeaderFooterStoryHandle = Extract<FolioEditableDocumentStoryHandle, {
|
|
129
136
|
type: "header" | "footer";
|
|
@@ -382,7 +389,7 @@ declare class FolioDocxReviewer {
|
|
|
382
389
|
*/
|
|
383
390
|
applyDocumentOperations(batch: FolioDocumentOperationBatch, options?: FolioApplyDocumentOperationsOptions): FolioDocumentOperationResult;
|
|
384
391
|
/** Apply a versioned operation batch to one editable document story. */
|
|
385
|
-
applyDocumentOperationsToStory({ story, batch, snapshot, revisionStamp, wordDiff, tableTemplates }: FolioApplyDocumentOperationsToStoryOptions): FolioDocumentOperationResult;
|
|
392
|
+
applyDocumentOperationsToStory({ story, batch, snapshot, revisionStamp, wordDiff, tableTemplates, replacementBackground }: FolioApplyDocumentOperationsToStoryOptions): FolioDocumentOperationResult;
|
|
386
393
|
private applyDocumentOperationsInternal;
|
|
387
394
|
/** Undo the latest unchanged document-operation batch and its created comments. */
|
|
388
395
|
undoDocumentOperations(undoHandle: FolioDocumentOperationUndoHandle): FolioDocumentOperationUndoResult;
|
|
@@ -35,9 +35,9 @@ import { createFolioAIEditSnapshotWithStyleResolver, detachFolioAIEditSnapshotEx
|
|
|
35
35
|
import { matchTableGeometry } from "./table-geometry.js";
|
|
36
36
|
import { tableTemplateCanCrossPackageLosslessly } from "./table-template.js";
|
|
37
37
|
import { TaggedError, panic } from "better-result";
|
|
38
|
+
import { REVIEW_CARRIERS } from "@stll/docx-core/model";
|
|
38
39
|
import { Fragment } from "prosemirror-model";
|
|
39
40
|
import { EditorState } from "prosemirror-state";
|
|
40
|
-
import { REVIEW_CARRIERS } from "@stll/docx-core/model";
|
|
41
41
|
import JSZip from "jszip";
|
|
42
42
|
//#region src/ai-edits/headless.ts
|
|
43
43
|
/**
|
|
@@ -782,7 +782,7 @@ var FolioDocxReviewer = class FolioDocxReviewer {
|
|
|
782
782
|
});
|
|
783
783
|
}
|
|
784
784
|
/** Apply a versioned operation batch to one editable document story. */
|
|
785
|
-
applyDocumentOperationsToStory({ story, batch, snapshot, revisionStamp, wordDiff, tableTemplates }) {
|
|
785
|
+
applyDocumentOperationsToStory({ story, batch, snapshot, revisionStamp, wordDiff, tableTemplates, replacementBackground }) {
|
|
786
786
|
return this.applyDocumentOperationsInternal({
|
|
787
787
|
story,
|
|
788
788
|
batch,
|
|
@@ -790,10 +790,11 @@ var FolioDocxReviewer = class FolioDocxReviewer {
|
|
|
790
790
|
...revisionStamp !== void 0 && { revisionStamp },
|
|
791
791
|
...wordDiff !== void 0 && { wordDiff },
|
|
792
792
|
...tableTemplates !== void 0 && { tableTemplates },
|
|
793
|
+
...replacementBackground !== void 0 && { replacementBackground },
|
|
793
794
|
createUndoEntry: true
|
|
794
795
|
});
|
|
795
796
|
}
|
|
796
|
-
applyDocumentOperationsInternal({ story, batch, snapshot, revisionStamp, wordDiff, tableTemplates, createUndoEntry }) {
|
|
797
|
+
applyDocumentOperationsInternal({ story, batch, snapshot, revisionStamp, wordDiff, tableTemplates, replacementBackground, createUndoEntry }) {
|
|
797
798
|
const beforeState = this.requireEditableStoryState(story);
|
|
798
799
|
const createdCommentsLengthBefore = this.createdComments.length;
|
|
799
800
|
const view = {
|
|
@@ -811,6 +812,7 @@ var FolioDocxReviewer = class FolioDocxReviewer {
|
|
|
811
812
|
...revisionStamp !== void 0 && { revisionStamp },
|
|
812
813
|
...wordDiff !== void 0 && { wordDiff },
|
|
813
814
|
...tableTemplates !== void 0 && { tableTemplates },
|
|
815
|
+
...replacementBackground !== void 0 && { replacementBackground },
|
|
814
816
|
createCommentId: (text) => {
|
|
815
817
|
const comment = createReviewerComment(this.nextCommentId(), text, this.author);
|
|
816
818
|
this.createdComments.push(comment);
|
package/dist/ai-edits/read.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ declare const FOLIO_REVIEW_CHANGE_KINDS: Readonly<{
|
|
|
25
25
|
readonly paragraphPropertiesChanged: "paragraphPropertiesChanged";
|
|
26
26
|
readonly sectionPropertiesChanged: "sectionPropertiesChanged";
|
|
27
27
|
readonly tablePropertiesChanged: "tablePropertiesChanged";
|
|
28
|
+
readonly tablePropertyExceptionsChanged: "tablePropertyExceptionsChanged";
|
|
28
29
|
readonly rowPropertiesChanged: "rowPropertiesChanged";
|
|
29
30
|
readonly cellPropertiesChanged: "cellPropertiesChanged";
|
|
30
31
|
}>;
|
package/dist/ai-edits/read.js
CHANGED
|
@@ -26,6 +26,7 @@ const FOLIO_REVIEW_CHANGE_KINDS = Object.freeze({
|
|
|
26
26
|
paragraphPropertiesChanged: "paragraphPropertiesChanged",
|
|
27
27
|
sectionPropertiesChanged: "sectionPropertiesChanged",
|
|
28
28
|
tablePropertiesChanged: "tablePropertiesChanged",
|
|
29
|
+
tablePropertyExceptionsChanged: "tablePropertyExceptionsChanged",
|
|
29
30
|
rowPropertiesChanged: "rowPropertiesChanged",
|
|
30
31
|
cellPropertiesChanged: "cellPropertiesChanged"
|
|
31
32
|
});
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { EMPTY_BUILT_IN_STYLE_INDEX, resolveHeadingLevel } from "../docx/builtInStyles.js";
|
|
2
|
+
import { resolveParagraphNumbering } from "../docx/numberingReference.js";
|
|
2
3
|
import { recreateProseNodeWithParagraphPropertySource } from "../docx/paragraphPropertySource.js";
|
|
3
4
|
import { expectCharacterStyleMarkAttrs, expectHyperlinkMarkAttrs, expectParagraphAttrs, expectRunFormattingOverrideMarkAttrs } from "../prosemirror/attrs/index.js";
|
|
4
5
|
import { marksToTextFormatting } from "../prosemirror/conversion/fromProseDoc.js";
|
|
6
|
+
import { paragraphNumberingAttr, readParagraphNumberingAttr } from "../prosemirror/numberingAttr.js";
|
|
7
|
+
import { readOutlineLevelAttr } from "../prosemirror/outlineLevelAttr.js";
|
|
5
8
|
import { directParagraphAlignment } from "../prosemirror/paragraphAlignment.js";
|
|
6
9
|
import { directParagraphIndentation } from "../prosemirror/paragraphIndentation.js";
|
|
7
10
|
import { directParagraphSpacing } from "../prosemirror/paragraphSpacing.js";
|
|
@@ -34,18 +37,16 @@ const remapFolioAIEditSnapshotNumberingReferences = (snapshot, numIdMap) => {
|
|
|
34
37
|
if (numIdMap.size === 0) return snapshot;
|
|
35
38
|
const metadata = metadataOf(snapshot);
|
|
36
39
|
const remapNode = (node) => {
|
|
37
|
-
const numPr = node.attrs["numPr"];
|
|
38
|
-
if (
|
|
39
|
-
const
|
|
40
|
-
if (typeof numId !== "number") return node;
|
|
41
|
-
const remappedNumId = numIdMap.get(numId);
|
|
40
|
+
const numPr = readParagraphNumberingAttr(node.attrs["numPr"]);
|
|
41
|
+
if (numPr?.kind !== "reference") return node;
|
|
42
|
+
const remappedNumId = numIdMap.get(numPr.numId);
|
|
42
43
|
if (remappedNumId === void 0) return node;
|
|
43
44
|
return recreateProseNodeWithParagraphPropertySource(node, { attrs: {
|
|
44
45
|
...node.attrs,
|
|
45
|
-
numPr: {
|
|
46
|
+
numPr: paragraphNumberingAttr({
|
|
46
47
|
...numPr,
|
|
47
48
|
numId: remappedNumId
|
|
48
|
-
}
|
|
49
|
+
})
|
|
49
50
|
} });
|
|
50
51
|
};
|
|
51
52
|
const remapped = remapDocument(metadata.sourceDocument, remapNode);
|
|
@@ -481,10 +482,9 @@ const getBlockKind = (node, headingLevel) => {
|
|
|
481
482
|
};
|
|
482
483
|
/** The block's 1-based heading level, as {@link resolveHeadingLevel} classifies it. */
|
|
483
484
|
const getHeadingLevel = (node, styles) => {
|
|
484
|
-
const outlineLevel = node.attrs["outlineLevel"];
|
|
485
485
|
const styleId = node.attrs["styleId"];
|
|
486
486
|
const level = resolveHeadingLevel({
|
|
487
|
-
outlineLevel:
|
|
487
|
+
outlineLevel: readOutlineLevelAttr(node.attrs["outlineLevel"]),
|
|
488
488
|
styleId: typeof styleId === "string" ? styleId : null
|
|
489
489
|
}, styles);
|
|
490
490
|
return level === void 0 ? void 0 : level + 1;
|
|
@@ -495,30 +495,35 @@ const getDisplayLabel = (node, isHeading) => {
|
|
|
495
495
|
const styleId = node.attrs["styleId"];
|
|
496
496
|
if (isHeading && typeof styleId === "string") return styleId;
|
|
497
497
|
};
|
|
498
|
+
/**
|
|
499
|
+
* The level the paragraph's `<w:numPr>` states, and only that. An absent
|
|
500
|
+
* `w:ilvl` renders as level zero but is not a stated zero, and a caller that
|
|
501
|
+
* writes it back would turn an untouched paragraph into one stating a level
|
|
502
|
+
* its source never did.
|
|
503
|
+
*/
|
|
498
504
|
const getListLevel = (node) => {
|
|
499
|
-
const numPr = node.attrs["numPr"];
|
|
500
|
-
|
|
501
|
-
const { ilvl } = numPr;
|
|
502
|
-
return typeof ilvl === "number" && Number.isInteger(ilvl) && ilvl >= 0 ? ilvl : void 0;
|
|
505
|
+
const numPr = readParagraphNumberingAttr(node.attrs["numPr"]);
|
|
506
|
+
return numPr === null || numPr.kind === "none" ? void 0 : numPr.ilvl;
|
|
503
507
|
};
|
|
508
|
+
/**
|
|
509
|
+
* The numbering a paragraph attr states, read through the model's own reader.
|
|
510
|
+
*
|
|
511
|
+
* The two functions below used to test the reserved id relationally
|
|
512
|
+
* (`numId > 0`, `numId <= 0`), which is the one spelling that disagreed with
|
|
513
|
+
* the other four: a malformed package's negative id is a dangling reference
|
|
514
|
+
* everywhere else and "not numbered" here.
|
|
515
|
+
*/
|
|
516
|
+
const statedNumbering = (node) => resolveParagraphNumbering(readParagraphNumberingAttr(node.attrs["numPr"]) ?? void 0);
|
|
504
517
|
const getListReference = (node) => {
|
|
505
|
-
const
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
return typeof numId === "number" && Number.isInteger(numId) && numId > 0 && typeof level === "number" && Number.isInteger(level) && level >= 0 ? {
|
|
510
|
-
numId,
|
|
511
|
-
level
|
|
518
|
+
const numbering = statedNumbering(node);
|
|
519
|
+
return numbering.kind === "reference" ? {
|
|
520
|
+
numId: numbering.numId,
|
|
521
|
+
level: numbering.ilvl
|
|
512
522
|
} : void 0;
|
|
513
523
|
};
|
|
514
524
|
const getNumberingReferenceKey = (node) => {
|
|
515
|
-
const
|
|
516
|
-
|
|
517
|
-
const { numId } = numPr;
|
|
518
|
-
if (typeof numId !== "number" || !Number.isInteger(numId) || numId <= 0) return null;
|
|
519
|
-
const level = "ilvl" in numPr ? numPr.ilvl : void 0;
|
|
520
|
-
if (level !== void 0 && (typeof level !== "number" || !Number.isInteger(level) || level < 0)) return null;
|
|
521
|
-
return `${String(numId)}:${String(level ?? 0)}`;
|
|
525
|
+
const numbering = statedNumbering(node);
|
|
526
|
+
return numbering.kind === "reference" ? `${String(numbering.numId)}:${String(numbering.ilvl)}` : null;
|
|
522
527
|
};
|
|
523
528
|
const getStyleId = (node) => {
|
|
524
529
|
const styleId = node.attrs["styleId"];
|
|
@@ -51,7 +51,11 @@ const mergeTableRectangle = ({ tr, tablePosition, table, rectangle }) => {
|
|
|
51
51
|
rowspan: rectangle.bottom - rectangle.top,
|
|
52
52
|
colwidth: nextColwidth,
|
|
53
53
|
width: preferredWidth.type === "value" ? preferredWidth.width : null,
|
|
54
|
-
widthType: preferredWidth.type === "value" ? preferredWidth.widthType : null
|
|
54
|
+
widthType: preferredWidth.type === "value" ? preferredWidth.widthType : null,
|
|
55
|
+
_authoredWidth: preferredWidth.type === "value" ? {
|
|
56
|
+
value: preferredWidth.width,
|
|
57
|
+
type: preferredWidth.widthType
|
|
58
|
+
} : null
|
|
55
59
|
});
|
|
56
60
|
if (appendedContent.size > 0) {
|
|
57
61
|
const contentEnd = absoluteMergedPosition + 1 + merged.cell.content.size;
|
|
@@ -74,16 +78,20 @@ const mergeTopRowColwidths = (cells, mergedColspan) => {
|
|
|
74
78
|
* preferred widths; retaining only the first cell's width makes a 50%+50%
|
|
75
79
|
* bilingual row serialize as a 50%-wide spanning cell. Mixed/implicit units
|
|
76
80
|
* cannot be composed safely, so clear the preference and let the table grid
|
|
77
|
-
* define the merged width.
|
|
81
|
+
* define the merged width.
|
|
82
|
+
*
|
|
83
|
+
* The summands are `_authoredWidth`, not the rendered `width`: a cell that
|
|
84
|
+
* states no preferred width still renders at the width the table grid
|
|
85
|
+
* resolved, and summing those would give the merged cell a `w:tcW` no source
|
|
86
|
+
* cell wrote. */
|
|
78
87
|
const mergeTopRowPreferredWidths = (cells) => {
|
|
79
88
|
let width = 0;
|
|
80
89
|
let widthType;
|
|
81
90
|
for (const cell of cells) {
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
widthType = candidateType;
|
|
91
|
+
const stated = expectTableCellAttrs(cell)._authoredWidth;
|
|
92
|
+
if (stated === void 0 || !Number.isFinite(stated.value) || stated.type !== "dxa" && stated.type !== "pct" || widthType !== void 0 && stated.type !== widthType) return { type: "absent" };
|
|
93
|
+
width += stated.value;
|
|
94
|
+
widthType = stated.type;
|
|
87
95
|
}
|
|
88
96
|
return widthType === void 0 ? { type: "absent" } : {
|
|
89
97
|
type: "value",
|
|
@@ -80,21 +80,24 @@ const TABLE_SCOPE = {
|
|
|
80
80
|
changeAttr: "tblPrChange",
|
|
81
81
|
changeType: "tablePropertyChange"
|
|
82
82
|
};
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
83
|
+
const GEOMETRY_SCOPES = {
|
|
84
|
+
tablePropertyChange: TABLE_SCOPE,
|
|
85
|
+
tableRowPropertyChange: {
|
|
86
|
+
keys: ROW_SCOPED_ATTRS,
|
|
87
|
+
signatureOf: (node) => scopedValues(node.attrs, ROW_SCOPED_ATTRS),
|
|
88
|
+
formattingOf: (node) => tableRowAttrsToFormatting(node.attrs),
|
|
89
|
+
rejectPatch: (previousFormatting) => tableRowRejectAttrPatch(previousFormatting),
|
|
90
|
+
changeAttr: "trPrChange",
|
|
91
|
+
changeType: "tableRowPropertyChange"
|
|
92
|
+
},
|
|
93
|
+
tableCellPropertyChange: {
|
|
94
|
+
keys: CELL_SCOPED_ATTRS,
|
|
95
|
+
signatureOf: (node) => scopedValues(node.attrs, CELL_SCOPED_ATTRS),
|
|
96
|
+
formattingOf: (node) => tableCellAttrsToFormatting(cellAttrsOf(node)),
|
|
97
|
+
rejectPatch: (previousFormatting, liveFormatting) => tableCellRejectAttrPatch(previousFormatting, liveFormatting),
|
|
98
|
+
changeAttr: "tcPrChange",
|
|
99
|
+
changeType: "tableCellPropertyChange"
|
|
100
|
+
}
|
|
98
101
|
};
|
|
99
102
|
const scopedValues = (attrs, keys) => canonicalJson(scopedAttrs(attrs, keys));
|
|
100
103
|
/**
|
|
@@ -200,9 +203,9 @@ const matchTableGeometry = ({ tr, baseTables, targetTables, pairings, revision }
|
|
|
200
203
|
const targetCell = targetRow.maybeChild(target.cellIndex);
|
|
201
204
|
const cellPosition = childPositions(baseRow, rowPosition)[base.cellIndex];
|
|
202
205
|
if (!baseCell || !targetCell || cellPosition === void 0) continue;
|
|
203
|
-
consider(baseTable.node, targetTable, baseTable.start,
|
|
204
|
-
consider(baseRow, targetRow, rowPosition,
|
|
205
|
-
consider(baseCell, targetCell, cellPosition,
|
|
206
|
+
consider(baseTable.node, targetTable, baseTable.start, GEOMETRY_SCOPES.tablePropertyChange);
|
|
207
|
+
consider(baseRow, targetRow, rowPosition, GEOMETRY_SCOPES.tableRowPropertyChange);
|
|
208
|
+
consider(baseCell, targetCell, cellPosition, GEOMETRY_SCOPES.tableCellPropertyChange);
|
|
206
209
|
}
|
|
207
210
|
let revisionId = revision.idSeed;
|
|
208
211
|
for (const target of targets) {
|
|
@@ -70,7 +70,6 @@ const CLEARED_PARAGRAPH_ATTRS = [
|
|
|
70
70
|
"pPrMark",
|
|
71
71
|
"_suggestedInsert",
|
|
72
72
|
"_sectionProperties",
|
|
73
|
-
"sectionBreakType",
|
|
74
73
|
"renderedPageBreakBefore"
|
|
75
74
|
];
|
|
76
75
|
/** Table, row and cell attrs that record the other document's revisions. */
|
|
@@ -78,7 +77,8 @@ const CLEARED_TABLE_ATTRS = ["tblPrChange", "_suggestedInsert"];
|
|
|
78
77
|
const CLEARED_ROW_ATTRS = [
|
|
79
78
|
"trIns",
|
|
80
79
|
"trDel",
|
|
81
|
-
"trPrChange"
|
|
80
|
+
"trPrChange",
|
|
81
|
+
"tblPrExChange"
|
|
82
82
|
];
|
|
83
83
|
const CLEARED_CELL_ATTRS = ["cellMarker", "tcPrChange"];
|
|
84
84
|
const hasAuthoredValue = (value) => {
|
package/dist/compare/compare.js
CHANGED
|
@@ -573,7 +573,8 @@ const applyComparison = ({ reviewer, revisionStamp, granularity, revisionFormat,
|
|
|
573
573
|
mode: "tracked-changes",
|
|
574
574
|
operations: plan.operations
|
|
575
575
|
},
|
|
576
|
-
tableTemplates: resolveTableTemplates(targetTables, plan.tableTemplates)
|
|
576
|
+
tableTemplates: resolveTableTemplates(targetTables, plan.tableTemplates),
|
|
577
|
+
replacementBackground: "keep"
|
|
577
578
|
});
|
|
578
579
|
if (nextRevisionId === void 0) panic("The applier did not report where it left the revision-id counter", { story: pair.baseStory });
|
|
579
580
|
idSeed = nextRevisionId;
|