@notectl/core 2.0.0 → 2.0.2
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/README.md +12 -10
- package/dist/chunks/{AttrRegistry-B2AGfTE0.mjs → AttrRegistry-iNpjvcSG.mjs} +2 -2
- package/dist/chunks/{AttrRegistry-B2AGfTE0.mjs.map → AttrRegistry-iNpjvcSG.mjs.map} +1 -1
- package/dist/chunks/AttributedMarkCommands-BY1BSYWM.mjs +2 -0
- package/dist/chunks/AttributedMarkCommands-BY1BSYWM.mjs.map +1 -0
- package/dist/chunks/BlockInsertion-BJFhE0jA.mjs +2 -0
- package/dist/chunks/BlockInsertion-BJFhE0jA.mjs.map +1 -0
- package/dist/chunks/{ColorPickerPopup-DRzFvt7o.mjs → ColorPickerPopup-D6XjShhv.mjs} +2 -2
- package/dist/chunks/ColorPickerPopup-D6XjShhv.mjs.map +1 -0
- package/dist/chunks/CommandHelpers-M6mPS6Ww.mjs +2 -0
- package/dist/chunks/CommandHelpers-M6mPS6Ww.mjs.map +1 -0
- package/dist/chunks/Commands-D_gMCnVa.mjs +2 -0
- package/dist/chunks/Commands-D_gMCnVa.mjs.map +1 -0
- package/dist/chunks/Document-3pNX7ear.mjs +2 -0
- package/dist/chunks/Document-3pNX7ear.mjs.map +1 -0
- package/dist/chunks/DocumentParser-LvzDQOd1.mjs +2 -0
- package/dist/chunks/DocumentParser-LvzDQOd1.mjs.map +1 -0
- package/dist/chunks/DomUtils-CznMAZZg.mjs +2 -0
- package/dist/chunks/DomUtils-CznMAZZg.mjs.map +1 -0
- package/dist/chunks/HTMLUtils-Cxy99Ak2.mjs +2 -0
- package/dist/chunks/HTMLUtils-Cxy99Ak2.mjs.map +1 -0
- package/dist/chunks/HeadingPlugin-BmkeUXj8.mjs +2 -0
- package/dist/chunks/HeadingPlugin-BmkeUXj8.mjs.map +1 -0
- package/dist/chunks/MarkCommands-CeCa4WSC.mjs +2 -0
- package/dist/chunks/MarkCommands-CeCa4WSC.mjs.map +1 -0
- package/dist/chunks/NavigationQueries-11qe4j9x.mjs +2 -0
- package/dist/chunks/NavigationQueries-11qe4j9x.mjs.map +1 -0
- package/dist/chunks/NodeResolver-z0ReCR34.mjs +2 -0
- package/dist/chunks/NodeResolver-z0ReCR34.mjs.map +1 -0
- package/dist/chunks/NodeSelectionCommands-CXrOcPtG.mjs +2 -0
- package/dist/chunks/NodeSelectionCommands-CXrOcPtG.mjs.map +1 -0
- package/dist/chunks/NotectlEditor-BJD7-FFx.mjs +4 -0
- package/dist/chunks/NotectlEditor-BJD7-FFx.mjs.map +1 -0
- package/dist/chunks/PluginHelpers-CdPR0MuT.mjs +2 -0
- package/dist/chunks/PluginHelpers-CdPR0MuT.mjs.map +1 -0
- package/dist/chunks/PopupManager-0b_Q0m7K.mjs +2 -0
- package/dist/chunks/PopupManager-0b_Q0m7K.mjs.map +1 -0
- package/dist/chunks/PrintTypes-DukwDSWS.mjs +2 -0
- package/dist/chunks/{PrintTypes-ehbL7ipA.mjs.map → PrintTypes-DukwDSWS.mjs.map} +1 -1
- package/dist/chunks/{RangeIterator-CNI6smOg.mjs → RangeIterator-XFN5FaYf.mjs} +2 -2
- package/dist/chunks/{RangeIterator-CNI6smOg.mjs.map → RangeIterator-XFN5FaYf.mjs.map} +1 -1
- package/dist/chunks/{Selection-6-W6Flxc.mjs → Selection-DhbizDM4.mjs} +2 -2
- package/dist/chunks/{Selection-6-W6Flxc.mjs.map → Selection-DhbizDM4.mjs.map} +1 -1
- package/dist/chunks/SelectionTransactions-DzIZxcuN.mjs +2 -0
- package/dist/chunks/{SelectionTransactions-q71GEzgE.mjs.map → SelectionTransactions-DzIZxcuN.mjs.map} +1 -1
- package/dist/chunks/{TextDirectionLocale-DB_aqrMg.mjs → TextDirectionLocale-CKz0ZrH_.mjs} +2 -2
- package/dist/chunks/{TextDirectionLocale-DB_aqrMg.mjs.map → TextDirectionLocale-CKz0ZrH_.mjs.map} +1 -1
- package/dist/chunks/XmlPatterns-DxQXGjP8.mjs +2 -0
- package/dist/chunks/XmlPatterns-DxQXGjP8.mjs.map +1 -0
- package/dist/chunks/ar-b6VdnxAs.mjs +2 -0
- package/dist/chunks/ar-b6VdnxAs.mjs.map +1 -0
- package/dist/chunks/de-fXvs5vQT.mjs +2 -0
- package/dist/chunks/de-fXvs5vQT.mjs.map +1 -0
- package/dist/chunks/es-BTqy_aQ4.mjs +2 -0
- package/dist/chunks/es-BTqy_aQ4.mjs.map +1 -0
- package/dist/chunks/fr-VdiCNF4J.mjs +2 -0
- package/dist/chunks/fr-VdiCNF4J.mjs.map +1 -0
- package/dist/chunks/hi-BdtVhAzs.mjs +2 -0
- package/dist/chunks/hi-BdtVhAzs.mjs.map +1 -0
- package/dist/chunks/index-C-L4awHz.mjs +2 -0
- package/dist/chunks/index-C-L4awHz.mjs.map +1 -0
- package/dist/chunks/index-Cs9iqxhF.mjs +2 -0
- package/dist/chunks/index-Cs9iqxhF.mjs.map +1 -0
- package/dist/chunks/pt-K0BUlM9X.mjs +2 -0
- package/dist/chunks/pt-K0BUlM9X.mjs.map +1 -0
- package/dist/chunks/ru-Tzd5N37W.mjs +2 -0
- package/dist/chunks/ru-Tzd5N37W.mjs.map +1 -0
- package/dist/chunks/zh-Di3WqY4_.mjs +2 -0
- package/dist/chunks/zh-Di3WqY4_.mjs.map +1 -0
- package/dist/{input → commands}/BlockInsertion.d.ts +14 -1
- package/dist/commands/BlockInsertion.d.ts.map +1 -0
- package/dist/commands/CommandHelpers.d.ts +17 -2
- package/dist/commands/CommandHelpers.d.ts.map +1 -1
- package/dist/commands/Commands.d.ts.map +1 -1
- package/dist/commands/GapCursorCommands.d.ts.map +1 -1
- package/dist/commands/NodeSelectionCommands.d.ts +3 -8
- package/dist/commands/NodeSelectionCommands.d.ts.map +1 -1
- package/dist/commands/PasteCommand.d.ts.map +1 -1
- package/dist/editor/ContentSerializer.d.ts.map +1 -1
- package/dist/editor/EditorConfig.d.ts +50 -0
- package/dist/editor/EditorConfig.d.ts.map +1 -0
- package/dist/editor/EditorConfigController.d.ts +1 -1
- package/dist/editor/EditorConfigController.d.ts.map +1 -1
- package/dist/editor/EditorDOM.d.ts.map +1 -1
- package/dist/editor/EditorInitializer.d.ts +37 -0
- package/dist/editor/EditorInitializer.d.ts.map +1 -0
- package/dist/editor/EditorLifecycleCoordinator.d.ts +6 -1
- package/dist/editor/EditorLifecycleCoordinator.d.ts.map +1 -1
- package/dist/editor/EditorThemeController.d.ts.map +1 -1
- package/dist/editor/NotectlEditor.d.ts +13 -51
- package/dist/editor/NotectlEditor.d.ts.map +1 -1
- package/dist/editor/PluginBootstrapper.d.ts +1 -1
- package/dist/editor/PluginBootstrapper.d.ts.map +1 -1
- package/dist/editor/styles/code-block.d.ts +1 -1
- package/dist/editor/styles/code-block.d.ts.map +1 -1
- package/dist/editor/theme/ThemeEngine.d.ts.map +1 -1
- package/dist/editor/theme/ThemeTokens.d.ts +17 -1
- package/dist/editor/theme/ThemeTokens.d.ts.map +1 -1
- package/dist/full.d.ts +1 -0
- package/dist/full.d.ts.map +1 -1
- package/dist/full.mjs +1 -1
- package/dist/html.mjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/input/ClipboardHandler.d.ts +5 -0
- package/dist/input/ClipboardHandler.d.ts.map +1 -1
- package/dist/input/HTMLParser.d.ts +9 -5
- package/dist/input/HTMLParser.d.ts.map +1 -1
- package/dist/input/InputHandler.d.ts +1 -0
- package/dist/input/InputHandler.d.ts.map +1 -1
- package/dist/input/InputManager.d.ts +2 -0
- package/dist/input/InputManager.d.ts.map +1 -1
- package/dist/input/InternalClipboard.d.ts +2 -22
- package/dist/input/InternalClipboard.d.ts.map +1 -1
- package/dist/input/PasteHTMLHandler.d.ts +25 -0
- package/dist/input/PasteHTMLHandler.d.ts.map +1 -0
- package/dist/input/PasteHandler.d.ts +7 -25
- package/dist/input/PasteHandler.d.ts.map +1 -1
- package/dist/input/PasteRichBlockHandler.d.ts +23 -0
- package/dist/input/PasteRichBlockHandler.d.ts.map +1 -0
- package/dist/input/SelectionDocument.d.ts +10 -0
- package/dist/input/SelectionDocument.d.ts.map +1 -0
- package/dist/model/Document.d.ts.map +1 -1
- package/dist/model/HTMLUtils.d.ts +2 -0
- package/dist/model/HTMLUtils.d.ts.map +1 -1
- package/dist/model/PasteInterceptor.d.ts +21 -0
- package/dist/model/PasteInterceptor.d.ts.map +1 -0
- package/dist/model/RichBlockData.d.ts +34 -0
- package/dist/model/RichBlockData.d.ts.map +1 -0
- package/dist/model/SchemaRegistry.d.ts +2 -0
- package/dist/model/SchemaRegistry.d.ts.map +1 -1
- package/dist/notectl-core.mjs +1 -1
- package/dist/notectl-core.umd.js +1 -1
- package/dist/notectl-core.umd.js.map +1 -1
- package/dist/plugins/Plugin.d.ts +3 -0
- package/dist/plugins/Plugin.d.ts.map +1 -1
- package/dist/plugins/PluginContextFactory.d.ts +73 -0
- package/dist/plugins/PluginContextFactory.d.ts.map +1 -0
- package/dist/plugins/PluginManager.d.ts +12 -0
- package/dist/plugins/PluginManager.d.ts.map +1 -1
- package/dist/plugins/alignment/AlignmentPlugin.d.ts.map +1 -1
- package/dist/plugins/alignment.mjs +1 -1
- package/dist/plugins/alignment.mjs.map +1 -1
- package/dist/plugins/blockquote/BlockquoteKeyboardHandlers.d.ts.map +1 -1
- package/dist/plugins/blockquote/BlockquotePlugin.d.ts.map +1 -1
- package/dist/plugins/blockquote.mjs +1 -1
- package/dist/plugins/blockquote.mjs.map +1 -1
- package/dist/plugins/caret-navigation/CaretNavigationPlugin.d.ts.map +1 -1
- package/dist/plugins/caret-navigation.mjs +1 -1
- package/dist/plugins/code-block/CodeBlockKeyboardHandlers.d.ts.map +1 -1
- package/dist/plugins/code-block/CodeBlockPlugin.d.ts +5 -0
- package/dist/plugins/code-block/CodeBlockPlugin.d.ts.map +1 -1
- package/dist/plugins/code-block/CodeBlockTypes.d.ts +7 -0
- package/dist/plugins/code-block/CodeBlockTypes.d.ts.map +1 -1
- package/dist/plugins/code-block/highlighter/RegexTokenizer.d.ts +14 -0
- package/dist/plugins/code-block/highlighter/RegexTokenizer.d.ts.map +1 -0
- package/dist/plugins/code-block/highlighter/TokenizerTypes.d.ts +15 -0
- package/dist/plugins/code-block/highlighter/TokenizerTypes.d.ts.map +1 -0
- package/dist/plugins/code-block/highlighter/languages/index.d.ts +3 -0
- package/dist/plugins/code-block/highlighter/languages/index.d.ts.map +1 -0
- package/dist/plugins/code-block/highlighter/languages/json.d.ts +3 -0
- package/dist/plugins/code-block/highlighter/languages/json.d.ts.map +1 -0
- package/dist/plugins/code-block/highlighter/languages/xml.d.ts +3 -0
- package/dist/plugins/code-block/highlighter/languages/xml.d.ts.map +1 -0
- package/dist/plugins/code-block/index.d.ts +5 -1
- package/dist/plugins/code-block/index.d.ts.map +1 -1
- package/dist/plugins/code-block.mjs +1 -1
- package/dist/plugins/code-block.mjs.map +1 -1
- package/dist/plugins/font/FontPlugin.d.ts.map +1 -1
- package/dist/plugins/font-size/FontSizePlugin.d.ts.map +1 -1
- package/dist/plugins/font-size.mjs +1 -1
- package/dist/plugins/font-size.mjs.map +1 -1
- package/dist/plugins/font.mjs +1 -1
- package/dist/plugins/font.mjs.map +1 -1
- package/dist/plugins/gap-cursor/GapCursorPlugin.d.ts.map +1 -1
- package/dist/plugins/gap-cursor.mjs +1 -1
- package/dist/plugins/hard-break.mjs +1 -1
- package/dist/plugins/heading/HeadingInputRules.d.ts.map +1 -1
- package/dist/plugins/heading/HeadingKeyboardHandlers.d.ts.map +1 -1
- package/dist/plugins/heading/HeadingPlugin.d.ts.map +1 -1
- package/dist/plugins/heading.mjs +1 -1
- package/dist/plugins/highlight/HighlightPlugin.d.ts.map +1 -1
- package/dist/plugins/highlight.mjs +1 -1
- package/dist/plugins/highlight.mjs.map +1 -1
- package/dist/plugins/horizontal-rule/HorizontalRulePlugin.d.ts.map +1 -1
- package/dist/plugins/horizontal-rule.mjs +1 -1
- package/dist/plugins/horizontal-rule.mjs.map +1 -1
- package/dist/plugins/image/ImageCommands.d.ts.map +1 -1
- package/dist/plugins/image/ImagePlugin.d.ts +0 -1
- package/dist/plugins/image/ImagePlugin.d.ts.map +1 -1
- package/dist/plugins/image/ImagePopup.d.ts +11 -0
- package/dist/plugins/image/ImagePopup.d.ts.map +1 -0
- package/dist/plugins/image.mjs +1 -1
- package/dist/plugins/image.mjs.map +1 -1
- package/dist/plugins/link/LinkPlugin.d.ts.map +1 -1
- package/dist/plugins/link.mjs +1 -1
- package/dist/plugins/link.mjs.map +1 -1
- package/dist/plugins/list/ListPlugin.d.ts.map +1 -1
- package/dist/plugins/list.mjs +1 -1
- package/dist/plugins/list.mjs.map +1 -1
- package/dist/plugins/print/PrintPlugin.d.ts.map +1 -1
- package/dist/plugins/print.mjs +1 -1
- package/dist/plugins/print.mjs.map +1 -1
- package/dist/plugins/shared/ColorMarkOperations.d.ts +1 -2
- package/dist/plugins/shared/ColorMarkOperations.d.ts.map +1 -1
- package/dist/plugins/shared/ColorPickerPopup.d.ts +1 -8
- package/dist/plugins/shared/ColorPickerPopup.d.ts.map +1 -1
- package/dist/plugins/shared/PluginHelpers.d.ts +8 -0
- package/dist/plugins/shared/PluginHelpers.d.ts.map +1 -1
- package/dist/plugins/shared/PopupManager.d.ts.map +1 -1
- package/dist/plugins/shared/XmlPatterns.d.ts +10 -0
- package/dist/plugins/shared/XmlPatterns.d.ts.map +1 -0
- package/dist/plugins/shared/index.d.ts +1 -0
- package/dist/plugins/shared/index.d.ts.map +1 -1
- package/dist/plugins/shared.mjs +1 -1
- package/dist/plugins/shared.mjs.map +1 -1
- package/dist/plugins/smart-paste/SmartPasteLocale.d.ts +7 -0
- package/dist/plugins/smart-paste/SmartPasteLocale.d.ts.map +1 -0
- package/dist/plugins/smart-paste/SmartPastePlugin.d.ts +19 -0
- package/dist/plugins/smart-paste/SmartPastePlugin.d.ts.map +1 -0
- package/dist/plugins/smart-paste/SmartPasteTypes.d.ts +24 -0
- package/dist/plugins/smart-paste/SmartPasteTypes.d.ts.map +1 -0
- package/dist/plugins/smart-paste/detectors/JsonDetector.d.ts +6 -0
- package/dist/plugins/smart-paste/detectors/JsonDetector.d.ts.map +1 -0
- package/dist/plugins/smart-paste/detectors/XmlDetector.d.ts +26 -0
- package/dist/plugins/smart-paste/detectors/XmlDetector.d.ts.map +1 -0
- package/dist/plugins/smart-paste/index.d.ts +7 -0
- package/dist/plugins/smart-paste/index.d.ts.map +1 -0
- package/dist/plugins/smart-paste/locales/ar.d.ts +4 -0
- package/dist/plugins/smart-paste/locales/ar.d.ts.map +1 -0
- package/dist/plugins/smart-paste/locales/de.d.ts +4 -0
- package/dist/plugins/smart-paste/locales/de.d.ts.map +1 -0
- package/dist/plugins/smart-paste/locales/es.d.ts +4 -0
- package/dist/plugins/smart-paste/locales/es.d.ts.map +1 -0
- package/dist/plugins/smart-paste/locales/fr.d.ts +4 -0
- package/dist/plugins/smart-paste/locales/fr.d.ts.map +1 -0
- package/dist/plugins/smart-paste/locales/hi.d.ts +4 -0
- package/dist/plugins/smart-paste/locales/hi.d.ts.map +1 -0
- package/dist/plugins/smart-paste/locales/pt.d.ts +4 -0
- package/dist/plugins/smart-paste/locales/pt.d.ts.map +1 -0
- package/dist/plugins/smart-paste/locales/ru.d.ts +4 -0
- package/dist/plugins/smart-paste/locales/ru.d.ts.map +1 -0
- package/dist/plugins/smart-paste/locales/zh.d.ts +4 -0
- package/dist/plugins/smart-paste/locales/zh.d.ts.map +1 -0
- package/dist/plugins/smart-paste.mjs +2 -0
- package/dist/plugins/smart-paste.mjs.map +1 -0
- package/dist/plugins/strikethrough/StrikethroughPlugin.d.ts.map +1 -1
- package/dist/plugins/strikethrough.mjs +1 -1
- package/dist/plugins/strikethrough.mjs.map +1 -1
- package/dist/plugins/super-sub/SuperSubPlugin.d.ts.map +1 -1
- package/dist/plugins/super-sub.mjs +1 -1
- package/dist/plugins/super-sub.mjs.map +1 -1
- package/dist/plugins/table/TableCommands.d.ts +1 -0
- package/dist/plugins/table/TableCommands.d.ts.map +1 -1
- package/dist/plugins/table/TableContextMenu.d.ts.map +1 -1
- package/dist/plugins/table/TableNavigation.d.ts.map +1 -1
- package/dist/plugins/table/TablePlugin.d.ts.map +1 -1
- package/dist/plugins/table/TableSelection.d.ts.map +1 -1
- package/dist/plugins/table/index.d.ts +1 -0
- package/dist/plugins/table/index.d.ts.map +1 -1
- package/dist/plugins/table.mjs +1 -1
- package/dist/plugins/table.mjs.map +1 -1
- package/dist/plugins/text-color/TextColorPlugin.d.ts.map +1 -1
- package/dist/plugins/text-color.mjs +1 -1
- package/dist/plugins/text-color.mjs.map +1 -1
- package/dist/plugins/text-direction/TextDirectionCorePlugin.d.ts.map +1 -1
- package/dist/plugins/text-direction/TextDirectionPlugin.d.ts.map +1 -1
- package/dist/plugins/text-direction-advanced.mjs +1 -1
- package/dist/plugins/text-direction-advanced.mjs.map +1 -1
- package/dist/plugins/text-direction.mjs +1 -1
- package/dist/plugins/text-direction.mjs.map +1 -1
- package/dist/plugins/text-formatting/TextFormattingPlugin.d.ts.map +1 -1
- package/dist/plugins/text-formatting.mjs +1 -1
- package/dist/plugins/text-formatting.mjs.map +1 -1
- package/dist/plugins/toolbar/ToolbarOverflowController.d.ts +2 -0
- package/dist/plugins/toolbar/ToolbarOverflowController.d.ts.map +1 -1
- package/dist/plugins/toolbar/ToolbarPlugin.d.ts.map +1 -1
- package/dist/plugins/toolbar.mjs +1 -1
- package/dist/plugins/toolbar.mjs.map +1 -1
- package/dist/presets/FullPreset.d.ts.map +1 -1
- package/dist/presets/PresetTypes.d.ts +2 -0
- package/dist/presets/PresetTypes.d.ts.map +1 -1
- package/dist/presets/full.mjs +1 -1
- package/dist/presets/full.mjs.map +1 -1
- package/dist/serialization/DocumentSerializer.d.ts.map +1 -1
- package/dist/state/InlineContentOps.d.ts.map +1 -1
- package/dist/state/StepInversion.d.ts +7 -0
- package/dist/state/StepInversion.d.ts.map +1 -0
- package/dist/state/Steps.d.ts +108 -0
- package/dist/state/Steps.d.ts.map +1 -0
- package/dist/state/Transaction.d.ts +5 -174
- package/dist/state/Transaction.d.ts.map +1 -1
- package/dist/state/TransactionBuilder.d.ts +69 -0
- package/dist/state/TransactionBuilder.d.ts.map +1 -0
- package/dist/test/TestUtils.d.ts.map +1 -1
- package/dist/view/CaretNavigation.d.ts.map +1 -1
- package/dist/view/DomUtils.d.ts +10 -1
- package/dist/view/DomUtils.d.ts.map +1 -1
- package/dist/view/EditorView.d.ts +10 -60
- package/dist/view/EditorView.d.ts.map +1 -1
- package/dist/view/EditorViewEvents.d.ts +54 -0
- package/dist/view/EditorViewEvents.d.ts.map +1 -0
- package/dist/view/EditorViewNavigation.d.ts +47 -0
- package/dist/view/EditorViewNavigation.d.ts.map +1 -0
- package/dist/view/SelectionSync.d.ts.map +1 -1
- package/dist/view/ViewMovementCommands.d.ts.map +1 -1
- package/package.json +12 -2
- package/dist/chunks/AttributedMarkCommands-BB7lzFct.mjs +0 -2
- package/dist/chunks/AttributedMarkCommands-BB7lzFct.mjs.map +0 -1
- package/dist/chunks/ColorPickerPopup-DRzFvt7o.mjs.map +0 -1
- package/dist/chunks/Commands-P9wS8qtN.mjs +0 -2
- package/dist/chunks/Commands-P9wS8qtN.mjs.map +0 -1
- package/dist/chunks/Document-BFYAonMF.mjs +0 -2
- package/dist/chunks/Document-BFYAonMF.mjs.map +0 -1
- package/dist/chunks/DocumentParser-DFcvVMGY.mjs +0 -2
- package/dist/chunks/DocumentParser-DFcvVMGY.mjs.map +0 -1
- package/dist/chunks/DomUtils-Cdz1eDKM.mjs +0 -2
- package/dist/chunks/DomUtils-Cdz1eDKM.mjs.map +0 -1
- package/dist/chunks/HTMLUtils-CCvQ5f83.mjs +0 -2
- package/dist/chunks/HTMLUtils-CCvQ5f83.mjs.map +0 -1
- package/dist/chunks/HeadingPlugin-DYy3IoT_.mjs +0 -2
- package/dist/chunks/HeadingPlugin-DYy3IoT_.mjs.map +0 -1
- package/dist/chunks/LocaleService-B6Z-wyAF.mjs +0 -2
- package/dist/chunks/LocaleService-B6Z-wyAF.mjs.map +0 -1
- package/dist/chunks/MarkCommands-B_erV7zz.mjs +0 -2
- package/dist/chunks/MarkCommands-B_erV7zz.mjs.map +0 -1
- package/dist/chunks/NavigationQueries-ogQuObz7.mjs +0 -2
- package/dist/chunks/NavigationQueries-ogQuObz7.mjs.map +0 -1
- package/dist/chunks/NotectlEditor-4NFnXLyD.mjs +0 -2
- package/dist/chunks/NotectlEditor-4NFnXLyD.mjs.map +0 -1
- package/dist/chunks/Plugin-OzM8Oxm_.mjs +0 -2
- package/dist/chunks/Plugin-OzM8Oxm_.mjs.map +0 -1
- package/dist/chunks/PluginHelpers-DjZt0pQi.mjs +0 -2
- package/dist/chunks/PluginHelpers-DjZt0pQi.mjs.map +0 -1
- package/dist/chunks/PopupManager-BM8IT6M7.mjs +0 -2
- package/dist/chunks/PopupManager-BM8IT6M7.mjs.map +0 -1
- package/dist/chunks/PrintTypes-ehbL7ipA.mjs +0 -2
- package/dist/chunks/SelectionTransactions-q71GEzgE.mjs +0 -2
- package/dist/chunks/index-C8xtb3SM.mjs +0 -2
- package/dist/chunks/index-C8xtb3SM.mjs.map +0 -1
- package/dist/chunks/index-DAoSt12h.mjs +0 -2
- package/dist/chunks/index-DAoSt12h.mjs.map +0 -1
- package/dist/input/BlockInsertion.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColorPickerPopup.d.ts","sourceRoot":"","sources":["../../../src/plugins/shared/ColorPickerPopup.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"ColorPickerPopup.d.ts","sourceRoot":"","sources":["../../../src/plugins/shared/ColorPickerPopup.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAE9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAE3D,kDAAkD;AAClD,MAAM,WAAW,iBAAiB;IACjC,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC;IACjC,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,EAAE,iBAAiB,KAAK,IAAI,CAAC;CACxD;AAID;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CACrC,SAAS,EAAE,WAAW,EACtB,OAAO,EAAE,aAAa,EACtB,MAAM,EAAE,iBAAiB,GACvB,IAAI,CAwCN"}
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
import { BlockNode } from '../../model/Document.js';
|
|
2
2
|
import { BlockId } from '../../model/TypeBrands.js';
|
|
3
3
|
import { EditorState } from '../../state/EditorState.js';
|
|
4
|
+
import { PluginContext } from '../Plugin.js';
|
|
4
5
|
/** Capitalizes the first character of a string. */
|
|
5
6
|
export declare function capitalize(s: string): string;
|
|
7
|
+
/** Converts a mark type to its toggle command name (e.g. 'bold' → 'toggleBold'). */
|
|
8
|
+
export declare function toCommandName(markType: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* Resolves the locale for a plugin, using config override, default, or dynamic loader.
|
|
11
|
+
* Plugins provide their config locale, a default English locale, and a loader for other languages.
|
|
12
|
+
*/
|
|
13
|
+
export declare function resolveLocale<T>(context: PluginContext, configLocale: T | undefined, defaultLocale: T, loader: (lang: string) => Promise<T>): Promise<T>;
|
|
6
14
|
/** Returns the block under the cursor, handling both TextSelection and NodeSelection. */
|
|
7
15
|
export declare function getSelectedBlock(state: EditorState): BlockNode | undefined;
|
|
8
16
|
/** Returns the block ID under the cursor, handling both TextSelection and NodeSelection. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PluginHelpers.d.ts","sourceRoot":"","sources":["../../../src/plugins/shared/PluginHelpers.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"PluginHelpers.d.ts","sourceRoot":"","sources":["../../../src/plugins/shared/PluginHelpers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEzD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD,mDAAmD;AACnD,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAE5C;AAED,oFAAoF;AACpF,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEtD;AAED;;;GAGG;AACH,wBAAsB,aAAa,CAAC,CAAC,EACpC,OAAO,EAAE,aAAa,EACtB,YAAY,EAAE,CAAC,GAAG,SAAS,EAC3B,aAAa,EAAE,CAAC,EAChB,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,GAClC,OAAO,CAAC,CAAC,CAAC,CAKZ;AAED,yFAAyF;AACzF,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,WAAW,GAAG,SAAS,GAAG,SAAS,CAK1E;AAED,4FAA4F;AAC5F,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,GAAG,SAAS,CAK1E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PopupManager.d.ts","sourceRoot":"","sources":["../../../src/plugins/shared/PopupManager.ts"],"names":[],"mappings":"AA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;IACvC,KAAK,IAAI,IAAI,CAAC;IACd,QAAQ,IAAI,IAAI,CAAC;IACjB,MAAM,IAAI,OAAO,CAAC;CAClB;AAED,eAAO,MAAM,eAAe,6BAA2C,CAAC;AAexE,qBAAa,YAAa,YAAW,eAAe;IACnD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAoB;IAC1C,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAO;gBAEzB,aAAa,EAAE,IAAI;IAI/B,mFAAmF;IACnF,IAAI,CAAC,MAAM,EAAE,WAAW,GAAG,WAAW;IAgFtC,6CAA6C;IAC7C,KAAK,IAAI,IAAI;IAOb,8BAA8B;IAC9B,QAAQ,IAAI,IAAI;IAShB,mDAAmD;IACnD,MAAM,IAAI,OAAO;IAIjB,gDAAgD;IAChD,OAAO,IAAI,IAAI;IAMf,OAAO,CAAC,UAAU;IAsBlB,OAAO,CAAC,WAAW;IAgBnB,OAAO,CAAC,iBAAiB;IAKzB,yEAAyE;IACzE,OAAO,CAAC,YAAY;IAOpB,OAAO,CAAC,cAAc;CAWtB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared XML regex pattern fragments used by XmlDetector and XML language definition.
|
|
3
|
+
*
|
|
4
|
+
* Based on XML 1.0 spec Name production (simplified to ASCII + common extensions).
|
|
5
|
+
*/
|
|
6
|
+
/** XML tag name pattern (string fragment for RegExp construction). */
|
|
7
|
+
export declare const XML_TAG_NAME = "[a-zA-Z_][\\w:.-]*";
|
|
8
|
+
/** Optional attributes pattern (string fragment for RegExp construction). */
|
|
9
|
+
export declare const XML_ATTRS = "(?:\\s(?:[^>\"']|\"[^\"]*\"|'[^']*')*)?";
|
|
10
|
+
//# sourceMappingURL=XmlPatterns.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"XmlPatterns.d.ts","sourceRoot":"","sources":["../../../src/plugins/shared/XmlPatterns.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,sEAAsE;AACtE,eAAO,MAAM,YAAY,uBAAuB,CAAC;AAEjD,6EAA6E;AAC7E,eAAO,MAAM,SAAS,4CAA4C,CAAC"}
|
|
@@ -9,4 +9,5 @@ export { attachGridKeyboard, attachListboxKeyboard, attachMenuKeyboard, type Gri
|
|
|
9
9
|
export { PopupManager, PopupServiceKey, type PopupCloseOptions, type PopupConfig, type PopupHandle, type PopupServiceAPI, } from './PopupManager.js';
|
|
10
10
|
export { appendToRoot, positionPopup, type PopupPosition, type PositionOptions, } from './PopupPositioning.js';
|
|
11
11
|
export { formatShortcut } from './ShortcutFormatting.js';
|
|
12
|
+
export { XML_ATTRS, XML_TAG_NAME } from './XmlPatterns.js';
|
|
12
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/shared/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,eAAe,EACf,KAAK,eAAe,GACpB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACN,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,eAAe,GACf,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACN,YAAY,EACZ,YAAY,GACZ,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACN,sBAAsB,EACtB,KAAK,iBAAiB,GACtB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACN,eAAe,EACf,oBAAoB,EACpB,kBAAkB,EAClB,eAAe,EACf,aAAa,GACb,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACN,mBAAmB,EACnB,oBAAoB,EACpB,YAAY,GACZ,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACN,UAAU,EACV,gBAAgB,EAChB,kBAAkB,GAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACN,kBAAkB,EAClB,qBAAqB,EACrB,kBAAkB,EAClB,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,GACvB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACN,YAAY,EACZ,eAAe,EACf,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,eAAe,GACpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACN,YAAY,EACZ,aAAa,EACb,KAAK,aAAa,EAClB,KAAK,eAAe,GACpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/shared/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,eAAe,EACf,KAAK,eAAe,GACpB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACN,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,eAAe,GACf,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACN,YAAY,EACZ,YAAY,GACZ,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACN,sBAAsB,EACtB,KAAK,iBAAiB,GACtB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACN,eAAe,EACf,oBAAoB,EACpB,kBAAkB,EAClB,eAAe,EACf,aAAa,GACb,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACN,mBAAmB,EACnB,oBAAoB,EACpB,YAAY,GACZ,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACN,UAAU,EACV,gBAAgB,EAChB,kBAAkB,GAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACN,kBAAkB,EAClB,qBAAqB,EACrB,kBAAkB,EAClB,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,GACvB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACN,YAAY,EACZ,eAAe,EACf,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,eAAe,GACpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACN,YAAY,EACZ,aAAa,EACb,KAAK,aAAa,EAClB,KAAK,eAAe,GACpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC"}
|
package/dist/plugins/shared.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{g as e,i as o,r}from"../chunks/ColorGrid-CpkbKfXg.mjs";import{a as t,g as n,i as a,r as s,b as i}from"../chunks/ColorPickerPopup-
|
|
1
|
+
import{g as e,i as o,r}from"../chunks/ColorGrid-CpkbKfXg.mjs";import{a as t,g as n,i as a,r as s,b as i}from"../chunks/ColorPickerPopup-D6XjShhv.mjs";import{i as c,a as l,b as u,c as p,r as f}from"../chunks/ColorValidation-DCSKq9B2.mjs";import{n as m,a as v,f as d}from"../chunks/KeyboardNav-DsYhKKuV.mjs";import{c as k,g as y,b as h}from"../chunks/PluginHelpers-CdPR0MuT.mjs";import{P as S,a as C}from"../chunks/PopupManager-0b_Q0m7K.mjs";import{a as g,p as w}from"../chunks/PopupPositioning-DtvqMSop.mjs";import{f as A}from"../chunks/ShortcutFormatting-BLKS0Gys.mjs";import{X as D,a as E}from"../chunks/XmlPatterns-DxQXGjP8.mjs";const P=/* @__PURE__ */new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"]);function M(e){let o=0;const r=r=>{r.stopPropagation();const t=Array.from(e.container.querySelectorAll(e.itemSelector));if(0!==t.length)switch(r.key){case"Escape":return r.preventDefault(),void e.onClose();case"ArrowDown":return r.preventDefault(),o=d(t,o,1),v(t,o),void t[o]?.focus();case"ArrowUp":return r.preventDefault(),o=d(t,o,-1),v(t,o),void t[o]?.focus();case"Enter":case" ":{r.preventDefault();const n=t[o];return void(n&&e.onActivate(n))}case"Home":return r.preventDefault(),o=0,v(t,o),void t[o]?.focus();case"End":return r.preventDefault(),o=t.length-1,v(t,o),void t[o]?.focus()}};return e.container.addEventListener("keydown",r),()=>e.container.removeEventListener("keydown",r)}function L(e){let o=0;const r=r=>{const t=Array.from(e.container.querySelectorAll(e.itemSelector));if(0!==t.length)switch(r.key){case"Escape":return r.preventDefault(),void e.onClose();case"ArrowDown":return r.preventDefault(),o=d(t,o,1),v(t,o),void t[o]?.focus();case"ArrowUp":return r.preventDefault(),o=d(t,o,-1),v(t,o),void t[o]?.focus();case"Enter":case" ":{r.preventDefault();const n=t[o];return void(n&&e.onSelect(n))}}};return e.container.addEventListener("keydown",r),()=>e.container.removeEventListener("keydown",r)}function j(e){let o=0;const r=e.columns,t=e.totalCells,n=Math.ceil(t/r),a=a=>{const s=Array.from(e.container.querySelectorAll(e.cellSelector));if(0!==s.length){if("Escape"===a.key)return a.preventDefault(),void e.onClose();if("Enter"===a.key||" "===a.key){a.preventDefault();const r=s[o];return void(r&&e.onSelect(r))}if(P.has(a.key)){a.preventDefault();const i=Math.floor(o/r)+1,c=o%r+1,[l,u]=m(i,c,n,r,a.key);let p=(l-1)*r+(u-1);return p>=t&&(p=t-1),o=p,v(s,o),s[o]?.focus(),void e.onNavigate?.(o)}if("Home"===a.key||"End"===a.key){a.preventDefault();const n=Math.floor(o/r)*r,i=Math.min(n+r-1,t-1);o="Home"===a.key?n:i,v(s,o),s[o]?.focus(),e.onNavigate?.(o)}}};return e.container.addEventListener("keydown",a),()=>e.container.removeEventListener("keydown",a)}export{S as PopupManager,C as PopupServiceKey,D as XML_ATTRS,E as XML_TAG_NAME,g as appendToRoot,t as applyColorMark,v as applyRovingTabindex,j as attachGridKeyboard,L as attachListboxKeyboard,M as attachMenuKeyboard,k as capitalize,d as findNextDropdownItem,A as formatShortcut,n as getActiveColor,e as getColorName,y as getSelectedBlock,h as getSelectedBlockId,a as isColorMarkActive,o as isLightColor,c as isValidCSSColor,l as isValidCSSFontFamily,u as isValidCSSFontSize,p as isValidHexColor,m as navigateGrid,w as positionPopup,s as removeColorMark,r as renderColorGrid,i as renderColorPickerPopup,f as resolveColors};
|
|
2
2
|
//# sourceMappingURL=shared.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.mjs","sources":["../../src/plugins/shared/PopupKeyboardPatterns.ts"],"sourcesContent":["/**\n * Pure functions that attach WAI-ARIA keyboard patterns to popup containers.\n * Supports menu, listbox, and grid navigation patterns.\n * Delegates to shared keyboard navigation helpers.\n */\n\nimport { applyRovingTabindex, findNextDropdownItem, navigateGrid } from './KeyboardNav.js';\n\n// --- Types ---\n\nexport interface MenuKeyboardConfig {\n\treadonly container: HTMLElement;\n\treadonly itemSelector: string;\n\treadonly onActivate: (item: HTMLElement) => void;\n\treadonly onClose: () => void;\n\treadonly getActiveElement: () => Element | null;\n}\n\nexport interface ListboxKeyboardConfig {\n\treadonly container: HTMLElement;\n\treadonly itemSelector: string;\n\treadonly onSelect: (item: HTMLElement) => void;\n\treadonly onClose: () => void;\n}\n\nexport interface GridKeyboardConfig {\n\treadonly container: HTMLElement;\n\treadonly cellSelector: string;\n\treadonly columns: number;\n\treadonly totalCells: number;\n\treadonly onSelect: (cell: HTMLElement) => void;\n\treadonly onClose: () => void;\n\treadonly onNavigate?: (index: number) => void;\n}\n\n// --- Constants ---\n\nconst GRID_NAV_KEYS: ReadonlySet<string> = new Set([\n\t'ArrowUp',\n\t'ArrowDown',\n\t'ArrowLeft',\n\t'ArrowRight',\n]);\n\n// --- Menu Keyboard ---\n\n/**\n * Attaches menu keyboard navigation (ArrowUp/Down, Enter/Space, Home/End, Escape).\n * Returns a cleanup function that removes the event listener.\n */\nexport function attachMenuKeyboard(config: MenuKeyboardConfig): () => void {\n\tlet focusedIndex = 0;\n\n\tconst handler = (e: KeyboardEvent): void => {\n\t\te.stopPropagation();\n\t\tconst items: HTMLElement[] = Array.from(\n\t\t\tconfig.container.querySelectorAll(config.itemSelector),\n\t\t) as HTMLElement[];\n\t\tif (items.length === 0) return;\n\n\t\tswitch (e.key) {\n\t\t\tcase 'Escape': {\n\t\t\t\te.preventDefault();\n\t\t\t\tconfig.onClose();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcase 'ArrowDown': {\n\t\t\t\te.preventDefault();\n\t\t\t\tfocusedIndex = findNextDropdownItem(items, focusedIndex, 1);\n\t\t\t\tapplyRovingTabindex(items as HTMLButtonElement[], focusedIndex);\n\t\t\t\titems[focusedIndex]?.focus();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcase 'ArrowUp': {\n\t\t\t\te.preventDefault();\n\t\t\t\tfocusedIndex = findNextDropdownItem(items, focusedIndex, -1);\n\t\t\t\tapplyRovingTabindex(items as HTMLButtonElement[], focusedIndex);\n\t\t\t\titems[focusedIndex]?.focus();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcase 'Enter':\n\t\t\tcase ' ': {\n\t\t\t\te.preventDefault();\n\t\t\t\tconst item: HTMLElement | undefined = items[focusedIndex];\n\t\t\t\tif (item) config.onActivate(item);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcase 'Home': {\n\t\t\t\te.preventDefault();\n\t\t\t\tfocusedIndex = 0;\n\t\t\t\tapplyRovingTabindex(items as HTMLButtonElement[], focusedIndex);\n\t\t\t\titems[focusedIndex]?.focus();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcase 'End': {\n\t\t\t\te.preventDefault();\n\t\t\t\tfocusedIndex = items.length - 1;\n\t\t\t\tapplyRovingTabindex(items as HTMLButtonElement[], focusedIndex);\n\t\t\t\titems[focusedIndex]?.focus();\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t};\n\n\tconfig.container.addEventListener('keydown', handler);\n\treturn () => config.container.removeEventListener('keydown', handler);\n}\n\n// --- Listbox Keyboard ---\n\n/**\n * Attaches listbox keyboard navigation (ArrowUp/Down, Enter/Space, Escape).\n * Returns a cleanup function.\n */\nexport function attachListboxKeyboard(config: ListboxKeyboardConfig): () => void {\n\tlet focusedIndex = 0;\n\n\tconst handler = (e: KeyboardEvent): void => {\n\t\tconst items: HTMLElement[] = Array.from(\n\t\t\tconfig.container.querySelectorAll(config.itemSelector),\n\t\t) as HTMLElement[];\n\t\tif (items.length === 0) return;\n\n\t\tswitch (e.key) {\n\t\t\tcase 'Escape': {\n\t\t\t\te.preventDefault();\n\t\t\t\tconfig.onClose();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcase 'ArrowDown': {\n\t\t\t\te.preventDefault();\n\t\t\t\tfocusedIndex = findNextDropdownItem(items, focusedIndex, 1);\n\t\t\t\tapplyRovingTabindex(items as HTMLButtonElement[], focusedIndex);\n\t\t\t\titems[focusedIndex]?.focus();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcase 'ArrowUp': {\n\t\t\t\te.preventDefault();\n\t\t\t\tfocusedIndex = findNextDropdownItem(items, focusedIndex, -1);\n\t\t\t\tapplyRovingTabindex(items as HTMLButtonElement[], focusedIndex);\n\t\t\t\titems[focusedIndex]?.focus();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcase 'Enter':\n\t\t\tcase ' ': {\n\t\t\t\te.preventDefault();\n\t\t\t\tconst item: HTMLElement | undefined = items[focusedIndex];\n\t\t\t\tif (item) config.onSelect(item);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t};\n\n\tconfig.container.addEventListener('keydown', handler);\n\treturn () => config.container.removeEventListener('keydown', handler);\n}\n\n// --- Grid Keyboard ---\n\n/**\n * Attaches grid keyboard navigation (2D arrows, Home/End per row, Enter/Space, Escape).\n * Returns a cleanup function.\n */\nexport function attachGridKeyboard(config: GridKeyboardConfig): () => void {\n\tlet focusedIndex = 0;\n\tconst columns: number = config.columns;\n\tconst totalCells: number = config.totalCells;\n\tconst totalRows: number = Math.ceil(totalCells / columns);\n\n\tconst handler = (e: KeyboardEvent): void => {\n\t\tconst cells: HTMLElement[] = Array.from(\n\t\t\tconfig.container.querySelectorAll(config.cellSelector),\n\t\t) as HTMLElement[];\n\t\tif (cells.length === 0) return;\n\n\t\tif (e.key === 'Escape') {\n\t\t\te.preventDefault();\n\t\t\tconfig.onClose();\n\t\t\treturn;\n\t\t}\n\n\t\tif (e.key === 'Enter' || e.key === ' ') {\n\t\t\te.preventDefault();\n\t\t\tconst cell: HTMLElement | undefined = cells[focusedIndex];\n\t\t\tif (cell) config.onSelect(cell);\n\t\t\treturn;\n\t\t}\n\n\t\tif (GRID_NAV_KEYS.has(e.key)) {\n\t\t\te.preventDefault();\n\t\t\tconst currentRow: number = Math.floor(focusedIndex / columns) + 1;\n\t\t\tconst currentCol: number = (focusedIndex % columns) + 1;\n\n\t\t\tconst [newRow, newCol] = navigateGrid(\n\t\t\t\tcurrentRow,\n\t\t\t\tcurrentCol,\n\t\t\t\ttotalRows,\n\t\t\t\tcolumns,\n\t\t\t\te.key as 'ArrowUp' | 'ArrowDown' | 'ArrowLeft' | 'ArrowRight',\n\t\t\t);\n\n\t\t\tlet newIdx: number = (newRow - 1) * columns + (newCol - 1);\n\t\t\tif (newIdx >= totalCells) {\n\t\t\t\tnewIdx = totalCells - 1;\n\t\t\t}\n\n\t\t\tfocusedIndex = newIdx;\n\t\t\tapplyRovingTabindex(cells as HTMLButtonElement[], focusedIndex);\n\t\t\tcells[focusedIndex]?.focus();\n\t\t\tconfig.onNavigate?.(focusedIndex);\n\t\t\treturn;\n\t\t}\n\n\t\tif (e.key === 'Home' || e.key === 'End') {\n\t\t\te.preventDefault();\n\t\t\tconst currentRow: number = Math.floor(focusedIndex / columns);\n\t\t\tconst rowStart: number = currentRow * columns;\n\t\t\tconst rowEnd: number = Math.min(rowStart + columns - 1, totalCells - 1);\n\n\t\t\tfocusedIndex = e.key === 'Home' ? rowStart : rowEnd;\n\t\t\tapplyRovingTabindex(cells as HTMLButtonElement[], focusedIndex);\n\t\t\tcells[focusedIndex]?.focus();\n\t\t\tconfig.onNavigate?.(focusedIndex);\n\t\t}\n\t};\n\n\tconfig.container.addEventListener('keydown', handler);\n\treturn () => config.container.removeEventListener('keydown', handler);\n}\n"],"names":["GRID_NAV_KEYS","Set","attachMenuKeyboard","config","focusedIndex","handler","e","stopPropagation","items","Array","from","container","querySelectorAll","itemSelector","length","key","preventDefault","onClose","findNextDropdownItem","applyRovingTabindex","focus","item","onActivate","addEventListener","removeEventListener","attachListboxKeyboard","onSelect","attachGridKeyboard","columns","totalCells","totalRows","Math","ceil","cells","cellSelector","cell","has","currentRow","floor","currentCol","newRow","newCol","navigateGrid","newIdx","onNavigate","rowStart","rowEnd","min"],"mappings":"yjBAqCA,MAAMA,qBAAyCC,IAAI,CAClD,UACA,YACA,YACA,eASM,SAASC,EAAmBC,GAClC,IAAIC,EAAe,EAEnB,MAAMC,EAAWC,IAChBA,EAAEC,kBACF,MAAMC,EAAuBC,MAAMC,KAClCP,EAAOQ,UAAUC,iBAAiBT,EAAOU,eAE1C,GAAqB,IAAjBL,EAAMM,OAEV,OAAQR,EAAES,KACT,IAAK,SAGJ,OAFAT,EAAEU,sBACFb,EAAOc,UAGR,IAAK,YAKJ,OAJAX,EAAEU,iBACFZ,EAAec,EAAqBV,EAAOJ,EAAc,GACzDe,EAAoBX,EAA8BJ,QAClDI,EAAMJ,IAAegB,QAGtB,IAAK,UAKJ,OAJAd,EAAEU,iBACFZ,EAAec,EAAqBV,EAAOJ,GAAc,GACzDe,EAAoBX,EAA8BJ,QAClDI,EAAMJ,IAAegB,QAGtB,IAAK,QACL,IAAK,IAAK,CACTd,EAAEU,iBACF,MAAMK,EAAgCb,EAAMJ,GAE5C,YADIiB,GAAMlB,EAAOmB,WAAWD,GAE7B,CACA,IAAK,OAKJ,OAJAf,EAAEU,iBACFZ,EAAe,EACfe,EAAoBX,EAA8BJ,QAClDI,EAAMJ,IAAegB,QAGtB,IAAK,MAKJ,OAJAd,EAAEU,iBACFZ,EAAeI,EAAMM,OAAS,EAC9BK,EAAoBX,EAA8BJ,QAClDI,EAAMJ,IAAegB,UAOxB,OADAjB,EAAOQ,UAAUY,iBAAiB,UAAWlB,GACtC,IAAMF,EAAOQ,UAAUa,oBAAoB,UAAWnB,EAC9D,CA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KO,MAAMlC,EAAewB,GAAW,EAC1DW,EAAsBnC,EAAewB,EAAW,GAE/CY,EAAQC,GAAUC,EACxBL,EACAE,EACAT,EACAF,EACAtB,EAAES,KAGH,IAAI4B,GAAkBH,EAAS,GAAKZ,GAAWa,EAAS,GASxD,OARIE,GAAUd,IACbc,EAASd,EAAa,GAGvBzB,EAAeuC,EACfxB,EAAoBc,EAA8B7B,GAClD6B,EAAM7B,IAAegB,aACrBjB,EAAOyC,aAAaxC,EAErB,CAEA,GAAc,SAAVE,EAAES,KAA4B,QAAVT,EAAES,IAAe,CACxCT,EAAEU,iBACF,MACM6B,EADqBd,KAAKO,MAAMlC,EAAewB,GACfA,EAChCkB,EAAiBf,KAAKgB,IAAIF,EAAWjB,EAAU,EAAGC,EAAa,GAErEzB,EAAyB,SAAVE,EAAES,IAAiB8B,EAAWC,EAC7C3B,EAAoBc,EAA8B7B,GAClD6B,EAAM7B,IAAegB,QACrBjB,EAAOyC,aAAaxC,EACrB,CAlDwB,GAsDzB,OADAD,EAAOQ,UAAUY,iBAAiB,UAAWlB,GACtC,IAAMF,EAAOQ,UAAUa,oBAAoB,UAAWnB,EAC9D"}
|
|
1
|
+
{"version":3,"file":"shared.mjs","sources":["../../src/plugins/shared/PopupKeyboardPatterns.ts"],"sourcesContent":["/**\n * Pure functions that attach WAI-ARIA keyboard patterns to popup containers.\n * Supports menu, listbox, and grid navigation patterns.\n * Delegates to shared keyboard navigation helpers.\n */\n\nimport { applyRovingTabindex, findNextDropdownItem, navigateGrid } from './KeyboardNav.js';\n\n// --- Types ---\n\nexport interface MenuKeyboardConfig {\n\treadonly container: HTMLElement;\n\treadonly itemSelector: string;\n\treadonly onActivate: (item: HTMLElement) => void;\n\treadonly onClose: () => void;\n\treadonly getActiveElement: () => Element | null;\n}\n\nexport interface ListboxKeyboardConfig {\n\treadonly container: HTMLElement;\n\treadonly itemSelector: string;\n\treadonly onSelect: (item: HTMLElement) => void;\n\treadonly onClose: () => void;\n}\n\nexport interface GridKeyboardConfig {\n\treadonly container: HTMLElement;\n\treadonly cellSelector: string;\n\treadonly columns: number;\n\treadonly totalCells: number;\n\treadonly onSelect: (cell: HTMLElement) => void;\n\treadonly onClose: () => void;\n\treadonly onNavigate?: (index: number) => void;\n}\n\n// --- Constants ---\n\nconst GRID_NAV_KEYS: ReadonlySet<string> = new Set([\n\t'ArrowUp',\n\t'ArrowDown',\n\t'ArrowLeft',\n\t'ArrowRight',\n]);\n\n// --- Menu Keyboard ---\n\n/**\n * Attaches menu keyboard navigation (ArrowUp/Down, Enter/Space, Home/End, Escape).\n * Returns a cleanup function that removes the event listener.\n */\nexport function attachMenuKeyboard(config: MenuKeyboardConfig): () => void {\n\tlet focusedIndex = 0;\n\n\tconst handler = (e: KeyboardEvent): void => {\n\t\te.stopPropagation();\n\t\tconst items: HTMLElement[] = Array.from(\n\t\t\tconfig.container.querySelectorAll(config.itemSelector),\n\t\t) as HTMLElement[];\n\t\tif (items.length === 0) return;\n\n\t\tswitch (e.key) {\n\t\t\tcase 'Escape': {\n\t\t\t\te.preventDefault();\n\t\t\t\tconfig.onClose();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcase 'ArrowDown': {\n\t\t\t\te.preventDefault();\n\t\t\t\tfocusedIndex = findNextDropdownItem(items, focusedIndex, 1);\n\t\t\t\tapplyRovingTabindex(items as HTMLButtonElement[], focusedIndex);\n\t\t\t\titems[focusedIndex]?.focus();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcase 'ArrowUp': {\n\t\t\t\te.preventDefault();\n\t\t\t\tfocusedIndex = findNextDropdownItem(items, focusedIndex, -1);\n\t\t\t\tapplyRovingTabindex(items as HTMLButtonElement[], focusedIndex);\n\t\t\t\titems[focusedIndex]?.focus();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcase 'Enter':\n\t\t\tcase ' ': {\n\t\t\t\te.preventDefault();\n\t\t\t\tconst item: HTMLElement | undefined = items[focusedIndex];\n\t\t\t\tif (item) config.onActivate(item);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcase 'Home': {\n\t\t\t\te.preventDefault();\n\t\t\t\tfocusedIndex = 0;\n\t\t\t\tapplyRovingTabindex(items as HTMLButtonElement[], focusedIndex);\n\t\t\t\titems[focusedIndex]?.focus();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcase 'End': {\n\t\t\t\te.preventDefault();\n\t\t\t\tfocusedIndex = items.length - 1;\n\t\t\t\tapplyRovingTabindex(items as HTMLButtonElement[], focusedIndex);\n\t\t\t\titems[focusedIndex]?.focus();\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t};\n\n\tconfig.container.addEventListener('keydown', handler);\n\treturn () => config.container.removeEventListener('keydown', handler);\n}\n\n// --- Listbox Keyboard ---\n\n/**\n * Attaches listbox keyboard navigation (ArrowUp/Down, Enter/Space, Escape).\n * Returns a cleanup function.\n */\nexport function attachListboxKeyboard(config: ListboxKeyboardConfig): () => void {\n\tlet focusedIndex = 0;\n\n\tconst handler = (e: KeyboardEvent): void => {\n\t\tconst items: HTMLElement[] = Array.from(\n\t\t\tconfig.container.querySelectorAll(config.itemSelector),\n\t\t) as HTMLElement[];\n\t\tif (items.length === 0) return;\n\n\t\tswitch (e.key) {\n\t\t\tcase 'Escape': {\n\t\t\t\te.preventDefault();\n\t\t\t\tconfig.onClose();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcase 'ArrowDown': {\n\t\t\t\te.preventDefault();\n\t\t\t\tfocusedIndex = findNextDropdownItem(items, focusedIndex, 1);\n\t\t\t\tapplyRovingTabindex(items as HTMLButtonElement[], focusedIndex);\n\t\t\t\titems[focusedIndex]?.focus();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcase 'ArrowUp': {\n\t\t\t\te.preventDefault();\n\t\t\t\tfocusedIndex = findNextDropdownItem(items, focusedIndex, -1);\n\t\t\t\tapplyRovingTabindex(items as HTMLButtonElement[], focusedIndex);\n\t\t\t\titems[focusedIndex]?.focus();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcase 'Enter':\n\t\t\tcase ' ': {\n\t\t\t\te.preventDefault();\n\t\t\t\tconst item: HTMLElement | undefined = items[focusedIndex];\n\t\t\t\tif (item) config.onSelect(item);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t};\n\n\tconfig.container.addEventListener('keydown', handler);\n\treturn () => config.container.removeEventListener('keydown', handler);\n}\n\n// --- Grid Keyboard ---\n\n/**\n * Attaches grid keyboard navigation (2D arrows, Home/End per row, Enter/Space, Escape).\n * Returns a cleanup function.\n */\nexport function attachGridKeyboard(config: GridKeyboardConfig): () => void {\n\tlet focusedIndex = 0;\n\tconst columns: number = config.columns;\n\tconst totalCells: number = config.totalCells;\n\tconst totalRows: number = Math.ceil(totalCells / columns);\n\n\tconst handler = (e: KeyboardEvent): void => {\n\t\tconst cells: HTMLElement[] = Array.from(\n\t\t\tconfig.container.querySelectorAll(config.cellSelector),\n\t\t) as HTMLElement[];\n\t\tif (cells.length === 0) return;\n\n\t\tif (e.key === 'Escape') {\n\t\t\te.preventDefault();\n\t\t\tconfig.onClose();\n\t\t\treturn;\n\t\t}\n\n\t\tif (e.key === 'Enter' || e.key === ' ') {\n\t\t\te.preventDefault();\n\t\t\tconst cell: HTMLElement | undefined = cells[focusedIndex];\n\t\t\tif (cell) config.onSelect(cell);\n\t\t\treturn;\n\t\t}\n\n\t\tif (GRID_NAV_KEYS.has(e.key)) {\n\t\t\te.preventDefault();\n\t\t\tconst currentRow: number = Math.floor(focusedIndex / columns) + 1;\n\t\t\tconst currentCol: number = (focusedIndex % columns) + 1;\n\n\t\t\tconst [newRow, newCol] = navigateGrid(\n\t\t\t\tcurrentRow,\n\t\t\t\tcurrentCol,\n\t\t\t\ttotalRows,\n\t\t\t\tcolumns,\n\t\t\t\te.key as 'ArrowUp' | 'ArrowDown' | 'ArrowLeft' | 'ArrowRight',\n\t\t\t);\n\n\t\t\tlet newIdx: number = (newRow - 1) * columns + (newCol - 1);\n\t\t\tif (newIdx >= totalCells) {\n\t\t\t\tnewIdx = totalCells - 1;\n\t\t\t}\n\n\t\t\tfocusedIndex = newIdx;\n\t\t\tapplyRovingTabindex(cells as HTMLButtonElement[], focusedIndex);\n\t\t\tcells[focusedIndex]?.focus();\n\t\t\tconfig.onNavigate?.(focusedIndex);\n\t\t\treturn;\n\t\t}\n\n\t\tif (e.key === 'Home' || e.key === 'End') {\n\t\t\te.preventDefault();\n\t\t\tconst currentRow: number = Math.floor(focusedIndex / columns);\n\t\t\tconst rowStart: number = currentRow * columns;\n\t\t\tconst rowEnd: number = Math.min(rowStart + columns - 1, totalCells - 1);\n\n\t\t\tfocusedIndex = e.key === 'Home' ? rowStart : rowEnd;\n\t\t\tapplyRovingTabindex(cells as HTMLButtonElement[], focusedIndex);\n\t\t\tcells[focusedIndex]?.focus();\n\t\t\tconfig.onNavigate?.(focusedIndex);\n\t\t}\n\t};\n\n\tconfig.container.addEventListener('keydown', handler);\n\treturn () => config.container.removeEventListener('keydown', handler);\n}\n"],"names":["GRID_NAV_KEYS","Set","attachMenuKeyboard","config","focusedIndex","handler","e","stopPropagation","items","Array","from","container","querySelectorAll","itemSelector","length","key","preventDefault","onClose","findNextDropdownItem","applyRovingTabindex","focus","item","onActivate","addEventListener","removeEventListener","attachListboxKeyboard","onSelect","attachGridKeyboard","columns","totalCells","totalRows","Math","ceil","cells","cellSelector","cell","has","currentRow","floor","currentCol","newRow","newCol","navigateGrid","newIdx","onNavigate","rowStart","rowEnd","min"],"mappings":"unBAqCA,MAAMA,qBAAyCC,IAAI,CAClD,UACA,YACA,YACA,eASM,SAASC,EAAmBC,GAClC,IAAIC,EAAe,EAEnB,MAAMC,EAAWC,IAChBA,EAAEC,kBACF,MAAMC,EAAuBC,MAAMC,KAClCP,EAAOQ,UAAUC,iBAAiBT,EAAOU,eAE1C,GAAqB,IAAjBL,EAAMM,OAEV,OAAQR,EAAES,KACT,IAAK,SAGJ,OAFAT,EAAEU,sBACFb,EAAOc,UAGR,IAAK,YAKJ,O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,EAAOyC,aAAaxC,EACrB,CAlDwB,GAsDzB,OADAD,EAAOQ,UAAUY,iBAAiB,UAAWlB,GACtC,IAAMF,EAAOQ,UAAUa,oBAAoB,UAAWnB,EAC9D"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Locale interface and default English locale for the SmartPastePlugin. */
|
|
2
|
+
export interface SmartPasteLocale {
|
|
3
|
+
readonly detectedAsCodeBlock: (language: string) => string;
|
|
4
|
+
}
|
|
5
|
+
export declare const SMART_PASTE_LOCALE_EN: SmartPasteLocale;
|
|
6
|
+
export declare function loadSmartPasteLocale(lang: string): Promise<SmartPasteLocale>;
|
|
7
|
+
//# sourceMappingURL=SmartPasteLocale.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SmartPasteLocale.d.ts","sourceRoot":"","sources":["../../../src/plugins/smart-paste/SmartPasteLocale.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAE5E,MAAM,WAAW,gBAAgB;IAChC,QAAQ,CAAC,mBAAmB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAC;CAC3D;AAED,eAAO,MAAM,qBAAqB,EAAE,gBAGnC,CAAC;AAKF,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAUlF"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Plugin, PluginContext } from '../Plugin.js';
|
|
2
|
+
import { SmartPasteConfig } from './SmartPasteTypes.js';
|
|
3
|
+
export declare class SmartPastePlugin implements Plugin {
|
|
4
|
+
readonly id = "smart-paste";
|
|
5
|
+
readonly name = "Smart Paste";
|
|
6
|
+
readonly dependencies: readonly ["code-block"];
|
|
7
|
+
private readonly config;
|
|
8
|
+
private readonly detectors;
|
|
9
|
+
private context;
|
|
10
|
+
private locale;
|
|
11
|
+
constructor(config?: Partial<SmartPasteConfig>);
|
|
12
|
+
init(context: PluginContext): Promise<void>;
|
|
13
|
+
destroy(): void;
|
|
14
|
+
private readonly handlePaste;
|
|
15
|
+
private detectContent;
|
|
16
|
+
private isCursorInCodeBlock;
|
|
17
|
+
private buildCodeBlockTransaction;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=SmartPastePlugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SmartPastePlugin.d.ts","sourceRoot":"","sources":["../../../src/plugins/smart-paste/SmartPastePlugin.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAeH,OAAO,KAAK,EAAoB,MAAM,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAO5E,OAAO,KAAK,EAAoC,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAK/F,qBAAa,gBAAiB,YAAW,MAAM;IAC9C,QAAQ,CAAC,EAAE,iBAAiB;IAC5B,QAAQ,CAAC,IAAI,iBAAiB;IAC9B,QAAQ,CAAC,YAAY,0BAA2B;IAEhD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAmB;IAC1C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAyB;IACnD,OAAO,CAAC,OAAO,CAA8B;IAC7C,OAAO,CAAC,MAAM,CAA2C;gBAE7C,MAAM,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC;IAIxC,IAAI,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAgCjD,OAAO,IAAI,IAAI;IAOf,OAAO,CAAC,QAAQ,CAAC,WAAW,CAiB1B;IAEF,OAAO,CAAC,aAAa;IAarB,OAAO,CAAC,mBAAmB;IAQ3B,OAAO,CAAC,yBAAyB;CAwCjC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ServiceKey } from '../Plugin.js';
|
|
2
|
+
import { SmartPasteLocale } from './SmartPasteLocale.js';
|
|
3
|
+
/** Result of detecting structured content in pasted text. */
|
|
4
|
+
export interface DetectionResult {
|
|
5
|
+
readonly language: string;
|
|
6
|
+
readonly formattedText: string;
|
|
7
|
+
readonly confidence: number;
|
|
8
|
+
}
|
|
9
|
+
/** Interface for content detectors that identify and format pasted text. */
|
|
10
|
+
export interface ContentDetector {
|
|
11
|
+
readonly id: string;
|
|
12
|
+
detect(text: string): DetectionResult | null;
|
|
13
|
+
}
|
|
14
|
+
/** Configuration for the SmartPastePlugin. */
|
|
15
|
+
export interface SmartPasteConfig {
|
|
16
|
+
readonly detectors?: readonly ContentDetector[];
|
|
17
|
+
readonly locale?: SmartPasteLocale;
|
|
18
|
+
}
|
|
19
|
+
/** Public service for registering additional content detectors at runtime. */
|
|
20
|
+
export interface SmartPasteService {
|
|
21
|
+
registerDetector(detector: ContentDetector): void;
|
|
22
|
+
}
|
|
23
|
+
export declare const SMART_PASTE_SERVICE_KEY: ServiceKey<SmartPasteService>;
|
|
24
|
+
//# sourceMappingURL=SmartPasteTypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SmartPasteTypes.d.ts","sourceRoot":"","sources":["../../../src/plugins/smart-paste/SmartPasteTypes.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE9D,6DAA6D;AAC7D,MAAM,WAAW,eAAe;IAC/B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC5B;AAED,4EAA4E;AAC5E,MAAM,WAAW,eAAe;IAC/B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI,CAAC;CAC7C;AAED,8CAA8C;AAC9C,MAAM,WAAW,gBAAgB;IAChC,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,eAAe,EAAE,CAAC;IAChD,QAAQ,CAAC,MAAM,CAAC,EAAE,gBAAgB,CAAC;CACnC;AAED,8EAA8E;AAC9E,MAAM,WAAW,iBAAiB;IACjC,gBAAgB,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI,CAAC;CAClD;AAED,eAAO,MAAM,uBAAuB,+BAAkD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JsonDetector.d.ts","sourceRoot":"","sources":["../../../../src/plugins/smart-paste/detectors/JsonDetector.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAQ9E,qBAAa,YAAa,YAAW,eAAe;IACnD,QAAQ,CAAC,EAAE,UAAU;IAErB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI;CAgB5C"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ContentDetector, DetectionResult } from '../SmartPasteTypes.js';
|
|
2
|
+
/**
|
|
3
|
+
* Detects well-formed XML content and formats it with proper indentation.
|
|
4
|
+
*
|
|
5
|
+
* Detection strategy:
|
|
6
|
+
* 1. Text must start with `<` (after trimming)
|
|
7
|
+
* 2. Must begin with an XML declaration, processing instruction, or opening tag
|
|
8
|
+
* 3. All opened tags must be properly closed (basic well-formedness check)
|
|
9
|
+
* 4. Must contain at least one tag pair or self-closing tag
|
|
10
|
+
*/
|
|
11
|
+
export declare class XmlDetector implements ContentDetector {
|
|
12
|
+
readonly id = "xml";
|
|
13
|
+
detect(text: string): DetectionResult | null;
|
|
14
|
+
/**
|
|
15
|
+
* Checks basic XML well-formedness by verifying that all opened tags
|
|
16
|
+
* are properly closed in the correct nesting order.
|
|
17
|
+
*/
|
|
18
|
+
private isWellFormed;
|
|
19
|
+
/**
|
|
20
|
+
* Formats XML with consistent 2-space indentation.
|
|
21
|
+
*/
|
|
22
|
+
private formatXml;
|
|
23
|
+
/** Splits XML into line-level tokens by breaking between adjacent tags. */
|
|
24
|
+
private splitIntoTokens;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=XmlDetector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"XmlDetector.d.ts","sourceRoot":"","sources":["../../../../src/plugins/smart-paste/detectors/XmlDetector.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAsC9E;;;;;;;;GAQG;AACH,qBAAa,WAAY,YAAW,eAAe;IAClD,QAAQ,CAAC,EAAE,SAAS;IAEpB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI;IAiB5C;;;OAGG;IACH,OAAO,CAAC,YAAY;IAgCpB;;OAEG;IACH,OAAO,CAAC,SAAS;IAwBjB,2EAA2E;IAC3E,OAAO,CAAC,eAAe;CAOvB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { SmartPastePlugin } from './SmartPastePlugin.js';
|
|
2
|
+
export { SMART_PASTE_SERVICE_KEY, type ContentDetector, type DetectionResult, type SmartPasteConfig, type SmartPasteService, } from './SmartPasteTypes.js';
|
|
3
|
+
export type { SmartPasteLocale } from './SmartPasteLocale.js';
|
|
4
|
+
export { SMART_PASTE_LOCALE_EN, loadSmartPasteLocale } from './SmartPasteLocale.js';
|
|
5
|
+
export { JsonDetector } from './detectors/JsonDetector.js';
|
|
6
|
+
export { XmlDetector } from './detectors/XmlDetector.js';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/smart-paste/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EACN,uBAAuB,EACvB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,GACtB,MAAM,sBAAsB,CAAC;AAE9B,YAAY,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AACpF,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ar.d.ts","sourceRoot":"","sources":["../../../../src/plugins/smart-paste/locales/ar.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE/D,QAAA,MAAM,MAAM,EAAE,gBAEb,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"de.d.ts","sourceRoot":"","sources":["../../../../src/plugins/smart-paste/locales/de.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE/D,QAAA,MAAM,MAAM,EAAE,gBAGb,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"es.d.ts","sourceRoot":"","sources":["../../../../src/plugins/smart-paste/locales/es.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE/D,QAAA,MAAM,MAAM,EAAE,gBAGb,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fr.d.ts","sourceRoot":"","sources":["../../../../src/plugins/smart-paste/locales/fr.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE/D,QAAA,MAAM,MAAM,EAAE,gBAGb,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hi.d.ts","sourceRoot":"","sources":["../../../../src/plugins/smart-paste/locales/hi.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE/D,QAAA,MAAM,MAAM,EAAE,gBAGb,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pt.d.ts","sourceRoot":"","sources":["../../../../src/plugins/smart-paste/locales/pt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE/D,QAAA,MAAM,MAAM,EAAE,gBAGb,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ru.d.ts","sourceRoot":"","sources":["../../../../src/plugins/smart-paste/locales/ru.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE/D,QAAA,MAAM,MAAM,EAAE,gBAGb,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zh.d.ts","sourceRoot":"","sources":["../../../../src/plugins/smart-paste/locales/zh.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE/D,QAAA,MAAM,MAAM,EAAE,gBAEb,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{e as t,i as e}from"../chunks/BlockInsertion-BJFhE0jA.mjs";import{g as s}from"../chunks/Commands-D_gMCnVa.mjs";import{s as n,c as o,e as c}from"../chunks/Document-3pNX7ear.mjs";import{j as r,i,c as l}from"../chunks/Selection-DhbizDM4.mjs";import{n as a}from"../chunks/TypeBrands-Bp_Z_o5Y.mjs";import{S as u,r as h}from"../chunks/PluginHelpers-CdPR0MuT.mjs";import{a as m,X as d}from"../chunks/XmlPatterns-DxQXGjP8.mjs";const f={detectedAsCodeBlock:t=>`Pasted as ${t} code block with syntax highlighting.`},p=/* @__PURE__ */Object.assign({"./locales/ar.ts":()=>import("../chunks/ar-b6VdnxAs.mjs"),"./locales/de.ts":()=>import("../chunks/de-fXvs5vQT.mjs"),"./locales/es.ts":()=>import("../chunks/es-BTqy_aQ4.mjs"),"./locales/fr.ts":()=>import("../chunks/fr-VdiCNF4J.mjs"),"./locales/hi.ts":()=>import("../chunks/hi-BdtVhAzs.mjs"),"./locales/pt.ts":()=>import("../chunks/pt-K0BUlM9X.mjs"),"./locales/ru.ts":()=>import("../chunks/ru-Tzd5N37W.mjs"),"./locales/zh.ts":()=>import("../chunks/zh-Di3WqY4_.mjs")});async function g(t){if("en"===t)return f;const e=p[`./locales/${t}.ts`];if(!e)return f;try{return(await e()).default}catch{return f}}const k=new u("smartPaste");class x{id="json";detect(t){const e=t.trim();if(!e.startsWith("{")&&!e.startsWith("["))return null;try{const t=JSON.parse(e);if("object"!=typeof t||null===t)return null;const s=JSON.stringify(t,null,2);return s.length<=5?null:{language:"json",formattedText:s,confidence:.9}}catch{return null}}}const j=/^(<\?[\s\S]*?\?>\s*)+/,C=new RegExp(`^<${m}${d}\\/?>`),b=new RegExp(["<\\?[^?]*\\?>","\x3c!--[\\s\\S]*?--\x3e","<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",`<\\/(${m})>`,`<(${m})${d}\\/>`,`<(${m})${d}>`].join("|"),"g"),y=new RegExp(`<\\/${m}>\\s*$`);class W{id="xml";detect(t){const e=t.trim();if(!e.startsWith("<"))return null;const s=e.replace(j,"");if(!C.test(s))return null;if(!this.isWellFormed(e))return null;const n=this.formatXml(e);return n.length<=10?null:{language:"xml",formattedText:n,confidence:.85}}isWellFormed(t){const e=[];let s=!1;b.lastIndex=0;let n=b.exec(t);for(;n;){const o=n[1],c=n[2],r=n[3];if(o){if(0===e.length||e[e.length-1]!==o)return!1;e.pop(),s=!0}else c?s=!0:r&&(e.push(r),s=!0);n=b.exec(t)}return s&&0===e.length}formatXml(t){const e=this.splitIntoTokens(t),s=[];let n=0;for(const o of e){const t=T(o),e=S[t];"decrease"===e&&(n=Math.max(0,n-1)),s.push(" ".repeat(2*n)+o),"increase"===e&&n++}return s.join("\n")}splitIntoTokens(t){return t.replace(/>\s*</g,">\n<").split("\n").map(t=>t.trim()).filter(t=>t.length>0)}}const S={pi:"none",comment:"none",cdata:"none",closing:"decrease",selfClosing:"none",inline:"none",opening:"increase",text:"none"};function T(t){return t.startsWith("<?")?"pi":t.startsWith("\x3c!--")?"comment":t.startsWith("<![CDATA[")?"cdata":t.startsWith("</")?"closing":t.endsWith("/>")?"selfClosing":t.startsWith("<")&&y.test(t)?"inline":t.startsWith("<")?"opening":"text"}class ${id="smart-paste";name="Smart Paste";dependencies=["code-block"];config;detectors=[];context=null;locale=f;constructor(t){this.config={...t}}async init(t){if(this.context=t,this.locale=await h(t,this.config.locale,f,g),this.detectors.push(new x),this.detectors.push(new W),this.config.detectors)for(const e of this.config.detectors)this.detectors.push(e);t.registerPasteInterceptor(this.handlePaste,{name:"smart-paste",priority:50}),t.registerService(k,{registerDetector:t=>{this.detectors.push(t)}})}destroy(){this.context=null,this.detectors.length=0}handlePaste=(t,e,s)=>{if(this.isCursorInCodeBlock(s))return null;const n=this.detectContent(t);if(!n)return null;const o=this.buildCodeBlockTransaction(s,n);return o&&this.context&&this.context.announce(this.locale.detectedAsCodeBlock(n.language)),o};detectContent(t){let e=null;for(const s of this.detectors){const n=s.detect(t);n&&(null===e||n.confidence>e.confidence)&&(e=n)}return e}isCursorInCodeBlock(t){const e=t.selection;if(!r(e))return!1;const s=t.getBlock(e.anchor.blockId);return"code_block"===s?.type}buildCodeBlockTransaction(u,h){const m=u.selection,d=u.transaction("paste");let f;f=r(m)&&!i(m)?s(u,d)??m.anchor.blockId:t(m);const p=n(),g=o(a("code_block"),[c(h.formattedText)],p,{language:h.language,backgroundColor:""});return e(u,d,f,g,m,this.context?.getSchemaRegistry())?(d.setSelection(l(p,h.formattedText.length)),d.build()):null}}export{x as JsonDetector,f as SMART_PASTE_LOCALE_EN,k as SMART_PASTE_SERVICE_KEY,$ as SmartPastePlugin,W as XmlDetector,g as loadSmartPasteLocale};
|
|
2
|
+
//# sourceMappingURL=smart-paste.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"smart-paste.mjs","sources":["../../src/plugins/smart-paste/SmartPasteLocale.ts","../../src/plugins/smart-paste/SmartPasteTypes.ts","../../src/plugins/smart-paste/detectors/JsonDetector.ts","../../src/plugins/smart-paste/detectors/XmlDetector.ts","../../src/plugins/smart-paste/SmartPastePlugin.ts"],"sourcesContent":["/** Locale interface and default English locale for the SmartPastePlugin. */\n\nexport interface SmartPasteLocale {\n\treadonly detectedAsCodeBlock: (language: string) => string;\n}\n\nexport const SMART_PASTE_LOCALE_EN: SmartPasteLocale = {\n\tdetectedAsCodeBlock: (language: string) =>\n\t\t`Pasted as ${language} code block with syntax highlighting.`,\n};\n\nconst localeModules: Record<string, () => Promise<{ default: SmartPasteLocale }>> =\n\timport.meta.glob<{ default: SmartPasteLocale }>('./locales/*.ts', { eager: false });\n\nexport async function loadSmartPasteLocale(lang: string): Promise<SmartPasteLocale> {\n\tif (lang === 'en') return SMART_PASTE_LOCALE_EN;\n\tconst loader = localeModules[`./locales/${lang}.ts`];\n\tif (!loader) return SMART_PASTE_LOCALE_EN;\n\ttry {\n\t\tconst mod = await loader();\n\t\treturn mod.default;\n\t} catch {\n\t\treturn SMART_PASTE_LOCALE_EN;\n\t}\n}\n","/**\n * Types for the smart paste plugin — content detection and formatting.\n */\n\nimport { ServiceKey } from '../Plugin.js';\nimport type { SmartPasteLocale } from './SmartPasteLocale.js';\n\n/** Result of detecting structured content in pasted text. */\nexport interface DetectionResult {\n\treadonly language: string;\n\treadonly formattedText: string;\n\treadonly confidence: number;\n}\n\n/** Interface for content detectors that identify and format pasted text. */\nexport interface ContentDetector {\n\treadonly id: string;\n\tdetect(text: string): DetectionResult | null;\n}\n\n/** Configuration for the SmartPastePlugin. */\nexport interface SmartPasteConfig {\n\treadonly detectors?: readonly ContentDetector[];\n\treadonly locale?: SmartPasteLocale;\n}\n\n/** Public service for registering additional content detectors at runtime. */\nexport interface SmartPasteService {\n\tregisterDetector(detector: ContentDetector): void;\n}\n\nexport const SMART_PASTE_SERVICE_KEY = new ServiceKey<SmartPasteService>('smartPaste');\n","/**\n * JSON content detector — validates and formats JSON for code block insertion.\n */\n\nimport type { ContentDetector, DetectionResult } from '../SmartPasteTypes.js';\n\n/** Minimum length for formatted JSON to be considered meaningful. */\nconst MIN_FORMATTED_LENGTH = 5;\n\n/** Confidence score for valid JSON detected via JSON.parse. */\nconst JSON_CONFIDENCE = 0.9;\n\nexport class JsonDetector implements ContentDetector {\n\treadonly id = 'json';\n\n\tdetect(text: string): DetectionResult | null {\n\t\tconst trimmed: string = text.trim();\n\t\tif (!trimmed.startsWith('{') && !trimmed.startsWith('[')) return null;\n\n\t\ttry {\n\t\t\tconst parsed: unknown = JSON.parse(trimmed);\n\t\t\tif (typeof parsed !== 'object' || parsed === null) return null;\n\n\t\t\tconst formatted: string = JSON.stringify(parsed, null, 2);\n\t\t\tif (formatted.length <= MIN_FORMATTED_LENGTH) return null;\n\n\t\t\treturn { language: 'json', formattedText: formatted, confidence: JSON_CONFIDENCE };\n\t\t} catch {\n\t\t\treturn null;\n\t\t}\n\t}\n}\n","/**\n * XML content detector — validates and formats XML for code block insertion.\n */\n\nimport { XML_ATTRS, XML_TAG_NAME } from '../../shared/XmlPatterns.js';\nimport type { ContentDetector, DetectionResult } from '../SmartPasteTypes.js';\n\n/** Minimum length for formatted XML to be considered meaningful. */\nconst MIN_FORMATTED_LENGTH = 10;\n\n/** Confidence score for valid XML detected via structural analysis. */\nconst XML_CONFIDENCE = 0.85;\n\n/** Matches any leading processing instructions like <?xml ...?> or <?xml-stylesheet ...?> */\nconst LEADING_PIS_PATTERN = /^(<\\?[\\s\\S]*?\\?>\\s*)+/;\n\n/** Matches an opening tag like <root> or <ns:tag attr=\"val\"> */\nconst OPENING_TAG_PATTERN = new RegExp(`^<${XML_TAG_NAME}${XML_ATTRS}\\\\/?>`);\n\n// --- Well-formedness regex (decomposed for readability) ---\n\nconst PI_FRAGMENT = '<\\\\?[^?]*\\\\?>';\nconst COMMENT_FRAGMENT = '<!--[\\\\s\\\\S]*?-->';\nconst CDATA_FRAGMENT = '<!\\\\[CDATA\\\\[[\\\\s\\\\S]*?\\\\]\\\\]>';\nconst CLOSING_TAG_FRAGMENT = `<\\\\/(${XML_TAG_NAME})>`;\nconst SELF_CLOSING_TAG_FRAGMENT = `<(${XML_TAG_NAME})${XML_ATTRS}\\\\/>`;\nconst OPENING_TAG_FRAGMENT = `<(${XML_TAG_NAME})${XML_ATTRS}>`;\n\nconst WELL_FORMED_TAG_PATTERN = new RegExp(\n\t[\n\t\tPI_FRAGMENT,\n\t\tCOMMENT_FRAGMENT,\n\t\tCDATA_FRAGMENT,\n\t\tCLOSING_TAG_FRAGMENT,\n\t\tSELF_CLOSING_TAG_FRAGMENT,\n\t\tOPENING_TAG_FRAGMENT,\n\t].join('|'),\n\t'g',\n);\n\n/** Matches an inline element where open + close tag appear on the same token. */\nconst INLINE_ELEMENT_PATTERN = new RegExp(`<\\\\/${XML_TAG_NAME}>\\\\s*$`);\n\n/**\n * Detects well-formed XML content and formats it with proper indentation.\n *\n * Detection strategy:\n * 1. Text must start with `<` (after trimming)\n * 2. Must begin with an XML declaration, processing instruction, or opening tag\n * 3. All opened tags must be properly closed (basic well-formedness check)\n * 4. Must contain at least one tag pair or self-closing tag\n */\nexport class XmlDetector implements ContentDetector {\n\treadonly id = 'xml';\n\n\tdetect(text: string): DetectionResult | null {\n\t\tconst trimmed: string = text.trim();\n\t\tif (!trimmed.startsWith('<')) return null;\n\n\t\t// Quick structural check: strip leading PIs, then must start with an opening tag\n\t\tconst remainder: string = trimmed.replace(LEADING_PIS_PATTERN, '');\n\t\tif (!OPENING_TAG_PATTERN.test(remainder)) return null;\n\n\t\t// Validate well-formedness via tag balancing\n\t\tif (!this.isWellFormed(trimmed)) return null;\n\n\t\tconst formatted: string = this.formatXml(trimmed);\n\t\tif (formatted.length <= MIN_FORMATTED_LENGTH) return null;\n\n\t\treturn { language: 'xml', formattedText: formatted, confidence: XML_CONFIDENCE };\n\t}\n\n\t/**\n\t * Checks basic XML well-formedness by verifying that all opened tags\n\t * are properly closed in the correct nesting order.\n\t */\n\tprivate isWellFormed(xml: string): boolean {\n\t\tconst tagStack: string[] = [];\n\t\tlet foundTag = false;\n\n\t\t// Reset lastIndex — RegExp with 'g' flag is stateful\n\t\tWELL_FORMED_TAG_PATTERN.lastIndex = 0;\n\t\tlet match: RegExpExecArray | null = WELL_FORMED_TAG_PATTERN.exec(xml);\n\n\t\twhile (match) {\n\t\t\tconst closingTag: string | undefined = match[1];\n\t\t\tconst selfClosingTag: string | undefined = match[2];\n\t\t\tconst openingTag: string | undefined = match[3];\n\n\t\t\tif (closingTag) {\n\t\t\t\tif (tagStack.length === 0 || tagStack[tagStack.length - 1] !== closingTag) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\ttagStack.pop();\n\t\t\t\tfoundTag = true;\n\t\t\t} else if (selfClosingTag) {\n\t\t\t\tfoundTag = true;\n\t\t\t} else if (openingTag) {\n\t\t\t\ttagStack.push(openingTag);\n\t\t\t\tfoundTag = true;\n\t\t\t}\n\n\t\t\tmatch = WELL_FORMED_TAG_PATTERN.exec(xml);\n\t\t}\n\n\t\treturn foundTag && tagStack.length === 0;\n\t}\n\n\t/**\n\t * Formats XML with consistent 2-space indentation.\n\t */\n\tprivate formatXml(xml: string): string {\n\t\tconst tokens: string[] = this.splitIntoTokens(xml);\n\t\tconst parts: string[] = [];\n\t\tlet indent = 0;\n\t\tconst INDENT_STEP = 2;\n\n\t\tfor (const token of tokens) {\n\t\t\tconst kind: XmlTokenKind = classifyXmlToken(token);\n\t\t\tconst indentChange: IndentChange = INDENT_BEHAVIOR[kind];\n\n\t\t\tif (indentChange === 'decrease') {\n\t\t\t\tindent = Math.max(0, indent - 1);\n\t\t\t}\n\n\t\t\tparts.push(' '.repeat(indent * INDENT_STEP) + token);\n\n\t\t\tif (indentChange === 'increase') {\n\t\t\t\tindent++;\n\t\t\t}\n\t\t}\n\n\t\treturn parts.join('\\n');\n\t}\n\n\t/** Splits XML into line-level tokens by breaking between adjacent tags. */\n\tprivate splitIntoTokens(xml: string): string[] {\n\t\treturn xml\n\t\t\t.replace(/>\\s*</g, '>\\n<')\n\t\t\t.split('\\n')\n\t\t\t.map((line: string) => line.trim())\n\t\t\t.filter((line: string) => line.length > 0);\n\t}\n}\n\n// --- Token Classification ---\n\ntype XmlTokenKind =\n\t| 'pi'\n\t| 'comment'\n\t| 'cdata'\n\t| 'closing'\n\t| 'selfClosing'\n\t| 'inline'\n\t| 'opening'\n\t| 'text';\ntype IndentChange = 'increase' | 'decrease' | 'none';\n\nconst INDENT_BEHAVIOR: Readonly<Record<XmlTokenKind, IndentChange>> = {\n\tpi: 'none',\n\tcomment: 'none',\n\tcdata: 'none',\n\tclosing: 'decrease',\n\tselfClosing: 'none',\n\tinline: 'none',\n\topening: 'increase',\n\ttext: 'none',\n};\n\nfunction classifyXmlToken(token: string): XmlTokenKind {\n\tif (token.startsWith('<?')) return 'pi';\n\tif (token.startsWith('<!--')) return 'comment';\n\tif (token.startsWith('<![CDATA[')) return 'cdata';\n\tif (token.startsWith('</')) return 'closing';\n\tif (token.endsWith('/>')) return 'selfClosing';\n\tif (token.startsWith('<') && INLINE_ELEMENT_PATTERN.test(token)) return 'inline';\n\tif (token.startsWith('<')) return 'opening';\n\treturn 'text';\n}\n","/**\n * SmartPastePlugin: detects structured content in clipboard text\n * and inserts it as formatted code blocks with syntax highlighting.\n */\n\nimport { insertBlockAfterAnchor, resolveAnchorBlockId } from '../../commands/BlockInsertion.js';\nimport { addDeleteSelectionSteps } from '../../commands/Commands.js';\nimport {\n\ttype BlockNode,\n\tcreateBlockNode,\n\tcreateTextNode,\n\tgenerateBlockId,\n} from '../../model/Document.js';\nimport { createCollapsedSelection, isCollapsed, isTextSelection } from '../../model/Selection.js';\nimport type { BlockId, NodeTypeName } from '../../model/TypeBrands.js';\nimport { nodeType } from '../../model/TypeBrands.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { Transaction } from '../../state/Transaction.js';\nimport type { PasteInterceptor, Plugin, PluginContext } from '../Plugin.js';\nimport { resolveLocale } from '../shared/PluginHelpers.js';\nimport {\n\tSMART_PASTE_LOCALE_EN,\n\ttype SmartPasteLocale,\n\tloadSmartPasteLocale,\n} from './SmartPasteLocale.js';\nimport type { ContentDetector, DetectionResult, SmartPasteConfig } from './SmartPasteTypes.js';\nimport { SMART_PASTE_SERVICE_KEY } from './SmartPasteTypes.js';\nimport { JsonDetector } from './detectors/JsonDetector.js';\nimport { XmlDetector } from './detectors/XmlDetector.js';\n\nexport class SmartPastePlugin implements Plugin {\n\treadonly id = 'smart-paste';\n\treadonly name = 'Smart Paste';\n\treadonly dependencies = ['code-block'] as const;\n\n\tprivate readonly config: SmartPasteConfig;\n\tprivate readonly detectors: ContentDetector[] = [];\n\tprivate context: PluginContext | null = null;\n\tprivate locale: SmartPasteLocale = SMART_PASTE_LOCALE_EN;\n\n\tconstructor(config?: Partial<SmartPasteConfig>) {\n\t\tthis.config = { ...config };\n\t}\n\n\tasync init(context: PluginContext): Promise<void> {\n\t\tthis.context = context;\n\n\t\tthis.locale = await resolveLocale(\n\t\t\tcontext,\n\t\t\tthis.config.locale,\n\t\t\tSMART_PASTE_LOCALE_EN,\n\t\t\tloadSmartPasteLocale,\n\t\t);\n\n\t\t// Register built-in detectors\n\t\tthis.detectors.push(new JsonDetector());\n\t\tthis.detectors.push(new XmlDetector());\n\n\t\t// Register config-provided detectors\n\t\tif (this.config.detectors) {\n\t\t\tfor (const detector of this.config.detectors) {\n\t\t\t\tthis.detectors.push(detector);\n\t\t\t}\n\t\t}\n\n\t\t// Register paste interceptor\n\t\tcontext.registerPasteInterceptor(this.handlePaste, { name: 'smart-paste', priority: 50 });\n\n\t\t// Register service for external detector registration\n\t\tcontext.registerService(SMART_PASTE_SERVICE_KEY, {\n\t\t\tregisterDetector: (detector: ContentDetector) => {\n\t\t\t\tthis.detectors.push(detector);\n\t\t\t},\n\t\t});\n\t}\n\n\tdestroy(): void {\n\t\tthis.context = null;\n\t\tthis.detectors.length = 0;\n\t}\n\n\t// --- Paste Interceptor ---\n\n\tprivate readonly handlePaste: PasteInterceptor = (\n\t\tplainText: string,\n\t\t_html: string,\n\t\tstate: EditorState,\n\t): Transaction | null => {\n\t\t// Don't create nested code blocks\n\t\tif (this.isCursorInCodeBlock(state)) return null;\n\n\t\t// Run all detectors and pick the highest confidence result\n\t\tconst detection: DetectionResult | null = this.detectContent(plainText);\n\t\tif (!detection) return null;\n\n\t\tconst tr: Transaction | null = this.buildCodeBlockTransaction(state, detection);\n\t\tif (tr && this.context) {\n\t\t\tthis.context.announce(this.locale.detectedAsCodeBlock(detection.language));\n\t\t}\n\t\treturn tr;\n\t};\n\n\tprivate detectContent(text: string): DetectionResult | null {\n\t\tlet best: DetectionResult | null = null;\n\n\t\tfor (const detector of this.detectors) {\n\t\t\tconst result: DetectionResult | null = detector.detect(text);\n\t\t\tif (result && (best === null || result.confidence > best.confidence)) {\n\t\t\t\tbest = result;\n\t\t\t}\n\t\t}\n\n\t\treturn best;\n\t}\n\n\tprivate isCursorInCodeBlock(state: EditorState): boolean {\n\t\tconst sel = state.selection;\n\t\tif (!isTextSelection(sel)) return false;\n\n\t\tconst block: BlockNode | undefined = state.getBlock(sel.anchor.blockId);\n\t\treturn block?.type === 'code_block';\n\t}\n\n\tprivate buildCodeBlockTransaction(\n\t\tstate: EditorState,\n\t\tdetection: DetectionResult,\n\t): Transaction | null {\n\t\tconst sel = state.selection;\n\t\tconst builder = state.transaction('paste');\n\n\t\t// Delete selection if range-selected\n\t\tlet anchorBlockId: BlockId;\n\t\tif (isTextSelection(sel) && !isCollapsed(sel)) {\n\t\t\tconst landingId: BlockId | undefined = addDeleteSelectionSteps(state, builder);\n\t\t\tanchorBlockId = landingId ?? sel.anchor.blockId;\n\t\t} else {\n\t\t\tanchorBlockId = resolveAnchorBlockId(sel);\n\t\t}\n\n\t\t// Create the code block node\n\t\tconst newBlockId: BlockId = generateBlockId();\n\t\tconst codeBlock: BlockNode = createBlockNode(\n\t\t\tnodeType('code_block') as NodeTypeName,\n\t\t\t[createTextNode(detection.formattedText)],\n\t\t\tnewBlockId,\n\t\t\t{ language: detection.language, backgroundColor: '' },\n\t\t);\n\n\t\t// Insert at cursor (handles cell vs root, empty anchor removal)\n\t\tconst inserted: boolean = insertBlockAfterAnchor(\n\t\t\tstate,\n\t\t\tbuilder,\n\t\t\tanchorBlockId,\n\t\t\tcodeBlock,\n\t\t\tsel,\n\t\t\tthis.context?.getSchemaRegistry(),\n\t\t);\n\t\tif (!inserted) return null;\n\n\t\tbuilder.setSelection(createCollapsedSelection(newBlockId, detection.formattedText.length));\n\n\t\treturn builder.build();\n\t}\n}\n"],"names":["SMART_PASTE_LOCALE_EN","detectedAsCodeBlock","language","localeModules","assign","import","async","loadSmartPasteLocale","lang","loader","default","SMART_PASTE_SERVICE_KEY","ServiceKey","JsonDetector","id","detect","text","trimmed","trim","startsWith","parsed","JSON","parse","formatted","stringify","length","formattedText","confidence","LEADING_PIS_PATTERN","OPENING_TAG_PATTERN","RegExp","XML_TAG_NAME","XML_ATTRS","WELL_FORMED_TAG_PATTERN","join","INLINE_ELEMENT_PATTERN","XmlDetector","remainder","replace","test","this","isWellFormed","formatXml","xml","tagStack","foundTag","lastIndex","match","exec","closingTag","selfClosingTag","openingTag","pop","push","tokens","splitIntoTokens","parts","indent","token","kind","classifyXmlToken","indentChange","INDENT_BEHAVIOR","Math","max","repeat","split","map","line","filter","pi","comment","cdata","closing","selfClosing","inline","opening","endsWith","SmartPastePlugin","name","dependencies","config","detectors","context","locale","constructor","init","resolveLocale","detector","registerPasteInterceptor","handlePaste","priority","registerService","registerDetector","destroy","plainText","_html","state","isCursorInCodeBlock","detection","detectContent","tr","buildCodeBlockTransaction","announce","best","result","sel","selection","isTextSelection","block","getBlock","anchor","blockId","type","builder","transaction","anchorBlockId","isCollapsed","addDeleteSelectionSteps","resolveAnchorBlockId","newBlockId","generateBlockId","codeBlock","createBlockNode","nodeType","createTextNode","backgroundColor","insertBlockAfterAnchor","getSchemaRegistry","setSelection","createCollapsedSelection","build"],"mappings":"yaAMO,MAAMA,EAA0C,CACtDC,oBAAsBC,GACrB,aAAaA,0CAGTC,wBACLC,OAAA,CAAA,kBAAA,IAAAC,OAAA,6BAAA,kBAAA,IAAAA,OAAA,6BAAA,kBAAA,IAAAA,OAAA,6BAAA,kBAAA,IAAAA,OAAA,6BAAA,kBAAA,IAAAA,OAAA,6BAAA,kBAAA,IAAAA,OAAA,6BAAA,kBAAA,IAAAA,OAAA,6BAAA,kBAAA,IAAAA,OAAA,+BAEDC,eAAsBC,EAAqBC,GAC1C,GAAa,OAATA,EAAe,OAAOR,EAC1B,MAAMS,EAASN,EAAc,aAAaK,QAC1C,IAAKC,EAAQ,OAAOT,EACpB,IAEC,aADkBS,KACPC,OACZ,CAAA,MACC,OAAOV,CACR,CACD,CCOO,MAAMW,EAA0B,IAAIC,EAA8B,cCnBlE,MAAMC,EACHC,GAAK,OAEd,MAAAC,CAAOC,GACN,MAAMC,EAAkBD,EAAKE,OAC7B,IAAKD,EAAQE,WAAW,OAASF,EAAQE,WAAW,KAAM,OAAO,KAEjE,IACC,MAAMC,EAAkBC,KAAKC,MAAML,GACnC,GAAsB,iBAAXG,GAAkC,OAAXA,EAAiB,OAAO,KAE1D,MAAMG,EAAoBF,KAAKG,UAAUJ,EAAQ,KAAM,GACvD,OAAIG,EAAUE,QAjBY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IACtBC,EAAuBC,EAC5BC,EAAS,cACT,CAACC,EAAe1B,EAAUzE,gBAC1B8F,EACA,CAAEtH,SAAUiG,EAAUjG,SAAU4H,gBAAiB,KAYlD,OAR0BC,EACzB9B,EACAiB,EACAE,EACAM,EACAhB,EACAlE,KAAK2C,SAAS6C,sBAIfd,EAAQe,aAAaC,EAAyBV,EAAYrB,EAAUzE,cAAcD,SAE3EyF,EAAQiB,SAJO,IAKvB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StrikethroughPlugin.d.ts","sourceRoot":"","sources":["../../../src/plugins/strikethrough/StrikethroughPlugin.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"StrikethroughPlugin.d.ts","sourceRoot":"","sources":["../../../src/plugins/strikethrough/StrikethroughPlugin.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAG1D,OAAO,EAEN,KAAK,mBAAmB,EAExB,MAAM,0BAA0B,CAAC;AAIlC,OAAO,QAAQ,6BAA6B,CAAC;IAC5C,UAAU,gBAAgB;QACzB,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;KACrC;CACD;AAID,MAAM,WAAW,mBAAmB;IACnC,QAAQ,CAAC,MAAM,CAAC,EAAE,mBAAmB,CAAC;CACtC;AAMD,qBAAa,mBAAoB,YAAW,MAAM;IACjD,QAAQ,CAAC,EAAE,mBAAmB;IAC9B,QAAQ,CAAC,IAAI,mBAAmB;IAChC,QAAQ,CAAC,QAAQ,MAAM;IAEvB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAsB;IAC7C,OAAO,CAAC,MAAM,CAAuB;gBAEzB,MAAM,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC;IAI3C,IAAI,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAajD,OAAO,CAAC,gBAAgB;IAuBxB,OAAO,CAAC,eAAe;IAWvB,OAAO,CAAC,cAAc;IAMtB,OAAO,CAAC,mBAAmB;CAc3B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{m as t}from"../chunks/TypeBrands-Bp_Z_o5Y.mjs";import{r as s}from"../chunks/PluginHelpers-CdPR0MuT.mjs";import{f as r}from"../chunks/ShortcutFormatting-BLKS0Gys.mjs";import{c as e,i as o}from"../chunks/MarkCommands-CeCa4WSC.mjs";const i={label:"Strikethrough",tooltip:t=>`Strikethrough (${t})`},a=/* @__PURE__ */Object.assign({"./locales/ar.ts":()=>import("../chunks/ar-Ds6Z2Gzf.mjs"),"./locales/de.ts":()=>import("../chunks/de-CtFvAXwF.mjs"),"./locales/es.ts":()=>import("../chunks/es-CFjzqIbS.mjs"),"./locales/fr.ts":()=>import("../chunks/fr-BoRJ3B2-.mjs"),"./locales/hi.ts":()=>import("../chunks/hi-Ga9h9a_1.mjs"),"./locales/pt.ts":()=>import("../chunks/pt-CFjzqIbS.mjs"),"./locales/ru.ts":()=>import("../chunks/ru-BgBctNVm.mjs"),"./locales/zh.ts":()=>import("../chunks/zh-C3aI7A2o.mjs")});async function h(t){if("en"===t)return i;const s=a[`./locales/${t}.ts`];if(!s)return i;try{return(await s()).default}catch{return i}}const c={};class l{id="strikethrough";name="Strikethrough";priority=22;config;locale;constructor(t){this.config={...c,...t}}async init(t){this.locale=await s(t,this.config.locale,i,h),this.registerMarkSpec(t),this.registerCommand(t),this.registerKeymap(t),this.registerToolbarItem(t)}registerMarkSpec(t){t.registerMarkSpec({type:"strikethrough",rank:3,toDOM:()=>document.createElement("s"),toHTMLString:(t,s)=>`<s>${s}</s>`,parseHTML:[{tag:"s"},{tag:"strike"},{tag:"del"},{tag:"span",getAttrs:t=>!!t.style.textDecoration.includes("line-through")&&{}}],sanitize:{tags:["s"]}})}registerCommand(s){s.registerCommand("toggleStrikethrough",()=>{const r=e(s.getState(),t("strikethrough"));return!!r&&(s.dispatch(r),!0)})}registerKeymap(t){t.registerKeymap({"Mod-Shift-X":()=>t.executeCommand("toggleStrikethrough")})}registerToolbarItem(s){s.registerToolbarItem({id:"strikethrough",group:"format",icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M10 19h4v-3h-4v3zM5 4v3h5v3h4V7h5V4H5zM3 14h18v-2H3v2z"/></svg>',label:this.locale.label,tooltip:this.locale.tooltip(r("Mod-Shift-X")),command:"toggleStrikethrough",isActive:s=>o(s,t("strikethrough"))})}}export{i as STRIKETHROUGH_LOCALE_EN,l as StrikethroughPlugin,h as loadStrikethroughLocale};
|
|
2
2
|
//# sourceMappingURL=strikethrough.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"strikethrough.mjs","sources":["../../src/plugins/strikethrough/StrikethroughLocale.ts","../../src/plugins/strikethrough/StrikethroughPlugin.ts"],"sourcesContent":["/**\n * Locale interface and default English locale for the StrikethroughPlugin.\n */\n\n// --- Locale Interface ---\n\nexport interface StrikethroughLocale {\n\treadonly label: string;\n\treadonly tooltip: (shortcut: string) => string;\n}\n\n// --- Default English Locale ---\n\nexport const STRIKETHROUGH_LOCALE_EN: StrikethroughLocale = {\n\tlabel: 'Strikethrough',\n\ttooltip: (shortcut: string) => `Strikethrough (${shortcut})`,\n};\n\n// --- Lazy Locale Loader ---\n\nconst localeModules: Record<string, () => Promise<{ default: StrikethroughLocale }>> =\n\timport.meta.glob<{ default: StrikethroughLocale }>('./locales/*.ts', { eager: false });\n\nexport async function loadStrikethroughLocale(lang: string): Promise<StrikethroughLocale> {\n\tif (lang === 'en') return STRIKETHROUGH_LOCALE_EN;\n\tconst loader = localeModules[`./locales/${lang}.ts`];\n\tif (!loader) return STRIKETHROUGH_LOCALE_EN;\n\ttry {\n\t\tconst mod = await loader();\n\t\treturn mod.default;\n\t} catch {\n\t\treturn STRIKETHROUGH_LOCALE_EN;\n\t}\n}\n","/**\n * StrikethroughPlugin: registers a strikethrough inline mark with MarkSpec,\n * toggle command, keyboard shortcut (Mod-Shift-X), and a toolbar button.\n */\n\nimport { isMarkActive, toggleMark } from '../../commands/Commands.js';\nimport {
|
|
1
|
+
{"version":3,"file":"strikethrough.mjs","sources":["../../src/plugins/strikethrough/StrikethroughLocale.ts","../../src/plugins/strikethrough/StrikethroughPlugin.ts"],"sourcesContent":["/**\n * Locale interface and default English locale for the StrikethroughPlugin.\n */\n\n// --- Locale Interface ---\n\nexport interface StrikethroughLocale {\n\treadonly label: string;\n\treadonly tooltip: (shortcut: string) => string;\n}\n\n// --- Default English Locale ---\n\nexport const STRIKETHROUGH_LOCALE_EN: StrikethroughLocale = {\n\tlabel: 'Strikethrough',\n\ttooltip: (shortcut: string) => `Strikethrough (${shortcut})`,\n};\n\n// --- Lazy Locale Loader ---\n\nconst localeModules: Record<string, () => Promise<{ default: StrikethroughLocale }>> =\n\timport.meta.glob<{ default: StrikethroughLocale }>('./locales/*.ts', { eager: false });\n\nexport async function loadStrikethroughLocale(lang: string): Promise<StrikethroughLocale> {\n\tif (lang === 'en') return STRIKETHROUGH_LOCALE_EN;\n\tconst loader = localeModules[`./locales/${lang}.ts`];\n\tif (!loader) return STRIKETHROUGH_LOCALE_EN;\n\ttry {\n\t\tconst mod = await loader();\n\t\treturn mod.default;\n\t} catch {\n\t\treturn STRIKETHROUGH_LOCALE_EN;\n\t}\n}\n","/**\n * StrikethroughPlugin: registers a strikethrough inline mark with MarkSpec,\n * toggle command, keyboard shortcut (Mod-Shift-X), and a toolbar button.\n */\n\nimport { isMarkActive, toggleMark } from '../../commands/Commands.js';\nimport { markType } from '../../model/TypeBrands.js';\nimport type { Plugin, PluginContext } from '../Plugin.js';\nimport { resolveLocale } from '../shared/PluginHelpers.js';\nimport { formatShortcut } from '../shared/ShortcutFormatting.js';\nimport {\n\tSTRIKETHROUGH_LOCALE_EN,\n\ttype StrikethroughLocale,\n\tloadStrikethroughLocale,\n} from './StrikethroughLocale.js';\n\n// --- Attribute Registry Augmentation ---\n\ndeclare module '../../model/AttrRegistry.js' {\n\tinterface MarkAttrRegistry {\n\t\tstrikethrough: Record<string, never>;\n\t}\n}\n\n// --- Configuration ---\n\nexport interface StrikethroughConfig {\n\treadonly locale?: StrikethroughLocale;\n}\n\nconst DEFAULT_CONFIG: StrikethroughConfig = {};\n\n// --- Plugin ---\n\nexport class StrikethroughPlugin implements Plugin {\n\treadonly id = 'strikethrough';\n\treadonly name = 'Strikethrough';\n\treadonly priority = 22;\n\n\tprivate readonly config: StrikethroughConfig;\n\tprivate locale!: StrikethroughLocale;\n\n\tconstructor(config?: Partial<StrikethroughConfig>) {\n\t\tthis.config = { ...DEFAULT_CONFIG, ...config };\n\t}\n\n\tasync init(context: PluginContext): Promise<void> {\n\t\tthis.locale = await resolveLocale(\n\t\t\tcontext,\n\t\t\tthis.config.locale,\n\t\t\tSTRIKETHROUGH_LOCALE_EN,\n\t\t\tloadStrikethroughLocale,\n\t\t);\n\t\tthis.registerMarkSpec(context);\n\t\tthis.registerCommand(context);\n\t\tthis.registerKeymap(context);\n\t\tthis.registerToolbarItem(context);\n\t}\n\n\tprivate registerMarkSpec(context: PluginContext): void {\n\t\tcontext.registerMarkSpec({\n\t\t\ttype: 'strikethrough',\n\t\t\trank: 3,\n\t\t\ttoDOM() {\n\t\t\t\treturn document.createElement('s');\n\t\t\t},\n\t\t\ttoHTMLString: (_mark, content) => `<s>${content}</s>`,\n\t\t\tparseHTML: [\n\t\t\t\t{ tag: 's' },\n\t\t\t\t{ tag: 'strike' },\n\t\t\t\t{ tag: 'del' },\n\t\t\t\t{\n\t\t\t\t\ttag: 'span',\n\t\t\t\t\tgetAttrs: (el: HTMLElement) => {\n\t\t\t\t\t\treturn el.style.textDecoration.includes('line-through') ? {} : false;\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t\tsanitize: { tags: ['s'] },\n\t\t});\n\t}\n\n\tprivate registerCommand(context: PluginContext): void {\n\t\tcontext.registerCommand('toggleStrikethrough', () => {\n\t\t\tconst tr = toggleMark(context.getState(), markType('strikethrough'));\n\t\t\tif (tr) {\n\t\t\t\tcontext.dispatch(tr);\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn false;\n\t\t});\n\t}\n\n\tprivate registerKeymap(context: PluginContext): void {\n\t\tcontext.registerKeymap({\n\t\t\t'Mod-Shift-X': () => context.executeCommand('toggleStrikethrough'),\n\t\t});\n\t}\n\n\tprivate registerToolbarItem(context: PluginContext): void {\n\t\tconst icon =\n\t\t\t'<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M10 19h4v-3h-4v3zM5 4v3h5v3h4V7h5V4H5zM3 14h18v-2H3v2z\"/></svg>';\n\n\t\tcontext.registerToolbarItem({\n\t\t\tid: 'strikethrough',\n\t\t\tgroup: 'format',\n\t\t\ticon,\n\t\t\tlabel: this.locale.label,\n\t\t\ttooltip: this.locale.tooltip(formatShortcut('Mod-Shift-X')),\n\t\t\tcommand: 'toggleStrikethrough',\n\t\t\tisActive: (state) => isMarkActive(state, markType('strikethrough')),\n\t\t});\n\t}\n}\n"],"names":["STRIKETHROUGH_LOCALE_EN","label","tooltip","shortcut","localeModules","assign","import","async","loadStrikethroughLocale","lang","loader","default","DEFAULT_CONFIG","StrikethroughPlugin","id","name","priority","config","locale","constructor","this","init","context","resolveLocale","registerMarkSpec","registerCommand","registerKeymap","registerToolbarItem","type","rank","toDOM","document","createElement","toHTMLString","_mark","content","parseHTML","tag","getAttrs","el","style","textDecoration","includes","sanitize","tags","tr","toggleMark","getState","markType","dispatch","executeCommand","group","icon","formatShortcut","command","isActive","state","isMarkActive"],"mappings":"4OAaO,MAAMA,EAA+C,CAC3DC,MAAO,gBACPC,QAAUC,GAAqB,kBAAkBA,MAK5CC,wBACLC,OAAA,CAAA,kBAAA,IAAAC,OAAA,6BAAA,kBAAA,IAAAA,OAAA,6BAAA,kBAAA,IAAAA,OAAA,6BAAA,kBAAA,IAAAA,OA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,GAI3BA,EAAQK,oBAAoB,CAC3Bb,GAAI,gBACJqC,MAAO,SACPC,KALA,uIAMAnD,MAAOmB,KAAKF,OAAOjB,MACnBC,QAASkB,KAAKF,OAAOhB,QAAQmD,EAAe,gBAC5CC,QAAS,sBACTC,SAAWC,GAAUC,EAAaD,EAAOR,EAAS,mBAEpD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SuperSubPlugin.d.ts","sourceRoot":"","sources":["../../../src/plugins/super-sub/SuperSubPlugin.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"SuperSubPlugin.d.ts","sourceRoot":"","sources":["../../../src/plugins/super-sub/SuperSubPlugin.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAQH,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAG1D,OAAO,EAAuB,KAAK,cAAc,EAAsB,MAAM,qBAAqB,CAAC;AAInG,OAAO,QAAQ,6BAA6B,CAAC;IAC5C,UAAU,gBAAgB;QACzB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QACnC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;KACjC;CACD;AAID,mDAAmD;AACnD,MAAM,WAAW,qBAAqB;IACrC,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;IAC/B,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,4EAA4E;AAC5E,MAAM,WAAW,cAAc;IAC9B,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,OAAO,CAAC,EAAE,qBAAqB,CAAC;IACzC,QAAQ,CAAC,MAAM,CAAC,EAAE,cAAc,CAAC;CACjC;AA4FD,qBAAa,cAAe,YAAW,MAAM;IAC5C,QAAQ,CAAC,EAAE,eAAe;IAC1B,QAAQ,CAAC,IAAI,6BAA6B;IAC1C,QAAQ,CAAC,QAAQ,MAAM;IAEvB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAiB;IACxC,OAAO,CAAC,MAAM,CAAkB;gBAEpB,MAAM,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC;IAItC,IAAI,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAqBjD,OAAO,CAAC,YAAY;IA2CpB,OAAO,CAAC,eAAe;IAWvB;;;;;OAKG;IACH,OAAO,CAAC,6BAA6B;IAoErC;;;OAGG;IACH,OAAO,CAAC,4BAA4B;IAsBpC,OAAO,CAAC,gBAAgB;CAIxB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{m as s}from"../chunks/TypeBrands-Bp_Z_o5Y.mjs";import{r as t,t as e}from"../chunks/PluginHelpers-CdPR0MuT.mjs";import{f as i}from"../chunks/ShortcutFormatting-BLKS0Gys.mjs";import{c as r,i as o}from"../chunks/MarkCommands-CeCa4WSC.mjs";const c={superscriptLabel:"Superscript",superscriptTooltip:s=>`Superscript (${s})`,subscriptLabel:"Subscript",subscriptTooltip:s=>`Subscript (${s})`},p=/* @__PURE__ */Object.assign({"./locales/ar.ts":()=>import("../chunks/ar-D9jyShaB.mjs"),"./locales/de.ts":()=>import("../chunks/de-ChcKkF7A.mjs"),"./locales/es.ts":()=>import("../chunks/es-Cud6JXHf.mjs"),"./locales/fr.ts":()=>import("../chunks/fr-zP7EjxDL.mjs"),"./locales/hi.ts":()=>import("../chunks/hi-CT5WERqi.mjs"),"./locales/pt.ts":()=>import("../chunks/pt--IiroJQw.mjs"),"./locales/ru.ts":()=>import("../chunks/ru-CiLrD2Nz.mjs"),"./locales/zh.ts":()=>import("../chunks/zh-Cmt7n9FY.mjs")});async function n(s){if("en"===s)return c;const t=p[`./locales/${s}.ts`];if(!t)return c;try{return(await t()).default}catch{return c}}const a={superscript:!0,subscript:!0},l=[{type:"superscript",opposite:"subscript",configKey:"superscript",rank:4,tag:"sup",icon:['<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">','<path d="M16 7.41L11.41 12 16 16.59 14.59 18l-6-6 6-6z"',' fill="none"/>','<path d="M9.64 7.64c.23-.5.36-1.05.36-1.64'," 0-2.21-1.79-4-4-4H2v14h4.36c2.34 0 4.24-1.9"," 4.24-4.24 0-1.6-.89-2.99-2.2-3.71zM4.5 4.5H6c.83"," 0 1.5.67 1.5 1.5S6.83 7.5 6 7.5H4.5v-3zm2 9H4.5v-3H6.5c.83",' 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5z" fill="none"/>','<path d="M15.97 3.84c0-.47.19-.91.53-1.21.34-.31.8-.49'," 1.3-.49.5 0 .95.18 1.28.48.32.3.5.7.51 1.15h1.59c-.02","-.96-.43-1.83-1.13-2.42C19.36.77 18.45.44 17.5.44c-.88"," 0-1.74.28-2.39.8-.67.53-1.06 1.28-1.06 2.1 0 .76.34"," 1.47.93 1.97.59.49 1.41.84 2.32 1.15.7.24 1.26.5 1.62.8.35.3.53.64.53"," 1.02 0 .48-.2.93-.55 1.24-.36.3-.84.48-1.37.48-.55 0-1.04-.2-1.39-.54","-.34-.33-.53-.8-.53-1.32h-1.58c.01 1.02.43 1.95 1.16 2.57.72.62 1.67.96"," 2.67.96.92 0 1.81-.3 2.46-.84.67-.56 1.04-1.33 1.04-2.18 0-.81-.36-1.56","-.99-2.08-.62-.51-1.48-.88-2.43-1.2-.67-.23-1.2-.47-1.52-.75-.32-.27-.46",'-.59-.46-.94z"/>','<path d="M5.88 20h2.66l3.4-5.42L15.3 20h2.67l-4.73-7.38',' 4.37-6.62h-2.6l-3.07 4.98L8.92 6h-2.6l4.26 6.58z"/>',"</svg>"].join(""),keyBinding:"Mod-.",toHTMLString:s=>`<sup>${s}</sup>`,parseHTML:[{tag:"sup"}],sanitize:{tags:["sup"]}},{type:"subscript",opposite:"superscript",configKey:"subscript",rank:4,tag:"sub",icon:['<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">','<path d="M15.97 16.84c0-.47.19-.91.53-1.21.34-.31.8-.49'," 1.3-.49.5 0 .95.18 1.28.48.32.3.5.7.51 1.15h1.59c-.02","-.96-.43-1.83-1.13-2.42-.7-.58-1.61-.91-2.56-.91-.88"," 0-1.74.28-2.39.8-.67.53-1.06 1.28-1.06 2.1 0 .76.34"," 1.47.93 1.97.59.49 1.41.84 2.32 1.15.7.24 1.26.5 1.62.8.35.3.53.64.53"," 1.02 0 .48-.2.93-.55 1.24-.36.3-.84.48-1.37.48-.55 0-1.04-.2-1.39-.54","-.34-.33-.53-.8-.53-1.32h-1.58c.01 1.02.43 1.95 1.16 2.57.72.62 1.67.96"," 2.67.96.92 0 1.81-.3 2.46-.84.67-.56 1.04-1.33 1.04-2.18 0-.81-.36-1.56","-.99-2.08-.62-.51-1.48-.88-2.43-1.2-.67-.23-1.2-.47-1.52-.75-.32-.27-.46",'-.59-.46-.94z"/>','<path d="M5.88 18h2.66l3.4-5.42L15.3 18h2.67l-4.73-7.38',' 4.37-6.62h-2.6l-3.07 4.98L8.92 4h-2.6l4.26 6.58z"/>',"</svg>"].join(""),keyBinding:"Mod-,",toHTMLString:s=>`<sub>${s}</sub>`,parseHTML:[{tag:"sub"}],sanitize:{tags:["sub"]}}];class u{id="super-sub";name="Superscript & Subscript";priority=23;config;locale;constructor(s){this.config={...a,...s}}async init(s){this.locale=await t(s,this.config.locale,c,n);const e=l.filter(s=>this.config[s.configKey]);for(const t of e)this.registerMark(s,t);this.registerKeymaps(s,e),this.registerExclusivityMiddleware(s,e),this.registerDisabledToolbarItems(s)}registerMark(t,c){const p=e(c.type),n=this.isToolbarVisible(c.configKey);if(t.registerMarkSpec({type:c.type,rank:c.rank,toDOM:()=>document.createElement(c.tag),toHTMLString:(s,t)=>c.toHTMLString(t),parseHTML:c.parseHTML,sanitize:c.sanitize}),t.registerCommand(p,()=>{const e=r(t.getState(),s(c.type));return!!e&&(t.dispatch(e),!0)}),n){const e="superscript"===c.type?this.locale.superscriptLabel:this.locale.subscriptLabel,r="superscript"===c.type?this.locale.superscriptTooltip(i(c.keyBinding)):this.locale.subscriptTooltip(i(c.keyBinding));t.registerToolbarItem({id:c.type,group:"format",icon:c.icon,label:e,tooltip:r,command:p,isActive:t=>o(t,s(c.type))})}}registerKeymaps(s,t){const i={};for(const r of t){const t=e(r.type);i[r.keyBinding]=()=>s.executeCommand(t)}Object.keys(i).length>0&&s.registerKeymap(i)}registerExclusivityMiddleware(t,e){e.some(s=>"superscript"===s.type)&&e.some(s=>"subscript"===s.type)&&t.registerMiddleware((t,e,i)=>{let r=!1;const o=[];for(const p of t.steps){if("addMark"!==p.type){o.push(p);continue}const t=p.mark.type,e=l.find(s=>s.type===t);if(!e){o.push(p);continue}r=!0;const i={type:"removeMark",blockId:p.blockId,from:p.from,to:p.to,mark:{type:s(e.opposite)},...p.path?{path:p.path}:{}};o.push(i,p)}let c=t.storedMarksAfter;if(c){const s=c.some(s=>"superscript"===s.type),t=c.some(s=>"subscript"===s.type);if(s&&t){const s=c.findLastIndex(s=>"superscript"===s.type)>c.findLastIndex(s=>"subscript"===s.type)?"subscript":"superscript";c=c.filter(t=>t.type!==s),r=!0}}i(r?{...t,steps:o,storedMarksAfter:c}:t)},{name:"super-sub:exclusivity"})}registerDisabledToolbarItems(s){if(this.config.toolbar)for(const t of l){const i=this.config[t.configKey],r=this.config.toolbar[t.configKey]??!0;if(!i&&r){const i="superscript"===t.type?this.locale.superscriptLabel:this.locale.subscriptLabel;s.registerToolbarItem({id:t.type,group:"format",icon:t.icon,label:i,command:e(t.type),isEnabled:()=>!1})}}}isToolbarVisible(s){return!this.config.toolbar||(this.config.toolbar[s]??!0)}}export{c as SUPER_SUB_LOCALE_EN,u as SuperSubPlugin,n as loadSuperSubLocale};
|
|
2
2
|
//# sourceMappingURL=super-sub.mjs.map
|