@stll/folio-core 0.14.1 → 0.15.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 +2 -2
- package/dist/ai-edits/blockRange.d.ts +3 -17
- package/dist/ai-edits/clean-text.d.ts +0 -1
- package/dist/ai-edits/headless.d.ts +23 -19
- package/dist/ai-edits/read.d.ts +8 -5
- package/dist/ai-edits/scoped-reading.d.ts +0 -1
- package/dist/ai-edits/snapshot.d.ts +1 -7
- package/dist/ai-edits/table-cell-mutations.d.ts +4 -31
- package/dist/ai-edits/table-row-column-mutations.d.ts +9 -39
- package/dist/ai-edits/table-targets.d.ts +0 -1
- package/dist/ai-edits/types.d.ts +32 -17
- package/dist/ai-suggestions/apply.d.ts +0 -1
- package/dist/ai-suggestions/conflict.d.ts +0 -1
- package/dist/ai-suggestions/text-positions.d.ts +2 -2
- package/dist/ai-suggestions/types.d.ts +27 -13
- package/dist/compat/eigenpal.d.ts +2 -1
- package/dist/compat/eigenpal.js +2 -1
- package/dist/content-controls/errors.d.ts +0 -1
- package/dist/content-controls/findContentControls.d.ts +6 -4
- package/dist/content-controls/mutateContentControls.d.ts +0 -1
- package/dist/controller/activeEditorStory.d.ts +1 -6
- package/dist/controller/collaborationModules.d.ts +0 -1
- package/dist/controller/contentControlWidgetController.d.ts +0 -1
- package/dist/controller/folioEditor.d.ts +2 -2
- package/dist/controller/folioEditorEvents.d.ts +5 -3
- package/dist/controller/fontReadiness.d.ts +0 -1
- package/dist/controller/headerFooterEditorManager.d.ts +1 -5
- package/dist/controller/hiddenEditorApi.d.ts +35 -18
- package/dist/controller/hiddenEditorManager.d.ts +5 -3
- package/dist/controller/latestRequestGate.d.ts +3 -1
- package/dist/controller/layoutPipeline.d.ts +1 -1
- package/dist/controller/layoutScheduler.d.ts +8 -5
- package/dist/controller/layoutSession.d.ts +0 -1
- package/dist/controller/noteEditorManager.d.ts +0 -1
- package/dist/document-operations.d.ts +5 -12
- package/dist/document-stories.d.ts +0 -1
- package/dist/docx/blockContentParser.d.ts +0 -1
- package/dist/docx/blockContentParser.js +1 -0
- package/dist/docx/bookmarkParser.d.ts +5 -3
- package/dist/docx/bookmarkPlacement.d.ts +0 -1
- package/dist/docx/commentParser.d.ts +0 -1
- package/dist/docx/commentRangeIntegrity.d.ts +0 -1
- package/dist/docx/commentReferenceNormalization.d.ts +1 -9
- package/dist/docx/commentReplyMarkers.d.ts +0 -1
- package/dist/docx/compatibility.d.ts +0 -1
- package/dist/docx/conformance.d.ts +0 -1
- package/dist/docx/corePropertiesParser.d.ts +0 -1
- package/dist/docx/documentParser.d.ts +0 -1
- package/dist/docx/documentParser.js +3 -1
- package/dist/docx/drawingUtils.d.ts +23 -2
- package/dist/docx/drawingUtils.js +23 -1
- package/dist/docx/encryption/agileDecryption.d.ts +0 -1
- package/dist/docx/encryption/cryptoBytes.js +4 -1
- package/dist/docx/encryption/openEncryptedDocx.d.ts +5 -2
- package/dist/docx/ensureParaIds.d.ts +7 -3
- package/dist/docx/fieldParser.d.ts +23 -11
- package/dist/docx/fontTableParser.d.ts +0 -1
- package/dist/docx/footnoteParser.d.ts +26 -13
- package/dist/docx/footnoteParser.js +4 -2
- package/dist/docx/groupDrawingParser.d.ts +0 -1
- package/dist/docx/headerFooterParser.d.ts +9 -5
- package/dist/docx/headerFooterRefParser.d.ts +0 -1
- package/dist/docx/headerFooterReferenceNormalization.d.ts +1 -6
- package/dist/docx/headerFooterVerbatim.d.ts +2 -2
- package/dist/docx/hyperlinkParser.d.ts +0 -1
- package/dist/docx/hyperlinkParser.js +1 -9
- package/dist/docx/imageParser.d.ts +0 -1
- package/dist/docx/imageParser.js +15 -7
- package/dist/docx/mathToMathml.d.ts +0 -1
- package/dist/docx/metadataPrivacy.d.ts +1 -3
- package/dist/docx/modelValidation.d.ts +0 -1
- package/dist/docx/newImage.d.ts +11 -0
- package/dist/docx/newImage.js +11 -0
- package/dist/docx/normalizeBaseDirection.d.ts +0 -1
- package/dist/docx/notePropertiesParser.d.ts +0 -1
- package/dist/docx/numberingParser.d.ts +10 -6
- package/dist/docx/numberingParser.js +4 -2
- package/dist/docx/numberingReferenceNormalization.d.ts +1 -9
- package/dist/docx/paragraphParser.d.ts +0 -1
- package/dist/docx/paragraphParser.js +27 -14
- package/dist/docx/paragraphTextBoxEnrichment.d.ts +0 -1
- package/dist/docx/paragraphTextBoxEnrichment.js +2 -1
- package/dist/docx/paragraphTraversal.d.ts +1 -8
- package/dist/docx/parser.d.ts +15 -8
- package/dist/docx/parser.js +12 -1
- package/dist/docx/parserEnums.d.ts +2 -2
- package/dist/docx/parserEnums.js +3 -2
- package/dist/docx/relsParser.d.ts +1 -0
- package/dist/docx/renderedPageBreakNormalization.d.ts +12 -0
- package/dist/docx/renderedPageBreakNormalization.js +59 -0
- package/dist/docx/replyToComment.d.ts +2 -2
- package/dist/docx/rezip.d.ts +6 -7
- package/dist/docx/rezip.js +136 -102
- package/dist/docx/runConsolidator.d.ts +0 -1
- package/dist/docx/runParser.d.ts +0 -1
- package/dist/docx/runParser.js +9 -12
- package/dist/docx/sdtProperties.d.ts +0 -1
- package/dist/docx/sdtPropertiesPatch.d.ts +0 -1
- package/dist/docx/sectionParser.d.ts +0 -1
- package/dist/docx/selectiveSave.d.ts +5 -3
- package/dist/docx/selectiveSave.js +2 -2
- package/dist/docx/selectiveSaveFlags.d.ts +4 -2
- package/dist/docx/selectiveXmlPatch.js +20 -8
- package/dist/docx/serializer/blockSdtSerializer.d.ts +0 -1
- package/dist/docx/serializer/blockSdtSerializer.js +2 -1
- package/dist/docx/serializer/borderSerializer.d.ts +0 -1
- package/dist/docx/serializer/commentSerializer.d.ts +0 -1
- package/dist/docx/serializer/commentSerializer.js +11 -37
- package/dist/docx/serializer/documentSerializer.d.ts +0 -1
- package/dist/docx/serializer/documentSerializer.js +1 -1
- package/dist/docx/serializer/fontTableSerializer.d.ts +0 -1
- package/dist/docx/serializer/headerFooterSerializer.d.ts +0 -1
- package/dist/docx/serializer/headerFooterSerializer.js +1 -1
- package/dist/docx/serializer/noteSerializer.d.ts +0 -1
- package/dist/docx/serializer/noteSerializer.js +1 -1
- package/dist/docx/serializer/numberingSerializer.d.ts +0 -1
- package/dist/docx/serializer/paragraphSerializer.d.ts +0 -1
- package/dist/docx/serializer/paragraphSerializer.js +10 -23
- package/dist/docx/serializer/runSerializer.d.ts +0 -1
- package/dist/docx/serializer/runSerializer.js +37 -22
- package/dist/docx/serializer/sectionPropertiesSerializer.d.ts +0 -1
- package/dist/docx/serializer/sectionPropertiesSerializer.js +5 -4
- package/dist/docx/serializer/settingsSerializer.d.ts +0 -1
- package/dist/docx/serializer/stylesSerializer.d.ts +0 -1
- package/dist/docx/serializer/tableSerializer.d.ts +0 -1
- package/dist/docx/serializer/tableSerializer.js +2 -0
- package/dist/docx/serializer/themeSerializer.d.ts +0 -1
- package/dist/docx/serializer/xmlUtils.js +10 -1
- package/dist/docx/server/applyDocxXmlPatchProposal.d.ts +3 -10
- package/dist/docx/server/docxToMarkdown.d.ts +0 -1
- package/dist/docx/server/evaluateDocxXmlPatchProposal.d.ts +3 -9
- package/dist/docx/server/inspectDocxPackage.d.ts +3 -8
- package/dist/docx/server/validateDocxConformance.d.ts +0 -1
- package/dist/docx/settingsParser.d.ts +2 -2
- package/dist/docx/shapeParser.d.ts +0 -1
- package/dist/docx/shapeParser.js +11 -10
- package/dist/docx/streamingXmlParser.d.ts +16 -0
- package/dist/docx/streamingXmlParser.js +248 -0
- package/dist/docx/styleParser.d.ts +0 -1
- package/dist/docx/styleParser.js +6 -4
- package/dist/docx/tableParser.d.ts +1 -2
- package/dist/docx/tableParser.js +3 -6
- package/dist/docx/textBoxParser.d.ts +1 -2
- package/dist/docx/textBoxParser.js +4 -1
- package/dist/docx/textWhitespace.d.ts +4 -0
- package/dist/docx/textWhitespace.js +4 -0
- package/dist/docx/themeParser.d.ts +0 -1
- package/dist/docx/trackedMoveRangeNormalization.d.ts +1 -8
- package/dist/docx/unzip.d.ts +6 -3
- package/dist/docx/unzip.js +96 -40
- package/dist/docx/vmlImageParser.d.ts +0 -1
- package/dist/docx/vmlImageParser.js +3 -1
- package/dist/docx/watermarkParser.d.ts +0 -1
- package/dist/docx/xmlParser.d.ts +21 -8
- package/dist/docx/xmlParser.js +126 -43
- package/dist/fields/bookmarkPages.d.ts +0 -1
- package/dist/fields/bookmarkText.d.ts +0 -1
- package/dist/fields/evaluateField.d.ts +5 -3
- package/dist/fields/fieldContext.d.ts +11 -5
- package/dist/fields/resolveFieldValues.d.ts +4 -3
- package/dist/fields/sectionPageCounts.d.ts +0 -1
- package/dist/fields/seqValues.d.ts +0 -1
- package/dist/fonts/embeddedFontTable.d.ts +5 -2
- package/dist/fonts/embeddedFonts.d.ts +15 -7
- package/dist/index.d.ts +3 -1
- package/dist/index.js +2 -1
- package/dist/layout-bridge/cellSelectionHighlight.d.ts +0 -1
- package/dist/layout-bridge/convert/footnoteLayout.d.ts +5 -3
- package/dist/layout-bridge/convert/headerFooterLayout.d.ts +2 -2
- package/dist/layout-bridge/convert/paragraphFrames.d.ts +0 -1
- package/dist/layout-bridge/convert/templatePreviewFlow.d.ts +8 -8
- package/dist/layout-bridge/convert/toFlowBlocks.d.ts +25 -13
- package/dist/layout-bridge/convert/wrapEditorViewAsSurface.d.ts +3 -2
- package/dist/layout-bridge/dom/findHfPmSpans.d.ts +2 -1
- package/dist/layout-bridge/dom/noteStoryDom.d.ts +0 -1
- package/dist/layout-bridge/engine/clickToPosition.d.ts +5 -3
- package/dist/layout-bridge/engine/hitTest.d.ts +40 -19
- package/dist/layout-bridge/engine/selectionRects.d.ts +16 -8
- package/dist/layout-bridge/engine/tableWidthUtils.d.ts +0 -1
- package/dist/layout-bridge/headerFooterLayout.d.ts +0 -1
- package/dist/layout-bridge/sectionColumns.d.ts +0 -1
- package/dist/layout-bridge/tableInsertHover.d.ts +8 -4
- package/dist/layout-engine/headerFooterRefs.d.ts +0 -1
- package/dist/layout-engine/index.d.ts +0 -1
- package/dist/layout-engine/justificationCompatibility.d.ts +0 -1
- package/dist/layout-engine/keep-together.d.ts +7 -4
- package/dist/layout-engine/layoutInstrumentation.d.ts +0 -1
- package/dist/layout-engine/lineFlow.d.ts +0 -1
- package/dist/layout-engine/measure/cache.d.ts +0 -1
- package/dist/layout-engine/measure/effectiveLineBreakPolicy.d.ts +6 -7
- package/dist/layout-engine/measure/floatingTablePosition.d.ts +0 -1
- package/dist/layout-engine/measure/floatingZones.d.ts +14 -6
- package/dist/layout-engine/measure/font-metrics.worker.d.ts +0 -1
- package/dist/layout-engine/measure/lineBreakProvider.d.ts +20 -9
- package/dist/layout-engine/measure/lineBreaks.d.ts +0 -1
- package/dist/layout-engine/measure/listMarkerWidth.d.ts +0 -1
- package/dist/layout-engine/measure/measureBlocks.d.ts +1 -0
- package/dist/layout-engine/measure/measureContainer.d.ts +0 -1
- package/dist/layout-engine/measure/measureHelpers.d.ts +0 -1
- package/dist/layout-engine/measure/measureParagraph.d.ts +3 -2
- package/dist/layout-engine/measure/measureParagraph.js +23 -3
- package/dist/layout-engine/measure/measureProvider.d.ts +0 -1
- package/dist/layout-engine/measure/measureTypes.d.ts +4 -2
- package/dist/layout-engine/measure/measureWorker.d.ts +0 -1
- package/dist/layout-engine/measure/measureWorkerProtocol.d.ts +0 -1
- package/dist/layout-engine/measure/tableCellFloating.d.ts +0 -1
- package/dist/layout-engine/measure/tableCellFlow.d.ts +0 -1
- package/dist/layout-engine/measure/tableCellGrid.d.ts +0 -1
- package/dist/layout-engine/measure/textBoxParagraphLayout.d.ts +0 -1
- package/dist/layout-engine/measure/textMeasurementPolicy.d.ts +0 -1
- package/dist/layout-engine/paginator.d.ts +66 -33
- package/dist/layout-engine/paragraphFragmentRange.d.ts +0 -1
- package/dist/layout-engine/paragraphFrame.d.ts +0 -1
- package/dist/layout-engine/paragraphSequence.d.ts +0 -1
- package/dist/layout-engine/paragraphSpacing.d.ts +1 -5
- package/dist/layout-engine/pmPageIndex.d.ts +0 -1
- package/dist/layout-engine/renderedBreakReconciliation.d.ts +2 -17
- package/dist/layout-engine/section-breaks.d.ts +34 -17
- package/dist/layout-engine/tableRowBreak.d.ts +4 -3
- package/dist/layout-engine/textBoxFlow.d.ts +0 -1
- package/dist/layout-engine/textBoxGroup.d.ts +0 -1
- package/dist/layout-engine/types.d.ts +382 -189
- package/dist/layout-painter/anchoredImagePosition.d.ts +0 -1
- package/dist/layout-painter/borderStroke.d.ts +0 -1
- package/dist/layout-painter/imageLayout.d.ts +14 -7
- package/dist/layout-painter/index.d.ts +9 -5
- package/dist/layout-painter/registry/modules/image.d.ts +0 -1
- package/dist/layout-painter/registry/modules/paragraph.d.ts +0 -1
- package/dist/layout-painter/registry/modules/table.d.ts +0 -1
- package/dist/layout-painter/registry/modules/textBox.d.ts +0 -1
- package/dist/layout-painter/registry/modules.d.ts +0 -1
- package/dist/layout-painter/registry/registry.d.ts +0 -1
- package/dist/layout-painter/registry/types.d.ts +0 -1
- package/dist/layout-painter/renderFragment.d.ts +2 -2
- package/dist/layout-painter/renderImage.d.ts +0 -1
- package/dist/layout-painter/renderPage.d.ts +71 -42
- package/dist/layout-painter/renderParagraph.d.ts +28 -14
- package/dist/layout-painter/renderParagraph.js +6 -2
- package/dist/layout-painter/renderTable.d.ts +0 -1
- package/dist/layout-painter/renderTextBox.d.ts +0 -1
- package/dist/layout-painter/renderUtils.d.ts +17 -9
- package/dist/layout-painter/renderWatermark.d.ts +2 -2
- package/dist/layout-painter/sdtBoundary.d.ts +0 -1
- package/dist/managers/AutoSaveManager.d.ts +22 -11
- package/dist/managers/ClipboardManager.d.ts +0 -1
- package/dist/managers/ContextMenuManager.d.ts +5 -8
- package/dist/managers/DocumentLoaderManager.d.ts +12 -6
- package/dist/managers/EditorModeManager.d.ts +3 -2
- package/dist/managers/ErrorManager.d.ts +0 -1
- package/dist/managers/FindReplaceManager.d.ts +0 -1
- package/dist/managers/HistoryManager.d.ts +19 -9
- package/dist/managers/TableSelectionManager.d.ts +0 -1
- package/dist/managers/editorShortcuts.d.ts +4 -6
- package/dist/markdown/annotations.d.ts +0 -1
- package/dist/markdown/fromMarkdown.d.ts +0 -1
- package/dist/markdown/fromMarkdown.js +55 -5
- package/dist/markdown/images.d.ts +0 -1
- package/dist/markdown/index.d.ts +0 -1
- package/dist/markdown/internals.d.ts +0 -1
- package/dist/markdown/renderBlock.d.ts +0 -1
- package/dist/markdown/renderParagraph.d.ts +0 -1
- package/dist/markdown/renderRuns.d.ts +0 -1
- package/dist/markdown/renderTable.d.ts +0 -1
- package/dist/markdown/trailers.d.ts +0 -1
- package/dist/markdown/types.d.ts +39 -18
- package/dist/model.d.ts +3 -5
- package/dist/model.js +2 -2
- package/dist/paged-layout/incrementalMeasure.d.ts +1 -10
- package/dist/paged-layout/pageText.d.ts +1 -1
- package/dist/paged-layout/paragraphFlash.d.ts +0 -1
- package/dist/paged-layout/paragraphFlashTypes.d.ts +5 -2
- package/dist/paged-layout/rangeProjection.d.ts +10 -5
- package/dist/paged-layout/scrollNavigation.d.ts +0 -1
- package/dist/paged-layout/scrollPageInfo.d.ts +12 -13
- package/dist/paged-layout/scrollToPmPosition.d.ts +0 -1
- package/dist/paged-layout/sectionBlockWidths.d.ts +2 -11
- package/dist/paged-layout/sectionGeometry.d.ts +0 -1
- package/dist/paged-layout/selectionViewportRect.d.ts +0 -1
- package/dist/paged-layout/transactionDirtyRange.d.ts +0 -1
- package/dist/paged-layout/zoomScrollAnchor.d.ts +2 -12
- package/dist/prosemirror/attrs/index.d.ts +2 -2
- package/dist/prosemirror/attrs/index.js +5 -0
- package/dist/prosemirror/autospacingBase.d.ts +0 -1
- package/dist/prosemirror/cellDragSelection.d.ts +6 -4
- package/dist/prosemirror/commands/comments.d.ts +6 -4
- package/dist/prosemirror/commands/contentControls.d.ts +5 -3
- package/dist/prosemirror/commands/contentControlsBlockFill.d.ts +1 -1
- package/dist/prosemirror/commands/formatPainter.d.ts +0 -1
- package/dist/prosemirror/commands/formatting.d.ts +1 -1
- package/dist/prosemirror/commands/hyperlink.d.ts +4 -9
- package/dist/prosemirror/commands/image.d.ts +0 -1
- package/dist/prosemirror/commands/pageBreak.d.ts +0 -1
- package/dist/prosemirror/commands/paragraph.d.ts +0 -1
- package/dist/prosemirror/commands/pastePlainText.d.ts +0 -1
- package/dist/prosemirror/commands/propertyChangeScope.d.ts +0 -1
- package/dist/prosemirror/commands/sectionBreak.d.ts +0 -1
- package/dist/prosemirror/commands/table.d.ts +0 -1
- package/dist/prosemirror/commands/tableCellMergeResolution.d.ts +0 -1
- package/dist/prosemirror/commentIdAllocator.d.ts +2 -2
- package/dist/prosemirror/commentOps.d.ts +0 -1
- package/dist/prosemirror/conversion/effectiveTableCellFormatting.d.ts +1 -10
- package/dist/prosemirror/conversion/fromProseDoc.d.ts +0 -1
- package/dist/prosemirror/conversion/fromProseDoc.js +7 -4
- package/dist/prosemirror/conversion/runShadingMark.d.ts +0 -1
- package/dist/prosemirror/conversion/sdtAttrs.d.ts +0 -1
- package/dist/prosemirror/conversion/toProseDoc.d.ts +3 -2
- package/dist/prosemirror/conversion/toProseDoc.js +16 -2
- package/dist/prosemirror/extensions/ExtensionManager.d.ts +0 -1
- package/dist/prosemirror/extensions/StarterKit.d.ts +7 -4
- package/dist/prosemirror/extensions/core/DocExtension.d.ts +0 -1
- package/dist/prosemirror/extensions/core/HistoryExtension.d.ts +0 -1
- package/dist/prosemirror/extensions/core/ParagraphExtension.d.ts +0 -1
- package/dist/prosemirror/extensions/core/TextExtension.d.ts +0 -1
- package/dist/prosemirror/extensions/create.d.ts +0 -1
- package/dist/prosemirror/extensions/features/AutoBidiDetectionExtension.d.ts +0 -1
- package/dist/prosemirror/extensions/features/BaseKeymapExtension.d.ts +0 -1
- package/dist/prosemirror/extensions/features/BidiShortcutExtension.d.ts +0 -1
- package/dist/prosemirror/extensions/features/ContentControlWidgetsExtension.d.ts +0 -1
- package/dist/prosemirror/extensions/features/DropCursorExtension.d.ts +0 -1
- package/dist/prosemirror/extensions/features/EmptyParagraphFormatExtension.d.ts +0 -1
- package/dist/prosemirror/extensions/features/GapCursorExtension.d.ts +0 -1
- package/dist/prosemirror/extensions/features/ImageDragExtension.d.ts +0 -1
- package/dist/prosemirror/extensions/features/ImagePasteExtension.d.ts +0 -1
- package/dist/prosemirror/extensions/features/ListExtension.d.ts +0 -1
- package/dist/prosemirror/extensions/features/ParaIdAllocatorExtension.d.ts +0 -1
- package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.d.ts +7 -4
- package/dist/prosemirror/extensions/features/PasteCleanupExtension.d.ts +0 -1
- package/dist/prosemirror/extensions/features/PasteStyleInlinerExtension.d.ts +0 -1
- package/dist/prosemirror/extensions/features/SelectionTrackerExtension.d.ts +0 -1
- package/dist/prosemirror/extensions/features/bidiShortcutController.d.ts +3 -1
- package/dist/prosemirror/extensions/marks/AllCapsExtension.d.ts +0 -1
- package/dist/prosemirror/extensions/marks/BoldExtension.d.ts +0 -1
- package/dist/prosemirror/extensions/marks/CharacterSpacingExtension.d.ts +0 -1
- package/dist/prosemirror/extensions/marks/CharacterStyleExtension.d.ts +0 -1
- package/dist/prosemirror/extensions/marks/CommentExtension.d.ts +0 -1
- package/dist/prosemirror/extensions/marks/FontFamilyExtension.d.ts +0 -1
- package/dist/prosemirror/extensions/marks/FontFamilyExtension.js +1 -0
- package/dist/prosemirror/extensions/marks/FontSizeExtension.d.ts +0 -1
- package/dist/prosemirror/extensions/marks/FootnoteRefExtension.d.ts +0 -1
- package/dist/prosemirror/extensions/marks/HiddenTextExtension.d.ts +0 -1
- package/dist/prosemirror/extensions/marks/HighlightExtension.d.ts +0 -1
- package/dist/prosemirror/extensions/marks/HyperlinkExtension.d.ts +0 -1
- package/dist/prosemirror/extensions/marks/ItalicExtension.d.ts +0 -1
- package/dist/prosemirror/extensions/marks/LanguageExtension.d.ts +0 -1
- package/dist/prosemirror/extensions/marks/RtlExtension.d.ts +0 -1
- package/dist/prosemirror/extensions/marks/RunFormattingOverrideExtension.d.ts +0 -1
- package/dist/prosemirror/extensions/marks/RunShadingExtension.d.ts +0 -1
- package/dist/prosemirror/extensions/marks/SmallCapsExtension.d.ts +0 -1
- package/dist/prosemirror/extensions/marks/StrikeExtension.d.ts +0 -1
- package/dist/prosemirror/extensions/marks/SubscriptExtension.d.ts +0 -1
- package/dist/prosemirror/extensions/marks/SuperscriptExtension.d.ts +0 -1
- package/dist/prosemirror/extensions/marks/TextColorExtension.d.ts +0 -1
- package/dist/prosemirror/extensions/marks/TextEffectExtension.d.ts +0 -1
- package/dist/prosemirror/extensions/marks/TextEffectsExtensions.d.ts +0 -1
- package/dist/prosemirror/extensions/marks/TrackedChangeExtensions.d.ts +0 -1
- package/dist/prosemirror/extensions/marks/UnderlineExtension.d.ts +0 -1
- package/dist/prosemirror/extensions/marks/markUtils.d.ts +0 -1
- package/dist/prosemirror/extensions/marks/markUtils.js +4 -1
- package/dist/prosemirror/extensions/nodes/BlockSdtExtension.d.ts +0 -1
- package/dist/prosemirror/extensions/nodes/FieldExtension.d.ts +0 -1
- package/dist/prosemirror/extensions/nodes/HardBreakExtension.d.ts +0 -1
- package/dist/prosemirror/extensions/nodes/HorizontalRuleExtension.d.ts +0 -1
- package/dist/prosemirror/extensions/nodes/ImageExtension.d.ts +0 -1
- package/dist/prosemirror/extensions/nodes/ImageExtension.js +2 -0
- package/dist/prosemirror/extensions/nodes/MathExtension.d.ts +0 -1
- package/dist/prosemirror/extensions/nodes/PageBreakExtension.d.ts +0 -1
- package/dist/prosemirror/extensions/nodes/RenderedPageBreakExtension.d.ts +0 -1
- package/dist/prosemirror/extensions/nodes/SdtExtension.d.ts +0 -1
- package/dist/prosemirror/extensions/nodes/ShapeExtension.d.ts +0 -1
- package/dist/prosemirror/extensions/nodes/ShapeExtension.js +2 -0
- package/dist/prosemirror/extensions/nodes/TabExtension.d.ts +0 -1
- package/dist/prosemirror/extensions/nodes/TableExtension.d.ts +4 -3
- package/dist/prosemirror/extensions/nodes/TextBoxAnchorExtension.d.ts +0 -1
- package/dist/prosemirror/extensions/nodes/TextBoxExtension.d.ts +53 -27
- package/dist/prosemirror/extensions/types.d.ts +0 -1
- package/dist/prosemirror/findReplaceSelection.d.ts +5 -3
- package/dist/prosemirror/imageCommit.d.ts +0 -1
- package/dist/prosemirror/index.d.ts +4 -0
- package/dist/prosemirror/insertOperations.d.ts +0 -1
- package/dist/prosemirror/paraText.d.ts +0 -1
- package/dist/prosemirror/plugins/aiCitationDecorations.d.ts +2 -2
- package/dist/prosemirror/plugins/aiSuggestionDecorations.d.ts +0 -1
- package/dist/prosemirror/plugins/anonymizationDecorations.d.ts +9 -7
- package/dist/prosemirror/plugins/autocompleteSuggestion.d.ts +2 -2
- package/dist/prosemirror/plugins/contentControlWidgets.d.ts +4 -7
- package/dist/prosemirror/plugins/createDocScanPlugin.d.ts +3 -8
- package/dist/prosemirror/plugins/documentStyles.d.ts +0 -1
- package/dist/prosemirror/plugins/pmTextScan.d.ts +2 -2
- package/dist/prosemirror/plugins/revisionIds.d.ts +0 -1
- package/dist/prosemirror/plugins/selectionTracker.d.ts +23 -12
- package/dist/prosemirror/plugins/suggestionMode.d.ts +0 -1
- package/dist/prosemirror/plugins/templateDirectives.d.ts +10 -8
- package/dist/prosemirror/plugins/templatePreviewValues.d.ts +10 -5
- package/dist/prosemirror/plugins/templateSlashMenu.d.ts +2 -2
- package/dist/prosemirror/queries.d.ts +0 -1
- package/dist/prosemirror/schema/index.d.ts +0 -1
- package/dist/prosemirror/schema/marks.d.ts +8 -5
- package/dist/prosemirror/schema/nodes.d.ts +340 -163
- package/dist/prosemirror/selectionState.d.ts +13 -7
- package/dist/prosemirror/styles/resolvedStyleAttrs.d.ts +0 -1
- package/dist/prosemirror/styles/styleResolver.d.ts +3 -2
- package/dist/prosemirror/tableCellMergeRevision.d.ts +0 -1
- package/dist/prosemirror/tableResize.d.ts +0 -1
- package/dist/prosemirror/textBoxAnchorAttrs.d.ts +0 -1
- package/dist/prosemirror/utils/extractTrackedChanges.d.ts +8 -5
- package/dist/prosemirror/utils/findParagraphByParaId.d.ts +0 -1
- package/dist/prosemirror/utils/tabCalculator.d.ts +18 -7
- package/dist/prosemirror/utils/visualLineNavigation.d.ts +0 -1
- package/dist/prosemirror/validation.d.ts +0 -1
- package/dist/redline.d.ts +16 -8
- package/dist/render-dom/BodySelectionOverlay.d.ts +1 -9
- package/dist/render-dom/HeaderFooterSelectionOverlay.d.ts +0 -1
- package/dist/render-dom/RemoteSelectionOverlay.d.ts +1 -8
- package/dist/render-dom/resolveSidebarItemPositions.d.ts +1 -9
- package/dist/style-engine/styleEngine.d.ts +21 -11
- package/dist/style-sets/extract.d.ts +4 -3
- package/dist/style-sets/stellaStyle.d.ts +0 -1
- package/dist/style-sets/types.d.ts +0 -1
- package/dist/symbols.d.ts +6 -2
- package/dist/types/block-id.d.ts +3 -6
- package/dist/types/document.d.ts +0 -3
- package/dist/types/documentEnumValues.d.ts +2 -1
- package/dist/types/documentEnumValues.js +6 -1
- package/dist/utils/clipboard.d.ts +17 -8
- package/dist/utils/colorResolver.d.ts +9 -5
- package/dist/utils/createDocument.d.ts +19 -10
- package/dist/utils/documentLoaderBehavior.d.ts +1 -5
- package/dist/utils/docxInput.js +1 -0
- package/dist/utils/findReplace.d.ts +0 -1
- package/dist/utils/fontFamilyMerge.d.ts +0 -1
- package/dist/utils/fontResolver.d.ts +10 -4
- package/dist/utils/formatToStyle.d.ts +0 -1
- package/dist/utils/headerFooter.d.ts +8 -16
- package/dist/utils/headingCollector.d.ts +7 -4
- package/dist/utils/mergeDocumentContent.d.ts +28 -0
- package/dist/utils/mergeDocumentContent.js +145 -0
- package/dist/utils/paragraphFormattingMerge.d.ts +0 -1
- package/dist/utils/replaceText.d.ts +0 -1
- package/dist/utils/rotationBoundingBox.d.ts +0 -1
- package/dist/utils/tableOperations.d.ts +0 -1
- package/dist/utils/textFormattingMerge.d.ts +0 -1
- package/dist/version-comparison.d.ts +12 -6
- package/dist/watermark/index.d.ts +0 -1
- package/package.json +3 -3
package/dist/docx/xmlParser.d.ts
CHANGED
|
@@ -79,7 +79,7 @@ declare function parseXmlDocument(xml: string): XmlElement | null;
|
|
|
79
79
|
* Get local name from a prefixed element name
|
|
80
80
|
* e.g., "w:p" -> "p", "a:graphic" -> "graphic"
|
|
81
81
|
*/
|
|
82
|
-
declare function getLocalName(name: string): string;
|
|
82
|
+
declare function getLocalName(name: string | undefined): string;
|
|
83
83
|
/**
|
|
84
84
|
* Get namespace prefix from an element name
|
|
85
85
|
* e.g., "w:p" -> "w", "a:graphic" -> "a"
|
|
@@ -92,7 +92,7 @@ declare function getNamespacePrefix(name: string): string | null;
|
|
|
92
92
|
* @param namespace - Namespace prefix (e.g., "w", "a")
|
|
93
93
|
* @param localName - Local element name (e.g., "p", "r")
|
|
94
94
|
*/
|
|
95
|
-
declare function matchesName(element: XmlElement,
|
|
95
|
+
declare function matchesName(element: XmlElement, _namespace: string, localName: string): boolean;
|
|
96
96
|
/**
|
|
97
97
|
* Find first child element matching the given namespaced name
|
|
98
98
|
*
|
|
@@ -101,7 +101,7 @@ declare function matchesName(element: XmlElement, namespace: string, localName:
|
|
|
101
101
|
* @param localName - Local element name (e.g., "p")
|
|
102
102
|
* @returns First matching child or null
|
|
103
103
|
*/
|
|
104
|
-
declare function findChild(parent: XmlElement | null | undefined,
|
|
104
|
+
declare function findChild(parent: XmlElement | null | undefined, _namespace: string, localName: string): XmlElement | null;
|
|
105
105
|
/**
|
|
106
106
|
* Find all child elements matching the given namespaced name
|
|
107
107
|
*
|
|
@@ -110,7 +110,7 @@ declare function findChild(parent: XmlElement | null | undefined, namespace: str
|
|
|
110
110
|
* @param localName - Local element name
|
|
111
111
|
* @returns Array of matching children
|
|
112
112
|
*/
|
|
113
|
-
declare function findChildren(parent: XmlElement | null | undefined,
|
|
113
|
+
declare function findChildren(parent: XmlElement | null | undefined, _namespace: string, localName: string): XmlElement[];
|
|
114
114
|
/**
|
|
115
115
|
* Find first child element by local name only (ignoring namespace)
|
|
116
116
|
*
|
|
@@ -237,6 +237,14 @@ declare function parseColorElement(element: XmlElement | null | undefined): {
|
|
|
237
237
|
* @returns Parsed number or undefined
|
|
238
238
|
*/
|
|
239
239
|
declare function parseNumericAttribute(element: XmlElement | null | undefined, namespace: string | null, name: string, scale?: number): number | undefined;
|
|
240
|
+
/**
|
|
241
|
+
* Parse a zero-based numbering level reference.
|
|
242
|
+
*
|
|
243
|
+
* OOXML numbering levels cannot be negative. Some producers emit negative
|
|
244
|
+
* sentinel values alongside `w:numId="0"` to disable numbering; treat those
|
|
245
|
+
* as an omitted level instead of leaking an invalid value into the model.
|
|
246
|
+
*/
|
|
247
|
+
declare function parseNumberingLevelAttribute(element: XmlElement | null | undefined): number | undefined;
|
|
240
248
|
/**
|
|
241
249
|
* Parse `w:w` on a table width/height element. For `w:type="pct"`, producers
|
|
242
250
|
* sometimes emit human-readable percentages (`100%`) instead of 50ths-of-percent
|
|
@@ -294,10 +302,15 @@ declare function collectXmlnsDeclarations(element: XmlElement): Record<string, s
|
|
|
294
302
|
*/
|
|
295
303
|
declare function mergeXmlnsDeclarations(inherited: Record<string, string>, element: XmlElement): Record<string, string>;
|
|
296
304
|
/**
|
|
297
|
-
* Return a shallow clone of `element`
|
|
298
|
-
*
|
|
299
|
-
*
|
|
305
|
+
* Return a shallow clone of `element` carrying the inherited namespace
|
|
306
|
+
* declarations needed by its raw subtree.
|
|
307
|
+
*
|
|
308
|
+
* Existing declarations retain their authored order. Only missing, referenced
|
|
309
|
+
* bindings are appended, which makes repeated detach/replay cycles idempotent
|
|
310
|
+
* even when the surrounding document declares a different namespace superset.
|
|
311
|
+
* If a producer omitted a binding for a standard OOXML prefix, use its
|
|
312
|
+
* canonical binding so the detached subtree is valid on its first replay.
|
|
300
313
|
*/
|
|
301
314
|
declare function cloneWithXmlnsDeclarations(element: XmlElement, xmlnsDecls: Record<string, string>): XmlElement;
|
|
302
315
|
//#endregion
|
|
303
|
-
export { NAMESPACES, XmlElement, cloneWithXmlnsDeclarations, collectXmlnsDeclarations, elementToXml, findAllDeep, findByFullName, findChild, findChildByLocalName, findChildren, findChildrenByLocalName, findDeep, getAttribute, getAttributeAny, getAttributeAnyPrefix, getAttributes, getChildElements, getLocalName, getNamespacePrefix, getTextContent, hasChild, hasFlag, matchesName, mergeXmlnsDeclarations, parseBooleanElement, parseColorElement, parseNumericAttribute, parseTableMeasurementValue, parseXml, parseXmlDocument };
|
|
316
|
+
export { NAMESPACES, XmlElement, cloneWithXmlnsDeclarations, collectXmlnsDeclarations, elementToXml, findAllDeep, findByFullName, findChild, findChildByLocalName, findChildren, findChildrenByLocalName, findDeep, getAttribute, getAttributeAny, getAttributeAnyPrefix, getAttributes, getChildElements, getLocalName, getNamespacePrefix, getTextContent, hasChild, hasFlag, matchesName, mergeXmlnsDeclarations, parseBooleanElement, parseColorElement, parseNumberingLevelAttribute, parseNumericAttribute, parseTableMeasurementValue, parseXml, parseXmlDocument };
|
package/dist/docx/xmlParser.js
CHANGED
|
@@ -53,6 +53,8 @@ const fxpBuilder = new XMLBuilder(fxpBuilderOptions);
|
|
|
53
53
|
const TEXT_KEY = "#text";
|
|
54
54
|
/** Attribute group key used by fast-xml-parser in preserveOrder mode. */
|
|
55
55
|
const ATTR_KEY = ":@";
|
|
56
|
+
/** Character reference required to keep carriage returns through XML end-of-line normalization. */
|
|
57
|
+
const XML_CARRIAGE_RETURN_REFERENCE = " ";
|
|
56
58
|
/**
|
|
57
59
|
* Convert a fast-xml-parser preserveOrder node into an XmlElement.
|
|
58
60
|
*
|
|
@@ -75,9 +77,8 @@ function fxpNodeToElement(node) {
|
|
|
75
77
|
};
|
|
76
78
|
if (attrs) element.attributes = attrs;
|
|
77
79
|
if (children.length > 0) {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
element.elements = elements;
|
|
80
|
+
for (let index = 0; index < children.length; index += 1) children[index] = fxpNodeToElement(children[index]);
|
|
81
|
+
element.elements = children;
|
|
81
82
|
}
|
|
82
83
|
return element;
|
|
83
84
|
}
|
|
@@ -89,9 +90,8 @@ function fxpNodeToElement(node) {
|
|
|
89
90
|
* `{ elements: [...] }`.
|
|
90
91
|
*/
|
|
91
92
|
function fxpToRootElement(nodes) {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
return { elements };
|
|
93
|
+
for (let index = 0; index < nodes.length; index += 1) nodes[index] = fxpNodeToElement(nodes[index]);
|
|
94
|
+
return { elements: nodes };
|
|
95
95
|
}
|
|
96
96
|
/**
|
|
97
97
|
* Convert an XmlElement back into the fast-xml-parser preserveOrder format
|
|
@@ -123,7 +123,7 @@ function parseXml(xml) {
|
|
|
123
123
|
*/
|
|
124
124
|
function elementToXml(element) {
|
|
125
125
|
const fxpNode = elementToFxpNode(element);
|
|
126
|
-
return fxpBuilder.build([fxpNode]);
|
|
126
|
+
return fxpBuilder.build([fxpNode]).replaceAll("\r", XML_CARRIAGE_RETURN_REFERENCE);
|
|
127
127
|
}
|
|
128
128
|
/**
|
|
129
129
|
* Parse XML string to a more convenient format
|
|
@@ -131,7 +131,10 @@ function elementToXml(element) {
|
|
|
131
131
|
function parseXmlDocument(xml) {
|
|
132
132
|
try {
|
|
133
133
|
const parsed = parseXml(xml);
|
|
134
|
-
if (parsed.elements && parsed.elements.length > 0)
|
|
134
|
+
if (parsed.elements && parsed.elements.length > 0) {
|
|
135
|
+
for (const element of parsed.elements) if (element.type === "element") return element;
|
|
136
|
+
return null;
|
|
137
|
+
}
|
|
135
138
|
return parsed;
|
|
136
139
|
} catch {
|
|
137
140
|
return null;
|
|
@@ -142,6 +145,8 @@ function parseXmlDocument(xml) {
|
|
|
142
145
|
* e.g., "w:p" -> "p", "a:graphic" -> "graphic"
|
|
143
146
|
*/
|
|
144
147
|
function getLocalName(name) {
|
|
148
|
+
if (!name) return "";
|
|
149
|
+
if (name[1] === ":") return name.slice(2);
|
|
145
150
|
const colonIndex = name.indexOf(":");
|
|
146
151
|
return colonIndex !== -1 ? name.slice(colonIndex + 1) : name;
|
|
147
152
|
}
|
|
@@ -150,9 +155,16 @@ function getLocalName(name) {
|
|
|
150
155
|
* e.g., "w:p" -> "w", "a:graphic" -> "a"
|
|
151
156
|
*/
|
|
152
157
|
function getNamespacePrefix(name) {
|
|
158
|
+
if (name[1] === ":") return name[0] ?? null;
|
|
153
159
|
const colonIndex = name.indexOf(":");
|
|
154
160
|
return colonIndex !== -1 ? name.slice(0, colonIndex) : null;
|
|
155
161
|
}
|
|
162
|
+
function hasLocalName(name, localName) {
|
|
163
|
+
if (!name) return false;
|
|
164
|
+
if (name === localName) return true;
|
|
165
|
+
const localNameOffset = name.length - localName.length;
|
|
166
|
+
return localNameOffset > 0 && name[localNameOffset - 1] === ":" && name.endsWith(localName);
|
|
167
|
+
}
|
|
156
168
|
/**
|
|
157
169
|
* Check if an element matches a given namespaced name
|
|
158
170
|
*
|
|
@@ -160,12 +172,9 @@ function getNamespacePrefix(name) {
|
|
|
160
172
|
* @param namespace - Namespace prefix (e.g., "w", "a")
|
|
161
173
|
* @param localName - Local element name (e.g., "p", "r")
|
|
162
174
|
*/
|
|
163
|
-
function matchesName(element,
|
|
175
|
+
function matchesName(element, _namespace, localName) {
|
|
164
176
|
if (!element.name) return false;
|
|
165
|
-
|
|
166
|
-
if (element.name === fullName) return true;
|
|
167
|
-
if (getLocalName(element.name) === localName) return true;
|
|
168
|
-
return false;
|
|
177
|
+
return hasLocalName(element.name, localName);
|
|
169
178
|
}
|
|
170
179
|
/**
|
|
171
180
|
* Find first child element matching the given namespaced name
|
|
@@ -175,13 +184,11 @@ function matchesName(element, namespace, localName) {
|
|
|
175
184
|
* @param localName - Local element name (e.g., "p")
|
|
176
185
|
* @returns First matching child or null
|
|
177
186
|
*/
|
|
178
|
-
function findChild(parent,
|
|
187
|
+
function findChild(parent, _namespace, localName) {
|
|
179
188
|
if (!parent || !parent.elements) return null;
|
|
180
|
-
const fullName = `${namespace}:${localName}`;
|
|
181
189
|
for (const child of parent.elements) {
|
|
182
190
|
if (child.type !== "element") continue;
|
|
183
|
-
if (child.name
|
|
184
|
-
if (getLocalName(child.name || "") === localName) return child;
|
|
191
|
+
if (hasLocalName(child.name, localName)) return child;
|
|
185
192
|
}
|
|
186
193
|
return null;
|
|
187
194
|
}
|
|
@@ -193,13 +200,12 @@ function findChild(parent, namespace, localName) {
|
|
|
193
200
|
* @param localName - Local element name
|
|
194
201
|
* @returns Array of matching children
|
|
195
202
|
*/
|
|
196
|
-
function findChildren(parent,
|
|
203
|
+
function findChildren(parent, _namespace, localName) {
|
|
197
204
|
if (!parent || !parent.elements) return [];
|
|
198
|
-
const fullName = `${namespace}:${localName}`;
|
|
199
205
|
const results = [];
|
|
200
206
|
for (const child of parent.elements) {
|
|
201
207
|
if (child.type !== "element") continue;
|
|
202
|
-
if (
|
|
208
|
+
if (hasLocalName(child.name, localName)) results.push(child);
|
|
203
209
|
}
|
|
204
210
|
return results;
|
|
205
211
|
}
|
|
@@ -214,7 +220,7 @@ function findChildByLocalName(parent, localName) {
|
|
|
214
220
|
if (!parent || !parent.elements) return null;
|
|
215
221
|
for (const child of parent.elements) {
|
|
216
222
|
if (child.type !== "element") continue;
|
|
217
|
-
if (
|
|
223
|
+
if (hasLocalName(child.name, localName)) return child;
|
|
218
224
|
}
|
|
219
225
|
return null;
|
|
220
226
|
}
|
|
@@ -227,7 +233,9 @@ function findChildByLocalName(parent, localName) {
|
|
|
227
233
|
*/
|
|
228
234
|
function findChildrenByLocalName(parent, localName) {
|
|
229
235
|
if (!parent || !parent.elements) return [];
|
|
230
|
-
|
|
236
|
+
const results = [];
|
|
237
|
+
for (const child of parent.elements) if (child.type === "element" && hasLocalName(child.name, localName)) results.push(child);
|
|
238
|
+
return results;
|
|
231
239
|
}
|
|
232
240
|
/**
|
|
233
241
|
* Find first child element by full name (including namespace prefix)
|
|
@@ -252,7 +260,9 @@ function findByFullName(parent, fullName) {
|
|
|
252
260
|
*/
|
|
253
261
|
function getChildElements(parent) {
|
|
254
262
|
if (!parent || !parent.elements) return [];
|
|
255
|
-
|
|
263
|
+
const results = [];
|
|
264
|
+
for (const child of parent.elements) if (child.type === "element") results.push(child);
|
|
265
|
+
return results;
|
|
256
266
|
}
|
|
257
267
|
/**
|
|
258
268
|
* Get an attribute value from an element
|
|
@@ -277,13 +287,13 @@ function getAttribute(element, namespace, name) {
|
|
|
277
287
|
if (!element || !element.attributes) return null;
|
|
278
288
|
const attrs = element.attributes;
|
|
279
289
|
if (namespace) {
|
|
280
|
-
const
|
|
281
|
-
if (
|
|
290
|
+
const prefixedValue = attrs[`${namespace}:${name}`];
|
|
291
|
+
if (prefixedValue !== void 0) return prefixedValue;
|
|
282
292
|
}
|
|
283
|
-
|
|
293
|
+
const unprefixedValue = attrs[name];
|
|
294
|
+
if (unprefixedValue !== void 0) return unprefixedValue;
|
|
284
295
|
if (namespace) {
|
|
285
|
-
const
|
|
286
|
-
for (const key of Object.keys(attrs)) if (key.endsWith(suffix)) return attrs[key] ?? null;
|
|
296
|
+
for (const key in attrs) if (hasLocalName(key, name)) return attrs[key] ?? null;
|
|
287
297
|
}
|
|
288
298
|
return null;
|
|
289
299
|
}
|
|
@@ -312,8 +322,11 @@ function getAttributeAnyPrefix(element, localName) {
|
|
|
312
322
|
if (canonical !== null) return canonical;
|
|
313
323
|
const attrs = element.attributes;
|
|
314
324
|
if (attrs) {
|
|
315
|
-
const
|
|
316
|
-
|
|
325
|
+
for (const key in attrs) if (hasLocalName(key, localName)) {
|
|
326
|
+
const value = attrs[key];
|
|
327
|
+
if (value === void 0) return null;
|
|
328
|
+
return typeof value === "string" ? value : String(value);
|
|
329
|
+
}
|
|
317
330
|
}
|
|
318
331
|
return null;
|
|
319
332
|
}
|
|
@@ -416,6 +429,17 @@ function parseNumericAttribute(element, namespace, name, scale = 1) {
|
|
|
416
429
|
return num * scale;
|
|
417
430
|
}
|
|
418
431
|
/**
|
|
432
|
+
* Parse a zero-based numbering level reference.
|
|
433
|
+
*
|
|
434
|
+
* OOXML numbering levels cannot be negative. Some producers emit negative
|
|
435
|
+
* sentinel values alongside `w:numId="0"` to disable numbering; treat those
|
|
436
|
+
* as an omitted level instead of leaking an invalid value into the model.
|
|
437
|
+
*/
|
|
438
|
+
function parseNumberingLevelAttribute(element) {
|
|
439
|
+
const level = parseNumericAttribute(element, "w", "val");
|
|
440
|
+
return level !== void 0 && level >= 0 ? level : void 0;
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
419
443
|
* Parse `w:w` on a table width/height element. For `w:type="pct"`, producers
|
|
420
444
|
* sometimes emit human-readable percentages (`100%`) instead of 50ths-of-percent
|
|
421
445
|
* (`5000`); normalize those to the ECMA-376 unit the layout engine expects.
|
|
@@ -519,9 +543,14 @@ function collectXmlnsDeclarations(element) {
|
|
|
519
543
|
const out = {};
|
|
520
544
|
const attrs = element.attributes;
|
|
521
545
|
if (!attrs) return out;
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
if (
|
|
546
|
+
let declarationCount = 0;
|
|
547
|
+
for (const key in attrs) {
|
|
548
|
+
if (declarationCount >= MAX_XMLNS_DECLARATIONS_PER_ELEMENT) break;
|
|
549
|
+
const value = attrs[key];
|
|
550
|
+
if ((key === "xmlns" || key.startsWith("xmlns:")) && value !== void 0) {
|
|
551
|
+
out[key] = String(value);
|
|
552
|
+
declarationCount += 1;
|
|
553
|
+
}
|
|
525
554
|
}
|
|
526
555
|
return out;
|
|
527
556
|
}
|
|
@@ -535,26 +564,80 @@ function collectXmlnsDeclarations(element) {
|
|
|
535
564
|
*/
|
|
536
565
|
function mergeXmlnsDeclarations(inherited, element) {
|
|
537
566
|
const own = collectXmlnsDeclarations(element);
|
|
538
|
-
|
|
539
|
-
return {
|
|
567
|
+
for (const _key in own) return {
|
|
540
568
|
...inherited,
|
|
541
569
|
...own
|
|
542
570
|
};
|
|
571
|
+
return inherited;
|
|
543
572
|
}
|
|
573
|
+
const QNAME_VALUE_ATTRIBUTES = /* @__PURE__ */ new Set([
|
|
574
|
+
"Ignorable",
|
|
575
|
+
"PreserveAttributes",
|
|
576
|
+
"PreserveElements",
|
|
577
|
+
"ProcessContent",
|
|
578
|
+
"Requires"
|
|
579
|
+
]);
|
|
580
|
+
const addPrefix = (name, prefixes) => {
|
|
581
|
+
const separatorIndex = name.indexOf(":");
|
|
582
|
+
if (separatorIndex > 0) prefixes.add(name.slice(0, separatorIndex));
|
|
583
|
+
};
|
|
584
|
+
/**
|
|
585
|
+
* Collect namespace prefixes whose bindings a detached raw subtree needs.
|
|
586
|
+
*
|
|
587
|
+
* Element and attribute names use prefixes directly. Markup-compatibility and
|
|
588
|
+
* QName-valued attributes can also refer to prefixes in their values, so keep
|
|
589
|
+
* those bindings even when no descendant name uses them.
|
|
590
|
+
*/
|
|
591
|
+
const collectUsedNamespacePrefixes = (element, prefixes = /* @__PURE__ */ new Set()) => {
|
|
592
|
+
if (element.name) if (element.name.includes(":")) addPrefix(element.name, prefixes);
|
|
593
|
+
else prefixes.add("");
|
|
594
|
+
if (element.attributes) for (const [name, value] of Object.entries(element.attributes)) {
|
|
595
|
+
if (name === "xmlns" || name.startsWith("xmlns:")) continue;
|
|
596
|
+
addPrefix(name, prefixes);
|
|
597
|
+
const localName = name.slice(name.indexOf(":") + 1);
|
|
598
|
+
if (name !== "xsi:type" && !QNAME_VALUE_ATTRIBUTES.has(localName)) continue;
|
|
599
|
+
for (const token of String(value).split(/\s+/u)) {
|
|
600
|
+
const separatorIndex = token.indexOf(":");
|
|
601
|
+
prefixes.add(separatorIndex > 0 ? token.slice(0, separatorIndex) : token);
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
if (element.elements) {
|
|
605
|
+
for (const child of element.elements) if (child.type === "element") collectUsedNamespacePrefixes(child, prefixes);
|
|
606
|
+
}
|
|
607
|
+
return prefixes;
|
|
608
|
+
};
|
|
609
|
+
const isCanonicalNamespacePrefix = (prefix) => Object.hasOwn(NAMESPACES, prefix);
|
|
544
610
|
/**
|
|
545
|
-
* Return a shallow clone of `element`
|
|
546
|
-
*
|
|
547
|
-
*
|
|
611
|
+
* Return a shallow clone of `element` carrying the inherited namespace
|
|
612
|
+
* declarations needed by its raw subtree.
|
|
613
|
+
*
|
|
614
|
+
* Existing declarations retain their authored order. Only missing, referenced
|
|
615
|
+
* bindings are appended, which makes repeated detach/replay cycles idempotent
|
|
616
|
+
* even when the surrounding document declares a different namespace superset.
|
|
617
|
+
* If a producer omitted a binding for a standard OOXML prefix, use its
|
|
618
|
+
* canonical binding so the detached subtree is valid on its first replay.
|
|
548
619
|
*/
|
|
549
620
|
function cloneWithXmlnsDeclarations(element, xmlnsDecls) {
|
|
550
|
-
|
|
551
|
-
|
|
621
|
+
const prefixes = collectUsedNamespacePrefixes(element);
|
|
622
|
+
const additions = {};
|
|
623
|
+
const attributes = element.attributes ?? {};
|
|
624
|
+
for (const [name, value] of Object.entries(xmlnsDecls)) {
|
|
625
|
+
const prefix = name === "xmlns" ? "" : name.slice(6);
|
|
626
|
+
if (prefixes.has(prefix) && attributes[name] === void 0) additions[name] = value;
|
|
627
|
+
}
|
|
628
|
+
for (const prefix of prefixes) {
|
|
629
|
+
const name = `xmlns:${prefix}`;
|
|
630
|
+
if (!prefix || attributes[name] !== void 0 || additions[name] !== void 0 || !isCanonicalNamespacePrefix(prefix)) continue;
|
|
631
|
+
additions[name] = NAMESPACES[prefix];
|
|
632
|
+
}
|
|
633
|
+
for (const _key in additions) return {
|
|
552
634
|
...element,
|
|
553
635
|
attributes: {
|
|
554
|
-
...
|
|
555
|
-
...
|
|
636
|
+
...attributes,
|
|
637
|
+
...additions
|
|
556
638
|
}
|
|
557
639
|
};
|
|
640
|
+
return element;
|
|
558
641
|
}
|
|
559
642
|
//#endregion
|
|
560
|
-
export { NAMESPACES, cloneWithXmlnsDeclarations, collectXmlnsDeclarations, elementToXml, findAllDeep, findByFullName, findChild, findChildByLocalName, findChildren, findChildrenByLocalName, findDeep, getAttribute, getAttributeAny, getAttributeAnyPrefix, getAttributes, getChildElements, getLocalName, getNamespacePrefix, getTextContent, hasChild, hasFlag, matchesName, mergeXmlnsDeclarations, parseBooleanElement, parseColorElement, parseNumericAttribute, parseTableMeasurementValue, parseXml, parseXmlDocument };
|
|
643
|
+
export { NAMESPACES, cloneWithXmlnsDeclarations, collectXmlnsDeclarations, elementToXml, findAllDeep, findByFullName, findChild, findChildByLocalName, findChildren, findChildrenByLocalName, findDeep, getAttribute, getAttributeAny, getAttributeAnyPrefix, getAttributes, getChildElements, getLocalName, getNamespacePrefix, getTextContent, hasChild, hasFlag, matchesName, mergeXmlnsDeclarations, parseBooleanElement, parseColorElement, parseNumberingLevelAttribute, parseNumericAttribute, parseTableMeasurementValue, parseXml, parseXmlDocument };
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { ParsedFieldInstruction } from "../docx/fieldParser.js";
|
|
2
2
|
import { FieldContext } from "./fieldContext.js";
|
|
3
|
-
|
|
4
3
|
//#region src/fields/evaluateField.d.ts
|
|
5
4
|
type EvaluateFieldOptions = {
|
|
6
|
-
/** Shown for unsupported field types and unresolved references. */
|
|
7
|
-
|
|
5
|
+
/** Shown for unsupported field types and unresolved references. */
|
|
6
|
+
fallback?: string;
|
|
7
|
+
/** Run identity (`pmStart`) used to look up a precomputed SEQ value. */
|
|
8
|
+
instanceId?: number;
|
|
9
|
+
/** Locked fields preserve their cached result instead of recalculating. */
|
|
8
10
|
locked?: boolean;
|
|
9
11
|
};
|
|
10
12
|
/**
|
|
@@ -7,14 +7,20 @@
|
|
|
7
7
|
* layout so a field paints the same value its width was measured against.
|
|
8
8
|
*/
|
|
9
9
|
type FieldContext = {
|
|
10
|
-
/** 1-indexed page the field is on (PAGE). */
|
|
10
|
+
/** 1-indexed page the field is on (PAGE). */
|
|
11
|
+
pageNumber: number;
|
|
12
|
+
/** Total pages in the document (NUMPAGES). */
|
|
11
13
|
totalPages: number;
|
|
12
14
|
/** Pages in the field's current section (SECTIONPAGES); omit until the
|
|
13
15
|
* per-section page counts are available, in which case the field falls back. */
|
|
14
|
-
sectionPages?: number;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
sectionPages?: number;
|
|
17
|
+
/** Bookmark name -> 1-indexed page it lands on (PAGEREF). */
|
|
18
|
+
bookmarkPages: ReadonlyMap<string, number>;
|
|
19
|
+
/** Bookmark name -> resolved display text (REF). */
|
|
20
|
+
bookmarkText: ReadonlyMap<string, string>;
|
|
21
|
+
/** Field instance id (the run's `pmStart`) -> precomputed SEQ value. */
|
|
22
|
+
seqValues: ReadonlyMap<number, number>;
|
|
23
|
+
/** Clock for DATE/TIME-family fields; passed in so evaluation stays pure. */
|
|
18
24
|
now: Date;
|
|
19
25
|
};
|
|
20
26
|
//#endregion
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { FlowBlock, Page } from "../layout-engine/types.js";
|
|
2
|
-
|
|
3
2
|
//#region src/fields/resolveFieldValues.d.ts
|
|
4
3
|
/** Layout-derived inputs shared by every field, regardless of its position. */
|
|
5
4
|
type SharedFieldInputs = {
|
|
6
5
|
totalPages: number;
|
|
7
6
|
bookmarkPages: ReadonlyMap<string, number>;
|
|
8
7
|
bookmarkText: ReadonlyMap<string, string>;
|
|
9
|
-
seqValues: ReadonlyMap<number, number>;
|
|
8
|
+
seqValues: ReadonlyMap<number, number>;
|
|
9
|
+
/** Section index -> page count, for SECTIONPAGES. */
|
|
10
10
|
sectionPageCounts: ReadonlyMap<number, number>;
|
|
11
11
|
now: Date;
|
|
12
12
|
};
|
|
13
13
|
type HeaderFooterFieldInputs = Pick<SharedFieldInputs, "bookmarkPages" | "bookmarkText" | "seqValues" | "sectionPageCounts">;
|
|
14
14
|
type ResolvedFieldValues = {
|
|
15
|
-
/** Field run `pmStart` -> resolved display text. */
|
|
15
|
+
/** Field run `pmStart` -> resolved display text. */
|
|
16
|
+
values: Map<number, string>;
|
|
16
17
|
/**
|
|
17
18
|
* True when at least one field resolved to a string that differs from the
|
|
18
19
|
* text it was measured at (`fallback || "1"`), i.e. a re-measure would change
|
|
@@ -20,8 +20,11 @@
|
|
|
20
20
|
*/
|
|
21
21
|
/** A single embedded face referenced from a `w:embed*` element. */
|
|
22
22
|
type EmbeddedFontFaceRef = {
|
|
23
|
-
/** Relationship id (`r:id`) resolved via `word/_rels/fontTable.xml.rels`. */
|
|
24
|
-
|
|
23
|
+
/** Relationship id (`r:id`) resolved via `word/_rels/fontTable.xml.rels`. */
|
|
24
|
+
relId: string;
|
|
25
|
+
/** Obfuscation key GUID (`w:fontKey`), e.g. `{XXXXXXXX-...}`. */
|
|
26
|
+
fontKey?: string;
|
|
27
|
+
/** Whether the embedded face is subsetted (`w:subsetted`). */
|
|
25
28
|
subsetted?: boolean;
|
|
26
29
|
};
|
|
27
30
|
/** One `<w:font>` entry with whichever of the four embed faces it declares. */
|
|
@@ -31,17 +31,25 @@ type EmbeddedFont = {
|
|
|
31
31
|
* {@link buildEmbeddedFontFamilyMap}) to resolve document runs, which
|
|
32
32
|
* still reference the font by its original DOCX name, to this family.
|
|
33
33
|
*/
|
|
34
|
-
family: string;
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
family: string;
|
|
35
|
+
/** Original Word font name (`w:font w:name`), before scoping. */
|
|
36
|
+
originalFamily: string;
|
|
37
|
+
/** CSS `font-style` the face maps to (`embed*Italic` → `italic`). */
|
|
38
|
+
style: "normal" | "italic";
|
|
39
|
+
/** CSS `font-weight` the face maps to (`embedBold*` → `700`). */
|
|
40
|
+
weight: 400 | 700;
|
|
41
|
+
/** De-obfuscated OpenType/TrueType bytes (backed by a fresh, non-shared buffer). */
|
|
42
|
+
bytes: Uint8Array<ArrayBuffer>;
|
|
43
|
+
/** Whether the source face was subsetted (`w:subsetted`). */
|
|
39
44
|
subsetted: boolean;
|
|
40
45
|
};
|
|
41
46
|
/** Already-unzipped package parts the pure extractor needs. */
|
|
42
47
|
type EmbeddedFontParts = {
|
|
43
|
-
/** Raw `word/fontTable.xml`. */
|
|
44
|
-
|
|
48
|
+
/** Raw `word/fontTable.xml`. */
|
|
49
|
+
fontTableXml: string | null | undefined;
|
|
50
|
+
/** Raw `word/_rels/fontTable.xml.rels`. */
|
|
51
|
+
fontTableRelsXml: string | null | undefined;
|
|
52
|
+
/** Unzipped font binaries keyed by package path (e.g. `word/fonts/font1.odttf`). */
|
|
45
53
|
fonts: ReadonlyMap<string, ArrayBuffer>;
|
|
46
54
|
};
|
|
47
55
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -5,12 +5,14 @@ import { ApplyFolioDocumentOperationsOptions, FOLIO_DOCUMENT_OPERATION_BATCH_MOD
|
|
|
5
5
|
import { createFolioAIEditSnapshot, hashFolioAIBlockText, normalizeFolioAIBlockText } from "./ai-edits/snapshot.js";
|
|
6
6
|
import { DeriveBlockIdInput, FolioBlockId, deriveBlockId, getFolioParaIdFromBlockId, isFolioBlockId, isSequentialFolioBlockId } from "./types/block-id.js";
|
|
7
7
|
import { WordDiffSegment, diffWordSegments } from "./ai-edits/word-diff.js";
|
|
8
|
+
import "./ai-edits/index.js";
|
|
8
9
|
import { AIBarStatus, AIChatMode, AICitation, AICitationSource, AIGenerateInput, AISuggestion, AISuggestionApplyMode, AISuggestionPreset, AISuggestionSeverity, AISuggestionStatus, DEFAULT_AI_SUGGESTION_PRESETS } from "./ai-suggestions/types.js";
|
|
9
10
|
import { ApplyResult, applySuggestions } from "./ai-suggestions/apply.js";
|
|
10
11
|
import { ResolvedAnchor, isSuggestionStale, resolveSuggestionAnchor } from "./ai-suggestions/conflict.js";
|
|
11
12
|
import { PositionalText, buildPositionalText } from "./ai-suggestions/text-positions.js";
|
|
12
13
|
import { DOCUMENT_PRESET_VERSION, DOCUMENT_STYLE_SET_VERSION, DocumentPreset, DocumentStyleSet } from "./style-sets/types.js";
|
|
13
14
|
import { CreateEmptyDocumentOptions, createEmptyDocument } from "./utils/createDocument.js";
|
|
15
|
+
import { mergeDocumentContent } from "./utils/mergeDocumentContent.js";
|
|
14
16
|
import { DocumentStyleCatalog, DocumentStyleCatalogEntry, ExtractDocumentStyleSetOptions, extractDocumentStyleSet, extractDocumentStyleSetFromDocx, inspectDocumentStyles, inspectDocumentStylesFromDocx } from "./style-sets/extract.js";
|
|
15
17
|
import { STELLA_STYLE_SET_NAME, createStellaStyleDocumentPreset, createStellaStyleSet } from "./style-sets/stellaStyle.js";
|
|
16
18
|
import { createDocx } from "./docx/rezip.js";
|
|
@@ -32,4 +34,4 @@ import { getGoogleFontsEnabled, setEmbeddedFontFamilyMap, setGoogleFontsEnabled
|
|
|
32
34
|
import { DOCX_CONFORMANCE_CLASSES } from "@stll/docx-core/model";
|
|
33
35
|
type Document = document_d_exports.Document;
|
|
34
36
|
type DocxConformanceClass = document_d_exports.DocxConformanceClass;
|
|
35
|
-
export { type AIBarStatus, type AIChatMode, type AICitation, type AICitationRange, type AICitationSource, type AIGenerateInput, type AISuggestion, type AISuggestionApplyMode, type AISuggestionPreset, type AISuggestionSeverity, type AISuggestionStatus, type AcceptAutocompleteResult, type AnonymizationMatch, type AnonymizationTerm, type ApplyFolioDocumentOperationsOptions, type ApplyResult, type AutocompleteSuggestionPluginOptions, type AutocompleteSuggestionState, type AutocompleteSuggestionStatus, type AutocompleteTriggerCheck, type AutocompleteTriggerOptions, type AutocompleteTriggerSkipReason, type CreateEmptyDocumentOptions, DEFAULT_AI_SUGGESTION_PRESETS, DEFAULT_AUTOCOMPLETE_DEAD_ZONE_NODES, DOCUMENT_PRESET_VERSION, DOCUMENT_STYLE_SET_VERSION, DOCX_CONFORMANCE_CLASSES, type DeriveBlockIdInput, type DirectiveKind, type DirectiveRange, type Document, type DocumentPreset, type DocumentStyleCatalog, type DocumentStyleCatalogEntry, type DocumentStyleSet, type DocxCompatibility, type DocxCompatibilityContext, type DocxCompatibilityIssue, type DocxCompatibilityLocation, type DocxCompatibilityPart, type DocxConformanceClass, type EmbeddedFont, type EmbeddedFontParts, type ExtractDocumentStyleSetOptions, FOLIO_DOCUMENT_OPERATION_BATCH_MODES, FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION, FOLIO_DOCUMENT_OPERATION_MODES, FOLIO_DOCUMENT_OPERATION_MODES_BY_TYPE, FOLIO_DOCUMENT_OPERATION_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_STORIES, FOLIO_DOCUMENT_OPERATION_TYPES, type FolioAIBlock, type FolioAIBlockAnchor, type FolioAIBlockKind, type FolioAIBlockPreviewRun, type FolioAIComment, type FolioAIEditAppliedOperation, type FolioAIEditApplyMode, type FolioAIEditApplyResult, type FolioAIEditOperation, type FolioAIEditPrecondition, type FolioAIEditReviewMeta, type FolioAIEditSeverity, type FolioAIEditSkipReason, type FolioAIEditSkippedOperation, type FolioAIEditSnapshot, type FolioAISignatureParty, type FolioBlockId, type FolioDocumentOperation, type FolioDocumentOperationAffectedTarget, type FolioDocumentOperationBatch, type FolioDocumentOperationCapabilities, type FolioDocumentOperationIssue, type FolioDocumentOperationMode, type FolioDocumentOperationPrecondition, type FolioDocumentOperationReceipt, type FolioDocumentOperationRecovery, type FolioDocumentOperationResult, type FolioDocumentOperationStatus, type FolioDocumentOperationStory, type FolioDocumentOperationType, type FolioDocumentOperationUndoFailureReason, type FolioDocumentOperationUndoHandle, type FolioDocumentOperationUndoResult, type FolioDocxCompatibilityHost, type FolioDocxCompatibilityProfile, type ImageMeta, type ImageRef, type InspectDocxCompatibilityOptions, InvalidFolioDocumentOperationBatchError, type MarkdownOptions, type MarkdownResult, type PositionalText, type ResolvedAnchor, STELLA_STYLE_SET_NAME, type TemplatePreviewSpan, type TemplatePreviewValue, type TemplatePreviewValues, type TemplateSlashMenuKeyAction, type TemplateSlashMenuState, UnsupportedFolioDocumentOperationVersionError, type WordDiffSegment, acceptAutocompleteSuggestion, acceptAutocompleteWord, anonymizationDecorationsKey, appendAutocompleteToken, applyFolioAIEditOperations, applyFolioDocumentOperations, applySuggestions, assertSupportedFolioDocumentOperationVersion, autocompleteSuggestionKey, autocompleteSuggestionPlugin, buildEmbeddedFontFamilyMap, buildPositionalText, clearAutocompleteSuggestion, clearTemplateSlashMenu, consumeTemplateSlashQuery, createAICitationDecorationsPlugin, createDocx, createEmptyDocument, createFolioAIEditSnapshot, createStellaStyleDocumentPreset, createStellaStyleSet, deriveBlockId, diffWordSegments, extractDocumentStyleSet, extractDocumentStyleSetFromDocx, extractEmbeddedFonts, finishAutocompleteSuggestion, fromMarkdown, getAnonymizationMatches, getAutocompleteSuggestion, getEmbeddedFontFaces, getFolioCaretViewportRect, getFolioDocumentOperationCapabilities, getFolioDocumentOperationIssues, getFolioDocumentOperationReceipts, getFolioParaIdFromBlockId, getFolioSelectionViewportRect, getGoogleFontsEnabled, getTemplateDirectives, getTemplateSlashMenu, hashFolioAIBlockText, inspectDocumentStyles, inspectDocumentStylesFromDocx, inspectDocxCompatibility, isFolioBlockId, isFolioDocumentOperationModeSupported, isSequentialFolioBlockId, isSuggestionStale, isSupportedFolioDocumentOperationVersion, normalizeFolioAIBlockText, parseFolioDocumentOperationBatch, resetTemplateSlashQuery, resolveSuggestionAnchor, scanDirectives, scopeEmbeddedFontFamily, scrollFolioPositionIntoView, setAICitationsMeta, setAISuggestionsMeta, setActiveCitationMeta, setAnonymizationTermsMeta, setEmbeddedFontFamilyMap, setFocusedSuggestionMeta, setGoogleFontsEnabled, setTemplatePreviewValues, shouldTriggerAutocomplete, startAutocompleteSuggestion, templateSlashMenuKey, toMarkdown, toMarkdownResult };
|
|
37
|
+
export { type AIBarStatus, type AIChatMode, type AICitation, type AICitationRange, type AICitationSource, type AIGenerateInput, type AISuggestion, type AISuggestionApplyMode, type AISuggestionPreset, type AISuggestionSeverity, type AISuggestionStatus, type AcceptAutocompleteResult, type AnonymizationMatch, type AnonymizationTerm, type ApplyFolioDocumentOperationsOptions, type ApplyResult, type AutocompleteSuggestionPluginOptions, type AutocompleteSuggestionState, type AutocompleteSuggestionStatus, type AutocompleteTriggerCheck, type AutocompleteTriggerOptions, type AutocompleteTriggerSkipReason, type CreateEmptyDocumentOptions, DEFAULT_AI_SUGGESTION_PRESETS, DEFAULT_AUTOCOMPLETE_DEAD_ZONE_NODES, DOCUMENT_PRESET_VERSION, DOCUMENT_STYLE_SET_VERSION, DOCX_CONFORMANCE_CLASSES, type DeriveBlockIdInput, type DirectiveKind, type DirectiveRange, type Document, type DocumentPreset, type DocumentStyleCatalog, type DocumentStyleCatalogEntry, type DocumentStyleSet, type DocxCompatibility, type DocxCompatibilityContext, type DocxCompatibilityIssue, type DocxCompatibilityLocation, type DocxCompatibilityPart, type DocxConformanceClass, type EmbeddedFont, type EmbeddedFontParts, type ExtractDocumentStyleSetOptions, FOLIO_DOCUMENT_OPERATION_BATCH_MODES, FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION, FOLIO_DOCUMENT_OPERATION_MODES, FOLIO_DOCUMENT_OPERATION_MODES_BY_TYPE, FOLIO_DOCUMENT_OPERATION_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_STORIES, FOLIO_DOCUMENT_OPERATION_TYPES, type FolioAIBlock, type FolioAIBlockAnchor, type FolioAIBlockKind, type FolioAIBlockPreviewRun, type FolioAIComment, type FolioAIEditAppliedOperation, type FolioAIEditApplyMode, type FolioAIEditApplyResult, type FolioAIEditOperation, type FolioAIEditPrecondition, type FolioAIEditReviewMeta, type FolioAIEditSeverity, type FolioAIEditSkipReason, type FolioAIEditSkippedOperation, type FolioAIEditSnapshot, type FolioAISignatureParty, type FolioBlockId, type FolioDocumentOperation, type FolioDocumentOperationAffectedTarget, type FolioDocumentOperationBatch, type FolioDocumentOperationCapabilities, type FolioDocumentOperationIssue, type FolioDocumentOperationMode, type FolioDocumentOperationPrecondition, type FolioDocumentOperationReceipt, type FolioDocumentOperationRecovery, type FolioDocumentOperationResult, type FolioDocumentOperationStatus, type FolioDocumentOperationStory, type FolioDocumentOperationType, type FolioDocumentOperationUndoFailureReason, type FolioDocumentOperationUndoHandle, type FolioDocumentOperationUndoResult, type FolioDocxCompatibilityHost, type FolioDocxCompatibilityProfile, type ImageMeta, type ImageRef, type InspectDocxCompatibilityOptions, InvalidFolioDocumentOperationBatchError, type MarkdownOptions, type MarkdownResult, type PositionalText, type ResolvedAnchor, STELLA_STYLE_SET_NAME, type TemplatePreviewSpan, type TemplatePreviewValue, type TemplatePreviewValues, type TemplateSlashMenuKeyAction, type TemplateSlashMenuState, UnsupportedFolioDocumentOperationVersionError, type WordDiffSegment, acceptAutocompleteSuggestion, acceptAutocompleteWord, anonymizationDecorationsKey, appendAutocompleteToken, applyFolioAIEditOperations, applyFolioDocumentOperations, applySuggestions, assertSupportedFolioDocumentOperationVersion, autocompleteSuggestionKey, autocompleteSuggestionPlugin, buildEmbeddedFontFamilyMap, buildPositionalText, clearAutocompleteSuggestion, clearTemplateSlashMenu, consumeTemplateSlashQuery, createAICitationDecorationsPlugin, createDocx, createEmptyDocument, createFolioAIEditSnapshot, createStellaStyleDocumentPreset, createStellaStyleSet, deriveBlockId, diffWordSegments, extractDocumentStyleSet, extractDocumentStyleSetFromDocx, extractEmbeddedFonts, finishAutocompleteSuggestion, fromMarkdown, getAnonymizationMatches, getAutocompleteSuggestion, getEmbeddedFontFaces, getFolioCaretViewportRect, getFolioDocumentOperationCapabilities, getFolioDocumentOperationIssues, getFolioDocumentOperationReceipts, getFolioParaIdFromBlockId, getFolioSelectionViewportRect, getGoogleFontsEnabled, getTemplateDirectives, getTemplateSlashMenu, hashFolioAIBlockText, inspectDocumentStyles, inspectDocumentStylesFromDocx, inspectDocxCompatibility, isFolioBlockId, isFolioDocumentOperationModeSupported, isSequentialFolioBlockId, isSuggestionStale, isSupportedFolioDocumentOperationVersion, mergeDocumentContent, normalizeFolioAIBlockText, parseFolioDocumentOperationBatch, resetTemplateSlashQuery, resolveSuggestionAnchor, scanDirectives, scopeEmbeddedFontFamily, scrollFolioPositionIntoView, setAICitationsMeta, setAISuggestionsMeta, setActiveCitationMeta, setAnonymizationTermsMeta, setEmbeddedFontFamilyMap, setFocusedSuggestionMeta, setGoogleFontsEnabled, setTemplatePreviewValues, shouldTriggerAutocomplete, startAutocompleteSuggestion, templateSlashMenuKey, toMarkdown, toMarkdownResult };
|
package/dist/index.js
CHANGED
|
@@ -6,6 +6,7 @@ import { applyFolioAIEditOperations } from "./ai-edits/apply.js";
|
|
|
6
6
|
import { FOLIO_DOCUMENT_OPERATION_BATCH_MODES, FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION, FOLIO_DOCUMENT_OPERATION_MODES, FOLIO_DOCUMENT_OPERATION_MODES_BY_TYPE, FOLIO_DOCUMENT_OPERATION_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_STORIES, FOLIO_DOCUMENT_OPERATION_TYPES, InvalidFolioDocumentOperationBatchError, UnsupportedFolioDocumentOperationVersionError, applyFolioDocumentOperations, assertSupportedFolioDocumentOperationVersion, getFolioDocumentOperationCapabilities, getFolioDocumentOperationIssues, getFolioDocumentOperationReceipts, isFolioDocumentOperationModeSupported, isSupportedFolioDocumentOperationVersion, parseFolioDocumentOperationBatch } from "./document-operations.js";
|
|
7
7
|
import { DOCUMENT_PRESET_VERSION, DOCUMENT_STYLE_SET_VERSION } from "./style-sets/types.js";
|
|
8
8
|
import { createEmptyDocument } from "./utils/createDocument.js";
|
|
9
|
+
import { mergeDocumentContent } from "./utils/mergeDocumentContent.js";
|
|
9
10
|
import { extractDocumentStyleSet, extractDocumentStyleSetFromDocx, inspectDocumentStyles, inspectDocumentStylesFromDocx } from "./style-sets/extract.js";
|
|
10
11
|
import { STELLA_STYLE_SET_NAME, createStellaStyleDocumentPreset, createStellaStyleSet } from "./style-sets/stellaStyle.js";
|
|
11
12
|
import { createDocx } from "./docx/rezip.js";
|
|
@@ -27,4 +28,4 @@ import { fromMarkdown } from "./markdown/fromMarkdown.js";
|
|
|
27
28
|
import { toMarkdown, toMarkdownResult } from "./markdown/index.js";
|
|
28
29
|
import { buildEmbeddedFontFamilyMap, extractEmbeddedFonts, getEmbeddedFontFaces, scopeEmbeddedFontFamily } from "./fonts/embeddedFonts.js";
|
|
29
30
|
import { DOCX_CONFORMANCE_CLASSES } from "@stll/docx-core/model";
|
|
30
|
-
export { DEFAULT_AI_SUGGESTION_PRESETS, DEFAULT_AUTOCOMPLETE_DEAD_ZONE_NODES, DOCUMENT_PRESET_VERSION, DOCUMENT_STYLE_SET_VERSION, DOCX_CONFORMANCE_CLASSES, FOLIO_DOCUMENT_OPERATION_BATCH_MODES, FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION, FOLIO_DOCUMENT_OPERATION_MODES, FOLIO_DOCUMENT_OPERATION_MODES_BY_TYPE, FOLIO_DOCUMENT_OPERATION_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_STORIES, FOLIO_DOCUMENT_OPERATION_TYPES, InvalidFolioDocumentOperationBatchError, STELLA_STYLE_SET_NAME, UnsupportedFolioDocumentOperationVersionError, acceptAutocompleteSuggestion, acceptAutocompleteWord, anonymizationDecorationsKey, appendAutocompleteToken, applyFolioAIEditOperations, applyFolioDocumentOperations, applySuggestions, assertSupportedFolioDocumentOperationVersion, autocompleteSuggestionKey, autocompleteSuggestionPlugin, buildEmbeddedFontFamilyMap, buildPositionalText, clearAutocompleteSuggestion, clearTemplateSlashMenu, consumeTemplateSlashQuery, createAICitationDecorationsPlugin, createDocx, createEmptyDocument, createFolioAIEditSnapshot, createStellaStyleDocumentPreset, createStellaStyleSet, deriveBlockId, diffWordSegments, extractDocumentStyleSet, extractDocumentStyleSetFromDocx, extractEmbeddedFonts, finishAutocompleteSuggestion, fromMarkdown, getAnonymizationMatches, getAutocompleteSuggestion, getEmbeddedFontFaces, getFolioCaretViewportRect, getFolioDocumentOperationCapabilities, getFolioDocumentOperationIssues, getFolioDocumentOperationReceipts, getFolioParaIdFromBlockId, getFolioSelectionViewportRect, getGoogleFontsEnabled, getTemplateDirectives, getTemplateSlashMenu, hashFolioAIBlockText, inspectDocumentStyles, inspectDocumentStylesFromDocx, inspectDocxCompatibility, isFolioBlockId, isFolioDocumentOperationModeSupported, isSequentialFolioBlockId, isSuggestionStale, isSupportedFolioDocumentOperationVersion, normalizeFolioAIBlockText, parseFolioDocumentOperationBatch, resetTemplateSlashQuery, resolveSuggestionAnchor, scanDirectives, scopeEmbeddedFontFamily, scrollFolioPositionIntoView, setAICitationsMeta, setAISuggestionsMeta, setActiveCitationMeta, setAnonymizationTermsMeta, setEmbeddedFontFamilyMap, setFocusedSuggestionMeta, setGoogleFontsEnabled, setTemplatePreviewValues, shouldTriggerAutocomplete, startAutocompleteSuggestion, templateSlashMenuKey, toMarkdown, toMarkdownResult };
|
|
31
|
+
export { DEFAULT_AI_SUGGESTION_PRESETS, DEFAULT_AUTOCOMPLETE_DEAD_ZONE_NODES, DOCUMENT_PRESET_VERSION, DOCUMENT_STYLE_SET_VERSION, DOCX_CONFORMANCE_CLASSES, FOLIO_DOCUMENT_OPERATION_BATCH_MODES, FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION, FOLIO_DOCUMENT_OPERATION_MODES, FOLIO_DOCUMENT_OPERATION_MODES_BY_TYPE, FOLIO_DOCUMENT_OPERATION_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_STORIES, FOLIO_DOCUMENT_OPERATION_TYPES, InvalidFolioDocumentOperationBatchError, STELLA_STYLE_SET_NAME, UnsupportedFolioDocumentOperationVersionError, acceptAutocompleteSuggestion, acceptAutocompleteWord, anonymizationDecorationsKey, appendAutocompleteToken, applyFolioAIEditOperations, applyFolioDocumentOperations, applySuggestions, assertSupportedFolioDocumentOperationVersion, autocompleteSuggestionKey, autocompleteSuggestionPlugin, buildEmbeddedFontFamilyMap, buildPositionalText, clearAutocompleteSuggestion, clearTemplateSlashMenu, consumeTemplateSlashQuery, createAICitationDecorationsPlugin, createDocx, createEmptyDocument, createFolioAIEditSnapshot, createStellaStyleDocumentPreset, createStellaStyleSet, deriveBlockId, diffWordSegments, extractDocumentStyleSet, extractDocumentStyleSetFromDocx, extractEmbeddedFonts, finishAutocompleteSuggestion, fromMarkdown, getAnonymizationMatches, getAutocompleteSuggestion, getEmbeddedFontFaces, getFolioCaretViewportRect, getFolioDocumentOperationCapabilities, getFolioDocumentOperationIssues, getFolioDocumentOperationReceipts, getFolioParaIdFromBlockId, getFolioSelectionViewportRect, getGoogleFontsEnabled, getTemplateDirectives, getTemplateSlashMenu, hashFolioAIBlockText, inspectDocumentStyles, inspectDocumentStylesFromDocx, inspectDocxCompatibility, isFolioBlockId, isFolioDocumentOperationModeSupported, isSequentialFolioBlockId, isSuggestionStale, isSupportedFolioDocumentOperationVersion, mergeDocumentContent, normalizeFolioAIBlockText, parseFolioDocumentOperationBatch, resetTemplateSlashQuery, resolveSuggestionAnchor, scanDirectives, scopeEmbeddedFontFamily, scrollFolioPositionIntoView, setAICitationsMeta, setAISuggestionsMeta, setActiveCitationMeta, setAnonymizationTermsMeta, setEmbeddedFontFamilyMap, setFocusedSuggestionMeta, setGoogleFontsEnabled, setTemplatePreviewValues, shouldTriggerAutocomplete, startAutocompleteSuggestion, templateSlashMenuKey, toMarkdown, toMarkdownResult };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { document_d_exports } from "../../types/document.js";
|
|
2
2
|
import { FOOTNOTE_ENTRY_MARGIN_BOTTOM, FOOTNOTE_FALLBACK_LINE_HEIGHT, FOOTNOTE_SEPARATOR_HEIGHT, FlowBlock, FootnoteContent, Measure, Page } from "../../layout-engine/types.js";
|
|
3
3
|
import { ToFlowBlocksOptions } from "./toFlowBlocks.js";
|
|
4
|
-
|
|
5
4
|
//#region src/layout-bridge/convert/footnoteLayout.d.ts
|
|
6
5
|
type MeasureBlocksFn = (blocks: FlowBlock[], contentWidth: number) => Measure[];
|
|
7
6
|
type ConvertFootnoteOptions = {
|
|
8
7
|
styles?: document_d_exports.StyleDefinitions | null;
|
|
9
8
|
theme?: document_d_exports.Theme | null;
|
|
10
|
-
measureBlocks?: MeasureBlocksFn;
|
|
9
|
+
measureBlocks?: MeasureBlocksFn;
|
|
10
|
+
/** Document-wide `w:defaultTabStop` in twips — forwarded to toFlowBlocks. */
|
|
11
11
|
defaultTabStopTwips?: number;
|
|
12
12
|
lineBreakRules?: ToFlowBlocksOptions["lineBreakRules"];
|
|
13
13
|
justificationCompatibility?: ToFlowBlocksOptions["justificationCompatibility"];
|
|
@@ -48,7 +48,9 @@ type NumberableNote = {
|
|
|
48
48
|
*/
|
|
49
49
|
declare function computeNoteDisplayNumbers(notes: readonly NumberableNote[], refNoteIds: readonly number[]): Map<number, number>;
|
|
50
50
|
type NoteDisplayNumberMaps = {
|
|
51
|
-
/** footnote `w:id` → sequential display number */
|
|
51
|
+
/** footnote `w:id` → sequential display number */
|
|
52
|
+
footnoteNumbers?: ReadonlyMap<number, number>;
|
|
53
|
+
/** endnote `w:id` → sequential display number */
|
|
52
54
|
endnoteNumbers?: ReadonlyMap<number, number>;
|
|
53
55
|
};
|
|
54
56
|
/**
|