@stll/folio-core 0.67.0 → 0.69.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.d.ts +9 -1
- package/dist/ai-edits/apply.js +94 -8
- package/dist/ai-edits/headless.d.ts +36 -21
- package/dist/ai-edits/headless.js +106 -36
- package/dist/ai-edits/index.d.ts +2 -2
- package/dist/ai-edits/newListNumbering.d.ts +14 -1
- package/dist/ai-edits/newListNumbering.js +24 -1
- package/dist/ai-edits/note-references.d.ts +6 -0
- package/dist/ai-edits/note-references.js +7 -1
- package/dist/ai-edits/pending-suggestions.js +2 -2
- package/dist/ai-edits/read.d.ts +19 -0
- package/dist/ai-edits/snapshot.d.ts +6 -0
- package/dist/ai-edits/snapshot.js +8 -3
- package/dist/ai-edits/types.d.ts +9 -1
- package/dist/ai-suggestions/apply.js +13 -4
- package/dist/compare/compare.js +2 -1
- package/dist/compare/inserted-resource-snapshot.d.ts +4 -1
- package/dist/compare/inserted-resource-snapshot.js +7 -3
- package/dist/controller/canonicalClipboard.js +31 -14
- package/dist/controller/canonicalComposition.js +35 -6
- package/dist/controller/canonicalInlineProjection.d.ts +35 -10
- package/dist/controller/canonicalInlineProjection.js +192 -28
- package/dist/controller/canonicalInput.d.ts +2 -1
- package/dist/controller/canonicalInput.js +32 -7
- package/dist/controller/canonicalListRendering.d.ts +2 -1
- package/dist/controller/canonicalListRendering.js +1 -1
- package/dist/controller/canonicalLockGuard.d.ts +23 -0
- package/dist/controller/canonicalLockGuard.js +133 -0
- package/dist/controller/canonicalProjectionBlocks.d.ts +79 -0
- package/dist/controller/canonicalProjectionBlocks.js +75 -0
- package/dist/controller/canonicalPublicOperations.d.ts +12 -4
- package/dist/controller/canonicalPublicOperations.js +676 -46
- package/dist/controller/canonicalSeedContent.d.ts +12 -0
- package/dist/controller/canonicalSeedContent.js +131 -0
- package/dist/controller/canonicalSession.d.ts +133 -21
- package/dist/controller/canonicalSession.js +738 -205
- package/dist/controller/canonicalSourceNormalization.d.ts +21 -0
- package/dist/controller/canonicalSourceNormalization.js +148 -0
- package/dist/controller/canonicalStoryEditor.d.ts +4 -3
- package/dist/controller/canonicalStoryEditor.js +20 -15
- package/dist/controller/canonicalStructure.d.ts +2 -1
- package/dist/controller/canonicalStructure.js +129 -7
- package/dist/controller/contentControlWidgetController.d.ts +5 -0
- package/dist/controller/contentControlWidgetController.js +13 -1
- package/dist/controller/folioEditor.js +4 -0
- package/dist/controller/headerFooterEditorManager.d.ts +7 -2
- package/dist/controller/headerFooterEditorManager.js +11 -6
- package/dist/controller/hiddenEditorApi.d.ts +17 -2
- package/dist/controller/hiddenEditorApi.js +4 -0
- package/dist/controller/hiddenEditorManager.d.ts +11 -3
- package/dist/controller/hiddenEditorManager.js +157 -48
- package/dist/controller/layoutPipeline.js +50 -16
- package/dist/controller/layoutSession.d.ts +3 -0
- package/dist/controller/layoutSession.js +3 -1
- package/dist/controller/noteEditorManager.d.ts +7 -2
- package/dist/controller/noteEditorManager.js +11 -6
- package/dist/display-list/build/pageFurniture.js +41 -19
- package/dist/display-list/build/tablePrimitives.js +23 -4
- package/dist/display-list/dom/renderDisplayListToDom.js +13 -11
- package/dist/document-operations.d.ts +9 -1
- package/dist/document-operations.js +4 -3
- package/dist/docx/blockContentParser.d.ts +7 -3
- package/dist/docx/blockContentParser.js +2 -3
- package/dist/docx/blockPlainText.js +2 -0
- package/dist/docx/bookmarkRangeJoin.d.ts +6 -0
- package/dist/docx/bookmarkRangeJoin.js +43 -0
- package/dist/docx/canonicalSave.js +11 -2
- package/dist/docx/canonicalSessionInput.d.ts +5 -1
- package/dist/docx/canonicalSessionInput.js +7 -2
- package/dist/docx/commentAnchorIndex.d.ts +40 -5
- package/dist/docx/commentAnchorIndex.js +94 -12
- package/dist/docx/commentRangeIntegrity.js +30 -24
- package/dist/docx/commentRangeJoin.d.ts +4 -0
- package/dist/docx/commentRangeJoin.js +26 -12
- package/dist/docx/commentReferenceCompletion.js +5 -4
- package/dist/docx/commentReferenceNormalization.js +40 -18
- package/dist/docx/compatibility.js +9 -2
- package/dist/docx/containerChildren.js +22 -1
- package/dist/docx/contentTypeRegistry.js +1 -1
- package/dist/docx/encryption/compoundFile.js +9 -1
- package/dist/docx/encryption/encryptionInfo.js +16 -2
- package/dist/docx/ensureParaIds.js +46 -7
- package/dist/docx/ensureUniqueControlIds.d.ts +25 -0
- package/dist/docx/ensureUniqueControlIds.js +110 -0
- package/dist/docx/headerFooterVerbatim.d.ts +7 -0
- package/dist/docx/headerFooterVerbatim.js +13 -2
- package/dist/docx/hostCommentThreads.d.ts +27 -0
- package/dist/docx/hostCommentThreads.js +72 -0
- package/dist/docx/hyperlinkParser.js +9 -2
- package/dist/docx/inlineWrapperContent.d.ts +8 -1
- package/dist/docx/inlineWrapperContent.js +9 -2
- package/dist/docx/listMarkerComputation.d.ts +35 -1
- package/dist/docx/listMarkerComputation.js +39 -1
- package/dist/docx/listModelNormalization.d.ts +44 -1
- package/dist/docx/listModelNormalization.js +226 -96
- package/dist/docx/listNumberingInstances.d.ts +1 -1
- package/dist/docx/listNumberingInstances.js +2 -2
- package/dist/docx/markupRangeMarker.d.ts +14 -0
- package/dist/docx/markupRangeMarker.js +15 -1
- package/dist/docx/metadataPrivacy.js +43 -22
- package/dist/docx/normalizeBaseDirection.js +3 -1
- package/dist/docx/numberingIds.d.ts +6 -0
- package/dist/docx/numberingIds.js +6 -1
- package/dist/docx/numberingReferenceNormalization.d.ts +4 -0
- package/dist/docx/numberingReferenceNormalization.js +12 -2
- package/dist/docx/paragraphParser.js +159 -48
- package/dist/docx/paragraphPropertySource.d.ts +29 -0
- package/dist/docx/paragraphPropertySource.js +106 -16
- package/dist/docx/paragraphTextBoxEnrichment.js +2 -1
- package/dist/docx/paragraphTraversal.js +2 -0
- package/dist/docx/parseWarningMessage.js +2 -1
- package/dist/docx/parser.js +8 -0
- package/dist/docx/removeHeaderFooterParts.js +1 -1
- package/dist/docx/renderedPageBreakNormalization.js +1 -1
- package/dist/docx/reviewProvenanceDiagnostics.d.ts +7 -0
- package/dist/docx/reviewProvenanceDiagnostics.js +39 -0
- package/dist/docx/reviewResolutionProvenance.d.ts +29 -3
- package/dist/docx/reviewResolutionProvenance.js +171 -33
- package/dist/docx/rezip.d.ts +6 -0
- package/dist/docx/rezip.js +38 -21
- package/dist/docx/selectiveSave.js +6 -10
- package/dist/docx/selectiveXmlPatch.d.ts +5 -4
- package/dist/docx/selectiveXmlPatch.js +11 -7
- package/dist/docx/serializer/documentSerializer.js +5 -2
- package/dist/docx/serializer/headerFooterSerializer.js +3 -1
- package/dist/docx/serializer/markupRangeAttributes.d.ts +6 -1
- package/dist/docx/serializer/markupRangeAttributes.js +6 -1
- package/dist/docx/serializer/noteSerializer.d.ts +17 -4
- package/dist/docx/serializer/noteSerializer.js +23 -16
- package/dist/docx/serializer/paragraphSerializer.js +56 -12
- package/dist/docx/serializer/partNamespaces.d.ts +1 -1
- package/dist/docx/serializer/partNamespaces.js +1 -1
- package/dist/docx/serializer/runSerializer.d.ts +1 -3
- package/dist/docx/serializer/runSerializer.js +2 -2
- package/dist/docx/serializer/tableSerializer.d.ts +4 -0
- package/dist/docx/serializer/tableSerializer.js +4 -2
- package/dist/docx/server/applyDocxXmlPatchProposal.js +8 -4
- package/dist/docx/server/build.d.ts +1 -1
- package/dist/docx/server/createBilingualDocument.js +27 -5
- package/dist/docx/server/migrateYjsAttrSchema.js +4 -0
- package/dist/docx/sessionListPruning.d.ts +2 -0
- package/dist/docx/sessionListPruning.js +50 -0
- package/dist/docx/splitRevisionPieces.d.ts +10 -0
- package/dist/docx/splitRevisionPieces.js +14 -0
- package/dist/docx/storyBlockReplay.js +19 -2
- package/dist/docx/structuralXmlPatch.js +44 -11
- package/dist/docx/tableParser.d.ts +6 -2
- package/dist/docx/tableParser.js +2 -3
- package/dist/docx/textBoxContentParser.d.ts +11 -0
- package/dist/docx/textBoxContentParser.js +51 -0
- package/dist/docx/textBoxParser.d.ts +0 -5
- package/dist/docx/textBoxParser.js +1 -23
- package/dist/docx/verticalMergeProjection.js +1 -1
- package/dist/docx/xmlParser.d.ts +1 -1
- package/dist/docx/xmlParser.js +2 -3
- package/dist/fonts/fontsourceFaces.d.ts +2 -8
- package/dist/fonts/fontsourceFaces.js +1 -7
- package/dist/i18n/messages/ar.gen.js +3 -0
- package/dist/i18n/messages/catalogs.gen.d.ts +51 -0
- package/dist/i18n/messages/catalogs.gen.js +51 -0
- package/dist/i18n/messages/cs.gen.js +3 -0
- package/dist/i18n/messages/de.gen.js +3 -0
- package/dist/i18n/messages/en.gen.js +3 -0
- package/dist/i18n/messages/es.gen.js +3 -0
- package/dist/i18n/messages/et.gen.js +3 -0
- package/dist/i18n/messages/fr.gen.js +3 -0
- package/dist/i18n/messages/he.gen.js +3 -0
- package/dist/i18n/messages/hi.gen.js +3 -0
- package/dist/i18n/messages/hu.gen.js +3 -0
- package/dist/i18n/messages/lt.gen.js +3 -0
- package/dist/i18n/messages/lv.gen.js +3 -0
- package/dist/i18n/messages/messages.gen.d.ts +3 -0
- package/dist/i18n/messages/pl.gen.js +3 -0
- package/dist/i18n/messages/pt-BR.gen.js +3 -0
- package/dist/i18n/messages/sk.gen.js +3 -0
- package/dist/i18n/messages/tr.gen.js +3 -0
- package/dist/i18n/messages/zh-CN.gen.js +3 -0
- package/dist/internal/acceptedBlockProjection.js +2 -0
- package/dist/internal/pageBreakRunDescendantIndex.d.ts +7 -2
- package/dist/internal/pageBreakRunDescendantIndex.js +12 -3
- package/dist/internal/pageBreakRunSourceDescendantIndex.d.ts +5 -0
- package/dist/internal/pageBreakRunSourceDescendantIndex.js +5 -0
- package/dist/internal/revisionResolutionInline.js +1 -2
- package/dist/internal/subtreeHolds.d.ts +12 -0
- package/dist/internal/subtreeHolds.js +25 -0
- package/dist/internal/wholeStoryRevisionResolution.js +1 -1
- package/dist/layout-bridge/cellSelectionHighlight.js +3 -3
- package/dist/layout-bridge/convert/flowBlockPostprocessing.js +20 -12
- package/dist/layout-bridge/convert/flowConversionShared.d.ts +15 -1
- package/dist/layout-bridge/convert/flowConversionShared.js +9 -1
- package/dist/layout-bridge/convert/paragraphAttrs.d.ts +15 -4
- package/dist/layout-bridge/convert/paragraphAttrs.js +11 -4
- package/dist/layout-bridge/convert/paragraphBlockCache.d.ts +26 -0
- package/dist/layout-bridge/convert/paragraphBlockCache.js +137 -0
- package/dist/layout-bridge/convert/paragraphConversion.d.ts +12 -2
- package/dist/layout-bridge/convert/paragraphConversion.js +37 -5
- package/dist/layout-bridge/convert/paragraphRuns.d.ts +2 -2
- package/dist/layout-bridge/convert/sectionBoundaries.js +16 -0
- package/dist/layout-bridge/convert/tableConversion.js +19 -8
- package/dist/layout-bridge/convert/toFlowBlocks.js +144 -15
- package/dist/layout-bridge/convert/topLevelConversion.d.ts +74 -0
- package/dist/layout-bridge/convert/topLevelConversion.js +109 -0
- package/dist/layout-bridge/dom/clickToPositionDom.js +41 -40
- package/dist/layout-bridge/dom/findBodyPmSpans.js +4 -3
- package/dist/layout-bridge/dom/findHfPmSpans.js +10 -15
- package/dist/layout-bridge/dom/imeCaretAnchor.d.ts +8 -0
- package/dist/layout-bridge/dom/imeCaretAnchor.js +71 -7
- package/dist/layout-bridge/dom/textStreamDom.js +3 -2
- package/dist/layout-bridge/engine/blockIndex.d.ts +7 -0
- package/dist/layout-bridge/engine/blockIndex.js +12 -0
- package/dist/layout-bridge/engine/hitTest.js +9 -10
- package/dist/layout-bridge/engine/selectionRects.js +6 -6
- package/dist/layout-bridge/headerFooterLayout.js +12 -11
- package/dist/layout-bridge/tableInsertHover.js +2 -1
- package/dist/layout-engine/footnoteContinuation.d.ts +36 -0
- package/dist/layout-engine/footnoteContinuation.js +210 -0
- package/dist/layout-engine/index.d.ts +2 -2
- package/dist/layout-engine/index.js +7 -2
- package/dist/layout-engine/measure/cache.d.ts +2 -0
- package/dist/layout-engine/measure/cache.js +16 -6
- package/dist/layout-engine/measure/measureParagraph.js +1 -1
- package/dist/layout-engine/measure/paragraphKeyMemo.d.ts +8 -0
- package/dist/layout-engine/measure/paragraphKeyMemo.js +92 -0
- package/dist/layout-engine/tableLayout.js +29 -5
- package/dist/layout-engine/tableRowBreak.d.ts +36 -0
- package/dist/layout-engine/tableRowBreak.js +43 -1
- package/dist/layout-engine/types.d.ts +42 -1
- package/dist/layout-painter/imageLayout.js +2 -1
- package/dist/layout-painter/pageShellStyles.d.ts +10 -0
- package/dist/layout-painter/pageShellStyles.js +32 -0
- package/dist/layout-painter/reconcileRenderedContent.d.ts +19 -0
- package/dist/layout-painter/reconcileRenderedContent.js +117 -0
- package/dist/layout-painter/renderFragment.js +4 -6
- package/dist/layout-painter/renderImage.js +2 -2
- package/dist/layout-painter/renderPage.d.ts +4 -4
- package/dist/layout-painter/renderPage.js +54 -46
- package/dist/layout-painter/renderParagraph.js +3 -3
- package/dist/layout-painter/renderTable.js +16 -16
- package/dist/layout-painter/renderTextBox.js +2 -2
- package/dist/layout-painter/sdtBoundary.js +3 -2
- package/dist/managers/AutoSaveManager.d.ts +5 -1
- package/dist/managers/FindReplaceManager.js +3 -10
- package/dist/markdown/escape.d.ts +20 -1
- package/dist/markdown/escape.js +43 -1
- package/dist/markdown/renderBlock.js +4 -1
- package/dist/markdown/renderParagraph.js +13 -27
- package/dist/markdown/renderTable.js +6 -2
- package/dist/markdown/trailers.js +1 -0
- package/dist/paged-layout/blockGeometry.js +3 -2
- package/dist/paged-layout/editorScrollRoot.d.ts +9 -0
- package/dist/paged-layout/editorScrollRoot.js +10 -1
- package/dist/paged-layout/rangeProjection.js +5 -4
- package/dist/paged-layout/scrollToPmPosition.js +3 -3
- package/dist/paged-layout/selectionViewportRect.d.ts +6 -0
- package/dist/paged-layout/selectionViewportRect.js +8 -2
- package/dist/pdf/images.d.ts +17 -1
- package/dist/pdf/images.js +22 -4
- package/dist/pdf/writePdf.js +4 -2
- package/dist/prosemirror/attrs/index.js +2 -0
- package/dist/prosemirror/canonicalCommands.d.ts +39 -1
- package/dist/prosemirror/canonicalTableCommands.d.ts +28 -0
- package/dist/prosemirror/canonicalTableCommands.js +362 -0
- package/dist/prosemirror/commands/comments.d.ts +30 -2
- package/dist/prosemirror/commands/comments.js +189 -18
- package/dist/prosemirror/commands/formatting.d.ts +1 -1
- package/dist/prosemirror/commands/index.d.ts +1 -1
- package/dist/prosemirror/commentIdAllocator.js +2 -2
- package/dist/prosemirror/commentRangeBoundaryAttrs.d.ts +6 -0
- package/dist/prosemirror/commentRangeBoundaryAttrs.js +9 -3
- package/dist/prosemirror/commentRecords.d.ts +137 -0
- package/dist/prosemirror/commentRecords.js +400 -0
- package/dist/prosemirror/commentReferenceIntegrity.js +3 -4
- package/dist/prosemirror/conversion/fromProseDoc.d.ts +2 -0
- package/dist/prosemirror/conversion/fromProseDoc.js +85 -34
- package/dist/prosemirror/conversion/index.d.ts +2 -2
- package/dist/prosemirror/conversion/toProseDoc.d.ts +140 -4
- package/dist/prosemirror/conversion/toProseDoc.js +432 -76
- package/dist/prosemirror/extensions/StarterKit.js +2 -0
- package/dist/prosemirror/extensions/core/DocExtension.js +1 -1
- package/dist/prosemirror/extensions/features/AutoBidiDetectionExtension.d.ts +1 -1
- package/dist/prosemirror/extensions/features/JoinedRunStyleExtension.d.ts +1 -1
- package/dist/prosemirror/extensions/features/ParaIdAllocatorExtension.d.ts +1 -1
- package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.d.ts +23 -1
- package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.js +61 -32
- package/dist/prosemirror/extensions/features/pastedHtmlLists.js +5 -4
- package/dist/prosemirror/extensions/marks/CommentExtension.js +8 -3
- package/dist/prosemirror/extensions/nodes/BlockCommentRangeBoundaryExtension.d.ts +4 -0
- package/dist/prosemirror/extensions/nodes/BlockCommentRangeBoundaryExtension.js +49 -0
- package/dist/prosemirror/extensions/nodes/CommentReferenceExtension.js +3 -1
- package/dist/prosemirror/extensions/nodes/ImageExtension.js +12 -3
- package/dist/prosemirror/extensions/nodes/TableExtension.js +32 -31
- package/dist/prosemirror/extensions/nodes/TextBoxExtension.js +1 -1
- package/dist/prosemirror/index.d.ts +3 -3
- package/dist/prosemirror/listLabels.js +3 -2
- package/dist/prosemirror/listNumbering.d.ts +6 -0
- package/dist/prosemirror/listNumbering.js +12 -9
- package/dist/prosemirror/lockedControls.d.ts +13 -0
- package/dist/prosemirror/lockedControls.js +106 -0
- package/dist/prosemirror/markupViewProjection.js +1 -1
- package/dist/prosemirror/nativeSelection.d.ts +33 -0
- package/dist/prosemirror/nativeSelection.js +74 -0
- package/dist/prosemirror/noteReferenceReview.js +2 -2
- package/dist/prosemirror/numberedRefFields.d.ts +2 -0
- package/dist/prosemirror/numberedRefFields.js +16 -5
- package/dist/prosemirror/paragraphMarkJoin.d.ts +6 -8
- package/dist/prosemirror/paragraphMarkJoin.js +155 -16
- package/dist/prosemirror/plugins/contentControlWidgets.js +2 -2
- package/dist/prosemirror/plugins/documentNumbering.js +37 -15
- package/dist/prosemirror/plugins/suggestionMode.js +33 -10
- package/dist/prosemirror/plugins/templatePreviewValues.js +16 -1
- package/dist/prosemirror/rebaseParagraphRuns.js +1 -1
- package/dist/prosemirror/replacedAnnotations.js +1 -0
- package/dist/prosemirror/runFormattingFromMarks.d.ts +0 -1
- package/dist/prosemirror/runFormattingFromMarks.js +2 -4
- package/dist/prosemirror/runFormattingReconciliation.js +2 -2
- package/dist/prosemirror/runIdentityAcrossRevisions.d.ts +23 -1
- package/dist/prosemirror/runIdentityAcrossRevisions.js +57 -8
- package/dist/prosemirror/runPropertyChangeResolution.js +1 -2
- package/dist/prosemirror/runStyleFormatting.d.ts +14 -4
- package/dist/prosemirror/runStyleFormatting.js +16 -13
- package/dist/prosemirror/schema/marks.d.ts +13 -1
- package/dist/prosemirror/storyListNumbering.js +7 -2
- package/dist/prosemirror/styles/paragraphStyleCascade.js +2 -2
- package/dist/prosemirror/tableResize.d.ts +10 -9
- package/dist/prosemirror/tableResize.js +60 -49
- package/dist/prosemirror/textInput.d.ts +30 -1
- package/dist/prosemirror/textInput.js +144 -17
- package/dist/prosemirror/utils/visualLineNavigation.js +20 -18
- package/dist/prosemirror/validation.d.ts +19 -0
- package/dist/prosemirror/validation.js +79 -5
- package/dist/redline.js +23 -9
- package/dist/render-dom/HeaderFooterSelectionOverlay.js +5 -4
- package/dist/render-dom/RenderedDomContext.js +7 -6
- package/dist/server.d.ts +2 -2
- package/dist/style-sets/extract.js +2 -2
- package/dist/types/canonicalCapabilities.d.ts +38 -16
- package/dist/types/canonicalCapabilities.js +21 -18
- package/dist/utils/cssString.d.ts +7 -0
- package/dist/utils/cssString.js +9 -0
- package/dist/utils/findMatchView.js +4 -3
- package/dist/utils/fontResolver.js +4 -1
- package/dist/utils/formatToStyle.d.ts +1 -1
- package/dist/utils/mergeDocumentContent.js +2 -2
- package/dist/utils/paintedPositions.d.ts +60 -0
- package/dist/utils/paintedPositions.js +101 -0
- package/dist/utils/replaceText.d.ts +11 -0
- package/dist/utils/replaceText.js +39 -7
- package/dist/version-comparison.d.ts +9 -1
- package/dist/version-comparison.js +11 -5
- package/package.json +2 -3
|
@@ -17,6 +17,7 @@ import { applyTemplatePreviewToBlocks } from "../layout-bridge/convert/templateP
|
|
|
17
17
|
import { toFlowBlocks } from "../layout-bridge/convert/toFlowBlocks.js";
|
|
18
18
|
import { getColumns } from "../layout-bridge/sectionColumns.js";
|
|
19
19
|
import { resolveAnchorLayoutInCellCompatibility } from "../layout-engine/anchorLayoutInCellCompatibility.js";
|
|
20
|
+
import { applyFootnoteContinuation, footnoteContinuationSettled, planFootnoteContinuation } from "../layout-engine/footnoteContinuation.js";
|
|
20
21
|
import { layoutDocument } from "../layout-engine/index.js";
|
|
21
22
|
import { resolveJustificationCompatibility } from "../layout-engine/justificationCompatibility.js";
|
|
22
23
|
import { recordLayoutComplete, recordLayoutError, recordLayoutPhase, recordLayoutStart, recordMarkupViewIncomplete } from "../layout-engine/layoutInstrumentation.js";
|
|
@@ -40,6 +41,7 @@ import { diffAgainstCommittedLayout } from "./committedLayoutDiff.js";
|
|
|
40
41
|
import { LAYOUT_MEASURE } from "./layoutRunOptions.js";
|
|
41
42
|
import { survivingComments } from "@stll/docx-core/ops";
|
|
42
43
|
// src/controller/layoutPipeline.ts
|
|
44
|
+
const MAX_FOOTNOTE_CONTINUATION_ROUNDS = 4;
|
|
43
45
|
const formatEndnoteTexts = (numbers, formatNumber) => {
|
|
44
46
|
const texts = /* @__PURE__ */ new Map();
|
|
45
47
|
for (const [id, displayNumber] of numbers) texts.set(id, formatNumber(displayNumber));
|
|
@@ -181,7 +183,8 @@ function runLayoutPipelineMeasured(deps, state, options) {
|
|
|
181
183
|
pageContentHeight,
|
|
182
184
|
fontAlternates,
|
|
183
185
|
...styles ? { styles } : {},
|
|
184
|
-
...document === null ? {} : { defaultSize: 10 }
|
|
186
|
+
...document === null ? {} : { defaultSize: 10 },
|
|
187
|
+
paragraphBlocks: session.paragraphBlocks
|
|
185
188
|
};
|
|
186
189
|
if (_theme !== void 0) flowOpts.theme = _theme;
|
|
187
190
|
if (defaultTabStop !== void 0) flowOpts.defaultTabStopTwips = defaultTabStop;
|
|
@@ -431,6 +434,16 @@ function runLayoutPipelineMeasured(deps, state, options) {
|
|
|
431
434
|
noteAreas: endnoteAreas.noteAreas
|
|
432
435
|
});
|
|
433
436
|
};
|
|
437
|
+
const withFootnoteHeights = (nextLayoutOpts) => {
|
|
438
|
+
if (!hasFootnotes) return nextLayoutOpts;
|
|
439
|
+
const footnoteHeightById = /* @__PURE__ */ new Map();
|
|
440
|
+
for (const [id, content] of footnoteContentMap) footnoteHeightById.set(id, content.height + 0);
|
|
441
|
+
return {
|
|
442
|
+
...nextLayoutOpts,
|
|
443
|
+
footnoteHeightById,
|
|
444
|
+
footnoteContinuation: nextLayoutOpts.footnoteContinuation ?? { trailingPages: 0 }
|
|
445
|
+
};
|
|
446
|
+
};
|
|
434
447
|
phaseStartedAt = performance.now();
|
|
435
448
|
let newLayout;
|
|
436
449
|
let pageFootnoteMap = /* @__PURE__ */ new Map();
|
|
@@ -470,12 +483,7 @@ function runLayoutPipelineMeasured(deps, state, options) {
|
|
|
470
483
|
let layoutOptsUsed = layoutOpts;
|
|
471
484
|
if (hasFootnotes) {
|
|
472
485
|
footnoteContentMap = buildFootnoteContentMap(documentFootnotes, footnoteRefs, contentWidth, buildNoteOptions());
|
|
473
|
-
|
|
474
|
-
for (const [id, content] of footnoteContentMap) footnoteHeightById.set(id, content.height + 0);
|
|
475
|
-
layoutOptsUsed = {
|
|
476
|
-
...layoutOpts,
|
|
477
|
-
footnoteHeightById
|
|
478
|
-
};
|
|
486
|
+
layoutOptsUsed = withFootnoteHeights(layoutOpts);
|
|
479
487
|
newLayout = layoutWithNoteAreas(newMeasures, layoutOptsUsed);
|
|
480
488
|
pageFootnoteMap = /* @__PURE__ */ new Map();
|
|
481
489
|
for (const page of newLayout.pages) if (page.footnoteIds && page.footnoteIds.length > 0) pageFootnoteMap.set(page.number, page.footnoteIds);
|
|
@@ -484,15 +492,6 @@ function runLayoutPipelineMeasured(deps, state, options) {
|
|
|
484
492
|
pageFootnoteMap = /* @__PURE__ */ new Map();
|
|
485
493
|
for (const page of newLayout.pages) if (page.footnoteIds && page.footnoteIds.length > 0) pageFootnoteMap.set(page.number, page.footnoteIds);
|
|
486
494
|
};
|
|
487
|
-
const withFootnoteHeights = (nextLayoutOpts) => {
|
|
488
|
-
if (!hasFootnotes) return nextLayoutOpts;
|
|
489
|
-
const footnoteHeightById = /* @__PURE__ */ new Map();
|
|
490
|
-
for (const [id, content] of footnoteContentMap) footnoteHeightById.set(id, content.height + 0);
|
|
491
|
-
return {
|
|
492
|
-
...nextLayoutOpts,
|
|
493
|
-
footnoteHeightById
|
|
494
|
-
};
|
|
495
|
-
};
|
|
496
495
|
const relayoutWithCurrentMeasures = (nextLayoutOpts) => {
|
|
497
496
|
layoutOptsUsed = withFootnoteHeights(nextLayoutOpts);
|
|
498
497
|
newLayout = layoutWithNoteAreas(newMeasures, layoutOptsUsed);
|
|
@@ -553,6 +552,41 @@ function runLayoutPipelineMeasured(deps, state, options) {
|
|
|
553
552
|
};
|
|
554
553
|
let stabilizedFieldValues;
|
|
555
554
|
stabilizeFieldWidths();
|
|
555
|
+
if (hasFootnotes) {
|
|
556
|
+
const usedTrailingPages = () => layoutOptsUsed.footnoteContinuation?.trailingPages ?? 0;
|
|
557
|
+
const planContinuation = () => planFootnoteContinuation({
|
|
558
|
+
pages: newLayout.pages,
|
|
559
|
+
contentById: footnoteContentMap,
|
|
560
|
+
trailingPages: usedTrailingPages()
|
|
561
|
+
});
|
|
562
|
+
const relayoutFor = (reservedHeights, trailingPages) => {
|
|
563
|
+
relayoutWithCurrentMeasures({
|
|
564
|
+
...layoutOptsUsed,
|
|
565
|
+
...reservedHeights === void 0 ? {} : { footnoteReservedHeights: reservedHeights },
|
|
566
|
+
footnoteContinuation: { trailingPages }
|
|
567
|
+
});
|
|
568
|
+
stabilizeFieldWidths();
|
|
569
|
+
};
|
|
570
|
+
let continuation = planContinuation();
|
|
571
|
+
for (let round = 0; round < MAX_FOOTNOTE_CONTINUATION_ROUNDS && !footnoteContinuationSettled({
|
|
572
|
+
reservedHeights: layoutOptsUsed.footnoteReservedHeights,
|
|
573
|
+
trailingPages: usedTrailingPages()
|
|
574
|
+
}, continuation); round += 1) {
|
|
575
|
+
relayoutFor(continuation.reservedHeights, continuation.trailingPages);
|
|
576
|
+
continuation = planContinuation();
|
|
577
|
+
}
|
|
578
|
+
while (continuation.extraPages > 0) {
|
|
579
|
+
relayoutFor(layoutOptsUsed.footnoteReservedHeights, continuation.trailingPages);
|
|
580
|
+
continuation = planContinuation();
|
|
581
|
+
}
|
|
582
|
+
if (continuation.pages.size > 0) {
|
|
583
|
+
newLayout = {
|
|
584
|
+
...newLayout,
|
|
585
|
+
pages: applyFootnoteContinuation(newLayout.pages, continuation)
|
|
586
|
+
};
|
|
587
|
+
rebuildFootnotePageMap();
|
|
588
|
+
}
|
|
589
|
+
}
|
|
556
590
|
newLayout = attachAuthoredMarginsToLayoutPages(newLayout, {
|
|
557
591
|
authoredMargins: margins,
|
|
558
592
|
mirrorMargins,
|
|
@@ -3,6 +3,7 @@ import { TemplatePreviewEntry, TemplatePreviewHiddenRange, TemplatePreviewValues
|
|
|
3
3
|
import { DisplayMode } from "../managers/EditorModeManager.js";
|
|
4
4
|
import { FlowBlock, Measure } from "../layout-engine/types.js";
|
|
5
5
|
import { FontAlternates } from "../fonts/fontAlternates.js";
|
|
6
|
+
import { ParagraphBlockCache } from "../layout-bridge/convert/paragraphBlockCache.js";
|
|
6
7
|
import { EditorState } from "prosemirror-state";
|
|
7
8
|
export type LayoutArtifacts = {
|
|
8
9
|
blocks: FlowBlock[];
|
|
@@ -46,5 +47,7 @@ export type LayoutSession = {
|
|
|
46
47
|
lastPmDoc: EditorState["doc"] | null;
|
|
47
48
|
lastMeasureInputs: LayoutMeasureInputs | null;
|
|
48
49
|
lastTemplatePreview: LayoutTemplatePreview;
|
|
50
|
+
/** Body paragraph blocks kept from earlier layout runs, so an edit converts only what it changed. */
|
|
51
|
+
paragraphBlocks: ParagraphBlockCache;
|
|
49
52
|
};
|
|
50
53
|
export declare const createLayoutSession: () => LayoutSession;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ParagraphBlockCache } from "../layout-bridge/convert/paragraphBlockCache.js";
|
|
1
2
|
// src/controller/layoutSession.ts
|
|
2
3
|
const createLayoutSession = () => ({
|
|
3
4
|
artifacts: null,
|
|
@@ -8,6 +9,7 @@ const createLayoutSession = () => ({
|
|
|
8
9
|
entries: [],
|
|
9
10
|
hidden: [],
|
|
10
11
|
mode: "plain"
|
|
11
|
-
}
|
|
12
|
+
},
|
|
13
|
+
paragraphBlocks: new ParagraphBlockCache()
|
|
12
14
|
});
|
|
13
15
|
export { createLayoutSession };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { document_d_exports } from "../types/document.js";
|
|
2
|
-
import {
|
|
2
|
+
import { CanonicalRefusalGround } from "../types/canonicalCapabilities.js";
|
|
3
3
|
import { NoteStoryKey } from "../types/editor-story.js";
|
|
4
4
|
import { HiddenEditorApi } from "./hiddenEditorApi.js";
|
|
5
5
|
import { Plugin } from "prosemirror-state";
|
|
@@ -14,8 +14,13 @@ export type NoteEditorManagerDeps = {
|
|
|
14
14
|
createView?: ((mountNode: HTMLElement, props: DirectEditorProps) => EditorView) | undefined;
|
|
15
15
|
getDocument: () => document_d_exports.Document | null;
|
|
16
16
|
getCanonicalApi?: (() => HiddenEditorApi | null) | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* The canonical session's own document, read without a copy (see
|
|
19
|
+
* `HiddenEditorManager.readCanonicalDocument`); null outside a session.
|
|
20
|
+
*/
|
|
21
|
+
readCanonicalDocument: () => document_d_exports.Document | null;
|
|
17
22
|
getExperimentalSession?: (() => "canonical" | undefined) | undefined;
|
|
18
|
-
onSessionRefusal?: ((reason: string,
|
|
23
|
+
onSessionRefusal?: ((reason: string, ground: CanonicalRefusalGround, error?: Error) => void) | undefined;
|
|
19
24
|
getHost: () => HTMLElement | null;
|
|
20
25
|
getPlugins?: (() => Plugin[]) | undefined;
|
|
21
26
|
getStyles: () => document_d_exports.StyleDefinitions | null | undefined;
|
|
@@ -7,6 +7,7 @@ import { ExtensionManager } from "../prosemirror/extensions/ExtensionManager.js"
|
|
|
7
7
|
import { createStarterKit } from "../prosemirror/extensions/StarterKit.js";
|
|
8
8
|
import { ensureBaseDirectionInState } from "../prosemirror/extensions/features/AutoBidiDetectionExtension.js";
|
|
9
9
|
import { ensureParaIdsInState } from "../prosemirror/extensions/features/ParaIdAllocatorExtension.js";
|
|
10
|
+
import { createNativeSelectionRefreshPlugin } from "../prosemirror/nativeSelection.js";
|
|
10
11
|
import { noteReferenceTransactionIssue } from "../prosemirror/noteReferenceOccurrences.js";
|
|
11
12
|
import { createDocumentNumberingPlugin } from "../prosemirror/plugins/documentNumbering.js";
|
|
12
13
|
import { createDocumentStyleContextPlugin, createDocumentStylesPlugin } from "../prosemirror/plugins/documentStyles.js";
|
|
@@ -40,10 +41,10 @@ const buildInitialState = (document, styles, numbering, manager, externalPlugins
|
|
|
40
41
|
doc: document,
|
|
41
42
|
schema,
|
|
42
43
|
plugins: [
|
|
44
|
+
createDocumentNumberingPlugin(numbering),
|
|
43
45
|
...manager.getPlugins(),
|
|
44
46
|
...externalPlugins,
|
|
45
|
-
createDocumentStylesPlugin(styles)
|
|
46
|
-
createDocumentNumberingPlugin(numbering)
|
|
47
|
+
createDocumentStylesPlugin(styles)
|
|
47
48
|
]
|
|
48
49
|
})));
|
|
49
50
|
};
|
|
@@ -89,7 +90,7 @@ const createNoteEditorManager = (deps) => {
|
|
|
89
90
|
mounted.clear();
|
|
90
91
|
active = null;
|
|
91
92
|
};
|
|
92
|
-
const getOwnedDocument = () => usesCanonicalSession(deps.getExperimentalSession?.(), CANONICAL_GAP.authorityRouting) ? deps.
|
|
93
|
+
const getOwnedDocument = () => usesCanonicalSession(deps.getExperimentalSession?.(), CANONICAL_GAP.authorityRouting) ? deps.readCanonicalDocument() : deps.getDocument();
|
|
93
94
|
const sync = () => {
|
|
94
95
|
const host = deps.getHost();
|
|
95
96
|
if (!host) return;
|
|
@@ -200,7 +201,11 @@ const createNoteEditorManager = (deps) => {
|
|
|
200
201
|
...canonical.props,
|
|
201
202
|
state: canonicalProjection ? EditorState.create({
|
|
202
203
|
doc: canonicalProjection,
|
|
203
|
-
plugins: [
|
|
204
|
+
plugins: [
|
|
205
|
+
createDocumentNumberingPlugin(numbering),
|
|
206
|
+
createDocumentStyleContextPlugin(styles),
|
|
207
|
+
createNativeSelectionRefreshPlugin()
|
|
208
|
+
]
|
|
204
209
|
}) : buildInitialState(proseDocument, styles, numbering, manager, externalPlugins),
|
|
205
210
|
dispatchTransaction(transaction) {
|
|
206
211
|
if (canonical.dispatch(transaction)) return;
|
|
@@ -208,7 +213,7 @@ const createNoteEditorManager = (deps) => {
|
|
|
208
213
|
const docChanged = !nextState.doc.eq(view.state.doc);
|
|
209
214
|
view.updateState(nextState);
|
|
210
215
|
const noteIssue = noteReferenceTransactionIssue(transaction);
|
|
211
|
-
if (noteIssue) deps.onSessionRefusal?.(noteIssue.message, CANONICAL_GAP.dispatch, noteIssue);
|
|
216
|
+
if (noteIssue) deps.onSessionRefusal?.(noteIssue.message, { gap: CANONICAL_GAP.dispatch }, noteIssue);
|
|
212
217
|
const mountedStory = mounted.get(key);
|
|
213
218
|
if (mountedStory && docChanged) mountedStory.dirty = true;
|
|
214
219
|
deps.onTransaction?.({
|
|
@@ -257,7 +262,7 @@ const createNoteEditorManager = (deps) => {
|
|
|
257
262
|
const canonical = deps.getCanonicalApi?.()?.getCanonicalDocument();
|
|
258
263
|
if (canonical) return canonical;
|
|
259
264
|
throw new CanonicalSessionError({
|
|
260
|
-
gap: CANONICAL_GAP.authorityRouting,
|
|
265
|
+
ground: { gap: CANONICAL_GAP.authorityRouting },
|
|
261
266
|
reason: "refused",
|
|
262
267
|
message: "Canonical story snapshot is unavailable."
|
|
263
268
|
});
|
|
@@ -2,6 +2,7 @@ import { NOTE_SEPARATOR_RULE_THICKNESS, NOTE_SEPARATOR_WIDTH_FRACTION } from "..
|
|
|
2
2
|
import { calculateFootnoteAreaRenderHeight } from "../../layout-painter/renderPage.js";
|
|
3
3
|
import { HIT_REGION_KINDS } from "../primitives.js";
|
|
4
4
|
import { DOC_CANVAS_TEXT } from "./colors.js";
|
|
5
|
+
import { createPageComposer } from "./regions.js";
|
|
5
6
|
import { paintFootnoteBlocks } from "./storyPrimitives.js";
|
|
6
7
|
import { UNSUPPORTED_CONSTRUCT } from "./unsupported.js";
|
|
7
8
|
// src/display-list/build/pageFurniture.ts
|
|
@@ -93,6 +94,7 @@ const paintFootnoteArea = ({ composer, page, context, contentById }) => {
|
|
|
93
94
|
}));
|
|
94
95
|
const missing = bodies.flatMap(({ noteId, content }) => content === void 0 ? [noteId] : []);
|
|
95
96
|
if (missing.length > 0) context.unsupported.report(UNSUPPORTED_CONSTRUCT.footnoteContent, context.pageIndex, `footnote bodies ${missing.join(", ")} were not supplied to the builder, so the band reserves their height and paints nothing`);
|
|
97
|
+
const noteWindowOf = (noteId) => page.footnoteWindows?.find((candidate) => candidate.noteId === noteId);
|
|
96
98
|
const items = bodies.map(({ noteId, content }) => ({
|
|
97
99
|
noteId,
|
|
98
100
|
displayNumber: String(content?.displayNumber ?? noteId),
|
|
@@ -104,7 +106,7 @@ const paintFootnoteArea = ({ composer, page, context, contentById }) => {
|
|
|
104
106
|
}));
|
|
105
107
|
const contentHeightPx = page.size.h - page.margins.top - page.margins.bottom;
|
|
106
108
|
const contentWidthPx = page.size.w - page.margins.left - page.margins.right;
|
|
107
|
-
const bandHeightPx = Math.max(reservedHeightPx, calculateFootnoteAreaRenderHeight(items));
|
|
109
|
+
const bandHeightPx = Math.max(reservedHeightPx, calculateFootnoteAreaRenderHeight(items, page.footnoteWindows));
|
|
108
110
|
const areaTopPx = page.margins.top + Math.max(-page.margins.top, contentHeightPx - bandHeightPx);
|
|
109
111
|
const primitives = [{
|
|
110
112
|
kind: "rect",
|
|
@@ -119,38 +121,58 @@ const paintFootnoteArea = ({ composer, page, context, contentById }) => {
|
|
|
119
121
|
composer.push(primitives);
|
|
120
122
|
for (const [index, { noteId, content }] of bodies.entries()) {
|
|
121
123
|
if (content === void 0) continue;
|
|
122
|
-
const offsetPx = calculateFootnoteAreaRenderHeight(items.slice(0, index));
|
|
124
|
+
const offsetPx = calculateFootnoteAreaRenderHeight(items.slice(0, index), page.footnoteWindows);
|
|
123
125
|
const story = {
|
|
124
126
|
kind: "footnote",
|
|
125
127
|
id: noteId
|
|
126
128
|
};
|
|
129
|
+
const noteWindow = noteWindowOf(noteId);
|
|
127
130
|
composer.region({
|
|
128
131
|
kind: HIT_REGION_KINDS.note,
|
|
129
132
|
rect: {
|
|
130
133
|
xPx: page.margins.left,
|
|
131
134
|
yPx: areaTopPx + offsetPx,
|
|
132
135
|
widthPx: contentWidthPx,
|
|
133
|
-
heightPx: content.height
|
|
136
|
+
heightPx: noteWindow ? noteWindow.to - noteWindow.from : content.height
|
|
134
137
|
},
|
|
135
138
|
model: { story }
|
|
136
139
|
}, () => {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
140
|
+
const paintBlocks = (target) => {
|
|
141
|
+
paintFootnoteBlocks({
|
|
142
|
+
composer: target,
|
|
143
|
+
blocks: content.blocks,
|
|
144
|
+
measures: content.measures,
|
|
145
|
+
xPx: page.margins.left,
|
|
146
|
+
yPx: areaTopPx + offsetPx - (noteWindow?.from ?? 0),
|
|
147
|
+
widthPx: contentWidthPx,
|
|
148
|
+
context: {
|
|
149
|
+
...context,
|
|
150
|
+
story,
|
|
151
|
+
inlinePictureViewport: {
|
|
152
|
+
left: page.margins.left,
|
|
153
|
+
right: page.size.w - page.margins.right
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
label: `footnote ${content.displayNumber}`
|
|
157
|
+
});
|
|
158
|
+
};
|
|
159
|
+
if (!noteWindow) {
|
|
160
|
+
paintBlocks(composer);
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
const clipped = createPageComposer();
|
|
164
|
+
paintBlocks(clipped);
|
|
165
|
+
composer.push([{
|
|
166
|
+
kind: "clipGroup",
|
|
167
|
+
rect: {
|
|
168
|
+
xPx: page.margins.left,
|
|
169
|
+
yPx: areaTopPx + offsetPx,
|
|
170
|
+
widthPx: contentWidthPx,
|
|
171
|
+
heightPx: noteWindow.to - noteWindow.from
|
|
151
172
|
},
|
|
152
|
-
|
|
153
|
-
|
|
173
|
+
children: [...clipped.primitives()],
|
|
174
|
+
regions: [...clipped.regions()]
|
|
175
|
+
}]);
|
|
154
176
|
});
|
|
155
177
|
}
|
|
156
178
|
};
|
|
@@ -36,7 +36,7 @@ const strokeFor = (border, context, label) => {
|
|
|
36
36
|
if (unresolvedColor !== void 0) context.unsupported.report(UNSUPPORTED_CONSTRUCT.unresolvedColor, context.pageIndex, `${label} colour ${unresolvedColor}`);
|
|
37
37
|
return stroke;
|
|
38
38
|
};
|
|
39
|
-
const paintCell = ({ composer, cell, cellMeasure, box, context, paintTextBox, visibleBand, sides }) => {
|
|
39
|
+
const paintCell = ({ composer, cell, cellMeasure, box, context, paintTextBox, visibleBand, contentBandPx, sides }) => {
|
|
40
40
|
const primitives = [];
|
|
41
41
|
if (cell.background) {
|
|
42
42
|
const fill = parseDisplayColor(cell.background);
|
|
@@ -111,8 +111,9 @@ const paintCell = ({ composer, cell, cellMeasure, box, context, paintTextBox, vi
|
|
|
111
111
|
if (cellTextRotationDegrees(cell.textDirection) !== 0) context.unsupported.report(UNSUPPORTED_CONSTRUCT.verticalCellText, context.pageIndex, `w:textDirection ${cell.textDirection} paints horizontally`);
|
|
112
112
|
composer.push(primitives);
|
|
113
113
|
primitives.length = 0;
|
|
114
|
+
const contentComposer = contentBandPx ? createPageComposer() : composer;
|
|
114
115
|
paintCellBlocks({
|
|
115
|
-
composer,
|
|
116
|
+
composer: contentComposer,
|
|
116
117
|
blocks: cell.blocks,
|
|
117
118
|
measures: cellMeasure.blocks,
|
|
118
119
|
xPx: contentXPx,
|
|
@@ -123,6 +124,17 @@ const paintCell = ({ composer, cell, cellMeasure, box, context, paintTextBox, vi
|
|
|
123
124
|
paintTextBox,
|
|
124
125
|
visibleBand
|
|
125
126
|
});
|
|
127
|
+
if (contentBandPx) composer.push([{
|
|
128
|
+
kind: "clipGroup",
|
|
129
|
+
rect: {
|
|
130
|
+
xPx: box.xPx,
|
|
131
|
+
yPx: contentBandPx.top,
|
|
132
|
+
widthPx: box.widthPx,
|
|
133
|
+
heightPx: Math.max(0, contentBandPx.bottom - contentBandPx.top)
|
|
134
|
+
},
|
|
135
|
+
children: [...contentComposer.primitives()],
|
|
136
|
+
regions: [...contentComposer.regions()]
|
|
137
|
+
}]);
|
|
126
138
|
const diagonals = [{
|
|
127
139
|
border: borders?.topLeftToBottomRight,
|
|
128
140
|
from: "topLeft"
|
|
@@ -265,7 +277,7 @@ const paintCellBlocks = ({ composer, blocks, measures, xPx, yPx, widthPx, inline
|
|
|
265
277
|
}
|
|
266
278
|
};
|
|
267
279
|
const rowIsPainted = (row) => row !== void 0 && row.hidden !== true;
|
|
268
|
-
const paintTableBody = ({ composer, block, measure, xPx, yPx, fromRow, toRow, headerRowCount, context, paintTextBox, visibleBand }) => {
|
|
280
|
+
const paintTableBody = ({ composer, block, measure, xPx, yPx, fromRow, toRow, headerRowCount, context, paintTextBox, visibleBand, cellLineBand }) => {
|
|
269
281
|
const grid = buildTableCellGrid(block.rows, measure.columnWidths.length);
|
|
270
282
|
const placements = buildTableCellPlacements({
|
|
271
283
|
grid,
|
|
@@ -299,10 +311,12 @@ const paintTableBody = ({ composer, block, measure, xPx, yPx, fromRow, toRow, he
|
|
|
299
311
|
};
|
|
300
312
|
const paintRowCells = (row, rowMeasure, rowIndex, rowYPx) => {
|
|
301
313
|
const opensContinuation = visibleBand !== void 0 && rowIndex === firstShownRow && rowYPx >= visibleBand.top;
|
|
314
|
+
const cellBands = rowIndex === fromRow ? cellLineBand?.cells : void 0;
|
|
302
315
|
for (let cellIndex = 0; cellIndex < row.cells.length; cellIndex += 1) {
|
|
303
316
|
const cell = row.cells[cellIndex];
|
|
304
317
|
const cellMeasure = rowMeasure.cells[cellIndex];
|
|
305
318
|
if (!cell || !cellMeasure) continue;
|
|
319
|
+
const cellBand = cellBands?.[cellIndex];
|
|
306
320
|
const placement = placements.get(cell);
|
|
307
321
|
if (!placement) continue;
|
|
308
322
|
const rowSpan = Math.max(1, Math.trunc(cell.rowSpan ?? 1));
|
|
@@ -338,6 +352,10 @@ const paintTableBody = ({ composer, block, measure, xPx, yPx, fromRow, toRow, he
|
|
|
338
352
|
context,
|
|
339
353
|
paintTextBox,
|
|
340
354
|
visibleBand,
|
|
355
|
+
...cellBand ? { contentBandPx: {
|
|
356
|
+
top: rowYPx + cellBand.top,
|
|
357
|
+
bottom: rowYPx + cellBand.bottom
|
|
358
|
+
} } : {},
|
|
341
359
|
sides: {
|
|
342
360
|
top: bordersSeparated || rowIndex === fromRow || opensContinuation || !hasVisibleBorder(aboveCell?.borders?.bottom),
|
|
343
361
|
bottom: true,
|
|
@@ -436,7 +454,8 @@ const paintTableFragment = ({ composer, fragment, block, measure, context, paint
|
|
|
436
454
|
headerRowCount: 0,
|
|
437
455
|
context,
|
|
438
456
|
paintTextBox,
|
|
439
|
-
visibleBand
|
|
457
|
+
visibleBand,
|
|
458
|
+
...fragment.cellLineBand ? { cellLineBand: fragment.cellLineBand } : {}
|
|
440
459
|
});
|
|
441
460
|
};
|
|
442
461
|
if (fragment.topClip === void 0 && fragment.bottomClip === void 0) {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { writeCommentAnchorIds } from "../../render-dom/commentAnchorAttributes.js";
|
|
2
2
|
import { bytesToDataUrl } from "../../utils/base64.js";
|
|
3
|
+
import { cssString } from "../../utils/cssString.js";
|
|
3
4
|
import { imageLuminanceFilter } from "../../utils/imageLuminance.js";
|
|
5
|
+
import { writePaintedRange } from "../../utils/paintedPositions.js";
|
|
4
6
|
import { applyTextAdvanceGaps } from "../../utils/textAdvanceGapsDom.js";
|
|
5
7
|
import { anchorTargetAttrs } from "../../utils/urlSecurity.js";
|
|
6
8
|
import { retainObjectUrl } from "../pageResourceOwnership.js";
|
|
@@ -78,7 +80,6 @@ const px = (value) => `${value}px`;
|
|
|
78
80
|
* the PDF backend's colour dump.
|
|
79
81
|
*/
|
|
80
82
|
const cssColor = ({ r, g, b, a }) => a === 1 ? `rgb(${r}, ${g}, ${b})` : `rgba(${r}, ${g}, ${b}, ${a})`;
|
|
81
|
-
const quoteFontFamily = (family) => `"${family.replaceAll("\"", "\\\"")}"`;
|
|
82
83
|
/**
|
|
83
84
|
* An embedded face wins over any installed face of the same name by being
|
|
84
85
|
* named first, under the id its `@font-face` rule was registered with.
|
|
@@ -91,8 +92,8 @@ const quoteFontFamily = (family) => `"${family.replaceAll("\"", "\\\"")}"`;
|
|
|
91
92
|
* any host missing the first one.
|
|
92
93
|
*/
|
|
93
94
|
const fontFamilyStack = ({ family, fallbacks, generic, embedded }) => {
|
|
94
|
-
const resolved = `${[family, ...fallbacks].map(
|
|
95
|
-
return embedded === void 0 ? resolved : `${
|
|
95
|
+
const resolved = `${[family, ...fallbacks].map(cssString).join(", ")}, ${generic}`;
|
|
96
|
+
return embedded === void 0 ? resolved : `${cssString(embedded.id)}, ${resolved}`;
|
|
96
97
|
};
|
|
97
98
|
const resolveFont = (ref, fonts) => {
|
|
98
99
|
const face = ref < 0 ? void 0 : fonts.at(ref);
|
|
@@ -110,7 +111,7 @@ const binarySrc = (bytes, mimeType, urls) => {
|
|
|
110
111
|
if (urls === "objectUrl" && isBlobPart(bytes) && typeof Blob === "function" && typeof URL !== "undefined" && typeof URL.createObjectURL === "function") return URL.createObjectURL(new Blob([bytes], { type: mimeType }));
|
|
111
112
|
return bytesToDataUrl(bytes, mimeType);
|
|
112
113
|
};
|
|
113
|
-
const fontFaceRule = (face, embedded, src) => `@font-face { font-family: ${
|
|
114
|
+
const fontFaceRule = (face, embedded, src) => `@font-face { font-family: ${cssString(embedded.id)}; src: url("${src}"); font-weight: ${face.weight}; font-style: ${face.italic ? "italic" : "normal"}; }`;
|
|
114
115
|
/**
|
|
115
116
|
* `@font-face` rules for the faces whose bytes travel with the list. Resolved
|
|
116
117
|
* once per render and shared by every page: an id maps to one blob, so the
|
|
@@ -279,9 +280,13 @@ const applyAdjustments = (span, adjustments) => {
|
|
|
279
280
|
*/
|
|
280
281
|
const applyModelRange = (span, range, purpose = "editing") => {
|
|
281
282
|
if (range === void 0) return;
|
|
282
|
-
if (purpose === "editing")
|
|
283
|
-
|
|
284
|
-
|
|
283
|
+
if (purpose === "editing") {
|
|
284
|
+
span.className = "layout-run-text";
|
|
285
|
+
writePaintedRange(span, range.start, range.end);
|
|
286
|
+
} else {
|
|
287
|
+
span.dataset["decorationStart"] = String(range.start);
|
|
288
|
+
span.dataset["decorationEnd"] = String(range.end);
|
|
289
|
+
}
|
|
285
290
|
const { story } = range;
|
|
286
291
|
span.dataset["story"] = story.kind;
|
|
287
292
|
switch (story.kind) {
|
|
@@ -577,10 +582,7 @@ const REGION_CLASS = {
|
|
|
577
582
|
const applyRegionModel = (element, region) => {
|
|
578
583
|
const model = region.model;
|
|
579
584
|
if (model === void 0) return;
|
|
580
|
-
if (model.pmRange !== void 0)
|
|
581
|
-
element.dataset["pmStart"] = String(model.pmRange.start);
|
|
582
|
-
element.dataset["pmEnd"] = String(model.pmRange.end);
|
|
583
|
-
}
|
|
585
|
+
if (model.pmRange !== void 0) writePaintedRange(element, model.pmRange.start, model.pmRange.end);
|
|
584
586
|
if (model.blockId !== void 0) element.dataset["blockId"] = model.blockId;
|
|
585
587
|
if (model.commentIds !== void 0) writeCommentAnchorIds(element, model.commentIds);
|
|
586
588
|
if (model.rowIndex !== void 0) element.dataset["rowIndex"] = String(model.rowIndex);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { NumberingIdsInUse } from "./docx/numberingIds.js";
|
|
2
1
|
import { document_d_exports } from "./types/document.js";
|
|
2
|
+
import { NumberingIdsInUse } from "./docx/numberingIds.js";
|
|
3
3
|
import { FolioTableTemplates } from "./ai-edits/table-template.js";
|
|
4
4
|
import { FolioAIEditAppliedOperation, FolioAIEditApplyMode, FolioAIEditNormalization, FolioAIEditOperation, FolioAIEditPrecondition, FolioAIEditSkippedOperation, FolioAIEditSnapshot, FolioAITextRangeHandle } from "./ai-edits/types.js";
|
|
5
5
|
import { FolioAIEditView, FolioReplacementBackground, FolioRevisionStamp, FolioUndefinedReferencePolicy, FolioWordDiffOptions } from "./ai-edits/apply.js";
|
|
@@ -314,6 +314,14 @@ export type ApplyFolioDocumentOperationsOptions = {
|
|
|
314
314
|
*/
|
|
315
315
|
restagesSuggestions?: boolean;
|
|
316
316
|
};
|
|
317
|
+
/**
|
|
318
|
+
* A suggested operation without a `suggestionId` is its own suggestion, named
|
|
319
|
+
* by its id. An id a still pending suggestion already carries would fold the
|
|
320
|
+
* two into one (accepted, rejected and exported together), so such an
|
|
321
|
+
* operation gets a distinct id, and an operation of the batch grouping with it
|
|
322
|
+
* by that id follows it.
|
|
323
|
+
*/
|
|
324
|
+
export declare const withDistinctSuggestionIds: (batch: FolioDocumentOperationBatch, pending: ReadonlySet<string>) => FolioDocumentOperationBatch;
|
|
317
325
|
export declare const applyFolioDocumentOperations: (input: ApplyFolioDocumentOperationsOptions) => FolioDocumentOperationResult;
|
|
318
326
|
/**
|
|
319
327
|
* Options of a caller that holds every story of the package: the numbering
|
|
@@ -1081,7 +1081,8 @@ const recoveryByReason = {
|
|
|
1081
1081
|
missingNumbering: "refreshDocument",
|
|
1082
1082
|
invalidResult: "refreshDocument",
|
|
1083
1083
|
pendingDeletion: "resolveTrackedChange",
|
|
1084
|
-
pendingParagraphMarkDeletion: "resolveTrackedChange"
|
|
1084
|
+
pendingParagraphMarkDeletion: "resolveTrackedChange",
|
|
1085
|
+
contentControlLock: "changeTarget"
|
|
1085
1086
|
};
|
|
1086
1087
|
const getFolioDocumentOperationIssues = (operations, skipped) => {
|
|
1087
1088
|
const indexById = /* @__PURE__ */ new Map();
|
|
@@ -1095,7 +1096,7 @@ const getFolioDocumentOperationIssues = (operations, skipped) => {
|
|
|
1095
1096
|
operationIndex,
|
|
1096
1097
|
path: `$.operations[${operationIndex}]`,
|
|
1097
1098
|
code: reason,
|
|
1098
|
-
retryable: reason !== "emptyOperation" && reason !== "noopOperation" && reason !== "pendingParagraphPropertyChange" && reason !== "pendingRunPropertyChange" && reason !== "pendingDeletion" && reason !== "pendingParagraphMarkDeletion" && reason !== "payloadDoesNotFit" && reason !== "protectedReference" && reason !== "invalidResult",
|
|
1099
|
+
retryable: reason !== "emptyOperation" && reason !== "noopOperation" && reason !== "pendingParagraphPropertyChange" && reason !== "pendingRunPropertyChange" && reason !== "pendingDeletion" && reason !== "pendingParagraphMarkDeletion" && reason !== "contentControlLock" && reason !== "payloadDoesNotFit" && reason !== "protectedReference" && reason !== "invalidResult",
|
|
1099
1100
|
recovery: recoveryByReason[reason],
|
|
1100
1101
|
...canonicalRefusal === void 0 ? {} : { canonicalRefusal },
|
|
1101
1102
|
...message !== void 0 && { message }
|
|
@@ -1517,4 +1518,4 @@ const applyFolioDocumentOperationsInPackage = ({ view, snapshot, batch, story =
|
|
|
1517
1518
|
undoHandle: result.applied.length > 0 && createUndoHandle !== void 0 ? createUndoHandle() : null
|
|
1518
1519
|
};
|
|
1519
1520
|
};
|
|
1520
|
-
export { FOLIO_DOCUMENT_OPERATION_BATCH_MODES, FOLIO_DOCUMENT_OPERATION_BATCH_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION, FOLIO_DOCUMENT_OPERATION_KEYS_BY_TYPE, FOLIO_DOCUMENT_OPERATION_MODES, FOLIO_DOCUMENT_OPERATION_MODES_BY_TYPE, FOLIO_DOCUMENT_OPERATION_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_STORIES, FOLIO_DOCUMENT_OPERATION_TYPES, FOLIO_LINE_SPACING_RULE_VALUES, FOLIO_PAGE_BREAK_CLEAR_VALUES, FOLIO_PARAGRAPH_ALIGNMENT_VALUES, InvalidFolioDocumentOperationBatchError, UnsupportedFolioDocumentOperationVersionError, applyFolioDocumentOperations, applyFolioDocumentOperationsInPackage, assertSupportedFolioDocumentOperationVersion, getFolioDocumentOperationCapabilities, getFolioDocumentOperationIssues, getFolioDocumentOperationReceipts, getFolioDocumentOperationReceiptsForStory, isFolioDocumentOperationModeSupported, isSupportedFolioDocumentOperationVersion, parseFolioDocumentOperationBatch };
|
|
1521
|
+
export { FOLIO_DOCUMENT_OPERATION_BATCH_MODES, FOLIO_DOCUMENT_OPERATION_BATCH_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION, FOLIO_DOCUMENT_OPERATION_KEYS_BY_TYPE, FOLIO_DOCUMENT_OPERATION_MODES, FOLIO_DOCUMENT_OPERATION_MODES_BY_TYPE, FOLIO_DOCUMENT_OPERATION_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_STORIES, FOLIO_DOCUMENT_OPERATION_TYPES, FOLIO_LINE_SPACING_RULE_VALUES, FOLIO_PAGE_BREAK_CLEAR_VALUES, FOLIO_PARAGRAPH_ALIGNMENT_VALUES, InvalidFolioDocumentOperationBatchError, UnsupportedFolioDocumentOperationVersionError, applyFolioDocumentOperations, applyFolioDocumentOperationsInPackage, assertSupportedFolioDocumentOperationVersion, getFolioDocumentOperationCapabilities, getFolioDocumentOperationIssues, getFolioDocumentOperationReceipts, getFolioDocumentOperationReceiptsForStory, isFolioDocumentOperationModeSupported, isSupportedFolioDocumentOperationVersion, parseFolioDocumentOperationBatch, withDistinctSuggestionIds };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { document_d_exports } from "../types/document.js";
|
|
2
2
|
import { NumberingMap } from "./numberingParser.js";
|
|
3
|
+
import { PreviousListState } from "./listMarkerComputation.js";
|
|
3
4
|
import { ParseContext } from "./parseContext.js";
|
|
4
5
|
import { XmlElement } from "./xmlParser.js";
|
|
5
6
|
import { OwnedElsewhere } from "./containerChildren.js";
|
|
6
|
-
import { PreviousListState } from "./listMarkerComputation.js";
|
|
7
7
|
import { PreviewLedger } from "./previewBudget.js";
|
|
8
8
|
import { StyleMap } from "./styleParser.js";
|
|
9
9
|
type ParseBlockContentOptions = {
|
|
@@ -40,8 +40,12 @@ type BlockContentWalk = {
|
|
|
40
40
|
};
|
|
41
41
|
export declare const BLOCK_CONTENT_HANDLERS: {
|
|
42
42
|
readonly altChunk: "capture";
|
|
43
|
-
readonly commentRangeEnd:
|
|
44
|
-
|
|
43
|
+
readonly commentRangeEnd: (child: XmlElement, walk: {
|
|
44
|
+
modelled: document_d_exports.BlockContent[];
|
|
45
|
+
}) => void;
|
|
46
|
+
readonly commentRangeStart: (child: XmlElement, walk: {
|
|
47
|
+
modelled: document_d_exports.BlockContent[];
|
|
48
|
+
}) => void;
|
|
45
49
|
readonly customXmlDelRangeEnd: "capture";
|
|
46
50
|
readonly customXmlDelRangeStart: "capture";
|
|
47
51
|
readonly customXmlInsRangeEnd: "capture";
|
|
@@ -2,7 +2,7 @@ import { blockCustomXmlShell } from "./blockCustomXmlShell.js";
|
|
|
2
2
|
import { parseBookmarkEnd, parseBookmarkStart } from "./bookmarkParser.js";
|
|
3
3
|
import { CAPTURE, dispatchChildrenWithContext, ownedElsewhere, withPreservedChildren } from "./containerChildren.js";
|
|
4
4
|
import { computeListMarker } from "./listMarkerComputation.js";
|
|
5
|
-
import { BLOCK_MOVE_RANGE_MARKER_HANDLERS } from "./markupRangeMarker.js";
|
|
5
|
+
import { BLOCK_COMMENT_RANGE_MARKER_HANDLERS, BLOCK_MOVE_RANGE_MARKER_HANDLERS } from "./markupRangeMarker.js";
|
|
6
6
|
import { parseParagraph } from "./paragraphParser.js";
|
|
7
7
|
import { enrichParagraphTextBoxes } from "./paragraphTextBoxEnrichment.js";
|
|
8
8
|
import { standalonePreviewLedger } from "./previewBudget.js";
|
|
@@ -104,10 +104,9 @@ const BLOCK_CONTENT_HANDLERS = {
|
|
|
104
104
|
modelled.push(parseBookmarkEnd(child));
|
|
105
105
|
},
|
|
106
106
|
...BLOCK_MOVE_RANGE_MARKER_HANDLERS,
|
|
107
|
+
...BLOCK_COMMENT_RANGE_MARKER_HANDLERS,
|
|
107
108
|
...BLOCK_CHILD_OWNERS,
|
|
108
109
|
altChunk: CAPTURE,
|
|
109
|
-
commentRangeEnd: CAPTURE,
|
|
110
|
-
commentRangeStart: CAPTURE,
|
|
111
110
|
customXmlDelRangeEnd: CAPTURE,
|
|
112
111
|
customXmlDelRangeStart: CAPTURE,
|
|
113
112
|
customXmlInsRangeEnd: CAPTURE,
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { document_d_exports } from "../types/document.js";
|
|
2
|
+
/**
|
|
3
|
+
* Collapse each bookmark's markers in paragraphs to its first start and its
|
|
4
|
+
* last end. Answers how many markers were dropped.
|
|
5
|
+
*/
|
|
6
|
+
export declare const joinBookmarkRangesAcrossParagraphs: (blocks: readonly document_d_exports.BlockContent[]) => number;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { InlineContentRemovals } from "./inlineContentRemovals.js";
|
|
2
|
+
import { visitInlineContentSlots } from "./paragraphTraversal.js";
|
|
3
|
+
// src/docx/bookmarkRangeJoin.ts
|
|
4
|
+
const visitBookmarkMarkers = (blocks, visit) => {
|
|
5
|
+
for (const block of blocks) switch (block.type) {
|
|
6
|
+
case "paragraph":
|
|
7
|
+
visitInlineContentSlots(block, ({ content, index, item }) => {
|
|
8
|
+
if (item.type === "bookmarkStart") visit({
|
|
9
|
+
content,
|
|
10
|
+
index
|
|
11
|
+
}, "start", item.id);
|
|
12
|
+
else if (item.type === "bookmarkEnd") visit({
|
|
13
|
+
content,
|
|
14
|
+
index
|
|
15
|
+
}, "end", item.id);
|
|
16
|
+
});
|
|
17
|
+
break;
|
|
18
|
+
case "table":
|
|
19
|
+
for (const row of block.rows) for (const cell of row.cells) visitBookmarkMarkers(cell.content, visit);
|
|
20
|
+
break;
|
|
21
|
+
case "blockSdt":
|
|
22
|
+
case "blockCustomXml": visitBookmarkMarkers(block.content, visit);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Collapse each bookmark's markers in paragraphs to its first start and its
|
|
27
|
+
* last end. Answers how many markers were dropped.
|
|
28
|
+
*/
|
|
29
|
+
const joinBookmarkRangesAcrossParagraphs = (blocks) => {
|
|
30
|
+
const starts = /* @__PURE__ */ new Map();
|
|
31
|
+
const ends = /* @__PURE__ */ new Map();
|
|
32
|
+
visitBookmarkMarkers(blocks, (slot, type, id) => {
|
|
33
|
+
const byId = type === "start" ? starts : ends;
|
|
34
|
+
const slots = byId.get(id);
|
|
35
|
+
if (slots) slots.push(slot);
|
|
36
|
+
else byId.set(id, [slot]);
|
|
37
|
+
});
|
|
38
|
+
const removals = new InlineContentRemovals();
|
|
39
|
+
for (const slots of starts.values()) for (const slot of slots.slice(1)) removals.mark(slot);
|
|
40
|
+
for (const slots of ends.values()) for (const slot of slots.slice(0, -1)) removals.mark(slot);
|
|
41
|
+
return removals.apply();
|
|
42
|
+
};
|
|
43
|
+
export { joinBookmarkRangesAcrossParagraphs };
|