@stll/folio-core 0.0.1-placeholder.0 → 0.1.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/LICENSE +202 -0
- package/NOTICE.md +29 -0
- package/README.md +41 -0
- package/dist/_virtual/_rolldown/runtime.js +13 -0
- package/dist/ai-edits/apply.d.ts +35 -0
- package/dist/ai-edits/apply.js +683 -0
- package/dist/ai-edits/clean-text.d.ts +28 -0
- package/dist/ai-edits/clean-text.js +23 -0
- package/dist/ai-edits/headless.d.ts +225 -0
- package/dist/ai-edits/headless.js +513 -0
- package/dist/ai-edits/index.d.ts +6 -0
- package/dist/ai-edits/index.js +5 -0
- package/dist/ai-edits/inline-emphasis.d.ts +38 -0
- package/dist/ai-edits/inline-emphasis.js +78 -0
- package/dist/ai-edits/snapshot.d.ts +9 -0
- package/dist/ai-edits/snapshot.js +195 -0
- package/dist/ai-edits/types.d.ts +156 -0
- package/dist/ai-edits/types.js +0 -0
- package/dist/ai-edits/word-diff.d.ts +20 -0
- package/dist/ai-edits/word-diff.js +77 -0
- package/dist/ai-suggestions/apply.d.ts +17 -0
- package/dist/ai-suggestions/apply.js +64 -0
- package/dist/ai-suggestions/conflict.d.ts +22 -0
- package/dist/ai-suggestions/conflict.js +67 -0
- package/dist/ai-suggestions/text-positions.d.ts +21 -0
- package/dist/ai-suggestions/text-positions.js +48 -0
- package/dist/ai-suggestions/types.d.ts +199 -0
- package/dist/ai-suggestions/types.js +59 -0
- package/dist/content-controls/errors.d.ts +52 -0
- package/dist/content-controls/errors.js +36 -0
- package/dist/content-controls/findContentControls.d.ts +55 -0
- package/dist/content-controls/findContentControls.js +75 -0
- package/dist/content-controls/index.d.ts +4 -0
- package/dist/content-controls/index.js +4 -0
- package/dist/content-controls/mutateContentControls.d.ts +51 -0
- package/dist/content-controls/mutateContentControls.js +377 -0
- package/dist/controller/folioEditor.d.ts +21 -0
- package/dist/controller/folioEditor.js +29 -0
- package/dist/controller/folioEditorEvents.d.ts +23 -0
- package/dist/controller/folioEditorEvents.js +24 -0
- package/dist/controller/hiddenEditorApi.d.ts +35 -0
- package/dist/controller/hiddenEditorApi.js +112 -0
- package/dist/controller/hiddenEditorManager.d.ts +93 -0
- package/dist/controller/hiddenEditorManager.js +308 -0
- package/dist/controller/layoutPipeline.d.ts +63 -0
- package/dist/controller/layoutPipeline.js +406 -0
- package/dist/controller/layoutScheduler.d.ts +41 -0
- package/dist/controller/layoutScheduler.js +59 -0
- package/dist/controller/layoutSession.d.ts +24 -0
- package/dist/controller/layoutSession.js +13 -0
- package/dist/docx/blockContentParser.d.ts +13 -0
- package/dist/docx/blockContentParser.js +289 -0
- package/dist/docx/bookmarkParser.d.ts +178 -0
- package/dist/docx/bookmarkParser.js +246 -0
- package/dist/docx/bookmarkPlacement.d.ts +10 -0
- package/dist/docx/bookmarkPlacement.js +50 -0
- package/dist/docx/bulletMarkers.d.ts +4 -0
- package/dist/docx/bulletMarkers.js +42 -0
- package/dist/docx/commentParser.d.ts +34 -0
- package/dist/docx/commentParser.js +127 -0
- package/dist/docx/commentReferenceNormalization.d.ts +25 -0
- package/dist/docx/commentReferenceNormalization.js +97 -0
- package/dist/docx/commentReplyMarkers.d.ts +20 -0
- package/dist/docx/commentReplyMarkers.js +123 -0
- package/dist/docx/compatibility.d.ts +12 -0
- package/dist/docx/compatibility.js +77 -0
- package/dist/docx/documentParser.d.ts +65 -0
- package/dist/docx/documentParser.js +209 -0
- package/dist/docx/drawingUtils.d.ts +56 -0
- package/dist/docx/drawingUtils.js +305 -0
- package/dist/docx/fieldParser.d.ts +228 -0
- package/dist/docx/fieldParser.js +559 -0
- package/dist/docx/footnoteParser.d.ts +109 -0
- package/dist/docx/footnoteParser.js +270 -0
- package/dist/docx/headerFooterParser.d.ts +119 -0
- package/dist/docx/headerFooterParser.js +266 -0
- package/dist/docx/headerFooterRefParser.d.ts +22 -0
- package/dist/docx/headerFooterRefParser.js +52 -0
- package/dist/docx/headerFooterReferenceNormalization.d.ts +19 -0
- package/dist/docx/headerFooterReferenceNormalization.js +64 -0
- package/dist/docx/hyperlinkParser.d.ts +108 -0
- package/dist/docx/hyperlinkParser.js +230 -0
- package/dist/docx/imageParser.d.ts +93 -0
- package/dist/docx/imageParser.js +522 -0
- package/dist/docx/mathToMathml.d.ts +15 -0
- package/dist/docx/mathToMathml.js +357 -0
- package/dist/docx/modelValidation.d.ts +13 -0
- package/dist/docx/modelValidation.js +21 -0
- package/dist/docx/normalizeBaseDirection.d.ts +12 -0
- package/dist/docx/normalizeBaseDirection.js +81 -0
- package/dist/docx/notePropertiesParser.d.ts +16 -0
- package/dist/docx/notePropertiesParser.js +99 -0
- package/dist/docx/numberingParser.d.ts +86 -0
- package/dist/docx/numberingParser.js +735 -0
- package/dist/docx/numberingReferenceNormalization.d.ts +25 -0
- package/dist/docx/numberingReferenceNormalization.js +22 -0
- package/dist/docx/paragraphParser.d.ts +86 -0
- package/dist/docx/paragraphParser.js +1132 -0
- package/dist/docx/paragraphTraversal.d.ts +19 -0
- package/dist/docx/paragraphTraversal.js +76 -0
- package/dist/docx/parser.d.ts +67 -0
- package/dist/docx/parser.js +391 -0
- package/dist/docx/parserEnums.d.ts +45 -0
- package/dist/docx/parserEnums.js +70 -0
- package/dist/docx/relsParser.d.ts +160 -0
- package/dist/docx/relsParser.js +235 -0
- package/dist/docx/replyToComment.d.ts +29 -0
- package/dist/docx/replyToComment.js +73 -0
- package/dist/docx/rezip.d.ts +166 -0
- package/dist/docx/rezip.js +1194 -0
- package/dist/docx/runConsolidator.d.ts +57 -0
- package/dist/docx/runConsolidator.js +224 -0
- package/dist/docx/runParser.d.ts +78 -0
- package/dist/docx/runParser.js +661 -0
- package/dist/docx/sdtProperties.d.ts +15 -0
- package/dist/docx/sdtProperties.js +290 -0
- package/dist/docx/sdtPropertiesPatch.d.ts +16 -0
- package/dist/docx/sdtPropertiesPatch.js +144 -0
- package/dist/docx/sectionParser.d.ts +95 -0
- package/dist/docx/sectionParser.js +534 -0
- package/dist/docx/selectiveSave.d.ts +25 -0
- package/dist/docx/selectiveSave.js +247 -0
- package/dist/docx/selectiveSaveFlags.d.ts +33 -0
- package/dist/docx/selectiveSaveFlags.js +11 -0
- package/dist/docx/selectiveSaveTripwire.d.ts +33 -0
- package/dist/docx/selectiveSaveTripwire.js +79 -0
- package/dist/docx/selectiveXmlPatch.d.ts +103 -0
- package/dist/docx/selectiveXmlPatch.js +493 -0
- package/dist/docx/serializer/blockSdtSerializer.d.ts +6 -0
- package/dist/docx/serializer/blockSdtSerializer.js +88 -0
- package/dist/docx/serializer/borderSerializer.d.ts +25 -0
- package/dist/docx/serializer/borderSerializer.js +44 -0
- package/dist/docx/serializer/commentSerializer.d.ts +31 -0
- package/dist/docx/serializer/commentSerializer.js +184 -0
- package/dist/docx/serializer/documentSerializer.d.ts +65 -0
- package/dist/docx/serializer/documentSerializer.js +199 -0
- package/dist/docx/serializer/headerFooterSerializer.d.ts +12 -0
- package/dist/docx/serializer/headerFooterSerializer.js +84 -0
- package/dist/docx/serializer/noteSerializer.d.ts +19 -0
- package/dist/docx/serializer/noteSerializer.js +70 -0
- package/dist/docx/serializer/numberingSerializer.d.ts +12 -0
- package/dist/docx/serializer/numberingSerializer.js +93 -0
- package/dist/docx/serializer/paragraphSerializer.d.ts +48 -0
- package/dist/docx/serializer/paragraphSerializer.js +559 -0
- package/dist/docx/serializer/runSerializer.d.ts +56 -0
- package/dist/docx/serializer/runSerializer.js +621 -0
- package/dist/docx/serializer/sectionPropertiesSerializer.d.ts +6 -0
- package/dist/docx/serializer/sectionPropertiesSerializer.js +187 -0
- package/dist/docx/serializer/tableSerializer.d.ts +79 -0
- package/dist/docx/serializer/tableSerializer.js +422 -0
- package/dist/docx/serializer/xmlUtils.d.ts +20 -0
- package/dist/docx/serializer/xmlUtils.js +25 -0
- package/dist/docx/settingsParser.d.ts +8 -0
- package/dist/docx/settingsParser.js +36 -0
- package/dist/docx/shapeParser.d.ts +20 -0
- package/dist/docx/shapeParser.js +272 -0
- package/dist/docx/styleParser.d.ts +50 -0
- package/dist/docx/styleParser.js +905 -0
- package/dist/docx/tableParser.d.ts +202 -0
- package/dist/docx/tableParser.js +811 -0
- package/dist/docx/textBoxParser.d.ts +117 -0
- package/dist/docx/textBoxParser.js +262 -0
- package/dist/docx/themeParser.d.ts +77 -0
- package/dist/docx/themeParser.js +330 -0
- package/dist/docx/trackedMoveRangeNormalization.d.ts +22 -0
- package/dist/docx/trackedMoveRangeNormalization.js +100 -0
- package/dist/docx/unzip.d.ts +118 -0
- package/dist/docx/unzip.js +383 -0
- package/dist/docx/vmlImageParser.d.ts +16 -0
- package/dist/docx/vmlImageParser.js +100 -0
- package/dist/docx/watermarkParser.d.ts +45 -0
- package/dist/docx/watermarkParser.js +348 -0
- package/dist/docx/wrapTypes.d.ts +29 -0
- package/dist/docx/wrapTypes.js +48 -0
- package/dist/docx/xmlParser.d.ts +297 -0
- package/dist/docx/xmlParser.js +527 -0
- package/dist/fields/bookmarkPages.d.ts +13 -0
- package/dist/fields/bookmarkPages.js +66 -0
- package/dist/fields/bookmarkText.d.ts +16 -0
- package/dist/fields/bookmarkText.js +61 -0
- package/dist/fields/evaluateField.d.ts +23 -0
- package/dist/fields/evaluateField.js +77 -0
- package/dist/fields/fieldContext.d.ts +21 -0
- package/dist/fields/fieldContext.js +0 -0
- package/dist/fields/resolveFieldValues.d.ts +44 -0
- package/dist/fields/resolveFieldValues.js +204 -0
- package/dist/fields/sectionPageCounts.d.ts +11 -0
- package/dist/fields/sectionPageCounts.js +16 -0
- package/dist/fields/seqValues.d.ts +14 -0
- package/dist/fields/seqValues.js +36 -0
- package/dist/fonts/embeddedFontTable.d.ts +42 -0
- package/dist/fonts/embeddedFontTable.js +80 -0
- package/dist/fonts/embeddedFonts.d.ts +46 -0
- package/dist/fonts/embeddedFonts.js +112 -0
- package/dist/fonts/fontDeobfuscation.d.ts +30 -0
- package/dist/fonts/fontDeobfuscation.js +57 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.js +23 -0
- package/dist/layout-bridge/convert/footnoteLayout.d.ts +57 -0
- package/dist/layout-bridge/convert/footnoteLayout.js +316 -0
- package/dist/layout-bridge/convert/headerFooterLayout.d.ts +74 -0
- package/dist/layout-bridge/convert/headerFooterLayout.js +432 -0
- package/dist/layout-bridge/convert/templatePreviewFlow.d.ts +36 -0
- package/dist/layout-bridge/convert/templatePreviewFlow.js +176 -0
- package/dist/layout-bridge/convert/toFlowBlocks.d.ts +65 -0
- package/dist/layout-bridge/convert/toFlowBlocks.js +1309 -0
- package/dist/layout-bridge/convert/wrapEditorViewAsSurface.d.ts +17 -0
- package/dist/layout-bridge/convert/wrapEditorViewAsSurface.js +36 -0
- package/dist/layout-bridge/dom/clickToPositionDom.d.ts +66 -0
- package/dist/layout-bridge/dom/clickToPositionDom.js +304 -0
- package/dist/layout-bridge/dom/findBodyPmSpans.d.ts +7 -0
- package/dist/layout-bridge/dom/findBodyPmSpans.js +17 -0
- package/dist/layout-bridge/dom/findHfPmSpans.d.ts +62 -0
- package/dist/layout-bridge/dom/findHfPmSpans.js +197 -0
- package/dist/layout-bridge/engine/clickToPosition.d.ts +66 -0
- package/dist/layout-bridge/engine/clickToPosition.js +403 -0
- package/dist/layout-bridge/engine/hitTest.d.ts +135 -0
- package/dist/layout-bridge/engine/hitTest.js +375 -0
- package/dist/layout-bridge/engine/measuring/index.d.ts +10 -0
- package/dist/layout-bridge/engine/measuring/index.js +9 -0
- package/dist/layout-bridge/engine/selectionRects.d.ts +59 -0
- package/dist/layout-bridge/engine/selectionRects.js +485 -0
- package/dist/layout-bridge/engine/tableWidthUtils.d.ts +7 -0
- package/dist/layout-bridge/engine/tableWidthUtils.js +25 -0
- package/dist/layout-engine/index.d.ts +44 -0
- package/dist/layout-engine/index.js +691 -0
- package/dist/layout-engine/keep-together.d.ts +43 -0
- package/dist/layout-engine/keep-together.js +98 -0
- package/dist/layout-engine/layoutInstrumentation.d.ts +50 -0
- package/dist/layout-engine/layoutInstrumentation.js +43 -0
- package/dist/layout-engine/lineFlow.d.ts +8 -0
- package/dist/layout-engine/lineFlow.js +17 -0
- package/dist/layout-engine/measure/cache.d.ts +93 -0
- package/dist/layout-engine/measure/cache.js +245 -0
- package/dist/layout-engine/measure/clampFloatingWrapMargins.d.ts +20 -0
- package/dist/layout-engine/measure/clampFloatingWrapMargins.js +29 -0
- package/dist/layout-engine/measure/featureFlags.d.ts +44 -0
- package/dist/layout-engine/measure/featureFlags.js +19 -0
- package/dist/layout-engine/measure/floatingZones.d.ts +89 -0
- package/dist/layout-engine/measure/floatingZones.js +152 -0
- package/dist/layout-engine/measure/font-metrics.worker.d.ts +17 -0
- package/dist/layout-engine/measure/font-metrics.worker.js +104 -0
- package/dist/layout-engine/measure/index.d.ts +9 -0
- package/dist/layout-engine/measure/index.js +8 -0
- package/dist/layout-engine/measure/listMarkerWidth.d.ts +40 -0
- package/dist/layout-engine/measure/listMarkerWidth.js +76 -0
- package/dist/layout-engine/measure/measureBlocks.d.ts +25 -0
- package/dist/layout-engine/measure/measureBlocks.js +450 -0
- package/dist/layout-engine/measure/measureContainer.d.ts +24 -0
- package/dist/layout-engine/measure/measureContainer.js +280 -0
- package/dist/layout-engine/measure/measureHelpers.d.ts +82 -0
- package/dist/layout-engine/measure/measureHelpers.js +156 -0
- package/dist/layout-engine/measure/measureParagraph.d.ts +61 -0
- package/dist/layout-engine/measure/measureParagraph.js +724 -0
- package/dist/layout-engine/measure/measureProvider.d.ts +23 -0
- package/dist/layout-engine/measure/measureProvider.js +35 -0
- package/dist/layout-engine/measure/measureTypes.d.ts +61 -0
- package/dist/layout-engine/measure/measureTypes.js +0 -0
- package/dist/layout-engine/measure/measureWorker.d.ts +54 -0
- package/dist/layout-engine/measure/measureWorker.js +249 -0
- package/dist/layout-engine/measure/measureWorkerProtocol.d.ts +88 -0
- package/dist/layout-engine/measure/measureWorkerProtocol.js +20 -0
- package/dist/layout-engine/measure/tableCellFloating.d.ts +26 -0
- package/dist/layout-engine/measure/tableCellFloating.js +99 -0
- package/dist/layout-engine/paginator.d.ts +84 -0
- package/dist/layout-engine/paginator.js +348 -0
- package/dist/layout-engine/paragraphFragmentRange.d.ts +9 -0
- package/dist/layout-engine/paragraphFragmentRange.js +40 -0
- package/dist/layout-engine/section-breaks.d.ts +78 -0
- package/dist/layout-engine/section-breaks.js +182 -0
- package/dist/layout-engine/tableRowBreak.d.ts +23 -0
- package/dist/layout-engine/tableRowBreak.js +147 -0
- package/dist/layout-engine/textBoxFlow.d.ts +50 -0
- package/dist/layout-engine/textBoxFlow.js +160 -0
- package/dist/layout-engine/types.d.ts +1031 -0
- package/dist/layout-engine/types.js +100 -0
- package/dist/layout-painter/documentColors.d.ts +4 -0
- package/dist/layout-painter/documentColors.js +40 -0
- package/dist/layout-painter/index.d.ts +110 -0
- package/dist/layout-painter/index.js +182 -0
- package/dist/layout-painter/registry/modules/image.d.ts +6 -0
- package/dist/layout-painter/registry/modules/image.js +17 -0
- package/dist/layout-painter/registry/modules/paragraph.d.ts +6 -0
- package/dist/layout-painter/registry/modules/paragraph.js +18 -0
- package/dist/layout-painter/registry/modules/table.d.ts +6 -0
- package/dist/layout-painter/registry/modules/table.js +16 -0
- package/dist/layout-painter/registry/modules/textBox.d.ts +6 -0
- package/dist/layout-painter/registry/modules/textBox.js +13 -0
- package/dist/layout-painter/registry/modules.d.ts +6 -0
- package/dist/layout-painter/registry/modules.js +26 -0
- package/dist/layout-painter/registry/registry.d.ts +24 -0
- package/dist/layout-painter/registry/registry.js +53 -0
- package/dist/layout-painter/registry/types.d.ts +61 -0
- package/dist/layout-painter/registry/types.js +0 -0
- package/dist/layout-painter/renderFragment.d.ts +32 -0
- package/dist/layout-painter/renderFragment.js +114 -0
- package/dist/layout-painter/renderImage.d.ts +88 -0
- package/dist/layout-painter/renderImage.js +130 -0
- package/dist/layout-painter/renderPage.d.ts +264 -0
- package/dist/layout-painter/renderPage.js +1795 -0
- package/dist/layout-painter/renderParagraph.d.ts +93 -0
- package/dist/layout-painter/renderParagraph.js +1300 -0
- package/dist/layout-painter/renderTable.d.ts +36 -0
- package/dist/layout-painter/renderTable.js +432 -0
- package/dist/layout-painter/renderTextBox.d.ts +22 -0
- package/dist/layout-painter/renderTextBox.js +67 -0
- package/dist/layout-painter/renderUtils.d.ts +42 -0
- package/dist/layout-painter/renderUtils.js +30 -0
- package/dist/layout-painter/renderWatermark.d.ts +16 -0
- package/dist/layout-painter/renderWatermark.js +61 -0
- package/dist/layout-painter/sdtBoundary.d.ts +6 -0
- package/dist/layout-painter/sdtBoundary.js +28 -0
- package/dist/managers/ContextMenuManager.d.ts +28 -0
- package/dist/managers/ContextMenuManager.js +48 -0
- package/dist/managers/DocumentLoaderManager.d.ts +47 -0
- package/dist/managers/DocumentLoaderManager.js +69 -0
- package/dist/managers/EditorModeManager.d.ts +28 -0
- package/dist/managers/EditorModeManager.js +50 -0
- package/dist/managers/ErrorManager.d.ts +26 -0
- package/dist/managers/ErrorManager.js +85 -0
- package/dist/managers/FindReplaceManager.d.ts +54 -0
- package/dist/managers/FindReplaceManager.js +104 -0
- package/dist/managers/HistoryManager.d.ts +92 -0
- package/dist/managers/HistoryManager.js +193 -0
- package/dist/managers/Subscribable.d.ts +34 -0
- package/dist/managers/Subscribable.js +46 -0
- package/dist/managers/TableSelectionManager.d.ts +74 -0
- package/dist/managers/TableSelectionManager.js +225 -0
- package/dist/managers/editorShortcuts.d.ts +42 -0
- package/dist/managers/editorShortcuts.js +60 -0
- package/dist/managers/types.d.ts +41 -0
- package/dist/managers/types.js +0 -0
- package/dist/markdown/annotations.d.ts +14 -0
- package/dist/markdown/annotations.js +42 -0
- package/dist/markdown/escape.d.ts +36 -0
- package/dist/markdown/escape.js +59 -0
- package/dist/markdown/fromMarkdown.d.ts +11 -0
- package/dist/markdown/fromMarkdown.js +223 -0
- package/dist/markdown/headings.d.ts +13 -0
- package/dist/markdown/headings.js +20 -0
- package/dist/markdown/images.d.ts +13 -0
- package/dist/markdown/images.js +63 -0
- package/dist/markdown/index.d.ts +18 -0
- package/dist/markdown/index.js +33 -0
- package/dist/markdown/internals.d.ts +15 -0
- package/dist/markdown/internals.js +35 -0
- package/dist/markdown/renderBlock.d.ts +7 -0
- package/dist/markdown/renderBlock.js +68 -0
- package/dist/markdown/renderParagraph.d.ts +11 -0
- package/dist/markdown/renderParagraph.js +64 -0
- package/dist/markdown/renderRuns.d.ts +11 -0
- package/dist/markdown/renderRuns.js +265 -0
- package/dist/markdown/renderTable.d.ts +8 -0
- package/dist/markdown/renderTable.js +229 -0
- package/dist/markdown/trailers.d.ts +13 -0
- package/dist/markdown/trailers.js +54 -0
- package/dist/markdown/types.d.ts +118 -0
- package/dist/markdown/types.js +0 -0
- package/dist/model.d.ts +13 -0
- package/dist/model.js +4 -0
- package/dist/paged-layout/LayoutSelectionGate.d.ts +80 -0
- package/dist/paged-layout/LayoutSelectionGate.js +131 -0
- package/dist/paged-layout/headerFooterMargins.d.ts +73 -0
- package/dist/paged-layout/headerFooterMargins.js +120 -0
- package/dist/paged-layout/hiddenEditorScroll.d.ts +4 -0
- package/dist/paged-layout/hiddenEditorScroll.js +4 -0
- package/dist/paged-layout/incrementalMeasure.d.ts +33 -0
- package/dist/paged-layout/incrementalMeasure.js +56 -0
- package/dist/paged-layout/rangeProjection.d.ts +51 -0
- package/dist/paged-layout/rangeProjection.js +153 -0
- package/dist/paged-layout/readOnlyEditAttempt.d.ts +5 -0
- package/dist/paged-layout/readOnlyEditAttempt.js +22 -0
- package/dist/paged-layout/scrollNavigation.d.ts +23 -0
- package/dist/paged-layout/scrollNavigation.js +31 -0
- package/dist/paged-layout/scrollPageInfo.d.ts +41 -0
- package/dist/paged-layout/scrollPageInfo.js +34 -0
- package/dist/paged-layout/scrollToPmPosition.d.ts +17 -0
- package/dist/paged-layout/scrollToPmPosition.js +95 -0
- package/dist/paged-layout/sectionBlockWidths.d.ts +35 -0
- package/dist/paged-layout/sectionBlockWidths.js +52 -0
- package/dist/paged-layout/sectionGeometry.d.ts +21 -0
- package/dist/paged-layout/sectionGeometry.js +36 -0
- package/dist/paged-layout/selectionViewportRect.d.ts +29 -0
- package/dist/paged-layout/selectionViewportRect.js +55 -0
- package/dist/paged-layout/tableColumnResize.d.ts +19 -0
- package/dist/paged-layout/tableColumnResize.js +28 -0
- package/dist/paged-layout/tableInsertButtonGeometry.d.ts +15 -0
- package/dist/paged-layout/tableInsertButtonGeometry.js +15 -0
- package/dist/paged-layout/transactionDirtyRange.d.ts +7 -0
- package/dist/paged-layout/transactionDirtyRange.js +27 -0
- package/dist/paged-layout/zoomScrollAnchor.d.ts +40 -0
- package/dist/paged-layout/zoomScrollAnchor.js +25 -0
- package/dist/prosemirror/attrs/index.d.ts +80 -0
- package/dist/prosemirror/attrs/index.js +1218 -0
- package/dist/prosemirror/autospacingBase.d.ts +11 -0
- package/dist/prosemirror/autospacingBase.js +16 -0
- package/dist/prosemirror/commands/comments.d.ts +93 -0
- package/dist/prosemirror/commands/comments.js +435 -0
- package/dist/prosemirror/commands/contentControls.d.ts +45 -0
- package/dist/prosemirror/commands/contentControls.js +294 -0
- package/dist/prosemirror/commands/contentControlsBlockFill.d.ts +15 -0
- package/dist/prosemirror/commands/contentControlsBlockFill.js +19 -0
- package/dist/prosemirror/commands/formatPainter.d.ts +31 -0
- package/dist/prosemirror/commands/formatPainter.js +130 -0
- package/dist/prosemirror/commands/formatting.d.ts +32 -0
- package/dist/prosemirror/commands/formatting.js +45 -0
- package/dist/prosemirror/commands/hyperlink.d.ts +31 -0
- package/dist/prosemirror/commands/hyperlink.js +79 -0
- package/dist/prosemirror/commands/image.d.ts +59 -0
- package/dist/prosemirror/commands/image.js +219 -0
- package/dist/prosemirror/commands/index.d.ts +13 -0
- package/dist/prosemirror/commands/index.js +13 -0
- package/dist/prosemirror/commands/pageBreak.d.ts +10 -0
- package/dist/prosemirror/commands/pageBreak.js +47 -0
- package/dist/prosemirror/commands/paragraph.d.ts +39 -0
- package/dist/prosemirror/commands/paragraph.js +64 -0
- package/dist/prosemirror/commands/pastePlainText.d.ts +39 -0
- package/dist/prosemirror/commands/pastePlainText.js +67 -0
- package/dist/prosemirror/commands/table.d.ts +83 -0
- package/dist/prosemirror/commands/table.js +105 -0
- package/dist/prosemirror/conversion/fromProseDoc.d.ts +27 -0
- package/dist/prosemirror/conversion/fromProseDoc.js +1550 -0
- package/dist/prosemirror/conversion/index.d.ts +4 -0
- package/dist/prosemirror/conversion/index.js +4 -0
- package/dist/prosemirror/conversion/runShadingMark.d.ts +16 -0
- package/dist/prosemirror/conversion/runShadingMark.js +39 -0
- package/dist/prosemirror/conversion/toProseDoc.d.ts +39 -0
- package/dist/prosemirror/conversion/toProseDoc.js +1404 -0
- package/dist/prosemirror/extensions/ExtensionManager.d.ts +43 -0
- package/dist/prosemirror/extensions/ExtensionManager.js +86 -0
- package/dist/prosemirror/extensions/StarterKit.d.ts +16 -0
- package/dist/prosemirror/extensions/StarterKit.js +132 -0
- package/dist/prosemirror/extensions/core/DocExtension.d.ts +9 -0
- package/dist/prosemirror/extensions/core/DocExtension.js +12 -0
- package/dist/prosemirror/extensions/core/HistoryExtension.d.ts +13 -0
- package/dist/prosemirror/extensions/core/HistoryExtension.js +28 -0
- package/dist/prosemirror/extensions/core/ParagraphExtension.d.ts +25 -0
- package/dist/prosemirror/extensions/core/ParagraphExtension.js +619 -0
- package/dist/prosemirror/extensions/core/TextExtension.d.ts +9 -0
- package/dist/prosemirror/extensions/core/TextExtension.js +12 -0
- package/dist/prosemirror/extensions/create.d.ts +17 -0
- package/dist/prosemirror/extensions/create.js +129 -0
- package/dist/prosemirror/extensions/features/AutoBidiDetectionExtension.d.ts +23 -0
- package/dist/prosemirror/extensions/features/AutoBidiDetectionExtension.js +106 -0
- package/dist/prosemirror/extensions/features/BaseKeymapExtension.d.ts +8 -0
- package/dist/prosemirror/extensions/features/BaseKeymapExtension.js +172 -0
- package/dist/prosemirror/extensions/features/BidiShortcutExtension.d.ts +16 -0
- package/dist/prosemirror/extensions/features/BidiShortcutExtension.js +38 -0
- package/dist/prosemirror/extensions/features/ContentControlWidgetsExtension.d.ts +16 -0
- package/dist/prosemirror/extensions/features/ContentControlWidgetsExtension.js +21 -0
- package/dist/prosemirror/extensions/features/DropCursorExtension.d.ts +12 -0
- package/dist/prosemirror/extensions/features/DropCursorExtension.js +20 -0
- package/dist/prosemirror/extensions/features/EmptyParagraphFormatExtension.d.ts +8 -0
- package/dist/prosemirror/extensions/features/EmptyParagraphFormatExtension.js +44 -0
- package/dist/prosemirror/extensions/features/GapCursorExtension.d.ts +19 -0
- package/dist/prosemirror/extensions/features/GapCursorExtension.js +24 -0
- package/dist/prosemirror/extensions/features/ImageDragExtension.d.ts +15 -0
- package/dist/prosemirror/extensions/features/ImageDragExtension.js +66 -0
- package/dist/prosemirror/extensions/features/ImagePasteExtension.d.ts +12 -0
- package/dist/prosemirror/extensions/features/ImagePasteExtension.js +91 -0
- package/dist/prosemirror/extensions/features/ListExtension.d.ts +14 -0
- package/dist/prosemirror/extensions/features/ListExtension.js +340 -0
- package/dist/prosemirror/extensions/features/ParaIdAllocatorExtension.d.ts +9 -0
- package/dist/prosemirror/extensions/features/ParaIdAllocatorExtension.js +60 -0
- package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.d.ts +35 -0
- package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.js +188 -0
- package/dist/prosemirror/extensions/features/PasteCleanupExtension.d.ts +20 -0
- package/dist/prosemirror/extensions/features/PasteCleanupExtension.js +34 -0
- package/dist/prosemirror/extensions/features/PasteStyleInlinerExtension.d.ts +20 -0
- package/dist/prosemirror/extensions/features/PasteStyleInlinerExtension.js +145 -0
- package/dist/prosemirror/extensions/features/SelectionTrackerExtension.d.ts +10 -0
- package/dist/prosemirror/extensions/features/SelectionTrackerExtension.js +17 -0
- package/dist/prosemirror/extensions/features/bidiShortcutController.d.ts +31 -0
- package/dist/prosemirror/extensions/features/bidiShortcutController.js +27 -0
- package/dist/prosemirror/extensions/features/pasteCleanup.d.ts +31 -0
- package/dist/prosemirror/extensions/features/pasteCleanup.js +159 -0
- package/dist/prosemirror/extensions/marks/AllCapsExtension.d.ts +9 -0
- package/dist/prosemirror/extensions/marks/AllCapsExtension.js +24 -0
- package/dist/prosemirror/extensions/marks/BoldExtension.d.ts +9 -0
- package/dist/prosemirror/extensions/marks/BoldExtension.js +41 -0
- package/dist/prosemirror/extensions/marks/CharacterSpacingExtension.d.ts +14 -0
- package/dist/prosemirror/extensions/marks/CharacterSpacingExtension.js +64 -0
- package/dist/prosemirror/extensions/marks/CharacterStyleExtension.d.ts +23 -0
- package/dist/prosemirror/extensions/marks/CharacterStyleExtension.js +47 -0
- package/dist/prosemirror/extensions/marks/CommentExtension.d.ts +12 -0
- package/dist/prosemirror/extensions/marks/CommentExtension.js +38 -0
- package/dist/prosemirror/extensions/marks/FontFamilyExtension.d.ts +9 -0
- package/dist/prosemirror/extensions/marks/FontFamilyExtension.js +55 -0
- package/dist/prosemirror/extensions/marks/FontSizeExtension.d.ts +9 -0
- package/dist/prosemirror/extensions/marks/FontSizeExtension.js +47 -0
- package/dist/prosemirror/extensions/marks/FootnoteRefExtension.d.ts +11 -0
- package/dist/prosemirror/extensions/marks/FootnoteRefExtension.js +92 -0
- package/dist/prosemirror/extensions/marks/HiddenTextExtension.d.ts +23 -0
- package/dist/prosemirror/extensions/marks/HiddenTextExtension.js +35 -0
- package/dist/prosemirror/extensions/marks/HighlightExtension.d.ts +10 -0
- package/dist/prosemirror/extensions/marks/HighlightExtension.js +115 -0
- package/dist/prosemirror/extensions/marks/HyperlinkExtension.d.ts +13 -0
- package/dist/prosemirror/extensions/marks/HyperlinkExtension.js +146 -0
- package/dist/prosemirror/extensions/marks/ItalicExtension.d.ts +9 -0
- package/dist/prosemirror/extensions/marks/ItalicExtension.js +34 -0
- package/dist/prosemirror/extensions/marks/RtlExtension.d.ts +6 -0
- package/dist/prosemirror/extensions/marks/RtlExtension.js +21 -0
- package/dist/prosemirror/extensions/marks/RunFormattingOverrideExtension.d.ts +11 -0
- package/dist/prosemirror/extensions/marks/RunFormattingOverrideExtension.js +75 -0
- package/dist/prosemirror/extensions/marks/RunShadingExtension.d.ts +6 -0
- package/dist/prosemirror/extensions/marks/RunShadingExtension.js +38 -0
- package/dist/prosemirror/extensions/marks/SmallCapsExtension.d.ts +9 -0
- package/dist/prosemirror/extensions/marks/SmallCapsExtension.js +24 -0
- package/dist/prosemirror/extensions/marks/StrikeExtension.d.ts +9 -0
- package/dist/prosemirror/extensions/marks/StrikeExtension.js +33 -0
- package/dist/prosemirror/extensions/marks/SubscriptExtension.d.ts +9 -0
- package/dist/prosemirror/extensions/marks/SubscriptExtension.js +25 -0
- package/dist/prosemirror/extensions/marks/SuperscriptExtension.d.ts +9 -0
- package/dist/prosemirror/extensions/marks/SuperscriptExtension.js +25 -0
- package/dist/prosemirror/extensions/marks/TextColorExtension.d.ts +9 -0
- package/dist/prosemirror/extensions/marks/TextColorExtension.js +50 -0
- package/dist/prosemirror/extensions/marks/TextEffectExtension.d.ts +6 -0
- package/dist/prosemirror/extensions/marks/TextEffectExtension.js +35 -0
- package/dist/prosemirror/extensions/marks/TextEffectsExtensions.d.ts +31 -0
- package/dist/prosemirror/extensions/marks/TextEffectsExtensions.js +134 -0
- package/dist/prosemirror/extensions/marks/TrackedChangeExtensions.d.ts +22 -0
- package/dist/prosemirror/extensions/marks/TrackedChangeExtensions.js +113 -0
- package/dist/prosemirror/extensions/marks/UnderlineExtension.d.ts +9 -0
- package/dist/prosemirror/extensions/marks/UnderlineExtension.js +60 -0
- package/dist/prosemirror/extensions/marks/markUtils.d.ts +34 -0
- package/dist/prosemirror/extensions/marks/markUtils.js +233 -0
- package/dist/prosemirror/extensions/nodes/BlockSdtExtension.d.ts +22 -0
- package/dist/prosemirror/extensions/nodes/BlockSdtExtension.js +122 -0
- package/dist/prosemirror/extensions/nodes/FieldExtension.d.ts +12 -0
- package/dist/prosemirror/extensions/nodes/FieldExtension.js +87 -0
- package/dist/prosemirror/extensions/nodes/HardBreakExtension.d.ts +9 -0
- package/dist/prosemirror/extensions/nodes/HardBreakExtension.js +38 -0
- package/dist/prosemirror/extensions/nodes/HorizontalRuleExtension.d.ts +9 -0
- package/dist/prosemirror/extensions/nodes/HorizontalRuleExtension.js +18 -0
- package/dist/prosemirror/extensions/nodes/ImageExtension.d.ts +9 -0
- package/dist/prosemirror/extensions/nodes/ImageExtension.js +132 -0
- package/dist/prosemirror/extensions/nodes/MathExtension.d.ts +13 -0
- package/dist/prosemirror/extensions/nodes/MathExtension.js +56 -0
- package/dist/prosemirror/extensions/nodes/PageBreakExtension.d.ts +9 -0
- package/dist/prosemirror/extensions/nodes/PageBreakExtension.js +20 -0
- package/dist/prosemirror/extensions/nodes/SdtExtension.d.ts +12 -0
- package/dist/prosemirror/extensions/nodes/SdtExtension.js +107 -0
- package/dist/prosemirror/extensions/nodes/ShapeExtension.d.ts +30 -0
- package/dist/prosemirror/extensions/nodes/ShapeExtension.js +502 -0
- package/dist/prosemirror/extensions/nodes/TabExtension.d.ts +9 -0
- package/dist/prosemirror/extensions/nodes/TabExtension.js +27 -0
- package/dist/prosemirror/extensions/nodes/TableExtension.d.ts +34 -0
- package/dist/prosemirror/extensions/nodes/TableExtension.js +1972 -0
- package/dist/prosemirror/extensions/nodes/TextBoxExtension.d.ts +34 -0
- package/dist/prosemirror/extensions/nodes/TextBoxExtension.js +150 -0
- package/dist/prosemirror/extensions/types.d.ts +101 -0
- package/dist/prosemirror/extensions/types.js +10 -0
- package/dist/prosemirror/findReplaceSelection.d.ts +23 -0
- package/dist/prosemirror/findReplaceSelection.js +86 -0
- package/dist/prosemirror/index.d.ts +25 -0
- package/dist/prosemirror/index.js +23 -0
- package/dist/prosemirror/insertOperations.d.ts +12 -0
- package/dist/prosemirror/insertOperations.js +19 -0
- package/dist/prosemirror/paragraphDirection.d.ts +42 -0
- package/dist/prosemirror/paragraphDirection.js +33 -0
- package/dist/prosemirror/plugins/aiCitationDecorations.d.ts +40 -0
- package/dist/prosemirror/plugins/aiCitationDecorations.js +90 -0
- package/dist/prosemirror/plugins/aiSuggestionDecorations.d.ts +42 -0
- package/dist/prosemirror/plugins/aiSuggestionDecorations.js +135 -0
- package/dist/prosemirror/plugins/anonymizationDecorations.d.ts +60 -0
- package/dist/prosemirror/plugins/anonymizationDecorations.js +120 -0
- package/dist/prosemirror/plugins/autocompleteSuggestion.d.ts +123 -0
- package/dist/prosemirror/plugins/autocompleteSuggestion.js +283 -0
- package/dist/prosemirror/plugins/contentControlWidgets.d.ts +56 -0
- package/dist/prosemirror/plugins/contentControlWidgets.js +192 -0
- package/dist/prosemirror/plugins/createDocScanPlugin.d.ts +37 -0
- package/dist/prosemirror/plugins/createDocScanPlugin.js +55 -0
- package/dist/prosemirror/plugins/documentStyles.d.ts +18 -0
- package/dist/prosemirror/plugins/documentStyles.js +46 -0
- package/dist/prosemirror/plugins/index.d.ts +3 -0
- package/dist/prosemirror/plugins/index.js +3 -0
- package/dist/prosemirror/plugins/pmTextScan.d.ts +19 -0
- package/dist/prosemirror/plugins/pmTextScan.js +39 -0
- package/dist/prosemirror/plugins/selectionTracker.d.ts +43 -0
- package/dist/prosemirror/plugins/selectionTracker.js +179 -0
- package/dist/prosemirror/plugins/suggestionMode.d.ts +70 -0
- package/dist/prosemirror/plugins/suggestionMode.js +489 -0
- package/dist/prosemirror/plugins/templateDirectives.d.ts +25 -0
- package/dist/prosemirror/plugins/templateDirectives.js +67 -0
- package/dist/prosemirror/plugins/templatePreviewValues.d.ts +49 -0
- package/dist/prosemirror/plugins/templatePreviewValues.js +117 -0
- package/dist/prosemirror/plugins/templateSlashMenu.d.ts +57 -0
- package/dist/prosemirror/plugins/templateSlashMenu.js +184 -0
- package/dist/prosemirror/schema/index.d.ts +15 -0
- package/dist/prosemirror/schema/index.js +20 -0
- package/dist/prosemirror/schema/marks.d.ts +118 -0
- package/dist/prosemirror/schema/marks.js +0 -0
- package/dist/prosemirror/schema/nodes.d.ts +389 -0
- package/dist/prosemirror/schema/nodes.js +0 -0
- package/dist/prosemirror/selectionState.d.ts +23 -0
- package/dist/prosemirror/selectionState.js +111 -0
- package/dist/prosemirror/styles/index.d.ts +2 -0
- package/dist/prosemirror/styles/index.js +2 -0
- package/dist/prosemirror/styles/resolvedStyleAttrs.d.ts +32 -0
- package/dist/prosemirror/styles/resolvedStyleAttrs.js +108 -0
- package/dist/prosemirror/styles/styleResolver.d.ts +94 -0
- package/dist/prosemirror/styles/styleResolver.js +200 -0
- package/dist/prosemirror/utils/findParagraphByParaId.d.ts +26 -0
- package/dist/prosemirror/utils/findParagraphByParaId.js +37 -0
- package/dist/prosemirror/utils/tabCalculator.d.ts +110 -0
- package/dist/prosemirror/utils/tabCalculator.js +137 -0
- package/dist/prosemirror/validation.d.ts +20 -0
- package/dist/prosemirror/validation.js +177 -0
- package/dist/server.d.ts +7 -0
- package/dist/server.js +6 -0
- package/dist/style-engine/index.d.ts +3 -0
- package/dist/style-engine/index.js +2 -0
- package/dist/style-engine/styleEngine.d.ts +67 -0
- package/dist/style-engine/styleEngine.js +70 -0
- package/dist/types/block-id.d.ts +58 -0
- package/dist/types/block-id.js +61 -0
- package/dist/types/colors.d.ts +2 -0
- package/dist/types/colors.js +0 -0
- package/dist/types/content.d.ts +2 -0
- package/dist/types/content.js +0 -0
- package/dist/types/document.d.ts +7 -0
- package/dist/types/document.js +0 -0
- package/dist/types/documentEnumValues.d.ts +89 -0
- package/dist/types/documentEnumValues.js +693 -0
- package/dist/types/formatting.d.ts +2 -0
- package/dist/types/formatting.js +0 -0
- package/dist/types/index.d.ts +107 -0
- package/dist/types/index.js +0 -0
- package/dist/utils/authorColors.d.ts +16 -0
- package/dist/utils/authorColors.js +30 -0
- package/dist/utils/baseDirection.d.ts +23 -0
- package/dist/utils/baseDirection.js +34 -0
- package/dist/utils/clipboard.d.ts +126 -0
- package/dist/utils/clipboard.js +622 -0
- package/dist/utils/colorResolver.d.ts +158 -0
- package/dist/utils/colorResolver.js +557 -0
- package/dist/utils/createDocument.d.ts +50 -0
- package/dist/utils/createDocument.js +262 -0
- package/dist/utils/documentLoaderBehavior.d.ts +22 -0
- package/dist/utils/documentLoaderBehavior.js +14 -0
- package/dist/utils/docxInput.d.ts +22 -0
- package/dist/utils/docxInput.js +16 -0
- package/dist/utils/domGuards.d.ts +59 -0
- package/dist/utils/domGuards.js +82 -0
- package/dist/utils/fontFamilyMerge.d.ts +7 -0
- package/dist/utils/fontFamilyMerge.js +31 -0
- package/dist/utils/fontLoader.d.ts +50 -0
- package/dist/utils/fontLoader.js +177 -0
- package/dist/utils/fontResolver.d.ts +61 -0
- package/dist/utils/fontResolver.js +651 -0
- package/dist/utils/fontWeights.d.ts +4 -0
- package/dist/utils/fontWeights.js +4 -0
- package/dist/utils/formatToStyle.d.ts +103 -0
- package/dist/utils/formatToStyle.js +289 -0
- package/dist/utils/headerFooter.d.ts +74 -0
- package/dist/utils/headerFooter.js +257 -0
- package/dist/utils/headingCollector.d.ts +22 -0
- package/dist/utils/headingCollector.js +36 -0
- package/dist/utils/hexId.d.ts +33 -0
- package/dist/utils/hexId.js +37 -0
- package/dist/utils/imageValidation.d.ts +5 -0
- package/dist/utils/imageValidation.js +31 -0
- package/dist/utils/paragraphFormattingMerge.d.ts +14 -0
- package/dist/utils/paragraphFormattingMerge.js +68 -0
- package/dist/utils/replaceText.d.ts +17 -0
- package/dist/utils/replaceText.js +161 -0
- package/dist/utils/rotationBoundingBox.d.ts +12 -0
- package/dist/utils/rotationBoundingBox.js +36 -0
- package/dist/utils/scriptSegments.d.ts +36 -0
- package/dist/utils/scriptSegments.js +52 -0
- package/dist/utils/tableOperations.d.ts +87 -0
- package/dist/utils/tableOperations.js +259 -0
- package/dist/utils/textFormattingMerge.d.ts +6 -0
- package/dist/utils/textFormattingMerge.js +31 -0
- package/dist/utils/tiffConverter.d.ts +18 -0
- package/dist/utils/tiffConverter.js +83 -0
- package/dist/utils/units.d.ts +99 -0
- package/dist/utils/units.js +139 -0
- package/dist/utils/urlSecurity.d.ts +7 -0
- package/dist/utils/urlSecurity.js +65 -0
- package/dist/watermark/index.d.ts +39 -0
- package/dist/watermark/index.js +149 -0
- package/package.json +122 -2
|
@@ -0,0 +1,522 @@
|
|
|
1
|
+
import { findByFullName, findChild, getAttribute, getChildElements, parseNumericAttribute } from "./xmlParser.js";
|
|
2
|
+
import { emuToPixels } from "../utils/units.js";
|
|
3
|
+
import { WRAP_ELEMENT_NAMES, parsePositionH, parsePositionV, parseWrapElement } from "./drawingUtils.js";
|
|
4
|
+
import { resolveTarget } from "./relsParser.js";
|
|
5
|
+
import { isTextBoxDrawing } from "./textBoxParser.js";
|
|
6
|
+
//#region src/docx/imageParser.ts
|
|
7
|
+
/**
|
|
8
|
+
* Convert rotation value (1/60000 of a degree) to degrees
|
|
9
|
+
*
|
|
10
|
+
* @param rot - Rotation in 60000ths of a degree
|
|
11
|
+
* @returns Rotation in degrees
|
|
12
|
+
*/
|
|
13
|
+
function rotToDegrees(rot) {
|
|
14
|
+
if (!rot) return;
|
|
15
|
+
const val = Number.parseInt(rot, 10);
|
|
16
|
+
if (Number.isNaN(val)) return;
|
|
17
|
+
return val / 6e4;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Find any of the specified elements
|
|
21
|
+
*/
|
|
22
|
+
function findAnyOf(parent, names) {
|
|
23
|
+
const children = getChildElements(parent);
|
|
24
|
+
for (const child of children) if (names.includes(child.name || "")) return child;
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Parse extent element for image size
|
|
29
|
+
*
|
|
30
|
+
* @param extent - wp:extent element
|
|
31
|
+
* @returns ImageSize in EMUs
|
|
32
|
+
*/
|
|
33
|
+
function parseExtent(extent) {
|
|
34
|
+
if (!extent) return {
|
|
35
|
+
width: 0,
|
|
36
|
+
height: 0
|
|
37
|
+
};
|
|
38
|
+
return {
|
|
39
|
+
width: parseNumericAttribute(extent, null, "cx") ?? 0,
|
|
40
|
+
height: parseNumericAttribute(extent, null, "cy") ?? 0
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Parse effect extent for shadow/effect margins
|
|
45
|
+
*
|
|
46
|
+
* @param effectExtent - wp:effectExtent element
|
|
47
|
+
* @returns Padding for effects
|
|
48
|
+
*/
|
|
49
|
+
function parseEffectExtent(effectExtent) {
|
|
50
|
+
if (!effectExtent) return;
|
|
51
|
+
const l = parseNumericAttribute(effectExtent, null, "l") ?? 0;
|
|
52
|
+
const t = parseNumericAttribute(effectExtent, null, "t") ?? 0;
|
|
53
|
+
const r = parseNumericAttribute(effectExtent, null, "r") ?? 0;
|
|
54
|
+
const b = parseNumericAttribute(effectExtent, null, "b") ?? 0;
|
|
55
|
+
if (l === 0 && t === 0 && r === 0 && b === 0) return;
|
|
56
|
+
return {
|
|
57
|
+
left: l,
|
|
58
|
+
top: t,
|
|
59
|
+
right: r,
|
|
60
|
+
bottom: b
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Parse document properties (wp:docPr)
|
|
65
|
+
*
|
|
66
|
+
* @param docPr - wp:docPr element
|
|
67
|
+
* @returns Object with id, name, description, title
|
|
68
|
+
*/
|
|
69
|
+
function parseDocProps(docPr) {
|
|
70
|
+
if (!docPr) return {};
|
|
71
|
+
const id = getAttribute(docPr, null, "id");
|
|
72
|
+
const name = getAttribute(docPr, null, "name");
|
|
73
|
+
const descr = getAttribute(docPr, null, "descr");
|
|
74
|
+
const title = getAttribute(docPr, null, "title");
|
|
75
|
+
const decorative = getAttribute(docPr, null, "decorative") === "1";
|
|
76
|
+
const hlinkClickEl = findChild(docPr, "a", "hlinkClick");
|
|
77
|
+
const hlinkRId = hlinkClickEl ? getAttribute(hlinkClickEl, "r", "id") : null;
|
|
78
|
+
return {
|
|
79
|
+
...id != null ? { id } : {},
|
|
80
|
+
...name != null ? { name } : {},
|
|
81
|
+
...descr != null ? { alt: descr } : {},
|
|
82
|
+
...title != null ? { title } : {},
|
|
83
|
+
...decorative ? { decorative } : {},
|
|
84
|
+
...hlinkRId != null ? { hlinkRId } : {}
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Parse transform properties from a:xfrm
|
|
89
|
+
*/
|
|
90
|
+
function parseTransform(xfrm) {
|
|
91
|
+
if (!xfrm) return;
|
|
92
|
+
const rot = getAttribute(xfrm, null, "rot");
|
|
93
|
+
const flipH = getAttribute(xfrm, null, "flipH") === "1";
|
|
94
|
+
const flipV = getAttribute(xfrm, null, "flipV") === "1";
|
|
95
|
+
const rotation = rotToDegrees(rot);
|
|
96
|
+
if (rotation === void 0 && !flipH && !flipV) return;
|
|
97
|
+
const transform = {};
|
|
98
|
+
if (rotation !== void 0) transform.rotation = rotation;
|
|
99
|
+
if (flipH) transform.flipH = true;
|
|
100
|
+
if (flipV) transform.flipV = true;
|
|
101
|
+
return transform;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Find the pic:blipFill element in a w:drawing container.
|
|
105
|
+
*
|
|
106
|
+
* Path: a:graphic > a:graphicData > pic:pic > pic:blipFill
|
|
107
|
+
*
|
|
108
|
+
* The blipFill carries both `a:blip` (the relationship ID) and the optional
|
|
109
|
+
* `a:srcRect` crop element, so callers that need either share this walk.
|
|
110
|
+
*/
|
|
111
|
+
function findBlipFillElement(container) {
|
|
112
|
+
const graphic = findByFullName(container, "a:graphic");
|
|
113
|
+
if (!graphic) return null;
|
|
114
|
+
const graphicData = findByFullName(graphic, "a:graphicData");
|
|
115
|
+
if (!graphicData) return null;
|
|
116
|
+
const pic = findByFullName(graphicData, "pic:pic");
|
|
117
|
+
if (!pic) return null;
|
|
118
|
+
return findByFullName(pic, "pic:blipFill");
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Parse `<a:srcRect l="..." t="..." r="..." b="..."/>` inside `pic:blipFill`.
|
|
122
|
+
* Values are in 1/100000 of the source image dimension; converted to fractions
|
|
123
|
+
* in [0, 1] so the renderer can apply them as CSS clip-path percentages.
|
|
124
|
+
*
|
|
125
|
+
* eigenpal #424 (image-crop subset).
|
|
126
|
+
*/
|
|
127
|
+
function parseImageCrop(blipFill) {
|
|
128
|
+
if (!blipFill) return;
|
|
129
|
+
const srcRect = findByFullName(blipFill, "a:srcRect");
|
|
130
|
+
if (!srcRect) return;
|
|
131
|
+
const toFraction = (attr) => {
|
|
132
|
+
const raw = parseNumericAttribute(srcRect, null, attr);
|
|
133
|
+
if (raw === void 0 || raw === 0) return;
|
|
134
|
+
return raw / 1e5;
|
|
135
|
+
};
|
|
136
|
+
const left = toFraction("l");
|
|
137
|
+
const top = toFraction("t");
|
|
138
|
+
const right = toFraction("r");
|
|
139
|
+
const bottom = toFraction("b");
|
|
140
|
+
if (left === void 0 && top === void 0 && right === void 0 && bottom === void 0) return;
|
|
141
|
+
const crop = {};
|
|
142
|
+
if (left !== void 0) crop.left = left;
|
|
143
|
+
if (top !== void 0) crop.top = top;
|
|
144
|
+
if (right !== void 0) crop.right = right;
|
|
145
|
+
if (bottom !== void 0) crop.bottom = bottom;
|
|
146
|
+
return crop;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Parse an OOXML `ST_OnOff` attribute on an element. Accepts the full
|
|
150
|
+
* set of literals the spec allows (`"1"`/`"true"`/`"on"` and
|
|
151
|
+
* `"0"`/`"false"`/`"off"`); anything else (including an absent
|
|
152
|
+
* attribute) folds back to `undefined` so callers can apply the
|
|
153
|
+
* spec-defined default.
|
|
154
|
+
*/
|
|
155
|
+
function parseOnOffAttr(element, name) {
|
|
156
|
+
const raw = getAttribute(element, null, name);
|
|
157
|
+
if (raw === null) return;
|
|
158
|
+
if (raw === "1" || raw === "true" || raw === "on") return true;
|
|
159
|
+
if (raw === "0" || raw === "false" || raw === "off") return false;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Parse `<a:alphaModFix amt="..."/>` inside the `a:blip` element. The
|
|
163
|
+
* `amt` value is in 1/100000; convert to a fraction in [0, 1] for CSS
|
|
164
|
+
* `opacity`. Returns undefined when no alpha modifier is present (fully
|
|
165
|
+
* opaque), when `amt` is missing or non-numeric, or when `amt` >= 100000
|
|
166
|
+
* (also fully opaque). `parseNumericAttribute` already returns
|
|
167
|
+
* `undefined` (not `NaN`) for non-numeric values, so a downstream NaN
|
|
168
|
+
* is impossible here.
|
|
169
|
+
*
|
|
170
|
+
* Mirrors eigenpal docx-editor #424.
|
|
171
|
+
*/
|
|
172
|
+
function parseImageOpacity(blip) {
|
|
173
|
+
if (!blip) return;
|
|
174
|
+
const alpha = findByFullName(blip, "a:alphaModFix");
|
|
175
|
+
if (!alpha) return;
|
|
176
|
+
const amt = parseNumericAttribute(alpha, null, "amt");
|
|
177
|
+
if (amt === void 0 || amt >= 1e5) return;
|
|
178
|
+
return Math.max(0, amt / 1e5);
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Extract rId from a:blip element
|
|
182
|
+
*/
|
|
183
|
+
function extractBlipRId(blip) {
|
|
184
|
+
if (!blip) return "";
|
|
185
|
+
const rEmbed = getAttribute(blip, "r", "embed");
|
|
186
|
+
if (rEmbed) return rEmbed;
|
|
187
|
+
const embed = getAttribute(blip, null, "embed");
|
|
188
|
+
if (embed) return embed;
|
|
189
|
+
const rLink = getAttribute(blip, "r", "link");
|
|
190
|
+
if (rLink) return rLink;
|
|
191
|
+
return "";
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Find transform (a:xfrm) from picture shape properties
|
|
195
|
+
*
|
|
196
|
+
* Path: a:graphic > a:graphicData > pic:pic > pic:spPr > a:xfrm
|
|
197
|
+
*/
|
|
198
|
+
function findPictureTransform(container) {
|
|
199
|
+
const graphic = findByFullName(container, "a:graphic");
|
|
200
|
+
if (!graphic) return null;
|
|
201
|
+
const graphicData = findByFullName(graphic, "a:graphicData");
|
|
202
|
+
if (!graphicData) return null;
|
|
203
|
+
const pic = findByFullName(graphicData, "pic:pic");
|
|
204
|
+
if (!pic) return null;
|
|
205
|
+
const spPr = findByFullName(pic, "pic:spPr");
|
|
206
|
+
if (!spPr) return null;
|
|
207
|
+
return findByFullName(spPr, "a:xfrm");
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Normalize a target path to the standard word/media/... format
|
|
211
|
+
*/
|
|
212
|
+
function normalizeMediaPath(targetPath) {
|
|
213
|
+
if (!targetPath) return targetPath;
|
|
214
|
+
let normalized = targetPath.replace(/^\/+/u, "");
|
|
215
|
+
if (!normalized.startsWith("word/")) normalized = `word/${normalized}`;
|
|
216
|
+
return normalized;
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Get MIME type from file extension
|
|
220
|
+
*/
|
|
221
|
+
function getMimeType(path) {
|
|
222
|
+
return {
|
|
223
|
+
png: "image/png",
|
|
224
|
+
jpg: "image/jpeg",
|
|
225
|
+
jpeg: "image/jpeg",
|
|
226
|
+
gif: "image/gif",
|
|
227
|
+
bmp: "image/bmp",
|
|
228
|
+
tiff: "image/tiff",
|
|
229
|
+
tif: "image/tiff",
|
|
230
|
+
webp: "image/webp",
|
|
231
|
+
svg: "image/svg+xml",
|
|
232
|
+
emf: "image/x-emf",
|
|
233
|
+
wmf: "image/x-wmf"
|
|
234
|
+
}[path.split(".").pop()?.toLowerCase() ?? ""] ?? "application/octet-stream";
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Resolve image data from relationships and media map
|
|
238
|
+
*
|
|
239
|
+
* @param rId - Relationship ID (e.g., "rId1")
|
|
240
|
+
* @param rels - Relationship map
|
|
241
|
+
* @param media - Media files map
|
|
242
|
+
* @returns Object with src (data URL or blob), mimeType, and filename
|
|
243
|
+
*/
|
|
244
|
+
function resolveImageData(rId, rels, media) {
|
|
245
|
+
if (!rId || !rels) return {};
|
|
246
|
+
const rel = rels.get(rId);
|
|
247
|
+
if (!rel) return {};
|
|
248
|
+
const targetPath = rel.target;
|
|
249
|
+
if (!targetPath) return {};
|
|
250
|
+
const normalizedPath = normalizeMediaPath(targetPath);
|
|
251
|
+
const filename = targetPath.split("/").pop();
|
|
252
|
+
const findMediaCaseInsensitive = (map, searchPath) => {
|
|
253
|
+
const lowerPath = searchPath.toLowerCase();
|
|
254
|
+
for (const [key, value] of map.entries()) if (key.toLowerCase() === lowerPath) return value;
|
|
255
|
+
};
|
|
256
|
+
if (media) {
|
|
257
|
+
const mediaFile = findMediaCaseInsensitive(media, normalizedPath);
|
|
258
|
+
if (mediaFile) {
|
|
259
|
+
const src = mediaFile.dataUrl || mediaFile.base64;
|
|
260
|
+
return {
|
|
261
|
+
...src !== void 0 ? { src } : {},
|
|
262
|
+
mimeType: mediaFile.mimeType,
|
|
263
|
+
...filename !== void 0 ? { filename } : {}
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
const altPath = targetPath.replace(/^\/+/u, "");
|
|
267
|
+
const altMediaFile = findMediaCaseInsensitive(media, altPath);
|
|
268
|
+
if (altMediaFile) {
|
|
269
|
+
const src = altMediaFile.dataUrl || altMediaFile.base64;
|
|
270
|
+
return {
|
|
271
|
+
...src !== void 0 ? { src } : {},
|
|
272
|
+
mimeType: altMediaFile.mimeType,
|
|
273
|
+
...filename !== void 0 ? { filename } : {}
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
const prefixedMediaFile = findMediaCaseInsensitive(media, `word/${altPath}`);
|
|
277
|
+
if (prefixedMediaFile) {
|
|
278
|
+
const src = prefixedMediaFile.dataUrl || prefixedMediaFile.base64;
|
|
279
|
+
return {
|
|
280
|
+
...src !== void 0 ? { src } : {},
|
|
281
|
+
mimeType: prefixedMediaFile.mimeType,
|
|
282
|
+
...filename !== void 0 ? { filename } : {}
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
return {
|
|
287
|
+
mimeType: getMimeType(targetPath),
|
|
288
|
+
...filename !== void 0 ? { filename } : {}
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Parse a wp:inline element (inline image)
|
|
293
|
+
*
|
|
294
|
+
* @param inlineEl - The wp:inline element
|
|
295
|
+
* @param rels - Relationship map for resolving rId
|
|
296
|
+
* @param media - Media files map
|
|
297
|
+
* @returns Parsed Image object
|
|
298
|
+
*/
|
|
299
|
+
function parseInline(inlineEl, rels, media) {
|
|
300
|
+
const size = parseExtent(findByFullName(inlineEl, "wp:extent"));
|
|
301
|
+
const padding = parseEffectExtent(findByFullName(inlineEl, "wp:effectExtent"));
|
|
302
|
+
const props = parseDocProps(findByFullName(inlineEl, "wp:docPr"));
|
|
303
|
+
const blipFill = findBlipFillElement(inlineEl);
|
|
304
|
+
const blip = blipFill ? findByFullName(blipFill, "a:blip") : null;
|
|
305
|
+
const rId = extractBlipRId(blip);
|
|
306
|
+
const crop = parseImageCrop(blipFill);
|
|
307
|
+
const opacity = parseImageOpacity(blip);
|
|
308
|
+
const imageData = resolveImageData(rId, rels, media);
|
|
309
|
+
const transform = parseTransform(findPictureTransform(inlineEl));
|
|
310
|
+
const distT = parseNumericAttribute(inlineEl, null, "distT") ?? void 0;
|
|
311
|
+
const distB = parseNumericAttribute(inlineEl, null, "distB") ?? void 0;
|
|
312
|
+
const distL = parseNumericAttribute(inlineEl, null, "distL") ?? void 0;
|
|
313
|
+
const distR = parseNumericAttribute(inlineEl, null, "distR") ?? void 0;
|
|
314
|
+
const wrap = { type: "inline" };
|
|
315
|
+
if (distT !== void 0) wrap.distT = distT;
|
|
316
|
+
if (distB !== void 0) wrap.distB = distB;
|
|
317
|
+
if (distL !== void 0) wrap.distL = distL;
|
|
318
|
+
if (distR !== void 0) wrap.distR = distR;
|
|
319
|
+
const image = {
|
|
320
|
+
type: "image",
|
|
321
|
+
rId,
|
|
322
|
+
size,
|
|
323
|
+
wrap
|
|
324
|
+
};
|
|
325
|
+
if (props.id) image.id = props.id;
|
|
326
|
+
if (props.alt) image.alt = props.alt;
|
|
327
|
+
if (props.title) image.title = props.title;
|
|
328
|
+
if (props.decorative) image.decorative = true;
|
|
329
|
+
if (imageData.src) image.src = imageData.src;
|
|
330
|
+
if (imageData.mimeType) image.mimeType = imageData.mimeType;
|
|
331
|
+
if (imageData.filename) image.filename = imageData.filename;
|
|
332
|
+
if (padding) image.padding = padding;
|
|
333
|
+
if (transform) image.transform = transform;
|
|
334
|
+
if (crop) image.crop = crop;
|
|
335
|
+
if (opacity !== void 0) image.opacity = opacity;
|
|
336
|
+
if (props.hlinkRId && rels) {
|
|
337
|
+
const href = resolveTarget(rels, props.hlinkRId);
|
|
338
|
+
if (href) image.hlinkHref = href;
|
|
339
|
+
}
|
|
340
|
+
return image;
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* Parse a wp:anchor element (floating/anchored image)
|
|
344
|
+
*
|
|
345
|
+
* @param anchorEl - The wp:anchor element
|
|
346
|
+
* @param rels - Relationship map for resolving rId
|
|
347
|
+
* @param media - Media files map
|
|
348
|
+
* @returns Parsed Image object
|
|
349
|
+
*/
|
|
350
|
+
function parseAnchor(anchorEl, rels, media) {
|
|
351
|
+
const size = parseExtent(findByFullName(anchorEl, "wp:extent"));
|
|
352
|
+
const padding = parseEffectExtent(findByFullName(anchorEl, "wp:effectExtent"));
|
|
353
|
+
const props = parseDocProps(findByFullName(anchorEl, "wp:docPr"));
|
|
354
|
+
const behindDoc = getAttribute(anchorEl, null, "behindDoc") === "1";
|
|
355
|
+
const layoutInCell = parseOnOffAttr(anchorEl, "layoutInCell");
|
|
356
|
+
const allowOverlap = parseOnOffAttr(anchorEl, "allowOverlap");
|
|
357
|
+
const anchorDistT = parseNumericAttribute(anchorEl, null, "distT");
|
|
358
|
+
const anchorDistB = parseNumericAttribute(anchorEl, null, "distB");
|
|
359
|
+
const anchorDistL = parseNumericAttribute(anchorEl, null, "distL");
|
|
360
|
+
const anchorDistR = parseNumericAttribute(anchorEl, null, "distR");
|
|
361
|
+
const anchorDistances = {
|
|
362
|
+
...anchorDistT != null ? { distT: anchorDistT } : {},
|
|
363
|
+
...anchorDistB != null ? { distB: anchorDistB } : {},
|
|
364
|
+
...anchorDistL != null ? { distL: anchorDistL } : {},
|
|
365
|
+
...anchorDistR != null ? { distR: anchorDistR } : {}
|
|
366
|
+
};
|
|
367
|
+
const wrap = parseWrapElement(findAnyOf(anchorEl, WRAP_ELEMENT_NAMES), behindDoc, anchorDistances);
|
|
368
|
+
const posH = findByFullName(anchorEl, "wp:positionH");
|
|
369
|
+
const posV = findByFullName(anchorEl, "wp:positionV");
|
|
370
|
+
const horizontal = parsePositionH(posH);
|
|
371
|
+
const vertical = parsePositionV(posV);
|
|
372
|
+
let position;
|
|
373
|
+
if (horizontal || vertical) position = {
|
|
374
|
+
horizontal: horizontal ?? { relativeTo: "column" },
|
|
375
|
+
vertical: vertical ?? { relativeTo: "paragraph" }
|
|
376
|
+
};
|
|
377
|
+
const blipFill = findBlipFillElement(anchorEl);
|
|
378
|
+
const blip = blipFill ? findByFullName(blipFill, "a:blip") : null;
|
|
379
|
+
const rId = extractBlipRId(blip);
|
|
380
|
+
const crop = parseImageCrop(blipFill);
|
|
381
|
+
const opacity = parseImageOpacity(blip);
|
|
382
|
+
const imageData = resolveImageData(rId, rels, media);
|
|
383
|
+
const transform = parseTransform(findPictureTransform(anchorEl));
|
|
384
|
+
const image = {
|
|
385
|
+
type: "image",
|
|
386
|
+
rId,
|
|
387
|
+
size,
|
|
388
|
+
wrap
|
|
389
|
+
};
|
|
390
|
+
if (props.id) image.id = props.id;
|
|
391
|
+
if (props.alt) image.alt = props.alt;
|
|
392
|
+
if (props.title) image.title = props.title;
|
|
393
|
+
if (props.decorative) image.decorative = true;
|
|
394
|
+
if (imageData.src) image.src = imageData.src;
|
|
395
|
+
if (imageData.mimeType) image.mimeType = imageData.mimeType;
|
|
396
|
+
if (imageData.filename) image.filename = imageData.filename;
|
|
397
|
+
if (position) image.position = position;
|
|
398
|
+
if (padding) image.padding = padding;
|
|
399
|
+
if (transform) image.transform = transform;
|
|
400
|
+
if (crop) image.crop = crop;
|
|
401
|
+
if (opacity !== void 0) image.opacity = opacity;
|
|
402
|
+
if (layoutInCell !== void 0) image.layoutInCell = layoutInCell;
|
|
403
|
+
if (allowOverlap !== void 0) image.allowOverlap = allowOverlap;
|
|
404
|
+
if (props.hlinkRId && rels) {
|
|
405
|
+
const href = resolveTarget(rels, props.hlinkRId);
|
|
406
|
+
if (href) image.hlinkHref = href;
|
|
407
|
+
}
|
|
408
|
+
return image;
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* Parse a w:drawing element
|
|
412
|
+
*
|
|
413
|
+
* The drawing element contains either wp:inline or wp:anchor.
|
|
414
|
+
*
|
|
415
|
+
* @param drawingEl - The w:drawing element
|
|
416
|
+
* @param rels - Relationship map for resolving rId
|
|
417
|
+
* @param media - Media files map
|
|
418
|
+
* @returns Parsed Image object or null if not an image
|
|
419
|
+
*/
|
|
420
|
+
function parseDrawing(drawingEl, rels, media) {
|
|
421
|
+
if (isTextBoxDrawing(drawingEl)) return null;
|
|
422
|
+
const children = getChildElements(drawingEl);
|
|
423
|
+
for (const child of children) {
|
|
424
|
+
const name = child.name || "";
|
|
425
|
+
if (name === "wp:inline" || name === "wp:anchor") return name === "wp:inline" ? parseInline(child, rels, media) : parseAnchor(child, rels, media);
|
|
426
|
+
}
|
|
427
|
+
return null;
|
|
428
|
+
}
|
|
429
|
+
/**
|
|
430
|
+
* Parse an image from a w:drawing element
|
|
431
|
+
*
|
|
432
|
+
* This is the main entry point for image parsing.
|
|
433
|
+
*
|
|
434
|
+
* @param node - The w:drawing XML element
|
|
435
|
+
* @param rels - Relationship map for resolving rId
|
|
436
|
+
* @param media - Media files map
|
|
437
|
+
* @returns Parsed Image object or null if parsing fails
|
|
438
|
+
*/
|
|
439
|
+
function parseImage(node, rels, media) {
|
|
440
|
+
return parseDrawing(node, rels, media);
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
443
|
+
* Check if an image is inline (not floating)
|
|
444
|
+
*/
|
|
445
|
+
function isInlineImage(image) {
|
|
446
|
+
return image.wrap.type === "inline";
|
|
447
|
+
}
|
|
448
|
+
/**
|
|
449
|
+
* Check if an image is floating (anchored)
|
|
450
|
+
*/
|
|
451
|
+
function isFloatingImage(image) {
|
|
452
|
+
return image.wrap.type !== "inline";
|
|
453
|
+
}
|
|
454
|
+
/**
|
|
455
|
+
* Check if an image is behind text
|
|
456
|
+
*/
|
|
457
|
+
function isBehindText(image) {
|
|
458
|
+
return image.wrap.type === "behind";
|
|
459
|
+
}
|
|
460
|
+
/**
|
|
461
|
+
* Check if an image is in front of text
|
|
462
|
+
*/
|
|
463
|
+
function isInFrontOfText(image) {
|
|
464
|
+
return image.wrap.type === "inFront";
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
467
|
+
* Get image width in pixels
|
|
468
|
+
*/
|
|
469
|
+
function getImageWidthPx(image) {
|
|
470
|
+
return emuToPixels(image.size.width);
|
|
471
|
+
}
|
|
472
|
+
/**
|
|
473
|
+
* Get image height in pixels
|
|
474
|
+
*/
|
|
475
|
+
function getImageHeightPx(image) {
|
|
476
|
+
return emuToPixels(image.size.height);
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
* Get image dimensions in pixels
|
|
480
|
+
*/
|
|
481
|
+
function getImageDimensionsPx(image) {
|
|
482
|
+
return {
|
|
483
|
+
width: emuToPixels(image.size.width),
|
|
484
|
+
height: emuToPixels(image.size.height)
|
|
485
|
+
};
|
|
486
|
+
}
|
|
487
|
+
/**
|
|
488
|
+
* Check if image has alt text (for accessibility)
|
|
489
|
+
*/
|
|
490
|
+
function hasAltText(image) {
|
|
491
|
+
return !!image.alt && image.alt.trim().length > 0;
|
|
492
|
+
}
|
|
493
|
+
/**
|
|
494
|
+
* Check if image is decorative (should be ignored by screen readers)
|
|
495
|
+
*/
|
|
496
|
+
function isDecorativeImage(image) {
|
|
497
|
+
return image.decorative === true;
|
|
498
|
+
}
|
|
499
|
+
/**
|
|
500
|
+
* Get wrap distances in pixels
|
|
501
|
+
*/
|
|
502
|
+
function getWrapDistancesPx(image) {
|
|
503
|
+
return {
|
|
504
|
+
top: emuToPixels(image.wrap.distT),
|
|
505
|
+
bottom: emuToPixels(image.wrap.distB),
|
|
506
|
+
left: emuToPixels(image.wrap.distL),
|
|
507
|
+
right: emuToPixels(image.wrap.distR)
|
|
508
|
+
};
|
|
509
|
+
}
|
|
510
|
+
/**
|
|
511
|
+
* Check if image needs text wrapping
|
|
512
|
+
*/
|
|
513
|
+
function needsTextWrapping(image) {
|
|
514
|
+
return [
|
|
515
|
+
"square",
|
|
516
|
+
"tight",
|
|
517
|
+
"through",
|
|
518
|
+
"topAndBottom"
|
|
519
|
+
].includes(image.wrap.type);
|
|
520
|
+
}
|
|
521
|
+
//#endregion
|
|
522
|
+
export { getImageDimensionsPx, getImageHeightPx, getImageWidthPx, getWrapDistancesPx, hasAltText, isBehindText, isDecorativeImage, isFloatingImage, isInFrontOfText, isInlineImage, needsTextWrapping, parseDrawing, parseImage, resolveImageData };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { XmlElement } from "./xmlParser.js";
|
|
2
|
+
|
|
3
|
+
//#region src/docx/mathToMathml.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Convert an OMML element (`<m:oMath>` or `<m:oMathPara>`) into a MathML
|
|
6
|
+
* XML string.
|
|
7
|
+
*
|
|
8
|
+
* The returned string is the full `<math>...</math>` element including the
|
|
9
|
+
* MathML namespace, ready to set via `Element.innerHTML` or
|
|
10
|
+
* `Range.createContextualFragment`. Returns `null` if `omml` is not an
|
|
11
|
+
* OMML root element or contains no convertible children.
|
|
12
|
+
*/
|
|
13
|
+
declare function ommlToMathml(omml: XmlElement): string | null;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { ommlToMathml };
|