@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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToolbarPlugin-CLz2wa2c.mjs","names":[],"sources":["../../src/plugins/toolbar/ToolbarRegistry.ts","../../src/editor/styles/toolbar.ts","../../src/plugins/toolbar/ToolbarKeyboardNav.ts","../../src/plugins/toolbar/ToolbarLocale.ts","../../src/plugins/toolbar/ToolbarOverflowBehavior.ts","../../src/plugins/toolbar/ToolbarOverflowController.ts","../../src/plugins/toolbar/ToolbarRenderers.ts","../../src/plugins/toolbar/ToolbarPopupController.ts","../../src/plugins/toolbar/ToolbarTooltip.ts","../../src/plugins/toolbar/ToolbarPlugin.ts"],"sourcesContent":["/**\n * ToolbarRegistry: manages plugin-registered toolbar items\n * with per-plugin tracking for clean teardown.\n */\n\nimport type { ToolbarItem } from './ToolbarItem.js';\n\nexport class ToolbarRegistry {\n\tprivate readonly _toolbarItems = new Map<string, ToolbarItem>();\n\tprivate readonly _toolbarItemPluginMap = new Map<string, string[]>();\n\n\tregisterToolbarItem(item: ToolbarItem, pluginId?: string): void {\n\t\tif (this._toolbarItems.has(item.id)) {\n\t\t\tthrow new Error(`ToolbarItem with id \"${item.id}\" is already registered.`);\n\t\t}\n\t\tthis._toolbarItems.set(item.id, item);\n\t\tif (pluginId) {\n\t\t\tconst ids = this._toolbarItemPluginMap.get(pluginId) ?? [];\n\t\t\tids.push(item.id);\n\t\t\tthis._toolbarItemPluginMap.set(pluginId, ids);\n\t\t}\n\t}\n\n\tgetToolbarItemsByPlugin(pluginId: string): ToolbarItem[] {\n\t\tconst ids = this._toolbarItemPluginMap.get(pluginId) ?? [];\n\t\tconst items: ToolbarItem[] = [];\n\t\tfor (const id of ids) {\n\t\t\tconst item = this._toolbarItems.get(id);\n\t\t\tif (item) items.push(item);\n\t\t}\n\t\treturn items;\n\t}\n\n\tgetToolbarItem(id: string): ToolbarItem | undefined {\n\t\treturn this._toolbarItems.get(id);\n\t}\n\n\tgetToolbarItems(): ToolbarItem[] {\n\t\treturn [...this._toolbarItems.values()];\n\t}\n\n\tremoveToolbarItem(id: string): void {\n\t\tthis._toolbarItems.delete(id);\n\t\tfor (const [pluginId, ids] of this._toolbarItemPluginMap) {\n\t\t\tconst idx = ids.indexOf(id);\n\t\t\tif (idx !== -1) {\n\t\t\t\tids.splice(idx, 1);\n\t\t\t\tif (ids.length === 0) this._toolbarItemPluginMap.delete(pluginId);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tclear(): void {\n\t\tthis._toolbarItems.clear();\n\t\tthis._toolbarItemPluginMap.clear();\n\t}\n}\n","/** Toolbar styles — buttons, separators, tooltips, popups, dropdowns. */\nexport const TOOLBAR_CSS = `\n/* Toolbar */\n.notectl-plugin-container--top {\n\tdisplay: flex;\n\talign-items: center;\n\tflex-wrap: nowrap;\n\tborder-bottom: 1px solid var(--notectl-border);\n\tbackground: var(--notectl-toolbar-bg, var(--notectl-surface-raised));\n\tmin-height: 40px;\n\tflex-shrink: 0;\n}\n\n.notectl-toolbar {\n\tdisplay: flex;\n\talign-items: center;\n\tflex-wrap: nowrap;\n\toverflow: hidden;\n\tflex: 1;\n\tmin-width: 0;\n\tgap: 2px;\n\tpadding: 4px 8px;\n}\n\n.notectl-toolbar[hidden] {\n\tdisplay: none;\n}\n\n/* Group wrapper — real flex container so consumers can style it via ::part(toolbar-group)\n with padding/background/border directly. Group gap mirrors the toolbar gap so the\n visual rhythm between buttons stays uniform whether or not a group boundary lies between them. */\n.notectl-toolbar-group {\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 2px;\n}\n\n.notectl-toolbar-group--overflow-hidden {\n\tdisplay: none;\n}\n\n.notectl-toolbar-btn {\n\tdisplay: inline-flex;\n\talign-items: center;\n\tjustify-content: center;\n\twidth: 32px;\n\theight: 32px;\n\tborder: 1px solid transparent;\n\tborder-radius: 4px;\n\tbackground: var(--notectl-toolbar-button-bg, transparent);\n\tcursor: pointer;\n\tcolor: var(--notectl-toolbar-button-fg, var(--notectl-fg));\n\tfont-size: 14px;\n\tline-height: 1;\n\tpadding: 0;\n\tflex-shrink: 0;\n\ttransition: background 0.1s, border-color 0.1s;\n}\n\n@media (hover: hover) {\n\t.notectl-toolbar-btn:hover {\n\t\tbackground: var(--notectl-toolbar-button-hover-bg, var(--notectl-hover-bg));\n\t\tborder-color: var(--notectl-border);\n\t}\n}\n\n.notectl-toolbar-btn--active {\n\tbackground: var(--notectl-toolbar-button-active-bg, var(--notectl-active-bg));\n\tborder-color: var(--notectl-primary-muted);\n\tcolor: var(--notectl-toolbar-button-active-fg, var(--notectl-primary-fg));\n}\n\n.notectl-toolbar-btn:focus-visible {\n\tbox-shadow: 0 0 0 2px var(--notectl-focus-ring);\n\toutline: none;\n}\n\n.notectl-toolbar-btn:disabled {\n\topacity: 0.4;\n\tcursor: not-allowed;\n}\n\n@media (hover: hover) {\n\t.notectl-toolbar-btn:disabled:hover {\n\t\tbackground: transparent;\n\t\tborder-color: transparent;\n\t}\n}\n\n.notectl-toolbar-btn__icon {\n\tdisplay: inline-flex;\n\talign-items: center;\n\tjustify-content: center;\n\tpointer-events: none;\n}\n\n.notectl-toolbar-btn__icon svg {\n\tdisplay: block;\n\twidth: 18px;\n\theight: 18px;\n\tfill: currentColor;\n}\n\n/* Tooltip (rendered as fixed-position element in shadow root) */\n.notectl-toolbar-tooltip {\n\tpadding: 4px 8px;\n\tborder-radius: 4px;\n\tbackground: var(--notectl-tooltip-bg);\n\tcolor: var(--notectl-tooltip-fg);\n\tfont-size: 11px;\n\tfont-weight: 500;\n\twhite-space: nowrap;\n\tpointer-events: none;\n\tz-index: 10001;\n\tline-height: 1.4;\n\tletter-spacing: 0.01em;\n\tfont-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\n}\n\n.notectl-toolbar-separator {\n\tdisplay: inline-block;\n\twidth: 1px;\n\theight: 20px;\n\tbackground: var(--notectl-border);\n\tmargin: 0 4px;\n\tvertical-align: middle;\n}\n\n/* Toolbar Popups */\n.notectl-toolbar-popup {\n\tbackground: var(--notectl-surface-overlay);\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 6px;\n\tbox-shadow: 0 4px 12px var(--notectl-shadow);\n\toverflow: hidden;\n}\n\n/* Grid Picker */\n.notectl-grid-picker__cell:focus-visible {\n\toutline: 2px solid var(--notectl-focus-ring);\n\toutline-offset: -1px;\n}\n\n.notectl-grid-picker__cell--highlighted {\n\tbackground: var(--notectl-primary-muted);\n\tborder-color: var(--notectl-primary);\n}\n\n/* Dropdown */\n.notectl-dropdown {\n\tmin-width: 160px;\n\tpadding: 4px 0;\n}\n\n.notectl-dropdown__item {\n\tdisplay: flex;\n\talign-items: center;\n\twidth: 100%;\n\tpadding: 8px 12px;\n\ttext-align: start;\n\tborder: none;\n\tbackground: none;\n\tcursor: pointer;\n\tfont-size: 14px;\n\tcolor: var(--notectl-fg);\n\tline-height: 1.4;\n\tfont-family: inherit;\n\twhite-space: nowrap;\n}\n\n@media (hover: hover) {\n\t.notectl-dropdown__item:hover {\n\t\tbackground: var(--notectl-hover-bg);\n\t}\n}\n\n.notectl-dropdown__item:focus-visible {\n\tbackground: var(--notectl-hover-bg);\n\toutline: none;\n}\n\n.notectl-dropdown__item-icon {\n\tdisplay: inline-flex;\n\talign-items: center;\n\tjustify-content: center;\n\twidth: 28px;\n\tfont-weight: 600;\n\tcolor: var(--notectl-fg-muted);\n\tflex-shrink: 0;\n}\n\n.notectl-dropdown__item-label {\n\tflex: 1;\n}\n\n/* Overflow behavior: flow mode — toolbar wraps to additional rows */\n.notectl-toolbar[data-overflow=\"flow\"] {\n\tflex-wrap: wrap;\n\toverflow: visible;\n}\n\n/* Overflow behavior: none — toolbar clips without any responsive behavior */\n.notectl-toolbar[data-overflow=\"none\"] {\n\tflex-wrap: nowrap;\n\toverflow: hidden;\n}\n\n/* Overflow: hidden items (burger-menu mode) */\n.notectl-toolbar-btn--overflow-hidden,\n.notectl-toolbar-separator--overflow-hidden {\n\tdisplay: none;\n}\n\n/* Overflow \"more\" button */\n.notectl-toolbar-overflow-btn {\n\tdisplay: inline-flex;\n\talign-items: center;\n\tjustify-content: center;\n\twidth: 32px;\n\theight: 32px;\n\tborder: 1px solid transparent;\n\tborder-radius: 4px;\n\tbackground: transparent;\n\tcursor: pointer;\n\tcolor: var(--notectl-fg);\n\tfont-size: 16px;\n\tline-height: 1;\n\tpadding: 0;\n\tflex-shrink: 0;\n\tmargin-inline-start: auto;\n\ttransition: background 0.1s, border-color 0.1s;\n}\n\n@media (hover: hover) {\n\t.notectl-toolbar-overflow-btn:hover {\n\t\tbackground: var(--notectl-hover-bg);\n\t\tborder-color: var(--notectl-border);\n\t}\n}\n\n.notectl-toolbar-overflow-btn--hidden {\n\tdisplay: none;\n}\n\n.notectl-toolbar-overflow-btn:focus-visible {\n\tbox-shadow: 0 0 0 2px var(--notectl-focus-ring);\n\toutline: none;\n}\n\n/* Dropdown item states shared by all dropdown menus (including overflow) */\n.notectl-dropdown__item:disabled {\n\topacity: 0.4;\n\tcursor: not-allowed;\n}\n\n@media (hover: hover) {\n\t.notectl-dropdown__item:disabled:hover {\n\t\tbackground: none;\n\t}\n}\n\n.notectl-dropdown__item--active {\n\tcolor: var(--notectl-primary-fg);\n}\n\n.notectl-dropdown__item-icon svg {\n\tdisplay: block;\n\twidth: 16px;\n\theight: 16px;\n\tfill: currentColor;\n}\n\n.notectl-dropdown__separator {\n\theight: 1px;\n\tbackground: var(--notectl-border);\n\tmargin: 4px 0;\n}\n\n/* Combobox-style toolbar buttons (shared base for font, fontSize, heading, etc.) */\n.notectl-toolbar-btn[role=\"combobox\"] {\n\twidth: auto;\n\tpadding: 0 8px;\n\tgap: 4px;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 4px;\n\tbackground: var(--notectl-toolbar-bg, var(--notectl-surface-raised));\n}\n\n@media (hover: hover) {\n\t.notectl-toolbar-btn[role=\"combobox\"]:hover {\n\t\tbackground: var(--notectl-hover-bg);\n\t\tborder-color: var(--notectl-fg-muted);\n\t}\n}\n\n.notectl-toolbar-btn[role=\"combobox\"].notectl-toolbar-btn--active {\n\tbackground: var(--notectl-toolbar-bg, var(--notectl-surface-raised));\n\tborder-color: var(--notectl-primary-muted);\n}\n\n.notectl-toolbar-combobox__label {\n\tflex: 1;\n\tfont-size: 13px;\n\tfont-weight: 500;\n\tcolor: var(--notectl-fg);\n\twhite-space: nowrap;\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n\ttext-align: start;\n\tline-height: 30px;\n}\n\n.notectl-toolbar-combobox__arrow {\n\tflex-shrink: 0;\n\tfont-size: 11px;\n\tcolor: var(--notectl-fg-muted);\n\tline-height: 30px;\n}\n\n/* Link Popup */\n.notectl-link-popup {\n\tpadding: 8px;\n\tmin-width: 200px;\n}\n\n.notectl-link-popup__input {\n\twidth: 100%;\n\tpadding: 4px;\n\tbox-sizing: border-box;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 4px;\n\tfont-size: 13px;\n\tcolor: var(--notectl-fg);\n\tbackground: var(--notectl-surface-overlay);\n}\n\n.notectl-link-popup__input:focus-visible {\n\toutline: 2px solid var(--notectl-focus-ring);\n\toutline-offset: -1px;\n}\n\n.notectl-link-popup__button {\n\twidth: 100%;\n\tpadding: 6px 12px;\n\tcursor: pointer;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 4px;\n\tbackground: var(--notectl-surface-overlay);\n\tcolor: var(--notectl-fg);\n\tfont-size: 13px;\n}\n\n.notectl-link-popup__button--apply {\n\tmargin-top: 4px;\n}\n\n@media (hover: hover) {\n\t.notectl-link-popup__button:hover {\n\t\tbackground: var(--notectl-hover-bg);\n\t}\n}\n\n.notectl-link-popup__button:focus-visible {\n\toutline: 2px solid var(--notectl-focus-ring);\n\toutline-offset: -1px;\n}\n`;\n","/**\n * Keyboard navigation helpers for the toolbar (WAI-ARIA Toolbar pattern).\n * Also re-exports generic navigation helpers from `plugins/shared`.\n */\n\n/** Returns indices of all enabled buttons. */\nexport function getEnabledIndices(buttons: readonly HTMLButtonElement[]): number[] {\n\tconst result: number[] = [];\n\tfor (let i = 0; i < buttons.length; i++) {\n\t\tif (!buttons[i]?.disabled) {\n\t\t\tresult.push(i);\n\t\t}\n\t}\n\treturn result;\n}\n\n/** Finds the next enabled button index in the given direction (wraps around). */\nexport function findNextEnabled(\n\tbuttons: readonly HTMLButtonElement[],\n\tcurrent: number,\n\tdirection: 1 | -1,\n): number {\n\tconst len = buttons.length;\n\tif (len === 0) return -1;\n\n\tlet index = current;\n\tfor (let i = 0; i < len; i++) {\n\t\tindex = (index + direction + len) % len;\n\t\tif (!buttons[index]?.disabled) {\n\t\t\treturn index;\n\t\t}\n\t}\n\treturn current;\n}\n\n/** Finds the first enabled button index. */\nexport function findFirstEnabled(buttons: readonly HTMLButtonElement[]): number {\n\tfor (let i = 0; i < buttons.length; i++) {\n\t\tif (!buttons[i]?.disabled) return i;\n\t}\n\treturn -1;\n}\n\n/** Finds the last enabled button index. */\nexport function findLastEnabled(buttons: readonly HTMLButtonElement[]): number {\n\tfor (let i = buttons.length - 1; i >= 0; i--) {\n\t\tif (!buttons[i]?.disabled) return i;\n\t}\n\treturn -1;\n}\n\nexport {\n\tapplyRovingTabindex,\n\tfindNextDropdownItem,\n\tnavigateGrid,\n} from '../shared/KeyboardNav.js';\n\n/**\n * Resolves a horizontal navigation direction based on text direction.\n * In RTL, ArrowRight moves backward (-1) and ArrowLeft moves forward (1).\n */\nexport function resolveHorizontalDirection(\n\tkey: 'ArrowRight' | 'ArrowLeft',\n\tisRtl: boolean,\n): 1 | -1 {\n\tif (key === 'ArrowRight') return isRtl ? -1 : 1;\n\treturn isRtl ? 1 : -1;\n}\n","/** Locale interface and default English locale for the ToolbarPlugin. */\n\nimport { type LocaleModuleMap, loadLocaleModule } from '../shared/LocaleLoader.js';\n\n// --- Locale Interface ---\n\nexport interface ToolbarLocale {\n\treadonly formattingOptionsAria: string;\n\treadonly moreToolsAria: string;\n\treadonly gridPickerLabel: (rows: number, cols: number) => string;\n}\n\n// --- Default English Locale ---\n\nexport const TOOLBAR_LOCALE_EN: ToolbarLocale = {\n\tformattingOptionsAria: 'Formatting options',\n\tmoreToolsAria: 'More tools',\n\tgridPickerLabel: (rows: number, cols: number) => `${rows} x ${cols}`,\n};\n\n// --- Lazy Locale Loader ---\n\nconst localeModules: LocaleModuleMap<ToolbarLocale> = import.meta.glob<{\n\tdefault: ToolbarLocale;\n}>('./locales/*.ts', { eager: false });\n\nexport async function loadToolbarLocale(lang: string): Promise<ToolbarLocale> {\n\treturn loadLocaleModule(localeModules, lang, TOOLBAR_LOCALE_EN);\n}\n","/**\n * Controls how the toolbar responds when items exceed the available width.\n *\n * @example\n * ```typescript\n * const editor = await createEditor({\n * toolbar: {\n * groups: [[BoldPlugin, ItalicPlugin], [HeadingPlugin]],\n * overflow: ToolbarOverflowBehavior.Flow,\n * },\n * });\n * ```\n */\nexport const ToolbarOverflowBehavior = {\n\t/** Items that don't fit are hidden behind a \"...\" dropdown button. Default. */\n\tBurgerMenu: 'burger-menu',\n\t/** Toolbar wraps to additional rows when items overflow. Pure CSS, no JS measurement. */\n\tFlow: 'flow',\n\t/** No responsive behavior; the toolbar clips at the container boundary. */\n\tNone: 'none',\n} as const;\n\nexport type ToolbarOverflowBehavior =\n\t(typeof ToolbarOverflowBehavior)[keyof typeof ToolbarOverflowBehavior];\n","/**\n * ToolbarOverflowController: manages responsive toolbar overflow.\n * Uses ResizeObserver to detect when items exceed available width,\n * hides overflow items, and shows a \"more\" dropdown button.\n * Delegates popup lifecycle to PopupManager when available.\n */\n\nimport { isRtlContext } from '../../platform/Platform.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { PluginContext } from '../Plugin.js';\nimport { findNextDropdownItem } from '../shared/KeyboardNav.js';\nimport type { PopupHandle, PopupManager } from '../shared/PopupManager.js';\nimport { appendToRoot, positionPopup } from '../shared/PopupPositioning.js';\nimport type { ToolbarItem } from './ToolbarItem.js';\n\n// --- Types ---\n\ninterface OverflowEntry {\n\treadonly element: HTMLButtonElement;\n\treadonly item: ToolbarItem;\n}\n\ntype OnOverflowChange = (\n\tvisibleButtons: readonly HTMLButtonElement[],\n\toverflowButton: HTMLButtonElement | null,\n) => void;\n\ntype OnItemActivated = (overflowButton: HTMLButtonElement, item: ToolbarItem) => void;\n\nexport interface OverflowControllerConfig {\n\treadonly toolbar: HTMLElement;\n\treadonly ariaLabel: string;\n\treadonly context: PluginContext;\n\treadonly onOverflowChange: OnOverflowChange;\n\treadonly onItemActivated: OnItemActivated;\n\treadonly getActiveElement: () => Element | null;\n\treadonly popupManager?: PopupManager;\n}\n\n// --- Constants ---\n\nconst OVERFLOW_BTN_WIDTH = 34;\nconst GAP = 2;\nconst HIDDEN_BTN_CLASS = 'notectl-toolbar-btn--overflow-hidden';\nconst HIDDEN_SEP_CLASS = 'notectl-toolbar-separator--overflow-hidden';\nconst HIDDEN_GROUP_CLASS = 'notectl-toolbar-group--overflow-hidden';\nconst HIDDEN_OVERFLOW_CLASS = 'notectl-toolbar-overflow-btn--hidden';\nconst GROUP_CLASS = 'notectl-toolbar-group';\nconst SEPARATOR_CLASS = 'notectl-toolbar-separator';\nconst BUTTON_CLASS = 'notectl-toolbar-btn';\nconst ELLIPSIS_SVG =\n\t'<svg viewBox=\"0 0 16 16\" width=\"16\" height=\"16\"><circle cx=\"3\" cy=\"8\" r=\"1.5\" fill=\"currentColor\"/><circle cx=\"8\" cy=\"8\" r=\"1.5\" fill=\"currentColor\"/><circle cx=\"13\" cy=\"8\" r=\"1.5\" fill=\"currentColor\"/></svg>';\n\n// --- Controller ---\n\nexport class ToolbarOverflowController {\n\tprivate readonly toolbar: HTMLElement;\n\tprivate readonly context: PluginContext;\n\tprivate readonly onOverflowChange: OnOverflowChange;\n\tprivate readonly onItemActivated: OnItemActivated;\n\tprivate readonly getActiveElement: () => Element | null;\n\tprivate readonly ariaLabel: string;\n\tprivate readonly popupManager: PopupManager | null;\n\n\tprivate entries: OverflowEntry[] = [];\n\tprivate overflowButton: HTMLButtonElement | null = null;\n\tprivate overflowDropdown: HTMLElement | null = null;\n\tprivate overflowHandle: PopupHandle | null = null;\n\tprivate overflowEntries: OverflowEntry[] = [];\n\tprivate resizeObserver: ResizeObserver | null = null;\n\tprivate closeHandler: ((e: MouseEvent) => void) | null = null;\n\tprivate closeHandlerTimer: ReturnType<typeof setTimeout> | null = null;\n\tprivate closeHandlerAttached = false;\n\n\tconstructor(config: OverflowControllerConfig) {\n\t\tthis.toolbar = config.toolbar;\n\t\tthis.ariaLabel = config.ariaLabel;\n\t\tthis.context = config.context;\n\t\tthis.onOverflowChange = config.onOverflowChange;\n\t\tthis.onItemActivated = config.onItemActivated;\n\t\tthis.getActiveElement = config.getActiveElement;\n\t\tthis.popupManager = config.popupManager ?? null;\n\n\t\tthis.resizeObserver = new ResizeObserver(() => this.recalculate());\n\t\tthis.resizeObserver.observe(this.toolbar);\n\t}\n\n\t/** Called after renderItems() — stores button references and recalculates. */\n\tupdate(buttons: readonly { element: HTMLButtonElement; item: ToolbarItem }[]): void {\n\t\tthis.entries = buttons.map((b) => ({ element: b.element, item: b.item }));\n\t\tthis.recalculate();\n\t}\n\n\t/**\n\t * Measures the toolbar and redistributes content between visible and overflow.\n\t *\n\t * Overflow unit is the **group wrapper** (`.notectl-toolbar-group`), not individual\n\t * buttons — when any button in a group would not fit, the whole group moves to the\n\t * overflow dropdown so logical clusters stay together. Standalone buttons appended\n\t * directly to the toolbar (legacy / test setups) are treated as single-button groups.\n\t */\n\trecalculate(): void {\n\t\tif (this.entries.length === 0) return;\n\n\t\tthis.closeDropdown();\n\t\tthis.resetVisibility();\n\t\tthis.ensureOverflowButton();\n\t\tthis.setOverflowButtonVisible(false);\n\n\t\t// Phase 1 — Measure (reads only): batch all layout reads before any writes\n\t\tconst availableWidth: number = this.measureAvailableWidth();\n\t\tconst children: HTMLElement[] = Array.from(this.toolbar.children) as HTMLElement[];\n\t\tconst childWidths: Map<HTMLElement, number> = this.measureChildWidths(children);\n\n\t\t// Phase 2 — Apply (writes only): use cached widths, no layout reads\n\t\tconst maxWidth: number = availableWidth - OVERFLOW_BTN_WIDTH - GAP;\n\t\tlet usedWidth = 0;\n\t\tlet overflowing = false;\n\t\tconst overflowList: OverflowEntry[] = [];\n\n\t\tfor (const child of children) {\n\t\t\tif (child === this.overflowButton) continue;\n\n\t\t\tif (child.classList.contains(SEPARATOR_CLASS)) {\n\t\t\t\tconst sepWidth: number = (childWidths.get(child) ?? 0) + GAP;\n\t\t\t\tif (overflowing || usedWidth + sepWidth > maxWidth) {\n\t\t\t\t\toverflowing = true;\n\t\t\t\t\tchild.classList.add(HIDDEN_SEP_CLASS);\n\t\t\t\t} else {\n\t\t\t\t\tusedWidth += sepWidth;\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (child.classList.contains(GROUP_CLASS)) {\n\t\t\t\tconst groupWidth: number = (childWidths.get(child) ?? 0) + GAP;\n\t\t\t\tconst groupEntries: OverflowEntry[] = this.entriesInside(child);\n\t\t\t\tif (overflowing || usedWidth + groupWidth > maxWidth) {\n\t\t\t\t\toverflowing = true;\n\t\t\t\t\tthis.hideGroup(child, groupEntries, overflowList);\n\t\t\t\t} else {\n\t\t\t\t\tusedWidth += groupWidth;\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Standalone button (used by tests that append buttons directly to the toolbar)\n\t\t\tconst entry: OverflowEntry | undefined = this.entries.find((oe) => oe.element === child);\n\t\t\tif (!entry) continue;\n\n\t\t\tconst btnWidth: number = (childWidths.get(child) ?? 0) + GAP;\n\t\t\tif (overflowing || usedWidth + btnWidth > maxWidth) {\n\t\t\t\toverflowing = true;\n\t\t\t\tentry.element.classList.add(HIDDEN_BTN_CLASS);\n\t\t\t\toverflowList.push(entry);\n\t\t\t} else {\n\t\t\t\tusedWidth += btnWidth;\n\t\t\t}\n\t\t}\n\n\t\tthis.overflowEntries = overflowList;\n\t\tthis.hideTrailingSeparators();\n\t\tthis.setOverflowButtonVisible(overflowList.length > 0);\n\t\tthis.notifyChange();\n\t}\n\n\t/**\n\t * Hides a group wrapper and marks every entry inside it as overflowed.\n\t * Marking individual buttons too keeps `notifyChange()` filter logic uniform.\n\t */\n\tprivate hideGroup(\n\t\tgroup: HTMLElement,\n\t\tentries: readonly OverflowEntry[],\n\t\toverflowList: OverflowEntry[],\n\t): void {\n\t\tgroup.classList.add(HIDDEN_GROUP_CLASS);\n\t\tfor (const entry of entries) {\n\t\t\tentry.element.classList.add(HIDDEN_BTN_CLASS);\n\t\t\toverflowList.push(entry);\n\t\t}\n\t}\n\n\tprivate entriesInside(group: HTMLElement): OverflowEntry[] {\n\t\tconst result: OverflowEntry[] = [];\n\t\tfor (const entry of this.entries) {\n\t\t\tif (group.contains(entry.element)) {\n\t\t\t\tresult.push(entry);\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t}\n\n\t/** Updates active/disabled states for items in the open overflow dropdown. */\n\tupdateItemStates(state: EditorState): void {\n\t\tif (!this.overflowDropdown) return;\n\n\t\tconst menuItems: HTMLButtonElement[] = Array.from(\n\t\t\tthis.overflowDropdown.querySelectorAll('.notectl-dropdown__item'),\n\t\t) as HTMLButtonElement[];\n\n\t\tfor (const menuItem of menuItems) {\n\t\t\tconst itemId: string | null = menuItem.getAttribute('data-toolbar-item');\n\t\t\tconst entry: OverflowEntry | undefined = this.overflowEntries.find(\n\t\t\t\t(oe) => oe.item.id === itemId,\n\t\t\t);\n\t\t\tif (!entry) continue;\n\n\t\t\tconst active: boolean = entry.item.isActive?.(state) ?? false;\n\t\t\tconst enabled: boolean = entry.item.isEnabled?.(state) ?? true;\n\t\t\tmenuItem.classList.toggle('notectl-dropdown__item--active', active);\n\t\t\tmenuItem.disabled = !enabled;\n\n\t\t\tif (entry.item.popupType === 'combobox') {\n\t\t\t\tconst labelEl: HTMLSpanElement | null = menuItem.querySelector(\n\t\t\t\t\t'.notectl-dropdown__item-label',\n\t\t\t\t);\n\t\t\t\tif (labelEl) {\n\t\t\t\t\tlabelEl.textContent = entry.item.getLabel(state);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (entry.item.getIcon) {\n\t\t\t\tconst newIcon: string = entry.item.getIcon(state);\n\t\t\t\tconst iconEl: HTMLSpanElement | null = menuItem.querySelector(\n\t\t\t\t\t'.notectl-dropdown__item-icon',\n\t\t\t\t);\n\t\t\t\tif (iconEl && iconEl.innerHTML !== newIcon) {\n\t\t\t\t\ticonEl.innerHTML = newIcon;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/** Cleans up ResizeObserver, DOM elements, and event listeners. */\n\tdestroy(): void {\n\t\tthis.resizeObserver?.disconnect();\n\t\tthis.resizeObserver = null;\n\t\tthis.closeDropdown();\n\t\tthis.overflowButton?.remove();\n\t\tthis.overflowButton = null;\n\t\tthis.entries = [];\n\t\tthis.overflowEntries = [];\n\t}\n\n\t// --- Measurement ---\n\n\tprivate measureChildWidths(children: readonly HTMLElement[]): Map<HTMLElement, number> {\n\t\tconst widths: Map<HTMLElement, number> = new Map();\n\t\tfor (const child of children) {\n\t\t\tif (child === this.overflowButton) continue;\n\t\t\twidths.set(child, child.offsetWidth);\n\t\t}\n\t\treturn widths;\n\t}\n\n\tprivate measureAvailableWidth(): number {\n\t\tconst toolbarStyle: CSSStyleDeclaration = getComputedStyle(this.toolbar);\n\t\tconst paddingLeft: number = Number.parseFloat(toolbarStyle.paddingLeft) || 0;\n\t\tconst paddingRight: number = Number.parseFloat(toolbarStyle.paddingRight) || 0;\n\t\treturn this.toolbar.clientWidth - paddingLeft - paddingRight;\n\t}\n\n\tprivate resetVisibility(): void {\n\t\tfor (const entry of this.entries) {\n\t\t\tentry.element.classList.remove(HIDDEN_BTN_CLASS);\n\t\t}\n\t\tconst separators: HTMLElement[] = Array.from(\n\t\t\tthis.toolbar.querySelectorAll(`.${SEPARATOR_CLASS}`),\n\t\t) as HTMLElement[];\n\t\tfor (const sep of separators) {\n\t\t\tsep.classList.remove(HIDDEN_SEP_CLASS);\n\t\t}\n\t\tconst groups: HTMLElement[] = Array.from(\n\t\t\tthis.toolbar.querySelectorAll(`.${GROUP_CLASS}`),\n\t\t) as HTMLElement[];\n\t\tfor (const grp of groups) {\n\t\t\tgrp.classList.remove(HIDDEN_GROUP_CLASS);\n\t\t}\n\t}\n\n\t// --- Overflow Button ---\n\n\tprivate setOverflowButtonVisible(visible: boolean): void {\n\t\tif (!this.overflowButton) return;\n\t\tthis.overflowButton.classList.toggle(HIDDEN_OVERFLOW_CLASS, !visible);\n\t\tif (!visible) {\n\t\t\tthis.overflowButton.removeAttribute('tabindex');\n\t\t}\n\t}\n\n\tprivate ensureOverflowButton(): void {\n\t\tif (this.overflowButton) return;\n\n\t\tconst btn: HTMLButtonElement = document.createElement('button');\n\t\tbtn.type = 'button';\n\t\tbtn.className = 'notectl-toolbar-overflow-btn';\n\t\tbtn.setAttribute('aria-label', this.ariaLabel);\n\t\tbtn.setAttribute('aria-haspopup', 'true');\n\t\tbtn.setAttribute('aria-expanded', 'false');\n\t\tbtn.setAttribute('part', 'toolbar-button toolbar-overflow-button');\n\t\tbtn.innerHTML = ELLIPSIS_SVG;\n\n\t\tbtn.addEventListener('mousedown', (e: MouseEvent) => {\n\t\t\te.preventDefault();\n\t\t\tthis.toggleDropdown();\n\t\t});\n\n\t\tthis.toolbar.appendChild(btn);\n\t\tthis.overflowButton = btn;\n\t}\n\n\t// --- Dropdown ---\n\n\tprivate toggleDropdown(): void {\n\t\tif (this.overflowDropdown) {\n\t\t\tthis.closeDropdown();\n\t\t} else {\n\t\t\tthis.openDropdown();\n\t\t}\n\t}\n\n\tprivate openDropdown(): void {\n\t\tif (!this.overflowButton || this.overflowEntries.length === 0) return;\n\n\t\tconst dropdown: HTMLDivElement = document.createElement('div');\n\t\tdropdown.className = 'notectl-toolbar-popup notectl-dropdown';\n\t\tdropdown.setAttribute('role', 'menu');\n\n\t\tthis.renderDropdownItems(dropdown, this.context.getState());\n\n\t\tif (this.popupManager) {\n\t\t\tthis.overflowHandle = this.popupManager.open({\n\t\t\t\tanchor: this.overflowButton,\n\t\t\t\tclassName: 'notectl-toolbar-popup notectl-dropdown',\n\t\t\t\tariaRole: 'menu',\n\t\t\t\tposition: 'below-end',\n\t\t\t\treferenceNode: this.overflowButton,\n\t\t\t\trestoreFocusTo: this.overflowButton,\n\t\t\t\tonClose: () => {\n\t\t\t\t\tthis.overflowHandle = null;\n\t\t\t\t\tthis.overflowDropdown = null;\n\t\t\t\t\tif (this.overflowButton) {\n\t\t\t\t\t\tthis.overflowButton.setAttribute('aria-expanded', 'false');\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tcontent: (popup: HTMLElement) => {\n\t\t\t\t\tthis.renderDropdownItems(popup, this.context.getState());\n\t\t\t\t\tthis.overflowDropdown = popup;\n\t\t\t\t\tpopup.addEventListener('keydown', (e: KeyboardEvent) => this.handleDropdownKeydown(e));\n\t\t\t\t},\n\t\t\t});\n\t\t\tthis.overflowButton.setAttribute('aria-expanded', 'true');\n\t\t} else {\n\t\t\tthis.positionDropdown(dropdown);\n\t\t\tappendToRoot(dropdown, this.overflowButton);\n\t\t\tthis.overflowDropdown = dropdown;\n\t\t\tthis.overflowButton.setAttribute('aria-expanded', 'true');\n\n\t\t\trequestAnimationFrame(() => {\n\t\t\t\tconst first: HTMLElement | null = dropdown.querySelector('[role=\"menuitem\"]');\n\t\t\t\tfirst?.focus();\n\t\t\t});\n\n\t\t\tdropdown.addEventListener('keydown', (e: KeyboardEvent) => this.handleDropdownKeydown(e));\n\t\t\tthis.registerCloseHandler();\n\t\t}\n\t}\n\n\tprivate renderDropdownItems(dropdown: HTMLElement, state: EditorState): void {\n\t\tlet lastGroup: string | null = null;\n\n\t\tfor (const entry of this.overflowEntries) {\n\t\t\tif (lastGroup !== null && entry.item.group !== lastGroup) {\n\t\t\t\tconst sep: HTMLDivElement = document.createElement('div');\n\t\t\t\tsep.className = 'notectl-dropdown__separator';\n\t\t\t\tsep.setAttribute('role', 'separator');\n\t\t\t\tdropdown.appendChild(sep);\n\t\t\t}\n\t\t\tlastGroup = entry.item.group;\n\n\t\t\tconst menuBtn: HTMLButtonElement = document.createElement('button');\n\t\t\tmenuBtn.type = 'button';\n\t\t\tmenuBtn.className = 'notectl-dropdown__item';\n\t\t\tmenuBtn.setAttribute('role', 'menuitem');\n\t\t\tmenuBtn.setAttribute('tabindex', '-1');\n\t\t\tmenuBtn.setAttribute('data-toolbar-item', entry.item.id);\n\n\t\t\tconst iconSpan: HTMLSpanElement = document.createElement('span');\n\t\t\ticonSpan.className = 'notectl-dropdown__item-icon';\n\t\t\tif (entry.item.popupType !== 'combobox') {\n\t\t\t\ticonSpan.innerHTML = entry.item.icon;\n\t\t\t}\n\t\t\tmenuBtn.appendChild(iconSpan);\n\n\t\t\tconst labelSpan: HTMLSpanElement = document.createElement('span');\n\t\t\tlabelSpan.className = 'notectl-dropdown__item-label';\n\t\t\tlabelSpan.textContent =\n\t\t\t\tentry.item.popupType === 'combobox'\n\t\t\t\t\t? entry.item.getLabel(state)\n\t\t\t\t\t: (entry.item.tooltip ?? entry.item.label);\n\t\t\tmenuBtn.appendChild(labelSpan);\n\n\t\t\tmenuBtn.addEventListener('mousedown', (ev: MouseEvent) => {\n\t\t\t\tev.preventDefault();\n\t\t\t\tev.stopPropagation();\n\t\t\t\tthis.activateOverflowItem(entry);\n\t\t\t});\n\n\t\t\tdropdown.appendChild(menuBtn);\n\t\t}\n\t}\n\n\tprivate positionDropdown(dropdown: HTMLElement): void {\n\t\tif (!this.overflowButton) return;\n\n\t\tconst rect: DOMRect = this.overflowButton.getBoundingClientRect();\n\t\tconst rtl: boolean = isRtlContext(this.toolbar);\n\n\t\tpositionPopup(dropdown, rect, { position: rtl ? 'below-start' : 'below-end', isRtl: rtl });\n\t}\n\n\tprivate registerCloseHandler(): void {\n\t\tthis.closeHandler = (ev: MouseEvent) => {\n\t\t\tconst path: EventTarget[] = ev.composedPath();\n\t\t\tif (\n\t\t\t\tthis.overflowDropdown &&\n\t\t\t\t!path.includes(this.overflowDropdown) &&\n\t\t\t\tthis.overflowButton &&\n\t\t\t\t!path.includes(this.overflowButton)\n\t\t\t) {\n\t\t\t\tthis.closeDropdown();\n\t\t\t}\n\t\t};\n\t\tthis.closeHandlerTimer = setTimeout(() => {\n\t\t\tthis.closeHandlerTimer = null;\n\t\t\tif (!this.closeHandler || !this.overflowDropdown) return;\n\t\t\tdocument.addEventListener('mousedown', this.closeHandler);\n\t\t\tthis.closeHandlerAttached = true;\n\t\t}, 0);\n\t}\n\n\tprivate closeDropdown(): void {\n\t\tif (this.overflowHandle) {\n\t\t\tconst handle: PopupHandle = this.overflowHandle;\n\t\t\tthis.overflowHandle = null;\n\t\t\tthis.overflowDropdown = null;\n\t\t\thandle.close();\n\t\t\tif (this.overflowButton) {\n\t\t\t\tthis.overflowButton.setAttribute('aria-expanded', 'false');\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tif (this.overflowDropdown) {\n\t\t\tthis.overflowDropdown.remove();\n\t\t\tthis.overflowDropdown = null;\n\t\t}\n\t\tif (this.overflowButton) {\n\t\t\tthis.overflowButton.setAttribute('aria-expanded', 'false');\n\t\t}\n\t\tif (this.closeHandler) {\n\t\t\tif (this.closeHandlerTimer !== null) {\n\t\t\t\tclearTimeout(this.closeHandlerTimer);\n\t\t\t\tthis.closeHandlerTimer = null;\n\t\t\t}\n\t\t\tif (this.closeHandlerAttached) {\n\t\t\t\tdocument.removeEventListener('mousedown', this.closeHandler);\n\t\t\t\tthis.closeHandlerAttached = false;\n\t\t\t}\n\t\t\tthis.closeHandler = null;\n\t\t}\n\t}\n\n\tprivate activateOverflowItem(entry: OverflowEntry): void {\n\t\tthis.closeDropdown();\n\t\tif (entry.item.popupType && this.overflowButton) {\n\t\t\tthis.onItemActivated(this.overflowButton, entry.item);\n\t\t} else {\n\t\t\tthis.context.executeCommand(entry.item.command);\n\t\t}\n\t}\n\n\t// --- Keyboard Navigation ---\n\n\tprivate handleDropdownKeydown(e: KeyboardEvent): void {\n\t\tif (!this.overflowDropdown) return;\n\n\t\tif (e.key === 'Escape' || e.key === 'Tab') {\n\t\t\te.preventDefault();\n\t\t\te.stopPropagation();\n\t\t\tthis.closeDropdown();\n\t\t\tthis.overflowButton?.focus();\n\t\t\treturn;\n\t\t}\n\n\t\tconst items: HTMLElement[] = Array.from(\n\t\t\tthis.overflowDropdown.querySelectorAll('[role=\"menuitem\"]'),\n\t\t) as HTMLElement[];\n\t\tconst current: number = items.indexOf(this.getActiveElement() as HTMLElement);\n\n\t\tswitch (e.key) {\n\t\t\tcase 'ArrowDown': {\n\t\t\t\te.preventDefault();\n\t\t\t\tconst next: number = findNextDropdownItem(items, current, 1);\n\t\t\t\titems[next]?.focus();\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase 'ArrowUp': {\n\t\t\t\te.preventDefault();\n\t\t\t\tconst prev: number = findNextDropdownItem(items, current, -1);\n\t\t\t\titems[prev]?.focus();\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase 'Enter':\n\t\t\tcase ' ': {\n\t\t\t\te.preventDefault();\n\t\t\t\tconst focusedItem: HTMLElement | undefined = items[current];\n\t\t\t\tif (!focusedItem) break;\n\t\t\t\tconst itemId: string | null = focusedItem.getAttribute('data-toolbar-item');\n\t\t\t\tconst entry: OverflowEntry | undefined = this.overflowEntries.find(\n\t\t\t\t\t(oe) => oe.item.id === itemId,\n\t\t\t\t);\n\t\t\t\tif (entry) this.activateOverflowItem(entry);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\t// --- Helpers ---\n\n\tprivate hideTrailingSeparators(): void {\n\t\tconst children: HTMLElement[] = Array.from(this.toolbar.children) as HTMLElement[];\n\t\tfor (let i = children.length - 1; i >= 0; i--) {\n\t\t\tconst child: HTMLElement | undefined = children[i];\n\t\t\tif (!child || child === this.overflowButton) continue;\n\t\t\tif (child.classList.contains(SEPARATOR_CLASS)) {\n\t\t\t\tif (!child.classList.contains(HIDDEN_SEP_CLASS)) {\n\t\t\t\t\tchild.classList.add(HIDDEN_SEP_CLASS);\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst isHiddenGroup: boolean =\n\t\t\t\tchild.classList.contains(GROUP_CLASS) && child.classList.contains(HIDDEN_GROUP_CLASS);\n\t\t\tconst isHiddenButton: boolean =\n\t\t\t\tchild.classList.contains(BUTTON_CLASS) && child.classList.contains(HIDDEN_BTN_CLASS);\n\t\t\tif (isHiddenGroup || isHiddenButton) continue;\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tprivate notifyChange(): void {\n\t\tconst visible: HTMLButtonElement[] = this.entries\n\t\t\t.filter((oe) => !oe.element.classList.contains(HIDDEN_BTN_CLASS))\n\t\t\t.map((oe) => oe.element);\n\t\tthis.onOverflowChange(visible, this.overflowEntries.length > 0 ? this.overflowButton : null);\n\t}\n}\n","/**\n * ToolbarRenderers: pure rendering functions for toolbar popup content.\n * Grid pickers, dropdown menus, and separator elements.\n */\n\nimport { setStyleProperties } from '../../style/StyleRuntime.js';\nimport type { DropdownConfig, GridPickerConfig } from './ToolbarItem.js';\nimport { TOOLBAR_LOCALE_EN, type ToolbarLocale } from './ToolbarLocale.js';\n\nconst HIGHLIGHTED_CLASS = 'notectl-grid-picker__cell--highlighted';\n\n/**\n * Renders a grid picker into the given container.\n * Calls `onClose` after a cell is selected so the popup can be dismissed.\n */\nexport function renderGridPicker(\n\tcontainer: HTMLElement,\n\tconfig: GridPickerConfig,\n\tonClose: () => void,\n\tlocale: ToolbarLocale = TOOLBAR_LOCALE_EN,\n): void {\n\tcontainer.className += ' notectl-grid-picker';\n\n\tconst grid: HTMLDivElement = document.createElement('div');\n\tgrid.className = 'notectl-grid-picker__grid';\n\tgrid.setAttribute('role', 'grid');\n\tsetStyleProperties(grid, {\n\t\tdisplay: 'grid',\n\t\tgridTemplateColumns: `repeat(${config.maxCols}, 1fr)`,\n\t\tgap: '2px',\n\t\tpadding: '8px',\n\t});\n\n\tconst label: HTMLDivElement = document.createElement('div');\n\tlabel.className = 'notectl-grid-picker__label';\n\tlabel.textContent = locale.gridPickerLabel(1, 1);\n\tsetStyleProperties(label, {\n\t\ttextAlign: 'center',\n\t\tpadding: '4px',\n\t\tfontSize: '12px',\n\t});\n\tlabel.setAttribute('aria-live', 'polite');\n\n\tfor (let r = 1; r <= config.maxRows; r++) {\n\t\tfor (let c = 1; c <= config.maxCols; c++) {\n\t\t\tconst cell: HTMLDivElement = document.createElement('div');\n\t\t\tcell.className = 'notectl-grid-picker__cell';\n\t\t\tcell.setAttribute('role', 'gridcell');\n\t\t\tcell.setAttribute('tabindex', '-1');\n\t\t\tcell.setAttribute('aria-label', locale.gridPickerLabel(r, c));\n\t\t\tsetStyleProperties(cell, {\n\t\t\t\twidth: '20px',\n\t\t\t\theight: '20px',\n\t\t\t\tborder: '1px solid #ccc',\n\t\t\t\tcursor: 'pointer',\n\t\t\t});\n\t\t\tcell.setAttribute('data-row', String(r));\n\t\t\tcell.setAttribute('data-col', String(c));\n\n\t\t\tcell.addEventListener('mouseenter', () => {\n\t\t\t\thighlightCells(grid, r, c);\n\t\t\t\tlabel.textContent = locale.gridPickerLabel(r, c);\n\t\t\t});\n\n\t\t\tcell.addEventListener('mousedown', (e: MouseEvent) => {\n\t\t\t\te.preventDefault();\n\t\t\t\te.stopPropagation();\n\t\t\t});\n\n\t\t\tcell.addEventListener('click', () => {\n\t\t\t\tconfig.onSelect(r, c);\n\t\t\t\tonClose();\n\t\t\t});\n\n\t\t\tgrid.appendChild(cell);\n\t\t}\n\t}\n\n\tcontainer.appendChild(grid);\n\tcontainer.appendChild(label);\n}\n\n/**\n * Highlights grid cells up to the given row/col and updates the label.\n * Used by both mouse hover and keyboard navigation.\n */\nexport function highlightCells(grid: HTMLElement, targetRow: number, targetCol: number): void {\n\tconst cells: NodeListOf<Element> = grid.querySelectorAll('.notectl-grid-picker__cell');\n\tfor (const cell of cells) {\n\t\tconst r: number = Number(cell.getAttribute('data-row'));\n\t\tconst c: number = Number(cell.getAttribute('data-col'));\n\t\tcell.classList.toggle(HIGHLIGHTED_CLASS, r <= targetRow && c <= targetCol);\n\t}\n}\n\n/**\n * Renders a dropdown menu into the given container.\n * Calls `onClose` after an item is activated so the popup can be dismissed.\n */\nexport function renderDropdown(\n\tcontainer: HTMLElement,\n\tconfig: DropdownConfig,\n\texecuteCommand: (command: string) => void,\n\tonClose: () => void,\n): void {\n\tcontainer.classList.add('notectl-dropdown');\n\tcontainer.setAttribute('role', 'menu');\n\n\tfor (const item of config.items) {\n\t\tconst btn: HTMLButtonElement = document.createElement('button');\n\t\tbtn.type = 'button';\n\t\tbtn.className = 'notectl-dropdown__item';\n\t\tbtn.setAttribute('role', 'menuitem');\n\t\tbtn.setAttribute('tabindex', '-1');\n\n\t\tif (item.icon) {\n\t\t\tconst iconSpan: HTMLSpanElement = document.createElement('span');\n\t\t\ticonSpan.className = 'notectl-dropdown__item-icon';\n\t\t\ticonSpan.innerHTML = item.icon;\n\t\t\tbtn.appendChild(iconSpan);\n\t\t}\n\n\t\tconst labelSpan: HTMLSpanElement = document.createElement('span');\n\t\tlabelSpan.className = 'notectl-dropdown__item-label';\n\t\tlabelSpan.textContent = item.label;\n\t\tbtn.appendChild(labelSpan);\n\n\t\tbtn.addEventListener('mousedown', (e: MouseEvent) => {\n\t\t\te.preventDefault();\n\t\t\te.stopPropagation();\n\t\t});\n\n\t\tbtn.addEventListener('click', () => {\n\t\t\texecuteCommand(item.command);\n\t\t\tonClose();\n\t\t});\n\n\t\tcontainer.appendChild(btn);\n\t}\n}\n\n/** Creates a toolbar group separator element. */\nexport function createSeparator(): HTMLSpanElement {\n\tconst sep: HTMLSpanElement = document.createElement('span');\n\tsep.className = 'notectl-toolbar-separator';\n\tsep.setAttribute('role', 'separator');\n\tsep.setAttribute('part', 'toolbar-divider');\n\treturn sep;\n}\n","/**\n * ToolbarPopupController: manages popup lifecycle, positioning, keyboard\n * navigation, and auto-close for toolbar popups (grid pickers, dropdowns,\n * and custom popups). Delegates lifecycle to PopupManager.\n */\n\nimport { isRtlContext } from '../../platform/Platform.js';\nimport type { PluginContext } from '../Plugin.js';\nimport { findNextDropdownItem, navigateGrid } from '../shared/KeyboardNav.js';\nimport type { PopupCloseOptions, PopupHandle, PopupManager } from '../shared/PopupManager.js';\nimport type { ToolbarItem } from './ToolbarItem.js';\nimport { TOOLBAR_LOCALE_EN, type ToolbarLocale } from './ToolbarLocale.js';\nimport { highlightCells, renderDropdown, renderGridPicker } from './ToolbarRenderers.js';\n\nexport class ToolbarPopupController {\n\tprivate activePopup: HTMLElement | null = null;\n\tprivate activePopupButton: HTMLButtonElement | null = null;\n\tprivate activeHandle: PopupHandle | null = null;\n\tprivate readonly getActiveElement: () => Element | null;\n\tprivate readonly locale: ToolbarLocale;\n\tprivate popupManager: PopupManager | null = null;\n\n\tconstructor(getActiveElement: () => Element | null, locale: ToolbarLocale = TOOLBAR_LOCALE_EN) {\n\t\tthis.getActiveElement = getActiveElement;\n\t\tthis.locale = locale;\n\t}\n\n\t/** Injects the PopupManager instance (called after service registration). */\n\tsetPopupManager(manager: PopupManager): void {\n\t\tthis.popupManager = manager;\n\t}\n\n\t/** Whether a popup is currently open. */\n\tisOpen(): boolean {\n\t\treturn this.activePopup !== null;\n\t}\n\n\t/** Toggles a popup for the given toolbar button. */\n\ttoggle(button: HTMLButtonElement, item: ToolbarItem, context: PluginContext): void {\n\t\tif (this.activePopup) {\n\t\t\tthis.close();\n\t\t\treturn;\n\t\t}\n\n\t\tthis.openViaManager(button, item, context);\n\t}\n\n\t/** Closes the active popup and cleans up event listeners. */\n\tclose(): void {\n\t\tif (this.activeHandle) {\n\t\t\t// Prevent onClose callback from re-entering\n\t\t\tconst handle: PopupHandle = this.activeHandle;\n\t\t\tthis.activeHandle = null;\n\t\t\tthis.clearButtonState();\n\t\t\thandle.close();\n\t\t\treturn;\n\t\t}\n\n\t\tthis.clearButtonState();\n\t\tif (this.activePopup) {\n\t\t\tthis.activePopup.remove();\n\t\t\tthis.activePopup = null;\n\t\t}\n\t}\n\n\t/** Closes popup and restores focus to the trigger button. */\n\tcloseAndRestoreFocus(): void {\n\t\tconst triggerBtn: HTMLButtonElement | null = this.activePopupButton;\n\t\tthis.close();\n\t\ttriggerBtn?.focus();\n\t}\n\n\tdestroy(): void {\n\t\tthis.close();\n\t}\n\n\t// --- PopupManager path ---\n\n\tprivate openViaManager(\n\t\tbutton: HTMLButtonElement,\n\t\titem: ToolbarItem,\n\t\tcontext: PluginContext,\n\t): void {\n\t\tif (!this.popupManager) return;\n\n\t\tthis.activePopupButton = button;\n\t\tbutton.classList.add('notectl-toolbar-btn--popup-open');\n\t\tbutton.setAttribute('aria-expanded', 'true');\n\n\t\tthis.activeHandle = this.popupManager.open({\n\t\t\tanchor: button,\n\t\t\tclassName: 'notectl-toolbar-popup',\n\t\t\treferenceNode: button,\n\t\t\trestoreFocusTo: button,\n\t\t\tposition: 'below-start',\n\t\t\tonClose: () => {\n\t\t\t\t// Called when PopupManager closes the popup (click-outside, etc.)\n\t\t\t\tthis.activeHandle = null;\n\t\t\t\tthis.clearButtonState();\n\t\t\t\tthis.activePopup = null;\n\t\t\t},\n\t\t\tcontent: (popup: HTMLElement, close: (options?: PopupCloseOptions) => void) => {\n\t\t\t\tthis.activePopup = popup;\n\t\t\t\tthis.renderPopupContent(popup, item, context, close);\n\t\t\t\tpopup.addEventListener('keydown', (e: KeyboardEvent) => this.handlePopupKeydown(e));\n\t\t\t},\n\t\t});\n\t}\n\n\t// --- Shared rendering ---\n\n\tprivate renderPopupContent(\n\t\tpopup: HTMLElement,\n\t\titem: ToolbarItem,\n\t\tcontext: PluginContext,\n\t\tclose: (options?: PopupCloseOptions) => void,\n\t): void {\n\t\tconst closeAndFocusEditor = (): void => {\n\t\t\tclose({ restoreFocusTo: null });\n\t\t\tcontext.getContainer().focus();\n\t\t};\n\n\t\tswitch (item.popupType) {\n\t\t\tcase 'gridPicker':\n\t\t\t\trenderGridPicker(popup, item.popupConfig, closeAndFocusEditor, this.locale);\n\t\t\t\tbreak;\n\t\t\tcase 'dropdown':\n\t\t\t\trenderDropdown(\n\t\t\t\t\tpopup,\n\t\t\t\t\titem.popupConfig,\n\t\t\t\t\t(cmd: string) => context.executeCommand(cmd),\n\t\t\t\t\tcloseAndFocusEditor,\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\tcase 'custom':\n\t\t\t\titem.renderPopup(popup, context, close);\n\t\t\t\tbreak;\n\t\t\tcase 'combobox':\n\t\t\t\titem.renderPopup(popup, context, close);\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\t// --- Button state ---\n\n\tprivate clearButtonState(): void {\n\t\tif (this.activePopupButton) {\n\t\t\tthis.activePopupButton.classList.remove('notectl-toolbar-btn--popup-open');\n\t\t\tthis.activePopupButton.setAttribute('aria-expanded', 'false');\n\t\t\tthis.activePopupButton = null;\n\t\t}\n\t}\n\n\t// --- Keyboard Navigation ---\n\n\tprivate handlePopupKeydown(e: KeyboardEvent): void {\n\t\tif (!this.activePopup) return;\n\n\t\tif (e.key === 'Escape') {\n\t\t\te.preventDefault();\n\t\t\te.stopPropagation();\n\t\t\tthis.closeAndRestoreFocus();\n\t\t\treturn;\n\t\t}\n\n\t\tif (e.key === 'Tab') {\n\t\t\te.preventDefault();\n\t\t\tthis.closeAndRestoreFocus();\n\t\t\treturn;\n\t\t}\n\n\t\tconst menuItems: NodeListOf<Element> = this.activePopup.querySelectorAll('[role=\"menuitem\"]');\n\t\tif (menuItems.length > 0) {\n\t\t\tthis.handleDropdownKeydown(e, menuItems);\n\t\t\treturn;\n\t\t}\n\n\t\tconst hasGrid: boolean = this.activePopup.querySelector('.notectl-grid-picker__cell') !== null;\n\t\tif (hasGrid) {\n\t\t\tthis.handleGridKeydown(e);\n\t\t\treturn;\n\t\t}\n\n\t\tthis.handleCustomPopupKeydown(e);\n\t}\n\n\tprivate handleDropdownKeydown(e: KeyboardEvent, items: NodeListOf<Element>): void {\n\t\tconst itemArr: HTMLElement[] = Array.from(items) as HTMLElement[];\n\t\tconst current: number = itemArr.indexOf(this.getActiveElement() as HTMLElement);\n\n\t\tswitch (e.key) {\n\t\t\tcase 'ArrowDown': {\n\t\t\t\te.preventDefault();\n\t\t\t\tconst next: number = findNextDropdownItem(itemArr, current, 1);\n\t\t\t\titemArr[next]?.focus();\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase 'ArrowUp': {\n\t\t\t\te.preventDefault();\n\t\t\t\tconst prev: number = findNextDropdownItem(itemArr, current, -1);\n\t\t\t\titemArr[prev]?.focus();\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase 'Enter':\n\t\t\tcase ' ': {\n\t\t\t\te.preventDefault();\n\t\t\t\tconst focused: HTMLElement | undefined = itemArr[current];\n\t\t\t\tif (focused) focused.click();\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate handleGridKeydown(e: KeyboardEvent): void {\n\t\tconst focused: HTMLElement = this.getActiveElement() as HTMLElement;\n\t\tconst row: number = Number(focused?.getAttribute('data-row') ?? 1);\n\t\tconst col: number = Number(focused?.getAttribute('data-col') ?? 1);\n\n\t\tconst grid: Element | null =\n\t\t\tthis.activePopup?.querySelector('.notectl-grid-picker__grid') ?? null;\n\t\tif (!grid) return;\n\n\t\tconst lastCell: Element | null = grid.querySelector('.notectl-grid-picker__cell:last-child');\n\t\tconst maxCols: number = Number(lastCell?.getAttribute('data-col') ?? 1);\n\t\tconst maxRows: number = Number(lastCell?.getAttribute('data-row') ?? 1);\n\n\t\tif (['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'].includes(e.key)) {\n\t\t\te.preventDefault();\n\t\t\tconst [newRow, newCol]: [number, number] = navigateGrid(\n\t\t\t\trow,\n\t\t\t\tcol,\n\t\t\t\tmaxRows,\n\t\t\t\tmaxCols,\n\t\t\t\te.key as 'ArrowUp' | 'ArrowDown' | 'ArrowLeft' | 'ArrowRight',\n\t\t\t\tthis.activePopup ? isRtlContext(this.activePopup) : false,\n\t\t\t);\n\t\t\tconst target: HTMLElement | null = grid.querySelector(\n\t\t\t\t`.notectl-grid-picker__cell[data-row=\"${newRow}\"][data-col=\"${newCol}\"]`,\n\t\t\t);\n\t\t\ttarget?.focus();\n\n\t\t\thighlightCells(grid as HTMLElement, newRow, newCol);\n\t\t\tconst label: Element | null =\n\t\t\t\tthis.activePopup?.querySelector('.notectl-grid-picker__label') ?? null;\n\t\t\tif (label) label.textContent = this.locale.gridPickerLabel(newRow, newCol);\n\t\t}\n\n\t\tif (e.key === 'Enter' || e.key === ' ') {\n\t\t\te.preventDefault();\n\t\t\tfocused?.click();\n\t\t}\n\t}\n\n\tprivate handleCustomPopupKeydown(e: KeyboardEvent): void {\n\t\tif (!this.activePopup) return;\n\t\tconst buttons: HTMLButtonElement[] = Array.from(this.activePopup.querySelectorAll('button'));\n\t\tif (buttons.length === 0) return;\n\t\tconst active: HTMLElement = this.getActiveElement() as HTMLElement;\n\t\tconst currentIdx: number = buttons.indexOf(active as HTMLButtonElement);\n\n\t\tswitch (e.key) {\n\t\t\tcase 'ArrowDown': {\n\t\t\t\te.preventDefault();\n\t\t\t\tconst next: number = findNextDropdownItem(buttons, currentIdx, 1);\n\t\t\t\tbuttons[next]?.focus();\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase 'ArrowUp': {\n\t\t\t\te.preventDefault();\n\t\t\t\tconst prev: number = findNextDropdownItem(buttons, currentIdx, -1);\n\t\t\t\tbuttons[prev]?.focus();\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase 'Enter':\n\t\t\tcase ' ': {\n\t\t\t\te.preventDefault();\n\t\t\t\tif (active) activateButton(active);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * Activates a popup control from the keyboard by replaying a full mouse press.\n *\n * Custom-popup action buttons split across two conventions: some run their action\n * on `mousedown` and `preventDefault` it to keep focus on a text field (the link and\n * image popups), while others run it on `click` (the formula dialog's Insert/Cancel).\n * Dispatching both, in pointer order, activates either kind exactly once, because no\n * button runs its action on *both* events: a button that listens on both uses\n * `mousedown` only as a focus guard and runs its action on `click`.\n *\n * Self-managing custom popups that own their full keyboard (the color grid, the\n * structural math palette) handle Enter/Space themselves and stop the event before it\n * reaches here, so this path serves the popups that rely on the controller.\n */\nfunction activateButton(target: HTMLElement): void {\n\ttarget.dispatchEvent(new MouseEvent('mousedown', { bubbles: true, cancelable: true }));\n\ttarget.dispatchEvent(new MouseEvent('mouseup', { bubbles: true, cancelable: true }));\n\ttarget.click();\n}\n","/**\n * ToolbarTooltip: manages the tooltip lifecycle for toolbar buttons.\n * Shows a tooltip after a short delay when hovering or focusing a button,\n * hides it when the cursor leaves or focus moves away.\n */\n\nimport { setStyleProperties, setStyleProperty } from '../../style/StyleRuntime.js';\nimport type { ContainingBlockOffset } from '../shared/PopupPositioning.js';\nimport { measureContainingBlockOffset } from '../shared/PopupPositioning.js';\n\nconst TOOLTIP_DELAY_MS = 500;\n\nexport class ToolbarTooltip {\n\tprivate readonly element: HTMLElement;\n\tprivate timer: ReturnType<typeof setTimeout> | null = null;\n\tprivate target: HTMLButtonElement | null = null;\n\tprivate readonly isPopupActive: () => boolean;\n\n\tstatic readonly TOOLTIP_ID = 'notectl-toolbar-tooltip';\n\n\tconstructor(isPopupActive: () => boolean) {\n\t\tthis.isPopupActive = isPopupActive;\n\t\tthis.element = document.createElement('div');\n\t\tthis.element.className = 'notectl-toolbar-tooltip';\n\t\tthis.element.id = ToolbarTooltip.TOOLTIP_ID;\n\t\tthis.element.setAttribute('role', 'tooltip');\n\t\tsetStyleProperty(this.element, 'display', 'none');\n\t}\n\n\tshow(button: HTMLButtonElement): void {\n\t\tthis.hide();\n\n\t\tif (this.isPopupActive() || button.disabled) return;\n\n\t\tconst text: string | null = button.getAttribute('data-tooltip');\n\t\tif (!text) return;\n\n\t\tthis.target = button;\n\n\t\tthis.timer = setTimeout(() => {\n\t\t\tif (this.isPopupActive()) return;\n\n\t\t\tthis.element.textContent = text;\n\t\t\tsetStyleProperty(this.element, 'display', '');\n\n\t\t\tconst root: Node = button.getRootNode();\n\t\t\tif (root instanceof ShadowRoot && !this.element.parentNode) {\n\t\t\t\troot.appendChild(this.element);\n\t\t\t} else if (!(root instanceof ShadowRoot) && !this.element.parentNode) {\n\t\t\t\tdocument.body.appendChild(this.element);\n\t\t\t}\n\n\t\t\tbutton.setAttribute('aria-describedby', ToolbarTooltip.TOOLTIP_ID);\n\n\t\t\tconst rect: DOMRect = button.getBoundingClientRect();\n\t\t\tsetStyleProperty(this.element, 'position', 'fixed');\n\t\t\tconst cbOffset: ContainingBlockOffset = measureContainingBlockOffset(this.element);\n\t\t\tsetStyleProperties(this.element, {\n\t\t\t\ttop: `${rect.bottom + 6 - cbOffset.y}px`,\n\t\t\t\tleft: `${rect.left + rect.width / 2 - cbOffset.x}px`,\n\t\t\t\ttransform: 'translateX(-50%)',\n\t\t\t});\n\t\t}, TOOLTIP_DELAY_MS);\n\t}\n\n\thide(): void {\n\t\tif (this.timer) {\n\t\t\tclearTimeout(this.timer);\n\t\t\tthis.timer = null;\n\t\t}\n\t\tif (this.target) {\n\t\t\tthis.target.removeAttribute('aria-describedby');\n\t\t\tthis.target = null;\n\t\t}\n\t\tsetStyleProperty(this.element, 'display', 'none');\n\t}\n\n\tdestroy(): void {\n\t\tthis.hide();\n\t\tthis.element.remove();\n\t}\n}\n","/**\n * Toolbar plugin: renders toolbar items registered by other plugins.\n * Acts as a pure rendering engine — has no knowledge of specific features.\n * Supports buttons, dropdowns, grid pickers, and custom popups.\n * Implements WAI-ARIA Toolbar pattern with roving tabindex.\n */\n\nimport { TOOLBAR_CSS } from '../../editor/styles/toolbar.js';\nimport { isRtlContext } from '../../platform/Platform.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { Transaction } from '../../state/Transaction.js';\nimport { ServiceKey } from '../Plugin.js';\nimport type { Plugin, PluginConfig, PluginContext } from '../Plugin.js';\nimport { applyRovingTabindex } from '../shared/KeyboardNav.js';\nimport { resolveLocale } from '../shared/PluginHelpers.js';\nimport { PopupManager, PopupServiceKey } from '../shared/PopupManager.js';\nimport type { ToolbarItem } from './ToolbarItem.js';\nimport {\n\tfindFirstEnabled,\n\tfindLastEnabled,\n\tfindNextEnabled,\n\tresolveHorizontalDirection,\n} from './ToolbarKeyboardNav.js';\nimport { TOOLBAR_LOCALE_EN, type ToolbarLocale, loadToolbarLocale } from './ToolbarLocale.js';\nimport {\n\tToolbarOverflowBehavior,\n\ttype ToolbarOverflowBehavior as ToolbarOverflowBehaviorType,\n} from './ToolbarOverflowBehavior.js';\nimport { ToolbarOverflowController } from './ToolbarOverflowController.js';\nimport { ToolbarPopupController } from './ToolbarPopupController.js';\nimport { createSeparator } from './ToolbarRenderers.js';\nimport { ToolbarTooltip } from './ToolbarTooltip.js';\n\n// --- Layout Config ---\n\n/**\n * Configuration for a single toolbar group. Accepts either:\n * - A `ReadonlyArray<string>` of plugin ids (backwards-compatible tuple form), or\n * - An object with `plugins` and an optional accessible `label`. When `label` is set,\n * the group wrapper receives `role=\"group\"` and `aria-label`, so assistive technology\n * can announce the cluster by name.\n */\nexport type ToolbarGroupConfig =\n\t| ReadonlyArray<string>\n\t| {\n\t\t\treadonly plugins: ReadonlyArray<string>;\n\t\t\treadonly label?: string;\n\t };\n\nexport interface ToolbarLayoutConfig {\n\treadonly groups: ReadonlyArray<ToolbarGroupConfig>;\n\t/**\n\t * Controls responsive overflow behavior when toolbar items exceed available width.\n\t * Defaults to `ToolbarOverflowBehavior.BurgerMenu`.\n\t */\n\treadonly overflow?: ToolbarOverflowBehaviorType;\n}\n\ninterface NormalizedGroup {\n\treadonly plugins: ReadonlyArray<string>;\n\treadonly label: string | undefined;\n}\n\nfunction normalizeGroupConfig(group: ToolbarGroupConfig): NormalizedGroup {\n\tif (Array.isArray(group)) {\n\t\treturn { plugins: group, label: undefined };\n\t}\n\tconst obj: { readonly plugins: ReadonlyArray<string>; readonly label?: string } = group as {\n\t\treadonly plugins: ReadonlyArray<string>;\n\t\treadonly label?: string;\n\t};\n\treturn { plugins: obj.plugins, label: obj.label };\n}\n\n// --- Typed Service API ---\n\nexport interface ToolbarServiceAPI {\n\t/** Re-reads isActive/isEnabled from state and updates all buttons. */\n\trefresh(): void;\n\t/** Closes the currently open popup, if any. */\n\tclosePopup(): void;\n}\n\nexport const ToolbarServiceKey = new ServiceKey<ToolbarServiceAPI>('toolbar');\n\n// --- Plugin ---\n\ninterface ToolbarButton {\n\telement: HTMLButtonElement;\n\titem: ToolbarItem;\n\tcomboLabelEl: HTMLSpanElement | null;\n}\n\nexport class ToolbarPlugin implements Plugin {\n\treadonly id = 'toolbar';\n\treadonly name = 'Toolbar';\n\treadonly priority = 10;\n\n\tprivate context: PluginContext | null = null;\n\tprivate toolbarElement: HTMLElement | null = null;\n\tprivate buttons: ToolbarButton[] = [];\n\tprivate readonly hiddenItems = new Set<string>();\n\tprivate readonly layoutConfig: ToolbarLayoutConfig | null;\n\tprivate overflowBehavior: ToolbarOverflowBehaviorType;\n\tprivate focusedIndex = 0;\n\tprivate tooltip: ToolbarTooltip | null = null;\n\tprivate popupController: ToolbarPopupController | null = null;\n\tprivate popupManager: PopupManager | null = null;\n\tprivate overflowController: ToolbarOverflowController | null = null;\n\tprivate visibleElements: HTMLButtonElement[] = [];\n\tprivate locale!: ToolbarLocale;\n\n\tconstructor(layoutConfig?: ToolbarLayoutConfig) {\n\t\tthis.layoutConfig = layoutConfig ?? null;\n\t\tthis.overflowBehavior = layoutConfig?.overflow ?? ToolbarOverflowBehavior.BurgerMenu;\n\t}\n\n\tasync init(context: PluginContext): Promise<void> {\n\t\tthis.locale = await resolveLocale(context, undefined, TOOLBAR_LOCALE_EN, loadToolbarLocale);\n\t\tcontext.registerStyleSheet(TOOLBAR_CSS);\n\t\tthis.context = context;\n\n\t\tthis.popupManager = new PopupManager(context.getContainer());\n\t\tcontext.registerService(PopupServiceKey, this.popupManager);\n\n\t\tthis.popupController = new ToolbarPopupController(() => this.getActiveElement(), this.locale);\n\t\tthis.popupController.setPopupManager(this.popupManager);\n\t\tthis.tooltip = new ToolbarTooltip(() => this.popupController?.isOpen() ?? false);\n\n\t\tcontext.registerService(ToolbarServiceKey, {\n\t\t\trefresh: () => this.updateButtonStates(context.getState()),\n\t\t\tclosePopup: () => this.popupController?.close(),\n\t\t});\n\n\t\tthis.createToolbarElement();\n\t}\n\n\t/** Returns the current overflow behavior. */\n\tgetOverflowBehavior(): ToolbarOverflowBehaviorType {\n\t\treturn this.overflowBehavior;\n\t}\n\n\t/** Switches the overflow behavior at runtime. */\n\tsetOverflowBehavior(behavior: ToolbarOverflowBehaviorType): void {\n\t\tif (behavior === this.overflowBehavior) return;\n\n\t\tthis.overflowBehavior = behavior;\n\t\tthis.applyOverflowBehavior();\n\t\tthis.renderItems();\n\t}\n\n\tonReady(): void {\n\t\tthis.renderItems();\n\t}\n\n\tdestroy(): void {\n\t\tthis.overflowController?.destroy();\n\t\tthis.overflowController = null;\n\t\tthis.popupController?.destroy();\n\t\tthis.popupController = null;\n\t\tthis.popupManager?.destroy();\n\t\tthis.popupManager = null;\n\t\tthis.tooltip?.destroy();\n\t\tthis.tooltip = null;\n\t\tif (this.toolbarElement) {\n\t\t\tthis.toolbarElement.remove();\n\t\t\tthis.toolbarElement = null;\n\t\t}\n\t\tthis.buttons = [];\n\t\tthis.visibleElements = [];\n\t\tthis.context = null;\n\t}\n\n\tonStateChange(_oldState: EditorState, newState: EditorState, _tr: Transaction): void {\n\t\tthis.updateButtonStates(newState);\n\t}\n\n\tonReadOnlyChange(readonly: boolean): void {\n\t\tif (this.toolbarElement) {\n\t\t\tthis.toolbarElement.hidden = readonly;\n\t\t}\n\t}\n\n\tonConfigure(config: PluginConfig): void {\n\t\tfor (const [key, value] of Object.entries(config)) {\n\t\t\tif (value === false) {\n\t\t\t\tthis.hiddenItems.add(key);\n\t\t\t} else {\n\t\t\t\tthis.hiddenItems.delete(key);\n\t\t\t}\n\t\t}\n\t\tthis.renderItems();\n\t}\n\n\t// --- Toolbar ---\n\n\tprivate createToolbarElement(): void {\n\t\tif (!this.context) return;\n\n\t\tif (this.toolbarElement) {\n\t\t\tthis.toolbarElement.remove();\n\t\t}\n\t\tthis.buttons = [];\n\n\t\tconst container: HTMLElement = this.context.getPluginContainer('top');\n\t\tthis.toolbarElement = document.createElement('div');\n\t\tthis.toolbarElement.setAttribute('role', 'toolbar');\n\t\tthis.toolbarElement.setAttribute('aria-label', this.locale.formattingOptionsAria);\n\t\tthis.toolbarElement.setAttribute('data-notectl-no-print', '');\n\t\tthis.toolbarElement.setAttribute('part', 'toolbar');\n\t\tthis.toolbarElement.className = 'notectl-toolbar';\n\n\t\tthis.toolbarElement.addEventListener('keydown', (e) => this.handleToolbarKeydown(e));\n\n\t\tthis.applyOverflowBehavior();\n\t\tcontainer.appendChild(this.toolbarElement);\n\t}\n\n\t/** Applies the current overflow behavior: creates/destroys the overflow controller and sets the data attribute. */\n\tprivate applyOverflowBehavior(): void {\n\t\tif (!this.toolbarElement || !this.context) return;\n\n\t\t// Tear down existing overflow controller\n\t\tthis.overflowController?.destroy();\n\t\tthis.overflowController = null;\n\n\t\tthis.toolbarElement.setAttribute('data-overflow', this.overflowBehavior);\n\n\t\tif (this.overflowBehavior === ToolbarOverflowBehavior.BurgerMenu) {\n\t\t\tthis.overflowController = new ToolbarOverflowController({\n\t\t\t\ttoolbar: this.toolbarElement,\n\t\t\t\tariaLabel: this.locale.moreToolsAria,\n\t\t\t\tcontext: this.context,\n\t\t\t\tpopupManager: this.popupManager ?? undefined,\n\t\t\t\tonOverflowChange: (visibleButtons, overflowBtn) => {\n\t\t\t\t\tthis.visibleElements = overflowBtn\n\t\t\t\t\t\t? [...visibleButtons, overflowBtn]\n\t\t\t\t\t\t: [...visibleButtons];\n\t\t\t\t\tthis.initRovingTabindex();\n\t\t\t\t},\n\t\t\t\tonItemActivated: (btn: HTMLButtonElement, item: ToolbarItem) => {\n\t\t\t\t\tthis.activateButton(btn, item);\n\t\t\t\t},\n\t\t\t\tgetActiveElement: () => this.getActiveElement(),\n\t\t\t});\n\t\t} else {\n\t\t\t// Flow and None modes: all buttons are visible for roving tabindex\n\t\t\tthis.visibleElements = [];\n\t\t}\n\t}\n\n\tprivate renderItems(): void {\n\t\tif (!this.context || !this.toolbarElement) return;\n\n\t\tfor (const btn of this.buttons) {\n\t\t\tbtn.element.remove();\n\t\t}\n\t\tthis.buttons = [];\n\n\t\tfor (const sep of this.toolbarElement.querySelectorAll('.notectl-toolbar-separator')) {\n\t\t\tsep.remove();\n\t\t}\n\t\tfor (const grp of this.toolbarElement.querySelectorAll('.notectl-toolbar-group')) {\n\t\t\tgrp.remove();\n\t\t}\n\n\t\tif (this.layoutConfig) {\n\t\t\tthis.renderItemsByLayout();\n\t\t} else {\n\t\t\tthis.renderItemsByGroup();\n\t\t}\n\n\t\tif (this.buttons.length > 0 && !this.toolbarElement.parentElement) {\n\t\t\tconst container: HTMLElement = this.context.getPluginContainer('top');\n\t\t\tcontainer.appendChild(this.toolbarElement);\n\t\t}\n\n\t\tthis.overflowController?.update(this.buttons);\n\t\tthis.initRovingTabindex();\n\t\tthis.updateButtonStates(this.context.getState());\n\t}\n\n\tprivate createGroupWrapper(label: string | undefined): HTMLDivElement {\n\t\tconst wrapper: HTMLDivElement = document.createElement('div');\n\t\twrapper.className = 'notectl-toolbar-group';\n\t\twrapper.setAttribute('part', 'toolbar-group');\n\t\tif (label !== undefined) {\n\t\t\twrapper.setAttribute('role', 'group');\n\t\t\twrapper.setAttribute('aria-label', label);\n\t\t}\n\t\treturn wrapper;\n\t}\n\n\t// --- Roving Tabindex ---\n\n\tprivate getTabElements(): HTMLButtonElement[] {\n\t\treturn this.visibleElements.length > 0\n\t\t\t? this.visibleElements\n\t\t\t: this.buttons.map((b) => b.element);\n\t}\n\n\tprivate initRovingTabindex(): void {\n\t\tconst elements: HTMLButtonElement[] = this.getTabElements();\n\t\tconst first: number = findFirstEnabled(elements);\n\t\tthis.focusedIndex = first >= 0 ? first : 0;\n\t\tapplyRovingTabindex(elements, this.focusedIndex);\n\t}\n\n\tprivate setRovingFocus(index: number): void {\n\t\tconst elements: HTMLButtonElement[] = this.getTabElements();\n\t\tif (index < 0 || index >= elements.length) return;\n\t\tthis.focusedIndex = index;\n\t\tapplyRovingTabindex(elements, index);\n\t\telements[index]?.focus();\n\t}\n\n\t/** Returns the active element, respecting shadow DOM boundaries. */\n\tprivate getActiveElement(): Element | null {\n\t\tconst root: Node | undefined = this.toolbarElement?.getRootNode();\n\t\tif (root instanceof ShadowRoot) {\n\t\t\treturn root.activeElement;\n\t\t}\n\t\treturn document.activeElement;\n\t}\n\n\tprivate syncFocusedIndex(): void {\n\t\tconst active: Element | null = this.getActiveElement();\n\t\tconst elements: HTMLButtonElement[] = this.getTabElements();\n\t\tconst idx: number = elements.findIndex((el) => el === active);\n\t\tif (idx >= 0) {\n\t\t\tthis.focusedIndex = idx;\n\t\t}\n\t}\n\n\t// --- Toolbar Keyboard ---\n\n\tprivate handleToolbarKeydown(e: KeyboardEvent): void {\n\t\tconst elements: HTMLButtonElement[] = this.getTabElements();\n\t\tif (elements.length === 0) return;\n\n\t\tthis.syncFocusedIndex();\n\n\t\tswitch (e.key) {\n\t\t\tcase 'ArrowRight':\n\t\t\tcase 'ArrowLeft': {\n\t\t\t\te.preventDefault();\n\t\t\t\tconst rtl: boolean = this.toolbarElement ? isRtlContext(this.toolbarElement) : false;\n\t\t\t\tconst dir: 1 | -1 = resolveHorizontalDirection(e.key, rtl);\n\t\t\t\tconst next: number = findNextEnabled(elements, this.focusedIndex, dir);\n\t\t\t\tthis.setRovingFocus(next);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase 'Home': {\n\t\t\t\te.preventDefault();\n\t\t\t\tconst first: number = findFirstEnabled(elements);\n\t\t\t\tif (first >= 0) this.setRovingFocus(first);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase 'End': {\n\t\t\t\te.preventDefault();\n\t\t\t\tconst last: number = findLastEnabled(elements);\n\t\t\t\tif (last >= 0) this.setRovingFocus(last);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase 'Enter':\n\t\t\tcase ' ': {\n\t\t\t\te.preventDefault();\n\t\t\t\tconst focused: HTMLButtonElement | undefined = elements[this.focusedIndex];\n\t\t\t\tconst btn: ToolbarButton | undefined = this.buttons.find((b) => b.element === focused);\n\t\t\t\tif (btn) this.activateButton(btn.element, btn.item);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\t/** Activates a toolbar button (shared between mouse click and keyboard). */\n\tprivate activateButton(btn: HTMLButtonElement, item: ToolbarItem): void {\n\t\tthis.tooltip?.hide();\n\t\tif (item.popupType && this.context) {\n\t\t\tthis.popupController?.toggle(btn, item, this.context);\n\t\t} else {\n\t\t\tthis.context?.executeCommand(item.command);\n\t\t}\n\t}\n\n\t// --- Layout Rendering ---\n\n\tprivate renderItemsByLayout(): void {\n\t\tif (!this.context || !this.toolbarElement || !this.layoutConfig) return;\n\n\t\tconst toolbarReg = this.context.getToolbarRegistry();\n\t\tlet firstGroup = true;\n\n\t\tfor (const rawGroup of this.layoutConfig.groups) {\n\t\t\tconst { plugins, label }: NormalizedGroup = normalizeGroupConfig(rawGroup);\n\t\t\tconst groupItems: ToolbarItem[] = [];\n\t\t\tfor (const pId of plugins) {\n\t\t\t\tconst items: ToolbarItem[] = toolbarReg\n\t\t\t\t\t.getToolbarItemsByPlugin(pId)\n\t\t\t\t\t.filter((item) => !this.hiddenItems.has(item.id));\n\t\t\t\tgroupItems.push(...items);\n\t\t\t}\n\n\t\t\tif (groupItems.length === 0) continue;\n\n\t\t\tif (!firstGroup) {\n\t\t\t\tthis.toolbarElement.appendChild(createSeparator());\n\t\t\t}\n\t\t\tfirstGroup = false;\n\n\t\t\tconst wrapper: HTMLDivElement = this.createGroupWrapper(label);\n\t\t\tfor (const item of groupItems) {\n\t\t\t\tconst btn: ToolbarButton = this.createButton(item);\n\t\t\t\twrapper.appendChild(btn.element);\n\t\t\t\tthis.buttons.push(btn);\n\t\t\t}\n\t\t\tthis.toolbarElement.appendChild(wrapper);\n\t\t}\n\n\t\tif (this.buttons.length === 0) {\n\t\t\tthis.toolbarElement.remove();\n\t\t}\n\t}\n\n\tprivate renderItemsByGroup(): void {\n\t\tif (!this.context || !this.toolbarElement) return;\n\n\t\tconst toolbarRegistry = this.context.getToolbarRegistry();\n\t\tconst items: ToolbarItem[] = toolbarRegistry\n\t\t\t.getToolbarItems()\n\t\t\t.filter((item) => !this.hiddenItems.has(item.id));\n\t\tif (items.length === 0) {\n\t\t\tthis.toolbarElement.remove();\n\t\t\treturn;\n\t\t}\n\n\t\tconst groups = new Map<string, ToolbarItem[]>();\n\t\tfor (const item of items) {\n\t\t\tconst list: ToolbarItem[] = groups.get(item.group) ?? [];\n\t\t\tlist.push(item);\n\t\t\tgroups.set(item.group, list);\n\t\t}\n\n\t\tlet firstGroup = true;\n\t\tfor (const [, groupItems] of groups) {\n\t\t\tif (!firstGroup) {\n\t\t\t\tthis.toolbarElement.appendChild(createSeparator());\n\t\t\t}\n\t\t\tfirstGroup = false;\n\n\t\t\tconst wrapper: HTMLDivElement = this.createGroupWrapper(undefined);\n\t\t\tfor (const item of groupItems) {\n\t\t\t\tconst btn: ToolbarButton = this.createButton(item);\n\t\t\t\twrapper.appendChild(btn.element);\n\t\t\t\tthis.buttons.push(btn);\n\t\t\t}\n\t\t\tthis.toolbarElement.appendChild(wrapper);\n\t\t}\n\t}\n\n\t// --- Button Creation ---\n\n\tprivate createButton(item: ToolbarItem): ToolbarButton {\n\t\tconst btn: HTMLButtonElement = document.createElement('button');\n\t\tbtn.type = 'button';\n\t\tbtn.className = `notectl-toolbar-btn notectl-toolbar-btn--${item.id}`;\n\t\tbtn.setAttribute('aria-pressed', 'false');\n\t\tbtn.setAttribute('aria-label', item.label);\n\t\tbtn.setAttribute('data-toolbar-item', item.id);\n\t\tbtn.setAttribute('data-tooltip', item.tooltip ?? item.label);\n\t\tbtn.setAttribute('part', 'toolbar-button');\n\n\t\tlet comboLabelEl: HTMLSpanElement | null = null;\n\n\t\tif (item.popupType === 'combobox') {\n\t\t\tbtn.setAttribute('role', 'combobox');\n\t\t\tbtn.setAttribute('aria-haspopup', 'listbox');\n\t\t\tbtn.setAttribute('aria-expanded', 'false');\n\n\t\t\tconst labelSpan: HTMLSpanElement = document.createElement('span');\n\t\t\tlabelSpan.className = 'notectl-toolbar-combobox__label';\n\t\t\tconst state: EditorState | undefined = this.context?.getState();\n\t\t\tif (state) {\n\t\t\t\tlabelSpan.textContent = item.getLabel(state);\n\t\t\t}\n\t\t\tbtn.appendChild(labelSpan);\n\t\t\tcomboLabelEl = labelSpan;\n\n\t\t\tconst arrowSpan: HTMLSpanElement = document.createElement('span');\n\t\t\tarrowSpan.className = 'notectl-toolbar-combobox__arrow';\n\t\t\tarrowSpan.setAttribute('aria-hidden', 'true');\n\t\t\tarrowSpan.textContent = '\\u25BE';\n\t\t\tbtn.appendChild(arrowSpan);\n\t\t} else {\n\t\t\tif (item.popupType) {\n\t\t\t\tbtn.setAttribute('aria-haspopup', 'true');\n\t\t\t\tbtn.setAttribute('aria-expanded', 'false');\n\t\t\t}\n\n\t\t\tconst span: HTMLSpanElement = document.createElement('span');\n\t\t\tspan.className = 'notectl-toolbar-btn__icon';\n\t\t\tspan.innerHTML = item.icon;\n\t\t\tbtn.appendChild(span);\n\t\t}\n\n\t\tbtn.addEventListener('mousedown', (e: MouseEvent) => {\n\t\t\te.preventDefault();\n\t\t\tthis.activateButton(btn, item);\n\t\t});\n\n\t\tbtn.addEventListener('mouseenter', () => this.tooltip?.show(btn));\n\t\tbtn.addEventListener('mouseleave', () => this.tooltip?.hide());\n\t\tbtn.addEventListener('focus', () => this.tooltip?.show(btn));\n\t\tbtn.addEventListener('blur', () => this.tooltip?.hide());\n\n\t\treturn { element: btn, item, comboLabelEl };\n\t}\n\n\t// --- Button State Updates ---\n\n\tprivate updateButtonStates(state: EditorState): void {\n\t\tfor (const btn of this.buttons) {\n\t\t\tconst active: boolean = btn.item.isActive?.(state) ?? false;\n\t\t\tconst enabled: boolean = btn.item.isEnabled?.(state) ?? true;\n\t\t\tbtn.element.setAttribute('aria-pressed', String(active));\n\t\t\tbtn.element.classList.toggle('notectl-toolbar-btn--active', active);\n\t\t\t// Modifier part mirrors active state for ::part() targeting from outside the shadow root.\n\t\t\t// Kept in sync with aria-pressed — never drift these apart.\n\t\t\tbtn.element.setAttribute(\n\t\t\t\t'part',\n\t\t\t\tactive ? 'toolbar-button toolbar-button-active' : 'toolbar-button',\n\t\t\t);\n\t\t\tbtn.element.disabled = !enabled;\n\t\t\tif (!enabled) {\n\t\t\t\tbtn.element.setAttribute('aria-disabled', 'true');\n\t\t\t} else {\n\t\t\t\tbtn.element.removeAttribute('aria-disabled');\n\t\t\t}\n\t\t\tif (btn.comboLabelEl && btn.item.popupType === 'combobox') {\n\t\t\t\tbtn.comboLabelEl.textContent = btn.item.getLabel(state);\n\t\t\t}\n\t\t\tif (btn.item.getIcon) {\n\t\t\t\tconst newIcon: string = btn.item.getIcon(state);\n\t\t\t\tconst iconEl: HTMLSpanElement | null = btn.element.querySelector(\n\t\t\t\t\t'.notectl-toolbar-btn__icon',\n\t\t\t\t);\n\t\t\t\tif (iconEl && iconEl.innerHTML !== newIcon) {\n\t\t\t\t\ticonEl.innerHTML = newIcon;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tthis.overflowController?.updateItemStates(state);\n\t}\n}\n"],"mappings":"yXAOA,IAAa,EAAb,MACC,6BAAiC,IAAI,IACrC,qCAAyC,IAAI,IAE7C,mBAAA,CAAoB,EAAmB,GACtC,GAAI,KAAK,cAAc,IAAI,EAAK,IAC/B,MAAM,IAAI,MAAM,wBAAwB,EAAK,8BAG9C,GADA,KAAK,cAAc,IAAI,EAAK,GAAI,GAC5B,EAAU,CACb,MAAM,EAAM,KAAK,sBAAsB,IAAI,IAAa,GACxD,EAAI,KAAK,EAAK,IACd,KAAK,sBAAsB,IAAI,EAAU,EAC1C,CACD,CAEA,uBAAA,CAAwB,GACvB,MAAM,EAAM,KAAK,sBAAsB,IAAI,IAAa,GAClD,EAAuB,GAC7B,IAAK,MAAM,KAAM,EAAK,CACrB,MAAM,EAAO,KAAK,cAAc,IAAI,GAChC,GAAM,EAAM,KAAK,EACtB,CACA,OAAO,CACR,CAEA,cAAA,CAAe,GACd,OAAO,KAAK,cAAc,IAAI,EAC/B,CAEA,eAAA,GACC,MAAO,IAAI,KAAK,cAAc,SAC/B,CAEA,iBAAA,CAAkB,GACjB,KAAK,cAAc,OAAO,GAC1B,IAAK,MAAO,EAAU,KAAQ,KAAK,sBAAuB,CACzD,MAAM,EAAM,EAAI,QAAQ,GACxB,IAAY,IAAR,EAAY,CACf,EAAI,OAAO,EAAK,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,SAAS,QACvD,EAAI,iBAAiB,QAAA,IAAe,KAAK,SAAS,KAAK,IACvD,EAAI,iBAAiB,OAAA,IAAc,KAAK,SAAS,QAE1C,CAAE,QAAS,EAAK,OAAM,eAC9B,CAIA,kBAAA,CAA2B,GAC1B,IAAK,MAAM,KAAO,KAAK,QAAS,CAC/B,MAAM,EAAkB,EAAI,KAAK,WAAW,KAAU,EAChD,EAAmB,EAAI,KAAK,YAAY,KAAU,EAkBxD,GAjBA,EAAI,QAAQ,aAAa,eAAgB,OAAO,IAChD,EAAI,QAAQ,UAAU,OAAO,8BAA+B,GAG5D,EAAI,QAAQ,aACX,OACA,EAAS,uCAAyC,kBAEnD,EAAI,QAAQ,UAAY,EACnB,EAGJ,EAAI,QAAQ,gBAAgB,iBAF5B,EAAI,QAAQ,aAAa,gBAAiB,QAIvC,EAAI,cAAuC,aAAvB,EAAI,KAAK,YAChC,EAAI,aAAa,YAAc,EAAI,KAAK,SAAS,IAE9C,EAAI,KAAK,QAAS,CACrB,MAAM,EAAkB,EAAI,KAAK,QAAQ,GACnC,EAAiC,EAAI,QAAQ,cAClD,8BAEG,GAAU,EAAO,YAAc,IAClC,EAAO,UAAY,EAErB,CACD,CACA,KAAK,oBAAoB,iBAAiB,EAC3C"}
|
|
1
|
+
{"version":3,"file":"ToolbarPlugin-DtfGTO_V.mjs","names":[],"sources":["../../src/plugins/toolbar/ToolbarRegistry.ts","../../src/editor/styles/toolbar.ts","../../src/plugins/toolbar/ToolbarKeyboardNav.ts","../../src/plugins/toolbar/ToolbarLocale.ts","../../src/plugins/toolbar/ToolbarOverflowBehavior.ts","../../src/plugins/toolbar/ToolbarOverflowController.ts","../../src/plugins/toolbar/ToolbarRenderers.ts","../../src/plugins/toolbar/ToolbarPopupController.ts","../../src/plugins/toolbar/ToolbarTooltip.ts","../../src/plugins/toolbar/ToolbarPlugin.ts"],"sourcesContent":["/**\n * ToolbarRegistry: manages plugin-registered toolbar items\n * with per-plugin tracking for clean teardown.\n */\n\nimport type { ToolbarItem } from './ToolbarItem.js';\n\nexport class ToolbarRegistry {\n\tprivate readonly _toolbarItems = new Map<string, ToolbarItem>();\n\tprivate readonly _toolbarItemPluginMap = new Map<string, string[]>();\n\n\tregisterToolbarItem(item: ToolbarItem, pluginId?: string): void {\n\t\tif (this._toolbarItems.has(item.id)) {\n\t\t\tthrow new Error(`ToolbarItem with id \"${item.id}\" is already registered.`);\n\t\t}\n\t\tthis._toolbarItems.set(item.id, item);\n\t\tif (pluginId) {\n\t\t\tconst ids = this._toolbarItemPluginMap.get(pluginId) ?? [];\n\t\t\tids.push(item.id);\n\t\t\tthis._toolbarItemPluginMap.set(pluginId, ids);\n\t\t}\n\t}\n\n\tgetToolbarItemsByPlugin(pluginId: string): ToolbarItem[] {\n\t\tconst ids = this._toolbarItemPluginMap.get(pluginId) ?? [];\n\t\tconst items: ToolbarItem[] = [];\n\t\tfor (const id of ids) {\n\t\t\tconst item = this._toolbarItems.get(id);\n\t\t\tif (item) items.push(item);\n\t\t}\n\t\treturn items;\n\t}\n\n\tgetToolbarItem(id: string): ToolbarItem | undefined {\n\t\treturn this._toolbarItems.get(id);\n\t}\n\n\tgetToolbarItems(): ToolbarItem[] {\n\t\treturn [...this._toolbarItems.values()];\n\t}\n\n\tremoveToolbarItem(id: string): void {\n\t\tthis._toolbarItems.delete(id);\n\t\tfor (const [pluginId, ids] of this._toolbarItemPluginMap) {\n\t\t\tconst idx = ids.indexOf(id);\n\t\t\tif (idx !== -1) {\n\t\t\t\tids.splice(idx, 1);\n\t\t\t\tif (ids.length === 0) this._toolbarItemPluginMap.delete(pluginId);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tclear(): void {\n\t\tthis._toolbarItems.clear();\n\t\tthis._toolbarItemPluginMap.clear();\n\t}\n}\n","/** Toolbar styles — buttons, separators, tooltips, popups, dropdowns. */\nexport const TOOLBAR_CSS = `\n/* Toolbar */\n.notectl-plugin-container--top {\n\tdisplay: flex;\n\talign-items: center;\n\tflex-wrap: nowrap;\n\tborder-bottom: 1px solid var(--notectl-border);\n\tbackground: var(--notectl-toolbar-bg, var(--notectl-surface-raised));\n\tmin-height: 40px;\n\tflex-shrink: 0;\n}\n\n.notectl-toolbar {\n\tdisplay: flex;\n\talign-items: center;\n\tflex-wrap: nowrap;\n\toverflow: hidden;\n\tflex: 1;\n\tmin-width: 0;\n\tgap: 2px;\n\tpadding: 4px 8px;\n}\n\n.notectl-toolbar[hidden] {\n\tdisplay: none;\n}\n\n/* Group wrapper — real flex container so consumers can style it via ::part(toolbar-group)\n with padding/background/border directly. Group gap mirrors the toolbar gap so the\n visual rhythm between buttons stays uniform whether or not a group boundary lies between them. */\n.notectl-toolbar-group {\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 2px;\n}\n\n.notectl-toolbar-group--overflow-hidden {\n\tdisplay: none;\n}\n\n.notectl-toolbar-btn {\n\tdisplay: inline-flex;\n\talign-items: center;\n\tjustify-content: center;\n\twidth: 32px;\n\theight: 32px;\n\tborder: 1px solid transparent;\n\tborder-radius: 4px;\n\tbackground: var(--notectl-toolbar-button-bg, transparent);\n\tcursor: pointer;\n\tcolor: var(--notectl-toolbar-button-fg, var(--notectl-fg));\n\tfont-size: 14px;\n\tline-height: 1;\n\tpadding: 0;\n\tflex-shrink: 0;\n\ttransition: background 0.1s, border-color 0.1s;\n}\n\n@media (hover: hover) {\n\t.notectl-toolbar-btn:hover {\n\t\tbackground: var(--notectl-toolbar-button-hover-bg, var(--notectl-hover-bg));\n\t\tborder-color: var(--notectl-border);\n\t}\n}\n\n.notectl-toolbar-btn--active {\n\tbackground: var(--notectl-toolbar-button-active-bg, var(--notectl-active-bg));\n\tborder-color: var(--notectl-primary-muted);\n\tcolor: var(--notectl-toolbar-button-active-fg, var(--notectl-primary-fg));\n}\n\n.notectl-toolbar-btn:focus-visible {\n\tbox-shadow: 0 0 0 2px var(--notectl-focus-ring);\n\toutline: none;\n}\n\n.notectl-toolbar-btn:disabled {\n\topacity: 0.4;\n\tcursor: not-allowed;\n}\n\n@media (hover: hover) {\n\t.notectl-toolbar-btn:disabled:hover {\n\t\tbackground: transparent;\n\t\tborder-color: transparent;\n\t}\n}\n\n.notectl-toolbar-btn__icon {\n\tdisplay: inline-flex;\n\talign-items: center;\n\tjustify-content: center;\n\tpointer-events: none;\n}\n\n.notectl-toolbar-btn__icon svg {\n\tdisplay: block;\n\twidth: 18px;\n\theight: 18px;\n\tfill: currentColor;\n}\n\n/* Tooltip (rendered as fixed-position element in shadow root) */\n.notectl-toolbar-tooltip {\n\tpadding: 4px 8px;\n\tborder-radius: 4px;\n\tbackground: var(--notectl-tooltip-bg);\n\tcolor: var(--notectl-tooltip-fg);\n\tfont-size: 11px;\n\tfont-weight: 500;\n\twhite-space: nowrap;\n\tpointer-events: none;\n\tz-index: 10001;\n\tline-height: 1.4;\n\tletter-spacing: 0.01em;\n\tfont-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\n}\n\n.notectl-toolbar-separator {\n\tdisplay: inline-block;\n\twidth: 1px;\n\theight: 20px;\n\tbackground: var(--notectl-border);\n\tmargin: 0 4px;\n\tvertical-align: middle;\n}\n\n/* Toolbar Popups */\n.notectl-toolbar-popup {\n\tbackground: var(--notectl-surface-overlay);\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 6px;\n\tbox-shadow: 0 4px 12px var(--notectl-shadow);\n\toverflow: hidden;\n}\n\n/* Grid Picker */\n.notectl-grid-picker__cell:focus-visible {\n\toutline: 2px solid var(--notectl-focus-ring);\n\toutline-offset: -1px;\n}\n\n.notectl-grid-picker__cell--highlighted {\n\tbackground: var(--notectl-primary-muted);\n\tborder-color: var(--notectl-primary);\n}\n\n/* Dropdown */\n.notectl-dropdown {\n\tmin-width: 160px;\n\tpadding: 4px 0;\n}\n\n.notectl-dropdown__item {\n\tdisplay: flex;\n\talign-items: center;\n\twidth: 100%;\n\tpadding: 8px 12px;\n\ttext-align: start;\n\tborder: none;\n\tbackground: none;\n\tcursor: pointer;\n\tfont-size: 14px;\n\tcolor: var(--notectl-fg);\n\tline-height: 1.4;\n\tfont-family: inherit;\n\twhite-space: nowrap;\n}\n\n@media (hover: hover) {\n\t.notectl-dropdown__item:hover {\n\t\tbackground: var(--notectl-hover-bg);\n\t}\n}\n\n.notectl-dropdown__item:focus-visible {\n\tbackground: var(--notectl-hover-bg);\n\toutline: none;\n}\n\n.notectl-dropdown__item-icon {\n\tdisplay: inline-flex;\n\talign-items: center;\n\tjustify-content: center;\n\twidth: 28px;\n\tfont-weight: 600;\n\tcolor: var(--notectl-fg-muted);\n\tflex-shrink: 0;\n}\n\n.notectl-dropdown__item-label {\n\tflex: 1;\n}\n\n/* Overflow behavior: flow mode — toolbar wraps to additional rows */\n.notectl-toolbar[data-overflow=\"flow\"] {\n\tflex-wrap: wrap;\n\toverflow: visible;\n}\n\n/* Overflow behavior: none — toolbar clips without any responsive behavior */\n.notectl-toolbar[data-overflow=\"none\"] {\n\tflex-wrap: nowrap;\n\toverflow: hidden;\n}\n\n/* Overflow: hidden items (burger-menu mode) */\n.notectl-toolbar-btn--overflow-hidden,\n.notectl-toolbar-separator--overflow-hidden {\n\tdisplay: none;\n}\n\n/* Overflow \"more\" button */\n.notectl-toolbar-overflow-btn {\n\tdisplay: inline-flex;\n\talign-items: center;\n\tjustify-content: center;\n\twidth: 32px;\n\theight: 32px;\n\tborder: 1px solid transparent;\n\tborder-radius: 4px;\n\tbackground: transparent;\n\tcursor: pointer;\n\tcolor: var(--notectl-fg);\n\tfont-size: 16px;\n\tline-height: 1;\n\tpadding: 0;\n\tflex-shrink: 0;\n\tmargin-inline-start: auto;\n\ttransition: background 0.1s, border-color 0.1s;\n}\n\n@media (hover: hover) {\n\t.notectl-toolbar-overflow-btn:hover {\n\t\tbackground: var(--notectl-hover-bg);\n\t\tborder-color: var(--notectl-border);\n\t}\n}\n\n.notectl-toolbar-overflow-btn--hidden {\n\tdisplay: none;\n}\n\n.notectl-toolbar-overflow-btn:focus-visible {\n\tbox-shadow: 0 0 0 2px var(--notectl-focus-ring);\n\toutline: none;\n}\n\n/* Dropdown item states shared by all dropdown menus (including overflow) */\n.notectl-dropdown__item:disabled {\n\topacity: 0.4;\n\tcursor: not-allowed;\n}\n\n@media (hover: hover) {\n\t.notectl-dropdown__item:disabled:hover {\n\t\tbackground: none;\n\t}\n}\n\n.notectl-dropdown__item--active {\n\tcolor: var(--notectl-primary-fg);\n}\n\n.notectl-dropdown__item-icon svg {\n\tdisplay: block;\n\twidth: 16px;\n\theight: 16px;\n\tfill: currentColor;\n}\n\n.notectl-dropdown__separator {\n\theight: 1px;\n\tbackground: var(--notectl-border);\n\tmargin: 4px 0;\n}\n\n/* Combobox-style toolbar buttons (shared base for font, fontSize, heading, etc.) */\n.notectl-toolbar-btn[role=\"combobox\"] {\n\twidth: auto;\n\tpadding: 0 8px;\n\tgap: 4px;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 4px;\n\tbackground: var(--notectl-toolbar-bg, var(--notectl-surface-raised));\n}\n\n@media (hover: hover) {\n\t.notectl-toolbar-btn[role=\"combobox\"]:hover {\n\t\tbackground: var(--notectl-hover-bg);\n\t\tborder-color: var(--notectl-fg-muted);\n\t}\n}\n\n.notectl-toolbar-btn[role=\"combobox\"].notectl-toolbar-btn--active {\n\tbackground: var(--notectl-toolbar-bg, var(--notectl-surface-raised));\n\tborder-color: var(--notectl-primary-muted);\n}\n\n.notectl-toolbar-combobox__label {\n\tflex: 1;\n\tfont-size: 13px;\n\tfont-weight: 500;\n\tcolor: var(--notectl-fg);\n\twhite-space: nowrap;\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n\ttext-align: start;\n\tline-height: 30px;\n}\n\n.notectl-toolbar-combobox__arrow {\n\tflex-shrink: 0;\n\tfont-size: 11px;\n\tcolor: var(--notectl-fg-muted);\n\tline-height: 30px;\n}\n\n/* Link Popup */\n.notectl-link-popup {\n\tpadding: 8px;\n\tmin-width: 200px;\n}\n\n.notectl-link-popup__input {\n\twidth: 100%;\n\tpadding: 4px;\n\tbox-sizing: border-box;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 4px;\n\tfont-size: 13px;\n\tcolor: var(--notectl-fg);\n\tbackground: var(--notectl-surface-overlay);\n}\n\n.notectl-link-popup__input:focus-visible {\n\toutline: 2px solid var(--notectl-focus-ring);\n\toutline-offset: -1px;\n}\n\n.notectl-link-popup__button {\n\twidth: 100%;\n\tpadding: 6px 12px;\n\tcursor: pointer;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 4px;\n\tbackground: var(--notectl-surface-overlay);\n\tcolor: var(--notectl-fg);\n\tfont-size: 13px;\n}\n\n.notectl-link-popup__button--apply {\n\tmargin-top: 4px;\n}\n\n@media (hover: hover) {\n\t.notectl-link-popup__button:hover {\n\t\tbackground: var(--notectl-hover-bg);\n\t}\n}\n\n.notectl-link-popup__button:focus-visible {\n\toutline: 2px solid var(--notectl-focus-ring);\n\toutline-offset: -1px;\n}\n`;\n","/**\n * Keyboard navigation helpers for the toolbar (WAI-ARIA Toolbar pattern).\n * Also re-exports generic navigation helpers from `plugins/shared`.\n */\n\n/** Returns indices of all enabled buttons. */\nexport function getEnabledIndices(buttons: readonly HTMLButtonElement[]): number[] {\n\tconst result: number[] = [];\n\tfor (let i = 0; i < buttons.length; i++) {\n\t\tif (!buttons[i]?.disabled) {\n\t\t\tresult.push(i);\n\t\t}\n\t}\n\treturn result;\n}\n\n/** Finds the next enabled button index in the given direction (wraps around). */\nexport function findNextEnabled(\n\tbuttons: readonly HTMLButtonElement[],\n\tcurrent: number,\n\tdirection: 1 | -1,\n): number {\n\tconst len = buttons.length;\n\tif (len === 0) return -1;\n\n\tlet index = current;\n\tfor (let i = 0; i < len; i++) {\n\t\tindex = (index + direction + len) % len;\n\t\tif (!buttons[index]?.disabled) {\n\t\t\treturn index;\n\t\t}\n\t}\n\treturn current;\n}\n\n/** Finds the first enabled button index. */\nexport function findFirstEnabled(buttons: readonly HTMLButtonElement[]): number {\n\tfor (let i = 0; i < buttons.length; i++) {\n\t\tif (!buttons[i]?.disabled) return i;\n\t}\n\treturn -1;\n}\n\n/** Finds the last enabled button index. */\nexport function findLastEnabled(buttons: readonly HTMLButtonElement[]): number {\n\tfor (let i = buttons.length - 1; i >= 0; i--) {\n\t\tif (!buttons[i]?.disabled) return i;\n\t}\n\treturn -1;\n}\n\nexport {\n\tapplyRovingTabindex,\n\tfindNextDropdownItem,\n\tnavigateGrid,\n} from '../shared/KeyboardNav.js';\n\n/**\n * Resolves a horizontal navigation direction based on text direction.\n * In RTL, ArrowRight moves backward (-1) and ArrowLeft moves forward (1).\n */\nexport function resolveHorizontalDirection(\n\tkey: 'ArrowRight' | 'ArrowLeft',\n\tisRtl: boolean,\n): 1 | -1 {\n\tif (key === 'ArrowRight') return isRtl ? -1 : 1;\n\treturn isRtl ? 1 : -1;\n}\n","/** Locale interface and default English locale for the ToolbarPlugin. */\n\nimport { type LocaleModuleMap, loadLocaleModule } from '../shared/LocaleLoader.js';\n\n// --- Locale Interface ---\n\nexport interface ToolbarLocale {\n\treadonly formattingOptionsAria: string;\n\treadonly moreToolsAria: string;\n\treadonly gridPickerLabel: (rows: number, cols: number) => string;\n}\n\n// --- Default English Locale ---\n\nexport const TOOLBAR_LOCALE_EN: ToolbarLocale = {\n\tformattingOptionsAria: 'Formatting options',\n\tmoreToolsAria: 'More tools',\n\tgridPickerLabel: (rows: number, cols: number) => `${rows} x ${cols}`,\n};\n\n// --- Lazy Locale Loader ---\n\nconst localeModules: LocaleModuleMap<ToolbarLocale> = import.meta.glob<{\n\tdefault: ToolbarLocale;\n}>('./locales/*.ts', { eager: false });\n\nexport async function loadToolbarLocale(lang: string): Promise<ToolbarLocale> {\n\treturn loadLocaleModule(localeModules, lang, TOOLBAR_LOCALE_EN);\n}\n","/**\n * Controls how the toolbar responds when items exceed the available width.\n *\n * @example\n * ```typescript\n * const editor = await createEditor({\n * toolbar: {\n * groups: [[BoldPlugin, ItalicPlugin], [HeadingPlugin]],\n * overflow: ToolbarOverflowBehavior.Flow,\n * },\n * });\n * ```\n */\nexport const ToolbarOverflowBehavior = {\n\t/** Items that don't fit are hidden behind a \"...\" dropdown button. Default. */\n\tBurgerMenu: 'burger-menu',\n\t/** Toolbar wraps to additional rows when items overflow. Pure CSS, no JS measurement. */\n\tFlow: 'flow',\n\t/** No responsive behavior; the toolbar clips at the container boundary. */\n\tNone: 'none',\n} as const;\n\nexport type ToolbarOverflowBehavior =\n\t(typeof ToolbarOverflowBehavior)[keyof typeof ToolbarOverflowBehavior];\n","/**\n * ToolbarOverflowController: manages responsive toolbar overflow.\n * Uses ResizeObserver to detect when items exceed available width,\n * hides overflow items, and shows a \"more\" dropdown button.\n * Delegates popup lifecycle to PopupManager when available.\n */\n\nimport { isRtlContext } from '../../platform/Platform.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { PluginContext } from '../Plugin.js';\nimport { findNextDropdownItem } from '../shared/KeyboardNav.js';\nimport type { PopupHandle, PopupManager } from '../shared/PopupManager.js';\nimport { appendToRoot, positionPopup } from '../shared/PopupPositioning.js';\nimport type { ToolbarItem } from './ToolbarItem.js';\n\n// --- Types ---\n\ninterface OverflowEntry {\n\treadonly element: HTMLButtonElement;\n\treadonly item: ToolbarItem;\n}\n\ntype OnOverflowChange = (\n\tvisibleButtons: readonly HTMLButtonElement[],\n\toverflowButton: HTMLButtonElement | null,\n) => void;\n\ntype OnItemActivated = (overflowButton: HTMLButtonElement, item: ToolbarItem) => void;\n\nexport interface OverflowControllerConfig {\n\treadonly toolbar: HTMLElement;\n\treadonly ariaLabel: string;\n\treadonly context: PluginContext;\n\treadonly onOverflowChange: OnOverflowChange;\n\treadonly onItemActivated: OnItemActivated;\n\treadonly getActiveElement: () => Element | null;\n\treadonly popupManager?: PopupManager;\n}\n\n// --- Constants ---\n\nconst OVERFLOW_BTN_WIDTH = 34;\nconst GAP = 2;\nconst HIDDEN_BTN_CLASS = 'notectl-toolbar-btn--overflow-hidden';\nconst HIDDEN_SEP_CLASS = 'notectl-toolbar-separator--overflow-hidden';\nconst HIDDEN_GROUP_CLASS = 'notectl-toolbar-group--overflow-hidden';\nconst HIDDEN_OVERFLOW_CLASS = 'notectl-toolbar-overflow-btn--hidden';\nconst GROUP_CLASS = 'notectl-toolbar-group';\nconst SEPARATOR_CLASS = 'notectl-toolbar-separator';\nconst BUTTON_CLASS = 'notectl-toolbar-btn';\nconst ELLIPSIS_SVG =\n\t'<svg viewBox=\"0 0 16 16\" width=\"16\" height=\"16\"><circle cx=\"3\" cy=\"8\" r=\"1.5\" fill=\"currentColor\"/><circle cx=\"8\" cy=\"8\" r=\"1.5\" fill=\"currentColor\"/><circle cx=\"13\" cy=\"8\" r=\"1.5\" fill=\"currentColor\"/></svg>';\n\n// --- Controller ---\n\nexport class ToolbarOverflowController {\n\tprivate readonly toolbar: HTMLElement;\n\tprivate readonly context: PluginContext;\n\tprivate readonly onOverflowChange: OnOverflowChange;\n\tprivate readonly onItemActivated: OnItemActivated;\n\tprivate readonly getActiveElement: () => Element | null;\n\tprivate readonly ariaLabel: string;\n\tprivate readonly popupManager: PopupManager | null;\n\n\tprivate entries: OverflowEntry[] = [];\n\tprivate overflowButton: HTMLButtonElement | null = null;\n\tprivate overflowDropdown: HTMLElement | null = null;\n\tprivate overflowHandle: PopupHandle | null = null;\n\tprivate overflowEntries: OverflowEntry[] = [];\n\tprivate resizeObserver: ResizeObserver | null = null;\n\tprivate closeHandler: ((e: MouseEvent) => void) | null = null;\n\tprivate closeHandlerTimer: ReturnType<typeof setTimeout> | null = null;\n\tprivate closeHandlerAttached = false;\n\n\tconstructor(config: OverflowControllerConfig) {\n\t\tthis.toolbar = config.toolbar;\n\t\tthis.ariaLabel = config.ariaLabel;\n\t\tthis.context = config.context;\n\t\tthis.onOverflowChange = config.onOverflowChange;\n\t\tthis.onItemActivated = config.onItemActivated;\n\t\tthis.getActiveElement = config.getActiveElement;\n\t\tthis.popupManager = config.popupManager ?? null;\n\n\t\tthis.resizeObserver = new ResizeObserver(() => this.recalculate());\n\t\tthis.resizeObserver.observe(this.toolbar);\n\t}\n\n\t/** Called after renderItems() — stores button references and recalculates. */\n\tupdate(buttons: readonly { element: HTMLButtonElement; item: ToolbarItem }[]): void {\n\t\tthis.entries = buttons.map((b) => ({ element: b.element, item: b.item }));\n\t\tthis.recalculate();\n\t}\n\n\t/**\n\t * Measures the toolbar and redistributes content between visible and overflow.\n\t *\n\t * Overflow unit is the **group wrapper** (`.notectl-toolbar-group`), not individual\n\t * buttons — when any button in a group would not fit, the whole group moves to the\n\t * overflow dropdown so logical clusters stay together. Standalone buttons appended\n\t * directly to the toolbar (legacy / test setups) are treated as single-button groups.\n\t */\n\trecalculate(): void {\n\t\tif (this.entries.length === 0) return;\n\n\t\tthis.closeDropdown();\n\t\tthis.resetVisibility();\n\t\tthis.ensureOverflowButton();\n\t\tthis.setOverflowButtonVisible(false);\n\n\t\t// Phase 1 — Measure (reads only): batch all layout reads before any writes\n\t\tconst availableWidth: number = this.measureAvailableWidth();\n\t\tconst children: HTMLElement[] = Array.from(this.toolbar.children) as HTMLElement[];\n\t\tconst childWidths: Map<HTMLElement, number> = this.measureChildWidths(children);\n\n\t\t// Phase 2 — Apply (writes only): use cached widths, no layout reads\n\t\tconst maxWidth: number = availableWidth - OVERFLOW_BTN_WIDTH - GAP;\n\t\tlet usedWidth = 0;\n\t\tlet overflowing = false;\n\t\tconst overflowList: OverflowEntry[] = [];\n\n\t\tfor (const child of children) {\n\t\t\tif (child === this.overflowButton) continue;\n\n\t\t\tif (child.classList.contains(SEPARATOR_CLASS)) {\n\t\t\t\tconst sepWidth: number = (childWidths.get(child) ?? 0) + GAP;\n\t\t\t\tif (overflowing || usedWidth + sepWidth > maxWidth) {\n\t\t\t\t\toverflowing = true;\n\t\t\t\t\tchild.classList.add(HIDDEN_SEP_CLASS);\n\t\t\t\t} else {\n\t\t\t\t\tusedWidth += sepWidth;\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (child.classList.contains(GROUP_CLASS)) {\n\t\t\t\tconst groupWidth: number = (childWidths.get(child) ?? 0) + GAP;\n\t\t\t\tconst groupEntries: OverflowEntry[] = this.entriesInside(child);\n\t\t\t\tif (overflowing || usedWidth + groupWidth > maxWidth) {\n\t\t\t\t\toverflowing = true;\n\t\t\t\t\tthis.hideGroup(child, groupEntries, overflowList);\n\t\t\t\t} else {\n\t\t\t\t\tusedWidth += groupWidth;\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Standalone button (used by tests that append buttons directly to the toolbar)\n\t\t\tconst entry: OverflowEntry | undefined = this.entries.find((oe) => oe.element === child);\n\t\t\tif (!entry) continue;\n\n\t\t\tconst btnWidth: number = (childWidths.get(child) ?? 0) + GAP;\n\t\t\tif (overflowing || usedWidth + btnWidth > maxWidth) {\n\t\t\t\toverflowing = true;\n\t\t\t\tentry.element.classList.add(HIDDEN_BTN_CLASS);\n\t\t\t\toverflowList.push(entry);\n\t\t\t} else {\n\t\t\t\tusedWidth += btnWidth;\n\t\t\t}\n\t\t}\n\n\t\tthis.overflowEntries = overflowList;\n\t\tthis.hideTrailingSeparators();\n\t\tthis.setOverflowButtonVisible(overflowList.length > 0);\n\t\tthis.notifyChange();\n\t}\n\n\t/**\n\t * Hides a group wrapper and marks every entry inside it as overflowed.\n\t * Marking individual buttons too keeps `notifyChange()` filter logic uniform.\n\t */\n\tprivate hideGroup(\n\t\tgroup: HTMLElement,\n\t\tentries: readonly OverflowEntry[],\n\t\toverflowList: OverflowEntry[],\n\t): void {\n\t\tgroup.classList.add(HIDDEN_GROUP_CLASS);\n\t\tfor (const entry of entries) {\n\t\t\tentry.element.classList.add(HIDDEN_BTN_CLASS);\n\t\t\toverflowList.push(entry);\n\t\t}\n\t}\n\n\tprivate entriesInside(group: HTMLElement): OverflowEntry[] {\n\t\tconst result: OverflowEntry[] = [];\n\t\tfor (const entry of this.entries) {\n\t\t\tif (group.contains(entry.element)) {\n\t\t\t\tresult.push(entry);\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t}\n\n\t/** Updates active/disabled states for items in the open overflow dropdown. */\n\tupdateItemStates(state: EditorState): void {\n\t\tif (!this.overflowDropdown) return;\n\n\t\tconst menuItems: HTMLButtonElement[] = Array.from(\n\t\t\tthis.overflowDropdown.querySelectorAll('.notectl-dropdown__item'),\n\t\t) as HTMLButtonElement[];\n\n\t\tfor (const menuItem of menuItems) {\n\t\t\tconst itemId: string | null = menuItem.getAttribute('data-toolbar-item');\n\t\t\tconst entry: OverflowEntry | undefined = this.overflowEntries.find(\n\t\t\t\t(oe) => oe.item.id === itemId,\n\t\t\t);\n\t\t\tif (!entry) continue;\n\n\t\t\tconst active: boolean = entry.item.isActive?.(state) ?? false;\n\t\t\tconst enabled: boolean = entry.item.isEnabled?.(state) ?? true;\n\t\t\tmenuItem.classList.toggle('notectl-dropdown__item--active', active);\n\t\t\tmenuItem.disabled = !enabled;\n\n\t\t\tif (entry.item.popupType === 'combobox') {\n\t\t\t\tconst labelEl: HTMLSpanElement | null = menuItem.querySelector(\n\t\t\t\t\t'.notectl-dropdown__item-label',\n\t\t\t\t);\n\t\t\t\tif (labelEl) {\n\t\t\t\t\tlabelEl.textContent = entry.item.getLabel(state);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (entry.item.getIcon) {\n\t\t\t\tconst newIcon: string = entry.item.getIcon(state);\n\t\t\t\tconst iconEl: HTMLSpanElement | null = menuItem.querySelector(\n\t\t\t\t\t'.notectl-dropdown__item-icon',\n\t\t\t\t);\n\t\t\t\tif (iconEl && iconEl.innerHTML !== newIcon) {\n\t\t\t\t\ticonEl.innerHTML = newIcon;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/** Cleans up ResizeObserver, DOM elements, and event listeners. */\n\tdestroy(): void {\n\t\tthis.resizeObserver?.disconnect();\n\t\tthis.resizeObserver = null;\n\t\tthis.closeDropdown();\n\t\tthis.overflowButton?.remove();\n\t\tthis.overflowButton = null;\n\t\tthis.entries = [];\n\t\tthis.overflowEntries = [];\n\t}\n\n\t// --- Measurement ---\n\n\tprivate measureChildWidths(children: readonly HTMLElement[]): Map<HTMLElement, number> {\n\t\tconst widths: Map<HTMLElement, number> = new Map();\n\t\tfor (const child of children) {\n\t\t\tif (child === this.overflowButton) continue;\n\t\t\twidths.set(child, child.offsetWidth);\n\t\t}\n\t\treturn widths;\n\t}\n\n\tprivate measureAvailableWidth(): number {\n\t\tconst toolbarStyle: CSSStyleDeclaration = getComputedStyle(this.toolbar);\n\t\tconst paddingLeft: number = Number.parseFloat(toolbarStyle.paddingLeft) || 0;\n\t\tconst paddingRight: number = Number.parseFloat(toolbarStyle.paddingRight) || 0;\n\t\treturn this.toolbar.clientWidth - paddingLeft - paddingRight;\n\t}\n\n\tprivate resetVisibility(): void {\n\t\tfor (const entry of this.entries) {\n\t\t\tentry.element.classList.remove(HIDDEN_BTN_CLASS);\n\t\t}\n\t\tconst separators: HTMLElement[] = Array.from(\n\t\t\tthis.toolbar.querySelectorAll(`.${SEPARATOR_CLASS}`),\n\t\t) as HTMLElement[];\n\t\tfor (const sep of separators) {\n\t\t\tsep.classList.remove(HIDDEN_SEP_CLASS);\n\t\t}\n\t\tconst groups: HTMLElement[] = Array.from(\n\t\t\tthis.toolbar.querySelectorAll(`.${GROUP_CLASS}`),\n\t\t) as HTMLElement[];\n\t\tfor (const grp of groups) {\n\t\t\tgrp.classList.remove(HIDDEN_GROUP_CLASS);\n\t\t}\n\t}\n\n\t// --- Overflow Button ---\n\n\tprivate setOverflowButtonVisible(visible: boolean): void {\n\t\tif (!this.overflowButton) return;\n\t\tthis.overflowButton.classList.toggle(HIDDEN_OVERFLOW_CLASS, !visible);\n\t\tif (!visible) {\n\t\t\tthis.overflowButton.removeAttribute('tabindex');\n\t\t}\n\t}\n\n\tprivate ensureOverflowButton(): void {\n\t\tif (this.overflowButton) return;\n\n\t\tconst btn: HTMLButtonElement = document.createElement('button');\n\t\tbtn.type = 'button';\n\t\tbtn.className = 'notectl-toolbar-overflow-btn';\n\t\tbtn.setAttribute('aria-label', this.ariaLabel);\n\t\tbtn.setAttribute('aria-haspopup', 'true');\n\t\tbtn.setAttribute('aria-expanded', 'false');\n\t\tbtn.setAttribute('part', 'toolbar-button toolbar-overflow-button');\n\t\tbtn.innerHTML = ELLIPSIS_SVG;\n\n\t\tbtn.addEventListener('mousedown', (e: MouseEvent) => {\n\t\t\te.preventDefault();\n\t\t\tthis.toggleDropdown();\n\t\t});\n\n\t\tthis.toolbar.appendChild(btn);\n\t\tthis.overflowButton = btn;\n\t}\n\n\t// --- Dropdown ---\n\n\tprivate toggleDropdown(): void {\n\t\tif (this.overflowDropdown) {\n\t\t\tthis.closeDropdown();\n\t\t} else {\n\t\t\tthis.openDropdown();\n\t\t}\n\t}\n\n\tprivate openDropdown(): void {\n\t\tif (!this.overflowButton || this.overflowEntries.length === 0) return;\n\n\t\tconst dropdown: HTMLDivElement = document.createElement('div');\n\t\tdropdown.className = 'notectl-toolbar-popup notectl-dropdown';\n\t\tdropdown.setAttribute('role', 'menu');\n\n\t\tthis.renderDropdownItems(dropdown, this.context.getState());\n\n\t\tif (this.popupManager) {\n\t\t\tthis.overflowHandle = this.popupManager.open({\n\t\t\t\tanchor: this.overflowButton,\n\t\t\t\tclassName: 'notectl-toolbar-popup notectl-dropdown',\n\t\t\t\tariaRole: 'menu',\n\t\t\t\tposition: 'below-end',\n\t\t\t\treferenceNode: this.overflowButton,\n\t\t\t\trestoreFocusTo: this.overflowButton,\n\t\t\t\tonClose: () => {\n\t\t\t\t\tthis.overflowHandle = null;\n\t\t\t\t\tthis.overflowDropdown = null;\n\t\t\t\t\tif (this.overflowButton) {\n\t\t\t\t\t\tthis.overflowButton.setAttribute('aria-expanded', 'false');\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tcontent: (popup: HTMLElement) => {\n\t\t\t\t\tthis.renderDropdownItems(popup, this.context.getState());\n\t\t\t\t\tthis.overflowDropdown = popup;\n\t\t\t\t\tpopup.addEventListener('keydown', (e: KeyboardEvent) => this.handleDropdownKeydown(e));\n\t\t\t\t},\n\t\t\t});\n\t\t\tthis.overflowButton.setAttribute('aria-expanded', 'true');\n\t\t} else {\n\t\t\tthis.positionDropdown(dropdown);\n\t\t\tappendToRoot(dropdown, this.overflowButton);\n\t\t\tthis.overflowDropdown = dropdown;\n\t\t\tthis.overflowButton.setAttribute('aria-expanded', 'true');\n\n\t\t\trequestAnimationFrame(() => {\n\t\t\t\tconst first: HTMLElement | null = dropdown.querySelector('[role=\"menuitem\"]');\n\t\t\t\tfirst?.focus();\n\t\t\t});\n\n\t\t\tdropdown.addEventListener('keydown', (e: KeyboardEvent) => this.handleDropdownKeydown(e));\n\t\t\tthis.registerCloseHandler();\n\t\t}\n\t}\n\n\tprivate renderDropdownItems(dropdown: HTMLElement, state: EditorState): void {\n\t\tlet lastGroup: string | null = null;\n\n\t\tfor (const entry of this.overflowEntries) {\n\t\t\tif (lastGroup !== null && entry.item.group !== lastGroup) {\n\t\t\t\tconst sep: HTMLDivElement = document.createElement('div');\n\t\t\t\tsep.className = 'notectl-dropdown__separator';\n\t\t\t\tsep.setAttribute('role', 'separator');\n\t\t\t\tdropdown.appendChild(sep);\n\t\t\t}\n\t\t\tlastGroup = entry.item.group;\n\n\t\t\tconst menuBtn: HTMLButtonElement = document.createElement('button');\n\t\t\tmenuBtn.type = 'button';\n\t\t\tmenuBtn.className = 'notectl-dropdown__item';\n\t\t\tmenuBtn.setAttribute('role', 'menuitem');\n\t\t\tmenuBtn.setAttribute('tabindex', '-1');\n\t\t\tmenuBtn.setAttribute('data-toolbar-item', entry.item.id);\n\n\t\t\tconst iconSpan: HTMLSpanElement = document.createElement('span');\n\t\t\ticonSpan.className = 'notectl-dropdown__item-icon';\n\t\t\tif (entry.item.popupType !== 'combobox') {\n\t\t\t\ticonSpan.innerHTML = entry.item.icon;\n\t\t\t}\n\t\t\tmenuBtn.appendChild(iconSpan);\n\n\t\t\tconst labelSpan: HTMLSpanElement = document.createElement('span');\n\t\t\tlabelSpan.className = 'notectl-dropdown__item-label';\n\t\t\tlabelSpan.textContent =\n\t\t\t\tentry.item.popupType === 'combobox'\n\t\t\t\t\t? entry.item.getLabel(state)\n\t\t\t\t\t: (entry.item.tooltip ?? entry.item.label);\n\t\t\tmenuBtn.appendChild(labelSpan);\n\n\t\t\tmenuBtn.addEventListener('mousedown', (ev: MouseEvent) => {\n\t\t\t\tev.preventDefault();\n\t\t\t\tev.stopPropagation();\n\t\t\t\tthis.activateOverflowItem(entry);\n\t\t\t});\n\n\t\t\tdropdown.appendChild(menuBtn);\n\t\t}\n\t}\n\n\tprivate positionDropdown(dropdown: HTMLElement): void {\n\t\tif (!this.overflowButton) return;\n\n\t\tconst rect: DOMRect = this.overflowButton.getBoundingClientRect();\n\t\tconst rtl: boolean = isRtlContext(this.toolbar);\n\n\t\tpositionPopup(dropdown, rect, { position: rtl ? 'below-start' : 'below-end', isRtl: rtl });\n\t}\n\n\tprivate registerCloseHandler(): void {\n\t\tthis.closeHandler = (ev: MouseEvent) => {\n\t\t\tconst path: EventTarget[] = ev.composedPath();\n\t\t\tif (\n\t\t\t\tthis.overflowDropdown &&\n\t\t\t\t!path.includes(this.overflowDropdown) &&\n\t\t\t\tthis.overflowButton &&\n\t\t\t\t!path.includes(this.overflowButton)\n\t\t\t) {\n\t\t\t\tthis.closeDropdown();\n\t\t\t}\n\t\t};\n\t\tthis.closeHandlerTimer = setTimeout(() => {\n\t\t\tthis.closeHandlerTimer = null;\n\t\t\tif (!this.closeHandler || !this.overflowDropdown) return;\n\t\t\tdocument.addEventListener('mousedown', this.closeHandler);\n\t\t\tthis.closeHandlerAttached = true;\n\t\t}, 0);\n\t}\n\n\tprivate closeDropdown(): void {\n\t\tif (this.overflowHandle) {\n\t\t\tconst handle: PopupHandle = this.overflowHandle;\n\t\t\tthis.overflowHandle = null;\n\t\t\tthis.overflowDropdown = null;\n\t\t\thandle.close();\n\t\t\tif (this.overflowButton) {\n\t\t\t\tthis.overflowButton.setAttribute('aria-expanded', 'false');\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tif (this.overflowDropdown) {\n\t\t\tthis.overflowDropdown.remove();\n\t\t\tthis.overflowDropdown = null;\n\t\t}\n\t\tif (this.overflowButton) {\n\t\t\tthis.overflowButton.setAttribute('aria-expanded', 'false');\n\t\t}\n\t\tif (this.closeHandler) {\n\t\t\tif (this.closeHandlerTimer !== null) {\n\t\t\t\tclearTimeout(this.closeHandlerTimer);\n\t\t\t\tthis.closeHandlerTimer = null;\n\t\t\t}\n\t\t\tif (this.closeHandlerAttached) {\n\t\t\t\tdocument.removeEventListener('mousedown', this.closeHandler);\n\t\t\t\tthis.closeHandlerAttached = false;\n\t\t\t}\n\t\t\tthis.closeHandler = null;\n\t\t}\n\t}\n\n\tprivate activateOverflowItem(entry: OverflowEntry): void {\n\t\tthis.closeDropdown();\n\t\tif (entry.item.popupType && this.overflowButton) {\n\t\t\tthis.onItemActivated(this.overflowButton, entry.item);\n\t\t} else {\n\t\t\tthis.context.executeCommand(entry.item.command);\n\t\t}\n\t}\n\n\t// --- Keyboard Navigation ---\n\n\tprivate handleDropdownKeydown(e: KeyboardEvent): void {\n\t\tif (!this.overflowDropdown) return;\n\n\t\tif (e.key === 'Escape' || e.key === 'Tab') {\n\t\t\te.preventDefault();\n\t\t\te.stopPropagation();\n\t\t\tthis.closeDropdown();\n\t\t\tthis.overflowButton?.focus();\n\t\t\treturn;\n\t\t}\n\n\t\tconst items: HTMLElement[] = Array.from(\n\t\t\tthis.overflowDropdown.querySelectorAll('[role=\"menuitem\"]'),\n\t\t) as HTMLElement[];\n\t\tconst current: number = items.indexOf(this.getActiveElement() as HTMLElement);\n\n\t\tswitch (e.key) {\n\t\t\tcase 'ArrowDown': {\n\t\t\t\te.preventDefault();\n\t\t\t\tconst next: number = findNextDropdownItem(items, current, 1);\n\t\t\t\titems[next]?.focus();\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase 'ArrowUp': {\n\t\t\t\te.preventDefault();\n\t\t\t\tconst prev: number = findNextDropdownItem(items, current, -1);\n\t\t\t\titems[prev]?.focus();\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase 'Enter':\n\t\t\tcase ' ': {\n\t\t\t\te.preventDefault();\n\t\t\t\tconst focusedItem: HTMLElement | undefined = items[current];\n\t\t\t\tif (!focusedItem) break;\n\t\t\t\tconst itemId: string | null = focusedItem.getAttribute('data-toolbar-item');\n\t\t\t\tconst entry: OverflowEntry | undefined = this.overflowEntries.find(\n\t\t\t\t\t(oe) => oe.item.id === itemId,\n\t\t\t\t);\n\t\t\t\tif (entry) this.activateOverflowItem(entry);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\t// --- Helpers ---\n\n\tprivate hideTrailingSeparators(): void {\n\t\tconst children: HTMLElement[] = Array.from(this.toolbar.children) as HTMLElement[];\n\t\tfor (let i = children.length - 1; i >= 0; i--) {\n\t\t\tconst child: HTMLElement | undefined = children[i];\n\t\t\tif (!child || child === this.overflowButton) continue;\n\t\t\tif (child.classList.contains(SEPARATOR_CLASS)) {\n\t\t\t\tif (!child.classList.contains(HIDDEN_SEP_CLASS)) {\n\t\t\t\t\tchild.classList.add(HIDDEN_SEP_CLASS);\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst isHiddenGroup: boolean =\n\t\t\t\tchild.classList.contains(GROUP_CLASS) && child.classList.contains(HIDDEN_GROUP_CLASS);\n\t\t\tconst isHiddenButton: boolean =\n\t\t\t\tchild.classList.contains(BUTTON_CLASS) && child.classList.contains(HIDDEN_BTN_CLASS);\n\t\t\tif (isHiddenGroup || isHiddenButton) continue;\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tprivate notifyChange(): void {\n\t\tconst visible: HTMLButtonElement[] = this.entries\n\t\t\t.filter((oe) => !oe.element.classList.contains(HIDDEN_BTN_CLASS))\n\t\t\t.map((oe) => oe.element);\n\t\tthis.onOverflowChange(visible, this.overflowEntries.length > 0 ? this.overflowButton : null);\n\t}\n}\n","/**\n * ToolbarRenderers: pure rendering functions for toolbar popup content.\n * Grid pickers, dropdown menus, and separator elements.\n */\n\nimport { setStyleProperties } from '../../style/StyleRuntime.js';\nimport type { DropdownConfig, GridPickerConfig } from './ToolbarItem.js';\nimport { TOOLBAR_LOCALE_EN, type ToolbarLocale } from './ToolbarLocale.js';\n\nconst HIGHLIGHTED_CLASS = 'notectl-grid-picker__cell--highlighted';\n\n/**\n * Renders a grid picker into the given container.\n * Calls `onClose` after a cell is selected so the popup can be dismissed.\n */\nexport function renderGridPicker(\n\tcontainer: HTMLElement,\n\tconfig: GridPickerConfig,\n\tonClose: () => void,\n\tlocale: ToolbarLocale = TOOLBAR_LOCALE_EN,\n): void {\n\tcontainer.className += ' notectl-grid-picker';\n\n\tconst grid: HTMLDivElement = document.createElement('div');\n\tgrid.className = 'notectl-grid-picker__grid';\n\tgrid.setAttribute('role', 'grid');\n\tsetStyleProperties(grid, {\n\t\tdisplay: 'grid',\n\t\tgridTemplateColumns: `repeat(${config.maxCols}, 1fr)`,\n\t\tgap: '2px',\n\t\tpadding: '8px',\n\t});\n\n\tconst label: HTMLDivElement = document.createElement('div');\n\tlabel.className = 'notectl-grid-picker__label';\n\tlabel.textContent = locale.gridPickerLabel(1, 1);\n\tsetStyleProperties(label, {\n\t\ttextAlign: 'center',\n\t\tpadding: '4px',\n\t\tfontSize: '12px',\n\t});\n\tlabel.setAttribute('aria-live', 'polite');\n\n\tfor (let r = 1; r <= config.maxRows; r++) {\n\t\tfor (let c = 1; c <= config.maxCols; c++) {\n\t\t\tconst cell: HTMLDivElement = document.createElement('div');\n\t\t\tcell.className = 'notectl-grid-picker__cell';\n\t\t\tcell.setAttribute('role', 'gridcell');\n\t\t\tcell.setAttribute('tabindex', '-1');\n\t\t\tcell.setAttribute('aria-label', locale.gridPickerLabel(r, c));\n\t\t\tsetStyleProperties(cell, {\n\t\t\t\twidth: '20px',\n\t\t\t\theight: '20px',\n\t\t\t\tborder: '1px solid #ccc',\n\t\t\t\tcursor: 'pointer',\n\t\t\t});\n\t\t\tcell.setAttribute('data-row', String(r));\n\t\t\tcell.setAttribute('data-col', String(c));\n\n\t\t\tcell.addEventListener('mouseenter', () => {\n\t\t\t\thighlightCells(grid, r, c);\n\t\t\t\tlabel.textContent = locale.gridPickerLabel(r, c);\n\t\t\t});\n\n\t\t\tcell.addEventListener('mousedown', (e: MouseEvent) => {\n\t\t\t\te.preventDefault();\n\t\t\t\te.stopPropagation();\n\t\t\t});\n\n\t\t\tcell.addEventListener('click', () => {\n\t\t\t\tconfig.onSelect(r, c);\n\t\t\t\tonClose();\n\t\t\t});\n\n\t\t\tgrid.appendChild(cell);\n\t\t}\n\t}\n\n\tcontainer.appendChild(grid);\n\tcontainer.appendChild(label);\n}\n\n/**\n * Highlights grid cells up to the given row/col and updates the label.\n * Used by both mouse hover and keyboard navigation.\n */\nexport function highlightCells(grid: HTMLElement, targetRow: number, targetCol: number): void {\n\tconst cells: NodeListOf<Element> = grid.querySelectorAll('.notectl-grid-picker__cell');\n\tfor (const cell of cells) {\n\t\tconst r: number = Number(cell.getAttribute('data-row'));\n\t\tconst c: number = Number(cell.getAttribute('data-col'));\n\t\tcell.classList.toggle(HIGHLIGHTED_CLASS, r <= targetRow && c <= targetCol);\n\t}\n}\n\n/**\n * Renders a dropdown menu into the given container.\n * Calls `onClose` after an item is activated so the popup can be dismissed.\n */\nexport function renderDropdown(\n\tcontainer: HTMLElement,\n\tconfig: DropdownConfig,\n\texecuteCommand: (command: string) => void,\n\tonClose: () => void,\n): void {\n\tcontainer.classList.add('notectl-dropdown');\n\tcontainer.setAttribute('role', 'menu');\n\n\tfor (const item of config.items) {\n\t\tconst btn: HTMLButtonElement = document.createElement('button');\n\t\tbtn.type = 'button';\n\t\tbtn.className = 'notectl-dropdown__item';\n\t\tbtn.setAttribute('role', 'menuitem');\n\t\tbtn.setAttribute('tabindex', '-1');\n\n\t\tif (item.icon) {\n\t\t\tconst iconSpan: HTMLSpanElement = document.createElement('span');\n\t\t\ticonSpan.className = 'notectl-dropdown__item-icon';\n\t\t\ticonSpan.innerHTML = item.icon;\n\t\t\tbtn.appendChild(iconSpan);\n\t\t}\n\n\t\tconst labelSpan: HTMLSpanElement = document.createElement('span');\n\t\tlabelSpan.className = 'notectl-dropdown__item-label';\n\t\tlabelSpan.textContent = item.label;\n\t\tbtn.appendChild(labelSpan);\n\n\t\tbtn.addEventListener('mousedown', (e: MouseEvent) => {\n\t\t\te.preventDefault();\n\t\t\te.stopPropagation();\n\t\t});\n\n\t\tbtn.addEventListener('click', () => {\n\t\t\texecuteCommand(item.command);\n\t\t\tonClose();\n\t\t});\n\n\t\tcontainer.appendChild(btn);\n\t}\n}\n\n/** Creates a toolbar group separator element. */\nexport function createSeparator(): HTMLSpanElement {\n\tconst sep: HTMLSpanElement = document.createElement('span');\n\tsep.className = 'notectl-toolbar-separator';\n\tsep.setAttribute('role', 'separator');\n\tsep.setAttribute('part', 'toolbar-divider');\n\treturn sep;\n}\n","/**\n * ToolbarPopupController: manages popup lifecycle, positioning, keyboard\n * navigation, and auto-close for toolbar popups (grid pickers, dropdowns,\n * and custom popups). Delegates lifecycle to PopupManager.\n */\n\nimport { isRtlContext } from '../../platform/Platform.js';\nimport type { PluginContext } from '../Plugin.js';\nimport { findNextDropdownItem, navigateGrid } from '../shared/KeyboardNav.js';\nimport type { PopupCloseOptions, PopupHandle, PopupManager } from '../shared/PopupManager.js';\nimport type { ToolbarItem } from './ToolbarItem.js';\nimport { TOOLBAR_LOCALE_EN, type ToolbarLocale } from './ToolbarLocale.js';\nimport { highlightCells, renderDropdown, renderGridPicker } from './ToolbarRenderers.js';\n\nexport class ToolbarPopupController {\n\tprivate activePopup: HTMLElement | null = null;\n\tprivate activePopupButton: HTMLButtonElement | null = null;\n\tprivate activeHandle: PopupHandle | null = null;\n\tprivate readonly getActiveElement: () => Element | null;\n\tprivate readonly locale: ToolbarLocale;\n\tprivate popupManager: PopupManager | null = null;\n\n\tconstructor(getActiveElement: () => Element | null, locale: ToolbarLocale = TOOLBAR_LOCALE_EN) {\n\t\tthis.getActiveElement = getActiveElement;\n\t\tthis.locale = locale;\n\t}\n\n\t/** Injects the PopupManager instance (called after service registration). */\n\tsetPopupManager(manager: PopupManager): void {\n\t\tthis.popupManager = manager;\n\t}\n\n\t/** Whether a popup is currently open. */\n\tisOpen(): boolean {\n\t\treturn this.activePopup !== null;\n\t}\n\n\t/** Toggles a popup for the given toolbar button. */\n\ttoggle(button: HTMLButtonElement, item: ToolbarItem, context: PluginContext): void {\n\t\tif (this.activePopup) {\n\t\t\tthis.close();\n\t\t\treturn;\n\t\t}\n\n\t\tthis.openViaManager(button, item, context);\n\t}\n\n\t/** Closes the active popup and cleans up event listeners. */\n\tclose(): void {\n\t\tif (this.activeHandle) {\n\t\t\t// Prevent onClose callback from re-entering\n\t\t\tconst handle: PopupHandle = this.activeHandle;\n\t\t\tthis.activeHandle = null;\n\t\t\tthis.clearButtonState();\n\t\t\thandle.close();\n\t\t\treturn;\n\t\t}\n\n\t\tthis.clearButtonState();\n\t\tif (this.activePopup) {\n\t\t\tthis.activePopup.remove();\n\t\t\tthis.activePopup = null;\n\t\t}\n\t}\n\n\t/** Closes popup and restores focus to the trigger button. */\n\tcloseAndRestoreFocus(): void {\n\t\tconst triggerBtn: HTMLButtonElement | null = this.activePopupButton;\n\t\tthis.close();\n\t\ttriggerBtn?.focus();\n\t}\n\n\tdestroy(): void {\n\t\tthis.close();\n\t}\n\n\t// --- PopupManager path ---\n\n\tprivate openViaManager(\n\t\tbutton: HTMLButtonElement,\n\t\titem: ToolbarItem,\n\t\tcontext: PluginContext,\n\t): void {\n\t\tif (!this.popupManager) return;\n\n\t\tthis.activePopupButton = button;\n\t\tbutton.classList.add('notectl-toolbar-btn--popup-open');\n\t\tbutton.setAttribute('aria-expanded', 'true');\n\n\t\tthis.activeHandle = this.popupManager.open({\n\t\t\tanchor: button,\n\t\t\tclassName: 'notectl-toolbar-popup',\n\t\t\treferenceNode: button,\n\t\t\trestoreFocusTo: button,\n\t\t\tposition: 'below-start',\n\t\t\tonClose: () => {\n\t\t\t\t// Called when PopupManager closes the popup (click-outside, etc.)\n\t\t\t\tthis.activeHandle = null;\n\t\t\t\tthis.clearButtonState();\n\t\t\t\tthis.activePopup = null;\n\t\t\t},\n\t\t\tcontent: (popup: HTMLElement, close: (options?: PopupCloseOptions) => void) => {\n\t\t\t\tthis.activePopup = popup;\n\t\t\t\tthis.renderPopupContent(popup, item, context, close);\n\t\t\t\tpopup.addEventListener('keydown', (e: KeyboardEvent) => this.handlePopupKeydown(e));\n\t\t\t},\n\t\t});\n\t}\n\n\t// --- Shared rendering ---\n\n\tprivate renderPopupContent(\n\t\tpopup: HTMLElement,\n\t\titem: ToolbarItem,\n\t\tcontext: PluginContext,\n\t\tclose: (options?: PopupCloseOptions) => void,\n\t): void {\n\t\tconst closeAndFocusEditor = (): void => {\n\t\t\tclose({ restoreFocusTo: null });\n\t\t\tcontext.getContainer().focus();\n\t\t};\n\n\t\tswitch (item.popupType) {\n\t\t\tcase 'gridPicker':\n\t\t\t\trenderGridPicker(popup, item.popupConfig, closeAndFocusEditor, this.locale);\n\t\t\t\tbreak;\n\t\t\tcase 'dropdown':\n\t\t\t\trenderDropdown(\n\t\t\t\t\tpopup,\n\t\t\t\t\titem.popupConfig,\n\t\t\t\t\t(cmd: string) => context.executeCommand(cmd),\n\t\t\t\t\tcloseAndFocusEditor,\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\tcase 'custom':\n\t\t\t\titem.renderPopup(popup, context, close);\n\t\t\t\tbreak;\n\t\t\tcase 'combobox':\n\t\t\t\titem.renderPopup(popup, context, close);\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\t// --- Button state ---\n\n\tprivate clearButtonState(): void {\n\t\tif (this.activePopupButton) {\n\t\t\tthis.activePopupButton.classList.remove('notectl-toolbar-btn--popup-open');\n\t\t\tthis.activePopupButton.setAttribute('aria-expanded', 'false');\n\t\t\tthis.activePopupButton = null;\n\t\t}\n\t}\n\n\t// --- Keyboard Navigation ---\n\n\tprivate handlePopupKeydown(e: KeyboardEvent): void {\n\t\tif (!this.activePopup) return;\n\n\t\tif (e.key === 'Escape') {\n\t\t\te.preventDefault();\n\t\t\te.stopPropagation();\n\t\t\tthis.closeAndRestoreFocus();\n\t\t\treturn;\n\t\t}\n\n\t\tif (e.key === 'Tab') {\n\t\t\te.preventDefault();\n\t\t\tthis.closeAndRestoreFocus();\n\t\t\treturn;\n\t\t}\n\n\t\tconst menuItems: NodeListOf<Element> = this.activePopup.querySelectorAll('[role=\"menuitem\"]');\n\t\tif (menuItems.length > 0) {\n\t\t\tthis.handleDropdownKeydown(e, menuItems);\n\t\t\treturn;\n\t\t}\n\n\t\tconst hasGrid: boolean = this.activePopup.querySelector('.notectl-grid-picker__cell') !== null;\n\t\tif (hasGrid) {\n\t\t\tthis.handleGridKeydown(e);\n\t\t\treturn;\n\t\t}\n\n\t\tthis.handleCustomPopupKeydown(e);\n\t}\n\n\tprivate handleDropdownKeydown(e: KeyboardEvent, items: NodeListOf<Element>): void {\n\t\tconst itemArr: HTMLElement[] = Array.from(items) as HTMLElement[];\n\t\tconst current: number = itemArr.indexOf(this.getActiveElement() as HTMLElement);\n\n\t\tswitch (e.key) {\n\t\t\tcase 'ArrowDown': {\n\t\t\t\te.preventDefault();\n\t\t\t\tconst next: number = findNextDropdownItem(itemArr, current, 1);\n\t\t\t\titemArr[next]?.focus();\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase 'ArrowUp': {\n\t\t\t\te.preventDefault();\n\t\t\t\tconst prev: number = findNextDropdownItem(itemArr, current, -1);\n\t\t\t\titemArr[prev]?.focus();\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase 'Enter':\n\t\t\tcase ' ': {\n\t\t\t\te.preventDefault();\n\t\t\t\tconst focused: HTMLElement | undefined = itemArr[current];\n\t\t\t\tif (focused) focused.click();\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate handleGridKeydown(e: KeyboardEvent): void {\n\t\tconst focused: HTMLElement = this.getActiveElement() as HTMLElement;\n\t\tconst row: number = Number(focused?.getAttribute('data-row') ?? 1);\n\t\tconst col: number = Number(focused?.getAttribute('data-col') ?? 1);\n\n\t\tconst grid: Element | null =\n\t\t\tthis.activePopup?.querySelector('.notectl-grid-picker__grid') ?? null;\n\t\tif (!grid) return;\n\n\t\tconst lastCell: Element | null = grid.querySelector('.notectl-grid-picker__cell:last-child');\n\t\tconst maxCols: number = Number(lastCell?.getAttribute('data-col') ?? 1);\n\t\tconst maxRows: number = Number(lastCell?.getAttribute('data-row') ?? 1);\n\n\t\tif (['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'].includes(e.key)) {\n\t\t\te.preventDefault();\n\t\t\tconst [newRow, newCol]: [number, number] = navigateGrid(\n\t\t\t\trow,\n\t\t\t\tcol,\n\t\t\t\tmaxRows,\n\t\t\t\tmaxCols,\n\t\t\t\te.key as 'ArrowUp' | 'ArrowDown' | 'ArrowLeft' | 'ArrowRight',\n\t\t\t\tthis.activePopup ? isRtlContext(this.activePopup) : false,\n\t\t\t);\n\t\t\tconst target: HTMLElement | null = grid.querySelector(\n\t\t\t\t`.notectl-grid-picker__cell[data-row=\"${newRow}\"][data-col=\"${newCol}\"]`,\n\t\t\t);\n\t\t\ttarget?.focus();\n\n\t\t\thighlightCells(grid as HTMLElement, newRow, newCol);\n\t\t\tconst label: Element | null =\n\t\t\t\tthis.activePopup?.querySelector('.notectl-grid-picker__label') ?? null;\n\t\t\tif (label) label.textContent = this.locale.gridPickerLabel(newRow, newCol);\n\t\t}\n\n\t\tif (e.key === 'Enter' || e.key === ' ') {\n\t\t\te.preventDefault();\n\t\t\tfocused?.click();\n\t\t}\n\t}\n\n\tprivate handleCustomPopupKeydown(e: KeyboardEvent): void {\n\t\tif (!this.activePopup) return;\n\t\tconst buttons: HTMLButtonElement[] = Array.from(this.activePopup.querySelectorAll('button'));\n\t\tif (buttons.length === 0) return;\n\t\tconst active: HTMLElement = this.getActiveElement() as HTMLElement;\n\t\tconst currentIdx: number = buttons.indexOf(active as HTMLButtonElement);\n\n\t\tswitch (e.key) {\n\t\t\tcase 'ArrowDown': {\n\t\t\t\te.preventDefault();\n\t\t\t\tconst next: number = findNextDropdownItem(buttons, currentIdx, 1);\n\t\t\t\tbuttons[next]?.focus();\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase 'ArrowUp': {\n\t\t\t\te.preventDefault();\n\t\t\t\tconst prev: number = findNextDropdownItem(buttons, currentIdx, -1);\n\t\t\t\tbuttons[prev]?.focus();\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase 'Enter':\n\t\t\tcase ' ': {\n\t\t\t\te.preventDefault();\n\t\t\t\tif (active) activateButton(active);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * Activates a popup control from the keyboard by replaying a full mouse press.\n *\n * Custom-popup action buttons split across two conventions: some run their action\n * on `mousedown` and `preventDefault` it to keep focus on a text field (the link and\n * image popups), while others run it on `click` (the formula dialog's Insert/Cancel).\n * Dispatching both, in pointer order, activates either kind exactly once, because no\n * button runs its action on *both* events: a button that listens on both uses\n * `mousedown` only as a focus guard and runs its action on `click`.\n *\n * Self-managing custom popups that own their full keyboard (the color grid, the\n * structural math palette) handle Enter/Space themselves and stop the event before it\n * reaches here, so this path serves the popups that rely on the controller.\n */\nfunction activateButton(target: HTMLElement): void {\n\ttarget.dispatchEvent(new MouseEvent('mousedown', { bubbles: true, cancelable: true }));\n\ttarget.dispatchEvent(new MouseEvent('mouseup', { bubbles: true, cancelable: true }));\n\ttarget.click();\n}\n","/**\n * ToolbarTooltip: manages the tooltip lifecycle for toolbar buttons.\n * Shows a tooltip after a short delay when hovering or focusing a button,\n * hides it when the cursor leaves or focus moves away.\n */\n\nimport { setStyleProperties, setStyleProperty } from '../../style/StyleRuntime.js';\nimport type { ContainingBlockOffset } from '../shared/PopupPositioning.js';\nimport { measureContainingBlockOffset } from '../shared/PopupPositioning.js';\n\nconst TOOLTIP_DELAY_MS = 500;\n\nexport class ToolbarTooltip {\n\tprivate readonly element: HTMLElement;\n\tprivate timer: ReturnType<typeof setTimeout> | null = null;\n\tprivate target: HTMLButtonElement | null = null;\n\tprivate readonly isPopupActive: () => boolean;\n\n\tstatic readonly TOOLTIP_ID = 'notectl-toolbar-tooltip';\n\n\tconstructor(isPopupActive: () => boolean) {\n\t\tthis.isPopupActive = isPopupActive;\n\t\tthis.element = document.createElement('div');\n\t\tthis.element.className = 'notectl-toolbar-tooltip';\n\t\tthis.element.id = ToolbarTooltip.TOOLTIP_ID;\n\t\tthis.element.setAttribute('role', 'tooltip');\n\t\tsetStyleProperty(this.element, 'display', 'none');\n\t}\n\n\tshow(button: HTMLButtonElement): void {\n\t\tthis.hide();\n\n\t\tif (this.isPopupActive() || button.disabled) return;\n\n\t\tconst text: string | null = button.getAttribute('data-tooltip');\n\t\tif (!text) return;\n\n\t\tthis.target = button;\n\n\t\tthis.timer = setTimeout(() => {\n\t\t\tif (this.isPopupActive()) return;\n\n\t\t\tthis.element.textContent = text;\n\t\t\tsetStyleProperty(this.element, 'display', '');\n\n\t\t\tconst root: Node = button.getRootNode();\n\t\t\tif (root instanceof ShadowRoot && !this.element.parentNode) {\n\t\t\t\troot.appendChild(this.element);\n\t\t\t} else if (!(root instanceof ShadowRoot) && !this.element.parentNode) {\n\t\t\t\tdocument.body.appendChild(this.element);\n\t\t\t}\n\n\t\t\tbutton.setAttribute('aria-describedby', ToolbarTooltip.TOOLTIP_ID);\n\n\t\t\tconst rect: DOMRect = button.getBoundingClientRect();\n\t\t\tsetStyleProperty(this.element, 'position', 'fixed');\n\t\t\tconst cbOffset: ContainingBlockOffset = measureContainingBlockOffset(this.element);\n\t\t\tsetStyleProperties(this.element, {\n\t\t\t\ttop: `${rect.bottom + 6 - cbOffset.y}px`,\n\t\t\t\tleft: `${rect.left + rect.width / 2 - cbOffset.x}px`,\n\t\t\t\ttransform: 'translateX(-50%)',\n\t\t\t});\n\t\t}, TOOLTIP_DELAY_MS);\n\t}\n\n\thide(): void {\n\t\tif (this.timer) {\n\t\t\tclearTimeout(this.timer);\n\t\t\tthis.timer = null;\n\t\t}\n\t\tif (this.target) {\n\t\t\tthis.target.removeAttribute('aria-describedby');\n\t\t\tthis.target = null;\n\t\t}\n\t\tsetStyleProperty(this.element, 'display', 'none');\n\t}\n\n\tdestroy(): void {\n\t\tthis.hide();\n\t\tthis.element.remove();\n\t}\n}\n","/**\n * Toolbar plugin: renders toolbar items registered by other plugins.\n * Acts as a pure rendering engine — has no knowledge of specific features.\n * Supports buttons, dropdowns, grid pickers, and custom popups.\n * Implements WAI-ARIA Toolbar pattern with roving tabindex.\n */\n\nimport { TOOLBAR_CSS } from '../../editor/styles/toolbar.js';\nimport { isRtlContext } from '../../platform/Platform.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { Transaction } from '../../state/Transaction.js';\nimport { ServiceKey } from '../Plugin.js';\nimport type { Plugin, PluginConfig, PluginContext } from '../Plugin.js';\nimport { applyRovingTabindex } from '../shared/KeyboardNav.js';\nimport { resolveLocale } from '../shared/PluginHelpers.js';\nimport { PopupManager, PopupServiceKey } from '../shared/PopupManager.js';\nimport type { ToolbarItem } from './ToolbarItem.js';\nimport {\n\tfindFirstEnabled,\n\tfindLastEnabled,\n\tfindNextEnabled,\n\tresolveHorizontalDirection,\n} from './ToolbarKeyboardNav.js';\nimport { TOOLBAR_LOCALE_EN, type ToolbarLocale, loadToolbarLocale } from './ToolbarLocale.js';\nimport {\n\tToolbarOverflowBehavior,\n\ttype ToolbarOverflowBehavior as ToolbarOverflowBehaviorType,\n} from './ToolbarOverflowBehavior.js';\nimport { ToolbarOverflowController } from './ToolbarOverflowController.js';\nimport { ToolbarPopupController } from './ToolbarPopupController.js';\nimport { createSeparator } from './ToolbarRenderers.js';\nimport { ToolbarTooltip } from './ToolbarTooltip.js';\n\n// --- Layout Config ---\n\n/**\n * Configuration for a single toolbar group. Accepts either:\n * - A `ReadonlyArray<string>` of plugin ids (backwards-compatible tuple form), or\n * - An object with `plugins` and an optional accessible `label`. When `label` is set,\n * the group wrapper receives `role=\"group\"` and `aria-label`, so assistive technology\n * can announce the cluster by name.\n */\nexport type ToolbarGroupConfig =\n\t| ReadonlyArray<string>\n\t| {\n\t\t\treadonly plugins: ReadonlyArray<string>;\n\t\t\treadonly label?: string;\n\t };\n\nexport interface ToolbarLayoutConfig {\n\treadonly groups: ReadonlyArray<ToolbarGroupConfig>;\n\t/**\n\t * Controls responsive overflow behavior when toolbar items exceed available width.\n\t * Defaults to `ToolbarOverflowBehavior.BurgerMenu`.\n\t */\n\treadonly overflow?: ToolbarOverflowBehaviorType;\n}\n\ninterface NormalizedGroup {\n\treadonly plugins: ReadonlyArray<string>;\n\treadonly label: string | undefined;\n}\n\nfunction normalizeGroupConfig(group: ToolbarGroupConfig): NormalizedGroup {\n\tif (Array.isArray(group)) {\n\t\treturn { plugins: group, label: undefined };\n\t}\n\tconst obj: { readonly plugins: ReadonlyArray<string>; readonly label?: string } = group as {\n\t\treadonly plugins: ReadonlyArray<string>;\n\t\treadonly label?: string;\n\t};\n\treturn { plugins: obj.plugins, label: obj.label };\n}\n\n// --- Typed Service API ---\n\nexport interface ToolbarServiceAPI {\n\t/** Re-reads isActive/isEnabled from state and updates all buttons. */\n\trefresh(): void;\n\t/** Closes the currently open popup, if any. */\n\tclosePopup(): void;\n}\n\nexport const ToolbarServiceKey = new ServiceKey<ToolbarServiceAPI>('toolbar');\n\n// --- Plugin ---\n\ninterface ToolbarButton {\n\telement: HTMLButtonElement;\n\titem: ToolbarItem;\n\tcomboLabelEl: HTMLSpanElement | null;\n}\n\nexport class ToolbarPlugin implements Plugin {\n\treadonly id = 'toolbar';\n\treadonly name = 'Toolbar';\n\treadonly priority = 10;\n\n\tprivate context: PluginContext | null = null;\n\tprivate toolbarElement: HTMLElement | null = null;\n\tprivate buttons: ToolbarButton[] = [];\n\tprivate readonly hiddenItems = new Set<string>();\n\tprivate readonly layoutConfig: ToolbarLayoutConfig | null;\n\tprivate overflowBehavior: ToolbarOverflowBehaviorType;\n\tprivate focusedIndex = 0;\n\tprivate tooltip: ToolbarTooltip | null = null;\n\tprivate popupController: ToolbarPopupController | null = null;\n\tprivate popupManager: PopupManager | null = null;\n\tprivate overflowController: ToolbarOverflowController | null = null;\n\tprivate visibleElements: HTMLButtonElement[] = [];\n\tprivate locale!: ToolbarLocale;\n\n\tconstructor(layoutConfig?: ToolbarLayoutConfig) {\n\t\tthis.layoutConfig = layoutConfig ?? null;\n\t\tthis.overflowBehavior = layoutConfig?.overflow ?? ToolbarOverflowBehavior.BurgerMenu;\n\t}\n\n\tasync init(context: PluginContext): Promise<void> {\n\t\tthis.locale = await resolveLocale(context, undefined, TOOLBAR_LOCALE_EN, loadToolbarLocale);\n\t\tcontext.registerStyleSheet(TOOLBAR_CSS);\n\t\tthis.context = context;\n\n\t\tthis.popupManager = new PopupManager(context.getContainer());\n\t\tcontext.registerService(PopupServiceKey, this.popupManager);\n\n\t\tthis.popupController = new ToolbarPopupController(() => this.getActiveElement(), this.locale);\n\t\tthis.popupController.setPopupManager(this.popupManager);\n\t\tthis.tooltip = new ToolbarTooltip(() => this.popupController?.isOpen() ?? false);\n\n\t\tcontext.registerService(ToolbarServiceKey, {\n\t\t\trefresh: () => this.updateButtonStates(context.getState()),\n\t\t\tclosePopup: () => this.popupController?.close(),\n\t\t});\n\n\t\tthis.createToolbarElement();\n\t}\n\n\t/** Returns the current overflow behavior. */\n\tgetOverflowBehavior(): ToolbarOverflowBehaviorType {\n\t\treturn this.overflowBehavior;\n\t}\n\n\t/** Switches the overflow behavior at runtime. */\n\tsetOverflowBehavior(behavior: ToolbarOverflowBehaviorType): void {\n\t\tif (behavior === this.overflowBehavior) return;\n\n\t\tthis.overflowBehavior = behavior;\n\t\tthis.applyOverflowBehavior();\n\t\tthis.renderItems();\n\t}\n\n\tonReady(): void {\n\t\tthis.renderItems();\n\t}\n\n\tdestroy(): void {\n\t\tthis.overflowController?.destroy();\n\t\tthis.overflowController = null;\n\t\tthis.popupController?.destroy();\n\t\tthis.popupController = null;\n\t\tthis.popupManager?.destroy();\n\t\tthis.popupManager = null;\n\t\tthis.tooltip?.destroy();\n\t\tthis.tooltip = null;\n\t\tif (this.toolbarElement) {\n\t\t\tthis.toolbarElement.remove();\n\t\t\tthis.toolbarElement = null;\n\t\t}\n\t\tthis.buttons = [];\n\t\tthis.visibleElements = [];\n\t\tthis.context = null;\n\t}\n\n\tonStateChange(_oldState: EditorState, newState: EditorState, _tr: Transaction): void {\n\t\tthis.updateButtonStates(newState);\n\t}\n\n\tonReadOnlyChange(readonly: boolean): void {\n\t\tif (this.toolbarElement) {\n\t\t\tthis.toolbarElement.hidden = readonly;\n\t\t}\n\t}\n\n\tonConfigure(config: PluginConfig): void {\n\t\tfor (const [key, value] of Object.entries(config)) {\n\t\t\tif (value === false) {\n\t\t\t\tthis.hiddenItems.add(key);\n\t\t\t} else {\n\t\t\t\tthis.hiddenItems.delete(key);\n\t\t\t}\n\t\t}\n\t\tthis.renderItems();\n\t}\n\n\t// --- Toolbar ---\n\n\tprivate createToolbarElement(): void {\n\t\tif (!this.context) return;\n\n\t\tif (this.toolbarElement) {\n\t\t\tthis.toolbarElement.remove();\n\t\t}\n\t\tthis.buttons = [];\n\n\t\tconst container: HTMLElement = this.context.getPluginContainer('top');\n\t\tthis.toolbarElement = document.createElement('div');\n\t\tthis.toolbarElement.setAttribute('role', 'toolbar');\n\t\tthis.toolbarElement.setAttribute('aria-label', this.locale.formattingOptionsAria);\n\t\tthis.toolbarElement.setAttribute('data-notectl-no-print', '');\n\t\tthis.toolbarElement.setAttribute('part', 'toolbar');\n\t\tthis.toolbarElement.className = 'notectl-toolbar';\n\n\t\tthis.toolbarElement.addEventListener('keydown', (e) => this.handleToolbarKeydown(e));\n\n\t\tthis.applyOverflowBehavior();\n\t\tcontainer.appendChild(this.toolbarElement);\n\t}\n\n\t/** Applies the current overflow behavior: creates/destroys the overflow controller and sets the data attribute. */\n\tprivate applyOverflowBehavior(): void {\n\t\tif (!this.toolbarElement || !this.context) return;\n\n\t\t// Tear down existing overflow controller\n\t\tthis.overflowController?.destroy();\n\t\tthis.overflowController = null;\n\n\t\tthis.toolbarElement.setAttribute('data-overflow', this.overflowBehavior);\n\n\t\tif (this.overflowBehavior === ToolbarOverflowBehavior.BurgerMenu) {\n\t\t\tthis.overflowController = new ToolbarOverflowController({\n\t\t\t\ttoolbar: this.toolbarElement,\n\t\t\t\tariaLabel: this.locale.moreToolsAria,\n\t\t\t\tcontext: this.context,\n\t\t\t\tpopupManager: this.popupManager ?? undefined,\n\t\t\t\tonOverflowChange: (visibleButtons, overflowBtn) => {\n\t\t\t\t\tthis.visibleElements = overflowBtn\n\t\t\t\t\t\t? [...visibleButtons, overflowBtn]\n\t\t\t\t\t\t: [...visibleButtons];\n\t\t\t\t\tthis.initRovingTabindex();\n\t\t\t\t},\n\t\t\t\tonItemActivated: (btn: HTMLButtonElement, item: ToolbarItem) => {\n\t\t\t\t\tthis.activateButton(btn, item);\n\t\t\t\t},\n\t\t\t\tgetActiveElement: () => this.getActiveElement(),\n\t\t\t});\n\t\t} else {\n\t\t\t// Flow and None modes: all buttons are visible for roving tabindex\n\t\t\tthis.visibleElements = [];\n\t\t}\n\t}\n\n\tprivate renderItems(): void {\n\t\tif (!this.context || !this.toolbarElement) return;\n\n\t\tfor (const btn of this.buttons) {\n\t\t\tbtn.element.remove();\n\t\t}\n\t\tthis.buttons = [];\n\n\t\tfor (const sep of this.toolbarElement.querySelectorAll('.notectl-toolbar-separator')) {\n\t\t\tsep.remove();\n\t\t}\n\t\tfor (const grp of this.toolbarElement.querySelectorAll('.notectl-toolbar-group')) {\n\t\t\tgrp.remove();\n\t\t}\n\n\t\tif (this.layoutConfig) {\n\t\t\tthis.renderItemsByLayout();\n\t\t} else {\n\t\t\tthis.renderItemsByGroup();\n\t\t}\n\n\t\tif (this.buttons.length > 0 && !this.toolbarElement.parentElement) {\n\t\t\tconst container: HTMLElement = this.context.getPluginContainer('top');\n\t\t\tcontainer.appendChild(this.toolbarElement);\n\t\t}\n\n\t\tthis.overflowController?.update(this.buttons);\n\t\tthis.initRovingTabindex();\n\t\tthis.updateButtonStates(this.context.getState());\n\t}\n\n\tprivate createGroupWrapper(label: string | undefined): HTMLDivElement {\n\t\tconst wrapper: HTMLDivElement = document.createElement('div');\n\t\twrapper.className = 'notectl-toolbar-group';\n\t\twrapper.setAttribute('part', 'toolbar-group');\n\t\tif (label !== undefined) {\n\t\t\twrapper.setAttribute('role', 'group');\n\t\t\twrapper.setAttribute('aria-label', label);\n\t\t}\n\t\treturn wrapper;\n\t}\n\n\t// --- Roving Tabindex ---\n\n\tprivate getTabElements(): HTMLButtonElement[] {\n\t\treturn this.visibleElements.length > 0\n\t\t\t? this.visibleElements\n\t\t\t: this.buttons.map((b) => b.element);\n\t}\n\n\tprivate initRovingTabindex(): void {\n\t\tconst elements: HTMLButtonElement[] = this.getTabElements();\n\t\tconst first: number = findFirstEnabled(elements);\n\t\tthis.focusedIndex = first >= 0 ? first : 0;\n\t\tapplyRovingTabindex(elements, this.focusedIndex);\n\t}\n\n\tprivate setRovingFocus(index: number): void {\n\t\tconst elements: HTMLButtonElement[] = this.getTabElements();\n\t\tif (index < 0 || index >= elements.length) return;\n\t\tthis.focusedIndex = index;\n\t\tapplyRovingTabindex(elements, index);\n\t\telements[index]?.focus();\n\t}\n\n\t/** Returns the active element, respecting shadow DOM boundaries. */\n\tprivate getActiveElement(): Element | null {\n\t\tconst root: Node | undefined = this.toolbarElement?.getRootNode();\n\t\tif (root instanceof ShadowRoot) {\n\t\t\treturn root.activeElement;\n\t\t}\n\t\treturn document.activeElement;\n\t}\n\n\tprivate syncFocusedIndex(): void {\n\t\tconst active: Element | null = this.getActiveElement();\n\t\tconst elements: HTMLButtonElement[] = this.getTabElements();\n\t\tconst idx: number = elements.findIndex((el) => el === active);\n\t\tif (idx >= 0) {\n\t\t\tthis.focusedIndex = idx;\n\t\t}\n\t}\n\n\t// --- Toolbar Keyboard ---\n\n\tprivate handleToolbarKeydown(e: KeyboardEvent): void {\n\t\tconst elements: HTMLButtonElement[] = this.getTabElements();\n\t\tif (elements.length === 0) return;\n\n\t\tthis.syncFocusedIndex();\n\n\t\tswitch (e.key) {\n\t\t\tcase 'ArrowRight':\n\t\t\tcase 'ArrowLeft': {\n\t\t\t\te.preventDefault();\n\t\t\t\tconst rtl: boolean = this.toolbarElement ? isRtlContext(this.toolbarElement) : false;\n\t\t\t\tconst dir: 1 | -1 = resolveHorizontalDirection(e.key, rtl);\n\t\t\t\tconst next: number = findNextEnabled(elements, this.focusedIndex, dir);\n\t\t\t\tthis.setRovingFocus(next);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase 'Home': {\n\t\t\t\te.preventDefault();\n\t\t\t\tconst first: number = findFirstEnabled(elements);\n\t\t\t\tif (first >= 0) this.setRovingFocus(first);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase 'End': {\n\t\t\t\te.preventDefault();\n\t\t\t\tconst last: number = findLastEnabled(elements);\n\t\t\t\tif (last >= 0) this.setRovingFocus(last);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase 'Enter':\n\t\t\tcase ' ': {\n\t\t\t\te.preventDefault();\n\t\t\t\tconst focused: HTMLButtonElement | undefined = elements[this.focusedIndex];\n\t\t\t\tconst btn: ToolbarButton | undefined = this.buttons.find((b) => b.element === focused);\n\t\t\t\tif (btn) this.activateButton(btn.element, btn.item);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\t/** Activates a toolbar button (shared between mouse click and keyboard). */\n\tprivate activateButton(btn: HTMLButtonElement, item: ToolbarItem): void {\n\t\tthis.tooltip?.hide();\n\t\tif (item.popupType && this.context) {\n\t\t\tthis.popupController?.toggle(btn, item, this.context);\n\t\t} else {\n\t\t\tthis.context?.executeCommand(item.command);\n\t\t}\n\t}\n\n\t// --- Layout Rendering ---\n\n\tprivate renderItemsByLayout(): void {\n\t\tif (!this.context || !this.toolbarElement || !this.layoutConfig) return;\n\n\t\tconst toolbarReg = this.context.getToolbarRegistry();\n\t\tlet firstGroup = true;\n\n\t\tfor (const rawGroup of this.layoutConfig.groups) {\n\t\t\tconst { plugins, label }: NormalizedGroup = normalizeGroupConfig(rawGroup);\n\t\t\tconst groupItems: ToolbarItem[] = [];\n\t\t\tfor (const pId of plugins) {\n\t\t\t\tconst items: ToolbarItem[] = toolbarReg\n\t\t\t\t\t.getToolbarItemsByPlugin(pId)\n\t\t\t\t\t.filter((item) => !this.hiddenItems.has(item.id));\n\t\t\t\tgroupItems.push(...items);\n\t\t\t}\n\n\t\t\tif (groupItems.length === 0) continue;\n\n\t\t\tif (!firstGroup) {\n\t\t\t\tthis.toolbarElement.appendChild(createSeparator());\n\t\t\t}\n\t\t\tfirstGroup = false;\n\n\t\t\tconst wrapper: HTMLDivElement = this.createGroupWrapper(label);\n\t\t\tfor (const item of groupItems) {\n\t\t\t\tconst btn: ToolbarButton = this.createButton(item);\n\t\t\t\twrapper.appendChild(btn.element);\n\t\t\t\tthis.buttons.push(btn);\n\t\t\t}\n\t\t\tthis.toolbarElement.appendChild(wrapper);\n\t\t}\n\n\t\tif (this.buttons.length === 0) {\n\t\t\tthis.toolbarElement.remove();\n\t\t}\n\t}\n\n\tprivate renderItemsByGroup(): void {\n\t\tif (!this.context || !this.toolbarElement) return;\n\n\t\tconst toolbarRegistry = this.context.getToolbarRegistry();\n\t\tconst items: ToolbarItem[] = toolbarRegistry\n\t\t\t.getToolbarItems()\n\t\t\t.filter((item) => !this.hiddenItems.has(item.id));\n\t\tif (items.length === 0) {\n\t\t\tthis.toolbarElement.remove();\n\t\t\treturn;\n\t\t}\n\n\t\tconst groups = new Map<string, ToolbarItem[]>();\n\t\tfor (const item of items) {\n\t\t\tconst list: ToolbarItem[] = groups.get(item.group) ?? [];\n\t\t\tlist.push(item);\n\t\t\tgroups.set(item.group, list);\n\t\t}\n\n\t\tlet firstGroup = true;\n\t\tfor (const [, groupItems] of groups) {\n\t\t\tif (!firstGroup) {\n\t\t\t\tthis.toolbarElement.appendChild(createSeparator());\n\t\t\t}\n\t\t\tfirstGroup = false;\n\n\t\t\tconst wrapper: HTMLDivElement = this.createGroupWrapper(undefined);\n\t\t\tfor (const item of groupItems) {\n\t\t\t\tconst btn: ToolbarButton = this.createButton(item);\n\t\t\t\twrapper.appendChild(btn.element);\n\t\t\t\tthis.buttons.push(btn);\n\t\t\t}\n\t\t\tthis.toolbarElement.appendChild(wrapper);\n\t\t}\n\t}\n\n\t// --- Button Creation ---\n\n\tprivate createButton(item: ToolbarItem): ToolbarButton {\n\t\tconst btn: HTMLButtonElement = document.createElement('button');\n\t\tbtn.type = 'button';\n\t\tbtn.className = `notectl-toolbar-btn notectl-toolbar-btn--${item.id}`;\n\t\tbtn.setAttribute('aria-pressed', 'false');\n\t\tbtn.setAttribute('aria-label', item.label);\n\t\tbtn.setAttribute('data-toolbar-item', item.id);\n\t\tbtn.setAttribute('data-tooltip', item.tooltip ?? item.label);\n\t\tbtn.setAttribute('part', 'toolbar-button');\n\n\t\tlet comboLabelEl: HTMLSpanElement | null = null;\n\n\t\tif (item.popupType === 'combobox') {\n\t\t\tbtn.setAttribute('role', 'combobox');\n\t\t\tbtn.setAttribute('aria-haspopup', 'listbox');\n\t\t\tbtn.setAttribute('aria-expanded', 'false');\n\n\t\t\tconst labelSpan: HTMLSpanElement = document.createElement('span');\n\t\t\tlabelSpan.className = 'notectl-toolbar-combobox__label';\n\t\t\tconst state: EditorState | undefined = this.context?.getState();\n\t\t\tif (state) {\n\t\t\t\tlabelSpan.textContent = item.getLabel(state);\n\t\t\t}\n\t\t\tbtn.appendChild(labelSpan);\n\t\t\tcomboLabelEl = labelSpan;\n\n\t\t\tconst arrowSpan: HTMLSpanElement = document.createElement('span');\n\t\t\tarrowSpan.className = 'notectl-toolbar-combobox__arrow';\n\t\t\tarrowSpan.setAttribute('aria-hidden', 'true');\n\t\t\tarrowSpan.textContent = '\\u25BE';\n\t\t\tbtn.appendChild(arrowSpan);\n\t\t} else {\n\t\t\tif (item.popupType) {\n\t\t\t\tbtn.setAttribute('aria-haspopup', 'true');\n\t\t\t\tbtn.setAttribute('aria-expanded', 'false');\n\t\t\t}\n\n\t\t\tconst span: HTMLSpanElement = document.createElement('span');\n\t\t\tspan.className = 'notectl-toolbar-btn__icon';\n\t\t\tspan.innerHTML = item.icon;\n\t\t\tbtn.appendChild(span);\n\t\t}\n\n\t\tbtn.addEventListener('mousedown', (e: MouseEvent) => {\n\t\t\te.preventDefault();\n\t\t\tthis.activateButton(btn, item);\n\t\t});\n\n\t\tbtn.addEventListener('mouseenter', () => this.tooltip?.show(btn));\n\t\tbtn.addEventListener('mouseleave', () => this.tooltip?.hide());\n\t\tbtn.addEventListener('focus', () => this.tooltip?.show(btn));\n\t\tbtn.addEventListener('blur', () => this.tooltip?.hide());\n\n\t\treturn { element: btn, item, comboLabelEl };\n\t}\n\n\t// --- Button State Updates ---\n\n\tprivate updateButtonStates(state: EditorState): void {\n\t\tfor (const btn of this.buttons) {\n\t\t\tconst active: boolean = btn.item.isActive?.(state) ?? false;\n\t\t\tconst enabled: boolean = btn.item.isEnabled?.(state) ?? true;\n\t\t\tbtn.element.setAttribute('aria-pressed', String(active));\n\t\t\tbtn.element.classList.toggle('notectl-toolbar-btn--active', active);\n\t\t\t// Modifier part mirrors active state for ::part() targeting from outside the shadow root.\n\t\t\t// Kept in sync with aria-pressed — never drift these apart.\n\t\t\tbtn.element.setAttribute(\n\t\t\t\t'part',\n\t\t\t\tactive ? 'toolbar-button toolbar-button-active' : 'toolbar-button',\n\t\t\t);\n\t\t\tbtn.element.disabled = !enabled;\n\t\t\tif (!enabled) {\n\t\t\t\tbtn.element.setAttribute('aria-disabled', 'true');\n\t\t\t} else {\n\t\t\t\tbtn.element.removeAttribute('aria-disabled');\n\t\t\t}\n\t\t\tif (btn.comboLabelEl && btn.item.popupType === 'combobox') {\n\t\t\t\tbtn.comboLabelEl.textContent = btn.item.getLabel(state);\n\t\t\t}\n\t\t\tif (btn.item.getIcon) {\n\t\t\t\tconst newIcon: string = btn.item.getIcon(state);\n\t\t\t\tconst iconEl: HTMLSpanElement | null = btn.element.querySelector(\n\t\t\t\t\t'.notectl-toolbar-btn__icon',\n\t\t\t\t);\n\t\t\t\tif (iconEl && iconEl.innerHTML !== newIcon) {\n\t\t\t\t\ticonEl.innerHTML = newIcon;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tthis.overflowController?.updateItemStates(state);\n\t}\n}\n"],"mappings":"yXAOA,IAAa,EAAb,MACC,6BAAiC,IAAI,IACrC,qCAAyC,IAAI,IAE7C,mBAAA,CAAoB,EAAmB,GACtC,GAAI,KAAK,cAAc,IAAI,EAAK,IAC/B,MAAM,IAAI,MAAM,wBAAwB,EAAK,8BAG9C,GADA,KAAK,cAAc,IAAI,EAAK,GAAI,GAC5B,EAAU,CACb,MAAM,EAAM,KAAK,sBAAsB,IAAI,IAAa,GACxD,EAAI,KAAK,EAAK,IACd,KAAK,sBAAsB,IAAI,EAAU,EAC1C,CACD,CAEA,uBAAA,CAAwB,GACvB,MAAM,EAAM,KAAK,sBAAsB,IAAI,IAAa,GAClD,EAAuB,GAC7B,IAAK,MAAM,KAAM,EAAK,CACrB,MAAM,EAAO,KAAK,cAAc,IAAI,GAChC,GAAM,EAAM,KAAK,EACtB,CACA,OAAO,CACR,CAEA,cAAA,CAAe,GACd,OAAO,KAAK,cAAc,IAAI,EAC/B,CAEA,eAAA,GACC,MAAO,IAAI,KAAK,cAAc,SAC/B,CAEA,iBAAA,CAAkB,GACjB,KAAK,cAAc,OAAO,GAC1B,IAAK,MAAO,EAAU,KAAQ,KAAK,sBAAuB,CACzD,MAAM,EAAM,EAAI,QAAQ,GACxB,IAAY,IAAR,EAAY,CACf,EAAI,OAAO,EAAK,GACG,IAAf,EAAI,QAAc,KAAK,sBAAsB,OAAO,GACxD,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S,KAAK,IACvD,EAAI,iBAAiB,OAAA,IAAc,KAAK,SAAS,QAE1C,CAAE,QAAS,EAAK,OAAM,eAC9B,CAIA,kBAAA,CAA2B,GAC1B,IAAK,MAAM,KAAO,KAAK,QAAS,CAC/B,MAAM,EAAkB,EAAI,KAAK,WAAW,KAAU,EAChD,EAAmB,EAAI,KAAK,YAAY,KAAU,EAkBxD,GAjBA,EAAI,QAAQ,aAAa,eAAgB,OAAO,IAChD,EAAI,QAAQ,UAAU,OAAO,8BAA+B,GAG5D,EAAI,QAAQ,aACX,OACA,EAAS,uCAAyC,kBAEnD,EAAI,QAAQ,UAAY,EACnB,EAGJ,EAAI,QAAQ,gBAAgB,iBAF5B,EAAI,QAAQ,aAAa,gBAAiB,QAIvC,EAAI,cAAuC,aAAvB,EAAI,KAAK,YAChC,EAAI,aAAa,YAAc,EAAI,KAAK,SAAS,IAE9C,EAAI,KAAK,QAAS,CACrB,MAAM,EAAkB,EAAI,KAAK,QAAQ,GACnC,EAAiC,EAAI,QAAQ,cAClD,8BAEG,GAAU,EAAO,YAAc,IAClC,EAAO,UAAY,EAErB,CACD,CACA,KAAK,oBAAoB,iBAAiB,EAC3C"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{n as t,r as e}from"./HTMLUtils-Bhg3_P8B.mjs";import{_ as n,o,p as i,w as r}from"./Document-827l3P80.mjs";import{c as a,l,o as s,r as d,t as c,u}from"./Selection-HYoVFpAx.mjs";import{a as p}from"./TypeBrands-Ch9856Gb.mjs";import{n as h}from"./DomUtils-Bf7JLFlx.mjs";import{s as m}from"./BlockInsertion-CJusvrDL.mjs";import{t as v}from"./NodeSelectionCommands-1PjwUDTJ.mjs";import{t as f}from"./Platform-ByobkiCc.mjs";import{c as b,r as g}from"./StyleRuntime-DW6omotc.mjs";import{c as y,o as x}from"./PluginHelpers-Dx_0hfDe.mjs";import{t as _}from"./ShortcutFormatting-TwiufqeV.mjs";import{a as w}from"./PopupPositioning-BFh6Ed1D.mjs";import A from"dompurify";var k=/^[A-Za-z0-9_-]{11}$/,C=/^\d+$/,P=/^[A-Za-z0-9]+$/,z=/^[A-Za-z0-9]+$/;function E(t,e){const n=t.indexOf(e);if(-1!==n)return t[n+1]}function L(t,e,n){const o=e.searchParams.get("h")??n;return o&&P.test(o)?{videoId:t,hash:o}:{videoId:t}}var S=[{id:"youtube",label:"YouTube",hostnames:["youtube.com","www.youtube.com","m.youtube.com","music.youtube.com","youtu.be","youtube-nocookie.com","www.youtube-nocookie.com"],embedHostnames:["www.youtube-nocookie.com","youtube-nocookie.com","www.youtube.com","youtube.com"],parse(t){const e=t.hostname.toLowerCase(),n=t.pathname.split("/").filter(Boolean);if("youtu.be"===e){const t=n[0];return t&&k.test(t)?{videoId:t}:null}const o=t.searchParams.get("v");if(o&&k.test(o))return{videoId:o};for(const i of["embed","shorts","live","v"]){const t=E(n,i);if(t&&k.test(t))return{videoId:t}}return null},buildEmbedUrl(t,e){const n=e.privacy?"www.youtube-nocookie.com":"www.youtube.com",o=V({rel:"0",...e.autoplay?{autoplay:"1"}:{}});return`https://${n}/embed/${t.videoId}${o}`},buildWatchUrl:t=>`https://www.youtube.com/watch?v=${t.videoId}`,thumbnailUrl:t=>`https://i.ytimg.com/vi/${t.videoId}/hqdefault.jpg`},{id:"vimeo",label:"Vimeo",hostnames:["vimeo.com","www.vimeo.com","player.vimeo.com"],embedHostnames:["player.vimeo.com"],parse(t){const e=t.pathname.split("/").filter(Boolean),n=E(e,"video");if(n&&C.test(n))return L(n,t,void 0);const o=e.find(t=>C.test(t));return o?L(o,t,e[e.indexOf(o)+1]):null},buildEmbedUrl(t,e){const n=V({...t.hash?{h:t.hash}:{},...e.privacy?{dnt:"1"}:{},...e.autoplay?{autoplay:"1"}:{}});return`https://player.vimeo.com/video/${t.videoId}${n}`},buildWatchUrl(t){const e=`https://vimeo.com/${t.videoId}`;return t.hash?`${e}/${t.hash}`:e}},{id:"dailymotion",label:"Dailymotion",hostnames:["dailymotion.com","www.dailymotion.com","geo.dailymotion.com","dai.ly"],embedHostnames:["www.dailymotion.com","geo.dailymotion.com"],parse(t){const e=t.hostname.toLowerCase(),n=t.pathname.split("/").filter(Boolean);if("dai.ly"===e){const t=n[0];return t&&z.test(t)?{videoId:t}:null}const o=E(n,"video");return o&&z.test(o)?{videoId:o}:null},buildEmbedUrl(t,e){const n=V(e.autoplay?{autoplay:"1"}:{});return`https://www.dailymotion.com/embed/video/${t.videoId}${n}`},buildWatchUrl:t=>`https://www.dailymotion.com/video/${t.videoId}`,thumbnailUrl:t=>`https://www.dailymotion.com/thumbnail/video/${t.videoId}`}];function I(t,e=S){const n=B(t);if(!n)return null;if("https:"!==n.protocol&&"http:"!==n.protocol)return null;const o=n.hostname.toLowerCase();for(const i of e){if(!i.hostnames.includes(o))continue;const t=i.parse(n);if(t)return{provider:i.id,videoId:t.videoId,...t.hash?{hash:t.hash}:{}}}return null}function R(t,e=S){return e.find(e=>e.id===t)}function $(t,e){const n=R(t.provider,e);return n?n.buildWatchUrl(t):null}function N(t,e){return R(t.provider,e)?.thumbnailUrl?.(t)}function H(t,e=S){return R(t,e)?.label??t}function B(t){try{return new URL(t.trim())}catch{return null}}function V(t){const e=Object.entries(t);return 0===e.length?"":`?${e.map(([t,e])=>`${encodeURIComponent(t)}=${encodeURIComponent(e)}`).join("&")}`}var M={growWidth:"Mod-Shift-ArrowRight",shrinkWidth:"Mod-Shift-ArrowLeft",growWidthLarge:"Mod-Shift-Alt-ArrowRight",shrinkWidthLarge:"Mod-Shift-Alt-ArrowLeft",resetSize:"Mod-Shift-0"},W={providers:S,facade:!0,useProviderThumbnail:!1,privacy:!0,allowedAspectRatios:["16/9","4/3","1/1","9/16"],defaultAspectRatio:"16/9",defaultWidthPercent:100,minWidthPercent:25,widthStep:10,widthStepLarge:25,resizable:!0},j="video",D=/^\d+(?:\.\d+)?\s*\/\s*\d+(?:\.\d+)?$/;function T(t,e){if(!t||!D.test(t.trim()))return e.defaultAspectRatio;const[n,o]=t.split("/");return`${n?.trim()} / ${o?.trim()}`}function O(t,e){return Number.isFinite(t)?Math.max(e.minWidthPercent,Math.min(100,Math.round(t))):e.defaultWidthPercent}var U=/^[A-Za-z0-9_-]+$/;function F(t){return t.length>0&&t.length<=64&&U.test(t)}function K(t,e){return{provider:t?.provider??"",videoId:t?.videoId??"",...t?.hash?{hash:t.hash}:{},aspectRatio:T(t?.aspectRatio,e),widthPercent:O(t?.widthPercent??e.defaultWidthPercent,e),align:t?.align??"center",title:t?.title??"",...t?.caption?{caption:t.caption}:{},privacy:t?.privacy??e.privacy}}function q(t,e){const n=I(t.url,e.providers);return n?{provider:n.provider,videoId:n.videoId,...n.hash?{hash:n.hash}:{},aspectRatio:T(t.aspectRatio,e),widthPercent:e.defaultWidthPercent,align:"center",title:t.title,...t.caption?{caption:t.caption}:{},privacy:e.privacy}:null}function G(t){return{provider:t.provider,videoId:t.videoId,aspectRatio:t.aspectRatio,widthPercent:t.widthPercent,align:t.align,title:t.title,privacy:t.privacy,...t.hash?{hash:t.hash}:{},...t.caption?{caption:t.caption}:{}}}function X(t){const e=t.selection;if(!l(e))return null;const n=t.getBlock(e.nodeId);if(!n||"video"!==n.type)return null;const o=t.getNodePath(e.nodeId);return o?{block:n,path:o}:null}function Z(t,e){const n=t.getState(),o=X(n);return!!o&&(t.dispatch(n.transaction("command").setNodeAttr(o.path,e).build()),!0)}function Y(t){const e=t.getState(),n=X(e);if(!n)return!1;const o=v(e,d(n.block.id,n.path));return!!o&&(t.dispatch(o),!0)}var J=0;function Q(t){return`${t}-${J+=1}`}function tt(t,e){const n=Q("notectl-video-field"),o=document.createElement("div");o.className="notectl-video-popup__field";const i=document.createElement("label");i.className="notectl-video-popup__label",i.setAttribute("for",n),i.textContent=e.label,o.appendChild(i);const r=document.createElement("input");r.id=n,r.type=e.type,r.value=e.value,r.placeholder=e.placeholder,r.className="notectl-video-popup__input",r.setAttribute("aria-label",e.ariaLabel),e.required&&r.setAttribute("aria-required","true");const a=[];if(e.hint){const t=`${n}-hint`,i=document.createElement("p");i.id=t,i.className="notectl-video-popup__hint",i.textContent=e.hint,o.appendChild(i),a.push(t)}return e.describedBy&&a.push(e.describedBy),a.length>0&&r.setAttribute("aria-describedby",a.join(" ")),o.insertBefore(r,o.children[1]??null),t.appendChild(o),r}var et=class{context;config;locale;panel=null;outsideHandler=null;constructor(t,e,n){this.context=t,this.config=e,this.locale=n}get isOpen(){return null!==this.panel}openInsert(){this.context.isReadOnly()||this.open({rect:nt(),mode:"insert",label:this.locale.insertDialogLabel,onSubmit:t=>{const e=q(t,this.config);e&&function(t,e){const n=t.getState(),s=n.selection;if(a(s))return!1;const c=G(e),u=l(s)?s.nodeId:s.anchor.blockId,h=function(t,e){if("table_cell"===t.getBlock(e)?.type)return e;const n=t.getNodePath(e);if(n)for(const o of n)if("table_cell"===t.getBlock(o)?.type)return o}(n,u);h?function(t,e,n,a){const l=t.getNodePath(n),s=t.getBlock(n);if(!l||!s)return!1;const c=o(p(j),[],void 0,a),u=t.transaction("command"),h=i(s);for(let o=h.length-1;o>=0;o--){const t=s.children.findIndex(t=>r(t)&&t.id===h[o]?.id);-1!==t&&u.removeNode(l,t)}u.insertNode(l,0,c),u.setSelection(d(c.id,[...l,c.id])),e.dispatch(u.build())}(n,t,h,c):function(t,e,n,i){const r=o(p(j),[],void 0,i),a=t.transaction("command");!!m(t,a,n,r)&&(a.setSelection(d(r.id,[])),e.dispatch(a.build()))}(n,t,u,c)}(this.context,e)}})}openInsertReplacingRange(t,e){this.context.isReadOnly()||this.open({rect:nt(),mode:"insert",label:this.locale.insertDialogLabel,initial:{url:e},onSubmit:e=>{const i=q(e,this.config);i&&function(t,e,i){const a=t.getState(),l=a.getBlock(e.blockId);if(!l)return!1;const s=function(t,e){const n=t.getNodePath(e);if(!n||0===n.length)return null;if(1===n.length){const n=t.doc.children.findIndex(t=>t.id===e);return-1===n?null:{parentPath:[],index:n}}const o=n[n.length-2],i=o?t.getBlock(o):void 0;if(!i)return null;const a=i.children.findIndex(t=>r(t)&&t.id===e);return-1===a?null:{parentPath:n.slice(0,-1),index:a}}(a,e.blockId);if(!s)return!1;const c=0===Math.max(0,n(l).length-(e.end-e.start))&&"paragraph"===l.type,u=o(p(j),[],void 0,G(i)),h=0===s.parentPath.length?[]:[...s.parentPath,u.id],m=a.transaction("command");c?(m.removeNode(s.parentPath,s.index),m.insertNode(s.parentPath,s.index,u),0===s.parentPath.length&&s.index>=a.doc.children.length-1&&m.insertNode([],s.index+1,o(p("paragraph")))):(m.deleteTextAt(e.blockId,e.start,e.end),m.insertNode(s.parentPath,s.index+1,u)),m.setSelection(d(u.id,h)),t.dispatch(m.build())}(this.context,t,i)}})}openEditForSelected(){if(this.context.isReadOnly())return;const t=this.context.getState(),e=t.selection;if(!l(e))return;const n=t.getBlock(e.nodeId);if(!n||"video"!==n.type)return;const o=K(n.attrs,this.config),i={url:$({provider:o.provider,videoId:o.videoId,...o.hash?{hash:o.hash}:{}},this.config.providers)??"",title:o.title,caption:o.caption??"",aspectRatio:o.aspectRatio};this.open({rect:this.videoRect(e.nodeId),mode:"edit",label:this.locale.editDialogLabel,initial:i,onSubmit:t=>{!function(t,e,n){const o=X(t.getState());if(!o)return!1;const i=I(e.url,n.providers);if(!i)return!1;const r=function(t,e){const n={};for(const[o,i]of Object.entries(t??{}))e.includes(o)||"string"!=typeof i&&"number"!=typeof i&&"boolean"!=typeof i||(n[o]=i);return n}(o.block.attrs,["hash","caption"]);r.provider=i.provider,r.videoId=i.videoId,r.title=e.title,r.aspectRatio=T(e.aspectRatio,n),i.hash&&(r.hash=i.hash),e.caption.trim()&&(r.caption=e.caption.trim()),Z(t,r)}(this.context,t,this.config)}})}close(t){this.panel&&(this.outsideHandler&&(document.removeEventListener("mousedown",this.outsideHandler,!0),this.outsideHandler=null),this.panel.remove(),this.panel=null,t&&this.context.getContainer().focus())}open(t){this.close(!1);const e=document.createElement("div");e.className="notectl-video-overlay",e.setAttribute("role","dialog"),e.setAttribute("aria-modal","false"),e.setAttribute("aria-label",t.label),this.panel=e,function(t,e){const{config:n,locale:o,initial:i,mode:r}=e;t.classList.add("notectl-video-popup");const a=Q("notectl-video-error"),l=document.createElement("p");l.id=a,l.className="notectl-video-popup__error",l.setAttribute("role","alert");const s=tt(t,{label:o.urlLabel,ariaLabel:o.urlAria,placeholder:o.urlPlaceholder,value:i?.url??"",type:"url",required:!0,describedBy:a}),d=tt(t,{label:o.titleLabel,ariaLabel:o.titleAria,placeholder:o.titlePlaceholder,value:i?.title??"",type:"text",required:!0,hint:o.titleHint}),c=tt(t,{label:o.captionLabel,ariaLabel:o.captionAria,placeholder:o.captionPlaceholder,value:i?.caption??"",type:"text"}),u=function(t,e,n,o){const i=Q("notectl-video-field"),r=document.createElement("div");r.className="notectl-video-popup__field";const a=document.createElement("label");a.className="notectl-video-popup__label",a.setAttribute("for",i),a.textContent=n.aspectRatioLabel,r.appendChild(a);const l=document.createElement("select");l.id=i,l.className="notectl-video-popup__select",l.setAttribute("aria-label",n.aspectRatioAria);const s=e.allowedAspectRatios.includes(o)?e.allowedAspectRatios:[o,...e.allowedAspectRatios];for(const d of s){const t=document.createElement("option");t.value=d,t.textContent=d,d===o&&(t.selected=!0),l.appendChild(t)}return r.appendChild(l),t.appendChild(r),l}(t,n,o,i?.aspectRatio??n.defaultAspectRatio);t.appendChild(l);const p=document.createElement("div");p.className="notectl-video-popup__actions";const h=document.createElement("button");h.type="button",h.className="notectl-video-popup__cancel",h.textContent=o.cancelButton;const m=document.createElement("button");m.type="button",m.className="notectl-video-popup__submit",m.textContent="edit"===r?o.updateButton:o.insertButton,m.setAttribute("aria-label","edit"===r?o.updateAria:o.insertAria),p.append(h,m),t.appendChild(p);const v=(t,e)=>{l.textContent=t,e.focus()},f=()=>{const t=s.value.trim();if(!I(t,n.providers))return void v(o.invalidUrl,s);const i=d.value.trim();i?(l.textContent="",e.onSubmit({url:t,title:i,caption:c.value.trim(),aspectRatio:u.value}),e.onClose()):v(o.titleRequired,d)};h.addEventListener("mousedown",t=>t.preventDefault()),h.addEventListener("click",t=>{t.preventDefault(),e.onClose()}),m.addEventListener("mousedown",t=>t.preventDefault()),m.addEventListener("click",t=>{t.preventDefault(),f()});for(const b of[s,d,c])b.addEventListener("keydown",t=>{"Enter"===t.key&&(t.preventDefault(),f())});requestAnimationFrame(()=>s.focus())}(e,{mode:t.mode,initial:t.initial,config:this.config,locale:this.locale,onSubmit:t.onSubmit,onClose:()=>this.close(!0)}),e.addEventListener("keydown",t=>{"Escape"===t.key&&(t.preventDefault(),t.stopPropagation(),this.close(!0))}),this.context.getPluginContainer("top").appendChild(e),w(e),function(t,e){const n=e?e.bottom:window.innerHeight/3,o=e?e.left:window.innerWidth/3,i=t.offsetWidth||320,r=window.innerWidth-i-8,a=Math.max(8,Math.min(o,r)),l=window.innerHeight-t.offsetHeight-8,s=Math.min(n+8,Math.max(8,l));t.style.left=`${Math.round(a)}px`,t.style.top=`${Math.round(s)}px`}(e,t.rect),this.installOutsideHandler()}videoRect(t){const e=this.context.getContainer().querySelector(`[data-block-id="${t}"]`);return e?e.getBoundingClientRect():null}installOutsideHandler(){const t=t=>{this.panel&&!t.composedPath().includes(this.panel)&&this.close(!1)};this.outsideHandler=t,requestAnimationFrame(()=>{this.outsideHandler&&document.addEventListener("mousedown",t,!0)})}};function nt(){const t=window.getSelection();if(!t||0===t.rangeCount)return null;const e=t.getRangeAt(0).getBoundingClientRect();return 0===e.width&&0===e.height&&0===e.top&&0===e.left?null:e}var ot={insertVideo:"Insert Video",insertVideoTooltip:"Insert Video",urlLabel:"Video URL",urlPlaceholder:"https://www.youtube.com/watch?v=...",urlAria:"Video URL",titleLabel:"Title",titlePlaceholder:"Describe the video",titleAria:"Video title",titleHint:"Describes the video for screen readers. Required.",captionLabel:"Caption",captionPlaceholder:"Optional visible caption",captionAria:"Video caption",aspectRatioLabel:"Aspect ratio",aspectRatioAria:"Video aspect ratio",insertButton:"Insert",insertAria:"Insert video",updateButton:"Update",updateAria:"Update video",cancelButton:"Cancel",insertDialogLabel:"Insert video",editDialogLabel:"Edit video",invalidUrl:"Enter a YouTube, Vimeo, or Dailymotion video URL.",titleRequired:"Enter a title so screen readers can describe the video.",play:t=>t?`Play video: ${t}`:"Play video",loading:"Loading video...",providerBadge:t=>`${t} video`,closePlayer:"Close video player",videoAria:(t,e)=>e?`${t} video: ${e}`:`${t} video`,videoSelected:"Video selected.",videoSelectedWithTitle:t=>`Video selected: ${t}.`,resizeHint:(t,e)=>`${t} / ${e} to resize.`,keyboardResizeHint:(t,e)=>`${t} / ${e} to resize`,videoResized:t=>`Video resized to ${t} percent width.`,resetToDefaultSize:"Video reset to full width.",enteredPlayer:t=>t?`Playing ${t}. Press Escape to return to the document.`:"Playing video. Press Escape to return to the document.",exitedPlayer:"Returned to the document.",videoOptions:"Video options",editVideo:"Edit video",alignStart:"Align left",alignCenter:"Align center",alignEnd:"Align right",deleteVideo:"Delete video",embedPrompt:"Embed this video?",embedConfirm:"Embed",embedDismiss:"Keep as link",embedOfferAnnounce:t=>`${t} link pasted. Press Embed to turn it into a video, or continue editing to keep it as a link.`,embeddedAnnounce:"Video embedded."},it=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar--O0A9OTR.mjs"),"./locales/de.ts":()=>import("./de-BxQIt_1Y.mjs"),"./locales/es.ts":()=>import("./es-BQweZX6P.mjs"),"./locales/fr.ts":()=>import("./fr-C3EKRThN.mjs"),"./locales/hi.ts":()=>import("./hi-L6pJxZam.mjs"),"./locales/pt.ts":()=>import("./pt-Bb908r0n.mjs"),"./locales/ru.ts":()=>import("./ru-DkW9XZFy.mjs"),"./locales/zh.ts":()=>import("./zh-ikm3rSTR.mjs")});async function rt(t){return y(it,t,ot)}var at={start:"notectl-video--start",center:"notectl-video--center",end:"notectl-video--end"};function lt(t,e){for(const o of Object.values(at))t.classList.remove(o);const n=at[e]??at.center;t.classList.add(n)}function st(t,e,n){b(t,"aspect-ratio",e),b(t,"width",`${n}%`)}var dt=/^[A-Za-z0-9]+$/;function ct(t){return{provider:t.provider,videoId:t.videoId,...t.hash?{hash:t.hash}:{}}}function ut(t,e){const n=Number.parseFloat(t.getAttribute("width")??""),o=Number.parseFloat(t.getAttribute("height")??"");return Number.isFinite(n)&&Number.isFinite(o)&&n>0&&o>0?T(`${n}/${o}`,e):e.defaultAspectRatio}function pt(t,e,n){const o=function(t,e,n){const o=R(t.provider,e);return o?o.buildEmbedUrl(t,n):null}({provider:t.provider,videoId:t.videoId,...t.hash?{hash:t.hash}:{}},e.providers,{privacy:t.privacy,autoplay:!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches})??"",i=document.createElement("iframe");return i.className="notectl-video__iframe",i.setAttribute("src",o),i.setAttribute("title",t.title||n.providerBadge(H(t.provider,e.providers))),i.setAttribute("allow","autoplay; fullscreen; picture-in-picture; encrypted-media"),i.setAttribute("allowfullscreen","true"),i.setAttribute("referrerpolicy","no-referrer"),i.setAttribute("loading","lazy"),i.setAttribute("frameborder","0"),i}var ht=class{frame;getAttrs;config;locale;announce;facadeButton=null;player=null;iframe=null;escapeHandler=null;renderedKey="";constructor(t){this.frame=t.frame,this.getAttrs=t.getAttrs,this.config=t.config,this.locale=t.locale,this.announce=t.announce,this.renderFacade()}get isActive(){return null!==this.player}facadeKey(t){return[t.provider,t.videoId,t.hash??"",t.privacy,t.title,this.config.useProviderThumbnail].join("|")}renderFacade(){this.facadeButton?.remove();const t=this.getAttrs();this.renderedKey=this.facadeKey(t);const e=document.createElement("button");e.type="button",e.className="notectl-video__facade",e.setAttribute("aria-label",this.locale.play(t.title));const n=document.createElement("span");if(n.className="notectl-video__poster",n.setAttribute("aria-hidden","true"),this.config.useProviderThumbnail){const e=N({provider:t.provider,videoId:t.videoId},this.config.providers);e&&b(n,"background-image",`url("${e}")`)}const o=document.createElement("span");o.className="notectl-video__play-icon",o.setAttribute("aria-hidden","true"),o.innerHTML='<svg viewBox="0 0 68 48" width="48" height="34" aria-hidden="true" focusable="false"><path d="M66.5 7.7c-.8-2.9-2.5-5.4-5.4-6.2C55.8.1 34 0 34 0S12.2.1 6.9 1.5C4 2.3 2.3 4.8 1.5 7.7.1 13 0 24 0 24s.1 11 1.5 16.3c.8 2.9 2.5 5.4 5.4 6.2C12.2 47.9 34 48 34 48s21.8-.1 27.1-1.5c2.9-.8 4.6-3.3 5.4-6.2C67.9 35 68 24 68 24s-.1-11-1.5-16.3z" fill="currentColor"/><path d="M45 24 27 14v20z" fill="#fff"/></svg>';const i=document.createElement("span");i.className="notectl-video__badge",i.setAttribute("aria-hidden","true"),i.textContent=this.locale.providerBadge(H(t.provider,this.config.providers)),e.append(n,o,i),e.addEventListener("mousedown",t=>t.stopPropagation()),e.addEventListener("click",t=>{t.preventDefault(),t.stopPropagation(),this.activate()}),this.facadeButton=e,this.frame.insertBefore(e,this.frame.firstChild)}update(){const t=this.getAttrs(),e=this.facadeKey(t);if(e!==this.renderedKey){if(this.renderedKey=e,this.isActive&&this.iframe){const e=pt(t,this.config,this.locale);return this.iframe.replaceWith(e),void(this.iframe=e)}this.renderFacade()}}activate(){if(this.isActive||!this.facadeButton)return;const t=this.getAttrs(),e=document.createElement("div");e.className="notectl-video__player";const n=document.createElement("button");n.type="button",n.className="notectl-video__exit",n.setAttribute("aria-label",this.locale.closePlayer),n.innerHTML='<svg viewBox="0 0 24 24" width="20" height="20" aria-hidden="true" focusable="false"><path d="M19 6.4 17.6 5 12 10.6 6.4 5 5 6.4 10.6 12 5 17.6 6.4 19 12 13.4 17.6 19 19 17.6 13.4 12z" fill="currentColor"/></svg>',n.addEventListener("mousedown",t=>t.stopPropagation()),n.addEventListener("click",t=>{t.preventDefault(),t.stopPropagation(),this.deactivate(!0)});const o=pt(t,this.config,this.locale);e.append(n,o),this.facadeButton.remove(),this.facadeButton=null,this.frame.insertBefore(e,this.frame.firstChild),this.player=e,this.iframe=o,this.escapeHandler=t=>{"Escape"===t.key&&(t.stopPropagation(),this.deactivate(!0))},this.frame.addEventListener("keydown",this.escapeHandler),o.focus(),this.announce(this.locale.enteredPlayer(t.title))}deactivate(t){this.player&&(this.escapeHandler&&(this.frame.removeEventListener("keydown",this.escapeHandler),this.escapeHandler=null),this.player.remove(),this.player=null,this.iframe=null,this.renderFacade(),t&&this.facadeButton?.focus(),this.announce(this.locale.exitedPlayer))}destroy(){this.escapeHandler&&(this.frame.removeEventListener("keydown",this.escapeHandler),this.escapeHandler=null),this.player?.remove(),this.player=null,this.iframe=null,this.facadeButton?.remove(),this.facadeButton=null}},mt=["w","e"],vt={w:-1,e:1},ft=null;function bt(){ft?.remove(),ft=null}function gt(t,e,n,o,i,r){let a=0,l=0,s=0,d=0,c=vt[e];const u=t=>{const e=(t.clientX-a)*c;var n,r;n=l+(s>0?e/s*100:0),r=i.minPercent,d=Math.max(r,Math.min(100,n)),i.applyLiveWidth(d),o.textContent=i.formatPercent(Math.round(d))},p=t=>{document.removeEventListener("pointermove",u),document.removeEventListener("pointerup",p),n.classList.remove("notectl-video__resize-overlay--active"),o.classList.remove("notectl-video__size-indicator--visible"),bt(),i.commit(Math.round(d)),t.target?.releasePointerCapture?.(t.pointerId)};r(()=>{document.removeEventListener("pointermove",u),document.removeEventListener("pointerup",p)}),t.addEventListener("pointerdown",t=>{t.preventDefault(),t.stopPropagation(),a=t.clientX,l=i.getWidthPercent(),d=l,s=i.getReferenceWidth(),c=i.isRtl()?-vt[e]:vt[e],n.classList.add("notectl-video__resize-overlay--active"),o.textContent=i.formatPercent(Math.round(l)),o.classList.add("notectl-video__size-indicator--visible"),function(t){bt(),ft=document.createElement("style");const e=g(t);e&&ft.setAttribute("nonce",e),ft.textContent="*{cursor:ew-resize!important;user-select:none!important}",document.head.appendChild(ft)}(n),t.target.setPointerCapture(t.pointerId),document.addEventListener("pointermove",u),document.addEventListener("pointerup",p)})}function yt(t,e,n){const o=document.createElement("button");return o.type="button",o.className="notectl-video__tool",o.setAttribute("aria-label",t),o.title=t,o.innerHTML=e,o.addEventListener("mousedown",t=>t.preventDefault()),o.addEventListener("click",t=>{t.preventDefault(),t.stopPropagation(),n()}),o}function xt(t){const{config:e,locale:n,resolvedKeymap:o,announce:i,actions:r}=t;return(t,a,l)=>{const s=document.createElement("figure");s.className="notectl-video",s.setAttribute("data-block-id",t.id),s.setAttribute("data-void","true"),s.setAttribute("data-selectable","true");const d=document.createElement("div");d.className="notectl-video__frame",s.appendChild(d);let c=t.id,u=K(t.attrs,e),p=null,h=null,m=null;const v=new ht({frame:d,getAttrs:()=>u,config:e,locale:n,announce:i});function g(t){var o;u=K(t.attrs,e),st(d,u.aspectRatio,u.widthPercent),lt(s,u.align),s.setAttribute("aria-label",n.videoAria(H(u.provider,e.providers),u.title)),(o=u.caption)?(p||(p=document.createElement("figcaption"),p.className="notectl-video__caption",s.appendChild(p)),p.textContent!==o&&(p.textContent=o)):p&&(p.remove(),p=null),v.update(),m?.update(u.align)}function y(){h&&(h.destroy(),h.element.remove(),h=null)}return g(t),{dom:s,contentDOM:null,update:t=>"video"===t.type&&(c=t.id,s.setAttribute("data-block-id",t.id),g(t),!0),selectNode(){s.classList.add("notectl-video--selected"),e.resizable&&!h&&(h=function(t,e){const n=document.createElement("div");n.className="notectl-video__resize-overlay",n.setAttribute("data-notectl-no-print","");const o=document.createElement("div");o.className="notectl-video__size-indicator",n.appendChild(o);let i=null;for(const r of mt){const e=document.createElement("div");e.className=`notectl-video__resize-handle notectl-video__resize-handle--${r}`,e.setAttribute("aria-hidden","true"),gt(e,r,n,o,t,t=>{i=t}),n.appendChild(e)}if(e){const t=document.createElement("div");t.className="notectl-video__keyboard-hint",t.setAttribute("aria-hidden","true"),t.textContent=e,n.appendChild(t)}return{element:n,destroy(){i?.(),bt()}}}({minPercent:e.minWidthPercent,getWidthPercent:()=>u.widthPercent,getReferenceWidth:()=>s.clientWidth||d.clientWidth,isRtl:()=>"rtl"===f(s),applyLiveWidth:t=>b(d,"width",`${t}%`),commit:t=>function(t){const e=a(),n=e.getBlock(c);if(!n)return;const o=e.getNodePath(c);if(!o)return;const i={...n.attrs??{},widthPercent:t};l(e.transaction("command").setNodeAttr(o,i).build())}(t),formatPercent:t=>`${t}%`},function(t,e){const n=t.shrinkWidth??null,o=t.growWidth??null;return n&&o?e.keyboardResizeHint(_(n),_(o)):""}(o,n)),d.appendChild(h.element)),m||(m=function(t){const{locale:e,actions:n}=t,o=document.createElement("div");o.className="notectl-video__toolbar",o.setAttribute("role","toolbar"),o.setAttribute("aria-label",e.videoOptions),o.setAttribute("data-notectl-no-print",""),o.addEventListener("mousedown",t=>t.stopPropagation());const i=yt(e.editVideo,'<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04a1 1 0 0 0 0-1.41l-2.34-2.34a1 1 0 0 0-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z" fill="currentColor"/></svg>',()=>n.edit()),r={start:yt(e.alignStart,'<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M3 4h18v2H3V4zm0 7h12v2H3v-2zm0 7h18v2H3v-2zm0-3.5h12v-2H3v2z" fill="currentColor"/></svg>',()=>n.align("start")),center:yt(e.alignCenter,'<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M3 4h18v2H3V4zm3 7h12v2H6v-2zm-3 7h18v2H3v-2zm3-3.5h12v-2H6v2z" fill="currentColor"/></svg>',()=>n.align("center")),end:yt(e.alignEnd,'<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M3 4h18v2H3V4zm6 7h12v2H9v-2zm-6 7h18v2H3v-2zm6-3.5h12v-2H9v2z" fill="currentColor"/></svg>',()=>n.align("end"))},a=yt(e.deleteVideo,'<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M6 19a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z" fill="currentColor"/></svg>',()=>n.remove()),l=()=>{const t=document.createElement("span");return t.className="notectl-video__tool-separator",t.setAttribute("aria-hidden","true"),t};o.append(i,l(),r.start,r.center,r.end,l(),a);const s=t=>{for(const e of["start","center","end"]){const n=e===t;r[e].classList.toggle("notectl-video__tool--active",n),r[e].setAttribute("aria-pressed",n?"true":"false")}};return s(t.initialAlign),{element:o,update:s,destroy(){o.remove()}}}({locale:n,actions:r,initialAlign:u.align}),s.appendChild(m.element))},deselectNode(){s.classList.remove("notectl-video--selected"),y(),m?.destroy(),m=null},destroy(){y(),m?.destroy(),m=null,v.destroy()}}}}function _t(t){return(e,n,o)=>{const i=function(t,e,n){const o=t.trim();if(o&&!/\s/.test(o)){const t=I(o,n);if(t)return{url:o,match:t}}const i=function(t){if(!t)return null;const e=function(t){const e=document.createElement("template");return e.innerHTML=t,e.content}(t),n=e.querySelector("iframe");if(!n)return null;const o=e.cloneNode(!0);for(const i of Array.from(o.querySelectorAll("iframe")))i.remove();return""!==(o.textContent??"").trim()?null:n.getAttribute("src")}(e);if(i){const t=I(i,n);if(t)return{url:$(t,n)??i,match:t}}return null}(e,n,t.providers);if(!i)return null;const r=o.selection;if(!u(r)||!s(r))return null;const a=r.anchor.blockId,l=r.anchor.offset,d=l+i.url.length,p=o.transaction("paste").insertText(a,l,i.url,[]).setSelection(c(a,d)).build();return t.onOffer({blockId:a,start:l,end:d},i.match),p}}var wt=0,At=/* @__PURE__ */new Set,kt=null;var Ct=class{id="video";name="Video";priority=47;config;resolvedKeymap;context=null;locale=ot;overlay=null;embedPrompt=null;constructor(t){this.config={...W,...t},this.resolvedKeymap={...M,...t?.keymap}}async init(n){this.context=n,this.locale=await x(n,this.config.locale,ot,rt),n.registerStyleSheet('\n.notectl-video {\n\tmargin: 12px 0;\n\tposition: relative;\n\tuser-select: none;\n}\n\n.notectl-video--center { text-align: center; }\n.notectl-video--start { text-align: start; }\n.notectl-video--end { text-align: end; }\n\n.notectl-video__frame {\n\tdisplay: inline-block;\n\tposition: relative;\n\twidth: 100%;\n\tmax-width: 100%;\n\tvertical-align: top;\n\toverflow: hidden;\n\tborder-radius: 8px;\n\tbackground: #000;\n\ttext-align: start;\n}\n\n/* Facade (click-to-load) */\n.notectl-video__facade {\n\tposition: absolute;\n\tinset: 0;\n\twidth: 100%;\n\theight: 100%;\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\tpadding: 0;\n\tborder: 0;\n\tcursor: pointer;\n\tbackground: #14181c;\n\tcolor: #fff;\n}\n\n.notectl-video__facade:focus-visible {\n\toutline: 3px solid var(--notectl-primary);\n\toutline-offset: -3px;\n}\n\n.notectl-video__poster {\n\tposition: absolute;\n\tinset: 0;\n\tbackground-size: cover;\n\tbackground-position: center;\n\tbackground-repeat: no-repeat;\n}\n\n.notectl-video__poster::after {\n\tcontent: "";\n\tposition: absolute;\n\tinset: 0;\n\tbackground: rgba(0, 0, 0, 0.25);\n}\n\n.notectl-video__play-icon {\n\tposition: relative;\n\tz-index: 1;\n\tdisplay: inline-flex;\n\tfilter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.5));\n\ttransition: transform 0.12s ease;\n}\n\n.notectl-video__facade:hover .notectl-video__play-icon {\n\ttransform: scale(1.08);\n}\n\n.notectl-video__badge {\n\tposition: absolute;\n\tz-index: 1;\n\tbottom: 8px;\n\tinset-inline-start: 8px;\n\tpadding: 2px 6px;\n\tborder-radius: 4px;\n\tbackground: rgba(0, 0, 0, 0.65);\n\tcolor: #fff;\n\tfont-size: 12px;\n\tfont-weight: 600;\n}\n\n/* Player (activated iframe + exit control) */\n.notectl-video__player {\n\tposition: absolute;\n\tinset: 0;\n}\n\n.notectl-video__iframe {\n\tposition: absolute;\n\tinset: 0;\n\twidth: 100%;\n\theight: 100%;\n\tborder: 0;\n\tdisplay: block;\n}\n\n.notectl-video__exit {\n\tposition: absolute;\n\tz-index: 2;\n\ttop: 6px;\n\tinset-inline-end: 6px;\n\twidth: 28px;\n\theight: 28px;\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\tborder: 0;\n\tborder-radius: 50%;\n\tcursor: pointer;\n\tbackground: rgba(0, 0, 0, 0.65);\n\tcolor: #fff;\n}\n\n.notectl-video__exit:focus-visible {\n\toutline: 2px solid #fff;\n\toutline-offset: 2px;\n}\n\n/* Static fallback link (no-JS / export rehydration) */\n.notectl-video__fallback-link {\n\tposition: absolute;\n\tinset: 0;\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\tpadding: 8px;\n\tcolor: #fff;\n\ttext-decoration: underline;\n\ttext-align: center;\n}\n\n/* Caption */\n.notectl-video__caption {\n\tmargin-top: 6px;\n\tfont-size: 13px;\n\tcolor: var(--notectl-fg-muted);\n\ttext-align: center;\n}\n\n/* Selection */\n.notectl-video--selected .notectl-video__frame {\n\toutline: 2px solid var(--notectl-primary);\n\toutline-offset: 2px;\n}\n\n/* Resize overlay + side handles */\n.notectl-video__resize-overlay {\n\tposition: absolute;\n\tinset: 0;\n\tpointer-events: none;\n}\n\n.notectl-video__resize-handle {\n\tposition: absolute;\n\ttop: 50%;\n\ttransform: translateY(-50%);\n\twidth: 8px;\n\theight: 44px;\n\tmax-height: 60%;\n\tborder: 2px solid var(--notectl-primary);\n\tborder-radius: 6px;\n\tbackground: var(--notectl-surface-raised);\n\tpointer-events: all;\n\tcursor: ew-resize;\n\tz-index: 2;\n}\n\n.notectl-video__resize-handle--w { inset-inline-start: -5px; }\n.notectl-video__resize-handle--e { inset-inline-end: -5px; }\n\n.notectl-video__size-indicator {\n\tposition: absolute;\n\tbottom: -28px;\n\tleft: 50%;\n\ttransform: translateX(-50%);\n\tpadding: 2px 8px;\n\tborder-radius: 4px;\n\tbackground: var(--notectl-tooltip-bg);\n\tcolor: var(--notectl-tooltip-fg);\n\tfont-size: 11px;\n\tfont-weight: 500;\n\twhite-space: nowrap;\n\tpointer-events: none;\n\topacity: 0;\n\ttransition: opacity 0.15s;\n\tz-index: 3;\n}\n\n.notectl-video__size-indicator--visible { opacity: 1; }\n\n.notectl-video__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-video--selected .notectl-video__keyboard-hint { display: block; }\n.notectl-video__resize-overlay--active ~ .notectl-video__keyboard-hint,\n.notectl-video__resize-overlay--active .notectl-video__keyboard-hint { display: none; }\n\n/* On-selection toolbar */\n.notectl-video__toolbar {\n\tposition: absolute;\n\ttop: -44px;\n\tleft: 50%;\n\ttransform: translateX(-50%);\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 2px;\n\tpadding: 2px;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 6px;\n\tbackground: var(--notectl-surface-overlay);\n\tbox-shadow: 0 2px 8px var(--notectl-shadow);\n\tz-index: 10;\n}\n\n.notectl-video__tool {\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\twidth: 28px;\n\theight: 28px;\n\tborder: none;\n\tborder-radius: 4px;\n\tbackground: transparent;\n\tcursor: pointer;\n\tcolor: var(--notectl-fg);\n}\n\n.notectl-video__tool:hover { background: var(--notectl-hover-bg); }\n\n.notectl-video__tool--active {\n\tbackground: var(--notectl-active-bg);\n\tcolor: var(--notectl-primary);\n}\n\n.notectl-video__tool:focus-visible {\n\toutline: 2px solid var(--notectl-primary);\n\toutline-offset: 1px;\n}\n\n.notectl-video__tool svg { width: 16px; height: 16px; }\n\n.notectl-video__tool-separator {\n\twidth: 1px;\n\theight: 18px;\n\tmargin: 0 2px;\n\tbackground: var(--notectl-border);\n}\n\n@media (prefers-reduced-motion: reduce) {\n\t.notectl-video__play-icon,\n\t.notectl-video__size-indicator {\n\t\ttransition: none;\n\t}\n}\n\n@media (forced-colors: active) {\n\t.notectl-video__frame { outline: 1px solid CanvasText; }\n\t.notectl-video__facade { border: 1px solid ButtonText; }\n\t.notectl-video__play-icon { forced-color-adjust: none; }\n\t.notectl-video__resize-handle { background: ButtonFace; border-color: ButtonText; }\n\t.notectl-video--selected .notectl-video__frame { outline: 2px solid Highlight; }\n}\n'),n.registerStyleSheet("\n.notectl-video-overlay {\n\tposition: fixed;\n\tz-index: 1000;\n\tbox-sizing: border-box;\n\tmin-width: 300px;\n\tmax-width: 92vw;\n\tpadding: 12px;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 8px;\n\tbackground: var(--notectl-surface-overlay);\n\tcolor: var(--notectl-fg);\n\tbox-shadow: 0 6px 24px var(--notectl-shadow);\n}\n\n.notectl-video-popup {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 10px;\n}\n\n.notectl-video-popup__field {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 4px;\n}\n\n.notectl-video-popup__label {\n\tfont-size: 12px;\n\tfont-weight: 600;\n\tcolor: var(--notectl-fg-muted);\n}\n\n.notectl-video-popup__input,\n.notectl-video-popup__select {\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-raised);\n\tcolor: var(--notectl-fg);\n\tfont: inherit;\n}\n\n.notectl-video-popup__input:focus-visible,\n.notectl-video-popup__select:focus-visible {\n\toutline: 2px solid var(--notectl-primary);\n\toutline-offset: 1px;\n}\n\n.notectl-video-popup__hint {\n\tmargin: 0;\n\tfont-size: 11px;\n\tcolor: var(--notectl-fg-muted);\n}\n\n.notectl-video-popup__error:not(:empty) {\n\tmargin: 0;\n\tpadding: 6px 8px;\n\tborder-radius: 4px;\n\tbackground: var(--notectl-danger-muted);\n\tcolor: var(--notectl-danger);\n\tfont-size: 12px;\n}\n\n.notectl-video-popup__actions {\n\tdisplay: flex;\n\tjustify-content: flex-end;\n\tgap: 8px;\n\tmargin-top: 2px;\n}\n\n.notectl-video-popup__cancel,\n.notectl-video-popup__submit {\n\tpadding: 7px 14px;\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\tfont: inherit;\n}\n\n.notectl-video-popup__submit {\n\tborder-color: var(--notectl-primary);\n\tbackground: var(--notectl-primary);\n\tcolor: var(--notectl-primary-fg);\n\tfont-weight: 600;\n}\n\n.notectl-video-popup__cancel:focus-visible,\n.notectl-video-popup__submit:focus-visible {\n\toutline: 2px solid var(--notectl-primary);\n\toutline-offset: 2px;\n}\n\n/* Ask-first paste affordance */\n.notectl-video-embed-prompt {\n\tposition: fixed;\n\tz-index: 1000;\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 8px;\n\tpadding: 6px 8px 6px 12px;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 8px;\n\tbackground: var(--notectl-surface-overlay);\n\tcolor: var(--notectl-fg);\n\tbox-shadow: 0 4px 16px var(--notectl-shadow);\n\tfont-size: 13px;\n}\n\n.notectl-video-embed-prompt__text {\n\tmargin-inline-end: 4px;\n}\n\n.notectl-video-embed-prompt__embed,\n.notectl-video-embed-prompt__dismiss {\n\tpadding: 4px 10px;\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\tfont: inherit;\n}\n\n.notectl-video-embed-prompt__embed {\n\tborder-color: var(--notectl-primary);\n\tbackground: var(--notectl-primary);\n\tcolor: var(--notectl-primary-fg);\n\tfont-weight: 600;\n}\n\n.notectl-video-embed-prompt__embed:focus-visible,\n.notectl-video-embed-prompt__dismiss:focus-visible {\n\toutline: 2px solid var(--notectl-primary);\n\toutline-offset: 2px;\n}\n\n@media (forced-colors: active) {\n\t.notectl-video-overlay,\n\t.notectl-video-embed-prompt {\n\t\tborder: 1px solid CanvasText;\n\t}\n\t.notectl-video-popup__submit,\n\t.notectl-video-embed-prompt__embed {\n\t\tborder: 1px solid ButtonText;\n\t}\n}\n"),function(t){for(const e of t)At.add(e);wt+=1,kt||(kt=t=>{if("iframe"!==t.nodeName.toLowerCase())return;const e=t;e.hasAttribute("srcdoc")?e.parentNode?.removeChild(e):function(t,e){const n=B(t);return!!n&&"https:"===n.protocol&&e.has(n.hostname.toLowerCase())}(e.getAttribute("src")??"",At)||e.parentNode?.removeChild(e)},A.addHook("uponSanitizeElement",kt))}(function(t=S){const e=/* @__PURE__ */new Set;for(const n of t)for(const t of n.embedHostnames)e.add(t.toLowerCase());return e}(this.config.providers)),n.registerNodeSpec(function(n,o){const i=n.providers;return{type:"video",group:"block",isVoid:!0,selectable:!0,attrs:{provider:{default:""},videoId:{default:""},hash:{default:""},aspectRatio:{default:n.defaultAspectRatio},widthPercent:{default:n.defaultWidthPercent},align:{default:"center"},title:{default:""},caption:{default:""},privacy:{default:n.privacy}},toDOM(t){const e=K(t.attrs,n),r=h("figure",t.id);r.className="notectl-video",r.setAttribute("data-void","true"),r.setAttribute("data-selectable","true"),r.setAttribute("data-video-provider",e.provider),r.setAttribute("data-video-id",e.videoId),e.hash&&r.setAttribute("data-video-hash",e.hash),lt(r,e.align),r.setAttribute("aria-label",o.videoAria(H(e.provider,i),e.title));const a=document.createElement("div");a.className="notectl-video__frame",st(a,e.aspectRatio,e.widthPercent);const l=$(ct(e),i);if(l){const t=document.createElement("a");t.className="notectl-video__fallback-link",t.href=l,t.rel="noopener noreferrer",t.textContent=e.title||l,a.appendChild(t)}if(r.appendChild(a),e.caption){const t=document.createElement("figcaption");t.className="notectl-video__caption",t.textContent=e.caption,r.appendChild(t)}return r},toHTML(o){const r=K(o.attrs,n),a=ct(r),l=$(a,i),s=[`data-video-provider="${t(r.provider)}"`,`data-video-id="${t(r.videoId)}"`,`data-video-ratio="${t(r.aspectRatio)}"`,`data-video-width="${r.widthPercent}"`,`data-video-privacy="${r.privacy?"true":"false"}"`];r.hash&&s.push(`data-video-hash="${t(r.hash)}"`),r.title&&s.push(`data-video-title="${t(r.title)}"`);const d=n.useProviderThumbnail?N(a,i):void 0,c=d?`<img src="${t(d)}" alt="">`:e(r.title||l||""),u=l?`<a href="${t(l)}" rel="noopener noreferrer">${c}</a>`:c,p=r.caption?`<figcaption>${e(r.caption)}</figcaption>`:"";return`<figure ${s.join(" ")}>${u}${p}</figure>`},parseHTML:[{tag:"figure",priority:60,getAttrs:t=>function(t,e){const n=t.getAttribute("data-video-provider"),o=t.getAttribute("data-video-id");if(!n||!o)return!1;if(!F(o))return!1;if(!R(n,e.providers))return!1;const i=t.getAttribute("data-video-title")??t.querySelector("a")?.textContent?.trim()??t.getAttribute("aria-label")??"",r=t.querySelector("figcaption")?.textContent?.trim()??"",a=t.getAttribute("data-video-width"),l={provider:n,videoId:o,aspectRatio:T(t.getAttribute("data-video-ratio")??void 0,e),widthPercent:O(a?Number.parseFloat(a):e.defaultWidthPercent,e),align:"center",title:i,privacy:"false"!==t.getAttribute("data-video-privacy")},s=t.getAttribute("data-video-hash");return s&&dt.test(s)&&(l.hash=s),r&&(l.caption=r),l}(t,n)},{tag:"iframe",priority:60,getAttrs:t=>function(t,e){const n=I(t.getAttribute("src")??"",e.providers);if(!n||!F(n.videoId))return!1;const o={provider:n.provider,videoId:n.videoId,aspectRatio:ut(t,e),widthPercent:e.defaultWidthPercent,align:"center",title:t.getAttribute("title")??"",privacy:e.privacy};return n.hash&&(o.hash=n.hash),o}(t,n)}],sanitize:{tags:["figure","figcaption","a","img","iframe"],attrs:["href","rel","src","alt","title","allow","allowfullscreen","referrerpolicy","loading","width","height","frameborder","class","style"]}}}(this.config,this.locale)),this.overlay=new et(n,this.config,this.locale),this.registerNodeView(n),function(t){t.registerCommand("removeVideo",()=>Y(t))}(n),this.registerInsertCommand(n),this.registerResizeCommands(n),this.registerResizeKeymaps(n),this.registerPasteInterceptor(n),this.registerToolbarItem(n)}destroy(){(wt=Math.max(0,wt-1))>0||!kt||(A.removeHook("uponSanitizeElement"),kt=null,At.clear()),this.embedPrompt?.close(),this.embedPrompt=null,this.overlay?.close(!1),this.overlay=null,this.context=null}onStateChange(t,e,n){this.context&&!this.isVideoSelected(t)&&this.isVideoSelected(e)&&this.announceVideoSelection(e)}registerNodeView(t){t.registerNodeView(j,xt({config:this.config,locale:this.locale,resolvedKeymap:this.resolvedKeymap,announce:e=>t.announce(e),actions:{edit:()=>this.overlay?.openEditForSelected(),align:e=>function(t,e){const n=X(t.getState());return!!n&&Z(t,{...n.block.attrs??{},align:e})}(t,e),remove:()=>Y(t)}}))}registerInsertCommand(t){t.registerCommand("insertVideo",()=>(this.isVideoSelected(t.getState())?this.overlay?.openEditForSelected():this.overlay?.openInsert(),!0))}registerResizeCommands(t){const e=this.config.widthStep,n=this.config.widthStepLarge,o=e=>{const n=function(t,e,n){const o=X(t.getState());if(!o)return!1;const i=o.block.attrs?.widthPercent??n.defaultWidthPercent,r=O(i+e,n);return r!==i&&Z(t,{...o.block.attrs??{},widthPercent:r})}(t,e,this.config);return n&&this.announceCurrentSize(t),n};t.registerCommand("resizeVideoGrow",()=>o(e)),t.registerCommand("resizeVideoShrink",()=>o(-e)),t.registerCommand("resizeVideoGrowLarge",()=>o(n)),t.registerCommand("resizeVideoShrinkLarge",()=>o(-n)),t.registerCommand("resetVideoSize",()=>{const e=function(t,e){const n=X(t.getState());return!!n&&Z(t,{...n.block.attrs??{},widthPercent:e.defaultWidthPercent})}(t,this.config);return e&&t.announce(this.locale.resetToDefaultSize),e})}registerResizeKeymaps(t){const e={growWidth:"resizeVideoGrow",shrinkWidth:"resizeVideoShrink",growWidthLarge:"resizeVideoGrowLarge",shrinkWidthLarge:"resizeVideoShrinkLarge",resetSize:"resetVideoSize"},n={};for(const[o,i]of Object.entries(e)){const e=this.resolvedKeymap[o]??null;e&&(n[e]=()=>t.executeCommand(i))}Object.keys(n).length>0&&t.registerKeymap(n)}registerPasteInterceptor(t){t.registerPasteInterceptor(_t({providers:this.config.providers,onOffer:(t,e)=>this.offerEmbed(t,e)}),{name:"video",priority:40})}offerEmbed(t,e){if(!this.context)return;const o=this.context,i=H(e.provider,this.config.providers);this.embedPrompt?.close(),requestAnimationFrame(()=>{o.announce(this.locale.embedOfferAnnounce(i));const e=function(t,e){const o=t.getBlock(e.blockId);if(!o)return"";const i=n(o);return i.slice(e.start,Math.min(e.end,i.length))}(o.getState(),t);this.embedPrompt=function(t){const{locale:e}=t,n=document.createElement("div");n.className="notectl-video-embed-prompt",n.setAttribute("role","dialog"),n.setAttribute("aria-label",e.embedPrompt);const o=document.createElement("span");o.className="notectl-video-embed-prompt__text",o.textContent=e.embedPrompt;const i=document.createElement("button");i.type="button",i.className="notectl-video-embed-prompt__embed",i.textContent=e.embedConfirm;const r=document.createElement("button");r.type="button",r.className="notectl-video-embed-prompt__dismiss",r.textContent=e.embedDismiss,n.append(o,i,r);let a=null,l=!1;const s=()=>{l||(l=!0,a&&(document.removeEventListener("mousedown",a,!0),a=null),n.remove())},d=t=>{s(),t()};return i.addEventListener("mousedown",t=>t.preventDefault()),i.addEventListener("click",e=>{e.preventDefault(),d(t.onEmbed)}),r.addEventListener("mousedown",t=>t.preventDefault()),r.addEventListener("click",e=>{e.preventDefault(),d(t.onDismiss)}),n.addEventListener("keydown",e=>{"Escape"===e.key&&(e.preventDefault(),e.stopPropagation(),d(t.onDismiss))}),t.container.appendChild(n),w(n),function(t,e){const n=e?e.bottom:window.innerHeight/3,o=e?e.left:window.innerWidth/3,i=t.offsetWidth||240,r=window.innerWidth-i-8,a=Math.max(8,Math.min(o,r)),l=window.innerHeight-t.offsetHeight-8,s=Math.min(n+8,Math.max(8,l));t.style.left=`${Math.round(a)}px`,t.style.top=`${Math.round(s)}px`}(n,t.rect),a=e=>{e.composedPath().includes(n)||d(t.onDismiss)},requestAnimationFrame(()=>{a&&document.addEventListener("mousedown",a,!0),i.focus()}),{close:s}}({container:o.getPluginContainer("top"),rect:Pt(),locale:this.locale,onEmbed:()=>{this.embedPrompt=null,this.overlay?.openInsertReplacingRange(t,e)},onDismiss:()=>{this.embedPrompt=null,o.getContainer().focus()}})})}registerToolbarItem(t){t.registerToolbarItem({id:"video",group:"insert",icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 4h16a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2zm6 4.5v7l6-3.5-6-3.5z" fill="currentColor"/></svg>',label:this.locale.insertVideo,tooltip:this.locale.insertVideoTooltip,command:"insertVideo"})}isVideoSelected(t){const e=t.selection;return!!l(e)&&t.getBlock(e.nodeId)?.type===j}announceVideoSelection(t){if(!this.context)return;const e=t.selection;if(!l(e))return;const n=t.getBlock(e.nodeId);if(!n||"video"!==n.type)return;const o=n.attrs?.title??"",i=[o?this.locale.videoSelectedWithTitle(o):this.locale.videoSelected],r=this.resolvedKeymap.shrinkWidth??null,a=this.resolvedKeymap.growWidth??null;r&&a&&i.push(this.locale.resizeHint(_(r),_(a))),this.context.announce(i.join(" "))}announceCurrentSize(t){const e=function(t,e){const n=X(t);return n?n.block.attrs?.widthPercent??e.defaultWidthPercent:null}(t.getState(),this.config);null!==e&&t.announce(this.locale.videoResized(e))}};function Pt(){const t=window.getSelection();if(!t||0===t.rangeCount)return null;const e=t.getRangeAt(0).getBoundingClientRect();return 0===e.width&&0===e.height&&0===e.top&&0===e.left?null:e}export{M as a,W as i,ot as n,S as o,rt as r,I as s,Ct as t};
|
|
2
|
+
//# sourceMappingURL=VideoPlugin-BrR8g6Rz.mjs.map
|