@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,117 @@
|
|
|
1
|
+
import { scanDirectives } from "./templateDirectives.js";
|
|
2
|
+
import { Plugin, PluginKey } from "prosemirror-state";
|
|
3
|
+
import { Decoration, DecorationSet } from "prosemirror-view";
|
|
4
|
+
//#region src/prosemirror/plugins/templatePreviewValues.ts
|
|
5
|
+
/** Concatenated plain text of a preview value. */
|
|
6
|
+
const templatePreviewValueText = (value) => typeof value === "string" ? value : value.runs.map((run) => run.text).join("");
|
|
7
|
+
/** Stable identity of a preview value (text + formatting), for decoration
|
|
8
|
+
* keys and change detection. Distinguishes a plain string from a rich
|
|
9
|
+
* value with the same text. */
|
|
10
|
+
const templatePreviewValueFingerprint = (value) => {
|
|
11
|
+
if (typeof value === "string") return value;
|
|
12
|
+
return value.runs.map((run) => `${run.bold === true ? "b" : ""}${run.italic === true ? "i" : ""}:${run.text}`).join("\0");
|
|
13
|
+
};
|
|
14
|
+
const KEY_HOLDER_SYMBOL = Symbol.for("stll.folio.templatePreviewValuesKey");
|
|
15
|
+
const keyHolder = globalThis;
|
|
16
|
+
const templatePreviewValuesKey = keyHolder[KEY_HOLDER_SYMBOL] ?? (keyHolder[KEY_HOLDER_SYMBOL] = new PluginKey("templatePreviewValues"));
|
|
17
|
+
/** A rich span as DOM: text wrapped in `<em>` / `<strong>` per its flags. */
|
|
18
|
+
function buildSpanNode(span) {
|
|
19
|
+
let node = document.createTextNode(span.text);
|
|
20
|
+
if (span.italic === true) {
|
|
21
|
+
const em = document.createElement("em");
|
|
22
|
+
em.append(node);
|
|
23
|
+
node = em;
|
|
24
|
+
}
|
|
25
|
+
if (span.bold === true) {
|
|
26
|
+
const strong = document.createElement("strong");
|
|
27
|
+
strong.append(node);
|
|
28
|
+
node = strong;
|
|
29
|
+
}
|
|
30
|
+
return node;
|
|
31
|
+
}
|
|
32
|
+
function buildValueWidget(value, mode) {
|
|
33
|
+
return () => {
|
|
34
|
+
const span = document.createElement("span");
|
|
35
|
+
span.className = mode === "highlighted" ? "folio-template-preview-value folio-template-preview-value--highlighted" : "folio-template-preview-value";
|
|
36
|
+
span.contentEditable = "false";
|
|
37
|
+
if (typeof value === "string") {
|
|
38
|
+
span.textContent = value;
|
|
39
|
+
return span;
|
|
40
|
+
}
|
|
41
|
+
for (const run of value.runs) span.append(buildSpanNode(run));
|
|
42
|
+
return span;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
function collectPreviewEntries(doc, preview) {
|
|
46
|
+
if (!preview || Object.keys(preview.values).length === 0) return [];
|
|
47
|
+
const entries = [];
|
|
48
|
+
for (const range of scanDirectives(doc)) {
|
|
49
|
+
if (range.kind !== "placeholder" && range.kind !== "clause") continue;
|
|
50
|
+
const value = preview.values[range.expr];
|
|
51
|
+
if (value === void 0 || templatePreviewValueText(value) === "") continue;
|
|
52
|
+
entries.push({
|
|
53
|
+
from: range.from,
|
|
54
|
+
to: range.to,
|
|
55
|
+
expr: range.expr,
|
|
56
|
+
value
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
return entries;
|
|
60
|
+
}
|
|
61
|
+
function buildDecorationSet(doc, entries, mode) {
|
|
62
|
+
if (entries.length === 0) return DecorationSet.empty;
|
|
63
|
+
const decorations = [];
|
|
64
|
+
for (const entry of entries) decorations.push(Decoration.inline(entry.from, entry.to, { class: "folio-template-preview-original" }, {
|
|
65
|
+
inclusiveStart: false,
|
|
66
|
+
inclusiveEnd: false
|
|
67
|
+
}), Decoration.widget(entry.from, buildValueWidget(entry.value, mode), {
|
|
68
|
+
side: 1,
|
|
69
|
+
marks: [],
|
|
70
|
+
ignoreSelection: true,
|
|
71
|
+
key: `folio-template-preview-${entry.expr}-${entry.from}-${mode}-${templatePreviewValueFingerprint(entry.value)}`
|
|
72
|
+
}));
|
|
73
|
+
return DecorationSet.create(doc, decorations);
|
|
74
|
+
}
|
|
75
|
+
function createTemplatePreviewValuesPlugin() {
|
|
76
|
+
return new Plugin({
|
|
77
|
+
key: templatePreviewValuesKey,
|
|
78
|
+
state: {
|
|
79
|
+
init() {
|
|
80
|
+
return {
|
|
81
|
+
preview: null,
|
|
82
|
+
entries: [],
|
|
83
|
+
decorationSet: DecorationSet.empty
|
|
84
|
+
};
|
|
85
|
+
},
|
|
86
|
+
apply(tr, prev, _oldState, newState) {
|
|
87
|
+
const meta = tr.getMeta(templatePreviewValuesKey);
|
|
88
|
+
if (meta !== void 0) {
|
|
89
|
+
const entries = collectPreviewEntries(newState.doc, meta.preview);
|
|
90
|
+
return {
|
|
91
|
+
preview: meta.preview,
|
|
92
|
+
entries,
|
|
93
|
+
decorationSet: buildDecorationSet(newState.doc, entries, meta.preview?.mode ?? "plain")
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
if (tr.docChanged && prev.preview) {
|
|
97
|
+
const entries = collectPreviewEntries(newState.doc, prev.preview);
|
|
98
|
+
return {
|
|
99
|
+
preview: prev.preview,
|
|
100
|
+
entries,
|
|
101
|
+
decorationSet: buildDecorationSet(newState.doc, entries, prev.preview.mode)
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
return prev;
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
props: { decorations(state) {
|
|
108
|
+
return templatePreviewValuesKey.getState(state)?.decorationSet;
|
|
109
|
+
} }
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
/** Push (or clear, with `null`) the live fill preview into the editor. */
|
|
113
|
+
const setTemplatePreviewValues = (view, preview) => {
|
|
114
|
+
view.dispatch(view.state.tr.setMeta(templatePreviewValuesKey, { preview }));
|
|
115
|
+
};
|
|
116
|
+
//#endregion
|
|
117
|
+
export { createTemplatePreviewValuesPlugin, setTemplatePreviewValues, templatePreviewValueFingerprint, templatePreviewValueText, templatePreviewValuesKey };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { EditorState, Plugin, PluginKey, Transaction } from "prosemirror-state";
|
|
2
|
+
|
|
3
|
+
//#region src/prosemirror/plugins/templateSlashMenu.d.ts
|
|
4
|
+
type TemplateSlashMenuState = {
|
|
5
|
+
active: false;
|
|
6
|
+
from: null;
|
|
7
|
+
to: null;
|
|
8
|
+
query: "";
|
|
9
|
+
} | {
|
|
10
|
+
active: true;
|
|
11
|
+
from: number;
|
|
12
|
+
to: number;
|
|
13
|
+
query: string;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Keyboard intents the plugin forwards to the host while the menu is open. The
|
|
17
|
+
* host owns the highlighted row and the menu list, so it decides whether each
|
|
18
|
+
* key is consumed; returning `true` lets the plugin `preventDefault` the event.
|
|
19
|
+
*/
|
|
20
|
+
type TemplateSlashMenuKeyAction = "up" | "down" | "forward" | "back" | "commit" | "dismiss";
|
|
21
|
+
type TemplateSlashMenuPluginOptions = {
|
|
22
|
+
/** Fires whenever the trigger state changes (open, query edit, close). */onChange?: (state: TemplateSlashMenuState) => void;
|
|
23
|
+
/**
|
|
24
|
+
* Resolve a navigation/commit key while the menu is open. Returns `true` when
|
|
25
|
+
* the host consumed it (so the plugin swallows the event).
|
|
26
|
+
* - `up`/`down` move the highlighted row.
|
|
27
|
+
* - `forward` ArrowRight: enter a submenu row.
|
|
28
|
+
* - `back` ArrowLeft: step out of a submenu.
|
|
29
|
+
* - `commit` Enter: the host inserts the marker, then dispatches a
|
|
30
|
+
* clearing transaction; the plugin does not mutate the doc.
|
|
31
|
+
* - `dismiss` Escape: the host backs out of a submenu and returns `true`
|
|
32
|
+
* to keep the menu open, or returns `false` to let the
|
|
33
|
+
* plugin tear the trigger down.
|
|
34
|
+
*/
|
|
35
|
+
onKeyAction?: (action: TemplateSlashMenuKeyAction) => boolean;
|
|
36
|
+
};
|
|
37
|
+
declare const templateSlashMenuKey: PluginKey<TemplateSlashMenuState>;
|
|
38
|
+
declare const templateSlashMenuPlugin: (options?: TemplateSlashMenuPluginOptions) => Plugin<TemplateSlashMenuState>;
|
|
39
|
+
declare const getTemplateSlashMenu: (state: EditorState) => TemplateSlashMenuState;
|
|
40
|
+
/** Clear the trigger. Set on the host's marker-insert transaction so the
|
|
41
|
+
* insertion and the teardown commit together. */
|
|
42
|
+
declare const clearTemplateSlashMenu: (tr: Transaction) => Transaction;
|
|
43
|
+
/** Delete just the query chars typed after `/`, keeping the `/` and the trigger
|
|
44
|
+
* active so a submenu can start its own search from a blank query. No-op (and
|
|
45
|
+
* returns the unmodified state) when no trigger is active or the query is
|
|
46
|
+
* already empty. */
|
|
47
|
+
declare const resetTemplateSlashQuery: (state: EditorState) => Transaction | null;
|
|
48
|
+
/** Delete the `/query` the author typed, returning the PM range it occupied so
|
|
49
|
+
* the host can insert a marker in its place. Returns null when no trigger is
|
|
50
|
+
* active. The returned transaction also clears the trigger state. */
|
|
51
|
+
declare const consumeTemplateSlashQuery: (state: EditorState) => {
|
|
52
|
+
tr: Transaction;
|
|
53
|
+
from: number;
|
|
54
|
+
to: number;
|
|
55
|
+
} | null;
|
|
56
|
+
//#endregion
|
|
57
|
+
export { TemplateSlashMenuKeyAction, TemplateSlashMenuPluginOptions, TemplateSlashMenuState, clearTemplateSlashMenu, consumeTemplateSlashQuery, getTemplateSlashMenu, resetTemplateSlashQuery, templateSlashMenuKey, templateSlashMenuPlugin };
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { getTemplateDirectives } from "./templateDirectives.js";
|
|
2
|
+
import { Plugin, PluginKey } from "prosemirror-state";
|
|
3
|
+
//#region src/prosemirror/plugins/templateSlashMenu.ts
|
|
4
|
+
const IDLE = {
|
|
5
|
+
active: false,
|
|
6
|
+
from: null,
|
|
7
|
+
to: null,
|
|
8
|
+
query: ""
|
|
9
|
+
};
|
|
10
|
+
const QUERY_CHAR = /[\p{L}\p{N}_.-]/u;
|
|
11
|
+
const KEY_HOLDER_SYMBOL = Symbol.for("stll.folio.templateSlashMenuKey");
|
|
12
|
+
const keyHolder = globalThis;
|
|
13
|
+
const templateSlashMenuKey = keyHolder[KEY_HOLDER_SYMBOL] ?? (keyHolder[KEY_HOLDER_SYMBOL] = new PluginKey("templateSlashMenu"));
|
|
14
|
+
/** Whether the char immediately before `pos` is a marker boundary (start of the
|
|
15
|
+
* text block or whitespace). This is the misfire guard: a `/` mid-token (dates,
|
|
16
|
+
* URLs, and/or) has a word char before it and never opens the menu. */
|
|
17
|
+
const atTriggerBoundary = (state, pos) => {
|
|
18
|
+
const $pos = state.doc.resolve(pos);
|
|
19
|
+
const offset = $pos.parentOffset;
|
|
20
|
+
if (offset === 0) return true;
|
|
21
|
+
const before = $pos.parent.textBetween(offset - 1, offset, "\n", "\n");
|
|
22
|
+
return before === "" || /\s/u.test(before);
|
|
23
|
+
};
|
|
24
|
+
/** Whether `pos` falls strictly inside an existing template directive. The
|
|
25
|
+
* slash activations insert markers as raw text rather than going through
|
|
26
|
+
* `insertInline`'s overlap guard, so opening here would nest markers — e.g. a
|
|
27
|
+
* `/` typed after `#if ` inside `{{#if condition}}` could produce
|
|
28
|
+
* `{{#if {{field}}}}`, which the scanner/fill grammar cannot interpret.
|
|
29
|
+
* Boundaries are exclusive: a caret right before `{{` or after `}}` is fine. */
|
|
30
|
+
const insideDirective = (state, pos) => getTemplateDirectives(state).some((range) => pos > range.from && pos < range.to);
|
|
31
|
+
/** Whether the `/` that opened the trigger is still present at `from`. */
|
|
32
|
+
const slashStillAt = (state, from) => {
|
|
33
|
+
if (from < 0 || from > state.doc.content.size) return false;
|
|
34
|
+
const $from = state.doc.resolve(from);
|
|
35
|
+
if ($from.parentOffset >= $from.parent.content.size) return false;
|
|
36
|
+
return $from.parent.textBetween($from.parentOffset, $from.parentOffset + 1, "\n", "\n") === "/";
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* The query the author has typed, read from the tracked trigger RANGE
|
|
40
|
+
* `[from, to]` rather than the caret. `to` is carried through every transaction
|
|
41
|
+
* by position mapping (it grows as the author types at the query end), so the
|
|
42
|
+
* query is immune to the paged editor's relayout selection churn — the caret can
|
|
43
|
+
* momentarily land anywhere without affecting it. Because the range only ever
|
|
44
|
+
* grows with typed input, it never swallows prose that already followed the `/`.
|
|
45
|
+
*
|
|
46
|
+
* Returns the query string, or `null` when the span contains a terminator (a
|
|
47
|
+
* typed space or punctuation) — the command is over.
|
|
48
|
+
*/
|
|
49
|
+
const readRangeQuery = (state, from, to) => {
|
|
50
|
+
const start = from + 1;
|
|
51
|
+
if (to <= start) return "";
|
|
52
|
+
const text = state.doc.textBetween(start, to, "\n", "\n");
|
|
53
|
+
for (const char of text) if (!QUERY_CHAR.test(char)) return null;
|
|
54
|
+
return text;
|
|
55
|
+
};
|
|
56
|
+
const sameState = (a, b) => a.active === b.active && a.from === b.from && a.query === b.query;
|
|
57
|
+
/**
|
|
58
|
+
* Open the trigger at the collapsed caret if the guards pass: insert the `/`
|
|
59
|
+
* and dispatch the open meta in one transaction (so the slash and the anchor
|
|
60
|
+
* share one undo step), and return `true`. Shared by the keydown opener (the
|
|
61
|
+
* path that fires in folio's paged hidden-view input pipeline) and the
|
|
62
|
+
* `handleTextInput` opener (plain ProseMirror views / playground). Both guard
|
|
63
|
+
* on the menu not already being active, so they never double-open or double
|
|
64
|
+
* insert the `/`.
|
|
65
|
+
*/
|
|
66
|
+
const tryOpenTrigger = (view) => {
|
|
67
|
+
if (getTemplateSlashMenu(view.state).active) return false;
|
|
68
|
+
const { from } = view.state.selection;
|
|
69
|
+
if (!view.state.selection.empty || !atTriggerBoundary(view.state, from) || insideDirective(view.state, from)) return false;
|
|
70
|
+
const tr = view.state.tr.insertText("/", from);
|
|
71
|
+
tr.setMeta(templateSlashMenuKey, {
|
|
72
|
+
type: "open",
|
|
73
|
+
from,
|
|
74
|
+
query: ""
|
|
75
|
+
});
|
|
76
|
+
view.dispatch(tr);
|
|
77
|
+
return true;
|
|
78
|
+
};
|
|
79
|
+
const templateSlashMenuPlugin = (options = {}) => {
|
|
80
|
+
return new Plugin({
|
|
81
|
+
key: templateSlashMenuKey,
|
|
82
|
+
state: {
|
|
83
|
+
init: () => IDLE,
|
|
84
|
+
apply: (tr, value, _oldState, newState) => {
|
|
85
|
+
const meta = tr.getMeta(templateSlashMenuKey);
|
|
86
|
+
if (meta?.type === "clear") return IDLE;
|
|
87
|
+
if (meta?.type === "open") return {
|
|
88
|
+
active: true,
|
|
89
|
+
from: meta.from,
|
|
90
|
+
to: meta.from + 1,
|
|
91
|
+
query: meta.query
|
|
92
|
+
};
|
|
93
|
+
if (!value.active) return value;
|
|
94
|
+
const from = tr.mapping.map(value.from, -1);
|
|
95
|
+
const to = tr.mapping.map(value.to, 1);
|
|
96
|
+
if (!slashStillAt(newState, from)) return IDLE;
|
|
97
|
+
if (tr.selectionSet) {
|
|
98
|
+
const { selection } = newState;
|
|
99
|
+
if (!selection.empty || selection.from < from || selection.from > to) return IDLE;
|
|
100
|
+
}
|
|
101
|
+
const query = readRangeQuery(newState, from, to);
|
|
102
|
+
if (query === null) return IDLE;
|
|
103
|
+
return {
|
|
104
|
+
active: true,
|
|
105
|
+
from,
|
|
106
|
+
to,
|
|
107
|
+
query
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
view: () => ({ update: (editorView, prevState) => {
|
|
112
|
+
const prev = templateSlashMenuKey.getState(prevState) ?? IDLE;
|
|
113
|
+
const curr = templateSlashMenuKey.getState(editorView.state) ?? IDLE;
|
|
114
|
+
if (!sameState(prev, curr)) options.onChange?.(curr);
|
|
115
|
+
} }),
|
|
116
|
+
props: {
|
|
117
|
+
handleTextInput: (view, _from, _to, text) => {
|
|
118
|
+
if (text !== "/") return false;
|
|
119
|
+
return tryOpenTrigger(view);
|
|
120
|
+
},
|
|
121
|
+
handleKeyDown: (view, event) => {
|
|
122
|
+
const current = templateSlashMenuKey.getState(view.state) ?? IDLE;
|
|
123
|
+
if (!current.active && event.key === "/" && !event.metaKey && !event.ctrlKey && !event.altKey) {
|
|
124
|
+
if (tryOpenTrigger(view)) {
|
|
125
|
+
event.preventDefault();
|
|
126
|
+
return true;
|
|
127
|
+
}
|
|
128
|
+
return false;
|
|
129
|
+
}
|
|
130
|
+
if (!current.active) return false;
|
|
131
|
+
if (event.metaKey || event.ctrlKey || event.altKey || event.shiftKey) return false;
|
|
132
|
+
const action = keyToAction(event.key);
|
|
133
|
+
if (action === null) return false;
|
|
134
|
+
const handledByHost = options.onKeyAction?.(action) ?? false;
|
|
135
|
+
if (action === "dismiss" && !handledByHost) view.dispatch(clearTemplateSlashMenu(view.state.tr));
|
|
136
|
+
event.preventDefault();
|
|
137
|
+
return true;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
};
|
|
142
|
+
const keyToAction = (key) => {
|
|
143
|
+
if (key === "ArrowUp") return "up";
|
|
144
|
+
if (key === "ArrowDown") return "down";
|
|
145
|
+
if (key === "ArrowRight") return "forward";
|
|
146
|
+
if (key === "ArrowLeft") return "back";
|
|
147
|
+
if (key === "Enter") return "commit";
|
|
148
|
+
if (key === "Escape") return "dismiss";
|
|
149
|
+
return null;
|
|
150
|
+
};
|
|
151
|
+
const getTemplateSlashMenu = (state) => templateSlashMenuKey.getState(state) ?? IDLE;
|
|
152
|
+
/** Clear the trigger. Set on the host's marker-insert transaction so the
|
|
153
|
+
* insertion and the teardown commit together. */
|
|
154
|
+
const clearTemplateSlashMenu = (tr) => tr.setMeta(templateSlashMenuKey, { type: "clear" });
|
|
155
|
+
/** Delete just the query chars typed after `/`, keeping the `/` and the trigger
|
|
156
|
+
* active so a submenu can start its own search from a blank query. No-op (and
|
|
157
|
+
* returns the unmodified state) when no trigger is active or the query is
|
|
158
|
+
* already empty. */
|
|
159
|
+
const resetTemplateSlashQuery = (state) => {
|
|
160
|
+
const current = getTemplateSlashMenu(state);
|
|
161
|
+
if (!current.active) return null;
|
|
162
|
+
const queryStart = current.from + 1;
|
|
163
|
+
const queryEnd = current.to;
|
|
164
|
+
if (queryEnd <= queryStart) return null;
|
|
165
|
+
return state.tr.delete(queryStart, queryEnd);
|
|
166
|
+
};
|
|
167
|
+
/** Delete the `/query` the author typed, returning the PM range it occupied so
|
|
168
|
+
* the host can insert a marker in its place. Returns null when no trigger is
|
|
169
|
+
* active. The returned transaction also clears the trigger state. */
|
|
170
|
+
const consumeTemplateSlashQuery = (state) => {
|
|
171
|
+
const current = getTemplateSlashMenu(state);
|
|
172
|
+
if (!current.active) return null;
|
|
173
|
+
const from = current.from;
|
|
174
|
+
const to = current.to;
|
|
175
|
+
const tr = state.tr.delete(from, to);
|
|
176
|
+
clearTemplateSlashMenu(tr);
|
|
177
|
+
return {
|
|
178
|
+
tr,
|
|
179
|
+
from,
|
|
180
|
+
to
|
|
181
|
+
};
|
|
182
|
+
};
|
|
183
|
+
//#endregion
|
|
184
|
+
export { clearTemplateSlashMenu, consumeTemplateSlashQuery, getTemplateSlashMenu, resetTemplateSlashQuery, templateSlashMenuKey, templateSlashMenuPlugin };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ExtensionManager } from "../extensions/ExtensionManager.js";
|
|
2
|
+
import { BlockSdtAttrs, FieldAttrs, HardBreakAttrs, ImageAttrs, ImagePositionAttrs, MathAttrs, ParagraphAttrs, SdtAttrs, ShapeAttrs, TableAttrs, TableCellAttrs, TableRowAttrs, TextBoxAttrs } from "./nodes.js";
|
|
3
|
+
import { CharacterSpacingAttrs, CharacterStyleAttrs, CommentAttrs, EmphasisMarkAttrs, FontFamilyAttrs, FontSizeAttrs, FootnoteRefAttrs, HighlightAttrs, HyperlinkAttrs, RunFormattingOverrideAttrs, RunShadingAttrs, StrikeAttrs, TextColorAttrs, TextEffectAttrs, TrackedChangeMarkAttrs, UnderlineAttrs } from "./marks.js";
|
|
4
|
+
|
|
5
|
+
//#region src/prosemirror/schema/index.d.ts
|
|
6
|
+
declare const singletonManager: ExtensionManager;
|
|
7
|
+
declare const schema: import("prosemirror-model").Schema<any, any>;
|
|
8
|
+
/**
|
|
9
|
+
* Export types for convenience
|
|
10
|
+
*/
|
|
11
|
+
type DocxSchema = typeof schema;
|
|
12
|
+
type DocxNode = ReturnType<typeof schema.node>;
|
|
13
|
+
type DocxMark = ReturnType<typeof schema.mark>;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { type BlockSdtAttrs, type CharacterSpacingAttrs, type CharacterStyleAttrs, type CommentAttrs, DocxMark, DocxNode, DocxSchema, type EmphasisMarkAttrs, type FieldAttrs, type FontFamilyAttrs, type FontSizeAttrs, type FootnoteRefAttrs, type HardBreakAttrs, type HighlightAttrs, type HyperlinkAttrs, type ImageAttrs, type ImagePositionAttrs, type MathAttrs, type ParagraphAttrs, type RunFormattingOverrideAttrs, type RunShadingAttrs, type SdtAttrs, type ShapeAttrs, type StrikeAttrs, type TableAttrs, type TableCellAttrs, type TableRowAttrs, type TextBoxAttrs, type TextColorAttrs, type TextEffectAttrs, type TrackedChangeMarkAttrs, type UnderlineAttrs, schema, singletonManager };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ExtensionManager } from "../extensions/ExtensionManager.js";
|
|
2
|
+
import { createStarterKit } from "../extensions/StarterKit.js";
|
|
3
|
+
//#region src/prosemirror/schema/index.ts
|
|
4
|
+
/**
|
|
5
|
+
* ProseMirror Schema for DOCX Editor
|
|
6
|
+
*
|
|
7
|
+
* Singleton ExtensionManager that builds the schema and initializes runtime.
|
|
8
|
+
* Legacy code imports `schema` and commands from here; new code should use
|
|
9
|
+
* ExtensionManager directly.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Singleton ExtensionManager — builds schema + initializes runtime (plugins, commands, keymaps)
|
|
13
|
+
*/
|
|
14
|
+
const mgr = new ExtensionManager(createStarterKit());
|
|
15
|
+
mgr.buildSchema();
|
|
16
|
+
mgr.initializeRuntime();
|
|
17
|
+
const singletonManager = mgr;
|
|
18
|
+
const schema = mgr.getSchema();
|
|
19
|
+
//#endregion
|
|
20
|
+
export { schema, singletonManager };
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { document_d_exports } from "../../types/document.js";
|
|
2
|
+
import { ShadingProperties } from "../../types/colors.js";
|
|
3
|
+
|
|
4
|
+
//#region src/prosemirror/schema/marks.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Text color mark attributes
|
|
7
|
+
*/
|
|
8
|
+
type TextColorAttrs = {
|
|
9
|
+
rgb?: string;
|
|
10
|
+
themeColor?: document_d_exports.ThemeColorSlot;
|
|
11
|
+
themeTint?: string;
|
|
12
|
+
themeShade?: string;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Underline mark attributes
|
|
16
|
+
*/
|
|
17
|
+
type UnderlineAttrs = {
|
|
18
|
+
style?: document_d_exports.UnderlineStyle;
|
|
19
|
+
color?: TextColorAttrs;
|
|
20
|
+
};
|
|
21
|
+
type StrikeAttrs = {
|
|
22
|
+
double?: boolean;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Font size mark attributes
|
|
26
|
+
*/
|
|
27
|
+
type FontSizeAttrs = {
|
|
28
|
+
size: number;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Font family mark attributes
|
|
32
|
+
*/
|
|
33
|
+
type FontFamilyAttrs = {
|
|
34
|
+
ascii?: string;
|
|
35
|
+
hAnsi?: string;
|
|
36
|
+
eastAsia?: string;
|
|
37
|
+
cs?: string;
|
|
38
|
+
asciiTheme?: string;
|
|
39
|
+
hAnsiTheme?: string;
|
|
40
|
+
eastAsiaTheme?: string;
|
|
41
|
+
csTheme?: string;
|
|
42
|
+
};
|
|
43
|
+
type HighlightAttrs = {
|
|
44
|
+
color: NonNullable<document_d_exports.TextFormatting["highlight"]>;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Run-level shading mark attributes (w:shd). Carries the shading FILL as a
|
|
48
|
+
* flattened ColorValue (mirroring TextColorAttrs) plus the pattern. The default
|
|
49
|
+
* `clear` pattern is never stored (absence ⇒ the fill renders as a solid
|
|
50
|
+
* background and re-serializes to `w:val="clear"`); only non-clear patterns
|
|
51
|
+
* (`pct*`, stripes) are carried for export fidelity (`solid` is flattened into
|
|
52
|
+
* the fill). `patternColor` is the pattern foreground rgb (`w:shd w:color`),
|
|
53
|
+
* carried so a non-clear pattern's color survives export.
|
|
54
|
+
*/
|
|
55
|
+
type RunShadingAttrs = TextColorAttrs & {
|
|
56
|
+
pattern?: NonNullable<ShadingProperties["pattern"]>;
|
|
57
|
+
patternColor?: string;
|
|
58
|
+
};
|
|
59
|
+
type CharacterSpacingAttrs = {
|
|
60
|
+
spacing?: number;
|
|
61
|
+
position?: number;
|
|
62
|
+
scale?: number;
|
|
63
|
+
kerning?: number;
|
|
64
|
+
};
|
|
65
|
+
type EmphasisMarkAttrs = {
|
|
66
|
+
type?: Exclude<document_d_exports.EmphasisMark, "none">;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Text effect mark attributes (w:effect). The "none" sentinel is never marked;
|
|
70
|
+
* absence of the mark is the no-effect state.
|
|
71
|
+
*/
|
|
72
|
+
type TextEffectAttrs = {
|
|
73
|
+
effect: Exclude<document_d_exports.TextEffect, "none">;
|
|
74
|
+
};
|
|
75
|
+
type FootnoteRefAttrs = {
|
|
76
|
+
id: string | number;
|
|
77
|
+
noteType?: "footnote" | "endnote";
|
|
78
|
+
vertAlign?: "baseline" | "superscript";
|
|
79
|
+
};
|
|
80
|
+
type CommentAttrs = {
|
|
81
|
+
commentId: number;
|
|
82
|
+
};
|
|
83
|
+
type TrackedChangeMarkAttrs = {
|
|
84
|
+
revisionId: number;
|
|
85
|
+
author: string;
|
|
86
|
+
date?: string;
|
|
87
|
+
moveKind?: "moveTo" | "moveFrom";
|
|
88
|
+
};
|
|
89
|
+
type RunFormattingOverrideAttrs = { [K in keyof Pick<document_d_exports.TextFormatting, "bold" | "italic" | "strike" | "doubleStrike" | "allCaps" | "smallCaps" | "hidden" | "emboss" | "imprint" | "shadow" | "outline" | "rtl">]?: false } & {
|
|
90
|
+
underline?: "none";
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* Character style mark attributes (w:rStyle).
|
|
94
|
+
*
|
|
95
|
+
* `styleId` is the OOXML character style reference, carried so a styled run
|
|
96
|
+
* re-serializes as a style reference instead of losing the semantic link.
|
|
97
|
+
* `_styleRPr` is the style's own run properties snapshotted at load in mark
|
|
98
|
+
* normal form (the shape `marksToTextFormatting` produces); `fromProseDoc`
|
|
99
|
+
* subtracts values equal to this snapshot so style-provided formatting is not
|
|
100
|
+
* baked into the run as direct formatting on save. It is absent when the
|
|
101
|
+
* style was unknown at load — nothing was resolved, so nothing is subtracted
|
|
102
|
+
* and the reference round-trips verbatim.
|
|
103
|
+
*/
|
|
104
|
+
type CharacterStyleAttrs = {
|
|
105
|
+
styleId: string;
|
|
106
|
+
_styleRPr?: document_d_exports.TextFormatting;
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* Hyperlink mark attributes
|
|
110
|
+
*/
|
|
111
|
+
type HyperlinkAttrs = {
|
|
112
|
+
href: string;
|
|
113
|
+
tooltip?: string;
|
|
114
|
+
rId?: string;
|
|
115
|
+
_docxHyperlinkIndex?: number;
|
|
116
|
+
};
|
|
117
|
+
//#endregion
|
|
118
|
+
export { CharacterSpacingAttrs, CharacterStyleAttrs, CommentAttrs, EmphasisMarkAttrs, FontFamilyAttrs, FontSizeAttrs, FootnoteRefAttrs, HighlightAttrs, HyperlinkAttrs, RunFormattingOverrideAttrs, RunShadingAttrs, StrikeAttrs, TextColorAttrs, TextEffectAttrs, TrackedChangeMarkAttrs, UnderlineAttrs };
|
|
File without changes
|