@notectl/core 2.2.5 → 2.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{AlignmentPlugin-BCHxo16v.mjs → AlignmentPlugin--xAFlRqE.mjs} +2 -2
- package/dist/chunks/{AlignmentPlugin-BCHxo16v.mjs.map → AlignmentPlugin--xAFlRqE.mjs.map} +1 -1
- package/dist/chunks/{AttrRegistry-DcDVyzLm.mjs → AttrRegistry-B3zB02z9.mjs} +2 -2
- package/dist/chunks/AttrRegistry-B3zB02z9.mjs.map +1 -0
- package/dist/chunks/{AttributedMarkCommands-D4W2Jgpj.mjs → AttributedMarkCommands-bagbH8Qt.mjs} +2 -2
- package/dist/chunks/{AttributedMarkCommands-D4W2Jgpj.mjs.map → AttributedMarkCommands-bagbH8Qt.mjs.map} +1 -1
- package/dist/chunks/{BidiIsolationPlugin-BddRbDCN.mjs → BidiIsolationPlugin-DBXyXpgm.mjs} +2 -2
- package/dist/chunks/{BidiIsolationPlugin-BddRbDCN.mjs.map → BidiIsolationPlugin-DBXyXpgm.mjs.map} +1 -1
- package/dist/chunks/BlockInsertion-CJusvrDL.mjs +2 -0
- package/dist/chunks/BlockInsertion-CJusvrDL.mjs.map +1 -0
- package/dist/chunks/BlockquotePlugin-Bz2glHwX.mjs +2 -0
- package/dist/chunks/{BlockquotePlugin-4V7KV_Sb.mjs.map → BlockquotePlugin-Bz2glHwX.mjs.map} +1 -1
- package/dist/chunks/{CaretNavigationPlugin-C6XBwp0N.mjs → CaretNavigationPlugin-CNsT0eb4.mjs} +2 -2
- package/dist/chunks/{CaretNavigationPlugin-C6XBwp0N.mjs.map → CaretNavigationPlugin-CNsT0eb4.mjs.map} +1 -1
- package/dist/chunks/CodeBlockPlugin-C1hrdbSZ.mjs +2 -0
- package/dist/chunks/CodeBlockPlugin-C1hrdbSZ.mjs.map +1 -0
- package/dist/chunks/{ColorGrid-CXRdpP_n.mjs → ColorGrid-C9RQoEWF.mjs} +2 -2
- package/dist/chunks/{ColorGrid-CXRdpP_n.mjs.map → ColorGrid-C9RQoEWF.mjs.map} +1 -1
- package/dist/chunks/ColorPickerPopup-DiA68Pzz.mjs +2 -0
- package/dist/chunks/{ColorPickerPopup-C_74bqid.mjs.map → ColorPickerPopup-DiA68Pzz.mjs.map} +1 -1
- package/dist/chunks/Commands-1dFFldi7.mjs +2 -0
- package/dist/chunks/Commands-1dFFldi7.mjs.map +1 -0
- package/dist/chunks/ContentModel-NpAj7vGW.mjs +2 -0
- package/dist/chunks/ContentModel-NpAj7vGW.mjs.map +1 -0
- package/dist/chunks/Decoration-BpoEOANl.mjs +2 -0
- package/dist/chunks/Decoration-BpoEOANl.mjs.map +1 -0
- package/dist/chunks/{DirectionDetection-C7XE0nxW.mjs → DirectionDetection-CDVSEWQ6.mjs} +2 -2
- package/dist/chunks/{DirectionDetection-C7XE0nxW.mjs.map → DirectionDetection-CDVSEWQ6.mjs.map} +1 -1
- package/dist/chunks/Document-827l3P80.mjs +2 -0
- package/dist/chunks/Document-827l3P80.mjs.map +1 -0
- package/dist/chunks/DocumentParser-D2tr3ZKn.mjs +2 -0
- package/dist/chunks/DocumentParser-D2tr3ZKn.mjs.map +1 -0
- package/dist/chunks/EditorEventBoundary-zpYRxryo.mjs +2 -0
- package/dist/chunks/EditorEventBoundary-zpYRxryo.mjs.map +1 -0
- package/dist/chunks/FontPlugin-By-TGrQo.mjs +2 -0
- package/dist/chunks/{FontPlugin-DB1_bgam.mjs.map → FontPlugin-By-TGrQo.mjs.map} +1 -1
- package/dist/chunks/{FontSizePlugin-DFvp7Ki9.mjs → FontSizePlugin-Dln-tYXV.mjs} +2 -2
- package/dist/chunks/FontSizePlugin-Dln-tYXV.mjs.map +1 -0
- package/dist/chunks/FormulaPlugin-By1befrR.mjs +2 -0
- package/dist/chunks/FormulaPlugin-By1befrR.mjs.map +1 -0
- package/dist/chunks/GapCursorNavigation-BuXngVu-.mjs +2 -0
- package/dist/chunks/{GapCursorNavigation-ycNzuQVH.mjs.map → GapCursorNavigation-BuXngVu-.mjs.map} +1 -1
- package/dist/chunks/{GapCursorPlugin-Zvxjnr82.mjs → GapCursorPlugin-DAxVzXRs.mjs} +2 -2
- package/dist/chunks/{GapCursorPlugin-Zvxjnr82.mjs.map → GapCursorPlugin-DAxVzXRs.mjs.map} +1 -1
- package/dist/chunks/HTMLUtils-Bhg3_P8B.mjs +2 -0
- package/dist/chunks/HTMLUtils-Bhg3_P8B.mjs.map +1 -0
- package/dist/chunks/{HardBreakPlugin-9DOyCyyM.mjs → HardBreakPlugin-DlbSlrdq.mjs} +2 -2
- package/dist/chunks/{HardBreakPlugin-9DOyCyyM.mjs.map → HardBreakPlugin-DlbSlrdq.mjs.map} +1 -1
- package/dist/chunks/HeadingPlugin-uMAjPOk5.mjs +2 -0
- package/dist/chunks/{HeadingPlugin-D9yvG2Aw.mjs.map → HeadingPlugin-uMAjPOk5.mjs.map} +1 -1
- package/dist/chunks/{HighlightPlugin-D4gh4RP7.mjs → HighlightPlugin-Bj7FPkIQ.mjs} +2 -2
- package/dist/chunks/{HighlightPlugin-D4gh4RP7.mjs.map → HighlightPlugin-Bj7FPkIQ.mjs.map} +1 -1
- package/dist/chunks/HorizontalRulePlugin-DUVmTQpX.mjs +2 -0
- package/dist/chunks/HorizontalRulePlugin-DUVmTQpX.mjs.map +1 -0
- package/dist/chunks/ImagePlugin-FToCOjd5.mjs +2 -0
- package/dist/chunks/{ImagePlugin-Cp_RINtc.mjs.map → ImagePlugin-FToCOjd5.mjs.map} +1 -1
- package/dist/chunks/{InlineCodePlugin-DMr4O7c7.mjs → InlineCodePlugin-pISIoGQE.mjs} +2 -2
- package/dist/chunks/InlineCodePlugin-pISIoGQE.mjs.map +1 -0
- package/dist/chunks/InlineStyleMarkSpec-CjSRj4f_.mjs +2 -0
- package/dist/chunks/{InlineStyleMarkSpec-4R6DC7ij.mjs.map → InlineStyleMarkSpec-CjSRj4f_.mjs.map} +1 -1
- package/dist/chunks/LinkPlugin-Ct5Z180S.mjs +2 -0
- package/dist/chunks/LinkPlugin-Ct5Z180S.mjs.map +1 -0
- package/dist/chunks/ListPlugin-DAY5ezNs.mjs +2 -0
- package/dist/chunks/ListPlugin-DAY5ezNs.mjs.map +1 -0
- package/dist/chunks/MarkInputRule-Bdi8KPus.mjs +2 -0
- package/dist/chunks/MarkInputRule-Bdi8KPus.mjs.map +1 -0
- package/dist/chunks/MarkdownHTMLRegistry-CKEx7LkR.mjs +2 -0
- package/dist/chunks/MarkdownHTMLRegistry-CKEx7LkR.mjs.map +1 -0
- package/dist/chunks/MarkdownParser-CWt3M6jR.mjs +2 -0
- package/dist/chunks/MarkdownParser-CWt3M6jR.mjs.map +1 -0
- package/dist/chunks/MarkdownSerializer-J-i28out.mjs +2 -0
- package/dist/chunks/MarkdownSerializer-J-i28out.mjs.map +1 -0
- package/dist/chunks/{NodeResolver-ChgLF_IP.mjs → NodeResolver-Dleih-8R.mjs} +2 -2
- package/dist/chunks/{NodeResolver-ChgLF_IP.mjs.map → NodeResolver-Dleih-8R.mjs.map} +1 -1
- package/dist/chunks/NodeSelectionCommands-1PjwUDTJ.mjs +2 -0
- package/dist/chunks/{NodeSelectionCommands-Dj4VxLdD.mjs.map → NodeSelectionCommands-1PjwUDTJ.mjs.map} +1 -1
- package/dist/chunks/PluginHelpers-Dx_0hfDe.mjs +2 -0
- package/dist/chunks/{PluginHelpers-KDuTlmXm.mjs.map → PluginHelpers-Dx_0hfDe.mjs.map} +1 -1
- package/dist/chunks/{PopupManager-CyOfZUab.mjs → PopupManager-CT-fMZJn.mjs} +2 -2
- package/dist/chunks/{PopupManager-CyOfZUab.mjs.map → PopupManager-CT-fMZJn.mjs.map} +1 -1
- package/dist/chunks/PopupPositioning-BFh6Ed1D.mjs +2 -0
- package/dist/chunks/{PopupPositioning-DtUrY9bh.mjs.map → PopupPositioning-BFh6Ed1D.mjs.map} +1 -1
- package/dist/chunks/PrintPlugin-7zz9mhhU.mjs +2 -0
- package/dist/chunks/PrintPlugin-7zz9mhhU.mjs.map +1 -0
- package/dist/chunks/{PrintTypes-WdtgSj74.mjs → PrintTypes-CxU69qu3.mjs} +3 -2
- package/dist/chunks/PrintTypes-CxU69qu3.mjs.map +1 -0
- package/dist/chunks/{RangeIterator-o8v3msQe.mjs → RangeIterator-DP7Ud3Gp.mjs} +2 -2
- package/dist/chunks/{RangeIterator-o8v3msQe.mjs.map → RangeIterator-DP7Ud3Gp.mjs.map} +1 -1
- package/dist/chunks/SchemaRegistry-CkBN-1yW.mjs +2 -0
- package/dist/chunks/SchemaRegistry-CkBN-1yW.mjs.map +1 -0
- package/dist/chunks/{SimpleMark-CaQtFAau.mjs → SimpleMark-7CQcA4RK.mjs} +2 -2
- package/dist/chunks/{SimpleMark-CaQtFAau.mjs.map → SimpleMark-7CQcA4RK.mjs.map} +1 -1
- package/dist/chunks/{SmartPastePlugin-Bi_wpTCV.mjs → SmartPastePlugin-CYa_nD9v.mjs} +2 -2
- package/dist/chunks/{SmartPastePlugin-Bi_wpTCV.mjs.map → SmartPastePlugin-CYa_nD9v.mjs.map} +1 -1
- package/dist/chunks/StrikethroughPlugin-C2oWvGc3.mjs +2 -0
- package/dist/chunks/StrikethroughPlugin-C2oWvGc3.mjs.map +1 -0
- package/dist/chunks/StyleRuntime-DW6omotc.mjs +2 -0
- package/dist/chunks/StyleRuntime-DW6omotc.mjs.map +1 -0
- package/dist/chunks/{SuperSubPlugin-DVP7VnIz.mjs → SuperSubPlugin-D1xaKrSu.mjs} +2 -2
- package/dist/chunks/{SuperSubPlugin-DVP7VnIz.mjs.map → SuperSubPlugin-D1xaKrSu.mjs.map} +1 -1
- package/dist/chunks/TableDimensions-BBhjHNjQ.mjs +2 -0
- package/dist/chunks/TableDimensions-BBhjHNjQ.mjs.map +1 -0
- package/dist/chunks/TablePlugin-PJe3zwr-.mjs +2 -0
- package/dist/chunks/TablePlugin-PJe3zwr-.mjs.map +1 -0
- package/dist/chunks/TextColorPlugin-CTd9tfeG.mjs +2 -0
- package/dist/chunks/{TextColorPlugin-C1qpzEOa.mjs.map → TextColorPlugin-CTd9tfeG.mjs.map} +1 -1
- package/dist/chunks/TextDirectionAutoPlugin-CPnKVVuI.mjs +2 -0
- package/dist/chunks/{TextDirectionAutoPlugin-CzWJjrvG.mjs.map → TextDirectionAutoPlugin-CPnKVVuI.mjs.map} +1 -1
- package/dist/chunks/{TextDirectionPlugin-DHB88HKf.mjs → TextDirectionPlugin-Bns_03vL.mjs} +2 -2
- package/dist/chunks/{TextDirectionPlugin-DHB88HKf.mjs.map → TextDirectionPlugin-Bns_03vL.mjs.map} +1 -1
- package/dist/chunks/TextDirectionService-BcX07mw2.mjs +2 -0
- package/dist/chunks/{TextDirectionService-OFOU6r_s.mjs.map → TextDirectionService-BcX07mw2.mjs.map} +1 -1
- package/dist/chunks/TextFormattingPlugin-DBVlePqj.mjs +2 -0
- package/dist/chunks/TextFormattingPlugin-DBVlePqj.mjs.map +1 -0
- package/dist/chunks/{ToolbarPlugin-CLz2wa2c.mjs → ToolbarPlugin-DtfGTO_V.mjs} +2 -2
- package/dist/chunks/{ToolbarPlugin-CLz2wa2c.mjs.map → ToolbarPlugin-DtfGTO_V.mjs.map} +1 -1
- package/dist/chunks/VideoPlugin-BrR8g6Rz.mjs +2 -0
- package/dist/chunks/VideoPlugin-BrR8g6Rz.mjs.map +1 -0
- package/dist/chunks/WordBoundary-CFpIJDNP.mjs +2 -0
- package/dist/chunks/{WordBoundary-DxeMBRyP.mjs.map → WordBoundary-CFpIJDNP.mjs.map} +1 -1
- package/dist/chunks/ar-Dg9PdDet.mjs +2 -0
- package/dist/chunks/ar-Dg9PdDet.mjs.map +1 -0
- package/dist/chunks/ar-eOA3UmiE.mjs +2 -0
- package/dist/chunks/{ar-BTShmP2E.mjs.map → ar-eOA3UmiE.mjs.map} +1 -1
- package/dist/chunks/de-DJ5EkXQo.mjs +2 -0
- package/dist/chunks/de-DJ5EkXQo.mjs.map +1 -0
- package/dist/chunks/{de-C--bRmjW.mjs → de-DRbhnS4T.mjs} +2 -2
- package/dist/chunks/{de-C--bRmjW.mjs.map → de-DRbhnS4T.mjs.map} +1 -1
- package/dist/chunks/{es-DFUVd7eO.mjs → es-BQ9dox_E.mjs} +2 -2
- package/dist/chunks/{es-DFUVd7eO.mjs.map → es-BQ9dox_E.mjs.map} +1 -1
- package/dist/chunks/es-CEAJj7aB.mjs +2 -0
- package/dist/chunks/es-CEAJj7aB.mjs.map +1 -0
- package/dist/chunks/fr-DhWQzZy3.mjs +2 -0
- package/dist/chunks/fr-DhWQzZy3.mjs.map +1 -0
- package/dist/chunks/{fr-BaXKyPmX.mjs → fr-NVOinLyF.mjs} +2 -2
- package/dist/chunks/{fr-BaXKyPmX.mjs.map → fr-NVOinLyF.mjs.map} +1 -1
- package/dist/chunks/full-DSWM4cKQ.mjs +2 -0
- package/dist/chunks/{full-Cah3qjCT.mjs.map → full-DSWM4cKQ.mjs.map} +1 -1
- package/dist/chunks/hi-BsZzSMfL.mjs +2 -0
- package/dist/chunks/hi-BsZzSMfL.mjs.map +1 -0
- package/dist/chunks/{hi-aH9HZG23.mjs → hi-DrC2H81d.mjs} +2 -2
- package/dist/chunks/{hi-aH9HZG23.mjs.map → hi-DrC2H81d.mjs.map} +1 -1
- package/dist/chunks/minimal-CFkkPXef.mjs +2 -0
- package/dist/chunks/{minimal-DqATlnAL.mjs.map → minimal-CFkkPXef.mjs.map} +1 -1
- package/dist/chunks/pt-BuZ7acHF.mjs +2 -0
- package/dist/chunks/pt-BuZ7acHF.mjs.map +1 -0
- package/dist/chunks/{pt-Hy-0Xnnc.mjs → pt-CFrcl1v_.mjs} +2 -2
- package/dist/chunks/{pt-Hy-0Xnnc.mjs.map → pt-CFrcl1v_.mjs.map} +1 -1
- package/dist/chunks/rolldown-runtime-H_PjY6_i.mjs +1 -0
- package/dist/chunks/ru-CsP6mLxp.mjs +2 -0
- package/dist/chunks/ru-CsP6mLxp.mjs.map +1 -0
- package/dist/chunks/{ru-BFpEOrVp.mjs → ru-gxbzqLL8.mjs} +2 -2
- package/dist/chunks/{ru-BFpEOrVp.mjs.map → ru-gxbzqLL8.mjs.map} +1 -1
- package/dist/chunks/src-DiAOfuOT.mjs +2 -0
- package/dist/chunks/src-DiAOfuOT.mjs.map +1 -0
- package/dist/chunks/zh-BFZOM3lF.mjs +2 -0
- package/dist/chunks/{zh-BjoyjClN.mjs.map → zh-BFZOM3lF.mjs.map} +1 -1
- package/dist/chunks/zh-CiIyOm6U.mjs +2 -0
- package/dist/chunks/zh-CiIyOm6U.mjs.map +1 -0
- package/dist/commands/BlockInsertion.d.ts +5 -3
- package/dist/commands/BlockInsertion.d.ts.map +1 -1
- package/dist/commands/SelectionDeletion.d.ts +13 -2
- package/dist/commands/SelectionDeletion.d.ts.map +1 -1
- package/dist/editor/ContentSerializer.d.ts +21 -0
- package/dist/editor/ContentSerializer.d.ts.map +1 -1
- package/dist/editor/EditorConfig.d.ts +17 -0
- package/dist/editor/EditorConfig.d.ts.map +1 -1
- package/dist/editor/EditorConfigController.d.ts +10 -0
- package/dist/editor/EditorConfigController.d.ts.map +1 -1
- package/dist/editor/EditorInitializer.d.ts +4 -0
- package/dist/editor/EditorInitializer.d.ts.map +1 -1
- package/dist/editor/EditorLocale.d.ts +2 -0
- package/dist/editor/EditorLocale.d.ts.map +1 -1
- package/dist/editor/MarkdownMode.d.ts +46 -0
- package/dist/editor/MarkdownMode.d.ts.map +1 -0
- package/dist/editor/NotectlEditor.d.ts +46 -3
- package/dist/editor/NotectlEditor.d.ts.map +1 -1
- package/dist/editor/locales/ar.d.ts.map +1 -1
- package/dist/editor/locales/de.d.ts.map +1 -1
- package/dist/editor/locales/es.d.ts.map +1 -1
- package/dist/editor/locales/fr.d.ts.map +1 -1
- package/dist/editor/locales/hi.d.ts.map +1 -1
- package/dist/editor/locales/pt.d.ts.map +1 -1
- package/dist/editor/locales/ru.d.ts.map +1 -1
- package/dist/editor/locales/zh.d.ts.map +1 -1
- package/dist/editor/styles/list.d.ts +1 -1
- package/dist/editor/styles/list.d.ts.map +1 -1
- package/dist/editor/styles/table.d.ts +1 -1
- package/dist/editor/styles/table.d.ts.map +1 -1
- package/dist/full.mjs +1 -1
- package/dist/html.d.ts +1 -0
- package/dist/html.d.ts.map +1 -1
- package/dist/html.mjs +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/input/ClipboardHandler.d.ts +2 -0
- package/dist/input/ClipboardHandler.d.ts.map +1 -1
- package/dist/input/InputHandler.d.ts +7 -0
- package/dist/input/InputHandler.d.ts.map +1 -1
- package/dist/input/InputManager.d.ts +10 -0
- package/dist/input/InputManager.d.ts.map +1 -1
- package/dist/input/KeyboardHandler.d.ts.map +1 -1
- package/dist/input/MarkdownPasteDetector.d.ts +26 -0
- package/dist/input/MarkdownPasteDetector.d.ts.map +1 -0
- package/dist/input/PasteHTMLHandler.d.ts +18 -1
- package/dist/input/PasteHTMLHandler.d.ts.map +1 -1
- package/dist/input/PasteHandler.d.ts +30 -0
- package/dist/input/PasteHandler.d.ts.map +1 -1
- package/dist/input/PasteRichBlockHandler.d.ts.map +1 -1
- package/dist/input/SelectionDocument.d.ts +2 -1
- package/dist/input/SelectionDocument.d.ts.map +1 -1
- package/dist/markdown.d.ts +17 -0
- package/dist/markdown.d.ts.map +1 -0
- package/dist/markdown.mjs +1 -0
- package/dist/model/AttrRegistry.d.ts +2 -2
- package/dist/model/AttrRegistry.d.ts.map +1 -1
- package/dist/model/ContentModel.d.ts +12 -0
- package/dist/model/ContentModel.d.ts.map +1 -1
- package/dist/model/Document.d.ts +28 -3
- package/dist/model/Document.d.ts.map +1 -1
- package/dist/model/HTMLUtils.d.ts +15 -0
- package/dist/model/HTMLUtils.d.ts.map +1 -1
- package/dist/model/InlineNodeSpec.d.ts +7 -1
- package/dist/model/InlineNodeSpec.d.ts.map +1 -1
- package/dist/model/InputRule.d.ts +11 -0
- package/dist/model/InputRule.d.ts.map +1 -1
- package/dist/model/MarkSpec.d.ts +7 -1
- package/dist/model/MarkSpec.d.ts.map +1 -1
- package/dist/model/MarkdownSyntaxRegistry.d.ts +51 -0
- package/dist/model/MarkdownSyntaxRegistry.d.ts.map +1 -0
- package/dist/model/NodeSpec.d.ts +47 -1
- package/dist/model/NodeSpec.d.ts.map +1 -1
- package/dist/model/RichBlockData.d.ts +2 -0
- package/dist/model/RichBlockData.d.ts.map +1 -1
- package/dist/model/SchemaRegistry.d.ts.map +1 -1
- package/dist/model/TableDimensions.d.ts +11 -0
- package/dist/model/TableDimensions.d.ts.map +1 -0
- 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/platform/EditorEventBoundary.d.ts +12 -0
- package/dist/platform/EditorEventBoundary.d.ts.map +1 -0
- package/dist/plugins/Plugin.d.ts +7 -0
- package/dist/plugins/Plugin.d.ts.map +1 -1
- package/dist/plugins/PluginContextFactory.d.ts +2 -0
- package/dist/plugins/PluginContextFactory.d.ts.map +1 -1
- package/dist/plugins/PluginManager.d.ts +2 -0
- package/dist/plugins/PluginManager.d.ts.map +1 -1
- package/dist/plugins/alignment.mjs +1 -1
- package/dist/plugins/bidi-isolation.mjs +1 -1
- package/dist/plugins/blockquote/BlockquotePlugin.d.ts +2 -0
- package/dist/plugins/blockquote/BlockquotePlugin.d.ts.map +1 -1
- package/dist/plugins/blockquote.mjs +1 -1
- package/dist/plugins/caret-navigation.mjs +1 -1
- package/dist/plugins/code-block/CodeBlockTypes.d.ts +2 -0
- package/dist/plugins/code-block/CodeBlockTypes.d.ts.map +1 -1
- package/dist/plugins/code-block.mjs +1 -1
- package/dist/plugins/font-size/FontSizeOperations.d.ts.map +1 -1
- package/dist/plugins/font-size.mjs +1 -1
- package/dist/plugins/font.mjs +1 -1
- package/dist/plugins/formula/DisplayMathNodeSpec.d.ts.map +1 -1
- package/dist/plugins/formula/FormulaInputRules.d.ts.map +1 -1
- package/dist/plugins/formula/FormulaMarkdownSyntax.d.ts +4 -0
- package/dist/plugins/formula/FormulaMarkdownSyntax.d.ts.map +1 -0
- package/dist/plugins/formula/FormulaPlugin.d.ts.map +1 -1
- package/dist/plugins/formula/FormulaTypes.d.ts +2 -0
- package/dist/plugins/formula/FormulaTypes.d.ts.map +1 -1
- package/dist/plugins/formula/InlineMathNodeSpec.d.ts.map +1 -1
- package/dist/plugins/formula.mjs +1 -1
- package/dist/plugins/gap-cursor.mjs +1 -1
- package/dist/plugins/hard-break.mjs +1 -1
- package/dist/plugins/heading/HeadingPlugin.d.ts +2 -0
- package/dist/plugins/heading/HeadingPlugin.d.ts.map +1 -1
- package/dist/plugins/heading.mjs +1 -1
- package/dist/plugins/highlight.mjs +1 -1
- package/dist/plugins/horizontal-rule/HorizontalRulePlugin.d.ts +2 -0
- package/dist/plugins/horizontal-rule/HorizontalRulePlugin.d.ts.map +1 -1
- package/dist/plugins/horizontal-rule.mjs +1 -1
- package/dist/plugins/image/ImagePlugin.d.ts +14 -0
- package/dist/plugins/image/ImagePlugin.d.ts.map +1 -1
- package/dist/plugins/image.mjs +1 -1
- package/dist/plugins/inline-code/InlineCodePlugin.d.ts.map +1 -1
- package/dist/plugins/inline-code.mjs +1 -1
- package/dist/plugins/link/LinkPlugin.d.ts +14 -0
- package/dist/plugins/link/LinkPlugin.d.ts.map +1 -1
- package/dist/plugins/link.mjs +1 -1
- package/dist/plugins/list/ListCommands.d.ts +5 -1
- package/dist/plugins/list/ListCommands.d.ts.map +1 -1
- package/dist/plugins/list/ListInputRules.d.ts.map +1 -1
- package/dist/plugins/list/ListItemContext.d.ts +27 -0
- package/dist/plugins/list/ListItemContext.d.ts.map +1 -0
- package/dist/plugins/list/ListKeyboardHandlers.d.ts.map +1 -1
- package/dist/plugins/list/ListPlugin.d.ts +2 -0
- package/dist/plugins/list/ListPlugin.d.ts.map +1 -1
- package/dist/plugins/list/ListToolbarItems.d.ts.map +1 -1
- package/dist/plugins/list.mjs +1 -1
- package/dist/plugins/print/PrintContentPreparer.d.ts.map +1 -1
- package/dist/plugins/print/PrintDestinationBridge.d.ts +23 -0
- package/dist/plugins/print/PrintDestinationBridge.d.ts.map +1 -0
- package/dist/plugins/print/PrintHostStyles.d.ts +50 -0
- package/dist/plugins/print/PrintHostStyles.d.ts.map +1 -0
- package/dist/plugins/print/PrintPlugin.d.ts.map +1 -1
- package/dist/plugins/print/PrintServiceImpl.d.ts +76 -3
- package/dist/plugins/print/PrintServiceImpl.d.ts.map +1 -1
- package/dist/plugins/print/PrintStyleCollector.d.ts +150 -21
- package/dist/plugins/print/PrintStyleCollector.d.ts.map +1 -1
- package/dist/plugins/print/StaticHostMarker.d.ts +18 -0
- package/dist/plugins/print/StaticHostMarker.d.ts.map +1 -0
- package/dist/plugins/print.mjs +1 -1
- package/dist/plugins/shared/MarkInputRule.d.ts +9 -0
- package/dist/plugins/shared/MarkInputRule.d.ts.map +1 -0
- package/dist/plugins/shared/PopupPositioning.d.ts +2 -0
- package/dist/plugins/shared/PopupPositioning.d.ts.map +1 -1
- 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/smart-paste.mjs +1 -1
- package/dist/plugins/strikethrough/StrikethroughPlugin.d.ts +2 -0
- package/dist/plugins/strikethrough/StrikethroughPlugin.d.ts.map +1 -1
- package/dist/plugins/strikethrough.mjs +1 -1
- package/dist/plugins/super-sub.mjs +1 -1
- package/dist/plugins/table/TableClipboard.d.ts +8 -0
- package/dist/plugins/table/TableClipboard.d.ts.map +1 -0
- package/dist/plugins/table/TableCommands.d.ts.map +1 -1
- package/dist/plugins/table/TableContextMenu.d.ts +11 -1
- package/dist/plugins/table/TableContextMenu.d.ts.map +1 -1
- package/dist/plugins/table/TableControls.d.ts +6 -1
- package/dist/plugins/table/TableControls.d.ts.map +1 -1
- package/dist/plugins/table/TableControlsDOM.d.ts +11 -2
- package/dist/plugins/table/TableControlsDOM.d.ts.map +1 -1
- package/dist/plugins/table/TableControlsLayout.d.ts +12 -3
- package/dist/plugins/table/TableControlsLayout.d.ts.map +1 -1
- package/dist/plugins/table/TableGrid.d.ts +57 -0
- package/dist/plugins/table/TableGrid.d.ts.map +1 -0
- package/dist/plugins/table/TableHelpers.d.ts +4 -0
- package/dist/plugins/table/TableHelpers.d.ts.map +1 -1
- package/dist/plugins/table/TableLocale.d.ts +30 -0
- package/dist/plugins/table/TableLocale.d.ts.map +1 -1
- package/dist/plugins/table/TableNavigation.d.ts +5 -1
- package/dist/plugins/table/TableNavigation.d.ts.map +1 -1
- package/dist/plugins/table/TableNodeViews.d.ts +13 -1
- package/dist/plugins/table/TableNodeViews.d.ts.map +1 -1
- package/dist/plugins/table/TablePlugin.d.ts +21 -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/TableSizeEditor.d.ts +11 -0
- package/dist/plugins/table/TableSizeEditor.d.ts.map +1 -0
- package/dist/plugins/table/TableSizing.d.ts +70 -0
- package/dist/plugins/table/TableSizing.d.ts.map +1 -0
- package/dist/plugins/table/index.d.ts +3 -1
- package/dist/plugins/table/index.d.ts.map +1 -1
- package/dist/plugins/table/locales/ar.d.ts.map +1 -1
- package/dist/plugins/table/locales/de.d.ts.map +1 -1
- package/dist/plugins/table/locales/es.d.ts.map +1 -1
- package/dist/plugins/table/locales/fr.d.ts.map +1 -1
- package/dist/plugins/table/locales/hi.d.ts.map +1 -1
- package/dist/plugins/table/locales/pt.d.ts.map +1 -1
- package/dist/plugins/table/locales/ru.d.ts.map +1 -1
- package/dist/plugins/table/locales/zh.d.ts.map +1 -1
- package/dist/plugins/table.mjs +1 -1
- package/dist/plugins/text-color.mjs +1 -1
- package/dist/plugins/text-direction-auto.mjs +1 -1
- package/dist/plugins/text-direction.mjs +1 -1
- package/dist/plugins/text-formatting/TextFormattingPlugin.d.ts +9 -0
- package/dist/plugins/text-formatting/TextFormattingPlugin.d.ts.map +1 -1
- package/dist/plugins/text-formatting.mjs +1 -1
- package/dist/plugins/toolbar.mjs +1 -1
- package/dist/plugins/video/VideoCommands.d.ts.map +1 -1
- package/dist/plugins/video.mjs +1 -1
- package/dist/presets/full.mjs +1 -1
- package/dist/presets/minimal.mjs +1 -1
- package/dist/presets.mjs +1 -1
- package/dist/serialization/DocumentParser.d.ts.map +1 -1
- package/dist/serialization/DocumentSerializer.d.ts +2 -0
- package/dist/serialization/DocumentSerializer.d.ts.map +1 -1
- package/dist/serialization/HTMLSanitization.d.ts +15 -0
- package/dist/serialization/HTMLSanitization.d.ts.map +1 -0
- package/dist/serialization/MarkSerializer.d.ts +12 -0
- package/dist/serialization/MarkSerializer.d.ts.map +1 -1
- package/dist/serialization/MarkdownParser.d.ts +6 -0
- package/dist/serialization/MarkdownParser.d.ts.map +1 -0
- package/dist/serialization/MarkdownSerializer.d.ts +12 -0
- package/dist/serialization/MarkdownSerializer.d.ts.map +1 -0
- package/dist/serialization/MarkdownTypes.d.ts +59 -0
- package/dist/serialization/MarkdownTypes.d.ts.map +1 -0
- package/dist/serialization/TableDimensions.d.ts +37 -0
- package/dist/serialization/TableDimensions.d.ts.map +1 -0
- package/dist/serialization/markdown/BlockSerializers.d.ts +7 -0
- package/dist/serialization/markdown/BlockSerializers.d.ts.map +1 -0
- package/dist/serialization/markdown/BlockTokenizer.d.ts +54 -0
- package/dist/serialization/markdown/BlockTokenizer.d.ts.map +1 -0
- package/dist/serialization/markdown/GfmAutolink.d.ts +20 -0
- package/dist/serialization/markdown/GfmAutolink.d.ts.map +1 -0
- package/dist/serialization/markdown/GfmTableParser.d.ts +26 -0
- package/dist/serialization/markdown/GfmTableParser.d.ts.map +1 -0
- package/dist/serialization/markdown/InlineAst.d.ts +34 -0
- package/dist/serialization/markdown/InlineAst.d.ts.map +1 -0
- package/dist/serialization/markdown/InlineSerializers.d.ts +5 -0
- package/dist/serialization/markdown/InlineSerializers.d.ts.map +1 -0
- package/dist/serialization/markdown/InlineTokenizer.d.ts +5 -0
- package/dist/serialization/markdown/InlineTokenizer.d.ts.map +1 -0
- package/dist/serialization/markdown/LinkReferenceExtractor.d.ts +37 -0
- package/dist/serialization/markdown/LinkReferenceExtractor.d.ts.map +1 -0
- package/dist/serialization/markdown/MarkdownContext.d.ts +32 -0
- package/dist/serialization/markdown/MarkdownContext.d.ts.map +1 -0
- package/dist/serialization/markdown/MarkdownEntities.d.ts +33 -0
- package/dist/serialization/markdown/MarkdownEntities.d.ts.map +1 -0
- package/dist/serialization/markdown/MarkdownEscape.d.ts +33 -0
- package/dist/serialization/markdown/MarkdownEscape.d.ts.map +1 -0
- package/dist/serialization/markdown/MarkdownHTMLRegistry.d.ts +4 -0
- package/dist/serialization/markdown/MarkdownHTMLRegistry.d.ts.map +1 -0
- package/dist/serialization/markdown/MarkdownParseContext.d.ts +23 -0
- package/dist/serialization/markdown/MarkdownParseContext.d.ts.map +1 -0
- package/dist/state/Mapping.d.ts +33 -10
- package/dist/state/Mapping.d.ts.map +1 -1
- package/dist/state/StepApplication.d.ts +3 -1
- package/dist/state/StepApplication.d.ts.map +1 -1
- package/dist/state/StepHandlers.d.ts.map +1 -1
- package/dist/state/StepInversion.d.ts +2 -1
- package/dist/state/StepInversion.d.ts.map +1 -1
- package/dist/state/StepMapping.d.ts +3 -2
- package/dist/state/StepMapping.d.ts.map +1 -1
- package/dist/state/StepMaps.d.ts +3 -2
- package/dist/state/StepMaps.d.ts.map +1 -1
- package/dist/state/Steps.d.ts +34 -2
- package/dist/state/Steps.d.ts.map +1 -1
- package/dist/state/TransactionBuilder.d.ts +7 -1
- package/dist/state/TransactionBuilder.d.ts.map +1 -1
- package/dist/style/StyleRuntime.d.ts +7 -0
- package/dist/style/StyleRuntime.d.ts.map +1 -1
- package/dist/test/MarkdownConformanceUtils.d.ts +12 -0
- package/dist/test/MarkdownConformanceUtils.d.ts.map +1 -0
- package/dist/view/BlockRendering.d.ts +5 -0
- package/dist/view/BlockRendering.d.ts.map +1 -1
- package/dist/view/DecorationRendering.d.ts +6 -0
- package/dist/view/DecorationRendering.d.ts.map +1 -1
- package/dist/view/EditorViewEvents.d.ts.map +1 -1
- package/dist/view/Reconciler.d.ts.map +1 -1
- package/package.json +14 -1
- package/dist/chunks/AttrRegistry-DcDVyzLm.mjs.map +0 -1
- package/dist/chunks/BlockInsertion-6rR9tIGP.mjs +0 -2
- package/dist/chunks/BlockInsertion-6rR9tIGP.mjs.map +0 -1
- package/dist/chunks/BlockquotePlugin-4V7KV_Sb.mjs +0 -2
- package/dist/chunks/CodeBlockPlugin-DC0-BnNy.mjs +0 -2
- package/dist/chunks/CodeBlockPlugin-DC0-BnNy.mjs.map +0 -1
- package/dist/chunks/ColorPickerPopup-C_74bqid.mjs +0 -2
- package/dist/chunks/Commands-BIIpx_Zd.mjs +0 -2
- package/dist/chunks/Commands-BIIpx_Zd.mjs.map +0 -1
- package/dist/chunks/Decoration-ZeyVfwJB.mjs +0 -2
- package/dist/chunks/Decoration-ZeyVfwJB.mjs.map +0 -1
- package/dist/chunks/Document-r7vLOAGA.mjs +0 -2
- package/dist/chunks/Document-r7vLOAGA.mjs.map +0 -1
- package/dist/chunks/DocumentParser-CcTSeT1B.mjs +0 -2
- package/dist/chunks/DocumentParser-CcTSeT1B.mjs.map +0 -1
- package/dist/chunks/FontPlugin-DB1_bgam.mjs +0 -2
- package/dist/chunks/FontSizePlugin-DFvp7Ki9.mjs.map +0 -1
- package/dist/chunks/FormulaPlugin-BLEcyazj.mjs +0 -2
- package/dist/chunks/FormulaPlugin-BLEcyazj.mjs.map +0 -1
- package/dist/chunks/GapCursorNavigation-ycNzuQVH.mjs +0 -2
- package/dist/chunks/HTMLUtils-C6B4UT00.mjs +0 -2
- package/dist/chunks/HTMLUtils-C6B4UT00.mjs.map +0 -1
- package/dist/chunks/HeadingPlugin-D9yvG2Aw.mjs +0 -2
- package/dist/chunks/HorizontalRulePlugin-0FjHPZuA.mjs +0 -2
- package/dist/chunks/HorizontalRulePlugin-0FjHPZuA.mjs.map +0 -1
- package/dist/chunks/ImagePlugin-Cp_RINtc.mjs +0 -2
- package/dist/chunks/InlineCodePlugin-DMr4O7c7.mjs.map +0 -1
- package/dist/chunks/InlineStyleMarkSpec-4R6DC7ij.mjs +0 -2
- package/dist/chunks/LinkPlugin-DvZ3MPgL.mjs +0 -2
- package/dist/chunks/LinkPlugin-DvZ3MPgL.mjs.map +0 -1
- package/dist/chunks/ListPlugin-CVId2dE0.mjs +0 -2
- package/dist/chunks/ListPlugin-CVId2dE0.mjs.map +0 -1
- package/dist/chunks/NodeSelectionCommands-Dj4VxLdD.mjs +0 -2
- package/dist/chunks/PluginHelpers-KDuTlmXm.mjs +0 -2
- package/dist/chunks/PopupPositioning-DtUrY9bh.mjs +0 -2
- package/dist/chunks/PrintPlugin-C6gOJT6d.mjs +0 -2
- package/dist/chunks/PrintPlugin-C6gOJT6d.mjs.map +0 -1
- package/dist/chunks/PrintTypes-WdtgSj74.mjs.map +0 -1
- package/dist/chunks/StrikethroughPlugin-BLKDRWtf.mjs +0 -2
- package/dist/chunks/StrikethroughPlugin-BLKDRWtf.mjs.map +0 -1
- package/dist/chunks/StyleRuntime-BAutwDZT.mjs +0 -2
- package/dist/chunks/StyleRuntime-BAutwDZT.mjs.map +0 -1
- package/dist/chunks/TablePlugin-D93RR5xH.mjs +0 -2
- package/dist/chunks/TablePlugin-D93RR5xH.mjs.map +0 -1
- package/dist/chunks/TextColorPlugin-C1qpzEOa.mjs +0 -2
- package/dist/chunks/TextDirectionAutoPlugin-CzWJjrvG.mjs +0 -2
- package/dist/chunks/TextDirectionService-OFOU6r_s.mjs +0 -2
- package/dist/chunks/TextFormattingPlugin-Cubp3e7f.mjs +0 -2
- package/dist/chunks/TextFormattingPlugin-Cubp3e7f.mjs.map +0 -1
- package/dist/chunks/VideoPlugin-D9rQZol6.mjs +0 -2
- package/dist/chunks/VideoPlugin-D9rQZol6.mjs.map +0 -1
- package/dist/chunks/WordBoundary-DxeMBRyP.mjs +0 -2
- package/dist/chunks/ar-BTShmP2E.mjs +0 -2
- package/dist/chunks/ar-jbplYWkC.mjs +0 -2
- package/dist/chunks/ar-jbplYWkC.mjs.map +0 -1
- package/dist/chunks/de-DN-e6G5A.mjs +0 -2
- package/dist/chunks/de-DN-e6G5A.mjs.map +0 -1
- package/dist/chunks/es-CM55WeEN.mjs +0 -2
- package/dist/chunks/es-CM55WeEN.mjs.map +0 -1
- package/dist/chunks/fr-C_2i5Ono.mjs +0 -2
- package/dist/chunks/fr-C_2i5Ono.mjs.map +0 -1
- package/dist/chunks/full-Cah3qjCT.mjs +0 -2
- package/dist/chunks/hi-C9fvG91d.mjs +0 -2
- package/dist/chunks/hi-C9fvG91d.mjs.map +0 -1
- package/dist/chunks/minimal-DqATlnAL.mjs +0 -2
- package/dist/chunks/pt-GqLw5tN0.mjs +0 -2
- package/dist/chunks/pt-GqLw5tN0.mjs.map +0 -1
- package/dist/chunks/ru-4g_qsaLr.mjs +0 -2
- package/dist/chunks/ru-4g_qsaLr.mjs.map +0 -1
- package/dist/chunks/src-YY6n2SmV.mjs +0 -2
- package/dist/chunks/src-YY6n2SmV.mjs.map +0 -1
- package/dist/chunks/zh-BjoyjClN.mjs +0 -2
- package/dist/chunks/zh-DeZP08HI.mjs +0 -2
- package/dist/chunks/zh-DeZP08HI.mjs.map +0 -1
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var t=/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|blob|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i;function e(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}var n=e,r=new Set(["http:","https:","mailto:","tel:"]),a=/[\u0000-\u001F\u007F]/g;function o(t){const e=t.replace(a,"").trim();if(""===e)return"";if(e.startsWith("#")||e.startsWith("/"))return e;try{const t=new URL(e,"http://_invalid_base_/");return r.has(t.protocol)?e:""}catch{return""}}var i=new Set(["p","div","h1","h2","h3","h4","h5","h6","ul","ol","li","blockquote","table","thead","tbody","tfoot","tr","td","th","pre","figure","figcaption","section","article","header","footer"]),s=new Set(["br","hr","img","input","col","area","meta","link"]);function c(t,e=" "){const n=function(t){const e=[];let n=0,r=0;for(;r<t.length;){if("<"!==t[r]){r+=1;continue}let a=r+1;a<t.length&&"/"===t[a]&&(a+=1);const o=t[a];if(a>=t.length||!o||!h(o)){r+=1;continue}const i=l(t,a+1);if(void 0===i)break;r>n&&e.push(t.slice(n,r)),e.push(t.slice(r,i+1)),r=i+1,n=r}return n<t.length&&e.push(t.slice(n)),e}(t),r=[];let a=0,o="";const c=()=>{const t=o.trim();t.length>0&&r.push(`${e.repeat(a)}${t}`),o=""};for(const l of n){const t=l.startsWith("<")?u(l):"",n=i.has(t),h=s.has(t);n||h?(c(),l.startsWith("</")?(a=Math.max(0,a-1),r.push(`${e.repeat(a)}${l}`)):(r.push(`${e.repeat(a)}${l}`),!n||h||l.endsWith("/>")||(a+=1))):o+=l}return c(),r.join("\n")}function l(t,e){let n;for(let r=e;r<t.length;r+=1){const e=t[r]??"";if(n)e===n&&(n=void 0);else if('"'!==e&&"'"!==e){if(">"===e)return r}else n=e}}function h(t){return t>="a"&&t<="z"||t>="A"&&t<="Z"}function u(t){return t.match(/^<\/?([a-zA-Z][a-zA-Z0-9]*)/)?.[1]?.toLowerCase()??""}export{o as a,c as i,n,e as r,t};
|
|
2
|
-
//# sourceMappingURL=HTMLUtils-C6B4UT00.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"HTMLUtils-C6B4UT00.mjs","names":[],"sources":["../../src/model/HTMLUtils.ts"],"sourcesContent":["/**\n * HTML string escaping and formatting utilities shared across serialization and parsing.\n */\n\n/**\n * URI scheme regex for DOMPurify that extends the default allowlist with `blob:` and `data:`.\n * `blob:` is needed to preserve same-origin blob URLs (e.g. uploaded images) through\n * clipboard round-trips and HTML serialization.\n */\nexport const SAFE_URI_REGEXP: RegExp =\n\t/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|blob|data):|[^a-z]|[a-z+.\\-]+(?:[^a-z+.\\-:]|$))/i;\n\n/** Escapes special HTML characters in text content. */\nexport function escapeHTML(text: string): string {\n\treturn text\n\t\t.replace(/&/g, '&')\n\t\t.replace(/</g, '<')\n\t\t.replace(/>/g, '>')\n\t\t.replace(/\"/g, '"');\n}\n\n/** Escapes a value for safe interpolation into an HTML attribute (double-quoted). */\nexport const escapeAttr: (value: string) => string = escapeHTML;\n\n/**\n * URL schemes accepted by `sanitizeHref` for anchor `href` values. Intentionally narrower\n * than the DOMPurify allowlist: `data:` and `blob:` are excluded because they can carry\n * executable content or be used to navigate to attacker-controlled documents.\n */\nconst SAFE_HREF_SCHEMES: ReadonlySet<string> = new Set(['http:', 'https:', 'mailto:', 'tel:']);\n\n// biome-ignore lint/suspicious/noControlCharactersInRegex: stripping C0 controls and DEL is the intent\nconst HREF_CONTROL_CHARS: RegExp = /[\\u0000-\\u001F\\u007F]/g;\n\n/**\n * Validates an anchor `href` against an allowlist of safe URL schemes and returns the\n * original (cleaned) value when safe, or an empty string otherwise. Use at every sink\n * that writes a user-controlled URL into the document model or the live DOM to neutralize\n * `javascript:`, `data:`, `vbscript:` and similar scheme-based XSS vectors.\n *\n * Safe inputs: `http(s)://...`, `mailto:...`, `tel:...`, fragment-only (`#section`),\n * absolute paths (`/page`), and bare relative URLs (`example.com`, `page.html`).\n * Everything else collapses to `''`.\n */\nexport function sanitizeHref(raw: string): string {\n\tconst cleaned: string = raw.replace(HREF_CONTROL_CHARS, '').trim();\n\tif (cleaned === '') return '';\n\tif (cleaned.startsWith('#') || cleaned.startsWith('/')) return cleaned;\n\n\ttry {\n\t\tconst parsed: URL = new URL(cleaned, 'http://_invalid_base_/');\n\t\tif (!SAFE_HREF_SCHEMES.has(parsed.protocol)) return '';\n\t\treturn cleaned;\n\t} catch {\n\t\treturn '';\n\t}\n}\n\n/** Block-level HTML tags that should appear on their own line with indentation. */\nconst BLOCK_TAGS: ReadonlySet<string> = new Set([\n\t'p',\n\t'div',\n\t'h1',\n\t'h2',\n\t'h3',\n\t'h4',\n\t'h5',\n\t'h6',\n\t'ul',\n\t'ol',\n\t'li',\n\t'blockquote',\n\t'table',\n\t'thead',\n\t'tbody',\n\t'tfoot',\n\t'tr',\n\t'td',\n\t'th',\n\t'pre',\n\t'figure',\n\t'figcaption',\n\t'section',\n\t'article',\n\t'header',\n\t'footer',\n]);\n\n/** Void (self-closing) HTML tags that never have children. */\nconst VOID_TAGS: ReadonlySet<string> = new Set([\n\t'br',\n\t'hr',\n\t'img',\n\t'input',\n\t'col',\n\t'area',\n\t'meta',\n\t'link',\n]);\n\n/**\n * Pretty-prints an HTML string with indentation and line breaks for block-level elements.\n * Inline content (e.g. `<strong>bold</strong> text`) stays on a single line.\n */\nexport function formatHTML(html: string, indent = ' '): string {\n\tconst tokens: readonly string[] = tokenizeHTML(html);\n\tconst lines: string[] = [];\n\tlet depth = 0;\n\tlet inlineBuffer = '';\n\n\tconst flushInline = (): void => {\n\t\tconst trimmed: string = inlineBuffer.trim();\n\t\tif (trimmed.length > 0) {\n\t\t\tlines.push(`${indent.repeat(depth)}${trimmed}`);\n\t\t}\n\t\tinlineBuffer = '';\n\t};\n\n\tfor (const token of tokens) {\n\t\tconst tag: string = token.startsWith('<') ? extractTagName(token) : '';\n\t\tconst isBlock: boolean = BLOCK_TAGS.has(tag);\n\t\tconst isVoid: boolean = VOID_TAGS.has(tag);\n\n\t\tif (isBlock || isVoid) {\n\t\t\tflushInline();\n\n\t\t\tif (token.startsWith('</')) {\n\t\t\t\tdepth = Math.max(0, depth - 1);\n\t\t\t\tlines.push(`${indent.repeat(depth)}${token}`);\n\t\t\t} else {\n\t\t\t\tlines.push(`${indent.repeat(depth)}${token}`);\n\t\t\t\tif (isBlock && !isVoid && !token.endsWith('/>')) {\n\t\t\t\t\tdepth += 1;\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tinlineBuffer += token;\n\t\t}\n\t}\n\n\tflushInline();\n\treturn lines.join('\\n');\n}\n\n/** Splits HTML into a flat list of tokens: tags and text segments between block boundaries. */\nfunction tokenizeHTML(html: string): readonly string[] {\n\tconst tokens: string[] = [];\n\tlet textStart = 0;\n\tlet i = 0;\n\twhile (i < html.length) {\n\t\tif (html[i] !== '<') {\n\t\t\ti += 1;\n\t\t\tcontinue;\n\t\t}\n\n\t\tlet nameStart = i + 1;\n\t\tif (nameStart < html.length && html[nameStart] === '/') {\n\t\t\tnameStart += 1;\n\t\t}\n\t\tconst nameChar: string | undefined = html[nameStart];\n\t\tif (nameStart >= html.length || !nameChar || !isASCIILetter(nameChar)) {\n\t\t\ti += 1;\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst tagEnd: number | undefined = findTagEnd(html, nameStart + 1);\n\t\tif (tagEnd === undefined) {\n\t\t\tbreak;\n\t\t}\n\n\t\tif (i > textStart) {\n\t\t\ttokens.push(html.slice(textStart, i));\n\t\t}\n\t\ttokens.push(html.slice(i, tagEnd + 1));\n\t\ti = tagEnd + 1;\n\t\ttextStart = i;\n\t}\n\n\tif (textStart < html.length) {\n\t\ttokens.push(html.slice(textStart));\n\t}\n\treturn tokens;\n}\n\nfunction findTagEnd(html: string, from: number): number | undefined {\n\tlet quote: '\"' | \"'\" | undefined;\n\tfor (let i = from; i < html.length; i += 1) {\n\t\tconst char: string = html[i] ?? '';\n\t\tif (quote) {\n\t\t\tif (char === quote) {\n\t\t\t\tquote = undefined;\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\t\tif (char === '\"' || char === \"'\") {\n\t\t\tquote = char;\n\t\t\tcontinue;\n\t\t}\n\t\tif (char === '>') {\n\t\t\treturn i;\n\t\t}\n\t}\n\treturn undefined;\n}\n\nfunction isASCIILetter(char: string): boolean {\n\treturn (char >= 'a' && char <= 'z') || (char >= 'A' && char <= 'Z');\n}\n\n/** Extracts the tag name from an HTML tag string like `<p>` or `</div class=\"x\">`. */\nfunction extractTagName(tag: string): string {\n\tconst match: R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as o,v as i}from"./Document-r7vLOAGA.mjs";import{o as r,t as a,u as s}from"./Selection-HYoVFpAx.mjs";import{a as c}from"./TypeBrands-Ch9856Gb.mjs";import{n as l}from"./DomUtils-Bf7JLFlx.mjs";import{o as g}from"./StyleRuntime-BAutwDZT.mjs";import{c as p,o as d}from"./PluginHelpers-KDuTlmXm.mjs";function h(t,e,n,o){const i=document.createElement("button");i.type="button",i.className="notectl-heading-picker__item",i.setAttribute("role","option"),i.setAttribute("aria-selected",String(e)),e&&i.classList.add("notectl-heading-picker__item--active");const r=document.createElement("span");r.className="notectl-heading-picker__check",r.textContent=e?"✓":"",i.appendChild(r);const a=document.createElement("span");return a.className="notectl-heading-picker__label",a.textContent=t,o&&g(a,{fontSize:o.fontSize,fontWeight:o.fontWeight}),i.appendChild(a),i.addEventListener("mousedown",n),i}function u(t,e){return t[`heading${e}`]}function m(t,e){const n=t.getState();if(!s(n.selection))return!1;const o=n.getBlock(n.selection.anchor.blockId);return!!o&&(o.type===e?k(t,c("paragraph")):k(t,c(e)))}function f(t,e){const n=t.getState(),o=n.selection;if(!s(o))return!1;const i=n.getBlock(o.anchor.blockId);return!!i&&("heading"===i.type&&i.attrs?.level===e?k(t,c("paragraph")):k(t,c("heading"),{level:e}))}function k(e,o,r){const a=e.getState(),c=a.selection;if(!s(c))return!1;const l=a.getBlock(c.anchor.blockId);if(!l)return!1;const g=a.transaction("command"),p=e.getSchemaRegistry().getNodeSpec(o);p?.excludeMarks&&p.excludeMarks.length>0&&(function(e,o,r){if(0===n(o))return;const a=new Set(r),s=i(o);let c=0;for(const n of s)if(t(n)){if(n.text.length>0)for(const t of n.marks)a.has(t.type)&&e.removeMark(o.id,c,c+n.text.length,t);c+=n.text.length}else c+=1}(g,l,p.excludeMarks),function(t,e,n){if(!e.storedMarks)return;const o=new Set(n),i=e.storedMarks.filter(t=>!o.has(t.type));i.length!==e.storedMarks.length&&t.setStoredMarks(i.length>0?i:null,e.storedMarks)}(g,a,p.excludeMarks));const d=g.setBlockType(c.anchor.blockId,o,r).setSelection(c).build();return e.dispatch(d),!0}var b=new Set(["heading","title","subtitle"]);var y={paragraph:"Paragraph",title:"Title",subtitle:"Subtitle",heading1:"Heading 1",heading2:"Heading 2",heading3:"Heading 3",heading4:"Heading 4",heading5:"Heading 5",heading6:"Heading 6",blockTypeLabel:"Block Type",blockTypesAria:"Block types"},v=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar-0g2bmXTn.mjs"),"./locales/de.ts":()=>import("./de-Bwxlcuee.mjs"),"./locales/es.ts":()=>import("./es-C7uVqFYr.mjs"),"./locales/fr.ts":()=>import("./fr-D5ulA3Z6.mjs"),"./locales/hi.ts":()=>import("./hi-CrmakMVj.mjs"),"./locales/pt.ts":()=>import("./pt-_qxIe7zX.mjs"),"./locales/ru.ts":()=>import("./ru-Cs8KCNyq.mjs"),"./locales/zh.ts":()=>import("./zh-BQ73oqxc.mjs")});async function x(t){return p(v,t,y)}var S={levels:[1,2,3,4,5,6]},T={1:"h1",2:"h2",3:"h3",4:"h4",5:"h5",6:"h6"},B=class{id="heading";name="Heading";priority=30;config;locale;constructor(t){this.config={...S,...t}}async init(t){this.locale=await d(t,this.config.locale,y,x),t.registerStyleSheet("\n/* Heading Select — Width overrides for combobox button */\n.notectl-toolbar-btn--heading {\n\tmin-width: 100px;\n\tmax-width: 160px;\n}\n\n/* Heading Picker Popup */\n.notectl-heading-picker {\n\tmin-width: 200px;\n\tmax-height: 320px;\n\toverflow-y: auto;\n}\n\n.notectl-heading-picker__list {\n\tpadding: 4px 0;\n}\n\n.notectl-heading-picker__item {\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 8px;\n\twidth: 100%;\n\tpadding: 7px 12px;\n\tborder: none;\n\tbackground: none;\n\tcursor: pointer;\n\tfont-size: 14px;\n\tcolor: var(--notectl-fg);\n\ttext-align: start;\n\twhite-space: nowrap;\n\tfont-family: inherit;\n\ttransition: background 0.1s;\n}\n\n@media (hover: hover) {\n\t.notectl-heading-picker__item:hover {\n\t\tbackground: var(--notectl-hover-bg);\n\t}\n}\n\n.notectl-heading-picker__item--active {\n\tbackground: var(--notectl-active-bg);\n\tcolor: var(--notectl-primary-fg);\n}\n\n@media (hover: hover) {\n\t.notectl-heading-picker__item--active:hover {\n\t\tbackground: var(--notectl-active-bg);\n\t}\n}\n\n.notectl-heading-picker__check {\n\tdisplay: inline-flex;\n\talign-items: center;\n\tjustify-content: center;\n\twidth: 16px;\n\tflex-shrink: 0;\n\tfont-size: 13px;\n\tfont-weight: 600;\n\tcolor: var(--notectl-primary-fg);\n}\n\n.notectl-heading-picker__label {\n\tflex: 1;\n}\n"),this.registerNodeSpecs(t),function(t,e){t.registerCommand("setTitle",()=>m(t,"title")),t.registerCommand("setSubtitle",()=>m(t,"subtitle"));for(const n of e.levels)t.registerCommand(`setHeading${n}`,()=>f(t,n));t.registerCommand("toggleHeading",()=>f(t,1)),t.registerCommand("setParagraph",()=>k(t,c("paragraph")))}(t,this.config),function(t,i){const l={Enter:()=>function(t){return function(t,e){const n=t.getState();if(!s(n.selection))return!1;const o=n.selection;if(!r(o))return!1;const i=n.getBlock(o.anchor.blockId);return!(!i||!b.has(i.type))&&e({state:n,block:i,blockId:o.anchor.blockId,offset:o.anchor.offset})}(t,i=>{if(""===e(i.block)){const e=i.state.transaction("input").setBlockType(i.blockId,c("paragraph")).setSelection(i.state.selection).build();return t.dispatch(e),!0}const r=n(i.block);if(i.offset>=r){const e=o(),n=i.state.transaction("input").splitBlock(i.blockId,i.offset,e).setBlockType(e,c("paragraph")).setSelection(a(e,0)).build();return t.dispatch(n),!0}return!1})}(t)};for(const e of i.levels)e<=6&&(l[`Mod-Shift-${e}`]=()=>t.executeCommand(`setHeading${e}`));t.registerKeymap(l)}(t,this.config),function(t,e){for(const n of e.levels){const e="#".repeat(n),o=new RegExp(`^${e} $`);t.registerInputRule({pattern:o,handler(t,e,o,i){const l=t.selection;if(!s(l))return null;if(!r(l))return null;const g=t.getBlock(l.anchor.blockId);return g&&"paragraph"===g.type?t.transaction("input").deleteTextAt(l.anchor.blockId,o,o+n+1).setBlockType(l.anchor.blockId,c("heading"),{level:n}).setSelection(a(l.anchor.blockId,0)).build():null}})}}(t,this.config),function(t,e,n){t.registerBlockTypePickerEntry({id:"paragraph",label:n.paragraph,command:"setParagraph",priority:10,isActive:t=>!!s(t.selection)&&"paragraph"===t.getBlock(t.selection.anchor.blockId)?.type}),t.registerBlockTypePickerEntry({id:"title",label:n.title,command:"setTitle",priority:20,style:{fontSize:"1.6em",fontWeight:"700"},isActive:t=>!!s(t.selection)&&"title"===t.getBlock(t.selection.anchor.blockId)?.type}),t.registerBlockTypePickerEntry({id:"subtitle",label:n.subtitle,command:"setSubtitle",priority:30,style:{fontSize:"1.3em",fontWeight:"500"},isActive:t=>!!s(t.selection)&&"subtitle"===t.getBlock(t.selection.anchor.blockId)?.type});for(const o of e.levels)t.registerBlockTypePickerEntry({id:`heading-${o}`,label:u(n,o),command:`setHeading${o}`,priority:100+o,style:{fontSize:1.4-.1*o+"em",fontWeight:"600"},isActive:t=>{if(!s(t.selection))return!1;const e=t.getBlock(t.selection.anchor.blockId);return"heading"===e?.type&&e.attrs?.level===o}})}(t,this.config,this.locale),function(t,e){t.registerToolbarItem({id:"heading",group:"block",label:e.blockTypeLabel,tooltip:e.blockTypeLabel,command:"setParagraph",popupType:"combobox",getLabel:n=>function(t,e,n){if(!s(t.selection))return n.paragraph;const o=e.getBlockTypePickerRegistry().getBlockTypePickerEntries();for(const i of o)if(i.isActive(t))return i.label;return n.paragraph}(n,t,e),renderPopup:(t,n,o)=>{!function(t,e,n,o){t.classList.add("notectl-heading-picker");const i=e.getState();if(!s(i.selection))return;const r=e.getContainer(),a=document.createElement("div");a.className="notectl-heading-picker__list",a.setAttribute("role","listbox"),a.setAttribute("aria-label",n.blockTypesAria);const c=e.getBlockTypePickerRegistry().getBlockTypePickerEntries();for(const s of c){const t=s.isActive(i);a.appendChild(h(s.label,t,t=>{t.preventDefault(),t.stopPropagation(),e.executeCommand(s.command),o({restoreFocusTo:r})},s.style))}t.appendChild(a)}(t,n,e,o)},isActive:e=>t.getBlockTypePickerRegistry().getBlockTypePickerEntries().some(t=>"paragraph"!==t.id&&t.isActive(e))})}(t,this.locale)}registerNodeSpecs(t){t.registerNodeSpec({type:"title",group:"block",content:{allow:["text"]},excludeMarks:["fontSize"],toDOM(t){const e=l("h1",t.id);return e.classList.add("notectl-title"),e},toHTML:(t,e)=>`<h1 class="notectl-title">${e||"<br>"}</h1>`,parseHTML:[{tag:"h1",priority:60,getAttrs:t=>!!t.classList.contains("notectl-title")&&{}}],sanitize:{tags:["h1"],attrs:["class"]}}),t.registerNodeSpec({type:"subtitle",group:"block",content:{allow:["text"]},excludeMarks:["fontSize"],toDOM(t){const e=l("h2",t.id);return e.classList.add("notectl-subtitle"),e},toHTML:(t,e)=>`<h2 class="notectl-subtitle">${e||"<br>"}</h2>`,parseHTML:[{tag:"h2",priority:60,getAttrs:t=>!!t.classList.contains("notectl-subtitle")&&{}}],sanitize:{tags:["h2"],attrs:["class"]}}),t.registerNodeSpec({type:"heading",group:"block",content:{allow:["text"]},excludeMarks:["fontSize"],attrs:{level:{default:1}},toDOM:t=>l(T[t.attrs?.level??1]??"h1",t.id),toHTML(t,e){const n=T[t.attrs?.level??1]??"h1";return`<${n}>${e||"<br>"}</${n}>`},parseHTML:[{tag:"h1",getAttrs:()=>({level:1})},{tag:"h2",getAttrs:()=>({level:2})},{tag:"h3",getAttrs:()=>({level:3})},{tag:"h4",getAttrs:()=>({level:4})},{tag:"h5",getAttrs:()=>({level:5})},{tag:"h6",getAttrs:()=>({level:6})}],sanitize:{tags:["h1","h2","h3","h4","h5","h6"]}})}};export{y as n,x as r,B as t};
|
|
2
|
-
//# sourceMappingURL=HeadingPlugin-D9yvG2Aw.mjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{i as t}from"./Document-r7vLOAGA.mjs";import{o as r,t as o,u as e}from"./Selection-HYoVFpAx.mjs";import{a as s}from"./TypeBrands-Ch9856Gb.mjs";import{n as i}from"./DomUtils-Bf7JLFlx.mjs";import{s as l}from"./BlockInsertion-6rR9tIGP.mjs";import{c as a,i as n,o as c}from"./PluginHelpers-KDuTlmXm.mjs";import{t as m}from"./ShortcutFormatting-TwiufqeV.mjs";var p={label:"Horizontal Rule",tooltip:t=>`Horizontal Rule (${t})`},u=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar-CrOb0jL2.mjs"),"./locales/de.ts":()=>import("./de-C7uehgMu.mjs"),"./locales/es.ts":()=>import("./es-xuahrvJN.mjs"),"./locales/fr.ts":()=>import("./fr-B9pBLaVx.mjs"),"./locales/hi.ts":()=>import("./hi-DWX6k5ZD.mjs"),"./locales/pt.ts":()=>import("./pt-DFKJVh7k.mjs"),"./locales/ru.ts":()=>import("./ru-q8kz-237.mjs"),"./locales/zh.ts":()=>import("./zh-BGYJXxVl.mjs")});async function h(t){return a(u,t,p)}var d={},g=class{id="horizontal-rule";name="Horizontal Rule";priority=40;config;locale;constructor(t){this.config={...d,...t}}async init(t){this.locale=await c(t,this.config.locale,p,h),this.registerNodeSpec(t),this.registerCommands(t),this.registerKeymap(t),this.registerInputRule(t),this.registerToolbarItem(t)}registerNodeSpec(t){t.registerNodeSpec({type:"horizontal_rule",group:"block",isVoid:!0,toDOM:t=>i("hr",t.id),toHTML:()=>"<hr>",parseHTML:[{tag:"hr"}],sanitize:{tags:["hr"]}})}registerCommands(t){t.registerCommand("insertHorizontalRule",()=>this.insertHorizontalRule(t))}registerKeymap(t){t.registerKeymap({"Mod-Shift-H":()=>t.executeCommand("insertHorizontalRule")})}registerInputRule(i){i.registerInputRule({pattern:/^-{3,} $/,handler(i,l,a,n){const c=i.selection;if(!e(c))return null;if(!r(c))return null;const m=i.getBlock(c.anchor.blockId);if(!m||"paragraph"!==m.type)return null;const p=function(t){const r=t.selection;return e(r)?t.doc.children.findIndex(t=>t.id===r.anchor.blockId):-1}(i);if(-1===p)return null;const u=t(s("paragraph"));return i.transaction("input").deleteTextAt(c.anchor.blockId,0,n).setBlockType(c.anchor.blockId,s("horizontal_rule")).insertNode([],p+1,u).setSelection(o(u.id,0)).build()}})}registerToolbarItem(t){t.registerToolbarItem({id:"horizontal-rule",group:"block",icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 11h16v2H4z"/></svg>',label:this.locale.label,tooltip:this.locale.tooltip(m("Mod-Shift-H")),command:"insertHorizontalRule",isActive:()=>!1})}insertHorizontalRule(r){const e=r.getState(),i=n(e);if(!i)return!1;const a=e.transaction("command"),c=l(e,a,i,t(s("horizontal_rule")));return!!c&&(a.setSelection(o(c.id,0)),r.dispatch(a.build()),!0)}};export{p as n,h as r,g as t};
|
|
2
|
-
//# sourceMappingURL=HorizontalRulePlugin-0FjHPZuA.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"HorizontalRulePlugin-0FjHPZuA.mjs","names":[],"sources":["../../src/plugins/horizontal-rule/HorizontalRuleLocale.ts","../../src/plugins/horizontal-rule/HorizontalRulePlugin.ts"],"sourcesContent":["/** Locale interface and default English locale for the HorizontalRulePlugin. */\n\nimport { type LocaleModuleMap, loadLocaleModule } from '../shared/LocaleLoader.js';\n\n// --- Locale Interface ---\n\nexport interface HorizontalRuleLocale {\n\treadonly label: string;\n\treadonly tooltip: (shortcut: string) => string;\n}\n\n// --- Default English Locale ---\n\nexport const HORIZONTAL_RULE_LOCALE_EN: HorizontalRuleLocale = {\n\tlabel: 'Horizontal Rule',\n\ttooltip: (shortcut: string) => `Horizontal Rule (${shortcut})`,\n};\n\n// --- Lazy Locale Loader ---\n\nconst localeModules: LocaleModuleMap<HorizontalRuleLocale> = import.meta.glob<{\n\tdefault: HorizontalRuleLocale;\n}>('./locales/*.ts', { eager: false });\n\nexport async function loadHorizontalRuleLocale(lang: string): Promise<HorizontalRuleLocale> {\n\treturn loadLocaleModule(localeModules, lang, HORIZONTAL_RULE_LOCALE_EN);\n}\n","/**\n * HorizontalRulePlugin: registers a horizontal rule (divider) void block type\n * with NodeSpec, insert command, input rule, keyboard shortcut, and toolbar button.\n */\n\nimport { insertBlockObjectOnOwnLine } from '../../commands/BlockInsertion.js';\nimport { createBlockNode } from '../../model/Document.js';\nimport { createCollapsedSelection, isCollapsed, isTextSelection } from '../../model/Selection.js';\nimport { nodeType } from '../../model/TypeBrands.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport { createBlockElement } from '../../view/DomUtils.js';\nimport type { Plugin, PluginContext } from '../Plugin.js';\nimport { getSelectedBlockId, resolveLocale } from '../shared/PluginHelpers.js';\nimport { formatShortcut } from '../shared/ShortcutFormatting.js';\nimport {\n\tHORIZONTAL_RULE_LOCALE_EN,\n\ttype HorizontalRuleLocale,\n\tloadHorizontalRuleLocale,\n} from './HorizontalRuleLocale.js';\n\n// --- Attribute Registry Augmentation ---\n\ndeclare module '../../model/AttrRegistry.js' {\n\tinterface NodeAttrRegistry {\n\t\thorizontal_rule: Record<string, never>;\n\t}\n}\n\n// --- Configuration ---\n\nexport interface HorizontalRuleConfig {\n\t/** Locale override for user-facing strings. */\n\treadonly locale?: HorizontalRuleLocale;\n}\n\nconst DEFAULT_CONFIG: HorizontalRuleConfig = {};\n\n// --- Helpers ---\n\n/** Finds the index of the cursor's block among top-level document children. */\nfunction findBlockIndexForCursor(state: EditorState): number {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return -1;\n\treturn state.doc.children.findIndex((b) => b.id === sel.anchor.blockId);\n}\n\n// --- Plugin ---\n\nexport class HorizontalRulePlugin implements Plugin {\n\treadonly id = 'horizontal-rule';\n\treadonly name = 'Horizontal Rule';\n\treadonly priority = 40;\n\n\tprivate readonly config: HorizontalRuleConfig;\n\tprivate locale!: HorizontalRuleLocale;\n\n\tconstructor(config?: Partial<HorizontalRuleConfig>) {\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\tHORIZONTAL_RULE_LOCALE_EN,\n\t\t\tloadHorizontalRuleLocale,\n\t\t);\n\t\tthis.registerNodeSpec(context);\n\t\tthis.registerCommands(context);\n\t\tthis.registerKeymap(context);\n\t\tthis.registerInputRule(context);\n\t\tthis.registerToolbarItem(context);\n\t}\n\n\tprivate registerNodeSpec(context: PluginContext): void {\n\t\tcontext.registerNodeSpec({\n\t\t\ttype: 'horizontal_rule',\n\t\t\tgroup: 'block',\n\t\t\tisVoid: true,\n\t\t\ttoDOM(node) {\n\t\t\t\treturn createBlockElement('hr', node.id);\n\t\t\t},\n\t\t\ttoHTML() {\n\t\t\t\treturn '<hr>';\n\t\t\t},\n\t\t\tparseHTML: [{ tag: 'hr' }],\n\t\t\tsanitize: { tags: ['hr'] },\n\t\t});\n\t}\n\n\tprivate registerCommands(context: PluginContext): void {\n\t\tcontext.registerCommand('insertHorizontalRule', () => {\n\t\t\treturn this.insertHorizontalRule(context);\n\t\t});\n\t}\n\n\tprivate registerKeymap(context: PluginContext): void {\n\t\tcontext.registerKeymap({\n\t\t\t'Mod-Shift-H': () => context.executeCommand('insertHorizontalRule'),\n\t\t});\n\t}\n\n\tprivate registerInputRule(context: PluginContext): void {\n\t\tcontext.registerInputRule({\n\t\t\tpattern: /^-{3,} $/,\n\t\t\thandler(state, _match, _start, end) {\n\t\t\t\tconst sel = state.selection;\n\t\t\t\tif (!isTextSelection(sel)) return null;\n\t\t\t\tif (!isCollapsed(sel)) return null;\n\n\t\t\t\tconst block = state.getBlock(sel.anchor.blockId);\n\t\t\t\tif (!block || block.type !== 'paragraph') return null;\n\n\t\t\t\tconst blockIndex: number = findBlockIndexForCursor(state);\n\t\t\t\tif (blockIndex === -1) return null;\n\n\t\t\t\tconst newParagraph = createBlockNode(nodeType('paragraph'));\n\n\t\t\t\treturn state\n\t\t\t\t\t.transaction('input')\n\t\t\t\t\t.deleteTextAt(sel.anchor.blockId, 0, end)\n\t\t\t\t\t.setBlockType(sel.anchor.blockId, nodeType('horizontal_rule'))\n\t\t\t\t\t.insertNode([], blockIndex + 1, newParagraph)\n\t\t\t\t\t.setSelection(createCollapsedSelection(newParagraph.id, 0))\n\t\t\t\t\t.build();\n\t\t\t},\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=\"M4 11h16v2H4z\"/></svg>';\n\n\t\tcontext.registerToolbarItem({\n\t\t\tid: 'horizontal-rule',\n\t\t\tgroup: 'block',\n\t\t\ticon,\n\t\t\tlabel: this.locale.label,\n\t\t\ttooltip: this.locale.tooltip(formatShortcut('Mod-Shift-H')),\n\t\t\tcommand: 'insertHorizontalRule',\n\t\t\tisActive: () => false,\n\t\t});\n\t}\n\n\t/**\n\t * Inserts a horizontal rule after the current block,\n\t * followed by a new paragraph for continued editing.\n\t */\n\tprivate insertHorizontalRule(context: PluginContext): boolean {\n\t\tconst state: EditorState = context.getState();\n\t\tconst anchorBlockId = getSelectedBlockId(state);\n\t\tif (!anchorBlockId) return false;\n\n\t\tconst builder = state.transaction('command');\n\t\tconst trailing = insertBlockObjectOnOwnLine(\n\t\t\tstate,\n\t\t\tbuilder,\n\t\t\tanchorBlockId,\n\t\t\tcreateBlockNode(nodeType('horizontal_rule')),\n\t\t);\n\t\tif (!trailing) return false;\n\n\t\tbuilder.setSelection(createCollapsedSelection(trailing.id, 0));\n\t\tcontext.dispatch(builder.build());\n\t\treturn true;\n\t}\n}\n"],"mappings":"wWAaA,IAAa,EAAkD,CAC9D,MAAO,kBACP,QAAU,GAAqB,oBAAoB,MAK9C,iBAAuD,OAAA,OAAA,CAAA,kBAAA,IAAA,OAAA,qBAAA,kBAAA,IAAA,OAAA,qBAAA,kBAAA,IAAA,OAAA,qBAAA,kBAAA,IAAA,OAAA,qBAAA,kBAAA,IAAA,OAAA,qBAAA,k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GACnD,IAAmB,IAAf,EAAmB,OAAO,KAE9B,MAAM,EAAe,EAAgB,EAAS,cAE9C,OAAO,EACL,YAAY,SACZ,aAAa,EAAI,OAAO,QAAS,EAAG,GACpC,aAAa,EAAI,OAAO,QAAS,EAAS,oBAC1C,WAAW,GAAI,EAAa,EAAG,GAC/B,aAAa,EAAyB,EAAa,GAAI,IACvD,OACH,GAEF,CAEA,mBAAA,CAA4B,GAI3B,EAAQ,oBAAoB,CAC3B,GAAI,kBACJ,MAAO,QACP,KAAA,8FACA,MAAO,KAAK,OAAO,MACnB,QAAS,KAAK,OAAO,QAAQ,EAAe,gBAC5C,QAAS,uBACT,SAAA,KAAgB,GAElB,CAMA,oBAAA,CAA6B,GAC5B,MAAM,EAAqB,EAAQ,WAC7B,EAAgB,EAAmB,GACzC,IAAK,EAAe,OAAO,EAE3B,MAAM,EAAU,EAAM,YAAY,WAC5B,EAAW,EAChB,EACA,EACA,EACA,EAAgB,EAAS,qBAE1B,QAAK,IAEL,EAAQ,aAAa,EAAyB,EAAS,GAAI,IAC3D,EAAQ,SAAS,EAAQ,UAClB,EACR"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{S as t,d as e,i as n}from"./Document-r7vLOAGA.mjs";import{c as i,l as o,r}from"./Selection-HYoVFpAx.mjs";import{a}from"./TypeBrands-Ch9856Gb.mjs";import{n as s}from"./DomUtils-Bf7JLFlx.mjs";import{r as l}from"./HTMLUtils-C6B4UT00.mjs";import{s as c}from"./BlockInsertion-6rR9tIGP.mjs";import{t as d}from"./NodeSelectionCommands-Dj4VxLdD.mjs";import{t as g}from"./Platform-ByobkiCc.mjs";import{o as m,r as p,s as u}from"./StyleRuntime-BAutwDZT.mjs";import{n as h}from"./TypedKeys-CA4bfw9O.mjs";import{c as f,o as b}from"./PluginHelpers-KDuTlmXm.mjs";import{t as v}from"./ShortcutFormatting-TwiufqeV.mjs";function x(s,l){const d=s.getState(),g=d.selection,m={src:l.src,alt:l.alt??"",align:l.align??"center",...void 0!==l.width?{width:l.width}:{},...void 0!==l.height?{height:l.height}:{}};if(i(g))return!1;const p=o(g)?g.nodeId:g.anchor.blockId,u=function(t,e){if("table_cell"===t.getBlock(e)?.type)return e;const n=t.getNodePath(e);if(n)for(const i of n)if("table_cell"===t.getBlock(i)?.type)return i}(d,p);return u?function(i,o,s,l){const c=i.getNodePath(s);if(!c)return!1;const d=n(a("image"),[],void 0,l),g=i.getBlock(s);if(!g)return!1;const m=i.transaction("command"),p=e(g);for(let e=p.length-1;e>=0;e--){const n=g.children.findIndex(n=>t(n)&&n.id===p[e]?.id);-1!==n&&m.removeNode(c,n)}return m.insertNode(c,0,d),m.setSelection(r(d.id,[...c,d.id])),o.dispatch(m.build()),!0}(d,s,u,m):function(t,e,i,o){const s=n(a("image"),[],void 0,o),l=t.transaction("command");return!!c(t,l,i,s)&&(l.setSelection(r(s.id,[])),e.dispatch(l.build()),!0)}(d,s,p,m)}function _(t,e,n){const i=t.getState(),r=i.selection;if(!o(r))return!1;const a=i.getBlock(r.nodeId);if(!a||"image"!==a.type)return!1;const s=a.attrs?.width,l=a.attrs?.height;if(void 0===s||void 0===l)return!1;const c=l>0?s/l:1,d=Math.max(50,Math.min(n,s+e)),g=Math.round(d/c);return(d!==s||g!==l)&&function(t,e){const n=t.getState(),i=n.selection;if(!o(i))return!1;const r=n.getBlock(i.nodeId);if(!r||"image"!==r.type)return!1;const a=n.getNodePath(i.nodeId);if(!a)return!1;const s={...r.attrs??{},...e},l=n.transaction("command").setNodeAttr(a,s).build();return t.dispatch(l),!0}(t,{width:d,height:g})}var w={insertImage:"Insert Image",insertImageTooltip:"Insert Image",uploadFromComputer:"Upload from computer",uploadAria:"Upload image from computer",separator:"or",urlPlaceholder:"https://...",urlAria:"Image URL",insertButton:"Insert",insertAria:"Insert image",imageAria:(t,e,n)=>{const i=[t||"Image"];return void 0!==e&&void 0!==n&&i.push(`${e} by ${n} pixels`),i.join(", ")},resetToNaturalSize:"Image reset to natural size.",uploadFailed:"Upload failed.",uploading:"Uploading...",resizeHandleLabel:t=>`Resize ${t}`,imageSelected:"Image selected.",altTextPrefix:"Alt text: ",imageSizeAnnounce:(t,e)=>`Size: ${t} by ${e} pixels.`,resizeHint:(t,e)=>`${t} / ${e} to resize.`,imageResized:(t,e)=>`Image resized to ${t} by ${e} pixels.`,keyboardResizeHint:(t,e)=>`${t} / ${e} to resize`},z=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar-4b8e2YSc.mjs"),"./locales/de.ts":()=>import("./de-i95F9SDy.mjs"),"./locales/es.ts":()=>import("./es-DehVGwQ8.mjs"),"./locales/fr.ts":()=>import("./fr-DEZ_oxzS.mjs"),"./locales/hi.ts":()=>import("./hi-J8ErB5nB.mjs"),"./locales/pt.ts":()=>import("./pt-BlFAJZo7.mjs"),"./locales/ru.ts":()=>import("./ru-D53d-_UB.mjs"),"./locales/zh.ts":()=>import("./zh-DdzgYD7k.mjs")});async function y(t){return f(z,t,w)}var S={start:"notectl-image--start",center:"notectl-image--center",end:"notectl-image--end"},I={nw:"nwse-resize",ne:"nesw-resize",sw:"nesw-resize",se:"nwse-resize"},k={nw:-1,ne:1,sw:-1,se:1},L={nw:"nesw-resize",ne:"nwse-resize",sw:"nwse-resize",se:"nesw-resize"},C=null;function A(){C&&(C.remove(),C=null)}function N(t,e,n,i=w){return(o,r,a)=>{const s=document.createElement("figure");s.className="notectl-image",s.setAttribute("data-block-id",o.id),s.setAttribute("data-void","true"),s.setAttribute("data-selectable","true");const l=document.createElement("div");l.className="notectl-image__container";const c=document.createElement("img");c.className="notectl-image__img",c.draggable=!1;const d=document.createElement("div");d.className="notectl-image__overlay",l.appendChild(c),l.appendChild(d),s.appendChild(l);let h=o.id,f=null;function b(t){const n=t.attrs?.src??"",o=t.attrs?.alt??"",r=t.attrs?.width,a=t.attrs?.height,l=t.attrs?.align??"center";c.src!==n&&(c.src=n),c.alt=o,u(c,"width",void 0!==r?`${r}px`:""),u(c,"height",void 0!==a?`${a}px`:"");for(const e of Object.values(S))s.classList.remove(e);const g=S[l];g&&s.classList.add(g);const m=e.get(t.id)??"idle",p="uploading"===m;d.classList.toggle("notectl-image__overlay--uploading",p),d.classList.toggle("notectl-image__overlay--error","error"===m),d.textContent=p?i.uploading:"error"===m?i.uploadFailed:"",p?s.setAttribute("aria-busy","true"):s.removeAttribute("aria-busy"),function(t){const e=t.attrs?.alt??"",n=t.attrs?.width,o=t.attrs?.height;s.setAttribute("aria-label",i.imageAria(e,n,o))}(t)}b(o);let x=!1;function _(e,n,i,o){let l=0,d=0,u=1,h=k[n];const f=e=>{const n=e.clientX-l,i=(r=d+n*h,Math.max(50,Math.min(t.maxWidth,r)));var r;const a=Math.round(i/u);m(c,{width:`${i}px`,height:`${a}px`}),o.textContent=`${Math.round(i)} × ${a}`},b=t=>{document.removeEventListener("pointermove",f),document.removeEventListener("pointerup",b),s.classList.remove("notectl-image--resizing"),o.classList.remove("notectl-image__size-indicator--visible"),A();const e=Math.round(c.getBoundingClientRect().width);!function(t,e,n){const i=r(),o=i.getBlock(t);if(!o)return;const s=o.attrs?.width,l=o.attrs?.height;if(s===e&&l===n)return;const c=i.getNodePath(t);if(!c)return;const d={...o.attrs??{},width:e,height:n};a(i.transaction("command").setNodeAttr(c,d).build())}(i,e,Math.round(e/u)),t.target?.releasePointerCapture?.(t.pointerId)};e.addEventListener("pointerdown",t=>{t.preventDefault(),t.stopPropagation();const e="rtl"===g(s);h=function(t,e){const n=k[t];return e?-n:n}(n,e),l=t.clientX,d=c.getBoundingClientRect().width;const i=c.getBoundingClientRect().height;u=i>0?d/i:1,s.classList.add("notectl-image--resizing"),o.textContent=`${Math.round(d)} × ${Math.round(i)}`,o.classList.add("notectl-image__size-indicator--visible"),function(t,e){A(),C=document.createElement("style");const n=e?p(e):void 0;n&&C.setAttribute("nonce",n),C.textContent=`*{cursor:${t}!important;user-select:none!important}`,document.head.appendChild(C)}(e?L[n]:I[n],s),t.target.setPointerCapture(t.pointerId),document.addEventListener("pointermove",f),document.addEventListener("pointerup",b)})}function w(){A(),f&&(f.remove(),f=null)}return c.addEventListener("load",()=>{if(x)return;const e=r(),n=e.getBlock(h);if(!n||"image"!==n.type)return;const i=void 0!==n.attrs?.width,o=void 0!==n.attrs?.height;if(i&&o)return void(x=!0);const s=c.naturalWidth,l=c.naturalHeight;if(0===s||0===l)return;const d=Math.min(s,t.maxWidth),g=s>0?l/s:1,m=Math.round(d*g),p=e.getNodePath(h);if(!p)return;const u={...n.attrs??{},width:d,height:m};a(e.transaction("command").setNodeAttr(p,u).build()),x=!0}),{dom:s,contentDOM:null,update:t=>"image"===t.type&&(h=t.id,s.setAttribute("data-block-id",t.id),b(t),!0),selectNode(){s.classList.add("notectl-image--selected"),function(e){if(!t.resizable||f)return;f=document.createElement("div"),f.className="notectl-image__resize-overlay",f.setAttribute("data-notectl-no-print","");const o=document.createElement("div");o.className="notectl-image__size-indicator",f.appendChild(o);for(const t of["nw","ne","sw","se"]){const n=document.createElement("div");n.className=`notectl-image__resize-handle notectl-image__resize-handle--${t}`,n.setAttribute("aria-hidden","true"),_(n,t,e,o),f.appendChild(n)}if(n){const t=function(t,e){const n=t.shrinkWidth??null,i=t.growWidth??null;return n&&i?e.keyboardResizeHint(v(n),v(i)):""}(n,i);if(t){const e=document.createElement("div");e.className="notectl-image__keyboard-hint",e.setAttribute("aria-hidden","true"),e.textContent=t,f.appendChild(e)}}l.appendChild(f)}(h)},deselectNode(){s.classList.remove("notectl-image--selected"),w()},destroy(){w()}}}}var j=new h("image:upload"),E={growWidth:"Mod-Shift-ArrowRight",shrinkWidth:"Mod-Shift-ArrowLeft",growWidthLarge:"Mod-Shift-Alt-ArrowRight",shrinkWidthLarge:"Mod-Shift-Alt-ArrowLeft",resetSize:"Mod-Shift-0"},$={maxWidth:800,maxFileSize:10485760,acceptedTypes:["image/png","image/jpeg","image/gif","image/webp","image/svg+xml"],resizable:!0,resizeStep:10,resizeStepLarge:50},R=class{id="image";name="Image";priority=45;config;resolvedKeymap;uploadStates=/* @__PURE__ */new Map;blobUrls=/* @__PURE__ */new Set;context=null;locale;constructor(t){this.config={...$,...t},this.resolvedKeymap={...E,...t?.keymap}}async init(t){this.locale=await b(t,this.config.locale,w,y),t.registerStyleSheet('\n/* Image */\n.notectl-image {\n\tmargin: 8px 0;\n\tuser-select: none;\n\tline-height: 0;\n}\n\n.notectl-image--center {\n\ttext-align: center;\n}\n\n.notectl-image--start {\n\ttext-align: start;\n}\n\n.notectl-image--end {\n\ttext-align: end;\n}\n\n.notectl-image__container {\n\tdisplay: inline-block;\n\tposition: relative;\n\tline-height: 0;\n}\n\n.notectl-image__img {\n\tdisplay: block;\n\tmax-width: 100%;\n\tborder-radius: 4px;\n}\n\n.notectl-image--selected .notectl-image__container {\n\toutline: 2px solid var(--notectl-primary);\n\toutline-offset: 2px;\n\tborder-radius: 6px;\n}\n\n/* Alignment toolbar (appears on image selection) */\n.notectl-image__align-toolbar {\n\tdisplay: flex;\n\tgap: 2px;\n\tposition: absolute;\n\ttop: -36px;\n\tleft: 50%;\n\ttransform: translateX(-50%);\n\tbackground: var(--notectl-surface-overlay);\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 6px;\n\tpadding: 2px;\n\tbox-shadow: 0 2px 8px var(--notectl-shadow);\n\tz-index: 10;\n}\n\n.notectl-image__align-btn {\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\twidth: 28px;\n\theight: 28px;\n\tborder: none;\n\tbackground: transparent;\n\tborder-radius: 4px;\n\tcursor: pointer;\n\tcolor: var(--notectl-fg);\n}\n\n.notectl-image__align-btn:hover {\n\tbackground: var(--notectl-hover-bg);\n}\n\n.notectl-image__align-btn--active {\n\tbackground: var(--notectl-active-bg);\n\tcolor: var(--notectl-primary-fg);\n}\n\n.notectl-image__align-btn svg {\n\twidth: 16px;\n\theight: 16px;\n\tfill: currentColor;\n}\n\n/* Upload overlay */\n.notectl-image__overlay {\n\tposition: absolute;\n\tinset: 0;\n\tdisplay: none;\n\talign-items: center;\n\tjustify-content: center;\n\tbackground: rgba(255, 255, 255, 0.8);\n\tborder-radius: 4px;\n\tfont-size: 13px;\n\tcolor: var(--notectl-fg-muted);\n}\n\n.notectl-image__overlay--uploading {\n\tdisplay: flex;\n}\n\n.notectl-image__overlay--error {\n\tdisplay: flex;\n\tbackground: var(--notectl-danger-muted);\n\tcolor: var(--notectl-danger);\n}\n\n/* Resize overlay + handles */\n.notectl-image__resize-overlay {\n\tposition: absolute;\n\tinset: 0;\n\tpointer-events: none;\n}\n\n.notectl-image__resize-handle {\n\tposition: absolute;\n\twidth: 10px;\n\theight: 10px;\n\tbackground: var(--notectl-surface-raised);\n\tborder: 2px solid var(--notectl-primary);\n\tborder-radius: 50%;\n\tpointer-events: all;\n\tz-index: 2;\n\ttransition: transform 0.1s, background 0.1s;\n}\n\n.notectl-image__resize-handle:hover {\n\tbackground: var(--notectl-primary);\n\ttransform: scale(1.3);\n}\n\n.notectl-image--resizing .notectl-image__resize-handle {\n\tbackground: var(--notectl-primary);\n}\n\n.notectl-image__resize-handle--nw {\n\ttop: -5px;\n\tinset-inline-start: -5px;\n\tcursor: nwse-resize;\n}\n\n.notectl-image__resize-handle--ne {\n\ttop: -5px;\n\tinset-inline-end: -5px;\n\tcursor: nesw-resize;\n}\n\n.notectl-image__resize-handle--sw {\n\tbottom: -5px;\n\tinset-inline-start: -5px;\n\tcursor: nesw-resize;\n}\n\n.notectl-image__resize-handle--se {\n\tbottom: -5px;\n\tinset-inline-end: -5px;\n\tcursor: nwse-resize;\n}\n\n/* RTL cursor overrides — flip diagonal cursors when in RTL context */\n[dir="rtl"] .notectl-image__resize-handle--nw {\n\tcursor: nesw-resize;\n}\n\n[dir="rtl"] .notectl-image__resize-handle--ne {\n\tcursor: nwse-resize;\n}\n\n[dir="rtl"] .notectl-image__resize-handle--sw {\n\tcursor: nwse-resize;\n}\n\n[dir="rtl"] .notectl-image__resize-handle--se {\n\tcursor: nesw-resize;\n}\n\n/* Size indicator tooltip */\n.notectl-image__size-indicator {\n\tposition: absolute;\n\tbottom: -28px;\n\tleft: 50%;\n\ttransform: translateX(-50%);\n\tpadding: 2px 8px;\n\tbackground: var(--notectl-tooltip-bg);\n\tcolor: var(--notectl-tooltip-fg);\n\tfont-size: 11px;\n\tfont-weight: 500;\n\tborder-radius: 4px;\n\twhite-space: nowrap;\n\tpointer-events: none;\n\topacity: 0;\n\ttransition: opacity 0.15s;\n\tz-index: 3;\n}\n\n.notectl-image__size-indicator--visible {\n\topacity: 1;\n}\n\n/* Keyboard resize hint (shown on selection, hidden during drag) */\n.notectl-image__keyboard-hint {\n\tdisplay: none;\n\tposition: absolute;\n\tbottom: -28px;\n\tleft: 50%;\n\ttransform: translateX(-50%);\n\tpadding: 2px 8px;\n\tfont-size: 11px;\n\tcolor: var(--notectl-fg-muted);\n\twhite-space: nowrap;\n\tpointer-events: none;\n\tz-index: 3;\n}\n\n.notectl-image--selected .notectl-image__keyboard-hint {\n\tdisplay: block;\n}\n\n.notectl-image--resizing .notectl-image__keyboard-hint {\n\tdisplay: none;\n}\n\n/* Resizing feedback */\n.notectl-image--resizing .notectl-image__img {\n\topacity: 0.85;\n}\n'),t.registerStyleSheet("\n.notectl-image-popup {\n\tpadding: 8px;\n\tmin-width: 240px;\n}\n\n.notectl-image-popup__file-input {\n\tposition: absolute;\n\twidth: 0;\n\theight: 0;\n\toverflow: hidden;\n\topacity: 0;\n}\n\n.notectl-image-popup__upload-btn {\n\tdisplay: block;\n\twidth: 100%;\n\tpadding: 8px 12px;\n\tcursor: pointer;\n\ttext-align: center;\n\tbox-sizing: border-box;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 4px;\n\tbackground: var(--notectl-surface-raised);\n\tcolor: var(--notectl-fg);\n}\n\n.notectl-image-popup__separator {\n\tdisplay: flex;\n\talign-items: center;\n\tmargin: 8px 0;\n\tcolor: var(--notectl-fg-muted);\n\tfont-size: 12px;\n}\n\n.notectl-image-popup__separator-line {\n\tflex: 1;\n\theight: 1px;\n\tbackground: var(--notectl-border);\n}\n\n.notectl-image-popup__separator-text {\n\tpadding: 0 8px;\n}\n\n.notectl-image-popup__url-input {\n\twidth: 100%;\n\tpadding: 6px 8px;\n\tbox-sizing: border-box;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 4px;\n\tbackground: var(--notectl-surface-overlay);\n\tcolor: var(--notectl-fg);\n}\n\n.notectl-image-popup__insert-btn {\n\twidth: 100%;\n\tpadding: 8px 12px;\n\tmargin-top: 4px;\n\tcursor: pointer;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 4px;\n\tbackground: var(--notectl-surface-raised);\n\tcolor: var(--notectl-fg);\n}\n"),this.context=t,this.registerNodeSpec(t),this.registerNodeView(t),function(t){t.registerCommand("insertImage",()=>x(t,{src:""})),t.registerCommand("removeImage",()=>function(t){const e=t.getState(),n=e.selection;if(!o(n))return!1;const i=e.getBlock(n.nodeId);if(!i||"image"!==i.type)return!1;const a=e.getNodePath(n.nodeId);if(!a||0===a.length)return!1;const s=d(e,r(n.nodeId,a));return!!s&&(t.dispatch(s),!0)}(t))}(t),this.registerResizeCommands(t),this.registerResizeKeymaps(t),this.registerFileHandler(t),this.registerToolbarItem(t)}destroy(){for(const t of this.blobUrls)URL.revokeObjectURL(t);this.blobUrls.clear(),this.uploadStates.clear(),this.context=null}onStateChange(t,e,n){if(!this.context)return;for(const r of this.uploadStates.keys())e.getBlock(r)||this.uploadStates.delete(r);const i=this.isImageSelected(t),o=this.isImageSelected(e);!i&&o&&this.announceImageSelection(e)}registerNodeSpec(t){const e=this.locale;t.registerNodeSpec({type:"image",group:"block",isVoid:!0,selectable:!0,attrs:{src:{default:""},alt:{default:""},align:{default:"center"}},toDOM(t){const n=s("figure",t.id);n.className="notectl-image",n.setAttribute("data-void","true"),n.setAttribute("data-selectable","true");const i=document.createElement("div");i.className="notectl-image__container";const o=t.attrs?.alt??"",r=t.attrs?.width,a=t.attrs?.height,l=document.createElement("img");l.className="notectl-image__img",l.src=t.attrs?.src??"",l.alt=o,l.draggable=!1,void 0!==r&&u(l,"width",`${r}px`),void 0!==a&&u(l,"height",`${a}px`);const c={start:"notectl-image--start",center:"notectl-image--center",end:"notectl-image--end"}[t.attrs?.align??"center"];return c&&n.classList.add(c),n.setAttribute("aria-label",e.imageAria(o,r,a)),i.appendChild(l),n.appendChild(i),n},toHTML(t){const e=l(t.attrs?.src??""),n=l(t.attrs?.alt??""),i=t.attrs?.width,o=t.attrs?.height;return`<figure><img src="${e}" alt="${n}"${(void 0!==i?` width="${i}"`:"")+(void 0!==o?` height="${o}"`:"")}></figure>`},parseHTML:[{tag:"figure",getAttrs(t){const e=t.querySelector("img");if(!e)return!1;const n={src:e.getAttribute("src")??"",alt:e.getAttribute("alt")??"",align:"center"},i=e.getAttribute("width"),o=e.getAttribute("height");i&&(n.width=Number.parseInt(i,10)),o&&(n.height=Number.parseInt(o,10));const r=t.style?.textAlign??"";return"start"===r||"end"===r||"center"===r?n.align=r:"left"===r?n.align="start":"right"===r?n.align="end":t.classList.contains("notectl-align-start")||t.classList.contains("notectl-align-left")||t.classList.contains("notectl-image--start")||t.classList.contains("notectl-image--left")?n.align="start":t.classList.contains("notectl-align-end")||t.classList.contains("notectl-align-right")||t.classList.contains("notectl-image--end")||t.classList.contains("notectl-image--right")?n.align="end":t.classList.contains("notectl-align-center")&&(n.align="center"),n}},{tag:"img",getAttrs(t){const e={src:t.getAttribute("src")??"",alt:t.getAttribute("alt")??"",align:"center"},n=t.getAttribute("width"),i=t.getAttribute("height");return n&&(e.width=Number.parseInt(n,10)),i&&(e.height=Number.parseInt(i,10)),e}}],sanitize:{tags:["figure","img"],attrs:["src","alt","width","height","class","style"]}})}registerNodeView(t){t.registerNodeView("image",N(this.config,this.uploadStates,this.resolvedKeymap,this.locale))}registerResizeCommands(t){const e=this.config.resizeStep??10,n=this.config.resizeStepLarge??50,i=this.config.maxWidth;t.registerCommand("resizeImageGrow",()=>{const n=_(t,e,i);return n&&this.announceCurrentSize(t),n}),t.registerCommand("resizeImageShrink",()=>{const n=_(t,-e,i);return n&&this.announceCurrentSize(t),n}),t.registerCommand("resizeImageGrowLarge",()=>{const e=_(t,n,i);return e&&this.announceCurrentSize(t),e}),t.registerCommand("resizeImageShrinkLarge",()=>{const e=_(t,-n,i);return e&&this.announceCurrentSize(t),e}),t.registerCommand("resetImageSize",()=>{const e=function(t){const e=t.getState(),n=e.selection;if(!o(n))return!1;const i=e.getBlock(n.nodeId);if(!i||"image"!==i.type)return!1;const r=e.getNodePath(n.nodeId);if(!r)return!1;const a={...i.attrs??{}},s=Object.fromEntries(Object.entries(a).filter(([t])=>"width"!==t&&"height"!==t)),l=e.transaction("command").setNodeAttr(r,s).build();return t.dispatch(l),!0}(t);return e&&t.announce(this.locale.resetToNaturalSize),e})}registerResizeKeymaps(t){const e={};for(const[n,i]of Object.entries({growWidth:"resizeImageGrow",shrinkWidth:"resizeImageShrink",growWidthLarge:"resizeImageGrowLarge",shrinkWidthLarge:"resizeImageShrinkLarge",resetSize:"resetImageSize"})){const o=this.resolvedKeymap[n]??null;o&&(e[o]=()=>t.executeCommand(i))}Object.keys(e).length>0&&t.registerKeymap(e)}registerFileHandler(t){t.registerFileHandler("image/*",async(e,n)=>!!this.isAcceptedType(e.type)&&(this.handleFileInsert(t,e),!0))}handleFileInsert(t,e){if(e.size>this.config.maxFileSize)return;const n=URL.createObjectURL(e);if(this.blobUrls.add(n),!x(t,{src:n}))return URL.revokeObjectURL(n),void this.blobUrls.delete(n);const i=t.getState().selection;if(!o(i))return;const r=i.nodeId;this.uploadStates.set(r,"uploading"),t.getService(j)?this.uploadFile(t,e,r,n):this.uploadStates.set(r,"complete")}async uploadFile(t,e,n,i){const o=t.getService(j);if(o)try{const r=await o.upload(e);this.uploadStates.set(n,"complete");const a=t.getState(),s=a.getBlock(n);if(!s)return;const l=a.getNodePath(n);if(!l)return;const c={...s.attrs??{},src:r.url,...void 0!==r.width?{width:r.width}:{},...void 0!==r.height?{height:r.height}:{}},d=a.transaction("command").setNodeAttr(l,c).build();t.dispatch(d),URL.revokeObjectURL(i),this.blobUrls.delete(i)}catch{this.uploadStates.set(n,"error"),t.announce(this.locale.uploadFailed)}}registerToolbarItem(t){t.registerToolbarItem({id:"image",group:"insert",icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z"/></svg>',label:this.locale.insertImage,tooltip:this.locale.insertImageTooltip,command:"insertImage",popupType:"custom",renderPopup:(t,e,n)=>{!function(t,e,n){t.classList.add("notectl-image-popup"),function(t,e,n){const i=document.createElement("input");i.type="file",i.accept=n.acceptedTypes.join(","),i.className="notectl-image-popup__file-input";const o=document.createElement("button");o.type="button",o.textContent=n.locale.uploadFromComputer,o.setAttribute("aria-label",n.locale.uploadAria),o.className="notectl-image-popup__upload-btn",o.addEventListener("mousedown",t=>{t.preventDefault(),t.stopPropagation(),i.click()}),i.addEventListener("change",()=>{const t=i.files?.[0];t&&(n.onFileInsert(e,t),n.onClose(),e.getContainer().focus())}),t.appendChild(i),t.appendChild(o)}(t,e,n),function(t,e){const n=document.createElement("div");n.className="notectl-image-popup__separator";const i=document.createElement("span");i.className="notectl-image-popup__separator-line";const o=document.createElement("span");o.textContent=e.separator,o.className="notectl-image-popup__separator-text";const r=document.createElement("span");r.className="notectl-image-popup__separator-line",n.appendChild(i),n.appendChild(o),n.appendChild(r),t.appendChild(n)}(t,n.locale),function(t,e,n){const i=document.createElement("input");i.type="url",i.placeholder=n.locale.urlPlaceholder,i.setAttribute("aria-label",n.locale.urlAria),i.className="notectl-image-popup__url-input";const o=document.createElement("button");o.type="button",o.textContent=n.locale.insertButton,o.setAttribute("aria-label",n.locale.insertAria),o.className="notectl-image-popup__insert-btn";const r=()=>{const t=i.value.trim();t&&(x(e,{src:t}),n.onClose(),e.getContainer().focus())};o.addEventListener("mousedown",t=>{t.preventDefault(),t.stopPropagation(),r()}),i.addEventListener("keydown",t=>{"Enter"===t.key&&(t.preventDefault(),r())}),t.appendChild(i),t.appendChild(o),requestAnimationFrame(()=>i.focus())}(t,e,n)}(t,e,{acceptedTypes:this.config.acceptedTypes,locale:this.locale,onFileInsert:(t,e)=>this.handleFileInsert(t,e),onClose:n})}})}isAcceptedType(t){return this.config.acceptedTypes.some(e=>e===t||e.endsWith("/*")&&t.startsWith(e.slice(0,-1)))}isImageSelected(t){const e=t.selection;return!!o(e)&&"image"===t.getBlock(e.nodeId)?.type}announceImageSelection(t){if(!this.context)return;const e=t.selection;if(!o(e))return;const n=t.getBlock(e.nodeId);if(!n||"image"!==n.type)return;const i=n.attrs?.alt??"",r=n.attrs?.width,a=n.attrs?.height,s=[this.locale.imageSelected];i&&s.push(`${this.locale.altTextPrefix}${i}.`),void 0!==r&&void 0!==a&&s.push(this.locale.imageSizeAnnounce(r,a));const l=this.resolvedKeymap.shrinkWidth??null,c=this.resolvedKeymap.growWidth??null;l&&c&&s.push(this.locale.resizeHint(v(l),v(c))),this.context.announce(s.join(" "))}announceCurrentSize(t){const e=t.getState(),n=e.selection;if(!o(n))return;const i=e.getBlock(n.nodeId);if(!i||"image"!==i.type)return;const r=i.attrs?.width,a=i.attrs?.height;void 0!==r&&void 0!==a&&t.announce(this.locale.imageResized(r,a))}};export{y as a,w as i,E as n,j as r,R as t};
|
|
2
|
-
//# sourceMappingURL=ImagePlugin-Cp_RINtc.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"InlineCodePlugin-DMr4O7c7.mjs","names":[],"sources":["../../src/plugins/inline-code/InlineCodeLocale.ts","../../src/plugins/inline-code/InlineCodePlugin.ts"],"sourcesContent":["/**\n * Locale interface and default English locale for the InlineCodePlugin.\n */\n\nimport { type LocaleModuleMap, loadLocaleModule } from '../shared/LocaleLoader.js';\n\n// --- Locale Interface ---\n\nexport interface InlineCodeLocale {\n\treadonly label: string;\n\treadonly tooltip: (shortcut: string) => string;\n}\n\n// --- Default English Locale ---\n\nexport const INLINE_CODE_LOCALE_EN: InlineCodeLocale = {\n\tlabel: 'Inline Code',\n\ttooltip: (shortcut: string) => `Inline Code (${shortcut})`,\n};\n\n// --- Lazy Locale Loader ---\n\nconst localeModules: LocaleModuleMap<InlineCodeLocale> = import.meta.glob<{\n\tdefault: InlineCodeLocale;\n}>('./locales/*.ts', { eager: false });\n\nexport async function loadInlineCodeLocale(lang: string): Promise<InlineCodeLocale> {\n\treturn loadLocaleModule(localeModules, lang, INLINE_CODE_LOCALE_EN);\n}\n","/**\n * InlineCodePlugin: registers an inline code mark with MarkSpec,\n * toggle command, keyboard shortcut (Mod-E), backtick InputRule,\n * toolbar button, and mark exclusivity middleware.\n */\n\nimport type { BlockNode, Mark } from '../../model/Document.js';\nimport { getBlockContentSegmentsInRange } from '../../model/Document.js';\nimport { createCollapsedSelection, isCollapsed, isTextSelection } from '../../model/Selection.js';\nimport { markType } from '../../model/TypeBrands.js';\nimport type { Step } from '../../state/Steps.js';\nimport type { Plugin, PluginContext } from '../Plugin.js';\nimport { resolveLocale } from '../shared/PluginHelpers.js';\nimport { formatShortcut } from '../shared/ShortcutFormatting.js';\nimport { registerSimpleMark } from '../shared/SimpleMark.js';\nimport {\n\tINLINE_CODE_LOCALE_EN,\n\ttype InlineCodeLocale,\n\tloadInlineCodeLocale,\n} from './InlineCodeLocale.js';\n\n// --- Attribute Registry Augmentation ---\n\ndeclare module '../../model/AttrRegistry.js' {\n\tinterface MarkAttrRegistry {\n\t\tcode: Record<string, never>;\n\t}\n}\n\n// --- Configuration ---\n\nexport interface InlineCodeConfig {\n\t/** Show toolbar button. Default: true */\n\treadonly toolbar?: boolean;\n\t/** Override keyboard shortcut. Set to null to disable. Default: 'Mod-E' */\n\treadonly keymap?: string | null;\n\t/** Enable backtick InputRule. Default: true */\n\treadonly inputRule?: boolean;\n\t/** Override locale strings */\n\treadonly locale?: InlineCodeLocale;\n}\n\nconst DEFAULT_CONFIG: InlineCodeConfig = {\n\ttoolbar: true,\n\tkeymap: 'Mod-E',\n\tinputRule: true,\n};\n\n// --- CSS ---\n\nconst INLINE_CODE_CSS = `\n.notectl-content code {\n\tfont-family: ui-monospace, 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;\n\tfont-size: 0.9em;\n\tpadding: 0.15em 0.35em;\n\tborder-radius: 4px;\n\tbackground-color: var(--notectl-code-bg);\n\tcolor: var(--notectl-code-color);\n\tword-break: break-word;\n}\n@media (forced-colors: active) {\n\t.notectl-content code {\n\t\tborder: 1px solid LinkText;\n\t}\n}\n`;\n\n// --- Mark Exclusivity ---\n\nconst EXCLUDED_WITH_CODE: ReadonlySet<string> = new Set([\n\t'bold',\n\t'italic',\n\t'underline',\n\t'strikethrough',\n\t'highlight',\n\t'font',\n\t'fontSize',\n\t'superscript',\n\t'subscript',\n]);\n\n// --- Plugin ---\n\nexport class InlineCodePlugin implements Plugin {\n\treadonly id = 'inline-code';\n\treadonly name = 'Inline Code';\n\treadonly priority = 22;\n\n\tprivate readonly config: InlineCodeConfig;\n\tprivate locale!: InlineCodeLocale;\n\n\tconstructor(config?: Partial<InlineCodeConfig>) {\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\tINLINE_CODE_LOCALE_EN,\n\t\t\tloadInlineCodeLocale,\n\t\t);\n\t\tcontext.registerStyleSheet(INLINE_CODE_CSS);\n\t\tthis.registerMark(context);\n\n\t\tif (this.config.inputRule !== false) {\n\t\t\tthis.registerInputRule(context);\n\t\t}\n\t\tthis.registerExclusivityMiddleware(context);\n\t}\n\n\tprivate registerMark(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=\"M9.4 16.6L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0L19.2 12l-4.6-4.6L16 6l6 6-6 6-1.4-1.4z\"/></svg>';\n\n\t\tregisterSimpleMark(context, {\n\t\t\tmarkSpec: {\n\t\t\t\ttype: 'code',\n\t\t\t\trank: 3,\n\t\t\t\ttoDOM() {\n\t\t\t\t\treturn document.createElement('code');\n\t\t\t\t},\n\t\t\t\ttoHTMLString: (_mark, content) => `<code>${content}</code>`,\n\t\t\t\tparseHTML: [\n\t\t\t\t\t{\n\t\t\t\t\t\ttag: 'code',\n\t\t\t\t\t\tgetAttrs: (el: HTMLElement) => {\n\t\t\t\t\t\t\tif (el.parentElement?.tagName === 'PRE') return false;\n\t\t\t\t\t\t\treturn {};\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\ttag: 'span',\n\t\t\t\t\t\tgetAttrs: (el: HTMLElement) => {\n\t\t\t\t\t\t\tconst fontFamily: string = el.style.fontFamily.replace(/['\"]/g, '').trim();\n\t\t\t\t\t\t\tif (/^monospace$/i.test(fontFamily)) return {};\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tsanitize: { tags: ['code'] },\n\t\t\t},\n\t\t\tcommand: 'toggleInlineCode',\n\t\t\tkeyBinding: this.config.keymap !== null ? (this.config.keymap ?? 'Mod-E') : null,\n\t\t\ttoolbar:\n\t\t\t\tthis.config.toolbar !== false\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tid: 'inline_code',\n\t\t\t\t\t\t\tgroup: 'format',\n\t\t\t\t\t\t\ticon,\n\t\t\t\t\t\t\tlabel: this.locale.label,\n\t\t\t\t\t\t\ttooltip: this.locale.tooltip(formatShortcut(this.config.keymap ?? 'Mod-E')),\n\t\t\t\t\t\t}\n\t\t\t\t\t: undefined,\n\t\t});\n\t}\n\n\tprivate registerInputRule(context: PluginContext): void {\n\t\tconst pattern: RegExp = /(?:^|[^`])(`([^`]+)`)$/;\n\n\t\tcontext.registerInputRule({\n\t\t\tpattern,\n\t\t\thandler(state, match, _start, end) {\n\t\t\t\tconst sel = state.selection;\n\t\t\t\tif (!isTextSelection(sel)) return null;\n\t\t\t\tif (!isCollapsed(sel)) return null;\n\n\t\t\t\tconst block: BlockNode | undefined = state.getBlock(sel.anchor.blockId);\n\t\t\t\tif (!block || block.type === 'code_block') return null;\n\n\t\t\t\tconst innerText: string | undefined = match[2];\n\t\t\t\tconst backtickExpr: string | undefined = match[1];\n\t\t\t\tif (!innerText || !backtickExpr) return null;\n\n\t\t\t\tconst backtickExprStart: number = end - backtickExpr.length;\n\n\t\t\t\treturn state\n\t\t\t\t\t.transaction('input')\n\t\t\t\t\t.deleteTextAt(sel.anchor.blockId, backtickExprStart, end)\n\t\t\t\t\t.insertText(sel.anchor.blockId, backtickExprStart, innerText, [\n\t\t\t\t\t\t{ type: markType('code') },\n\t\t\t\t\t])\n\t\t\t\t\t.setSelection(\n\t\t\t\t\t\tcreateCollapsedSelection(sel.anchor.blockId, backtickExprStart + innerText.length),\n\t\t\t\t\t)\n\t\t\t\t\t.build();\n\t\t\t},\n\t\t});\n\t}\n\n\t/**\n\t * Prevents formatting marks from coexisting with the code mark.\n\t * Bold, italic, underline, etc. are stripped when code is applied,\n\t * and code is blocked on text that already has formatting marks.\n\t * The link mark is allowed to coexist.\n\t */\n\tprivate registerExclusivityMiddleware(context: PluginContext): void {\n\t\tcontext.registerMiddleware(\n\t\t\t(tr, state, next) => {\n\t\t\t\tlet patched = false;\n\t\t\t\tconst patchedSteps: Step[] = [];\n\n\t\t\t\tfor (const step of tr.steps) {\n\t\t\t\t\tif (step.type !== 'addMark') {\n\t\t\t\t\t\tpatchedSteps.push(step);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst stepMarkType: string = step.mark.type;\n\n\t\t\t\t\tif (stepMarkType === 'code') {\n\t\t\t\t\t\t// Adding code mark: inject removeMark steps for excluded marks\n\t\t\t\t\t\tconst block: BlockNode | undefined = state.getBlock(step.blockId);\n\t\t\t\t\t\tif (block) {\n\t\t\t\t\t\t\tconst segments = getBlockContentSegmentsInRange(block, step.from, step.to);\n\t\t\t\t\t\t\tconst marksToRemove: Set<string> = new Set();\n\t\t\t\t\t\t\tfor (const seg of segments) {\n\t\t\t\t\t\t\t\tif (seg.kind !== 'text') continue;\n\t\t\t\t\t\t\t\tfor (const m of seg.marks) {\n\t\t\t\t\t\t\t\t\tif (EXCLUDED_WITH_CODE.has(m.type)) {\n\t\t\t\t\t\t\t\t\t\tmarksToRemove.add(m.type);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tfor (const mt of marksToRemove) {\n\t\t\t\t\t\t\t\tpatched = true;\n\t\t\t\t\t\t\t\tpatchedSteps.push({\n\t\t\t\t\t\t\t\t\ttype: 'removeMark',\n\t\t\t\t\t\t\t\t\tblockId: step.blockId,\n\t\t\t\t\t\t\t\t\tfrom: step.from,\n\t\t\t\t\t\t\t\t\tto: step.to,\n\t\t\t\t\t\t\t\t\tmark: { type: markType(mt) },\n\t\t\t\t\t\t\t\t\t...(step.path ? { path: step.path } : {}),\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tpatchedSteps.push(step);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (EXCLUDED_WITH_CODE.has(stepMarkType)) {\n\t\t\t\t\t\t// Adding a formatting mark: block if target range has code mark\n\t\t\t\t\t\tconst block: BlockNode | undefined = state.getBlock(step.blockId);\n\t\t\t\t\t\tif (block) {\n\t\t\t\t\t\t\tconst segments = getBlockContentSegmentsInRange(block, step.from, step.to);\n\t\t\t\t\t\t\tconst hasCode: boolean = segments.some(\n\t\t\t\t\t\t\t\t(seg) => seg.kind === 'text' && seg.marks.some((m) => m.type === 'code'),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tif (hasCode) {\n\t\t\t\t\t\t\t\tpatched = true;\n\t\t\t\t\t\t\t\tcontinue; // skip this step\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tpatchedSteps.push(step);\n\t\t\t\t}\n\n\t\t\t\t// Handle stored marks\n\t\t\t\tlet storedMarksAfter: readonly Mark[] | null = tr.storedMarksAfter;\n\t\t\t\tif (storedMarksAfter) {\n\t\t\t\t\tconst hasCode: boolean = storedMarksAfter.some((m) => m.type === 'code');\n\t\t\t\t\tconst hasExcluded: boolean = storedMarksAfter.some((m) => EXCLUDED_WITH_CODE.has(m.type));\n\n\t\t\t\t\tif (hasCode && hasExcluded) {\n\t\t\t\t\t\t// Keep code, strip formatting marks\n\t\t\t\t\t\tstoredMarksAfter = storedMarksAfter.filter((m) => !EXCLUDED_WITH_CODE.has(m.type));\n\t\t\t\t\t\tpatched = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tnext(patched ? { ...tr, steps: patchedSteps, storedMarksAfter } : tr);\n\t\t\t},\n\t\t\t{ name: 'inline-code:mark-exclusivity', priority: 50 },\n\t\t);\n\t}\n}\n"],"mappings":"iTAeA,IAAa,EAA0C,CACtD,MAAO,cACP,QAAU,GAAqB,gBAAgB,MAK1C,iBAAmD,OAAA,OAAA,CAAA,kBAAA,IAAA,OAAA,qBAAA,kBAAA,IAAA,OAAA,qBAAA,kBAAA,IAAA,OAAA,qBAAA,kBAAA,IAAA,OAAA,qBAAA,kBAAA,IAAA,OAAA,qBAAA,kBAAA,IAAA,OAAA,qBAAA,kBAAA,IAAA,OAAA,qBAAA,kBAAA,IAAA,OAAA,uBAIzD,eAAsB,EAAqB,GAC1C,OAAO,EAAiB,EAAe,EAAM,EAC9C,CCcA,IAAM,EAAmC,CACxC,SAAS,EACT,OAAQ,QACR,WAAW,GAwBN,EAA0C,IAAI,IAAI,CACvD,OACA,SACA,YACA,gB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F,CAEA,EAAa,KAAK,EACnB,CAGA,IAAI,EAA2C,EAAG,iBAClD,GAAI,EAAkB,CACrB,MAAM,EAAmB,EAAiB,KAAM,GAAiB,SAAX,EAAE,MAClD,EAAuB,EAAiB,KAAM,GAAM,EAAmB,IAAI,EAAE,OAE/E,GAAW,IAEd,EAAmB,EAAiB,OAAQ,IAAO,EAAmB,IAAI,EAAE,OAC5E,GAAU,EAEZ,CAEA,EAAK,EAAU,IAAK,EAAI,MAAO,EAAc,oBAAqB,IAEnE,CAAE,KAAM,+BAAgC,SAAU,IAEpD"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as t}from"./HTMLUtils-C6B4UT00.mjs";import{s as r}from"./StyleRuntime-BAutwDZT.mjs";function e(e){const{type:n,rank:s,valueAttr:a,domStyleProperty:o,cssProperty:l,validate:i,validateOnParse:u,transformParsed:p}=e,c=t=>String(t.attrs?.[a]??"");return{type:n,rank:s,attrs:{[a]:{default:""}},toDOM(t){const e=document.createElement("span"),n=c(t);return n&&r(e,o,n),e},toHTMLString:(r,e,n)=>{const s=c(r);if(!s||!i(s))return e;const a=`${l}: ${t(s)}`;return`<span${n?.styleAttr(a)??` style="${a}"`}>${e}</span>`},toHTMLStyle:r=>{const e=c(r);return e&&i(e)?`${l}: ${t(e)}`:null},parseHTML:[{tag:"span",getAttrs:t=>{const r=t.style[o]??"";if(!r)return!1;if(u&&!i(r))return!1;const e=p?p(r):r;return{[a]:e}}}],sanitize:{tags:["span"]}}}export{e as t};
|
|
2
|
-
//# sourceMappingURL=InlineStyleMarkSpec-4R6DC7ij.mjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{b as t}from"./Document-r7vLOAGA.mjs";import{o as e,u as r}from"./Selection-HYoVFpAx.mjs";import{i as n}from"./TypeBrands-Ch9856Gb.mjs";import{a as i,r as o}from"./HTMLUtils-C6B4UT00.mjs";import{i as s,r as a,t as l}from"./AttributedMarkCommands-D4W2Jgpj.mjs";import{c,n as p,o as m}from"./PluginHelpers-KDuTlmXm.mjs";import{t as d}from"./ShortcutFormatting-TwiufqeV.mjs";var u={label:"Link",tooltip:t=>`Insert Link (${t})`,removeLink:"Remove Link",removeLinkAria:"Remove link",urlPlaceholder:"https://...",urlAria:"Link URL",apply:"Apply",applyAria:"Apply link",invalidUrl:"Only http(s), mailto, tel, fragments, and relative paths are allowed."},h=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar-Ctrv6cIi.mjs"),"./locales/de.ts":()=>import("./de-JhGflzS5.mjs"),"./locales/es.ts":()=>import("./es-Bv7bDbMp.mjs"),"./locales/fr.ts":()=>import("./fr-DtzIu6tU.mjs"),"./locales/hi.ts":()=>import("./hi-Bu799xIO.mjs"),"./locales/pt.ts":()=>import("./pt-DmN9u3NX.mjs"),"./locales/ru.ts":()=>import("./ru-BxySx7an.mjs"),"./locales/zh.ts":()=>import("./zh-DuucmOns.mjs")});async function k(t){return c(h,t,u)}var g={openInNewTab:!0},f=class{id="link";name="Link";priority=25;config;locale;constructor(t){this.config={...g,...t}}async init(t){this.locale=await m(t,this.config.locale,u,k),this.registerMarkSpec(t),this.registerCommands(t),this.registerKeymap(t),this.registerToolbarItem(t)}registerMarkSpec(t){const e=this.config.openInNewTab;t.registerMarkSpec({type:"link",rank:10,inclusive:!1,attrs:{href:{default:""}},toDOM(t){const r=document.createElement("a"),n=i(String(t.attrs?.href??""));return r.setAttribute("href",n),e&&(r.setAttribute("target","_blank"),r.setAttribute("rel","noopener noreferrer")),r},toHTMLString:(t,r)=>{const n=o(i(String(t.attrs?.href??"")));return e?`<a href="${n}" target="_blank" rel="noopener noreferrer">${r}</a>`:`<a href="${n}">${r}</a>`},parseHTML:[{tag:"a",getAttrs:t=>({href:i(t.getAttribute("href")??"")})}],sanitize:{tags:["a"],attrs:["href","target","rel"]}})}registerCommands(t){t.registerCommand("toggleLink",()=>{const e=t.getState();return this.toggleLink(t,e)}),t.registerCommand("setLink",()=>!1),t.registerCommand("removeLink",()=>{const e=t.getState();return this.removeLink(t,e)})}registerKeymap(t){t.registerKeymap({"Mod-K":()=>t.executeCommand("toggleLink")})}registerToolbarItem(t){t.registerToolbarItem({id:"link",group:"insert",icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"/></svg>',label:this.locale.label,tooltip:this.locale.tooltip(d("Mod-K")),command:"toggleLink",popupType:"custom",renderPopup:(t,e,r)=>{this.renderLinkPopup(t,e,r)},isActive:t=>this.isLinkActive(t),isEnabled:t=>!e(t.selection)})}isLinkActive(t){return a(t,"link")}toggleLink(t,e){return!!this.isLinkActive(e)&&this.removeLink(t,e)}addLink(t,i,o){const s=i.selection;return!!r(s)&&!e(s)&&p(t,l(i,{type:n("link"),attrs:{href:o}}))}removeLink(i,o){const a=o.selection;if(!r(a))return!1;if(e(a)){const e=o.getBlock(a.anchor.blockId);if(!e)return!1;const r=[];let s=0;for(const i of e.children){if(!("text"in i))continue;const e=s+i.text.length;r.push({pos:s,end:e,hasLink:t(i.marks,n("link"))}),s=e}const l=r.findIndex(t=>a.anchor.offset>=t.pos&&a.anchor.offset<=t.end),c=l>=0?r[l]:void 0;if(-1===l||!c?.hasLink)return!1;let p=l;for(;p>0&&r[p-1]?.hasLink;)p--;let m=l;for(;m<r.length-1&&r[m+1]?.hasLink;)m++;const d=r[p],u=r[m];if(!d||!u)return!1;const h=d.pos,k=u.end,g=o.transaction("command");return g.removeMark(a.anchor.blockId,h,k,{type:n("link")}),g.setSelection(a),i.dispatch(g.build()),!0}return p(i,s(o,n("link")))}renderLinkPopup(t,e,r){t.classList.add("notectl-link-popup");const n=e.getState();if(this.isLinkActive(n)){const n=document.createElement("button");n.type="button",n.className="notectl-link-popup__button",n.textContent=this.locale.removeLink,n.setAttribute("aria-label",this.locale.removeLinkAria),n.addEventListener("mousedown",t=>{t.preventDefault(),t.stopPropagation(),e.executeCommand("removeLink"),r(),e.getContainer().focus()}),t.appendChild(n)}else{const n=document.createElement("input");n.type="url",n.className="notectl-link-popup__input",n.placeholder=this.locale.urlPlaceholder,n.setAttribute("aria-label",this.locale.urlAria);const o=document.createElement("button");o.type="button",o.className="notectl-link-popup__button notectl-link-popup__button--apply",o.textContent=this.locale.apply,o.setAttribute("aria-label",this.locale.applyAria);const s=document.createElement("div");s.className="notectl-link-popup__error",s.setAttribute("role","alert"),s.hidden=!0;const a=()=>{const t=n.value.trim();if(""===t)return;const o=i(t);if(""===o)return s.textContent=this.locale.invalidUrl,s.hidden=!1,n.setAttribute("aria-invalid","true"),void n.focus();s.hidden=!0,n.removeAttribute("aria-invalid"),this.addLink(e,e.getState(),o),r(),e.getContainer().focus()};o.addEventListener("mousedown",t=>{t.preventDefault(),t.stopPropagation(),a()}),n.addEventListener("keydown",t=>{"Enter"===t.key&&(t.preventDefault(),a())}),n.addEventListener("input",()=>{s.hidden||(s.hidden=!0,n.removeAttribute("aria-invalid"))}),t.appendChild(n),t.appendChild(o),t.appendChild(s),requestAnimationFrame(()=>n.focus())}}};export{u as n,k as r,f as t};
|
|
2
|
-
//# sourceMappingURL=LinkPlugin-DvZ3MPgL.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LinkPlugin-DvZ3MPgL.mjs","names":[],"sources":["../../src/plugins/link/LinkLocale.ts","../../src/plugins/link/LinkPlugin.ts"],"sourcesContent":["/**\n * Locale interface and default English locale for the LinkPlugin.\n */\n\nimport { type LocaleModuleMap, loadLocaleModule } from '../shared/LocaleLoader.js';\n\n// --- Locale Interface ---\n\nexport interface LinkLocale {\n\treadonly label: string;\n\treadonly tooltip: (shortcut: string) => string;\n\treadonly removeLink: string;\n\treadonly removeLinkAria: string;\n\treadonly urlPlaceholder: string;\n\treadonly urlAria: string;\n\treadonly apply: string;\n\treadonly applyAria: string;\n\treadonly invalidUrl: string;\n}\n\n// --- Default English Locale ---\n\nexport const LINK_LOCALE_EN: LinkLocale = {\n\tlabel: 'Link',\n\ttooltip: (shortcut: string) => `Insert Link (${shortcut})`,\n\tremoveLink: 'Remove Link',\n\tremoveLinkAria: 'Remove link',\n\turlPlaceholder: 'https://...',\n\turlAria: 'Link URL',\n\tapply: 'Apply',\n\tapplyAria: 'Apply link',\n\tinvalidUrl: 'Only http(s), mailto, tel, fragments, and relative paths are allowed.',\n};\n\n// --- Lazy Locale Loader ---\n\nconst localeModules: LocaleModuleMap<LinkLocale> = import.meta.glob<{\n\tdefault: LinkLocale;\n}>('./locales/*.ts', { eager: false });\n\nexport async function loadLinkLocale(lang: string): Promise<LinkLocale> {\n\treturn loadLocaleModule(localeModules, lang, LINK_LOCALE_EN);\n}\n","/**\n * LinkPlugin: registers a link mark type with href attribute,\n * toggle command, keyboard shortcut (Mod-K), and toolbar button\n * with a URL input popup.\n */\n\nimport {\n\tapplyAttributedMark,\n\tisAttributedMarkActive,\n\tremoveAttributedMark,\n} from '../../commands/AttributedMarkCommands.js';\nimport { hasMark } from '../../model/Document.js';\nimport { escapeHTML, sanitizeHref } from '../../model/HTMLUtils.js';\nimport { isCollapsed, isTextSelection } from '../../model/Selection.js';\nimport { markType } from '../../model/TypeBrands.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { Plugin, PluginContext } from '../Plugin.js';\nimport { dispatchIfPresent, resolveLocale } from '../shared/PluginHelpers.js';\nimport { formatShortcut } from '../shared/ShortcutFormatting.js';\nimport { LINK_LOCALE_EN, type LinkLocale, loadLinkLocale } from './LinkLocale.js';\n\n// --- Attribute Registry Augmentation ---\n\ndeclare module '../../model/AttrRegistry.js' {\n\tinterface MarkAttrRegistry {\n\t\tlink: { href: string };\n\t}\n}\n\n// --- Configuration ---\n\nexport interface LinkConfig {\n\t/** Whether to add rel=\"noopener noreferrer\" and target=\"_blank\" by default. */\n\treadonly openInNewTab: boolean;\n\treadonly locale?: LinkLocale;\n}\n\nconst DEFAULT_CONFIG: LinkConfig = {\n\topenInNewTab: true,\n};\n\n// --- Plugin ---\n\nexport class LinkPlugin implements Plugin {\n\treadonly id = 'link';\n\treadonly name = 'Link';\n\treadonly priority = 25;\n\n\tprivate readonly config: LinkConfig;\n\tprivate locale!: LinkLocale;\n\n\tconstructor(config?: Partial<LinkConfig>) {\n\t\tthis.config = { ...DEFAULT_CONFIG, ...config };\n\t}\n\n\tasync init(context: PluginContext): Promise<void> {\n\t\tthis.locale = await resolveLocale(context, this.config.locale, LINK_LOCALE_EN, loadLinkLocale);\n\t\tthis.registerMarkSpec(context);\n\t\tthis.registerCommands(context);\n\t\tthis.registerKeymap(context);\n\t\tthis.registerToolbarItem(context);\n\t}\n\n\tprivate registerMarkSpec(context: PluginContext): void {\n\t\tconst openInNewTab = this.config.openInNewTab;\n\n\t\tcontext.registerMarkSpec({\n\t\t\ttype: 'link',\n\t\t\trank: 10,\n\t\t\tinclusive: false,\n\t\t\tattrs: {\n\t\t\t\thref: { default: '' },\n\t\t\t},\n\t\t\ttoDOM(mark) {\n\t\t\t\tconst a = document.createElement('a');\n\t\t\t\tconst href: string = sanitizeHref(String(mark.attrs?.href ?? ''));\n\t\t\t\ta.setAttribute('href', href);\n\t\t\t\tif (openInNewTab) {\n\t\t\t\t\ta.setAttribute('target', '_blank');\n\t\t\t\t\ta.setAttribute('rel', 'noopener noreferrer');\n\t\t\t\t}\n\t\t\t\treturn a;\n\t\t\t},\n\t\t\ttoHTMLString: (mark, content) => {\n\t\t\t\tconst safeHref: string = sanitizeHref(String(mark.attrs?.href ?? ''));\n\t\t\t\tconst href: string = escapeHTML(safeHref);\n\t\t\t\tif (openInNewTab) {\n\t\t\t\t\treturn `<a href=\"${href}\" target=\"_blank\" rel=\"noopener noreferrer\">${content}</a>`;\n\t\t\t\t}\n\t\t\t\treturn `<a href=\"${href}\">${content}</a>`;\n\t\t\t},\n\t\t\tparseHTML: [\n\t\t\t\t{\n\t\t\t\t\ttag: 'a',\n\t\t\t\t\tgetAttrs: (el) => {\n\t\t\t\t\t\t// Returning an empty href (instead of `false`) keeps the link mark\n\t\t\t\t\t\t// applied so the parser does not fall back to the core HTMLParser's\n\t\t\t\t\t\t// raw-href default; the empty value renders as a no-op anchor.\n\t\t\t\t\t\tconst href: string = sanitizeHref(el.getAttribute('href') ?? '');\n\t\t\t\t\t\treturn { href };\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t\tsanitize: { tags: ['a'], attrs: ['href', 'target', 'rel'] },\n\t\t});\n\t}\n\n\tprivate registerCommands(context: PluginContext): void {\n\t\tcontext.registerCommand('toggleLink', () => {\n\t\t\tconst state = context.getState();\n\t\t\treturn this.toggleLink(context, state);\n\t\t});\n\n\t\tcontext.registerCommand('setLink', () => {\n\t\t\t// setLink is called by the popup after URL input\n\t\t\t// The actual URL is set via the popup's custom render\n\t\t\treturn false;\n\t\t});\n\n\t\tcontext.registerCommand('removeLink', () => {\n\t\t\tconst state = context.getState();\n\t\t\treturn this.removeLink(context, state);\n\t\t});\n\t}\n\n\tprivate registerKeymap(context: PluginContext): void {\n\t\tcontext.registerKeymap({\n\t\t\t'Mod-K': () => context.executeCommand('toggleLink'),\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=\"M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z\"/></svg>';\n\n\t\tcontext.registerToolbarItem({\n\t\t\tid: 'link',\n\t\t\tgroup: 'insert',\n\t\t\ticon,\n\t\t\tlabel: this.locale.label,\n\t\t\ttooltip: this.locale.tooltip(formatShortcut('Mod-K')),\n\t\t\tcommand: 'toggleLink',\n\t\t\tpopupType: 'custom',\n\t\t\trenderPopup: (container, ctx, onClose) => {\n\t\t\t\tthis.renderLinkPopup(container, ctx, onClose);\n\t\t\t},\n\t\t\tisActive: (state) => this.isLinkActive(state),\n\t\t\tisEnabled: (state) => !isCollapsed(state.selection),\n\t\t});\n\t}\n\n\tprivate isLinkActive(state: EditorState): boolean {\n\t\treturn isAttributedMarkActive(state, 'link');\n\t}\n\n\tprivate toggleLink(context: PluginContext, state: EditorState): boolean {\n\t\tif (this.isLinkActive(state)) {\n\t\t\treturn this.removeLink(context, state);\n\t\t}\n\t\t// Adding links requires the toolbar popup for URL input\n\t\treturn false;\n\t}\n\n\tprivate addLink(context: PluginContext, state: EditorState, href: string): boolean {\n\t\tconst sel = state.selection;\n\t\tif (!isTextSelection(sel)) return false;\n\t\tif (isCollapsed(sel)) return false;\n\n\t\tconst mark = { type: markType('link'), attrs: { href } };\n\t\treturn dispatchIfPresent(context, applyAttributedMark(state, mark));\n\t}\n\n\tprivate removeLink(context: PluginContext, state: EditorState): boolean {\n\t\tconst sel = state.selection;\n\t\tif (!isTextSelection(sel)) return false;\n\n\t\tif (isCollapsed(sel)) {\n\t\t\t// Remove link from entire link span around cursor (plugin-specific extent scan)\n\t\t\tconst block = state.getBlock(sel.anchor.blockId);\n\t\t\tif (!block) return false;\n\n\t\t\tconst textChildren: { pos: number; end: number; hasLink: boolean }[] = [];\n\t\t\tlet pos = 0;\n\t\t\tfor (const child of block.children) {\n\t\t\t\tif (!('text' in child)) continue;\n\t\t\t\tconst end = pos + child.text.length;\n\t\t\t\ttextChildren.push({ pos, end, hasLink: hasMark(child.marks, markType('link')) });\n\t\t\t\tpos = end;\n\t\t\t}\n\n\t\t\tconst cursorIdx = textChildren.findIndex(\n\t\t\t\t(c) => sel.anchor.offset >= c.pos && sel.anchor.offset <= c.end,\n\t\t\t);\n\t\t\tconst cursorEntry = cursorIdx >= 0 ? textChildren[cursorIdx] : undefined;\n\t\t\tif (cursorIdx === -1 || !cursorEntry?.hasLink) return false;\n\n\t\t\tlet startIdx = cursorIdx;\n\t\t\twhile (startIdx > 0 && textChildren[startIdx - 1]?.hasLink) {\n\t\t\t\tstartIdx--;\n\t\t\t}\n\n\t\t\tlet endIdx = cursorIdx;\n\t\t\twhile (endIdx < textChildren.length - 1 && textChildren[endIdx + 1]?.hasLink) {\n\t\t\t\tendIdx++;\n\t\t\t}\n\n\t\t\tconst startEntry = textChildren[startIdx];\n\t\t\tconst endEntry = textChildren[endIdx];\n\t\t\tif (!startEntry || !endEntry) return false;\n\n\t\t\tconst linkStart = startEntry.pos;\n\t\t\tconst linkEnd = endEntry.end;\n\n\t\t\tconst builder = state.transaction('command');\n\t\t\tbuilder.removeMark(sel.anchor.blockId, linkStart, linkEnd, { type: markType('link') });\n\t\t\tbuilder.setSelection(sel);\n\t\t\tcontext.dispatch(builder.build());\n\t\t\treturn true;\n\t\t}\n\n\t\t// Range selection: delegate to shared helper\n\t\treturn dispatchIfPresent(context, removeAttributedMark(state, markType('link')));\n\t}\n\n\tprivate renderLinkPopup(\n\t\tcontainer: HTMLElement,\n\t\tcontext: PluginContext,\n\t\tonClose: () => void,\n\t): void {\n\t\tcontainer.classList.add('notectl-link-popup');\n\n\t\tconst state = context.getState();\n\t\tconst isActive = this.isLinkActive(state);\n\n\t\tif (isActive) {\n\t\t\t// Show remove link button\n\t\t\tconst removeBtn = document.createElement('button');\n\t\t\tremoveBtn.type = 'button';\n\t\t\tremoveBtn.className = 'notectl-link-popup__button';\n\t\t\tremoveBtn.textContent = this.locale.removeLink;\n\t\t\tremoveBtn.setAttribute('aria-label', this.locale.removeLinkAria);\n\t\t\tremoveBtn.addEventListener('mousedown', (e) => {\n\t\t\t\te.preventDefault();\n\t\t\t\te.stopPropagation();\n\t\t\t\tcontext.executeCommand('removeLink');\n\t\t\t\tonClose();\n\t\t\t\tcontext.getContainer().focus();\n\t\t\t});\n\t\t\tcontainer.appendChild(removeBtn);\n\t\t} else {\n\t\t\t// Show URL input\n\t\t\tconst input = document.createElement('input');\n\t\t\tinput.type = 'url';\n\t\t\tinput.className = 'notectl-link-popup__input';\n\t\t\tinput.placeholder = this.locale.urlPlaceholder;\n\t\t\tinput.setAttribute('aria-label', this.locale.urlAria);\n\n\t\t\tconst applyBtn = document.createElement('button');\n\t\t\tapplyBtn.type = 'button';\n\t\t\tapplyBtn.className = 'notectl-link-popup__button notectl-link-popup__button--apply';\n\t\t\tapplyBtn.textContent = this.locale.apply;\n\t\t\tapplyBtn.setAttribute('aria-label', this.locale.applyAria);\n\n\t\t\tconst errorMsg = document.createElement('div');\n\t\t\terrorMsg.className = 'notectl-link-popup__error';\n\t\t\terrorMsg.setAttribute('role', 'alert');\n\t\t\terrorMsg.hidden = true;\n\n\t\t\tconst applyLink = (): void => {\n\t\t\t\tconst raw: string = input.value.trim();\n\t\t\t\tif (raw === '') return;\n\t\t\t\tconst sanitized: string = sanitizeHref(raw);\n\t\t\t\tif (sanitized === '') {\n\t\t\t\t\terrorMsg.textContent = this.locale.invalidUrl;\n\t\t\t\t\terrorMsg.hidden = false;\n\t\t\t\t\tinput.setAttribute('aria-invalid', 'true');\n\t\t\t\t\tinput.focus();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\terrorMsg.hidden = true;\n\t\t\t\tinput.removeAttribute('aria-invalid');\n\t\t\t\tthis.addLink(context, context.getState(), sanitized);\n\t\t\t\tonClose();\n\t\t\t\tcontext.getContainer().focus();\n\t\t\t};\n\n\t\t\tapplyBtn.addEventListener('mousedown', (e) => {\n\t\t\t\te.preventDefault();\n\t\t\t\te.stopPropagation();\n\t\t\t\tapplyLink();\n\t\t\t});\n\n\t\t\tinput.addEventListener('keydown', (e) => {\n\t\t\t\tif (e.key === 'Enter') {\n\t\t\t\t\te.preventDefault();\n\t\t\t\t\tapplyLink();\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tinput.addEventListener('input', () => {\n\t\t\t\tif (!errorMsg.hidden) {\n\t\t\t\t\terrorMsg.hidden = true;\n\t\t\t\t\tinput.removeAttribute('aria-invalid');\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tcontainer.appendChild(input);\n\t\t\tcontainer.appendChild(applyBtn);\n\t\t\tcontainer.appendChild(errorMsg);\n\n\t\t\t// Auto-focus input\n\t\t\trequestAnimationFrame(() => input.focus());\n\t\t}\n\t}\n}\n"],"mappings":"0XAsBA,IAAa,EAA6B,CACzC,MAAO,OACP,QAAU,GAAqB,gBAAgB,KAC/C,WAAY,cACZ,eAAgB,cAChB,eAAgB,cAChB,QAAS,WACT,MAAO,QACP,UAAW,aACX,WAAY,yEAKP,iBAA6C,OAAA,OAAA,CAAA,kBAAA,IAAA,OAAA,qBAAA,kBAAA,IAAA,OAAA,qBAAA,kBAAA,IAAA,OAAA,qBAAA,kBAAA,IAAA,OAAA,qBAAA,kBAAA,IAAA,OAAA,qBAAA,kBAAA,IAAA,OAAA,qBAAA,kBAAA,IAAA,OAAA,qBAAA,kBAAA,IAAA,OAAA,uBAInD,eAAsB,EAAe,GACpC,OAAO,EAAiB,EAAe,EAAM,EAC9C,CCLA,IAAM,EAA6B,CAClC,cAAc,GAKF,EAAb,MACC,GAAc,OACd,KAAgB,OAChB,SAAoB,GAEpB,OACA,OAEA,WAAA,CAAY,GACX,KAAK,OAAS,IAAK,KAAmB,EACvC,CAEA,UAAM,CAAK,GACV,KAAK,aAAe,EAAc,EAAS,KAAK,OAAO,OAAQ,EAAgB,GAC/E,KAAK,iBAAiB,GACtB,KAAK,iBAAiB,GACtB,KAAK,eAAe,GACpB,KAAK,oBAAoB,EAC1B,CAEA,gBAAA,CAAyB,GACxB,MAAM,EAAe,KAAK,OAAO,aAEjC,EAAQ,iBAAiB,CACxB,KAAM,OACN,KAAM,GACN,WAAW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AAY,GACtB,EAAU,YAAY,GACtB,EAAU,YAAY,GAGtB,sBAAA,IAA4B,EAAM,QACnC,CACD"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{h as t,u as e}from"./Document-r7vLOAGA.mjs";import{d as n,o as i,t as c,u as s}from"./Selection-HYoVFpAx.mjs";import{a as o,t as r}from"./TypeBrands-Ch9856Gb.mjs";import{r as l}from"./AttrRegistry-DcDVyzLm.mjs";import{n as a}from"./DomUtils-Bf7JLFlx.mjs";import{t as d}from"./RangeIterator-o8v3msQe.mjs";import{s as u}from"./StyleRuntime-BAutwDZT.mjs";import{c as h,o as m}from"./PluginHelpers-KDuTlmXm.mjs";function p(t,e,n){return"checklist"===t?{listType:t,indent:e,checked:n??!1}:{listType:t,indent:e}}function k(t,e){const i=t.getState(),c=i.selection;return!!s(c)&&(c.anchor.blockId!==c.head.blockId?function(t,e,i){const c=e.selection;if(!s(c))return!1;const r=n(c,e.getBlockOrder()),a=g(e,r,i),u=e.transaction("command");return d(e,r,t=>{const n=e.getBlock(t);if(n)if(a)u.setBlockType(t,o("paragraph"));else{const e=l(n,"list_item")?n.attrs.indent:0,c=l(n,"list_item")&&"checklist"===n.attrs.listType&&n.attrs.checked;u.setBlockType(t,o("list_item"),p(i,e,c))}}),u.setSelection(c),t.dispatch(u.build()),!0}(t,i,e):function(t,e,n){const i=e.selection;if(!s(i))return!1;const c=e.getBlock(i.anchor.blockId);if(!c)return!1;if("list_item"===c.type&&c.attrs?.listType===n){const n=e.transaction("command").setBlockType(i.anchor.blockId,o("paragraph")).setSelection(i).build();return t.dispatch(n),!0}const r=p(n,l(c,"list_item")?c.attrs.indent:0),a=e.transaction("command").setBlockType(i.anchor.blockId,o("list_item"),r).setSelection(i).build();return t.dispatch(a),!0}(t,i,e))}function b(t,e,i){const c=t.getState();if(!s(c.selection))return!1;if(c.selection.anchor.blockId!==c.selection.head.blockId)return function(t,e,i,c){const r=e.selection;if(!s(r))return!1;const a=n(r,e.getBlockOrder()),u=e.transaction("command");let h=!1;return d(e,a,t=>{const n=e.getBlock(t);if(!n||!l(n,"list_item"))return;const s=n.attrs.indent+i;s<0||s>c||(u.setBlockType(t,o("list_item"),p(n.attrs.listType,s,n.attrs.checked)),h=!0)}),!!h&&(u.setSelection(r),t.dispatch(u.build()),!0)}(t,c,e,i);const r=c.selection,a=c.getBlock(r.anchor.blockId);if(!a||!l(a,"list_item"))return!1;const u=a.attrs.indent+e;if(u<0||u>i)return!1;const h=p(a.attrs.listType,u,a.attrs.checked),m=c.transaction("command").setBlockType(r.anchor.blockId,o("list_item"),h).setSelection(r).build();return t.dispatch(m),!0}function f(t,e){const{interactiveCheckboxes:n,targetId:i,locale:c}=e;if(t.isReadOnly()&&!n)return!1;const r=t.getState(),a=i??(s(r.selection)?r.selection.anchor.blockId:null);if(!a)return!1;const d=r.getBlock(a);if(!d||!l(d,"list_item")||"checklist"!==d.attrs.listType)return!1;const u=!d.attrs.checked,h=p(d.attrs.listType,d.attrs.indent,u),m=r.transaction("command").setBlockType(a,o("list_item"),h).setSelection(r.selection).build();return t.dispatch(m),t.announce(u?c.checkedAnnouncement:c.uncheckedAnnouncement),!0}function g(t,e,n){let i=!0;return d(t,e,e=>{const c=t.getBlock(e);c&&"list_item"===c.type&&c.attrs?.listType===n||(i=!1)}),i}var y=[{type:"bullet",icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 10.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm0-6c-.83 0-1.5.67-1.5 1.5S3.17 7.5 4 7.5 5.5 6.83 5.5 6 4.83 4.5 4 4.5zm0 12c-.83 0-1.5.68-1.5 1.5s.68 1.5 1.5 1.5 1.5-.68 1.5-1.5-.67-1.5-1.5-1.5zM7 19h14v-2H7v2zm0-6h14v-2H7v2zm0-8v2h14V5H7z"/></svg>',inputPattern:/^[-*] $/,inputPrefix:"- "},{type:"ordered",icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M2 17h2v.5H3v1h1v.5H2v1h3v-4H2v1zm1-9h1V4H2v1h1v3zm-1 3h1.8L2 13.1v.9h3v-1H3.2L5 10.9V10H2v1zm5-6v2h14V5H7zm0 14h14v-2H7v2zm0-6h14v-2H7v2z"/></svg>',inputPattern:/^\d+\. $/,inputPrefix:"1. "},{type:"checklist",icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M22 7h-9v2h9V7zm0 8h-9v2h9v-2zM5.54 11L2 7.46l1.41-1.41 2.12 2.12 4.24-4.24 1.41 1.41L5.54 11zm0 8L2 15.46l1.41-1.41 2.12 2.12 4.24-4.24 1.41 1.41L5.54 19z"/></svg>',inputPattern:/^\[[ x]] $/,inputPrefix:"[ ] "}];function v(t,e){const n=t.getState();if(!s(n.selection))return!1;const c=n.selection;if(!i(c))return!1;const o=n.getBlock(c.anchor.blockId);return!(!o||"list_item"!==o.type)&&e({state:n,block:o,blockId:c.anchor.blockId,offset:c.anchor.offset})}var x={bulletList:"Bullet List",numberedList:"Numbered List",checklist:"Checklist",checkboxLabel:"To-do item",checkedAnnouncement:"Checked",uncheckedAnnouncement:"Unchecked"},I=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar-Cy_77yRf.mjs"),"./locales/de.ts":()=>import("./de-CaeEIyzV.mjs"),"./locales/es.ts":()=>import("./es-DFokqQst.mjs"),"./locales/fr.ts":()=>import("./fr-5HkMazAf.mjs"),"./locales/hi.ts":()=>import("./hi-BzbMD_cP.mjs"),"./locales/pt.ts":()=>import("./pt-CR4j8gtE.mjs"),"./locales/ru.ts":()=>import("./ru-DiwQV30V.mjs"),"./locales/zh.ts":()=>import("./zh-BQqf3wJZ.mjs")});async function T(t){return h(I,t,x)}var B="notectl-checklist-marker";function L(t,e){return{bullet:e.bulletList,ordered:e.numberedList,checklist:e.checklist}[t]}function w(t,e){if(!s(t.selection))return!1;if(t.selection.anchor.blockId!==t.selection.head.blockId)return g(t,n(t.selection,t.getBlockOrder()),e);const i=t.getBlock(t.selection.anchor.blockId);return"list_item"===i?.type&&i.attrs?.listType===e}var S={types:["bullet","ordered","checklist"],maxIndent:4},C=class{id="list";name="List";priority=35;config;locale;context=null;checkboxClickHandler=null;constructor(t){this.config={...S,...t}}async init(n){this.context=n,this.locale=await m(n,this.config.locale,x,T);const r=this.getEnabledTypes();n.registerStyleSheet("\n/* List Wrappers — suppress native markers, we use ::before pseudo-elements */\n.notectl-list {\n\tlist-style: none;\n\tmargin: 0;\n\tpadding: 0;\n}\n\n/* Ordered List — each <ol> wrapper resets the counter */\n.notectl-list--ordered {\n\tcounter-reset: notectl-ordered;\n}\n\n/* List Items */\n.notectl-list-item {\n\tmargin: 0;\n\tpadding: 2px 0;\n\tpadding-inline-start: 24px;\n\tmin-height: 1.6em;\n\tposition: relative;\n}\n\n.notectl-list-item::before {\n\tposition: absolute;\n\tinset-inline-start: 0;\n\tdisplay: inline-block;\n\twidth: 24px;\n\ttext-align: center;\n\t-webkit-user-select: none;\n\tuser-select: none;\n\tpointer-events: none;\n}\n\n/* Bullet List */\n.notectl-list-item--bullet::before {\n\tcontent: '\\2022';\n\tcolor: var(--notectl-fg);\n}\n\n/* Ordered List — counter increment per item */\n.notectl-list-item--ordered {\n\tcounter-increment: notectl-ordered;\n}\n\n.notectl-list-item--ordered::before {\n\tcontent: counter(notectl-ordered) '.';\n\tcolor: var(--notectl-fg);\n\tfont-size: 14px;\n}\n\n/* Checklist — the marker is a real role=\"checkbox\" element (see ListMarker.ts)\n positioned over the reserved marker zone. inline-block keeps the parent's\n line-through (on checked items) from striking the glyph. */\n.notectl-checklist-marker {\n\tposition: absolute;\n\tinset-inline-start: 0;\n\tdisplay: inline-block;\n\twidth: 24px;\n\ttext-align: center;\n\tfont-size: 16px;\n\tcolor: var(--notectl-fg-muted);\n\tcursor: pointer;\n\ttext-decoration: none;\n\t-webkit-user-select: none;\n\tuser-select: none;\n}\n\n.notectl-checklist-marker::before {\n\tcontent: '\\2610';\n}\n\n.notectl-list-item--checklist[data-checked=\"true\"] .notectl-checklist-marker {\n\tcolor: var(--notectl-success);\n}\n\n.notectl-list-item--checklist[data-checked=\"true\"] .notectl-checklist-marker::before {\n\tcontent: '\\2611';\n}\n\n.notectl-list-item--checklist[data-checked=\"true\"] {\n\tcolor: var(--notectl-fg-muted);\n\ttext-decoration: line-through;\n}\n"),this.registerNodeSpec(n),function(t,e,n,i){for(const c of n)t.registerCommand(`toggleList:${c.type}`,()=>k(t,c.type));if(t.registerCommand("indentListItem",()=>b(t,1,e.maxIndent)),t.registerCommand("outdentListItem",()=>b(t,-1,e.maxIndent)),e.types.includes("checklist")){const n=()=>f(t,{interactiveCheckboxes:e.interactiveCheckboxes,locale:i});t.registerCommand("toggleChecklistItem",n,{readonlyAllowed:!0}),t.registerKeymap({"Mod-Enter":n},{priority:"navigation"})}t.registerKeymap({Tab:()=>b(t,1,e.maxIndent),"Shift-Tab":()=>b(t,-1,e.maxIndent)})}(n,this.config,r,this.locale),function(n){n.registerKeymap({Enter:()=>function(n){return v(n,i=>{if(""===t(i.block)){const t=i.state.transaction("input").setBlockType(i.blockId,o("paragraph")).setSelection(i.state.selection).build();return n.dispatch(t),!0}const s=e(),r=p(l(i.block,"list_item")?i.block.attrs.listType:"bullet",l(i.block,"list_item")?i.block.attrs.indent:0),a=i.state.transaction("input").splitBlock(i.blockId,i.offset,s).setBlockType(s,o("list_item"),r).setSelection(c(s,0)).build();return n.dispatch(a),!0})}(n),Backspace:()=>function(t){return v(t,e=>{if(0!==e.offset)return!1;const n=e.state.transaction("input").setBlockType(e.blockId,o("paragraph")).setSelection(e.state.selection).build();return t.dispatch(n),!0})}(n)})}(n),function(t,e){for(const n of e)t.registerInputRule({pattern:n.inputPattern,handler:(t,e,r,l)=>{const a=t.selection;if(!s(a))return null;if(!i(a))return null;const d=t.getBlock(a.anchor.blockId);if(!d||"paragraph"!==d.type)return null;const u=e[0]??"",h=u.length,m=p(n.type,0,u.includes("[x]"));return t.transaction("input").deleteTextAt(a.anchor.blockId,r,r+h).setBlockType(a.anchor.blockId,o("list_item"),m).setSelection(c(a.anchor.blockId,0)).build()}})}(n,r),function(t,e,n){for(const i of e)t.registerToolbarItem({id:`list-${i.type}`,group:"block",icon:i.icon,label:L(i.type,n),command:`toggleList:${i.type}`,isActive:t=>w(t,i.type)})}(n,r,this.locale),this.registerCheckboxClickHandler(n)}destroy(){this.checkboxClickHandler&&this.context&&this.context.getContainer().removeEventListener("mousedown",this.checkboxClickHandler),this.checkboxClickHandler=null,this.context=null}registerNodeSpec(t){const e=this.locale.checkboxLabel;t.registerNodeSpec({type:"list_item",group:"block",content:{allow:["text"]},attrs:{listType:{default:"bullet"},indent:{default:0},checked:{default:!1}},toDOM(t){const n=t.attrs?.listType??"bullet",i=t.attrs?.indent??0,c=t.attrs?.checked??!1,s=a("li",t.id);return s.setAttribute("role","listitem"),s.setAttribute("data-list-type",n),s.setAttribute("data-indent",String(i)),s.className=`notectl-list-item notectl-list-item--${n}`,i>0&&u(s,"marginLeft",24*i+"px"),"checklist"===n&&(s.setAttribute("data-checked",String(c)),s.appendChild(function(t,e){const n=document.createElement("span");return n.className=B,n.setAttribute("role","checkbox"),n.setAttribute("aria-checked",String(t)),n.setAttribute("aria-label",e),n.setAttribute("contenteditable","false"),n.setAttribute("data-widget","true"),n}(c,e))),s.setAttribute("aria-level",String(i+1)),s},wrapper(t){const e=t.attrs?.listType??"bullet";return{tag:"ordered"===e?"ol":"ul",key:`list-${e}`,className:`notectl-list notectl-list--${e}`,attrs:{role:"list"}}},toHTML(t,e){const n=t.attrs?.listType??"bullet",i=t.attrs?.checked??!1;return"checklist"===n?`<li role="checkbox" aria-checked="${String(i)}"><input type="checkbox" disabled${i?" checked":""}>${e||"<br>"}</li>`:`<li>${e||"<br>"}</li>`},parseHTML:[{tag:"li"}],sanitize:{tags:["ul","ol","li","input"],attrs:["type","disabled","checked","role","aria-checked"]}})}registerCheckboxClickHandler(t){this.config.types.includes("checklist")&&(this.checkboxClickHandler=e=>{if(t.isReadOnly()&&!this.config.interactiveCheckboxes)return;const n=e.target;if(!(n instanceof HTMLElement))return;const i=n.closest(`.${B}`);if(!i)return;const c=i.closest(".notectl-list-item--checklist");if(!c)return;e.preventDefault();const s=c.getAttribute("data-block-id");s&&f(t,{interactiveCheckboxes:this.config.interactiveCheckboxes,targetId:r(s),locale:this.locale})},t.getContainer().addEventListener("mousedown",this.checkboxClickHandler))}getEnabledTypes(){return y.filter(t=>this.config.types.includes(t.type))}};export{x as n,T as r,C as t};
|
|
2
|
-
//# sourceMappingURL=ListPlugin-CVId2dE0.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ListPlugin-CVId2dE0.mjs","names":[],"sources":["../../src/editor/styles/list.ts","../../src/plugins/list/ListAttrsFactory.ts","../../src/plugins/list/ListCommands.ts","../../src/plugins/list/ListDefinitions.ts","../../src/plugins/list/ListInputRules.ts","../../src/plugins/list/ListKeyboardHandlers.ts","../../src/plugins/list/ListLocale.ts","../../src/plugins/list/ListMarker.ts","../../src/plugins/list/ListToolbarItems.ts","../../src/plugins/list/ListPlugin.ts"],"sourcesContent":["/** Width of the list marker / checkbox area in pixels. */\nexport const LIST_MARKER_WIDTH = 24;\n\n/** List styles — bullet, ordered, checklist items. */\nexport const LIST_CSS = `\n/* List Wrappers — suppress native markers, we use ::before pseudo-elements */\n.notectl-list {\n\tlist-style: none;\n\tmargin: 0;\n\tpadding: 0;\n}\n\n/* Ordered List — each <ol> wrapper resets the counter */\n.notectl-list--ordered {\n\tcounter-reset: notectl-ordered;\n}\n\n/* List Items */\n.notectl-list-item {\n\tmargin: 0;\n\tpadding: 2px 0;\n\tpadding-inline-start: ${LIST_MARKER_WIDTH}px;\n\tmin-height: 1.6em;\n\tposition: relative;\n}\n\n.notectl-list-item::before {\n\tposition: absolute;\n\tinset-inline-start: 0;\n\tdisplay: inline-block;\n\twidth: ${LIST_MARKER_WIDTH}px;\n\ttext-align: center;\n\t-webkit-user-select: none;\n\tuser-select: none;\n\tpointer-events: none;\n}\n\n/* Bullet List */\n.notectl-list-item--bullet::before {\n\tcontent: '\\\\2022';\n\tcolor: var(--notectl-fg);\n}\n\n/* Ordered List — counter increment per item */\n.notectl-list-item--ordered {\n\tcounter-increment: notectl-ordered;\n}\n\n.notectl-list-item--ordered::before {\n\tcontent: counter(notectl-ordered) '.';\n\tcolor: var(--notectl-fg);\n\tfont-size: 14px;\n}\n\n/* Checklist — the marker is a real role=\"checkbox\" element (see ListMarker.ts)\n positioned over the reserved marker zone. inline-block keeps the parent's\n line-through (on checked items) from striking the glyph. */\n.notectl-checklist-marker {\n\tposition: absolute;\n\tinset-inline-start: 0;\n\tdisplay: inline-block;\n\twidth: ${LIST_MARKER_WIDTH}px;\n\ttext-align: center;\n\tfont-size: 16px;\n\tcolor: var(--notectl-fg-muted);\n\tcursor: pointer;\n\ttext-decoration: none;\n\t-webkit-user-select: none;\n\tuser-select: none;\n}\n\n.notectl-checklist-marker::before {\n\tcontent: '\\\\2610';\n}\n\n.notectl-list-item--checklist[data-checked=\"true\"] .notectl-checklist-marker {\n\tcolor: var(--notectl-success);\n}\n\n.notectl-list-item--checklist[data-checked=\"true\"] .notectl-checklist-marker::before {\n\tcontent: '\\\\2611';\n}\n\n.notectl-list-item--checklist[data-checked=\"true\"] {\n\tcolor: var(--notectl-fg-muted);\n\ttext-decoration: line-through;\n}\n`;\n","/**\n * Factory for building list item block attributes.\n * Centralizes attribute construction to avoid repetitive inline object literals.\n */\n\nimport type { BlockAttrs } from '../../model/Document.js';\nimport type { ListType } from './ListPlugin.js';\n\n/** Builds a `BlockAttrs` object for a list_item block. */\nexport function buildListItemAttrs(\n\tlistType: ListType,\n\tindent: number,\n\tchecked?: boolean,\n): BlockAttrs {\n\tif (listType === 'checklist') {\n\t\treturn { listType, indent, checked: checked ?? false };\n\t}\n\treturn { listType, indent };\n}\n","/**\n * Command registration and implementations for list block types.\n * Handles toggle between list types and paragraph, indent/outdent,\n * and checklist toggle.\n */\n\nimport { forEachBlockIdInRange } from '../../commands/RangeIterator.js';\nimport { isNodeOfType } from '../../model/AttrRegistry.js';\nimport { isTextSelection, selectionRange } from '../../model/Selection.js';\nimport { type BlockId, nodeType } from '../../model/TypeBrands.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { PluginContext } from '../Plugin.js';\nimport { buildListItemAttrs } from './ListAttrsFactory.js';\nimport type { ListTypeDefinition } from './ListDefinitions.js';\nimport type { ListLocale } from './ListLocale.js';\nimport type { ListConfig, ListType } from './ListPlugin.js';\n\n/** Registers all list commands (toggleList:*, indent, outdent, toggleChecklistItem). */\nexport function registerListCommands(\n\tcontext: PluginContext,\n\tconfig: ListConfig,\n\tenabledTypes: readonly ListTypeDefinition[],\n\tlocale: ListLocale,\n): void {\n\tfor (const def of enabledTypes) {\n\t\tcontext.registerCommand(`toggleList:${def.type}`, () => {\n\t\t\treturn toggleList(context, def.type);\n\t\t});\n\t}\n\n\tcontext.registerCommand('indentListItem', () => changeIndent(context, 1, config.maxIndent));\n\n\tcontext.registerCommand('outdentListItem', () => changeIndent(context, -1, config.maxIndent));\n\n\tif (config.types.includes('checklist')) {\n\t\tconst toggleChecklistItem = (): boolean =>\n\t\t\ttoggleChecked(context, { interactiveCheckboxes: config.interactiveCheckboxes, locale });\n\n\t\tcontext.registerCommand('toggleChecklistItem', toggleChecklistItem, {\n\t\t\treadonlyAllowed: true,\n\t\t});\n\n\t\t// Mod-Enter gives keyboard-only users a way to toggle a checklist item\n\t\t// (WCAG 2.1.1). The handler declines on non-checklist blocks, so it falls\n\t\t// through to other Mod-Enter bindings (e.g. code-block insert-after).\n\t\t// Registered at navigation priority so it stays reachable in read-only mode\n\t\t// when interactiveCheckboxes is enabled, matching the mouse handler.\n\t\tcontext.registerKeymap({ 'Mod-Enter': toggleChecklistItem }, { priority: 'navigation' });\n\t}\n\n\tcontext.registerKeymap({\n\t\tTab: () => changeIndent(context, 1, config.maxIndent),\n\t\t'Shift-Tab': () => changeIndent(context, -1, config.maxIndent),\n\t});\n}\n\n// --- Command Implementations ---\n\nfunction toggleList(context: PluginContext, listType: ListType): boolean {\n\tconst state: EditorState = context.getState();\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return false;\n\n\tif (sel.anchor.blockId !== sel.head.blockId) {\n\t\treturn toggleListRange(context, state, listType);\n\t}\n\treturn toggleListSingleBlock(context, state, listType);\n}\n\nfunction toggleListSingleBlock(\n\tcontext: PluginContext,\n\tstate: EditorState,\n\tlistType: ListType,\n): boolean {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return false;\n\tconst block = state.getBlock(sel.anchor.blockId);\n\tif (!block) return false;\n\n\tif (block.type === 'list_item' && block.attrs?.listType === listType) {\n\t\tconst tr = state\n\t\t\t.transaction('command')\n\t\t\t.setBlockType(sel.anchor.blockId, nodeType('paragraph'))\n\t\t\t.setSelection(sel)\n\t\t\t.build();\n\t\tcontext.dispatch(tr);\n\t\treturn true;\n\t}\n\n\tconst existingIndent: number = isNodeOfType(block, 'list_item') ? block.attrs.indent : 0;\n\tconst attrs = buildListItemAttrs(listType, existingIndent);\n\n\tconst tr = state\n\t\t.transaction('command')\n\t\t.setBlockType(sel.anchor.blockId, nodeType('list_item'), attrs)\n\t\t.setSelection(sel)\n\t\t.build();\n\tcontext.dispatch(tr);\n\treturn true;\n}\n\nfunction toggleListRange(context: PluginContext, state: EditorState, listType: ListType): boolean {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return false;\n\n\tconst range = selectionRange(sel, state.getBlockOrder());\n\tconst toggleOff: boolean = allBlocksMatchListType(state, range, listType);\n\tconst builder = state.transaction('command');\n\n\tforEachBlockIdInRange(state, range, (bid: BlockId) => {\n\t\tconst block = state.getBlock(bid);\n\t\tif (!block) return;\n\n\t\tif (toggleOff) {\n\t\t\tbuilder.setBlockType(bid, nodeType('paragraph'));\n\t\t} else {\n\t\t\tconst existingIndent: number = isNodeOfType(block, 'list_item') ? block.attrs.indent : 0;\n\t\t\tconst existingChecked: boolean =\n\t\t\t\tisNodeOfType(block, 'list_item') &&\n\t\t\t\tblock.attrs.listType === 'checklist' &&\n\t\t\t\tblock.attrs.checked;\n\t\t\tbuilder.setBlockType(\n\t\t\t\tbid,\n\t\t\t\tnodeType('list_item'),\n\t\t\t\tbuildListItemAttrs(listType, existingIndent, existingChecked),\n\t\t\t);\n\t\t}\n\t});\n\n\tbuilder.setSelection(sel);\n\tcontext.dispatch(builder.build());\n\treturn true;\n}\n\n// --- Indent / Outdent ---\n\nfunction changeIndent(context: PluginContext, delta: 1 | -1, maxIndent: number): boolean {\n\tconst state: EditorState = context.getState();\n\tif (!isTextSelection(state.selection)) return false;\n\n\tif (state.selection.anchor.blockId !== state.selection.head.blockId) {\n\t\treturn changeIndentRange(context, state, delta, maxIndent);\n\t}\n\n\tconst sel = state.selection;\n\tconst block = state.getBlock(sel.anchor.blockId);\n\tif (!block || !isNodeOfType(block, 'list_item')) return false;\n\n\tconst newIndent: number = block.attrs.indent + delta;\n\tif (newIndent < 0 || newIndent > maxIndent) return false;\n\n\tconst attrs = buildListItemAttrs(block.attrs.listType, newIndent, block.attrs.checked);\n\tconst tr = state\n\t\t.transaction('command')\n\t\t.setBlockType(sel.anchor.blockId, nodeType('list_item'), attrs)\n\t\t.setSelection(sel)\n\t\t.build();\n\tcontext.dispatch(tr);\n\treturn true;\n}\n\nfunction changeIndentRange(\n\tcontext: PluginContext,\n\tstate: EditorState,\n\tdelta: 1 | -1,\n\tmaxIndent: number,\n): boolean {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return false;\n\n\tconst range = selectionRange(sel, state.getBlockOrder());\n\tconst builder = state.transaction('command');\n\tlet changed = false;\n\n\tforEachBlockIdInRange(state, range, (bid: BlockId) => {\n\t\tconst block = state.getBlock(bid);\n\t\tif (!block || !isNodeOfType(block, 'list_item')) return;\n\n\t\tconst newIndent: number = block.attrs.indent + delta;\n\t\tif (newIndent < 0 || newIndent > maxIndent) return;\n\n\t\tbuilder.setBlockType(\n\t\t\tbid,\n\t\t\tnodeType('list_item'),\n\t\t\tbuildListItemAttrs(block.attrs.listType, newIndent, block.attrs.checked),\n\t\t);\n\t\tchanged = true;\n\t});\n\n\tif (!changed) return false;\n\n\tbuilder.setSelection(sel);\n\tcontext.dispatch(builder.build());\n\treturn true;\n}\n\n// --- Checklist Toggle ---\n\n/** Options for {@link toggleChecked}. */\nexport interface ToggleCheckedOptions {\n\t/** When true, the toggle is allowed even in read-only mode. */\n\treadonly interactiveCheckboxes?: boolean;\n\t/** Specific checklist item to toggle. Defaults to the selection's block. */\n\treadonly targetId?: BlockId;\n\t/** Locale used for the screen-reader announcement of the new state. */\n\treadonly locale: ListLocale;\n}\n\n/**\n * Toggles the checked state of a checklist item and announces the new state to\n * screen readers. Exported for use in the checkbox click handler.\n */\nexport function toggleChecked(context: PluginContext, options: ToggleCheckedOptions): boolean {\n\tconst { interactiveCheckboxes, targetId, locale } = options;\n\tif (context.isReadOnly() && !interactiveCheckboxes) return false;\n\n\tconst state: EditorState = context.getState();\n\tconst bid: BlockId | null =\n\t\ttargetId ?? (!isTextSelection(state.selection) ? null : state.selection.anchor.blockId);\n\tif (!bid) return false;\n\n\tconst block = state.getBlock(bid);\n\tif (!block || !isNodeOfType(block, 'list_item') || block.attrs.listType !== 'checklist') {\n\t\treturn false;\n\t}\n\n\tconst nextChecked: boolean = !block.attrs.checked;\n\tconst attrs = buildListItemAttrs(block.attrs.listType, block.attrs.indent, nextChecked);\n\n\tconst tr = state\n\t\t.transaction('command')\n\t\t.setBlockType(bid, nodeType('list_item'), attrs)\n\t\t.setSelection(state.selection)\n\t\t.build();\n\tcontext.dispatch(tr);\n\n\t// The marker is not focused while editing, so the aria-checked change alone is\n\t// not spoken — announce the new state explicitly (WCAG 4.1.3).\n\tcontext.announce(nextChecked ? locale.checkedAnnouncement : locale.uncheckedAnnouncement);\n\treturn true;\n}\n\n// --- Helpers ---\n\n/** Checks whether all blocks in a range are list items of the given type. Exported for toolbar. */\nexport function allBlocksMatchListType(\n\tstate: EditorState,\n\trange: ReturnType<typeof selectionRange>,\n\tlistType: ListType,\n): boolean {\n\tlet allMatch = true;\n\tforEachBlockIdInRange(state, range, (bid: BlockId) => {\n\t\tconst block = state.getBlock(bid);\n\t\tif (!block || block.type !== 'list_item' || block.attrs?.listType !== listType) {\n\t\t\tallMatch = false;\n\t\t}\n\t});\n\treturn allMatch;\n}\n","/**\n * List type metadata: icons, patterns, and type definitions.\n * Pure data constants shared across list plugin modules.\n */\n\nimport type { ListType } from './ListPlugin.js';\n\n// --- List Type Metadata ---\n\nexport interface ListTypeDefinition {\n\treadonly type: ListType;\n\treadonly icon: string;\n\treadonly inputPattern: RegExp;\n\treadonly inputPrefix: string;\n}\n\nconst BULLET_LIST_ICON =\n\t'<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M4 10.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm0-6c-.83 0-1.5.67-1.5 1.5S3.17 7.5 4 7.5 5.5 6.83 5.5 6 4.83 4.5 4 4.5zm0 12c-.83 0-1.5.68-1.5 1.5s.68 1.5 1.5 1.5 1.5-.68 1.5-1.5-.67-1.5-1.5-1.5zM7 19h14v-2H7v2zm0-6h14v-2H7v2zm0-8v2h14V5H7z\"/></svg>';\nconst NUMBERED_LIST_ICON =\n\t'<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M2 17h2v.5H3v1h1v.5H2v1h3v-4H2v1zm1-9h1V4H2v1h1v3zm-1 3h1.8L2 13.1v.9h3v-1H3.2L5 10.9V10H2v1zm5-6v2h14V5H7zm0 14h14v-2H7v2zm0-6h14v-2H7v2z\"/></svg>';\nconst CHECKLIST_ICON =\n\t'<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M22 7h-9v2h9V7zm0 8h-9v2h9v-2zM5.54 11L2 7.46l1.41-1.41 2.12 2.12 4.24-4.24 1.41 1.41L5.54 11zm0 8L2 15.46l1.41-1.41 2.12 2.12 4.24-4.24 1.41 1.41L5.54 19z\"/></svg>';\n\nexport const LIST_TYPE_DEFINITIONS: readonly ListTypeDefinition[] = [\n\t{\n\t\ttype: 'bullet',\n\t\ticon: BULLET_LIST_ICON,\n\t\tinputPattern: /^[-*] $/,\n\t\tinputPrefix: '- ',\n\t},\n\t{\n\t\ttype: 'ordered',\n\t\ticon: NUMBERED_LIST_ICON,\n\t\tinputPattern: /^\\d+\\. $/,\n\t\tinputPrefix: '1. ',\n\t},\n\t{\n\t\ttype: 'checklist',\n\t\ticon: CHECKLIST_ICON,\n\t\tinputPattern: /^\\[[ x]] $/,\n\t\tinputPrefix: '[ ] ',\n\t},\n];\n","/**\n * Input rule registration for list block types.\n * Converts `- `, `* `, `1. `, `[ ] `, `[x] ` at the start of a paragraph into list items.\n */\n\nimport { createCollapsedSelection, isCollapsed, isTextSelection } from '../../model/Selection.js';\nimport { nodeType } from '../../model/TypeBrands.js';\nimport type { PluginContext } from '../Plugin.js';\nimport { buildListItemAttrs } from './ListAttrsFactory.js';\nimport type { ListTypeDefinition } from './ListDefinitions.js';\n\n/** Registers markdown-style input rules for configured list types. */\nexport function registerListInputRules(\n\tcontext: PluginContext,\n\tenabledTypes: readonly ListTypeDefinition[],\n): void {\n\tfor (const def of enabledTypes) {\n\t\tcontext.registerInputRule({\n\t\t\tpattern: def.inputPattern,\n\t\t\thandler: (state, match, start, _end) => {\n\t\t\t\tconst sel = state.selection;\n\t\t\t\tif (!isTextSelection(sel)) return null;\n\t\t\t\tif (!isCollapsed(sel)) return null;\n\n\t\t\t\tconst block = state.getBlock(sel.anchor.blockId);\n\t\t\t\tif (!block || block.type !== 'paragraph') return null;\n\n\t\t\t\tconst matchStr = match[0] ?? '';\n\t\t\t\tconst matchLen = matchStr.length;\n\t\t\t\tconst attrs = buildListItemAttrs(def.type, 0, matchStr.includes('[x]'));\n\n\t\t\t\treturn state\n\t\t\t\t\t.transaction('input')\n\t\t\t\t\t.deleteTextAt(sel.anchor.blockId, start, start + matchLen)\n\t\t\t\t\t.setBlockType(sel.anchor.blockId, nodeType('list_item'), attrs)\n\t\t\t\t\t.setSelection(createCollapsedSelection(sel.anchor.blockId, 0))\n\t\t\t\t\t.build();\n\t\t\t},\n\t\t});\n\t}\n}\n","/**\n * Keyboard handlers for list block types.\n * Handles Enter (split/exit list) and Backspace (convert to paragraph).\n */\n\nimport { isNodeOfType } from '../../model/AttrRegistry.js';\nimport type { BlockNode } from '../../model/Document.js';\nimport { generateBlockId, getBlockText } from '../../model/Document.js';\nimport { createCollapsedSelection, isCollapsed, isTextSelection } from '../../model/Selection.js';\nimport type { BlockId } from '../../model/TypeBrands.js';\nimport { nodeType } from '../../model/TypeBrands.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { PluginContext } from '../Plugin.js';\nimport { buildListItemAttrs } from './ListAttrsFactory.js';\n\n// --- Context Guard ---\n\ninterface ListContext {\n\treadonly state: EditorState;\n\treadonly block: BlockNode;\n\treadonly blockId: BlockId;\n\treadonly offset: number;\n}\n\n/**\n * Guards against NodeSelection, non-collapsed selections, and non-list blocks.\n * Returns false (not handled) if the cursor is not inside a list_item block.\n */\nfunction withListContext(context: PluginContext, handler: (ctx: ListContext) => boolean): boolean {\n\tconst state: EditorState = context.getState();\n\tif (!isTextSelection(state.selection)) return false;\n\n\tconst sel = state.selection;\n\tif (!isCollapsed(sel)) return false;\n\n\tconst block: BlockNode | undefined = state.getBlock(sel.anchor.blockId);\n\tif (!block || block.type !== 'list_item') return false;\n\n\treturn handler({\n\t\tstate,\n\t\tblock,\n\t\tblockId: sel.anchor.blockId,\n\t\toffset: sel.anchor.offset,\n\t});\n}\n\n/** Registers Enter and Backspace keymaps for list items. */\nexport function registerListKeymaps(context: PluginContext): void {\n\tcontext.registerKeymap({\n\t\tEnter: () => handleEnter(context),\n\t\tBackspace: () => handleBackspace(context),\n\t});\n}\n\n// --- Enter Handler ---\n\n/**\n * Handles Enter inside a list item.\n * Empty item → exit list (convert to paragraph).\n * Non-empty item → split and create a new list item with the same type.\n */\nfunction handleEnter(context: PluginContext): boolean {\n\treturn withListContext(context, (ctx) => {\n\t\tconst text: string = getBlockText(ctx.block);\n\n\t\tif (text === '') {\n\t\t\tconst tr = ctx.state\n\t\t\t\t.transaction('input')\n\t\t\t\t.setBlockType(ctx.blockId, nodeType('paragraph'))\n\t\t\t\t.setSelection(ctx.state.selection)\n\t\t\t\t.build();\n\t\t\tcontext.dispatch(tr);\n\t\t\treturn true;\n\t\t}\n\n\t\tconst newBlockId = generateBlockId();\n\t\tconst listType = isNodeOfType(ctx.block, 'list_item') ? ctx.block.attrs.listType : 'bullet';\n\t\tconst indent: number = isNodeOfType(ctx.block, 'list_item') ? ctx.block.attrs.indent : 0;\n\t\tconst attrs = buildListItemAttrs(listType, indent);\n\n\t\tconst tr = ctx.state\n\t\t\t.transaction('input')\n\t\t\t.splitBlock(ctx.blockId, ctx.offset, newBlockId)\n\t\t\t.setBlockType(newBlockId, nodeType('list_item'), attrs)\n\t\t\t.setSelection(createCollapsedSelection(newBlockId, 0))\n\t\t\t.build();\n\t\tcontext.dispatch(tr);\n\t\treturn true;\n\t});\n}\n\n// --- Backspace Handler ---\n\n/**\n * Handles Backspace at the start of a list item.\n * Converts the list item back to a paragraph, preserving text.\n */\nfunction handleBackspace(context: PluginContext): boolean {\n\treturn withListContext(context, (ctx) => {\n\t\tif (ctx.offset !== 0) return false;\n\n\t\tconst tr = ctx.state\n\t\t\t.transaction('input')\n\t\t\t.setBlockType(ctx.blockId, nodeType('paragraph'))\n\t\t\t.setSelection(ctx.state.selection)\n\t\t\t.build();\n\t\tcontext.dispatch(tr);\n\t\treturn true;\n\t});\n}\n","/**\n * Locale interface and default English locale for the ListPlugin.\n */\n\nimport { type LocaleModuleMap, loadLocaleModule } from '../shared/LocaleLoader.js';\n\n// --- Locale Interface ---\n\nexport interface ListLocale {\n\treadonly bulletList: string;\n\treadonly numberedList: string;\n\treadonly checklist: string;\n\t/** Accessible name for the checklist item's checkbox marker (screen readers). */\n\treadonly checkboxLabel: string;\n\t/** Announced when a checklist item is toggled on. */\n\treadonly checkedAnnouncement: string;\n\t/** Announced when a checklist item is toggled off. */\n\treadonly uncheckedAnnouncement: string;\n}\n\n// --- Default English Locale ---\n\nexport const LIST_LOCALE_EN: ListLocale = {\n\tbulletList: 'Bullet List',\n\tnumberedList: 'Numbered List',\n\tchecklist: 'Checklist',\n\tcheckboxLabel: 'To-do item',\n\tcheckedAnnouncement: 'Checked',\n\tuncheckedAnnouncement: 'Unchecked',\n};\n\n// --- Lazy Locale Loader ---\n\nconst localeModules: LocaleModuleMap<ListLocale> = import.meta.glob<{\n\tdefault: ListLocale;\n}>('./locales/*.ts', { eager: false });\n\nexport async function loadListLocale(lang: string): Promise<ListLocale> {\n\treturn loadLocaleModule(localeModules, lang, LIST_LOCALE_EN);\n}\n","/**\n * Accessible checkbox marker for checklist items.\n *\n * The marker is a real `role=\"checkbox\"` element so assistive technology can\n * announce the item's checked state (WCAG 4.1.2 Name, Role, Value). It is\n * rendered `contenteditable=\"false\"` and flagged `data-widget` so the selection\n * layer treats it as zero-width view chrome, never as document content or a caret\n * position. The visible checkbox glyph is drawn in CSS.\n */\n\n/** CSS class identifying the checklist checkbox marker element. */\nexport const CHECKLIST_MARKER_CLASS = 'notectl-checklist-marker';\n\n/** Creates the accessible checkbox marker for a checklist item. */\nexport function createChecklistMarker(checked: boolean, label: string): HTMLElement {\n\tconst marker: HTMLElement = document.createElement('span');\n\tmarker.className = CHECKLIST_MARKER_CLASS;\n\tmarker.setAttribute('role', 'checkbox');\n\tmarker.setAttribute('aria-checked', String(checked));\n\tmarker.setAttribute('aria-label', label);\n\tmarker.setAttribute('contenteditable', 'false');\n\tmarker.setAttribute('data-widget', 'true');\n\treturn marker;\n}\n","/**\n * Toolbar item registration for list block types.\n * Registers bullet, ordered, and checklist toolbar buttons with active-state detection.\n */\n\nimport { isTextSelection, selectionRange } from '../../model/Selection.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { PluginContext } from '../Plugin.js';\nimport { allBlocksMatchListType } from './ListCommands.js';\nimport type { ListTypeDefinition } from './ListDefinitions.js';\nimport type { ListLocale } from './ListLocale.js';\nimport type { ListType } from './ListPlugin.js';\n\n/** Registers toolbar items for each enabled list type. */\nexport function registerListToolbarItems(\n\tcontext: PluginContext,\n\tenabledTypes: readonly ListTypeDefinition[],\n\tlocale: ListLocale,\n): void {\n\tfor (const def of enabledTypes) {\n\t\tcontext.registerToolbarItem({\n\t\t\tid: `list-${def.type}`,\n\t\t\tgroup: 'block',\n\t\t\ticon: def.icon,\n\t\t\tlabel: getListLabel(def.type, locale),\n\t\t\tcommand: `toggleList:${def.type}`,\n\t\t\tisActive: (state) => isListActive(state, def.type),\n\t\t});\n\t}\n}\n\n// --- Helpers ---\n\nfunction getListLabel(type: ListType, locale: ListLocale): string {\n\tconst labels: Record<ListType, string> = {\n\t\tbullet: locale.bulletList,\n\t\tordered: locale.numberedList,\n\t\tchecklist: locale.checklist,\n\t};\n\treturn labels[type];\n}\n\nfunction isListActive(state: EditorState, listType: ListType): boolean {\n\tif (!isTextSelection(state.selection)) return false;\n\n\tif (state.selection.anchor.blockId !== state.selection.head.blockId) {\n\t\tconst range = selectionRange(state.selection, state.getBlockOrder());\n\t\treturn allBlocksMatchListType(state, range, listType);\n\t}\n\n\tconst block = state.getBlock(state.selection.anchor.blockId);\n\treturn block?.type === 'list_item' && block.attrs?.listType === listType;\n}\n","/**\n * ListPlugin: registers ordered, unordered, and checklist block types\n * with NodeSpecs, toggle commands, indent/outdent (Tab/Shift-Tab),\n * input rules, and toolbar buttons.\n *\n * This file is a thin orchestrator — command logic, input rules, keyboard\n * handlers, and toolbar rendering are delegated to dedicated modules.\n *\n * List items are modeled as flat blocks with a `listType` and `indent` attribute,\n * allowing simple nesting representation without deep tree structures.\n */\n\nimport { LIST_CSS, LIST_MARKER_WIDTH } from '../../editor/styles/list.js';\nimport { blockId } from '../../model/TypeBrands.js';\nimport { setStyleProperty } from '../../style/StyleRuntime.js';\nimport { createBlockElement } from '../../view/DomUtils.js';\nimport type { Plugin, PluginContext } from '../Plugin.js';\nimport { resolveLocale } from '../shared/PluginHelpers.js';\nimport { registerListCommands, toggleChecked } from './ListCommands.js';\nimport { LIST_TYPE_DEFINITIONS, type ListTypeDefinition } from './ListDefinitions.js';\nimport { registerListInputRules } from './ListInputRules.js';\nimport { registerListKeymaps } from './ListKeyboardHandlers.js';\nimport { LIST_LOCALE_EN, type ListLocale, loadListLocale } from './ListLocale.js';\nimport { CHECKLIST_MARKER_CLASS, createChecklistMarker } from './ListMarker.js';\nimport { registerListToolbarItems } from './ListToolbarItems.js';\n\n// --- Attribute Registry Augmentation ---\n\nexport type ListType = 'bullet' | 'ordered' | 'checklist';\n\ndeclare module '../../model/AttrRegistry.js' {\n\tinterface NodeAttrRegistry {\n\t\tlist_item: { listType: ListType; indent: number; checked: boolean };\n\t}\n}\n\n// --- Configuration ---\n\nexport interface ListConfig {\n\t/** Which list types to enable. Defaults to all. */\n\treadonly types: readonly ListType[];\n\t/** Maximum indent depth. Defaults to 4. */\n\treadonly maxIndent: number;\n\t/**\n\t * When true, checklist checkboxes remain interactive even in read-only mode.\n\t * Defaults to false (checkboxes are fully read-only).\n\t */\n\treadonly interactiveCheckboxes?: boolean;\n\treadonly locale?: ListLocale;\n}\n\nconst DEFAULT_CONFIG: ListConfig = {\n\ttypes: ['bullet', 'ordered', 'checklist'],\n\tmaxIndent: 4,\n};\n\n// --- Plugin ---\n\nexport class ListPlugin implements Plugin {\n\treadonly id = 'list';\n\treadonly name = 'List';\n\treadonly priority = 35;\n\n\tprivate readonly config: ListConfig;\n\tprivate locale!: ListLocale;\n\tprivate context: PluginContext | null = null;\n\tprivate checkboxClickHandler: ((e: MouseEvent) => void) | null = null;\n\n\tconstructor(config?: Partial<ListConfig>) {\n\t\tthis.config = { ...DEFAULT_CONFIG, ...config };\n\t}\n\n\tasync init(context: PluginContext): Promise<void> {\n\t\tthis.context = context;\n\t\tthis.locale = await resolveLocale(context, this.config.locale, LIST_LOCALE_EN, loadListLocale);\n\t\tconst enabledTypes = this.getEnabledTypes();\n\n\t\tcontext.registerStyleSheet(LIST_CSS);\n\t\tthis.registerNodeSpec(context);\n\t\tregisterListCommands(context, this.config, enabledTypes, this.locale);\n\t\tregisterListKeymaps(context);\n\t\tregisterListInputRules(context, enabledTypes);\n\t\tregisterListToolbarItems(context, enabledTypes, this.locale);\n\t\tthis.registerCheckboxClickHandler(context);\n\t}\n\n\tdestroy(): void {\n\t\tif (this.checkboxClickHandler && this.context) {\n\t\t\tconst container: HTMLElement = this.context.getContainer();\n\t\t\tcontainer.removeEventListener('mousedown', this.checkboxClickHandler);\n\t\t}\n\t\tthis.checkboxClickHandler = null;\n\t\tthis.context = null;\n\t}\n\n\tprivate registerNodeSpec(context: PluginContext): void {\n\t\tconst checkboxLabel: string = this.locale.checkboxLabel;\n\n\t\tcontext.registerNodeSpec({\n\t\t\ttype: 'list_item',\n\t\t\tgroup: 'block',\n\t\t\tcontent: { allow: ['text'] },\n\t\t\tattrs: {\n\t\t\t\tlistType: { default: 'bullet' },\n\t\t\t\tindent: { default: 0 },\n\t\t\t\tchecked: { default: false },\n\t\t\t},\n\t\t\ttoDOM(node) {\n\t\t\t\tconst listType = node.attrs?.listType ?? 'bullet';\n\t\t\t\tconst indent = node.attrs?.indent ?? 0;\n\t\t\t\tconst checked = node.attrs?.checked ?? false;\n\n\t\t\t\tconst li = createBlockElement('li', node.id);\n\t\t\t\tli.setAttribute('role', 'listitem');\n\t\t\t\tli.setAttribute('data-list-type', listType);\n\t\t\t\tli.setAttribute('data-indent', String(indent));\n\t\t\t\tli.className = `notectl-list-item notectl-list-item--${listType}`;\n\n\t\t\t\tif (indent > 0) {\n\t\t\t\t\tsetStyleProperty(li, 'marginLeft', `${indent * LIST_MARKER_WIDTH}px`);\n\t\t\t\t}\n\n\t\t\t\tif (listType === 'checklist') {\n\t\t\t\t\t// `data-checked` drives the CSS glyph; the checked state is exposed to\n\t\t\t\t\t// assistive technology via the marker's own role=\"checkbox\", not via an\n\t\t\t\t\t// (invalid) aria-checked on the listitem. The marker is the first child\n\t\t\t\t\t// so reconciled inline content is appended after it.\n\t\t\t\t\tli.setAttribute('data-checked', String(checked));\n\t\t\t\t\tli.appendChild(createChecklistMarker(checked, checkboxLabel));\n\t\t\t\t}\n\t\t\t\tli.setAttribute('aria-level', String(indent + 1));\n\n\t\t\t\treturn li;\n\t\t\t},\n\t\t\twrapper(node) {\n\t\t\t\tconst listType = node.attrs?.listType ?? 'bullet';\n\t\t\t\tconst tag = listType === 'ordered' ? 'ol' : 'ul';\n\t\t\t\treturn {\n\t\t\t\t\ttag,\n\t\t\t\t\tkey: `list-${listType}`,\n\t\t\t\t\tclassName: `notectl-list notectl-list--${listType}`,\n\t\t\t\t\tattrs: { role: 'list' },\n\t\t\t\t};\n\t\t\t},\n\t\t\ttoHTML(node, content) {\n\t\t\t\tconst listType: string = (node.attrs?.listType as string) ?? 'bullet';\n\t\t\t\tconst checked: boolean = (node.attrs?.checked as boolean) ?? false;\n\n\t\t\t\tif (listType === 'checklist') {\n\t\t\t\t\tconst checkedAttr: string = checked ? ' checked' : '';\n\t\t\t\t\tconst ariaChecked: string = String(checked);\n\t\t\t\t\treturn (\n\t\t\t\t\t\t`<li role=\"checkbox\" aria-checked=\"${ariaChecked}\">` +\n\t\t\t\t\t\t`<input type=\"checkbox\" disabled${checkedAttr}>` +\n\t\t\t\t\t\t`${content || '<br>'}</li>`\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\treturn `<li>${content || '<br>'}</li>`;\n\t\t\t},\n\t\t\tparseHTML: [{ tag: 'li' }],\n\t\t\tsanitize: {\n\t\t\t\ttags: ['ul', 'ol', 'li', 'input'],\n\t\t\t\tattrs: ['type', 'disabled', 'checked', 'role', 'aria-checked'],\n\t\t\t},\n\t\t});\n\t}\n\n\tprivate registerCheckboxClickHandler(context: PluginContext): void {\n\t\tif (!this.config.types.includes('checklist')) return;\n\n\t\tthis.checkboxClickHandler = (e: MouseEvent) => {\n\t\t\tif (context.isReadOnly() && !this.config.interactiveCheckboxes) return;\n\n\t\t\tconst target: EventTarget | null = e.target;\n\t\t\tif (!(target instanceof HTMLElement)) return;\n\n\t\t\t// Toggle only when the checkbox marker itself is clicked. The marker is a\n\t\t\t// real element, so this is precise — no geometry/RTL math needed.\n\t\t\tconst marker: Element | null = target.closest(`.${CHECKLIST_MARKER_CLASS}`);\n\t\t\tif (!marker) return;\n\n\t\t\tconst li: Element | null = marker.closest('.notectl-list-item--checklist');\n\t\t\tif (!li) return;\n\n\t\t\te.preventDefault();\n\n\t\t\tconst bid: string | null = li.getAttribute('data-block-id');\n\t\t\tif (!bid) return;\n\n\t\t\ttoggleChecked(context, {\n\t\t\t\tinteractiveCheckboxes: this.config.interactiveCheckboxes,\n\t\t\t\ttargetId: blockId(bid),\n\t\t\t\tlocale: this.locale,\n\t\t\t});\n\t\t};\n\n\t\tconst container: HTMLElement = context.getContainer();\n\t\tcontainer.addEventListener('mousedown', this.checkboxClickHandler);\n\t}\n\n\tprivate getEnabledTypes(): readonly ListTypeDefinition[] {\n\t\treturn LIST_TYPE_DEFINITIONS.filter((def) => this.config.types.includes(def.type));\n\t}\n}\n"],"mappings":"+ZCSA,SAAgB,EACf,EACA,EACA,GAEA,MAAiB,cAAb,EACI,CAAE,WAAU,SAAQ,QAAS,IAAW,GAEzC,CAAE,WAAU,SACpB,CCwCA,SAAS,EAAW,EAAwB,GAC3C,MAAM,EAAqB,EAAQ,WAC7B,EAAM,EAAM,UAClB,QAAK,EAAgB,KAEjB,EAAI,OAAO,UAAY,EAAI,KAAK,QAsCrC,SAAyB,EAAwB,EAAoB,GACpE,MAAM,EAAM,EAAM,UAClB,IAAK,EAAgB,GAAM,OAAO,EAElC,MAAM,EAAQ,EAAe,EA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U,EAAQ,GAClB,OAAQ,KAAK,UAKf,EADuC,eAC7B,iBAAiB,YAAa,KAAK,sBAC9C,CAEA,eAAA,GACC,OAAO,EAAsB,OAAQ,GAAQ,KAAK,OAAO,MAAM,SAAS,EAAI,MAC7E"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{S as t,o as n,p as e,u as i}from"./Document-r7vLOAGA.mjs";import{c as o,l as r,n as s,o as c,r as l,t as u}from"./Selection-HYoVFpAx.mjs";import{r as a}from"./NodeResolver-ChgLF_IP.mjs";import{T as d,_ as f,l as p}from"./BlockInsertion-6rR9tIGP.mjs";import{i as b}from"./NavigationQueries-Bt4zZ17v.mjs";function m(e,o){const{parentPath:r,siblings:s,index:c}=d(e,o.nodeId);if(c<0)return null;const l=e.transaction("input");if(1===s.length){const t=i();return l.insertNode(r,0,n(t)),l.removeNode(r,1),l.setSelection(u(t,0)),l.build()}l.removeNode(r,c);const a=s[c-1];if(a&&t(a)){const t=f(e,a.id,"end");if(t)return l.setSelection(t),l.build()}const p=s[c+1];if(p&&t(p)){const t=f(e,p.id,"start");if(t)return l.setSelection(t),l.build()}return null}function S(n,e){if(e<0)return;const i=n[e+1];return i&&t(i)&&p(i)?i:void 0}function g(t,e){const{parentPath:o,siblings:r,index:s}=d(t,e.nodeId);if(s<0)return null;const c=S(r,s);if(c)return t.transaction("input").setSelection(u(c.id,0)).build();const l=i(),a=t.transaction("input");return a.insertNode(o,s+1,n(l)),a.setSelection(u(l,0)),a.build()}function h(t,e,o,r){const{parentPath:s,siblings:c,index:l}=d(t,e.nodeId),a=t.transaction(r),f=S(c,l);if(f)return a.insertText(f.id,0,o,[]),a.setSelection(u(f.id,o.length)),a.build();const p=i(),b=l>=0?l+1:c.length;return a.insertNode(s,b,n(p)),a.insertText(p,0,o,[]),a.setSelection(u(p,o.length)),a.build()}function I(t,n,i){const d=t.selection,f=t.getBlockOrder(),p=!i||"left"!==n&&"right"!==n?n:"left"===n?"right":"left";return r(d)?function(t,n,i,o){const r=o.indexOf(n.nodeId),c=a(t.doc,n.nodeId)??[];if("left"===i||"up"===i){if(r>0){const i=o[r-1];if(!i)return null;if(b(t,i))return t.transaction("input").setSelection(s(n.nodeId,"before",c)).build();const l=t.getBlock(i),a=l?e(l):0;return t.transaction("input").setSelection(u(i,a)).build()}return t.transaction("input").setSelection(s(n.nodeId,"before",c)).build()}if(r<o.length-1){const e=o[r+1];return e?b(t,e)?t.transaction("input").setSelection(s(n.nodeId,"after",c)).build():t.transaction("input").setSelection(u(e,0)).build():null}return t.transaction("input").setSelection(s(n.nodeId,"after",c)).build()}(t,d,p,f):o(d)?null:c(d)?function(t,n,i,o){const r=o.indexOf(n.anchor.blockId),s=t.getBlock(n.anchor.blockId);if(!s)return null;const c=e(s);if(("right"===i||"down"===i)&&n.anchor.offset===c&&r<o.length-1){const n=o[r+1];if(n&&b(t,n)){const e=a(t.doc,n)??[];return t.transaction("input").setSelection(l(n,e)).build()}}if(("left"===i||"up"===i)&&0===n.anchor.offset&&r>0){const n=o[r-1];if(n&&b(t,n)){const e=a(t.doc,n)??[];return t.transaction("input").setSelection(l(n,e)).build()}}return null}(t,d,p,f):null}export{I as i,g as n,h as r,m as t};
|
|
2
|
-
//# sourceMappingURL=NodeSelectionCommands-Dj4VxLdD.mjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{l as e,u as n}from"./Selection-HYoVFpAx.mjs";import{n as t}from"./TypedKeys-CA4bfw9O.mjs";var o=class{resolvedLocale;constructor(e){this.resolvedLocale="browser"===e?"undefined"!=typeof navigator?navigator.language.split("-")[0]??"en":"en":e}getLocale(){return this.resolvedLocale}},r=new t("locale");async function c(e,n,t){if("en"===n)return t;const o=e[`./locales/${n}.ts`];if(!o)return t;try{return(await o()).default}catch{return t}}function s(e,n){return!!n&&(e.dispatch(n),!0)}function a(e){return e.charAt(0).toUpperCase()+e.slice(1)}function i(e){return`toggle${a(e)}`}async function l(e,n,t,o){if(n)return n;const c=e.getService(r)?.getLocale()??"en";return"en"===c?t:o(c)}function u(t){const o=t.selection;return e(o)?t.getBlock(o.nodeId):n(o)?t.getBlock(o.anchor.blockId):void 0}function d(t){const o=t.selection;return e(o)?o.nodeId:n(o)?o.anchor.blockId:void 0}function f(t){const o=t.selection;if(e(o))return[o.nodeId];if(!n(o))return[];const r=o.anchor.blockId,c=o.head.blockId;if(r===c)return[r];const s=t.getBlockOrder(),a=s.indexOf(r),i=s.indexOf(c);if(-1===a||-1===i)return[];const l=Math.min(a,i),u=Math.max(a,i);return s.slice(l,u+1)}export{f as a,c,d as i,o as l,s as n,l as o,u as r,i as s,a as t,r as u};
|
|
2
|
-
//# sourceMappingURL=PluginHelpers-KDuTlmXm.mjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{o as t}from"./StyleRuntime-BAutwDZT.mjs";function e(t){const e=t.style.top,o=t.style.left,i=t.style.right;t.style.top="0px",t.style.left="0px",t.style.right="auto";const l=t.getBoundingClientRect(),n=l.left,p=l.top;t.style.left="auto",t.style.right="0px";const s=t.getBoundingClientRect(),r=window.innerWidth-s.right;return t.style.top=e,t.style.left=o,t.style.right=i,{x:n,y:p,rightX:r}}function o(o,i,l){const n=l.offset??2,p=window.innerWidth,s=window.innerHeight;t(o,{position:"fixed",zIndex:"10000"});const r=e(o),f=o.offsetWidth,h=o.offsetHeight,a={};switch(l.position){case"below-start":{let t=i.bottom+n;if(l.isRtl){let e=p-i.right;e+f>p-4&&(e=p-f-4),t+h>s-4&&(t=i.top-h-n),e<4&&(e=4),t<4&&(t=4),a.top=t-r.y+"px",a.right=e-r.rightX+"px",a.left="auto"}else{let e=i.left;e+f>p-4&&(e=p-f-4),t+h>s-4&&(t=i.top-h-n),e<4&&(e=4),t<4&&(t=4),a.top=t-r.y+"px",a.left=e-r.x+"px",a.right="auto"}break}case"below-end":{let t=i.bottom+n;if(l.isRtl){let e=i.left;e+f>p-4&&(e=p-f-4),t+h>s-4&&(t=i.top-h-n),e<4&&(e=4),t<4&&(t=4),a.top=t-r.y+"px",a.left=e-r.x+"px",a.right="auto"}else{let e=p-i.right;e+f>p-4&&(e=p-f-4),t+h>s-4&&(t=i.top-h-n),e<4&&(e=4),t<4&&(t=4),a.top=t-r.y+"px",a.right=e-r.rightX+"px",a.left="auto"}break}case"right":{let t=i.top;if(l.isRtl){let e=i.left-f-n;e<4&&(e=i.right+n),t+h>s-4&&(t=s-h-4),e<4&&(e=4),t<4&&(t=4),a.top=t-r.y+"px",a.left=e-r.x+"px",a.right="auto"}else{let e=i.right+n;e+f>p-4&&(e=i.left-f-n),t+h>s-4&&(t=s-h-4),e<4&&(e=4),t<4&&(t=4),a.top=t-r.y+"px",a.left=e-r.x+"px",a.right="auto"}break}}t(o,a)}function i(t,e){const o=e.getRootNode();o instanceof ShadowRoot?o.appendChild(t):document.body.appendChild(t)}function l(e){if("function"==typeof e.showPopover){e.setAttribute("popover","manual");try{e.showPopover()}catch{return void e.removeAttribute("popover")}t(e,{margin:"0",inset:"auto"})}}export{l as i,e as n,o as r,i as t};
|
|
2
|
-
//# sourceMappingURL=PopupPositioning-DtUrY9bh.mjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{c as t,o as e}from"./StyleRuntime-BAutwDZT.mjs";import{a as o,c as n,f as r,i,m as s,n as c,r as a,t as l}from"./PrintTypes-WdtgSj74.mjs";import{c as p,o as u}from"./PluginHelpers-KDuTlmXm.mjs";import{t as m}from"./ShortcutFormatting-TwiufqeV.mjs";import h from"dompurify";var d={label:"Print",tooltip:t=>`Print (${t})`,printingAnnouncement:"Printing"},f=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar-Uzo1Azdw.mjs"),"./locales/de.ts":()=>import("./de-DcMhfRBu.mjs"),"./locales/es.ts":()=>import("./es-BJHF95J_.mjs"),"./locales/fr.ts":()=>import("./fr-KXmbys88.mjs"),"./locales/hi.ts":()=>import("./hi-l6DA-aOw.mjs"),"./locales/pt.ts":()=>import("./pt-C8sOyw0V.mjs"),"./locales/ru.ts":()=>import("./ru-B1m8J9dl.mjs"),"./locales/zh.ts":()=>import("./zh-dGSDBBzb.mjs")});async function g(t){return p(f,t,d)}var v=["h1","h2","h3","h4","h5","h6","p","div","span","br","hr","strong","b","em","i","u","s","sub","sup","small","ul","ol","li","table","thead","tbody","tr","th","td","img"],y=["style","class","src","alt","width","height","colspan","rowspan"];function b(t){const e="function"==typeof t?t():t;return h.sanitize(e,{ALLOWED_TAGS:[...v],ALLOWED_ATTR:[...y]})}var j={print(){},toHTML:()=>""},w=class{id="print";name="Print";config;service=null;locale;constructor(t){this.config=t??{}}async init(o){this.locale=await u(o,this.config.locale,d,g);const i=o.getContainer(),p=i.getRootNode();if(p instanceof ShadowRoot){const a=p.host,u=o.getEventBus();this.service=function(o,i,a,p){function u(t){return t??{}}function m(t){const u={options:t,cancelled:!1};if(p.emit(c,u),u.cancelled)return null;const m=u.options,h=function(t,e,o,n="en"){return["<!DOCTYPE html>",`<html lang="${n}">`,"<head>",'<meta charset="utf-8">',`<title>${o.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}</title>`,`<style>${t}</style>`,"</head>",`<body>${e}</body>`,"</html>"].join("\n")}(function(t,e,o){const i=[],c=function(t){const e=[];for(const o of t.adoptedStyleSheets)for(const t of o.cssRules)e.push(t.cssText);return e.join("\n")}(t);c&&i.push(c);const a=!1!==o.forceLightTheme;if(a)i.push(r(s).replace(":host {",":root {"));else{const t=function(t){const e=getComputedStyle(t),o=[];for(let n=0;n<e.length;n++){const t=e[n]??"";if(t.startsWith("--notectl-")){const n=e.getPropertyValue(t).trim();n&&o.push(` ${t}: ${n};`)}}return 0===o.length?"":`:root {\n${o.join("\n")}\n}`}(e);t&&i.push(t)}const l=a?s.primitives.foreground:void 0;i.push(function(t,e){const o=getComputedStyle(t),n=["font-family","font-size","font-weight","line-height","letter-spacing","word-spacing","color"],r=[" margin: 0;"];for(const i of n){if("color"===i&&e){r.push(` color: ${e};`);continue}const t=o.getPropertyValue(i).trim();t&&r.push(` ${i}: ${t};`)}return`body {\n${r.join("\n")}\n}`}(e,l));const p=function(t){const e=[],o=[];if(t.margin?o.push(` margin: ${t.margin};`):t.paperSize&&o.push(" margin: 0;"),t.paperSize||t.orientation){const e=[t.paperSize?n(t.paperSize):"A4"];t.orientation&&e.push(t.orientation),o.push(` size: ${e.join(" ")};`)}o.length>0&&e.push(`@page {\n${o.join("\n")}\n}`),t.paperSize&&e.push(".notectl-content { padding: 48px 56px !important; }");const r=[];return r.push("[data-notectl-no-print] { display: none !important; }"),r.push(".notectl-code-block { white-space: pre-wrap !important; word-break: break-all !important; page-break-inside: avoid; }"),r.push("img { page-break-inside: avoid; }"),r.push(".notectl-table { break-inside: avoid; }"),!1!==t.printBackground&&r.push("* { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }"),e.push(`@media print {\n ${r.join("\n ")}\n}`),e.join("\n\n")}(o);return p&&i.push(p),o.customCSS&&i.push(o.customCSS),i.join("\n\n")}(o,i,m),function(t,o){const n=function(t){return(t.querySelector(".notectl-content")??t).cloneNode(!0)}(t);return function(t){t.removeAttribute("contenteditable");for(const e of["notectl-node-selected","notectl-content--empty"]){t.classList.remove(e);for(const o of t.querySelectorAll(`.${e}`))o.classList.remove(e)}t.removeAttribute("data-placeholder")}(n),function(t,o){if(o.excludeBlockTypes)for(const e of o.excludeBlockTypes){const o=t.querySelectorAll(`[data-block-type="${e}"]`);for(const t of o)t.remove()}if(o.pageBreakBefore)for(const n of o.pageBreakBefore){const o=t.querySelectorAll(`[data-block-type="${n}"]`);for(const t of o)e(t,{breakBefore:"page",pageBreakBefore:"always"})}}(n,o),function(t,e){if(e.header){const o=document.createElement("div");o.className="notectl-print-header",o.innerHTML=b(e.header),t.insertBefore(o,t.firstChild)}if(e.footer){const o=document.createElement("div");o.className="notectl-print-footer",o.innerHTML=b(e.footer),t.appendChild(o)}}(n,o),n}(a,m).outerHTML,m.title??"",i.closest("[lang]")?.getAttribute("lang")??(document.documentElement.lang||"en")),d={html:h};return p.emit(l,d),h}return{print(e){const o=m(u(e));if(!o)return;const n=document.createElement("iframe");t(n,"position:fixed;left:-9999px;width:0;height:0;border:none"),document.body.appendChild(n);const r=n.contentDocument;if(!r)return void document.body.removeChild(n);r.open(),r.write(o),r.close();const i=()=>{n.remove()};n.contentWindow?(n.contentWindow.addEventListener("afterprint",i,{once:!0}),n.contentWindow.print()):i()},toHTML:t=>m(u(t))??""}}(p,a,i,u)}else this.service=j;o.registerService(a,this.service);const h=this.config.defaults??{},f=this.service,v=this.locale;o.registerCommand("print",()=>(o.announce(v.printingAnnouncement),f.print(h),!0));const y=this.config.keyBinding??"Mod-P";if(o.registerKeymap({[y]:()=>(o.executeCommand("print"),!0)}),!1!==this.config.showToolbarItem){const t=m(y);o.registerToolbarItem({id:"print",group:"actions",label:this.locale.label,tooltip:this.locale.tooltip(t),icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M19 8H5c-1.66 0-3 1.34-3 3v6h4v4h12v-4h4v-6c0-1.66-1.34-3-3-3zm-3 11H8v-5h8v5zm3-7c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1zm-1-9H6v4h12V3z"/></svg>',command:"print"})}}destroy(){this.service=null}};export{d as n,g as r,w as t};
|
|
2
|
-
//# sourceMappingURL=PrintPlugin-C6gOJT6d.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PrintPlugin-C6gOJT6d.mjs","names":[],"sources":["../../src/plugins/print/PrintLocale.ts","../../src/plugins/print/PrintContentPreparer.ts","../../src/plugins/print/PrintStyleCollector.ts","../../src/plugins/print/PrintServiceImpl.ts","../../src/plugins/print/PrintPlugin.ts"],"sourcesContent":["/** Locale interface and default English locale for the PrintPlugin. */\n\nimport { type LocaleModuleMap, loadLocaleModule } from '../shared/LocaleLoader.js';\n\n// --- Locale Interface ---\n\nexport interface PrintLocale {\n\treadonly label: string;\n\treadonly tooltip: (shortcut: string) => string;\n\treadonly printingAnnouncement: string;\n}\n\n// --- Default English Locale ---\n\nexport const PRINT_LOCALE_EN: PrintLocale = {\n\tlabel: 'Print',\n\ttooltip: (shortcut: string) => `Print (${shortcut})`,\n\tprintingAnnouncement: 'Printing',\n};\n\n// --- Lazy Locale Loader ---\n\nconst localeModules: LocaleModuleMap<PrintLocale> = import.meta.glob<{\n\tdefault: PrintLocale;\n}>('./locales/*.ts', { eager: false });\n\nexport async function loadPrintLocale(lang: string): Promise<PrintLocale> {\n\treturn loadLocaleModule(localeModules, lang, PRINT_LOCALE_EN);\n}\n","/**\n * Prepares editor content for print output.\n * Clones the DOM, sanitizes interactive attributes, applies block filters,\n * and inserts header/footer elements.\n */\n\nimport DOMPurify from 'dompurify';\nimport { setStyleProperties } from '../../style/StyleRuntime.js';\nimport type { PrintOptions } from './PrintTypes.js';\n\n/** Deep-clones the .notectl-content element from the editor container. */\nexport function cloneContent(container: HTMLElement): HTMLElement {\n\tconst content: HTMLElement | null = container.querySelector('.notectl-content');\n\tconst source: HTMLElement = content ?? container;\n\treturn source.cloneNode(true) as HTMLElement;\n}\n\n/** Sanitizes the cloned content for print: removes interactive attributes and selection styling. */\nexport function sanitize(clone: HTMLElement): void {\n\t// Remove contenteditable from the root\n\tclone.removeAttribute('contenteditable');\n\n\t// Remove selection-related CSS classes\n\tconst selectionClasses: readonly string[] = ['notectl-node-selected', 'notectl-content--empty'];\n\tfor (const cls of selectionClasses) {\n\t\tclone.classList.remove(cls);\n\t\tfor (const el of clone.querySelectorAll(`.${cls}`)) {\n\t\t\tel.classList.remove(cls);\n\t\t}\n\t}\n\n\t// Remove data-placeholder to avoid showing placeholder in print\n\tclone.removeAttribute('data-placeholder');\n}\n\n/** Removes excluded block types and applies page-break-before to configured block types. */\nexport function applyBlockFilters(clone: HTMLElement, options: PrintOptions): void {\n\tif (options.excludeBlockTypes) {\n\t\tfor (const type of options.excludeBlockTypes) {\n\t\t\tconst elements: NodeListOf<Element> = clone.querySelectorAll(`[data-block-type=\"${type}\"]`);\n\t\t\tfor (const el of elements) {\n\t\t\t\tel.remove();\n\t\t\t}\n\t\t}\n\t}\n\n\tif (options.pageBreakBefore) {\n\t\tfor (const type of options.pageBreakBefore) {\n\t\t\tconst elements: NodeListOf<Element> = clone.querySelectorAll(`[data-block-type=\"${type}\"]`);\n\t\t\tfor (const el of elements) {\n\t\t\t\tsetStyleProperties(el as HTMLElement, {\n\t\t\t\t\tbreakBefore: 'page',\n\t\t\t\t\tpageBreakBefore: 'always',\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n}\n\n/** Tags allowed in print header/footer content. */\nconst HEADER_FOOTER_ALLOWED_TAGS: readonly string[] = [\n\t'h1',\n\t'h2',\n\t'h3',\n\t'h4',\n\t'h5',\n\t'h6',\n\t'p',\n\t'div',\n\t'span',\n\t'br',\n\t'hr',\n\t'strong',\n\t'b',\n\t'em',\n\t'i',\n\t'u',\n\t's',\n\t'sub',\n\t'sup',\n\t'small',\n\t'ul',\n\t'ol',\n\t'li',\n\t'table',\n\t'thead',\n\t'tbody',\n\t'tr',\n\t'th',\n\t'td',\n\t'img',\n];\n\n/** Attributes allowed in print header/footer content. */\nconst HEADER_FOOTER_ALLOWED_ATTRS: readonly string[] = [\n\t'style',\n\t'class',\n\t'src',\n\t'alt',\n\t'width',\n\t'height',\n\t'colspan',\n\t'rowspan',\n];\n\n/** Resolves a header/footer value to a sanitized HTML string. */\nfunction resolveContent(value: string | (() => string)): string {\n\tconst raw: string = typeof value === 'function' ? value() : value;\n\treturn DOMPurify.sanitize(raw, {\n\t\tALLOWED_TAGS: [...HEADER_FOOTER_ALLOWED_TAGS],\n\t\tALLOWED_ATTR: [...HEADER_FOOTER_ALLOWED_ATTRS],\n\t});\n}\n\n/** Inserts header and footer elements into the cloned content. */\nexport function insertHeaderFooter(clone: HTMLElement, options: PrintOptions): void {\n\tif (options.header) {\n\t\tconst headerEl: HTMLDivElement = document.createElement('div');\n\t\theaderEl.className = 'notectl-print-header';\n\t\theaderEl.innerHTML = resolveContent(options.header);\n\t\tclone.insertBefore(headerEl, clone.firstChild);\n\t}\n\n\tif (options.footer) {\n\t\tconst footerEl: HTMLDivElement = document.createElement('div');\n\t\tfooterEl.className = 'notectl-print-footer';\n\t\tfooterEl.innerHTML = resolveContent(options.footer);\n\t\tclone.appendChild(footerEl);\n\t}\n}\n\n/** Orchestrates all content preparation steps. Returns a ready-to-print DOM element. */\nexport function prepare(container: HTMLElement, options: PrintOptions): HTMLElement {\n\tconst clone: HTMLElement = cloneContent(container);\n\tsanitize(clone);\n\tapplyBlockFilters(clone, options);\n\tinsertHeaderFooter(clone, options);\n\treturn clone;\n}\n","/**\n * Collects and aggregates CSS for print output.\n * Extracts adopted stylesheets, snapshots theme tokens, and generates print-specific CSS.\n */\n\nimport { generateThemeCSS } from '../../editor/theme/ThemeEngine.js';\nimport { LIGHT_THEME } from '../../editor/theme/ThemeTokens.js';\nimport {\n\tPAPER_MARGIN_HORIZONTAL_PX,\n\tPAPER_MARGIN_TOP_PX,\n\tgetPaperCSSSize,\n} from '../../model/PaperSize.js';\nimport type { PrintOptions } from './PrintTypes.js';\n\n/** Extracts CSS text from all adopted stylesheets on a ShadowRoot. */\nexport function extractAdoptedStyles(shadowRoot: ShadowRoot): string {\n\tconst parts: string[] = [];\n\tfor (const sheet of shadowRoot.adoptedStyleSheets) {\n\t\tfor (const rule of sheet.cssRules) {\n\t\t\tparts.push(rule.cssText);\n\t\t}\n\t}\n\treturn parts.join('\\n');\n}\n\n/**\n * Generates light theme CSS custom properties for print output.\n * Uses the static LIGHT_THEME definition rather than reading computed styles,\n * ensuring print output is always readable on paper regardless of the active editor theme.\n */\nexport function generateLightThemeTokens(): string {\n\treturn generateThemeCSS(LIGHT_THEME).replace(':host {', ':root {');\n}\n\n/** Snapshots --notectl-* CSS custom properties from the host element into a :root block. */\nexport function snapshotThemeTokens(host: HTMLElement): string {\n\tconst computed: CSSStyleDeclaration = getComputedStyle(host);\n\tconst tokens: string[] = [];\n\n\tfor (let i = 0; i < computed.length; i++) {\n\t\tconst prop: string = computed[i] ?? '';\n\t\tif (prop.startsWith('--notectl-')) {\n\t\t\tconst value: string = computed.getPropertyValue(prop).trim();\n\t\t\tif (value) {\n\t\t\t\ttokens.push(` ${prop}: ${value};`);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (tokens.length === 0) return '';\n\treturn `:root {\\n${tokens.join('\\n')}\\n}`;\n}\n\n/**\n * Snapshots computed typography from the host element into a `body` rule.\n * In the editor, typography is inherited from `:host` (shadow DOM).\n * The print iframe is a regular document where `:host` doesn't match,\n * so we must apply the same font/line-height explicitly.\n */\nexport function snapshotTypography(host: HTMLElement, colorOverride?: string): string {\n\tconst computed: CSSStyleDeclaration = getComputedStyle(host);\n\tconst props: string[] = [\n\t\t'font-family',\n\t\t'font-size',\n\t\t'font-weight',\n\t\t'line-height',\n\t\t'letter-spacing',\n\t\t'word-spacing',\n\t\t'color',\n\t];\n\tconst rules: string[] = [' margin: 0;'];\n\tfor (const prop of props) {\n\t\tif (prop === 'color' && colorOverride) {\n\t\t\trules.push(` color: ${colorOverride};`);\n\t\t\tcontinue;\n\t\t}\n\t\tconst value: string = computed.getPropertyValue(prop).trim();\n\t\tif (value) {\n\t\t\trules.push(` ${prop}: ${value};`);\n\t\t}\n\t}\n\treturn `body {\\n${rules.join('\\n')}\\n}`;\n}\n\n/** Generates print-specific CSS rules based on PrintOptions. */\nexport function generatePrintCSS(options: PrintOptions): string {\n\tconst parts: string[] = [];\n\n\t// @page rule\n\tconst pageProps: string[] = [];\n\tif (options.margin) {\n\t\tpageProps.push(` margin: ${options.margin};`);\n\t} else if (options.paperSize) {\n\t\t// WYSIWYG: zero @page margin so body = full paper width;\n\t\t// document margins are applied as content padding below.\n\t\tpageProps.push(' margin: 0;');\n\t}\n\tif (options.paperSize || options.orientation) {\n\t\tconst sizeKeyword: string = options.paperSize ? getPaperCSSSize(options.paperSize) : 'A4';\n\t\tconst sizeParts: string[] = [sizeKeyword];\n\t\tif (options.orientation) {\n\t\t\tsizeParts.push(options.orientation);\n\t\t}\n\t\tpageProps.push(` size: ${sizeParts.join(' ')};`);\n\t}\n\tif (pageProps.length > 0) {\n\t\tparts.push(`@page {\\n${pageProps.join('\\n')}\\n}`);\n\t}\n\n\t// WYSIWYG: apply paper-mode document margins to print content\n\tif (options.paperSize) {\n\t\tparts.push(\n\t\t\t`.notectl-content { padding: ${PAPER_MARGIN_TOP_PX}px ${PAPER_MARGIN_HORIZONTAL_PX}px !important; }`,\n\t\t);\n\t}\n\n\t// Print media rules\n\tconst printRules: string[] = [];\n\n\t// Hide non-printable elements\n\tprintRules.push('[data-notectl-no-print] { display: none !important; }');\n\n\t// Code blocks: preserve background, force wrapping\n\tprintRules.push(\n\t\t'.notectl-code-block { white-space: pre-wrap !important; ' +\n\t\t\t'word-break: break-all !important; page-break-inside: avoid; }',\n\t);\n\n\t// Images: avoid page breaks\n\tprintRules.push('img { page-break-inside: avoid; }');\n\n\t// Tables: avoid page breaks\n\tprintRules.push('.notectl-table { break-inside: avoid; }');\n\n\t// Preserve background colors and images in print output (WYSIWYG default).\n\t// Only omitted when the consumer explicitly opts out via printBackground: false.\n\tif (options.printBackground !== false) {\n\t\tprintRules.push(\n\t\t\t'* { -webkit-print-color-adjust: exact !important; ' +\n\t\t\t\t'print-color-adjust: exact !important; }',\n\t\t);\n\t}\n\n\tparts.push(`@media print {\\n ${printRules.join('\\n ')}\\n}`);\n\n\treturn parts.join('\\n\\n');\n}\n\n/** Collects all CSS needed for print: adopted styles, theme tokens, print CSS, and custom CSS. */\nexport function collectAll(\n\tshadowRoot: ShadowRoot,\n\thost: HTMLElement,\n\toptions: PrintOptions,\n): string {\n\tconst parts: string[] = [];\n\n\tconst adopted: string = extractAdoptedStyles(shadowRoot);\n\tif (adopted) parts.push(adopted);\n\n\tconst forceLightTheme: boolean = options.forceLightTheme !== false;\n\n\tif (forceLightTheme) {\n\t\tparts.push(generateLightThemeTokens());\n\t} else {\n\t\tconst theme: string = snapshotThemeTokens(host);\n\t\tif (theme) parts.push(theme);\n\t}\n\n\t// WYSIWYG: snapshot host typography so the print iframe matches the editor.\n\t// In the editor, .notectl-content inherits font from :host (shadow DOM).\n\t// The print iframe is a regular document where :host doesn't apply.\n\tconst colorOverride: string | undefined = forceLightTheme\n\t\t? LIGHT_THEME.primitives.foreground\n\t\t: undefined;\n\tparts.push(snapshotTypography(host, colorOverride));\n\n\tconst printCSS: string = generatePrintCSS(options);\n\tif (printCSS) parts.push(printCSS);\n\n\tif (options.customCSS) {\n\t\tparts.push(options.customCSS);\n\t}\n\n\treturn parts.join('\\n\\n');\n}\n","/**\n * PrintService implementation.\n * Handles the synchronous print flow: event emission, style collection,\n * content preparation, iframe creation, and cleanup.\n */\n\nimport { setStyleText } from '../../style/StyleRuntime.js';\nimport type { PluginEventBus } from '../Plugin.js';\nimport { prepare } from './PrintContentPreparer.js';\nimport { collectAll } from './PrintStyleCollector.js';\nimport {\n\tAFTER_PRINT,\n\ttype AfterPrintEvent,\n\tBEFORE_PRINT,\n\ttype BeforePrintEvent,\n\ttype PrintOptions,\n\ttype PrintService,\n} from './PrintTypes.js';\n\n/** Escapes HTML special characters in a plain-text string. */\nfunction escapeHTML(text: string): string {\n\treturn text.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');\n}\n\n/** Builds a complete HTML document string from CSS, body content, and title. */\nexport function buildHTMLDocument(\n\tcss: string,\n\tcontent: string,\n\ttitle: string,\n\tlang = 'en',\n): string {\n\tconst safeTitle: string = escapeHTML(title);\n\treturn [\n\t\t'<!DOCTYPE html>',\n\t\t`<html lang=\"${lang}\">`,\n\t\t'<head>',\n\t\t`<meta charset=\"utf-8\">`,\n\t\t`<title>${safeTitle}</title>`,\n\t\t`<style>${css}</style>`,\n\t\t'</head>',\n\t\t`<body>${content}</body>`,\n\t\t'</html>',\n\t].join('\\n');\n}\n\n/** Creates and returns the PrintService implementation. */\nexport function createPrintService(\n\tshadowRoot: ShadowRoot,\n\thost: HTMLElement,\n\tcontainer: HTMLElement,\n\teventBus: PluginEventBus,\n): PrintService {\n\tfunction mergeOptions(options?: PrintOptions): PrintOptions {\n\t\treturn options ?? {};\n\t}\n\n\tfunction executePrint(options: PrintOptions): string | null {\n\t\t// 1. Emit BEFORE_PRINT — listeners can mutate options or cancel\n\t\tconst beforeEvent: BeforePrintEvent = {\n\t\t\toptions,\n\t\t\tcancelled: false,\n\t\t};\n\t\teventBus.emit(BEFORE_PRINT, beforeEvent);\n\n\t\tif (beforeEvent.cancelled) return null;\n\n\t\tconst finalOptions: PrintOptions = beforeEvent.options;\n\n\t\t// 2. Collect styles\n\t\tconst css: string = collectAll(shadowRoot, host, finalOptions);\n\n\t\t// 3. Prepare content\n\t\tconst clone: HTMLElement = prepare(container, finalOptions);\n\t\tconst contentHTML: string = clone.outerHTML;\n\n\t\t// 4. Build HTML document\n\t\tconst title: string = finalOptions.title ?? '';\n\t\tconst lang: string =\n\t\t\thost.closest('[lang]')?.getAttribute('lang') ?? (document.documentElement.lang || 'en');\n\t\tconst html: string = buildHTMLDocument(css, contentHTML, title, lang);\n\n\t\t// 5. Emit AFTER_PRINT\n\t\tconst afterEvent: AfterPrintEvent = { html };\n\t\teventBus.emit(AFTER_PRINT, afterEvent);\n\n\t\treturn html;\n\t}\n\n\treturn {\n\t\tprint(options?: PrintOptions): void {\n\t\t\tconst resolved: PrintOptions = mergeOptions(options);\n\t\t\tconst html: string | null = executePrint(resolved);\n\t\t\tif (!html) return;\n\n\t\t\t// Create hidden iframe\n\t\t\tconst iframe: HTMLIFrameElement = document.createElement('iframe');\n\t\t\tsetStyleText(iframe, 'position:fixed;left:-9999px;width:0;height:0;border:none');\n\t\t\tdocument.body.appendChild(iframe);\n\n\t\t\tconst iframeDoc: Document | null = iframe.contentDocument;\n\t\t\tif (!iframeDoc) {\n\t\t\t\tdocument.body.removeChild(iframe);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tiframeDoc.open();\n\t\t\tiframeDoc.write(html);\n\t\t\tiframeDoc.close();\n\n\t\t\tconst cleanup = (): void => {\n\t\t\t\tiframe.remove();\n\t\t\t};\n\n\t\t\t// Defer cleanup until print dialog closes\n\t\t\tif (iframe.contentWindow) {\n\t\t\t\tiframe.contentWindow.addEventListener('afterprint', cleanup, { once: true });\n\t\t\t\tiframe.contentWindow.print();\n\t\t\t} else {\n\t\t\t\tcleanup();\n\t\t\t}\n\t\t},\n\n\t\ttoHTML(options?: PrintOptions): string {\n\t\t\tconst resolved: PrintOptions = mergeOptions(options);\n\t\t\treturn executePrint(resolved) ?? '';\n\t\t},\n\t};\n}\n","/**\n * PrintPlugin: provides print functionality for the notectl editor.\n * Registers a command, keymap, toolbar item, and exposes a PrintService.\n * Orchestrator only — delegates all logic to PrintServiceImpl, PrintStyleCollector,\n * and PrintContentPreparer.\n */\n\nimport type { Plugin, PluginContext } from '../Plugin.js';\nimport { resolveLocale } from '../shared/PluginHelpers.js';\nimport { formatShortcut } from '../shared/ShortcutFormatting.js';\nimport { PRINT_LOCALE_EN, type PrintLocale, loadPrintLocale } from './PrintLocale.js';\nimport { createPrintService } from './PrintServiceImpl.js';\nimport type { PrintOptions, PrintPluginConfig, PrintService } from './PrintTypes.js';\nimport { PRINT_SERVICE_KEY } from './PrintTypes.js';\n\nconst PRINT_ICON: string =\n\t'<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\">' +\n\t'<path d=\"M19 8H5c-1.66 0-3 1.34-3 3v6h4v4h12v-4h4v-6c0-1.66-1.34-3-3-3zm-3' +\n\t' 11H8v-5h8v5zm3-7c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1zm-1-9H6v4h12V3z\"/>' +\n\t'</svg>';\n\n/** No-op fallback service for environments without ShadowRoot. */\nconst NOOP_SERVICE: PrintService = {\n\tprint(): void {},\n\ttoHTML(): string {\n\t\treturn '';\n\t},\n};\n\nexport class PrintPlugin implements Plugin {\n\treadonly id = 'print';\n\treadonly name = 'Print';\n\n\tprivate readonly config: PrintPluginConfig;\n\tprivate service: PrintService | null = null;\n\tprivate locale!: PrintLocale;\n\n\tconstructor(config?: PrintPluginConfig) {\n\t\tthis.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\tPRINT_LOCALE_EN,\n\t\t\tloadPrintLocale,\n\t\t);\n\t\tconst container: HTMLElement = context.getContainer();\n\t\tconst rootNode: Node = container.getRootNode();\n\n\t\tif (rootNode instanceof ShadowRoot) {\n\t\t\tconst host: HTMLElement = rootNode.host as HTMLElement;\n\t\t\tconst eventBus = context.getEventBus();\n\t\t\tthis.service = createPrintService(rootNode, host, container, eventBus);\n\t\t} else {\n\t\t\tthis.service = NOOP_SERVICE;\n\t\t}\n\n\t\tcontext.registerService(PRINT_SERVICE_KEY, this.service);\n\n\t\tconst defaults: PrintOptions = this.config.defaults ?? {};\n\t\tconst service: PrintService = this.service;\n\n\t\tconst printLocale = this.locale;\n\t\tcontext.registerCommand('print', () => {\n\t\t\tcontext.announce(printLocale.printingAnnouncement);\n\t\t\tservice.print(defaults);\n\t\t\treturn true;\n\t\t});\n\n\t\tconst keyBinding: string = this.config.keyBinding ?? 'Mod-P';\n\t\tcontext.registerKeymap({\n\t\t\t[keyBinding]: () => {\n\t\t\t\tcontext.executeCommand('print');\n\t\t\t\treturn true;\n\t\t\t},\n\t\t});\n\n\t\tif (this.config.showToolbarItem !== false) {\n\t\t\tconst shortcut: string = formatShortcut(keyBinding);\n\t\t\tcontext.registerToolbarItem({\n\t\t\t\tid: 'print',\n\t\t\t\tgroup: 'actions',\n\t\t\t\tlabel: this.locale.label,\n\t\t\t\ttooltip: this.locale.tooltip(shortcut),\n\t\t\t\ticon: PRINT_ICON,\n\t\t\t\tcommand: 'print',\n\t\t\t});\n\t\t}\n\t}\n\n\tdestroy(): void {\n\t\tthis.service = null;\n\t}\n}\n"],"mappings":"wR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AAO,cAAc,iBAAiB,aAAc,EAAS,CAAE,MAAM,IACrE,EAAO,cAAc,SAErB,GAEF,EAEA,OAAO,GAEC,EADwB,EAAa,KACX,GAGpC,CCzEkB,CAAmB,EAAU,EAAM,EAAW,EAC9D,MACC,KAAK,QAAU,EAGhB,EAAQ,gBAAgB,EAAmB,KAAK,SAEhD,MAAM,EAAyB,KAAK,OAAO,UAAY,CAAC,EAClD,EAAwB,KAAK,QAE7B,EAAc,KAAK,OACzB,EAAQ,gBAAgB,QAAA,KACvB,EAAQ,SAAS,EAAY,sBAC7B,EAAQ,MAAM,IACP,IAGR,MAAM,EAAqB,KAAK,OAAO,YAAc,QAQrD,GAPA,EAAQ,eAAe,CAAA,CACrB,GAAA,KACA,EAAQ,eAAe,UAChB,MAI2B,IAAhC,KAAK,OAAO,gBAA2B,CAC1C,MAAM,EAAmB,EAAe,GACxC,EAAQ,oBAAoB,CAC3B,GAAI,QACJ,MAAO,UACP,MAAO,KAAK,OAAO,MACnB,QAAS,KAAK,OAAO,QAAQ,GAC7B,KAtEH,sPAuEG,QAAS,SAEX,CACD,CAEA,OAAA,GACC,KAAK,QAAU,IAChB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PrintTypes-WdtgSj74.mjs","names":[],"sources":["../../src/editor/theme/ThemeTokens.ts","../../src/editor/theme/ThemeEngine.ts","../../src/model/PaperSize.ts","../../src/plugins/print/PrintTypes.ts"],"sourcesContent":["/**\n * Theme token types, built-in themes, and theme creation helpers.\n */\n\nimport type { SyntaxTokenType, TokenStyleValue } from './SyntaxTokenTypes.js';\nimport { resolveTokenColor } from './SyntaxTokenTypes.js';\n\n/** Primitive color palette a theme defines. */\nexport interface ThemePrimitives {\n\treadonly background: string;\n\treadonly foreground: string;\n\treadonly mutedForeground: string;\n\treadonly border: string;\n\treadonly borderFocus: string;\n\treadonly primary: string;\n\treadonly primaryForeground: string;\n\treadonly primaryMuted: string;\n\treadonly surfaceRaised: string;\n\treadonly surfaceOverlay: string;\n\treadonly hoverBackground: string;\n\treadonly activeBackground: string;\n\treadonly danger: string;\n\treadonly dangerMuted: string;\n\treadonly success: string;\n\treadonly shadow: string;\n\treadonly focusRing: string;\n}\n\n/** Component-level toolbar overrides. */\nexport interface ThemeToolbar {\n\treadonly background: string;\n\treadonly borderColor: string;\n}\n\n/** Syntax highlighting token styles — one entry per canonical token type. */\nexport type ThemeSyntax = { readonly [K in SyntaxTokenType]: TokenStyleValue };\n\n/** Component-level code block overrides. */\nexport interface ThemeCodeBlock {\n\treadonly background: string;\n\treadonly foreground: string;\n\treadonly headerBackground: string;\n\treadonly headerForeground: string;\n\treadonly headerBorder: string;\n\treadonly syntax?: ThemeSyntax;\n}\n\n/** Component-level inline code overrides. */\nexport interface ThemeInlineCode {\n\treadonly background: string;\n\treadonly foreground: string;\n}\n\n/** Component-level tooltip overrides. */\nexport interface ThemeTooltip {\n\treadonly background: string;\n\treadonly foreground: string;\n}\n\n/** Full theme definition. */\nexport interface Theme {\n\treadonly name: string;\n\treadonly primitives: ThemePrimitives;\n\treadonly toolbar?: Partial<ThemeToolbar>;\n\treadonly inlineCode?: Partial<ThemeInlineCode>;\n\treadonly codeBlock?: Partial<ThemeCodeBlock>;\n\treadonly tooltip?: Partial<ThemeTooltip>;\n}\n\n/** Partial custom theme — deeply partial for creating overrides. */\nexport interface PartialTheme {\n\treadonly name: string;\n\treadonly primitives?: Partial<ThemePrimitives>;\n\treadonly toolbar?: Partial<ThemeToolbar>;\n\treadonly inlineCode?: Partial<ThemeInlineCode>;\n\treadonly codeBlock?: Partial<Omit<ThemeCodeBlock, 'syntax'>> & {\n\t\treadonly syntax?: Partial<ThemeSyntax>;\n\t};\n\treadonly tooltip?: Partial<ThemeTooltip>;\n}\n\n/** Built-in theme presets. */\nexport const ThemePreset = {\n\tLight: 'light',\n\tDark: 'dark',\n\tSystem: 'system',\n} as const;\nexport type ThemePreset = (typeof ThemePreset)[keyof typeof ThemePreset];\n\n/** Built-in light theme. */\nexport const LIGHT_THEME: Theme = {\n\tname: 'light',\n\tprimitives: {\n\t\tbackground: '#ffffff',\n\t\tforeground: '#1a1a1a',\n\t\tmutedForeground: '#666666',\n\t\tborder: '#d0d0d0',\n\t\tborderFocus: '#4a90d9',\n\t\tprimary: '#4a90d9',\n\t\tprimaryForeground: '#1a5fa0',\n\t\tprimaryMuted: '#d0e0f0',\n\t\tsurfaceRaised: '#f8f8f8',\n\t\tsurfaceOverlay: '#ffffff',\n\t\thoverBackground: '#e8e8e8',\n\t\tactiveBackground: '#d0e0f0',\n\t\tdanger: '#dc2626',\n\t\tdangerMuted: '#fee2e2',\n\t\tsuccess: '#1a8c1a',\n\t\tshadow: 'rgba(0, 0, 0, 0.15)',\n\t\tfocusRing: 'rgba(74, 144, 217, 0.2)',\n\t},\n\tinlineCode: {\n\t\tbackground: '#edf0f5',\n\t\tforeground: '#334155',\n\t},\n\tcodeBlock: {\n\t\tbackground: '#f8fafc',\n\t\tforeground: '#334155',\n\t\theaderBackground: '#f1f5f9',\n\t\theaderForeground: '#64748b',\n\t\theaderBorder: '#e2e8f0',\n\t\tsyntax: {\n\t\t\tkeyword: '#d73a49',\n\t\t\tstring: '#032f62',\n\t\t\tcomment: { color: '#6a737d', fontStyle: 'italic' },\n\t\t\tnumber: '#005cc5',\n\t\t\tfunction: '#6f42c1',\n\t\t\toperator: '#d73a49',\n\t\t\tpunctuation: '#24292e',\n\t\t\tboolean: '#005cc5',\n\t\t\tnull: '#005cc5',\n\t\t\tproperty: '#005cc5',\n\t\t\ttype: '#e36209',\n\t\t\tannotation: '#6f42c1',\n\t\t\ttag: '#22863a',\n\t\t\tattribute: '#6f42c1',\n\t\t\tconstant: '#005cc5',\n\t\t\tregex: '#032f62',\n\t\t},\n\t},\n\ttooltip: {\n\t\tbackground: '#1a1a1a',\n\t\tforeground: '#ffffff',\n\t},\n};\n\n/** Built-in dark theme. */\nexport const DARK_THEME: Theme = {\n\tname: 'dark',\n\tprimitives: {\n\t\tbackground: '#1e1e2e',\n\t\tforeground: '#cdd6f4',\n\t\tmutedForeground: '#7f849c',\n\t\tborder: '#45475a',\n\t\tborderFocus: '#89b4fa',\n\t\tprimary: '#89b4fa',\n\t\tprimaryForeground: '#89b4fa',\n\t\tprimaryMuted: 'rgba(137, 180, 250, 0.15)',\n\t\tsurfaceRaised: '#313244',\n\t\tsurfaceOverlay: '#313244',\n\t\thoverBackground: '#45475a',\n\t\tactiveBackground: 'rgba(137, 180, 250, 0.15)',\n\t\tdanger: '#f38ba8',\n\t\tdangerMuted: 'rgba(243, 139, 168, 0.15)',\n\t\tsuccess: '#a6e3a1',\n\t\tshadow: 'rgba(0, 0, 0, 0.4)',\n\t\tfocusRing: 'rgba(137, 180, 250, 0.25)',\n\t},\n\tinlineCode: {\n\t\tbackground: '#313244',\n\t\tforeground: '#cdd6f4',\n\t},\n\tcodeBlock: {\n\t\tbackground: '#313244',\n\t\tforeground: '#cdd6f4',\n\t\theaderBackground: '#45475a',\n\t\theaderForeground: '#bac2de',\n\t\theaderBorder: '#585b70',\n\t\tsyntax: {\n\t\t\tkeyword: '#cba6f7',\n\t\t\tstring: '#a6e3a1',\n\t\t\tcomment: { color: '#9399b2', fontStyle: 'italic' },\n\t\t\tnumber: '#fab387',\n\t\t\tfunction: '#89b4fa',\n\t\t\toperator: '#89dceb',\n\t\t\tpunctuation: '#bac2de',\n\t\t\tboolean: '#fab387',\n\t\t\tnull: '#f38ba8',\n\t\t\tproperty: '#89b4fa',\n\t\t\ttype: '#fab387',\n\t\t\tannotation: '#cba6f7',\n\t\t\ttag: '#a6e3a1',\n\t\t\tattribute: '#89b4fa',\n\t\t\tconstant: '#f9e2af',\n\t\t\tregex: '#a6e3a1',\n\t\t},\n\t},\n\ttooltip: {\n\t\tbackground: '#585b70',\n\t\tforeground: '#cdd6f4',\n\t},\n};\n\n/** Creates a custom theme by extending a base theme with partial overrides. */\nexport function createTheme(base: Theme, overrides: PartialTheme): Theme {\n\tconst mergeSyntax = (): ThemeSyntax | undefined => {\n\t\tif (!overrides.codeBlock?.syntax) return base.codeBlock?.syntax;\n\t\tif (!base.codeBlock?.syntax) return undefined;\n\t\treturn { ...base.codeBlock.syntax, ...overrides.codeBlock.syntax } as ThemeSyntax;\n\t};\n\n\treturn {\n\t\tname: overrides.name,\n\t\tprimitives: { ...base.primitives, ...overrides.primitives },\n\t\ttoolbar: overrides.toolbar ? { ...base.toolbar, ...overrides.toolbar } : base.toolbar,\n\t\tinlineCode: overrides.inlineCode\n\t\t\t? { ...base.inlineCode, ...overrides.inlineCode }\n\t\t\t: base.inlineCode,\n\t\tcodeBlock: overrides.codeBlock\n\t\t\t? {\n\t\t\t\t\t...base.codeBlock,\n\t\t\t\t\t...overrides.codeBlock,\n\t\t\t\t\tsyntax: mergeSyntax(),\n\t\t\t\t}\n\t\t\t: base.codeBlock,\n\t\ttooltip: overrides.tooltip ? { ...base.tooltip, ...overrides.tooltip } : base.tooltip,\n\t};\n}\n\n// Re-export for convenience — avoids extra imports in consumer code.\nexport { resolveTokenColor };\n\n/** Resolves a ThemePreset string or Theme object to a full Theme. */\nexport function resolveTheme(theme: ThemePreset | Theme): Theme {\n\tif (typeof theme === 'object') return theme;\n\tswitch (theme) {\n\t\tcase ThemePreset.Light:\n\t\t\treturn LIGHT_THEME;\n\t\tcase ThemePreset.Dark:\n\t\t\treturn DARK_THEME;\n\t\tcase ThemePreset.System:\n\t\t\t// System is resolved externally via matchMedia; default to light.\n\t\t\treturn LIGHT_THEME;\n\t\tdefault:\n\t\t\treturn LIGHT_THEME;\n\t}\n}\n","/**\n * Theme engine — converts a Theme object into CSS custom properties.\n */\n\nimport {\n\tSYNTAX_TOKEN_TYPES,\n\tresolveTokenColor,\n\tresolveTokenFontStyle,\n\tresolveTokenFontWeight,\n} from './SyntaxTokenTypes.js';\nimport type { TokenStyleValue } from './SyntaxTokenTypes.js';\nimport type { Theme, ThemeSyntax } from './ThemeTokens.js';\n\n// --- Static entries (non-syntax) ---\n\nconst STATIC_ENTRIES: ReadonlyArray<readonly [string, string]> = [\n\t// Primitives\n\t['primitives.background', '--notectl-bg'],\n\t['primitives.foreground', '--notectl-fg'],\n\t['primitives.mutedForeground', '--notectl-fg-muted'],\n\t['primitives.border', '--notectl-border'],\n\t['primitives.borderFocus', '--notectl-border-focus'],\n\t['primitives.primary', '--notectl-primary'],\n\t['primitives.primaryForeground', '--notectl-primary-fg'],\n\t['primitives.primaryMuted', '--notectl-primary-muted'],\n\t['primitives.surfaceRaised', '--notectl-surface-raised'],\n\t['primitives.surfaceOverlay', '--notectl-surface-overlay'],\n\t['primitives.hoverBackground', '--notectl-hover-bg'],\n\t['primitives.activeBackground', '--notectl-active-bg'],\n\t['primitives.danger', '--notectl-danger'],\n\t['primitives.dangerMuted', '--notectl-danger-muted'],\n\t['primitives.success', '--notectl-success'],\n\t['primitives.shadow', '--notectl-shadow'],\n\t['primitives.focusRing', '--notectl-focus-ring'],\n\t// Component: toolbar\n\t['toolbar.background', '--notectl-toolbar-bg'],\n\t['toolbar.borderColor', '--notectl-toolbar-border'],\n\t// Component: inlineCode\n\t['inlineCode.background', '--notectl-code-bg'],\n\t['inlineCode.foreground', '--notectl-code-color'],\n\t// Component: codeBlock (non-syntax)\n\t['codeBlock.background', '--notectl-code-block-bg'],\n\t['codeBlock.foreground', '--notectl-code-block-color'],\n\t['codeBlock.headerBackground', '--notectl-code-block-header-bg'],\n\t['codeBlock.headerForeground', '--notectl-code-block-header-color'],\n\t['codeBlock.headerBorder', '--notectl-code-block-header-border'],\n\t// Component: tooltip\n\t['tooltip.background', '--notectl-tooltip-bg'],\n\t['tooltip.foreground', '--notectl-tooltip-fg'],\n];\n\n// --- Generated syntax variable map (derived from SYNTAX_TOKEN_TYPES) ---\n\nconst SYNTAX_VARIABLE_MAP: ReadonlyArray<readonly [string, string]> = SYNTAX_TOKEN_TYPES.map(\n\t(type) => [`codeBlock.syntax.${type}`, `--notectl-code-token-${type}`] as const,\n);\n\n/** Full variable map: static entries + syntax entries. */\nconst VARIABLE_MAP: ReadonlyArray<readonly [string, string]> = [\n\t...STATIC_ENTRIES,\n\t...SYNTAX_VARIABLE_MAP,\n];\n\n// --- Static fallbacks (non-syntax) ---\n\nconst STATIC_FALLBACKS: ReadonlyArray<readonly [string, string]> = [\n\t['--notectl-toolbar-bg', 'var(--notectl-surface-raised)'],\n\t['--notectl-toolbar-border', 'var(--notectl-border)'],\n\t['--notectl-code-bg', 'var(--notectl-surface-raised)'],\n\t['--notectl-code-color', 'var(--notectl-fg)'],\n\t['--notectl-code-block-bg', 'var(--notectl-surface-raised)'],\n\t['--notectl-code-block-color', 'var(--notectl-fg)'],\n\t['--notectl-code-block-header-bg', 'var(--notectl-surface-raised)'],\n\t['--notectl-code-block-header-color', 'var(--notectl-fg-muted)'],\n\t['--notectl-code-block-header-border', 'var(--notectl-border)'],\n\t['--notectl-tooltip-bg', 'var(--notectl-fg)'],\n\t['--notectl-tooltip-fg', 'var(--notectl-bg)'],\n];\n\n// --- Generated syntax fallbacks (derived from SYNTAX_TOKEN_TYPES) ---\n\nconst SYNTAX_FALLBACKS: ReadonlyArray<readonly [string, string]> = SYNTAX_TOKEN_TYPES.map(\n\t(type) => [`--notectl-code-token-${type}`, 'var(--notectl-code-block-color)'] as const,\n);\n\n/** Fallbacks for component tokens when not explicitly set. */\nconst COMPONENT_FALLBACKS: ReadonlyMap<string, string> = new Map([\n\t...STATIC_FALLBACKS,\n\t...SYNTAX_FALLBACKS,\n]);\n\n/** Resolves a dotted path like 'primitives.background' from a Theme. */\nfunction resolvePath(theme: Theme, path: string): string | undefined {\n\tconst parts: string[] = path.split('.');\n\tlet current: unknown = theme;\n\tfor (const part of parts) {\n\t\tif (current === undefined || current === null) return undefined;\n\t\tif (typeof current !== 'object') return undefined;\n\t\tcurrent = (current as Record<string, unknown>)[part];\n\t}\n\tif (typeof current === 'string') return current;\n\tif (typeof current === 'object' && current !== null && 'color' in current) {\n\t\treturn resolveTokenColor(current as TokenStyleValue);\n\t}\n\treturn undefined;\n}\n\n/** Emits font-style/font-weight CSS vars for syntax tokens that use TokenStyle objects. */\nfunction emitTokenStyleVars(syntax: ThemeSyntax, lines: string[]): void {\n\tfor (const type of SYNTAX_TOKEN_TYPES) {\n\t\tconst value: TokenStyleValue = syntax[type];\n\t\tif (typeof value !== 'object') continue;\n\n\t\tconst fontStyle: string | undefined = resolveTokenFontStyle(value);\n\t\tif (fontStyle) {\n\t\t\tlines.push(`\\t--notectl-code-token-${type}-font-style: ${fontStyle};`);\n\t\t}\n\t\tconst fontWeight: string | undefined = resolveTokenFontWeight(value);\n\t\tif (fontWeight) {\n\t\t\tlines.push(`\\t--notectl-code-token-${type}-font-weight: ${fontWeight};`);\n\t\t}\n\t}\n}\n\n/** Generates CSS text with all theme custom properties on :host. */\nexport function generateThemeCSS(theme: Theme): string {\n\tconst lines: string[] = [':host {'];\n\n\tfor (const [path, cssVar] of VARIABLE_MAP) {\n\t\tconst value: string | undefined = resolvePath(theme, path);\n\t\tif (value !== undefined) {\n\t\t\tlines.push(`\\t${cssVar}: ${value};`);\n\t\t} else {\n\t\t\tconst fallback: string | undefined = COMPONENT_FALLBACKS.get(cssVar);\n\t\t\tif (fallback) {\n\t\t\t\tlines.push(`\\t${cssVar}: ${fallback};`);\n\t\t\t}\n\t\t}\n\t}\n\n\t// Emit font-style / font-weight vars for TokenStyle entries\n\tif (theme.codeBlock?.syntax) {\n\t\temitTokenStyleVars(theme.codeBlock.syntax, lines);\n\t}\n\n\tlines.push('}');\n\treturn lines.join('\\n');\n}\n\n/** Creates a CSSStyleSheet populated with theme CSS variables. */\nexport function createThemeStyleSheet(theme: Theme): CSSStyleSheet {\n\tconst sheet: CSSStyleSheet = new CSSStyleSheet();\n\tsheet.replaceSync(generateThemeCSS(theme));\n\treturn sheet;\n}\n","/**\n * Paper size definitions and dimension helpers.\n * Used by PaperLayoutController for WYSIWYG page layout\n * and by PrintStyleCollector for @page CSS rules.\n */\n\n/** Conversion factor: 1mm = 96/25.4 px at CSS reference pixel (96 DPI). */\nconst MM_TO_PX: number = 96 / 25.4;\n\n/** Physical dimensions of a paper size. */\nexport interface PaperDimensions {\n\treadonly widthMm: number;\n\treadonly heightMm: number;\n\treadonly widthPx: number;\n\treadonly heightPx: number;\n}\n\n/** Available paper size presets. */\nexport const PaperSize = {\n\tDINA4: 'din-a4',\n\tDINA5: 'din-a5',\n\tUSLetter: 'us-letter',\n\tUSLegal: 'us-legal',\n} as const;\nexport type PaperSize = (typeof PaperSize)[keyof typeof PaperSize];\n\n/** Rounds to nearest integer for pixel dimensions. */\nfunction mmToPx(mm: number): number {\n\treturn Math.round(mm * MM_TO_PX);\n}\n\n/** Lookup table for paper dimensions. */\nconst PAPER_DIMENSIONS: ReadonlyMap<PaperSize, PaperDimensions> = new Map<\n\tPaperSize,\n\tPaperDimensions\n>([\n\t[PaperSize.DINA4, { widthMm: 210, heightMm: 297, widthPx: mmToPx(210), heightPx: mmToPx(297) }],\n\t[PaperSize.DINA5, { widthMm: 148, heightMm: 210, widthPx: mmToPx(148), heightPx: mmToPx(210) }],\n\t[\n\t\tPaperSize.USLetter,\n\t\t{ widthMm: 215.9, heightMm: 279.4, widthPx: mmToPx(215.9), heightPx: mmToPx(279.4) },\n\t],\n\t[\n\t\tPaperSize.USLegal,\n\t\t{ widthMm: 215.9, heightMm: 355.6, widthPx: mmToPx(215.9), heightPx: mmToPx(355.6) },\n\t],\n]);\n\n/** CSS @page size keywords for each paper size. */\nconst CSS_SIZE_KEYWORDS: ReadonlyMap<PaperSize, string> = new Map<PaperSize, string>([\n\t[PaperSize.DINA4, 'A4'],\n\t[PaperSize.DINA5, 'A5'],\n\t[PaperSize.USLetter, 'letter'],\n\t[PaperSize.USLegal, 'legal'],\n]);\n\n/** Returns the physical and pixel dimensions for a paper size. */\nexport function getPaperDimensions(size: PaperSize): PaperDimensions {\n\tconst dims: PaperDimensions | undefined = PAPER_DIMENSIONS.get(size);\n\tif (!dims) {\n\t\tthrow new Error(`Unknown paper size: ${size}`);\n\t}\n\treturn dims;\n}\n\n/**\n * Document margin constants for paper mode (in px).\n * These define the content padding inside the paper surface in the editor,\n * and become @page margins in print output to ensure WYSIWYG fidelity.\n */\nexport const PAPER_MARGIN_TOP_PX: number = 48;\nexport const PAPER_MARGIN_HORIZONTAL_PX: number = 56;\nexport const PAPER_VIEWPORT_PADDING_PX: number = 24;\n\n/** Type guard: returns true if the value is a valid PaperSize string. */\nexport function isValidPaperSize(value: string): value is PaperSize {\n\treturn (Object.values(PaperSize) as string[]).includes(value);\n}\n\n/** Returns the CSS @page size keyword (e.g. 'A4', 'letter') for a paper size. */\nexport function getPaperCSSSize(size: PaperSize): string {\n\tconst keyword: string | undefined = CSS_SIZE_KEYWORDS.get(size);\n\tif (!keyword) {\n\t\tthrow new Error(`Unknown paper size: ${size}`);\n\t}\n\treturn keyword;\n}\n","/**\n * Type definitions, service keys, and event keys for the PrintPlugin.\n */\n\nimport type { PaperSize } from '../../model/PaperSize.js';\nimport type { NodeTypeName } from '../../model/TypeBrands.js';\nimport { EventKey, ServiceKey } from '../Plugin.js';\n\n// --- Print Options ---\n\nexport interface PrintOptions {\n\t/** Page title shown in the browser print header. */\n\treadonly title?: string;\n\n\t/** Additional CSS appended to the print stylesheet. */\n\treadonly customCSS?: string;\n\n\t/**\n\t * Header HTML inserted once at the top of the print document.\n\t * For repeating per-page headers, use toHTML() with server-side PDF generation.\n\t */\n\treadonly header?: string | (() => string);\n\n\t/**\n\t * Footer HTML inserted once at the bottom of the print document.\n\t * For repeating per-page footers, use toHTML() with server-side PDF generation.\n\t */\n\treadonly footer?: string | (() => string);\n\n\t/** Page margins as CSS value (e.g. '2cm'). */\n\treadonly margin?: string;\n\n\t/** Force page break before these block types. */\n\treadonly pageBreakBefore?: readonly NodeTypeName[];\n\n\t/** Exclude these block types from print output. */\n\treadonly excludeBlockTypes?: readonly NodeTypeName[];\n\n\t/**\n\t * Whether to preserve background colors and images in print output.\n\t * Defaults to `true` (WYSIWYG). Set to `false` to let the browser strip\n\t * backgrounds (e.g. to save ink).\n\t */\n\treadonly printBackground?: boolean;\n\n\t/**\n\t * Force light theme tokens in print output for readability on paper.\n\t * Defaults to `true`. Set to `false` to print with the current editor theme.\n\t */\n\treadonly forceLightTheme?: boolean;\n\n\t/** Page orientation. */\n\treadonly orientation?: 'portrait' | 'landscape';\n\n\t/** Paper size for @page CSS rule. When set, overrides the default A4 page size. */\n\treadonly paperSize?: PaperSize;\n}\n\n// --- Plugin Configuration ---\n\nexport interface PrintPluginConfig {\n\t/** Default options applied to every print() call. */\n\treadonly defaults?: PrintOptions;\n\n\t/** Keyboard shortcut (default: 'Mod-P'). */\n\treadonly keyBinding?: string;\n\n\t/** Show toolbar button (default: true). */\n\treadonly showToolbarItem?: boolean;\n\n\t/** Locale override for user-facing strings. */\n\treadonly locale?: import('./PrintLocale.js').PrintLocale;\n}\n\n// --- Service Interface ---\n\nexport interface PrintService {\n\t/** Prints the editor content with optional configuration. */\n\tprint(options?: PrintOptions): void;\n\n\t/** Generates print-ready HTML as a complete document string. */\n\ttoHTML(options?: PrintOptions): string;\n}\n\n// --- Service & Event Keys ---\n\nexport const PRINT_SERVICE_KEY: ServiceKey<PrintService> = new ServiceKey<PrintService>('print');\n\nexport const BEFORE_PRINT: EventKey<BeforePrintEvent> = new EventKey<BeforePrintEvent>(\n\t'print:before',\n);\n\nexport const AFTER_PRINT: EventKey<AfterPrintEvent> = new EventKey<AfterPrintEvent>('print:after');\n\n// --- Event Payloads ---\n\nexport interface BeforePrintEvent {\n\t/** Options can be mutated — EventBus passes by reference. */\n\toptions: PrintOptions;\n\t/** Set to true to cancel the print. */\n\tcancelled: boolean;\n}\n\nexport interface AfterPrintEvent {\n\t/** The generated HTML (read-only). */\n\treadonly html: string;\n}\n"],"mappings":"6HAkFA,IAAa,EAAc,CAC1B,MAAO,QACP,KAAM,OACN,OAAQ,UAKI,EAAqB,CACjC,KAAM,QACN,WAAY,CACX,WAAY,UACZ,WAAY,UACZ,gBAAiB,UACjB,OAAQ,UACR,YAAa,UACb,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