@notectl/core 2.3.1 → 2.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/THIRD-PARTY-NOTICES.md +129 -0
- package/dist/chunks/AlignmentPlugin-DIwrRsHd.mjs +2 -0
- package/dist/chunks/AlignmentPlugin-DIwrRsHd.mjs.map +1 -0
- package/dist/chunks/{AttrRegistry-B3zB02z9.mjs → AttrRegistry-CtNhf2EF.mjs} +2 -2
- package/dist/chunks/{AttrRegistry-B3zB02z9.mjs.map → AttrRegistry-CtNhf2EF.mjs.map} +1 -1
- package/dist/chunks/AttributedMarkCommands-B3MQdob_.mjs +2 -0
- package/dist/chunks/AttributedMarkCommands-B3MQdob_.mjs.map +1 -0
- package/dist/chunks/{BidiIsolationPlugin-DBXyXpgm.mjs → BidiIsolationPlugin-cOLlL3Y9.mjs} +2 -2
- package/dist/chunks/{BidiIsolationPlugin-DBXyXpgm.mjs.map → BidiIsolationPlugin-cOLlL3Y9.mjs.map} +1 -1
- package/dist/chunks/BlockInsertion-O5pAFKid.mjs +2 -0
- package/dist/chunks/{BlockInsertion-CJusvrDL.mjs.map → BlockInsertion-O5pAFKid.mjs.map} +1 -1
- package/dist/chunks/BlockquotePlugin-D-jRWLQB.mjs +2 -0
- package/dist/chunks/{BlockquotePlugin-Bz2glHwX.mjs.map → BlockquotePlugin-D-jRWLQB.mjs.map} +1 -1
- package/dist/chunks/CaretNavigationPlugin-Clv8dzR5.mjs +2 -0
- package/dist/chunks/CaretNavigationPlugin-Clv8dzR5.mjs.map +1 -0
- package/dist/chunks/CodeBlockPlugin-BandNM3t.mjs +2 -0
- package/dist/chunks/{CodeBlockPlugin-C1hrdbSZ.mjs.map → CodeBlockPlugin-BandNM3t.mjs.map} +1 -1
- package/dist/chunks/ColorGrid-D0vLHsG6.mjs +2 -0
- package/dist/chunks/{ColorGrid-C9RQoEWF.mjs.map → ColorGrid-D0vLHsG6.mjs.map} +1 -1
- package/dist/chunks/ColorPickerPopup-_C5JZhki.mjs +2 -0
- package/dist/chunks/{ColorPickerPopup-DiA68Pzz.mjs.map → ColorPickerPopup-_C5JZhki.mjs.map} +1 -1
- package/dist/chunks/ColorValidation-B9d_umnf.mjs +2 -0
- package/dist/chunks/{ColorValidation-DAijTjG9.mjs.map → ColorValidation-B9d_umnf.mjs.map} +1 -1
- package/dist/chunks/Commands-D-0UXYvo.mjs +2 -0
- package/dist/chunks/Commands-D-0UXYvo.mjs.map +1 -0
- package/dist/chunks/ContentModel-Bzmzeqwg.mjs +2 -0
- package/dist/chunks/{ContentModel-NpAj7vGW.mjs.map → ContentModel-Bzmzeqwg.mjs.map} +1 -1
- package/dist/chunks/CursorMarks-dx51OGBf.mjs +2 -0
- package/dist/chunks/CursorMarks-dx51OGBf.mjs.map +1 -0
- package/dist/chunks/Decoration-BwhoA4MU.mjs +3 -0
- package/dist/chunks/Decoration-BwhoA4MU.mjs.map +1 -0
- package/dist/chunks/{DirectionDetection-CDVSEWQ6.mjs → DirectionDetection-ZrkMhyaL.mjs} +2 -2
- package/dist/chunks/{DirectionDetection-CDVSEWQ6.mjs.map → DirectionDetection-ZrkMhyaL.mjs.map} +1 -1
- package/dist/chunks/Document-D_2cIBJG.mjs +2 -0
- package/dist/chunks/Document-D_2cIBJG.mjs.map +1 -0
- package/dist/chunks/DocumentParser-i-CreJ48.mjs +2 -0
- package/dist/chunks/DocumentParser-i-CreJ48.mjs.map +1 -0
- package/dist/chunks/{FontPlugin-By-TGrQo.mjs → FontPlugin-B4Ouhmpe.mjs} +2 -2
- package/dist/chunks/{FontPlugin-By-TGrQo.mjs.map → FontPlugin-B4Ouhmpe.mjs.map} +1 -1
- package/dist/chunks/FontSizePlugin-CZB-AwZQ.mjs +2 -0
- package/dist/chunks/{FontSizePlugin-Dln-tYXV.mjs.map → FontSizePlugin-CZB-AwZQ.mjs.map} +1 -1
- package/dist/chunks/FormulaPlugin-C7N3QXDx.mjs +2 -0
- package/dist/chunks/FormulaPlugin-C7N3QXDx.mjs.map +1 -0
- package/dist/chunks/GapCursorPlugin-NozsEK9J.mjs +2 -0
- package/dist/chunks/GapCursorPlugin-NozsEK9J.mjs.map +1 -0
- package/dist/chunks/HTMLSanitization-Ce9dVT1q.mjs +2 -0
- package/dist/chunks/HTMLSanitization-Ce9dVT1q.mjs.map +1 -0
- package/dist/chunks/HTMLUtils-B0nGyFLb.mjs +2 -0
- package/dist/chunks/{HTMLUtils-Bhg3_P8B.mjs.map → HTMLUtils-B0nGyFLb.mjs.map} +1 -1
- package/dist/chunks/HardBreakPlugin-CC4rntSX.mjs +2 -0
- package/dist/chunks/{HardBreakPlugin-DlbSlrdq.mjs.map → HardBreakPlugin-CC4rntSX.mjs.map} +1 -1
- package/dist/chunks/HeadingPlugin-hubN_Ebt.mjs +2 -0
- package/dist/chunks/{HeadingPlugin-uMAjPOk5.mjs.map → HeadingPlugin-hubN_Ebt.mjs.map} +1 -1
- package/dist/chunks/{HighlightPlugin-Bj7FPkIQ.mjs → HighlightPlugin-CE_MgFNz.mjs} +2 -2
- package/dist/chunks/{HighlightPlugin-Bj7FPkIQ.mjs.map → HighlightPlugin-CE_MgFNz.mjs.map} +1 -1
- package/dist/chunks/{HorizontalRulePlugin-DUVmTQpX.mjs → HorizontalRulePlugin-CxmUMM34.mjs} +2 -2
- package/dist/chunks/{HorizontalRulePlugin-DUVmTQpX.mjs.map → HorizontalRulePlugin-CxmUMM34.mjs.map} +1 -1
- package/dist/chunks/{ImagePlugin-FToCOjd5.mjs → ImagePlugin-B_y4STEr.mjs} +2 -2
- package/dist/chunks/{ImagePlugin-FToCOjd5.mjs.map → ImagePlugin-B_y4STEr.mjs.map} +1 -1
- package/dist/chunks/InlineCodePlugin-C1SqGfv5.mjs +2 -0
- package/dist/chunks/{InlineCodePlugin-pISIoGQE.mjs.map → InlineCodePlugin-C1SqGfv5.mjs.map} +1 -1
- package/dist/chunks/{InlineStyleMarkSpec-CjSRj4f_.mjs → InlineStyleMarkSpec-Cx3goc3W.mjs} +2 -2
- package/dist/chunks/{InlineStyleMarkSpec-CjSRj4f_.mjs.map → InlineStyleMarkSpec-Cx3goc3W.mjs.map} +1 -1
- package/dist/chunks/{LinkPlugin-Ct5Z180S.mjs → LinkPlugin-BwXDGHPe.mjs} +2 -2
- package/dist/chunks/{LinkPlugin-Ct5Z180S.mjs.map → LinkPlugin-BwXDGHPe.mjs.map} +1 -1
- package/dist/chunks/ListPlugin-DSFPSWQC.mjs +2 -0
- package/dist/chunks/ListPlugin-DSFPSWQC.mjs.map +1 -0
- package/dist/chunks/MarkCommands-CJvLGL5G.mjs +2 -0
- package/dist/chunks/MarkCommands-CJvLGL5G.mjs.map +1 -0
- package/dist/chunks/{MarkInputRule-Bdi8KPus.mjs → MarkInputRule-DNneF2gp.mjs} +2 -2
- package/dist/chunks/{MarkInputRule-Bdi8KPus.mjs.map → MarkInputRule-DNneF2gp.mjs.map} +1 -1
- package/dist/chunks/MarkdownHTMLRegistry-CISsC0lH.mjs +2 -0
- package/dist/chunks/{MarkdownHTMLRegistry-CKEx7LkR.mjs.map → MarkdownHTMLRegistry-CISsC0lH.mjs.map} +1 -1
- package/dist/chunks/MarkdownParser-D1d9zB0R.mjs +2 -0
- package/dist/chunks/{MarkdownParser-CWt3M6jR.mjs.map → MarkdownParser-D1d9zB0R.mjs.map} +1 -1
- package/dist/chunks/MarkdownSerializer-Oex2RzNw.mjs +2 -0
- package/dist/chunks/{MarkdownSerializer-J-i28out.mjs.map → MarkdownSerializer-Oex2RzNw.mjs.map} +1 -1
- package/dist/chunks/MathFont-BS8IwYh2.mjs +2 -0
- package/dist/chunks/MathFont-BS8IwYh2.mjs.map +1 -0
- package/dist/chunks/{NodeResolver-Dleih-8R.mjs → NodeResolver-BtIknXqD.mjs} +2 -2
- package/dist/chunks/{NodeResolver-Dleih-8R.mjs.map → NodeResolver-BtIknXqD.mjs.map} +1 -1
- package/dist/chunks/NodeSelectionCommands-DK3iEh18.mjs +2 -0
- package/dist/chunks/{NodeSelectionCommands-1PjwUDTJ.mjs.map → NodeSelectionCommands-DK3iEh18.mjs.map} +1 -1
- package/dist/chunks/NodeSpecPatching-BrjPAbqe.mjs +2 -0
- package/dist/chunks/NodeSpecPatching-BrjPAbqe.mjs.map +1 -0
- package/dist/chunks/PluginHelpers-WG1Lzzh3.mjs +2 -0
- package/dist/chunks/{PluginHelpers-Dx_0hfDe.mjs.map → PluginHelpers-WG1Lzzh3.mjs.map} +1 -1
- package/dist/chunks/PopupKeyboardPatterns-BcwdDxRq.mjs +2 -0
- package/dist/chunks/{PopupKeyboardPatterns-tUrT9TyV.mjs.map → PopupKeyboardPatterns-BcwdDxRq.mjs.map} +1 -1
- package/dist/chunks/PopupManager-Jz5JrUdC.mjs +2 -0
- package/dist/chunks/{PopupManager-CT-fMZJn.mjs.map → PopupManager-Jz5JrUdC.mjs.map} +1 -1
- package/dist/chunks/{PopupPositioning-BFh6Ed1D.mjs → PopupPositioning-CIqgpqlW.mjs} +2 -2
- package/dist/chunks/{PopupPositioning-BFh6Ed1D.mjs.map → PopupPositioning-CIqgpqlW.mjs.map} +1 -1
- package/dist/chunks/PrintPlugin-1m54b2-Y.mjs +2 -0
- package/dist/chunks/PrintPlugin-1m54b2-Y.mjs.map +1 -0
- package/dist/chunks/{RangeIterator-DP7Ud3Gp.mjs → RangeIterator-DDOxTQIf.mjs} +2 -2
- package/dist/chunks/{RangeIterator-DP7Ud3Gp.mjs.map → RangeIterator-DDOxTQIf.mjs.map} +1 -1
- package/dist/chunks/SchemaRegistry-acc6q_5x.mjs +2 -0
- package/dist/chunks/SchemaRegistry-acc6q_5x.mjs.map +1 -0
- package/dist/chunks/Selection-DC6AOGgF.mjs +2 -0
- package/dist/chunks/Selection-DC6AOGgF.mjs.map +1 -0
- package/dist/chunks/{SelectionSync-BSHIw1EE.mjs → SelectionSync-CcvoRrNd.mjs} +2 -2
- package/dist/chunks/{SelectionSync-BSHIw1EE.mjs.map → SelectionSync-CcvoRrNd.mjs.map} +1 -1
- package/dist/chunks/SelectionTransactions-DNCzsl_b.mjs +2 -0
- package/dist/chunks/SelectionTransactions-DNCzsl_b.mjs.map +1 -0
- package/dist/chunks/SimpleMark-CTDtEIMV.mjs +2 -0
- package/dist/chunks/{SimpleMark-7CQcA4RK.mjs.map → SimpleMark-CTDtEIMV.mjs.map} +1 -1
- package/dist/chunks/SmartPastePlugin-CjExbE9Q.mjs +2 -0
- package/dist/chunks/SmartPastePlugin-CjExbE9Q.mjs.map +1 -0
- package/dist/chunks/StarterFonts-BDQPg-cu.mjs +2 -0
- package/dist/chunks/StarterFonts-BDQPg-cu.mjs.map +1 -0
- package/dist/chunks/{StrikethroughPlugin-C2oWvGc3.mjs → StrikethroughPlugin-d-EW2YYx.mjs} +2 -2
- package/dist/chunks/{StrikethroughPlugin-C2oWvGc3.mjs.map → StrikethroughPlugin-d-EW2YYx.mjs.map} +1 -1
- package/dist/chunks/StyleRuntime-C0RSqKzG.mjs +2 -0
- package/dist/chunks/{StyleRuntime-DW6omotc.mjs.map → StyleRuntime-C0RSqKzG.mjs.map} +1 -1
- package/dist/chunks/SuperSubPlugin-C-kvFQyx.mjs +2 -0
- package/dist/chunks/{SuperSubPlugin-D1xaKrSu.mjs.map → SuperSubPlugin-C-kvFQyx.mjs.map} +1 -1
- package/dist/chunks/TableDimensions-BcARMxQB.mjs +2 -0
- package/dist/chunks/TableDimensions-BcARMxQB.mjs.map +1 -0
- package/dist/chunks/TablePlugin-B894cIXW.mjs +2 -0
- package/dist/chunks/{TablePlugin-PJe3zwr-.mjs.map → TablePlugin-B894cIXW.mjs.map} +1 -1
- package/dist/chunks/{TextColorPlugin-CTd9tfeG.mjs → TextColorPlugin-B6YoN9mR.mjs} +2 -2
- package/dist/chunks/{TextColorPlugin-CTd9tfeG.mjs.map → TextColorPlugin-B6YoN9mR.mjs.map} +1 -1
- package/dist/chunks/TextDirectionAutoPlugin-LVDkKdDX.mjs +2 -0
- package/dist/chunks/{TextDirectionAutoPlugin-CPnKVVuI.mjs.map → TextDirectionAutoPlugin-LVDkKdDX.mjs.map} +1 -1
- package/dist/chunks/TextDirectionPlugin-CtGwof7i.mjs +2 -0
- package/dist/chunks/TextDirectionPlugin-CtGwof7i.mjs.map +1 -0
- package/dist/chunks/TextDirectionService-OFOU6r_s.mjs +2 -0
- package/dist/chunks/{TextDirectionService-BcX07mw2.mjs.map → TextDirectionService-OFOU6r_s.mjs.map} +1 -1
- package/dist/chunks/TextFormattingPlugin-DlS0SeW7.mjs +2 -0
- package/dist/chunks/{TextFormattingPlugin-DBVlePqj.mjs.map → TextFormattingPlugin-DlS0SeW7.mjs.map} +1 -1
- package/dist/chunks/ThemeEngine-D4W6Y80e.mjs +3 -0
- package/dist/chunks/ThemeEngine-D4W6Y80e.mjs.map +1 -0
- package/dist/chunks/ToolbarPlugin-ClKY-LiT.mjs +2 -0
- package/dist/chunks/{ToolbarPlugin-DtfGTO_V.mjs.map → ToolbarPlugin-ClKY-LiT.mjs.map} +1 -1
- package/dist/chunks/VideoPlugin-C9z4JfP_.mjs +2 -0
- package/dist/chunks/VideoPlugin-C9z4JfP_.mjs.map +1 -0
- package/dist/chunks/XmlSupport-3Za6SIqF.mjs +2 -0
- package/dist/chunks/XmlSupport-3Za6SIqF.mjs.map +1 -0
- package/dist/chunks/full-CNi2CaF3.mjs +2 -0
- package/dist/chunks/{full-DSWM4cKQ.mjs.map → full-CNi2CaF3.mjs.map} +1 -1
- package/dist/chunks/minimal-Bykbo9So.mjs +2 -0
- package/dist/chunks/{minimal-CFkkPXef.mjs.map → minimal-Bykbo9So.mjs.map} +1 -1
- package/dist/chunks/register-CF80zDgl.mjs +3 -0
- package/dist/chunks/register-CF80zDgl.mjs.map +1 -0
- package/dist/chunks/src-5GKFQ2mQ.mjs +2 -0
- package/dist/chunks/src-5GKFQ2mQ.mjs.map +1 -0
- package/dist/chunks/xml-BsV44TrJ.mjs +2 -0
- package/dist/chunks/xml-BsV44TrJ.mjs.map +1 -0
- package/dist/decorations/Decoration.d.ts +9 -0
- package/dist/decorations/Decoration.d.ts.map +1 -1
- package/dist/editor/ContentSerializer.d.ts +2 -7
- package/dist/editor/ContentSerializer.d.ts.map +1 -1
- package/dist/editor/EditorEventEmitter.d.ts +10 -2
- package/dist/editor/EditorEventEmitter.d.ts.map +1 -1
- package/dist/editor/EditorInitializer.d.ts +2 -4
- package/dist/editor/EditorInitializer.d.ts.map +1 -1
- package/dist/editor/EditorLifecycleCoordinator.d.ts +16 -1
- package/dist/editor/EditorLifecycleCoordinator.d.ts.map +1 -1
- package/dist/editor/EditorStyleCoordinator.d.ts +11 -3
- package/dist/editor/EditorStyleCoordinator.d.ts.map +1 -1
- package/dist/editor/NotectlEditor.d.ts +15 -3
- package/dist/editor/NotectlEditor.d.ts.map +1 -1
- package/dist/fonts/math.d.ts +3 -0
- package/dist/fonts/math.d.ts.map +1 -0
- package/dist/fonts/math.mjs +1 -0
- package/dist/fonts/starter.d.ts +3 -0
- package/dist/fonts/starter.d.ts.map +1 -0
- package/dist/fonts/starter.mjs +1 -0
- package/dist/fonts.d.ts +4 -4
- package/dist/fonts.mjs +1 -1
- package/dist/full.d.ts +1 -1
- package/dist/full.mjs +1 -1
- package/dist/html.mjs +1 -1
- package/dist/index.d.ts +5 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/input/InputHandler.d.ts +4 -0
- package/dist/input/InputHandler.d.ts.map +1 -1
- package/dist/input/InputManager.d.ts +5 -0
- package/dist/input/InputManager.d.ts.map +1 -1
- package/dist/input/KeyboardHandler.d.ts +4 -0
- package/dist/input/KeyboardHandler.d.ts.map +1 -1
- package/dist/input/PasteHTMLHandler.d.ts +7 -4
- package/dist/input/PasteHTMLHandler.d.ts.map +1 -1
- package/dist/input/PasteHandler.d.ts +33 -6
- package/dist/input/PasteHandler.d.ts.map +1 -1
- package/dist/input/PasteRichBlockHandler.d.ts +3 -2
- package/dist/input/PasteRichBlockHandler.d.ts.map +1 -1
- package/dist/markdown.mjs +1 -1
- package/dist/model/Document.d.ts +42 -0
- package/dist/model/Document.d.ts.map +1 -1
- package/dist/model/DocumentNormalization.d.ts +10 -0
- package/dist/model/DocumentNormalization.d.ts.map +1 -0
- package/dist/model/FileHandlerDispatcher.d.ts +27 -0
- package/dist/model/FileHandlerDispatcher.d.ts.map +1 -0
- package/dist/model/FileHandlerRegistry.d.ts +6 -1
- package/dist/model/FileHandlerRegistry.d.ts.map +1 -1
- package/dist/model/InputRuleRegistry.d.ts +9 -1
- package/dist/model/InputRuleRegistry.d.ts.map +1 -1
- package/dist/model/KeymapRegistry.d.ts +14 -1
- package/dist/model/KeymapRegistry.d.ts.map +1 -1
- package/dist/model/MarkdownSyntaxRegistry.d.ts +2 -0
- package/dist/model/MarkdownSyntaxRegistry.d.ts.map +1 -1
- package/dist/model/PluginCallbackExecutor.d.ts +44 -0
- package/dist/model/PluginCallbackExecutor.d.ts.map +1 -0
- package/dist/model/SanitizeConfig.d.ts +8 -0
- package/dist/model/SanitizeConfig.d.ts.map +1 -1
- package/dist/model/SchemaRegistry.d.ts +24 -0
- package/dist/model/SchemaRegistry.d.ts.map +1 -1
- package/dist/model/Selection.d.ts +4 -0
- package/dist/model/Selection.d.ts.map +1 -1
- package/dist/notectl-core.mjs +1 -1
- package/dist/notectl-core.umd.js +1 -1
- package/dist/notectl-core.umd.js.map +1 -1
- package/dist/plugins/Plugin.d.ts +3 -1
- package/dist/plugins/Plugin.d.ts.map +1 -1
- package/dist/plugins/PluginContextFactory.d.ts +9 -2
- package/dist/plugins/PluginContextFactory.d.ts.map +1 -1
- package/dist/plugins/PluginLifecycle.d.ts +6 -0
- package/dist/plugins/PluginLifecycle.d.ts.map +1 -1
- package/dist/plugins/PluginManager.d.ts +9 -2
- package/dist/plugins/PluginManager.d.ts.map +1 -1
- package/dist/plugins/RegistrationTracker.d.ts +2 -0
- package/dist/plugins/RegistrationTracker.d.ts.map +1 -1
- package/dist/plugins/alignment.mjs +1 -1
- package/dist/plugins/bidi-isolation.mjs +1 -1
- package/dist/plugins/blockquote.mjs +1 -1
- package/dist/plugins/caret-navigation.mjs +1 -1
- package/dist/plugins/code-block/CodeBlockHighlighting.d.ts.map +1 -1
- package/dist/plugins/code-block/CodeBlockSchema.d.ts +6 -2
- package/dist/plugins/code-block/CodeBlockSchema.d.ts.map +1 -1
- package/dist/plugins/code-block.mjs +1 -1
- package/dist/plugins/font-size.mjs +1 -1
- package/dist/plugins/font.mjs +1 -1
- package/dist/plugins/formula/FormulaPasteInterceptor.d.ts.map +1 -1
- package/dist/plugins/formula/FormulaTypes.d.ts +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.mjs +1 -1
- package/dist/plugins/highlight.mjs +1 -1
- package/dist/plugins/horizontal-rule.mjs +1 -1
- package/dist/plugins/image.mjs +1 -1
- package/dist/plugins/inline-code.mjs +1 -1
- package/dist/plugins/language.mjs +1 -1
- package/dist/plugins/link.mjs +1 -1
- package/dist/plugins/list/ListCommands.d.ts.map +1 -1
- package/dist/plugins/list/ListPlugin.d.ts +9 -0
- package/dist/plugins/list/ListPlugin.d.ts.map +1 -1
- package/dist/plugins/list.mjs +1 -1
- package/dist/plugins/print.mjs +1 -1
- package/dist/plugins/shared/NodeSpecPatching.d.ts +2 -2
- package/dist/plugins/shared/NodeSpecPatching.d.ts.map +1 -1
- package/dist/plugins/shared.mjs +1 -1
- package/dist/plugins/smart-paste/SmartPastePlugin.d.ts.map +1 -1
- package/dist/plugins/smart-paste.mjs +1 -1
- package/dist/plugins/strikethrough.mjs +1 -1
- package/dist/plugins/super-sub.mjs +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.mjs +1 -1
- package/dist/plugins/toolbar.mjs +1 -1
- package/dist/plugins/video/VideoNodeSpec.d.ts.map +1 -1
- package/dist/plugins/video/VideoPlugin.d.ts.map +1 -1
- package/dist/plugins/video/VideoProviders.d.ts +3 -3
- package/dist/plugins/video/VideoSanitizeHook.d.ts +4 -20
- package/dist/plugins/video/VideoSanitizeHook.d.ts.map +1 -1
- package/dist/plugins/video.mjs +1 -1
- package/dist/presets/full.d.ts +1 -1
- package/dist/presets/full.mjs +1 -1
- package/dist/presets/minimal.d.ts +1 -1
- package/dist/presets/minimal.mjs +1 -1
- package/dist/presets.d.ts +1 -1
- package/dist/presets.mjs +1 -1
- package/dist/register.d.ts +3 -0
- package/dist/register.d.ts.map +1 -0
- package/dist/register.mjs +1 -0
- package/dist/serialization/DocumentParser.d.ts.map +1 -1
- package/dist/serialization/DocumentSerializer.d.ts.map +1 -1
- package/dist/serialization/HTMLSanitization.d.ts +12 -0
- package/dist/serialization/HTMLSanitization.d.ts.map +1 -1
- package/dist/state/EditorState.d.ts.map +1 -1
- package/dist/state/History.d.ts.map +1 -1
- package/dist/state/Mapping.d.ts +2 -0
- package/dist/state/Mapping.d.ts.map +1 -1
- package/dist/state/StepHandlers.d.ts.map +1 -1
- package/dist/state/TransactionBuilder.d.ts +2 -0
- package/dist/state/TransactionBuilder.d.ts.map +1 -1
- package/dist/state/TransactionFinalizer.d.ts +10 -0
- package/dist/state/TransactionFinalizer.d.ts.map +1 -0
- package/dist/state/TransactionSnapshot.d.ts +32 -0
- package/dist/state/TransactionSnapshot.d.ts.map +1 -0
- package/dist/test/TestUtils.d.ts.map +1 -1
- package/dist/view/BlockRendering.d.ts +13 -2
- package/dist/view/BlockRendering.d.ts.map +1 -1
- package/dist/view/DecorationRendering.d.ts +19 -8
- package/dist/view/DecorationRendering.d.ts.map +1 -1
- package/dist/view/EditorView.d.ts +4 -0
- package/dist/view/EditorView.d.ts.map +1 -1
- package/dist/view/EditorViewEvents.d.ts +8 -0
- package/dist/view/EditorViewEvents.d.ts.map +1 -1
- package/dist/view/NodeViewCallbackBoundary.d.ts +12 -0
- package/dist/view/NodeViewCallbackBoundary.d.ts.map +1 -0
- package/dist/view/NodeViewOwnership.d.ts +12 -0
- package/dist/view/NodeViewOwnership.d.ts.map +1 -0
- package/dist/view/NodeViewRegistry.d.ts +7 -1
- package/dist/view/NodeViewRegistry.d.ts.map +1 -1
- package/dist/view/Reconciler.d.ts +6 -0
- package/dist/view/Reconciler.d.ts.map +1 -1
- package/package.json +29 -228
- package/dist/chunks/AlignmentPlugin--xAFlRqE.mjs +0 -2
- package/dist/chunks/AlignmentPlugin--xAFlRqE.mjs.map +0 -1
- package/dist/chunks/AttributedMarkCommands-bagbH8Qt.mjs +0 -2
- package/dist/chunks/AttributedMarkCommands-bagbH8Qt.mjs.map +0 -1
- package/dist/chunks/BlockInsertion-CJusvrDL.mjs +0 -2
- package/dist/chunks/BlockquotePlugin-Bz2glHwX.mjs +0 -2
- package/dist/chunks/CaretNavigationPlugin-CNsT0eb4.mjs +0 -2
- package/dist/chunks/CaretNavigationPlugin-CNsT0eb4.mjs.map +0 -1
- package/dist/chunks/CodeBlockPlugin-C1hrdbSZ.mjs +0 -2
- package/dist/chunks/ColorGrid-C9RQoEWF.mjs +0 -2
- package/dist/chunks/ColorPickerPopup-DiA68Pzz.mjs +0 -2
- package/dist/chunks/ColorValidation-DAijTjG9.mjs +0 -2
- package/dist/chunks/Commands-1dFFldi7.mjs +0 -2
- package/dist/chunks/Commands-1dFFldi7.mjs.map +0 -1
- package/dist/chunks/ContentModel-NpAj7vGW.mjs +0 -2
- package/dist/chunks/Decoration-BpoEOANl.mjs +0 -2
- package/dist/chunks/Decoration-BpoEOANl.mjs.map +0 -1
- package/dist/chunks/Document-827l3P80.mjs +0 -2
- package/dist/chunks/Document-827l3P80.mjs.map +0 -1
- package/dist/chunks/DocumentParser-D2tr3ZKn.mjs +0 -2
- package/dist/chunks/DocumentParser-D2tr3ZKn.mjs.map +0 -1
- package/dist/chunks/FontSizePlugin-Dln-tYXV.mjs +0 -2
- package/dist/chunks/FormulaPlugin-By1befrR.mjs +0 -2
- package/dist/chunks/FormulaPlugin-By1befrR.mjs.map +0 -1
- package/dist/chunks/GapCursorNavigation-BuXngVu-.mjs +0 -2
- package/dist/chunks/GapCursorNavigation-BuXngVu-.mjs.map +0 -1
- package/dist/chunks/GapCursorPlugin-DAxVzXRs.mjs +0 -2
- package/dist/chunks/GapCursorPlugin-DAxVzXRs.mjs.map +0 -1
- package/dist/chunks/HTMLUtils-Bhg3_P8B.mjs +0 -2
- package/dist/chunks/HardBreakPlugin-DlbSlrdq.mjs +0 -2
- package/dist/chunks/HeadingPlugin-uMAjPOk5.mjs +0 -2
- package/dist/chunks/InlineCodePlugin-pISIoGQE.mjs +0 -2
- package/dist/chunks/ListPlugin-DAY5ezNs.mjs +0 -2
- package/dist/chunks/ListPlugin-DAY5ezNs.mjs.map +0 -1
- package/dist/chunks/MarkdownHTMLRegistry-CKEx7LkR.mjs +0 -2
- package/dist/chunks/MarkdownParser-CWt3M6jR.mjs +0 -2
- package/dist/chunks/MarkdownSerializer-J-i28out.mjs +0 -2
- package/dist/chunks/NodeSelectionCommands-1PjwUDTJ.mjs +0 -2
- package/dist/chunks/NodeSpecPatching-B_yLknTl.mjs +0 -2
- package/dist/chunks/NodeSpecPatching-B_yLknTl.mjs.map +0 -1
- package/dist/chunks/PluginHelpers-Dx_0hfDe.mjs +0 -2
- package/dist/chunks/PopupKeyboardPatterns-tUrT9TyV.mjs +0 -2
- package/dist/chunks/PopupManager-CT-fMZJn.mjs +0 -2
- package/dist/chunks/PrintPlugin-7zz9mhhU.mjs +0 -2
- package/dist/chunks/PrintPlugin-7zz9mhhU.mjs.map +0 -1
- package/dist/chunks/PrintTypes-CxU69qu3.mjs +0 -3
- package/dist/chunks/PrintTypes-CxU69qu3.mjs.map +0 -1
- package/dist/chunks/SchemaRegistry-CkBN-1yW.mjs +0 -2
- package/dist/chunks/SchemaRegistry-CkBN-1yW.mjs.map +0 -1
- package/dist/chunks/Selection-HYoVFpAx.mjs +0 -2
- package/dist/chunks/Selection-HYoVFpAx.mjs.map +0 -1
- package/dist/chunks/SimpleMark-7CQcA4RK.mjs +0 -2
- package/dist/chunks/SmartPastePlugin-CYa_nD9v.mjs +0 -2
- package/dist/chunks/SmartPastePlugin-CYa_nD9v.mjs.map +0 -1
- package/dist/chunks/StyleRuntime-DW6omotc.mjs +0 -2
- package/dist/chunks/SuperSubPlugin-D1xaKrSu.mjs +0 -2
- package/dist/chunks/TableDimensions-BBhjHNjQ.mjs +0 -2
- package/dist/chunks/TableDimensions-BBhjHNjQ.mjs.map +0 -1
- package/dist/chunks/TablePlugin-PJe3zwr-.mjs +0 -2
- package/dist/chunks/TextDirectionAutoPlugin-CPnKVVuI.mjs +0 -2
- package/dist/chunks/TextDirectionPlugin-Bns_03vL.mjs +0 -2
- package/dist/chunks/TextDirectionPlugin-Bns_03vL.mjs.map +0 -1
- package/dist/chunks/TextDirectionService-BcX07mw2.mjs +0 -2
- package/dist/chunks/TextFormattingPlugin-DBVlePqj.mjs +0 -2
- package/dist/chunks/ToolbarPlugin-DtfGTO_V.mjs +0 -2
- package/dist/chunks/VideoPlugin-BrR8g6Rz.mjs +0 -2
- package/dist/chunks/VideoPlugin-BrR8g6Rz.mjs.map +0 -1
- package/dist/chunks/WordBoundary-CFpIJDNP.mjs +0 -2
- package/dist/chunks/WordBoundary-CFpIJDNP.mjs.map +0 -1
- package/dist/chunks/XmlDetector-D7TQpw-e.mjs +0 -2
- package/dist/chunks/XmlDetector-D7TQpw-e.mjs.map +0 -1
- package/dist/chunks/XmlSupport-BYiRwlkK.mjs +0 -2
- package/dist/chunks/XmlSupport-BYiRwlkK.mjs.map +0 -1
- package/dist/chunks/fonts-DQC6Uj4r.mjs +0 -2
- package/dist/chunks/fonts-DQC6Uj4r.mjs.map +0 -1
- package/dist/chunks/full-DSWM4cKQ.mjs +0 -2
- package/dist/chunks/minimal-CFkkPXef.mjs +0 -2
- package/dist/chunks/src-DiAOfuOT.mjs +0 -2
- package/dist/chunks/src-DiAOfuOT.mjs.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CaretNavigationPlugin-CNsT0eb4.mjs","names":[],"sources":["../../src/state/BlockBoundaryMovement.ts","../../src/commands/MovementCommands.ts","../../src/view/DomPointUtils.ts","../../src/view/CaretNavigation.ts","../../src/view/ViewMovementCommands.ts","../../src/plugins/caret-navigation/CaretNavigationLocale.ts","../../src/plugins/caret-navigation/CaretNavigationPlugin.ts"],"sourcesContent":["/**\n * Block boundary movement: pure state-level functions for moving\n * the cursor to the start or end of the current block.\n *\n * These only depend on model/ and state/ types, so they belong\n * at the state layer rather than in commands/.\n */\n\nimport { getBlockLength } from '../model/Document.js';\nimport { isCollapsed, isTextSelection } from '../model/Selection.js';\nimport type { BlockId } from '../model/TypeBrands.js';\nimport type { EditorState } from './EditorState.js';\nimport { moveTx } from './SelectionTransactions.js';\nimport type { Transaction } from './Transaction.js';\n\n/** Moves the cursor to the start of the current block. */\nexport function moveToBlockStart(state: EditorState): Transaction | null {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return null;\n\n\tconst blockId: BlockId = isCollapsed(sel) ? sel.anchor.blockId : sel.head.blockId;\n\tconst offset: number = isCollapsed(sel) ? sel.anchor.offset : sel.head.offset;\n\n\tif (offset === 0) return null;\n\treturn moveTx(state, blockId, 0);\n}\n\n/** Moves the cursor to the end of the current block. */\nexport function moveToBlockEnd(state: EditorState): Transaction | null {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return null;\n\n\tconst blockId: BlockId = isCollapsed(sel) ? sel.anchor.blockId : sel.head.blockId;\n\tconst block = state.getBlock(blockId);\n\tif (!block) return null;\n\n\tconst blockLen: number = getBlockLength(block);\n\tconst offset: number = isCollapsed(sel) ? sel.anchor.offset : sel.head.offset;\n\n\tif (offset === blockLen) return null;\n\treturn moveTx(state, blockId, blockLen);\n}\n","/**\n * Model-based movement commands for programmatic cursor navigation.\n *\n * All functions are pure: they take an EditorState and return a Transaction\n * or `null` (when the movement is not applicable). None touch the DOM.\n *\n * Move commands produce a collapsed cursor. Extend commands keep the anchor\n * and move the head, producing a range selection. All clear storedMarks.\n */\n\nimport {\n\tblockOffsetToTextOffset,\n\tgetBlockLength,\n\tgetBlockText,\n\tgetContentAtOffset,\n} from '../model/Document.js';\nimport { nextGraphemeSize, prevGraphemeSize } from '../model/GraphemeUtils.js';\nimport { isCollapsed, isTextSelection } from '../model/Selection.js';\nimport type { BlockId } from '../model/TypeBrands.js';\nimport type { EditorState } from '../state/EditorState.js';\nimport { canCrossBlockBoundary, isVoidBlock } from '../state/NavigationQueries.js';\nimport { extendTx, moveTx, nodeSelTx } from '../state/SelectionTransactions.js';\nimport type { Transaction } from '../state/Transaction.js';\n\n// Re-export block boundary movement from state layer\nexport { moveToBlockEnd, moveToBlockStart } from '../state/BlockBoundaryMovement.js';\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\n/** Resolves the effective head position from any text selection. */\nfunction resolveHead(state: EditorState): { blockId: BlockId; offset: number } | null {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return null;\n\treturn { blockId: sel.head.blockId, offset: sel.head.offset };\n}\n\n/** Returns the adjacent block ID in the given direction, or `null`. */\nfunction adjacentBlockId(\n\tstate: EditorState,\n\tcurrentBlockId: BlockId,\n\tdirection: 'forward' | 'backward',\n): BlockId | null {\n\tconst blockOrder: readonly BlockId[] = state.getBlockOrder();\n\tconst idx: number = blockOrder.indexOf(currentBlockId);\n\tif (idx < 0) return null;\n\tconst targetIdx: number = direction === 'forward' ? idx + 1 : idx - 1;\n\tif (targetIdx < 0 || targetIdx >= blockOrder.length) return null;\n\treturn blockOrder[targetIdx] ?? null;\n}\n\n// ---------------------------------------------------------------------------\n// Character Movement\n// ---------------------------------------------------------------------------\n\n/** Moves the cursor one character forward, skipping InlineNodes atomically. */\nexport function moveCharacterForward(state: EditorState): Transaction | null {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return null;\n\n\t// If range selection, collapse to head\n\tif (!isCollapsed(sel)) {\n\t\treturn moveTx(state, sel.head.blockId, sel.head.offset);\n\t}\n\n\tconst blockId: BlockId = sel.anchor.blockId;\n\tconst block = state.getBlock(blockId);\n\tif (!block) return null;\n\n\tconst offset: number = sel.anchor.offset;\n\tconst blockLen: number = getBlockLength(block);\n\n\tif (offset < blockLen) {\n\t\t// InlineNode: skip atomically (+1)\n\t\tconst content = getContentAtOffset(block, offset);\n\t\tif (content?.kind === 'inline') {\n\t\t\treturn moveTx(state, blockId, offset + 1);\n\t\t}\n\t\t// Text: advance by one grapheme cluster\n\t\tconst text: string = getBlockText(block);\n\t\tconst textOffset: number = blockOffsetToTextOffset(block, offset);\n\t\tconst step: number = nextGraphemeSize(text, textOffset) || 1;\n\t\treturn moveTx(state, blockId, offset + step);\n\t}\n\n\t// At block end → cross-block\n\tconst nextId: BlockId | null = adjacentBlockId(state, blockId, 'forward');\n\tif (!nextId) return null;\n\tif (!canCrossBlockBoundary(state, blockId, nextId)) return null;\n\n\tif (isVoidBlock(state, nextId)) return nodeSelTx(state, nextId);\n\n\treturn moveTx(state, nextId, 0);\n}\n\n/** Moves the cursor one character backward, skipping InlineNodes atomically. */\nexport function moveCharacterBackward(state: EditorState): Transaction | null {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return null;\n\n\t// If range selection, collapse to head\n\tif (!isCollapsed(sel)) {\n\t\treturn moveTx(state, sel.head.blockId, sel.head.offset);\n\t}\n\n\tconst blockId: BlockId = sel.anchor.blockId;\n\tconst block = state.getBlock(blockId);\n\tif (!block) return null;\n\n\tconst offset: number = sel.anchor.offset;\n\n\tif (offset > 0) {\n\t\t// InlineNode: skip atomically (-1)\n\t\tconst content = getContentAtOffset(block, offset - 1);\n\t\tif (content?.kind === 'inline') {\n\t\t\treturn moveTx(state, blockId, offset - 1);\n\t\t}\n\t\t// Text: retreat by one grapheme cluster\n\t\tconst text: string = getBlockText(block);\n\t\tconst textOffset: number = blockOffsetToTextOffset(block, offset);\n\t\tconst step: number = prevGraphemeSize(text, textOffset) || 1;\n\t\treturn moveTx(state, blockId, offset - step);\n\t}\n\n\t// At block start → cross-block\n\tconst prevId: BlockId | null = adjacentBlockId(state, blockId, 'backward');\n\tif (!prevId) return null;\n\tif (!canCrossBlockBoundary(state, blockId, prevId)) return null;\n\n\tif (isVoidBlock(state, prevId)) return nodeSelTx(state, prevId);\n\n\tconst prevBlock = state.getBlock(prevId);\n\tif (!prevBlock) return null;\n\treturn moveTx(state, prevId, getBlockLength(prevBlock));\n}\n\n// ---------------------------------------------------------------------------\n// Document Boundary Movement\n// ---------------------------------------------------------------------------\n\n/** Moves the cursor to the beginning of the document. */\nexport function moveToDocumentStart(state: EditorState): Transaction | null {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return null;\n\n\tconst blockOrder: readonly BlockId[] = state.getBlockOrder();\n\tconst firstId: BlockId | undefined = blockOrder[0];\n\tif (!firstId) return null;\n\n\tif (isVoidBlock(state, firstId)) return nodeSelTx(state, firstId);\n\n\treturn moveTx(state, firstId, 0);\n}\n\n/** Moves the cursor to the end of the document. */\nexport function moveToDocumentEnd(state: EditorState): Transaction | null {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return null;\n\n\tconst blockOrder: readonly BlockId[] = state.getBlockOrder();\n\tconst lastId: BlockId | undefined = blockOrder[blockOrder.length - 1];\n\tif (!lastId) return null;\n\n\tif (isVoidBlock(state, lastId)) return nodeSelTx(state, lastId);\n\n\tconst lastBlock = state.getBlock(lastId);\n\tif (!lastBlock) return null;\n\treturn moveTx(state, lastId, getBlockLength(lastBlock));\n}\n\n// ---------------------------------------------------------------------------\n// Extend (Selection Extension) Commands\n// ---------------------------------------------------------------------------\n\n/** Extends the selection one character forward. */\nexport function extendCharacterForward(state: EditorState): Transaction | null {\n\tconst head = resolveHead(state);\n\tif (!head) return null;\n\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return null;\n\n\tconst block = state.getBlock(head.blockId);\n\tif (!block) return null;\n\n\tconst blockLen: number = getBlockLength(block);\n\n\tif (head.offset < blockLen) {\n\t\tconst content = getContentAtOffset(block, head.offset);\n\t\tconst step: number =\n\t\t\tcontent?.kind === 'inline'\n\t\t\t\t? 1\n\t\t\t\t: nextGraphemeSize(getBlockText(block), blockOffsetToTextOffset(block, head.offset)) || 1;\n\t\treturn extendTx(state, sel.anchor.blockId, sel.anchor.offset, head.blockId, head.offset + step);\n\t}\n\n\t// Cross-block\n\tconst nextId: BlockId | null = adjacentBlockId(state, head.blockId, 'forward');\n\tif (!nextId) return null;\n\tif (!canCrossBlockBoundary(state, head.blockId, nextId)) return null;\n\n\treturn extendTx(state, sel.anchor.blockId, sel.anchor.offset, nextId, 0);\n}\n\n/** Extends the selection one character backward. */\nexport function extendCharacterBackward(state: EditorState): Transaction | null {\n\tconst head = resolveHead(state);\n\tif (!head) return null;\n\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return null;\n\n\tif (head.offset > 0) {\n\t\tconst block = state.getBlock(head.blockId);\n\t\tif (!block) return null;\n\t\tconst content = getContentAtOffset(block, head.offset - 1);\n\t\tconst step: number =\n\t\t\tcontent?.kind === 'inline'\n\t\t\t\t? 1\n\t\t\t\t: prevGraphemeSize(getBlockText(block), blockOffsetToTextOffset(block, head.offset)) || 1;\n\t\treturn extendTx(state, sel.anchor.blockId, sel.anchor.offset, head.blockId, head.offset - step);\n\t}\n\n\t// Cross-block\n\tconst prevId: BlockId | null = adjacentBlockId(state, head.blockId, 'backward');\n\tif (!prevId) return null;\n\tif (!canCrossBlockBoundary(state, head.blockId, prevId)) return null;\n\n\tconst prevBlock = state.getBlock(prevId);\n\tif (!prevBlock) return null;\n\n\treturn extendTx(state, sel.anchor.blockId, sel.anchor.offset, prevId, getBlockLength(prevBlock));\n}\n\n/** Extends the selection to the start of the current block. */\nexport function extendToBlockStart(state: EditorState): Transaction | null {\n\tconst head = resolveHead(state);\n\tif (!head) return null;\n\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return null;\n\n\tif (head.offset === 0) return null;\n\treturn extendTx(state, sel.anchor.blockId, sel.anchor.offset, head.blockId, 0);\n}\n\n/** Extends the selection to the end of the current block. */\nexport function extendToBlockEnd(state: EditorState): Transaction | null {\n\tconst head = resolveHead(state);\n\tif (!head) return null;\n\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return null;\n\n\tconst block = state.getBlock(head.blockId);\n\tif (!block) return null;\n\n\tconst blockLen: number = getBlockLength(block);\n\tif (head.offset === blockLen) return null;\n\n\treturn extendTx(state, sel.anchor.blockId, sel.anchor.offset, head.blockId, blockLen);\n}\n\n/** Extends the selection to the start of the document. */\nexport function extendToDocumentStart(state: EditorState): Transaction | null {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return null;\n\n\tconst blockOrder: readonly BlockId[] = state.getBlockOrder();\n\tconst firstId: BlockId | undefined = blockOrder[0];\n\tif (!firstId) return null;\n\n\t// No-op if head is already at document start\n\tif (sel.head.blockId === firstId && sel.head.offset === 0) return null;\n\n\treturn extendTx(state, sel.anchor.blockId, sel.anchor.offset, firstId, 0);\n}\n\n/** Extends the selection to the end of the document. */\nexport function extendToDocumentEnd(state: EditorState): Transaction | null {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return null;\n\n\tconst blockOrder: readonly BlockId[] = state.getBlockOrder();\n\tconst lastId: BlockId | undefined = blockOrder[blockOrder.length - 1];\n\tif (!lastId) return null;\n\n\tconst lastBlock = state.getBlock(lastId);\n\tif (!lastBlock) return null;\n\n\tconst lastBlockLen: number = getBlockLength(lastBlock);\n\n\t// No-op if head is already at document end\n\tif (sel.head.blockId === lastId && sel.head.offset === lastBlockLen) return null;\n\n\treturn extendTx(state, sel.anchor.blockId, sel.anchor.offset, lastId, lastBlockLen);\n}\n","/**\n * Utilities for resolving a DOM position from screen coordinates.\n *\n * Provides a fallback chain: `caretPositionFromPoint` → `caretRangeFromPoint`\n * → document fallback (when root is a ShadowRoot).\n */\n\n/** Result of resolving a DOM position from screen coordinates. */\nexport interface DomPoint {\n\treadonly node: Node;\n\treadonly offset: number;\n}\n\n/**\n * Tries `caretPositionFromPoint` (standard) then `caretRangeFromPoint`\n * (WebKit fallback) on a single target to resolve a DOM position.\n */\nfunction tryCaretFromPoint(target: Document | ShadowRoot, x: number, y: number): DomPoint | null {\n\tif ('caretPositionFromPoint' in target) {\n\t\tconst cp = (target as Document).caretPositionFromPoint(x, y);\n\t\tif (cp) {\n\t\t\treturn { node: cp.offsetNode, offset: cp.offset };\n\t\t}\n\t}\n\n\tif ('caretRangeFromPoint' in target) {\n\t\tconst range = (target as Document).caretRangeFromPoint(x, y);\n\t\tif (range) {\n\t\t\treturn { node: range.startContainer, offset: range.startOffset };\n\t\t}\n\t}\n\n\treturn null;\n}\n\n/**\n * Resolves a DOM position from screen coordinates using the best available API.\n *\n * Tries the given root first, then falls back to the ownerDocument when the\n * root is a ShadowRoot and the first attempt returned nothing.\n */\nexport function domPositionFromPoint(\n\troot: Document | ShadowRoot,\n\tx: number,\n\ty: number,\n\townerDoc?: Document,\n): DomPoint | null {\n\treturn (\n\t\ttryCaretFromPoint(root, x, y) ??\n\t\t(ownerDoc && root !== ownerDoc ? tryCaretFromPoint(ownerDoc, x, y) : null)\n\t);\n}\n","/**\n * Caret navigation utilities for layout-aware cursor movement.\n *\n * Provides `endOfTextblock()` for detecting visual block boundaries,\n * `navigateAcrossBlocks()` for cross-block cursor transitions, and\n * `navigateVerticalWithGoalColumn()` for column-preserving vertical nav.\n */\n\nimport { type BlockNode, getBlockLength, getContentAtOffset } from '../model/Document.js';\nimport { isCollapsed, isTextSelection } from '../model/Selection.js';\nimport type { BlockId } from '../model/TypeBrands.js';\nimport { getTextDirection } from '../platform/Platform.js';\nimport type { EditorState } from '../state/EditorState.js';\nimport { type AdjacentBlock, resolveAdjacentBlock } from '../state/NavigationQueries.js';\nimport { moveTx, nodeSelTx } from '../state/SelectionTransactions.js';\nimport type { Transaction } from '../state/Transaction.js';\nimport { domPositionFromPoint } from './DomPointUtils.js';\nimport { findBlockAncestor } from './DomUtils.js';\nimport type { SelectionEndpoints } from './SelectionSync.js';\nimport { domPositionToState, getSelection, readDOMSelectionEndpoints } from './SelectionSync.js';\n\nexport { navigateFromGapCursor } from './GapCursorNavigation.js';\n\n/** Inset in pixels from block edge for vertical goal-column probing. */\nconst BLOCK_EDGE_INSET_PX = 2;\n\n/** Minimum vertical movement (pixels) for a Selection.modify probe to be considered a real move. */\nconst VERTICAL_MOVEMENT_THRESHOLD_PX = 1;\n\nexport type CaretDirection = 'left' | 'right' | 'up' | 'down';\n\n/**\n * Checks whether the cursor is at the visual edge of its text block.\n *\n * For horizontal directions (left/right), uses a pure offset check.\n * For vertical directions (up/down), tries `Selection.modify` probing\n * to detect visual line boundaries, falling back to offset heuristic.\n *\n * An optional `caretRect` parameter avoids redundant `getBoundingClientRect`\n * calls when the caller already measured the caret position.\n */\nexport function endOfTextblock(\n\tcontainer: HTMLElement,\n\tstate: EditorState,\n\tdirection: CaretDirection,\n\tcaretRect?: DOMRect | null,\n): boolean {\n\tconst sel = state.selection;\n\n\tif (!isTextSelection(sel)) return false;\n\tif (!isCollapsed(sel)) return false;\n\n\tconst block = state.getBlock(sel.anchor.blockId);\n\tif (!block) return false;\n\n\tconst offset: number = sel.anchor.offset;\n\tconst blockLength: number = getBlockLength(block);\n\n\t// Horizontal: direction-aware offset check\n\tconst blockEl: Element | null = container.querySelector(\n\t\t`[data-block-id=\"${sel.anchor.blockId}\"]`,\n\t);\n\tconst isRtl: boolean = blockEl instanceof HTMLElement && getTextDirection(blockEl) === 'rtl';\n\n\tif (direction === 'left') return isRtl ? offset === blockLength : offset === 0;\n\tif (direction === 'right') return isRtl ? offset === 0 : offset === blockLength;\n\n\t// Vertical: quick offset check first\n\tif (direction === 'up' && offset === 0) return true;\n\tif (direction === 'down' && offset === blockLength) return true;\n\n\t// Vertical: try Selection.modify probing for multi-line blocks\n\tconst domSel: globalThis.Selection | null = getSelection();\n\tif (!domSel || !domSel.modify) {\n\t\t// Fallback: offset heuristic (no Selection.modify in test environments)\n\t\treturn direction === 'up' ? offset === 0 : offset === blockLength;\n\t}\n\n\treturn probeVerticalBoundary(container, domSel, direction, caretRect);\n}\n\n/**\n * Creates a transaction to move the cursor to an adjacent block.\n *\n * Returns `null` if navigation is not possible (document boundary,\n * isolating boundary, or no adjacent block).\n */\nexport function navigateAcrossBlocks(\n\tstate: EditorState,\n\tdirection: CaretDirection,\n): Transaction | null {\n\tconst target: AdjacentBlock | null = resolveNavigationTarget(state, direction);\n\tif (!target) return null;\n\n\tif (target.isVoid) return nodeSelTx(state, target.targetId);\n\n\t// Target is text → collapsed selection at start or end\n\tconst targetBlock = state.getBlock(target.targetId);\n\tif (!targetBlock) return null;\n\n\tconst targetOffset: number =\n\t\tdirection === 'right' || direction === 'down' ? 0 : getBlockLength(targetBlock);\n\n\treturn moveTx(state, target.targetId, targetOffset);\n}\n\n/**\n * Navigates vertically using a goal column for visual column preservation.\n *\n * Uses `caretPositionFromPoint` / `caretRangeFromPoint` to find the offset\n * in the target block that is closest to the given goalColumn X coordinate.\n * Falls back to start/end offset when goal column positioning is unavailable.\n */\nexport function navigateVerticalWithGoalColumn(\n\tcontainer: HTMLElement,\n\tstate: EditorState,\n\tdirection: 'up' | 'down',\n\tgoalColumn: number | null,\n): Transaction | null {\n\tconst target: AdjacentBlock | null = resolveNavigationTarget(state, direction);\n\tif (!target) return null;\n\n\t// Void → NodeSelection (goalColumn irrelevant)\n\tif (target.isVoid) return nodeSelTx(state, target.targetId);\n\n\tconst targetBlock = state.getBlock(target.targetId);\n\tif (!targetBlock) return null;\n\tconst blockLen: number = getBlockLength(targetBlock);\n\n\t// Try to resolve position using goalColumn\n\tif (goalColumn !== null) {\n\t\tconst position = resolveGoalColumnPosition(container, target.targetId, direction, goalColumn);\n\t\tif (position) return moveTx(state, position.blockId, position.offset);\n\t}\n\n\t// Offset-clamp fallback: preserve the absolute character offset, clamped to\n\t// the target block length. This handles cases where DOM-based goal column\n\t// resolution fails (e.g. Shadow DOM <li> elements) by keeping the cursor\n\t// at the same character column when possible.\n\tif (isTextSelection(state.selection) && isCollapsed(state.selection)) {\n\t\tconst sourceOffset: number = state.selection.anchor.offset;\n\t\tconst clampedOffset: number = Math.min(sourceOffset, blockLen);\n\t\treturn moveTx(state, target.targetId, clampedOffset);\n\t}\n\n\t// Final fallback: start (down) or end (up)\n\tconst fallbackOffset: number = direction === 'down' ? 0 : blockLen;\n\treturn moveTx(state, target.targetId, fallbackOffset);\n}\n\n/**\n * Skips over an InlineNode atomically when arrowing left/right.\n *\n * Returns a transaction moving the cursor past the InlineNode,\n * or `null` if the adjacent content is not an InlineNode (or\n * the direction is vertical).\n */\nexport function skipInlineNode(state: EditorState, direction: CaretDirection): Transaction | null {\n\tif (direction === 'up' || direction === 'down') return null;\n\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return null;\n\tif (!isCollapsed(sel)) return null;\n\n\tconst blockId: BlockId = sel.anchor.blockId;\n\tconst block = state.getBlock(blockId);\n\tif (!block) return null;\n\n\tconst offset: number = sel.anchor.offset;\n\n\treturn direction === 'right'\n\t\t? skipInlineNodeRight(state, blockId, block, offset)\n\t\t: skipInlineNodeLeft(state, blockId, block, offset);\n}\n\nfunction skipInlineNodeRight(\n\tstate: EditorState,\n\tblockId: BlockId,\n\tblock: BlockNode,\n\toffset: number,\n): Transaction | null {\n\tconst content = getContentAtOffset(block, offset);\n\tif (!content || content.kind !== 'inline') return null;\n\treturn moveTx(state, blockId, offset + 1);\n}\n\nfunction skipInlineNodeLeft(\n\tstate: EditorState,\n\tblockId: BlockId,\n\tblock: BlockNode,\n\toffset: number,\n): Transaction | null {\n\tif (offset === 0) return null;\n\tconst content = getContentAtOffset(block, offset - 1);\n\tif (!content || content.kind !== 'inline') return null;\n\treturn moveTx(state, blockId, offset - 1);\n}\n\n/**\n * Returns the bounding rect of the current caret position, or null.\n *\n * When `container` is provided, validates that `getRangeAt(0)` is inside\n * the container before using its rects. In Shadow DOM, `getRangeAt(0)` may\n * return a cross-boundary range whose rects reflect the shadow host position\n * rather than the actual caret position (e.g. inside `<li>` elements).\n * Falls back to composed selection endpoints via `readDOMSelectionEndpoints()`.\n */\nexport function getCaretRectFromSelection(\n\tdomSel: globalThis.Selection,\n\tcontainer?: HTMLElement,\n): DOMRect | null {\n\t// Standard path: use getRangeAt(0) directly, but only if the range\n\t// is inside the container (avoids cross-boundary rects in Shadow DOM)\n\tif (domSel.rangeCount > 0) {\n\t\tconst range: Range = domSel.getRangeAt(0);\n\t\tconst rangeInContainer: boolean = !container || container.contains(range.startContainer);\n\n\t\tif (rangeInContainer) {\n\t\t\tconst rects: DOMRectList = range.getClientRects();\n\t\t\tif (rects.length > 0) return rects[0] ?? null;\n\t\t\tconst rect: DOMRect = range.getBoundingClientRect();\n\t\t\tif (rect.height > 0) return rect;\n\t\t}\n\t}\n\n\t// Composed endpoint path: handles Shadow DOM cases where getRangeAt(0)\n\t// crosses the shadow boundary (e.g. <li> elements in wrapper <ul>/<ol>)\n\tif (container) {\n\t\tconst endpoints: SelectionEndpoints | null = readDOMSelectionEndpoints(container, domSel);\n\t\tif (endpoints) {\n\t\t\ttry {\n\t\t\t\tconst range: Range = document.createRange();\n\t\t\t\trange.setStart(endpoints.anchorNode, endpoints.anchorOffset);\n\t\t\t\trange.setEnd(endpoints.focusNode, endpoints.focusOffset);\n\t\t\t\tconst rects: DOMRectList = range.getClientRects();\n\t\t\t\tif (rects.length > 0) return rects[0] ?? null;\n\t\t\t\treturn range.getBoundingClientRect();\n\t\t\t} catch {\n\t\t\t\t// Unable to create range from endpoints\n\t\t\t}\n\t\t}\n\t}\n\n\treturn null;\n}\n\n// ---------------------------------------------------------------------------\n// Internal helpers\n// ---------------------------------------------------------------------------\n\n/**\n * Resolves the adjacent block in the given direction for cross-block navigation.\n * Performs boundary checks, isolating checks, and void detection.\n */\nfunction resolveNavigationTarget(\n\tstate: EditorState,\n\tdirection: CaretDirection,\n): AdjacentBlock | null {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return null;\n\tconst forward: boolean = direction === 'right' || direction === 'down';\n\treturn resolveAdjacentBlock(state, sel.anchor.blockId, forward);\n}\n\n/**\n * Computes the Y coordinate for vertical goal-column probing.\n *\n * Uses the block element's computed padding to ensure the probe point\n * lands inside the text content area, not in the padding zone.\n * Firefox's `caretPositionFromPoint` returns the end-of-text position\n * when probing in the padding area below the content, which breaks\n * ArrowUp column preservation.\n */\nfunction computeProbeY(blockEl: Element, rect: DOMRect, direction: 'up' | 'down'): number {\n\tif (!(blockEl instanceof HTMLElement)) {\n\t\treturn direction === 'down'\n\t\t\t? rect.top + BLOCK_EDGE_INSET_PX\n\t\t\t: rect.bottom - BLOCK_EDGE_INSET_PX;\n\t}\n\n\tconst style: CSSStyleDeclaration = getComputedStyle(blockEl);\n\tconst paddingTop: number = Number.parseFloat(style.paddingTop) || 0;\n\tconst paddingBottom: number = Number.parseFloat(style.paddingBottom) || 0;\n\n\treturn direction === 'down'\n\t\t? rect.top + paddingTop + BLOCK_EDGE_INSET_PX\n\t\t: rect.bottom - paddingBottom - BLOCK_EDGE_INSET_PX;\n}\n\n/**\n * Resolves an editor position in the target block by using the goalColumn\n * X coordinate and `caretPositionFromPoint` / `caretRangeFromPoint`.\n *\n * Returns `null` when the point-to-caret API is unavailable, when the\n * resolved DOM node falls outside the target block, or when the resulting\n * position doesn't belong to the target block — triggering the fallback\n * (block-end for up, block-start for down) in `navigateVerticalWithGoalColumn`.\n */\nfunction resolveGoalColumnPosition(\n\tcontainer: HTMLElement,\n\ttargetId: BlockId,\n\tdirection: 'up' | 'down',\n\tgoalColumn: number,\n): { blockId: BlockId; offset: number } | null {\n\tconst blockEl: Element | null = container.querySelector(`[data-block-id=\"${targetId}\"]`);\n\tif (!blockEl) return null;\n\n\tconst rect: DOMRect = blockEl.getBoundingClientRect();\n\tconst y: number = computeProbeY(blockEl, rect, direction);\n\t// Clamp goalColumn within the block's horizontal bounds to avoid\n\t// caretPositionFromPoint returning unexpected results for out-of-bounds X.\n\tconst clampedX: number = Math.min(Math.max(goalColumn, rect.left), rect.right - 1);\n\n\tconst root: Document | ShadowRoot = container.getRootNode() as Document | ShadowRoot;\n\tconst domPoint = domPositionFromPoint(root, clampedX, y, container.ownerDocument);\n\tif (!domPoint) return null;\n\n\t// Verify the DOM node is inside the target block\n\tif (!blockEl.contains(domPoint.node)) return null;\n\n\tconst position = domPositionToState(container, domPoint.node, domPoint.offset);\n\tif (!position) return null;\n\n\t// Ensure the resolved position is in the target block\n\tif (position.blockId !== targetId) return null;\n\n\treturn position;\n}\n\n/**\n * Probes whether the cursor is at the top/bottom visual line of a block.\n *\n * Strategy:\n * 1. `Selection.modify('move', direction, 'line')` — moves one visual line.\n * 2. If the cursor left the block or didn't move, it's at the boundary.\n * 3. Cross-check with `getBoundingClientRect`: compare the caret rect before\n * and after the probe. If the vertical position didn't change, the probe\n * hit the block edge even though `Selection.modify` reported movement\n * (can happen with certain inline element layouts).\n *\n * Original DOM selection is always restored before returning.\n */\nfunction probeVerticalBoundary(\n\tcontainer: HTMLElement,\n\tdomSel: globalThis.Selection,\n\tdirection: 'up' | 'down',\n\tpreReadRect?: DOMRect | null,\n): boolean {\n\t// Save original DOM selection (using composed ranges for Shadow DOM)\n\tconst origEndpoints: SelectionEndpoints | null = readDOMSelectionEndpoints(container, domSel);\n\n\t// Cannot determine position → safe default: not at boundary (let browser handle)\n\tif (!origEndpoints) return false;\n\n\tconst origRect: DOMRect | null = preReadRect ?? getCaretRectFromSelection(domSel, container);\n\tconst dirStr: string = direction === 'up' ? 'backward' : 'forward';\n\n\ttry {\n\t\tdomSel.modify('move', dirStr, 'line');\n\n\t\t// Read post-modify endpoints via composed ranges\n\t\tconst postEndpoints: SelectionEndpoints | null = readDOMSelectionEndpoints(container, domSel);\n\t\tif (!postEndpoints) return false;\n\n\t\t// Check if the new position is still within the same block\n\t\tconst origBlock: HTMLElement | null = findBlockAncestor(container, origEndpoints.focusNode);\n\t\tconst newBlock: HTMLElement | null = findBlockAncestor(container, postEndpoints.focusNode);\n\n\t\t// Moved to a different block → definitely at boundary\n\t\tif (origBlock !== newBlock) return true;\n\n\t\t// Selection didn't move at all → at boundary\n\t\tconst didNotMove: boolean =\n\t\t\tpostEndpoints.anchorNode === origEndpoints.anchorNode &&\n\t\t\tpostEndpoints.anchorOffset === origEndpoints.anchorOffset &&\n\t\t\tpostEndpoints.focusNode === origEndpoints.focusNode &&\n\t\t\tpostEndpoints.focusOffset === origEndpoints.focusOffset;\n\t\tif (didNotMove) return true;\n\n\t\t// Cross-check with getBoundingClientRect: if vertical position unchanged,\n\t\t// the probe was a no-op visually (edge case with inline elements)\n\t\tif (origRect) {\n\t\t\tconst newRect: DOMRect | null = getCaretRectFromSelection(domSel, container);\n\t\t\tif (newRect) {\n\t\t\t\tconst verticalDelta: number = Math.abs(newRect.top - origRect.top);\n\t\t\t\tif (verticalDelta < VERTICAL_MOVEMENT_THRESHOLD_PX) return true;\n\t\t\t}\n\t\t}\n\n\t\t// Stayed in same block and moved vertically → not at boundary\n\t\treturn false;\n\t} finally {\n\t\t// Restore original selection\n\t\ttry {\n\t\t\tdomSel.setBaseAndExtent(\n\t\t\t\torigEndpoints.anchorNode,\n\t\t\t\torigEndpoints.anchorOffset,\n\t\t\t\torigEndpoints.focusNode,\n\t\t\t\torigEndpoints.focusOffset,\n\t\t\t);\n\t\t} catch {\n\t\t\t// Selection restore may fail if DOM changed\n\t\t}\n\t}\n}\n","/**\n * View-based movement commands that use the browser's `Selection.modify()` API\n * for word, line-boundary, and line granularity movement.\n *\n * Falls back to model-based commands when `Selection.modify` is unavailable\n * (e.g. in happy-dom test environments).\n */\n\nimport { getBlockLength, getContentAtOffset } from '../model/Document.js';\nimport { isCollapsed, isTextSelection } from '../model/Selection.js';\nimport type { BlockId } from '../model/TypeBrands.js';\nimport { findWordBoundaryBackward, findWordBoundaryForward } from '../model/WordBoundary.js';\nimport { moveToBlockEnd, moveToBlockStart } from '../state/BlockBoundaryMovement.js';\nimport type { EditorState } from '../state/EditorState.js';\nimport {\n\tcanCrossBlockBoundary,\n\tisVoidBlock,\n\tresolveAdjacentBlock,\n} from '../state/NavigationQueries.js';\nimport { extendTx, moveTx, nodeSelTx } from '../state/SelectionTransactions.js';\nimport type { Transaction } from '../state/Transaction.js';\nimport { navigateAcrossBlocks } from './CaretNavigation.js';\nimport type { SelectionEndpoints } from './SelectionSync.js';\nimport { getSelection, readDOMSelectionEndpoints, readSelectionFromDOM } from './SelectionSync.js';\n\ntype Direction = 'forward' | 'backward';\ntype Granularity = 'word' | 'lineboundary' | 'line';\n\n// ---------------------------------------------------------------------------\n// Core view movement\n// ---------------------------------------------------------------------------\n\n/**\n * Moves the cursor using `Selection.modify('move', direction, granularity)`.\n * Falls back to model-based movement when the API is unavailable.\n */\nexport function viewMove(\n\tcontainer: HTMLElement,\n\tstate: EditorState,\n\tdirection: Direction,\n\tgranularity: Granularity,\n): Transaction | null {\n\treturn viewModifySelection(container, state, 'move', direction, granularity);\n}\n\n/**\n * Extends the selection using `Selection.modify('extend', direction, granularity)`.\n * Falls back to model-based extension when the API is unavailable.\n */\nexport function viewExtend(\n\tcontainer: HTMLElement,\n\tstate: EditorState,\n\tdirection: Direction,\n\tgranularity: Granularity,\n): Transaction | null {\n\treturn viewModifySelection(container, state, 'extend', direction, granularity);\n}\n\n/**\n * Shared implementation for viewMove and viewExtend.\n * Uses Selection.modify() with save/restore of DOM selection,\n * with fallback to model-based movement.\n */\nfunction viewModifySelection(\n\tcontainer: HTMLElement,\n\tstate: EditorState,\n\tmode: 'move' | 'extend',\n\tdirection: Direction,\n\tgranularity: Granularity,\n): Transaction | null {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return null;\n\n\tconst fallback = mode === 'move' ? fallbackMove : fallbackExtend;\n\n\tconst domSel: globalThis.Selection | null = getSelection();\n\tif (!domSel?.modify) {\n\t\treturn fallback(state, direction, granularity);\n\t}\n\n\tconst origEndpoints: SelectionEndpoints | null = readDOMSelectionEndpoints(container, domSel);\n\tif (!origEndpoints) return fallback(state, direction, granularity);\n\n\ttry {\n\t\tdomSel.modify(mode, direction, granularity);\n\n\t\tconst newSel = readSelectionFromDOM(container);\n\t\tif (!newSel) return null;\n\n\t\t// For move: check anchor; for extend: check head\n\t\tconst oldBlockId: BlockId = mode === 'move' ? sel.anchor.blockId : sel.head.blockId;\n\t\tconst newPosition = mode === 'move' ? newSel.anchor : newSel.head;\n\t\tconst newBlockId: BlockId = newPosition.blockId;\n\n\t\tif (newBlockId !== oldBlockId && !canCrossBlockBoundary(state, oldBlockId, newBlockId)) {\n\t\t\treturn null;\n\t\t}\n\n\t\tlet newOffset: number = newPosition.offset;\n\n\t\t// InlineNode boundary correction\n\t\tconst block = state.getBlock(newBlockId);\n\t\tif (block) {\n\t\t\tconst content = getContentAtOffset(block, newOffset);\n\t\t\tif (content?.kind === 'inline' && direction === 'forward') {\n\t\t\t\tnewOffset = Math.min(newOffset + 1, getBlockLength(block));\n\t\t\t}\n\t\t}\n\n\t\tif (mode === 'move') {\n\t\t\tif (isVoidBlock(state, newBlockId)) return nodeSelTx(state, newBlockId);\n\t\t\treturn moveTx(state, newBlockId, newOffset);\n\t\t}\n\n\t\treturn extendTx(state, sel.anchor.blockId, sel.anchor.offset, newBlockId, newOffset);\n\t} finally {\n\t\ttry {\n\t\t\tdomSel.setBaseAndExtent(\n\t\t\t\torigEndpoints.anchorNode,\n\t\t\t\torigEndpoints.anchorOffset,\n\t\t\t\torigEndpoints.focusNode,\n\t\t\t\torigEndpoints.focusOffset,\n\t\t\t);\n\t\t} catch {\n\t\t\t// Restore may fail if DOM changed\n\t\t}\n\t}\n}\n\n// ---------------------------------------------------------------------------\n// Fallback (model-based) when Selection.modify is unavailable\n// ---------------------------------------------------------------------------\n\nfunction fallbackMove(\n\tstate: EditorState,\n\tdirection: Direction,\n\tgranularity: Granularity,\n): Transaction | null {\n\tif (granularity === 'word') {\n\t\treturn fallbackWordMove(state, direction);\n\t}\n\tif (granularity === 'lineboundary') {\n\t\treturn direction === 'forward' ? moveToBlockEnd(state) : moveToBlockStart(state);\n\t}\n\t// granularity === 'line' → cross-block\n\tconst caretDir = direction === 'forward' ? 'down' : 'up';\n\treturn navigateAcrossBlocks(state, caretDir);\n}\n\nfunction fallbackExtend(\n\tstate: EditorState,\n\tdirection: Direction,\n\tgranularity: Granularity,\n): Transaction | null {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return null;\n\n\tconst head = sel.head;\n\tconst block = state.getBlock(head.blockId);\n\tif (!block) return null;\n\n\tlet newOffset: number = head.offset;\n\n\tif (granularity === 'word') {\n\t\tnewOffset =\n\t\t\tdirection === 'forward'\n\t\t\t\t? findWordBoundaryForward(block, head.offset)\n\t\t\t\t: findWordBoundaryBackward(block, head.offset);\n\t} else if (granularity === 'lineboundary') {\n\t\tnewOffset = direction === 'forward' ? getBlockLength(block) : 0;\n\t} else {\n\t\t// line: extend to next block boundary\n\t\tconst adj = resolveAdjacentBlock(state, head.blockId, direction === 'forward');\n\t\tif (!adj) return null;\n\t\t// Cannot extend a text selection into a void block\n\t\tif (adj.isVoid) return null;\n\n\t\tconst targetBlock = state.getBlock(adj.targetId);\n\t\tif (!targetBlock) return null;\n\n\t\tconst targetOffset: number = direction === 'forward' ? 0 : getBlockLength(targetBlock);\n\t\treturn extendTx(state, sel.anchor.blockId, sel.anchor.offset, adj.targetId, targetOffset);\n\t}\n\n\treturn extendTx(state, sel.anchor.blockId, sel.anchor.offset, head.blockId, newOffset);\n}\n\nfunction fallbackWordMove(state: EditorState, direction: Direction): Transaction | null {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return null;\n\n\tconst blockId: BlockId = isCollapsed(sel) ? sel.anchor.blockId : sel.head.blockId;\n\tconst offset: number = isCollapsed(sel) ? sel.anchor.offset : sel.head.offset;\n\tconst block = state.getBlock(blockId);\n\tif (!block) return null;\n\n\tconst newOffset: number =\n\t\tdirection === 'forward'\n\t\t\t? findWordBoundaryForward(block, offset)\n\t\t\t: findWordBoundaryBackward(block, offset);\n\n\tif (newOffset === offset) {\n\t\t// At block boundary — try crossing blocks\n\t\treturn fallbackCrossBlock(state, blockId, direction);\n\t}\n\n\treturn moveTx(state, blockId, newOffset);\n}\n\n/**\n * Crosses a block boundary from `blockId` in the given direction.\n * Checks `canCrossBlockBoundary` and handles void blocks (→ NodeSelection).\n */\nfunction fallbackCrossBlock(\n\tstate: EditorState,\n\tblockId: BlockId,\n\tdirection: Direction,\n): Transaction | null {\n\tconst adj = resolveAdjacentBlock(state, blockId, direction === 'forward');\n\tif (!adj) return null;\n\n\tif (adj.isVoid) return nodeSelTx(state, adj.targetId);\n\n\tconst targetBlock = state.getBlock(adj.targetId);\n\tif (!targetBlock) return null;\n\n\tconst targetOffset: number = direction === 'forward' ? 0 : getBlockLength(targetBlock);\n\treturn moveTx(state, adj.targetId, targetOffset);\n}\n\n// ---------------------------------------------------------------------------\n// Convenience wrappers\n// ---------------------------------------------------------------------------\n\n/** Moves the cursor one word forward. */\nexport function moveWordForward(container: HTMLElement, state: EditorState): Transaction | null {\n\treturn viewMove(container, state, 'forward', 'word');\n}\n\n/** Moves the cursor one word backward. */\nexport function moveWordBackward(container: HTMLElement, state: EditorState): Transaction | null {\n\treturn viewMove(container, state, 'backward', 'word');\n}\n\n/** Moves the cursor to the start of the line (visual). */\nexport function moveToLineStart(container: HTMLElement, state: EditorState): Transaction | null {\n\treturn viewMove(container, state, 'backward', 'lineboundary');\n}\n\n/** Moves the cursor to the end of the line (visual). */\nexport function moveToLineEnd(container: HTMLElement, state: EditorState): Transaction | null {\n\treturn viewMove(container, state, 'forward', 'lineboundary');\n}\n\n/** Moves the cursor one visual line up. */\nexport function moveLineUp(container: HTMLElement, state: EditorState): Transaction | null {\n\treturn viewMove(container, state, 'backward', 'line');\n}\n\n/** Moves the cursor one visual line down. */\nexport function moveLineDown(container: HTMLElement, state: EditorState): Transaction | null {\n\treturn viewMove(container, state, 'forward', 'line');\n}\n\n/** Extends the selection one word forward. */\nexport function extendWordForward(container: HTMLElement, state: EditorState): Transaction | null {\n\treturn viewExtend(container, state, 'forward', 'word');\n}\n\n/** Extends the selection one word backward. */\nexport function extendWordBackward(container: HTMLElement, state: EditorState): Transaction | null {\n\treturn viewExtend(container, state, 'backward', 'word');\n}\n\n/** Extends the selection to the start of the line. */\nexport function extendToLineStart(container: HTMLElement, state: EditorState): Transaction | null {\n\treturn viewExtend(container, state, 'backward', 'lineboundary');\n}\n\n/** Extends the selection to the end of the line. */\nexport function extendToLineEnd(container: HTMLElement, state: EditorState): Transaction | null {\n\treturn viewExtend(container, state, 'forward', 'lineboundary');\n}\n\n/** Extends the selection one visual line up. */\nexport function extendLineUp(container: HTMLElement, state: EditorState): Transaction | null {\n\treturn viewExtend(container, state, 'backward', 'line');\n}\n\n/** Extends the selection one visual line down. */\nexport function extendLineDown(container: HTMLElement, state: EditorState): Transaction | null {\n\treturn viewExtend(container, state, 'forward', 'line');\n}\n","/** Locale interface and default English locale for the CaretNavigationPlugin. */\n\nimport { type LocaleModuleMap, loadLocaleModule } from '../shared/LocaleLoader.js';\n\n// --- Locale Interface ---\n\nexport interface CaretNavigationLocale {\n\treadonly paragraph: string;\n\treadonly heading1: string;\n\treadonly heading2: string;\n\treadonly heading3: string;\n\treadonly heading4: string;\n\treadonly heading5: string;\n\treadonly heading6: string;\n\treadonly codeBlock: string;\n\treadonly blockquote: string;\n\treadonly listItem: string;\n\treadonly horizontalRule: string;\n\treadonly image: string;\n\treadonly table: string;\n}\n\n// --- Default English Locale ---\n\nexport const CARET_NAVIGATION_LOCALE_EN: CaretNavigationLocale = {\n\tparagraph: 'Paragraph',\n\theading1: 'Heading 1',\n\theading2: 'Heading 2',\n\theading3: 'Heading 3',\n\theading4: 'Heading 4',\n\theading5: 'Heading 5',\n\theading6: 'Heading 6',\n\tcodeBlock: 'Code Block',\n\tblockquote: 'Block Quote',\n\tlistItem: 'List Item',\n\thorizontalRule: 'Horizontal Rule',\n\timage: 'Image',\n\ttable: 'Table',\n};\n\n// --- Block Type → Locale Key Mapping ---\n\nconst BLOCK_TYPE_KEY_MAP: Readonly<Record<string, keyof CaretNavigationLocale>> = {\n\tparagraph: 'paragraph',\n\tcode_block: 'codeBlock',\n\tblockquote: 'blockquote',\n\tlist_item: 'listItem',\n\thorizontal_rule: 'horizontalRule',\n\timage: 'image',\n\ttable: 'table',\n};\n\n/** Resolves a block type + attrs to a localized label string. */\nexport function resolveBlockLabel(\n\tlocale: CaretNavigationLocale,\n\ttypeName: string,\n\tattrs?: Record<string, unknown>,\n): string {\n\tif (typeName === 'heading' && attrs?.level) {\n\t\tconst key = `heading${attrs.level}` as keyof CaretNavigationLocale;\n\t\tif (key in locale) return locale[key];\n\t}\n\tconst key: keyof CaretNavigationLocale | undefined = BLOCK_TYPE_KEY_MAP[typeName];\n\treturn key ? locale[key] : typeName;\n}\n\n// --- Lazy Locale Loader ---\n\nconst localeModules: LocaleModuleMap<CaretNavigationLocale> = import.meta.glob<{\n\tdefault: CaretNavigationLocale;\n}>('./locales/*.ts', { eager: false });\n\nexport async function loadCaretNavigationLocale(lang: string): Promise<CaretNavigationLocale> {\n\treturn loadLocaleModule(localeModules, lang, CARET_NAVIGATION_LOCALE_EN);\n}\n","/**\n * CaretNavigationPlugin: registers platform-aware keymaps for all\n * programmatic movement commands (character, word, line, document).\n *\n * Movement priorities use 'navigation' to match GapCursorPlugin.\n * Also announces block-type changes to screen readers on cross-block navigation.\n */\n\nimport {\n\textendCharacterBackward,\n\textendCharacterForward,\n\textendToDocumentEnd,\n\textendToDocumentStart,\n\tmoveToDocumentEnd,\n\tmoveToDocumentStart,\n} from '../../commands/MovementCommands.js';\nimport { isCollapsed, isTextSelection } from '../../model/Selection.js';\nimport type { BlockId } from '../../model/TypeBrands.js';\nimport { getTextDirection, isMac } from '../../platform/Platform.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { Transaction } from '../../state/Transaction.js';\nimport {\n\textendLineDown,\n\textendLineUp,\n\textendToLineEnd,\n\textendToLineStart,\n\textendWordBackward,\n\textendWordForward,\n\tmoveLineDown,\n\tmoveLineUp,\n\tmoveToLineEnd,\n\tmoveToLineStart,\n\tmoveWordBackward,\n\tmoveWordForward,\n} from '../../view/ViewMovementCommands.js';\nimport type { Plugin, PluginContext } from '../Plugin.js';\nimport { resolveLocale } from '../shared/PluginHelpers.js';\nimport {\n\tCARET_NAVIGATION_LOCALE_EN,\n\ttype CaretNavigationLocale,\n\tloadCaretNavigationLocale,\n\tresolveBlockLabel,\n} from './CaretNavigationLocale.js';\n\ntype ViewCommandFn = (container: HTMLElement, state: EditorState) => Transaction | null;\ntype ViewCommandKey = `${'word' | 'lineboundary' | 'line'}:${'forward' | 'backward'}`;\ntype ViewCommandLookup = Readonly<Record<ViewCommandKey, ViewCommandFn>>;\n\nconst VIEW_MOVE_FNS: ViewCommandLookup = {\n\t'word:forward': moveWordForward,\n\t'word:backward': moveWordBackward,\n\t'lineboundary:forward': moveToLineEnd,\n\t'lineboundary:backward': moveToLineStart,\n\t'line:forward': moveLineDown,\n\t'line:backward': moveLineUp,\n};\n\nconst VIEW_EXTEND_FNS: ViewCommandLookup = {\n\t'word:forward': extendWordForward,\n\t'word:backward': extendWordBackward,\n\t'lineboundary:forward': extendToLineEnd,\n\t'lineboundary:backward': extendToLineStart,\n\t'line:forward': extendLineDown,\n\t'line:backward': extendLineUp,\n};\n\n/** Debounce delay for block-type announcements (ms). */\nconst ANNOUNCE_DEBOUNCE_MS = 150;\n\nexport class CaretNavigationPlugin implements Plugin {\n\treadonly id = 'caret-navigation';\n\treadonly name = 'Caret Navigation';\n\treadonly priority = 4;\n\n\tprivate context: PluginContext | null = null;\n\tprivate lastAnnouncedBlockId: BlockId | null = null;\n\tprivate announceTimer: ReturnType<typeof setTimeout> | null = null;\n\tprivate announce: ((text: string) => void) | null = null;\n\tprivate locale: CaretNavigationLocale = CARET_NAVIGATION_LOCALE_EN;\n\n\tasync init(context: PluginContext): Promise<void> {\n\t\tthis.locale = await resolveLocale(\n\t\t\tcontext,\n\t\t\tundefined,\n\t\t\tCARET_NAVIGATION_LOCALE_EN,\n\t\t\tloadCaretNavigationLocale,\n\t\t);\n\n\t\tthis.context = context;\n\t\tthis.announce = (text: string) => context.announce(text);\n\t\tconst mac: boolean = isMac();\n\n\t\tconst keymap: Record<string, () => boolean> = {\n\t\t\t// --- Character movement (no modifier) ---\n\t\t\t// Handled natively by browser for basic cases, but Shift+Arrow\n\t\t\t// needs programmatic extend to correctly clear storedMarks.\n\n\t\t\t// --- Character extend ---\n\t\t\t'Shift-ArrowRight': () => this.extendCharacterVisual('right'),\n\t\t\t'Shift-ArrowLeft': () => this.extendCharacterVisual('left'),\n\n\t\t\t// --- Line extend ---\n\t\t\t'Shift-ArrowUp': () => this.viewExtendCommand('backward', 'line'),\n\t\t\t'Shift-ArrowDown': () => this.viewExtendCommand('forward', 'line'),\n\n\t\t\t// --- Word movement (platform-aware) ---\n\t\t\t...(mac\n\t\t\t\t? {\n\t\t\t\t\t\t'Alt-ArrowRight': () => this.viewMoveVisual('right', 'word'),\n\t\t\t\t\t\t'Alt-ArrowLeft': () => this.viewMoveVisual('left', 'word'),\n\t\t\t\t\t\t'Shift-Alt-ArrowRight': () => this.viewExtendVisual('right', 'word'),\n\t\t\t\t\t\t'Shift-Alt-ArrowLeft': () => this.viewExtendVisual('left', 'word'),\n\t\t\t\t\t}\n\t\t\t\t: {\n\t\t\t\t\t\t'Mod-ArrowRight': () => this.viewMoveVisual('right', 'word'),\n\t\t\t\t\t\t'Mod-ArrowLeft': () => this.viewMoveVisual('left', 'word'),\n\t\t\t\t\t\t'Mod-Shift-ArrowRight': () => this.viewExtendVisual('right', 'word'),\n\t\t\t\t\t\t'Mod-Shift-ArrowLeft': () => this.viewExtendVisual('left', 'word'),\n\t\t\t\t\t}),\n\n\t\t\t// --- Line boundary movement (platform-aware) ---\n\t\t\t...(mac\n\t\t\t\t? {\n\t\t\t\t\t\t'Mod-ArrowLeft': () => this.viewMoveVisual('left', 'lineboundary'),\n\t\t\t\t\t\t'Mod-ArrowRight': () => this.viewMoveVisual('right', 'lineboundary'),\n\t\t\t\t\t\t'Mod-Shift-ArrowLeft': () => this.viewExtendVisual('left', 'lineboundary'),\n\t\t\t\t\t\t'Mod-Shift-ArrowRight': () => this.viewExtendVisual('right', 'lineboundary'),\n\t\t\t\t\t}\n\t\t\t\t: {\n\t\t\t\t\t\tHome: () => this.viewMoveCommand('backward', 'lineboundary'),\n\t\t\t\t\t\tEnd: () => this.viewMoveCommand('forward', 'lineboundary'),\n\t\t\t\t\t\t'Shift-Home': () => this.viewExtendCommand('backward', 'lineboundary'),\n\t\t\t\t\t\t'Shift-End': () => this.viewExtendCommand('forward', 'lineboundary'),\n\t\t\t\t\t}),\n\n\t\t\t// --- Document boundary movement (platform-aware) ---\n\t\t\t...(mac\n\t\t\t\t? {\n\t\t\t\t\t\t'Mod-ArrowUp': () => this.modelCommand(moveToDocumentStart),\n\t\t\t\t\t\t'Mod-ArrowDown': () => this.modelCommand(moveToDocumentEnd),\n\t\t\t\t\t\t'Mod-Shift-ArrowUp': () => this.modelCommand(extendToDocumentStart),\n\t\t\t\t\t\t'Mod-Shift-ArrowDown': () => this.modelCommand(extendToDocumentEnd),\n\t\t\t\t\t}\n\t\t\t\t: {\n\t\t\t\t\t\t'Mod-Home': () => this.modelCommand(moveToDocumentStart),\n\t\t\t\t\t\t'Mod-End': () => this.modelCommand(moveToDocumentEnd),\n\t\t\t\t\t\t'Mod-Shift-Home': () => this.modelCommand(extendToDocumentStart),\n\t\t\t\t\t\t'Mod-Shift-End': () => this.modelCommand(extendToDocumentEnd),\n\t\t\t\t\t}),\n\t\t};\n\n\t\tcontext.registerKeymap(keymap, { priority: 'navigation' });\n\t}\n\n\t/** Announces block-type on cross-block cursor movement (debounced). */\n\tonStateChange(_oldState: EditorState, newState: EditorState, _tr: Transaction): void {\n\t\tconst newSel = newState.selection;\n\n\t\t// Only announce for collapsed text selections\n\t\tif (!isCollapsed(newSel) || !isTextSelection(newSel)) {\n\t\t\tif (this.announceTimer !== null) {\n\t\t\t\tclearTimeout(this.announceTimer);\n\t\t\t\tthis.announceTimer = null;\n\t\t\t}\n\t\t\tthis.lastAnnouncedBlockId = null;\n\t\t\treturn;\n\t\t}\n\n\t\tconst newBlockId: BlockId = newSel.anchor.blockId;\n\t\tif (newBlockId === this.lastAnnouncedBlockId) return;\n\n\t\t// First observed block (initial focus) — remember but don't announce\n\t\tif (this.lastAnnouncedBlockId === null) {\n\t\t\tthis.lastAnnouncedBlockId = newBlockId;\n\t\t\treturn;\n\t\t}\n\n\t\tthis.lastAnnouncedBlockId = newBlockId;\n\n\t\t// Debounce rapid navigation\n\t\tif (this.announceTimer !== null) clearTimeout(this.announceTimer);\n\t\tthis.announceTimer = setTimeout(() => {\n\t\t\tthis.announceTimer = null;\n\t\t\t// Skip if another plugin already announced (e.g. CodeBlockPlugin's \"Left code block\")\n\t\t\tif (this.context?.hasAnnouncement()) return;\n\t\t\tconst block = newState.getBlock(newBlockId);\n\t\t\tif (!block) return;\n\t\t\tconst label: string = resolveBlockLabel(\n\t\t\t\tthis.locale,\n\t\t\t\tblock.type,\n\t\t\t\tblock.attrs as Record<string, unknown> | undefined,\n\t\t\t);\n\t\t\tthis.announce?.(label);\n\t\t}, ANNOUNCE_DEBOUNCE_MS);\n\t}\n\n\tdestroy(): void {\n\t\tif (this.announceTimer !== null) clearTimeout(this.announceTimer);\n\t\tthis.announceTimer = null;\n\t\tthis.announce = null;\n\t\tthis.context = null;\n\t}\n\n\t/** Dispatches a model-based movement command (no DOM needed). */\n\tprivate modelCommand(fn: (state: EditorState) => Transaction | null): boolean {\n\t\tif (!this.context) return false;\n\t\tconst tr: Transaction | null = fn(this.context.getState());\n\t\tif (tr) {\n\t\t\tthis.context.dispatch(tr);\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\t/** Extends selection by one character based on visual left/right intent. */\n\tprivate extendCharacterVisual(visual: 'left' | 'right'): boolean {\n\t\tif (!this.context) return false;\n\t\tconst state: EditorState = this.context.getState();\n\t\tconst dir: 'forward' | 'backward' = this.resolveLogicalHorizontalDirection(state, visual);\n\t\tconst tr: Transaction | null =\n\t\t\tdir === 'forward' ? extendCharacterForward(state) : extendCharacterBackward(state);\n\t\tif (tr) {\n\t\t\tthis.context.dispatch(tr);\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\t/** Dispatches a view-based movement command (uses container + Selection.modify). */\n\tprivate viewMoveCommand(\n\t\tdirection: 'forward' | 'backward',\n\t\tgranularity: 'word' | 'lineboundary' | 'line',\n\t): boolean {\n\t\treturn this.dispatchViewCommand(VIEW_MOVE_FNS, direction, granularity);\n\t}\n\n\t/** Dispatches a view-based move command with visual direction mapping for RTL. */\n\tprivate viewMoveVisual(visual: 'left' | 'right', granularity: 'word' | 'lineboundary'): boolean {\n\t\tif (!this.context) return false;\n\t\tconst dir: 'forward' | 'backward' = this.resolveLogicalHorizontalDirection(\n\t\t\tthis.context.getState(),\n\t\t\tvisual,\n\t\t);\n\t\treturn this.viewMoveCommand(dir, granularity);\n\t}\n\n\t/** Dispatches a view-based extend command. */\n\tprivate viewExtendCommand(\n\t\tdirection: 'forward' | 'backward',\n\t\tgranularity: 'word' | 'lineboundary' | 'line',\n\t): boolean {\n\t\treturn this.dispatchViewCommand(VIEW_EXTEND_FNS, direction, granularity);\n\t}\n\n\tprivate dispatchViewCommand(\n\t\tlookup: ViewCommandLookup,\n\t\tdirection: 'forward' | 'backward',\n\t\tgranularity: 'word' | 'lineboundary' | 'line',\n\t): boolean {\n\t\tif (!this.context) return false;\n\t\tconst fn: ViewCommandFn | undefined = lookup[`${granularity}:${direction}`];\n\t\tif (!fn) return false;\n\t\tconst tr: Transaction | null = fn(this.context.getContainer(), this.context.getState());\n\t\tif (tr) {\n\t\t\tthis.context.dispatch(tr);\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\t/** Dispatches a view-based extend command with visual direction mapping for RTL. */\n\tprivate viewExtendVisual(\n\t\tvisual: 'left' | 'right',\n\t\tgranularity: 'word' | 'lineboundary',\n\t): boolean {\n\t\tif (!this.context) return false;\n\t\tconst dir: 'forward' | 'backward' = this.resolveLogicalHorizontalDirection(\n\t\t\tthis.context.getState(),\n\t\t\tvisual,\n\t\t);\n\t\treturn this.viewExtendCommand(dir, granularity);\n\t}\n\n\t/**\n\t * Resolves logical movement direction from visual left/right intent.\n\t * In RTL blocks, visual directions are mirrored in offset space.\n\t */\n\tprivate resolveLogicalHorizontalDirection(\n\t\tstate: EditorState,\n\t\tvisual: 'left' | 'right',\n\t): 'forward' | 'backward' {\n\t\tconst sel = state.selection;\n\t\tif (!isTextSelection(sel)) {\n\t\t\treturn visual === 'left' ? 'backward' : 'forward';\n\t\t}\n\t\tconst container: HTMLElement | undefined = this.context?.getContainer();\n\t\tif (!container) return visual === 'left' ? 'backward' : 'forward';\n\t\tconst blockEl: Element | null = container.querySelector(\n\t\t\t`[data-block-id=\"${sel.head.blockId}\"]`,\n\t\t);\n\t\tconst isRtl: boolean = blockEl instanceof HTMLElement && getTextDirection(blockEl) === 'rtl';\n\t\tif (!isRtl) return visual === 'left' ? 'backward' : 'forward';\n\t\treturn visual === 'left' ? 'forward' : 'backward';\n\t}\n}\n"],"mappings":"+hBAgBA,SAAgB,EAAiB,GAChC,MAAM,EAAM,EAAM,UAClB,IAAK,EAAgB,GAAM,OAAO,KAElC,MAAM,EAAmB,EAAY,GAAO,EAAI,OAAO,QAAU,EAAI,KAAK,QAG1E,OAAe,KAFQ,EAAY,GAAO,EAAI,OAAO,OAAS,EAAI,KAAK,QAE9C,KAClB,EAAO,EAAO,EAAS,EAC/B,CAGA,SAAgB,EAAe,GAC9B,MAAM,EAAM,EAAM,UAClB,IAAK,EAAgB,GAAM,OAAO,KAElC,MAAM,EAAmB,EAAY,GAAO,EAAI,OAAO,QAAU,EAAI,KAAK,QACpE,EAAQ,EAAM,SAAS,GAC7B,IAAK,EAAO,OAAO,KAEnB,MAAM,EAAmB,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AmB,EAAI,KAAK,aAG7B,OADuB,aAAmB,aAA6C,QAA9B,EAAiB,GAExD,SAAX,EAAoB,UAAY,WADT,SAAX,EAAoB,WAAa,SAErD"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as t}from"./HTMLUtils-Bhg3_P8B.mjs";import{D as e,_ as n,b as o,c as r,f as c,h as s,w as i}from"./Document-827l3P80.mjs";import{a,d as l,i as d,o as u,s as g,t as p,u as f}from"./Selection-HYoVFpAx.mjs";import{t as h}from"./Commands-1dFFldi7.mjs";import{a as k}from"./TypeBrands-Ch9856Gb.mjs";import{n as b}from"./DomUtils-Bf7JLFlx.mjs";import{r as m}from"./NodeResolver-Dleih-8R.mjs";import{i as v,r as x,t as C}from"./Decoration-BpoEOANl.mjs";import{C as y,S,_ as w,v as _,y as I}from"./BlockInsertion-CJusvrDL.mjs";import{c as B}from"./StyleRuntime-DW6omotc.mjs";import{n as A}from"./TypedKeys-CA4bfw9O.mjs";import{t as T}from"./SyntaxTokenTypes-BUCOMtL8.mjs";import{c as L,o as M}from"./PluginHelpers-Dx_0hfDe.mjs";import{t as P}from"./ShortcutFormatting-TwiufqeV.mjs";import{t as O}from"./PopupManager-CT-fMZJn.mjs";import{c as N,l as j}from"./XmlDetector-D7TQpw-e.mjs";import{a as E,r as z,s as $,t as D}from"./XmlSupport-BYiRwlkK.mjs";import{n as q}from"./PopupKeyboardPatterns-tUrT9TyV.mjs";var H=`\n/* Code Block — uses theme custom properties */\n.notectl-code-block {\n\tposition: relative;\n\tmargin: 8px 0;\n\tborder-radius: 6px;\n\tbackground: var(--notectl-code-block-bg);\n\tcolor: var(--notectl-code-block-color);\n\tfont-family: 'SF Mono', 'Fira Code', 'Cascadia Code', Menlo, Consolas, monospace;\n\tfont-size: 14px;\n\tline-height: 1.5;\n\toverflow: hidden;\n}\n\n.notectl-code-block__header {\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: space-between;\n\tpadding: 6px 12px;\n\tbackground: var(--notectl-code-block-header-bg);\n\tborder-bottom: 1px solid var(--notectl-code-block-header-border);\n\tfont-size: 12px;\n\tcolor: var(--notectl-code-block-header-color);\n\tuser-select: none;\n}\n\n.notectl-code-block__language-btn {\n\tdisplay: inline-flex;\n\talign-items: center;\n\tgap: 4px;\n\tborder: none;\n\tborder-radius: 4px;\n\tbackground: transparent;\n\tcolor: var(--notectl-code-block-header-color);\n\tcursor: pointer;\n\tpadding: 2px 6px;\n\tfont-size: inherit;\n\tfont-family: inherit;\n\ttransition: background 0.15s;\n}\n\n.notectl-code-block__language-btn:hover {\n\tbackground: rgba(128, 128, 128, 0.15);\n}\n\n.notectl-code-block__language-btn:focus-visible {\n\toutline: 2px solid var(--notectl-primary);\n\toutline-offset: 1px;\n}\n\n.notectl-code-block__language {\n\tfont-weight: 500;\n\tletter-spacing: 0.02em;\n}\n\n.notectl-code-block__chevron {\n\tdisplay: inline-flex;\n\talign-items: center;\n\topacity: 0.6;\n}\n\n.notectl-code-block__actions {\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 2px;\n}\n\n.notectl-code-block__copy,\n.notectl-code-block__delete {\n\tdisplay: inline-flex;\n\talign-items: center;\n\tjustify-content: center;\n\twidth: 24px;\n\theight: 24px;\n\tborder: none;\n\tborder-radius: 4px;\n\tbackground: transparent;\n\tcolor: var(--notectl-code-block-header-color);\n\tcursor: pointer;\n\tpadding: 0;\n\ttransition: background 0.15s, color 0.15s;\n}\n\n.notectl-code-block__copy:hover,\n.notectl-code-block__delete:hover {\n\tbackground: rgba(128, 128, 128, 0.15);\n\tcolor: var(--notectl-code-block-color);\n}\n\n.notectl-code-block__copy svg,\n.notectl-code-block__delete svg {\n\tfill: currentColor;\n}\n\n.notectl-code-block__content {\n\tdisplay: block;\n\tpadding: 12px 16px;\n\twhite-space: pre-wrap;\n\tword-wrap: break-word;\n\ttab-size: 4;\n\t-moz-tab-size: 4;\n\toutline: none;\n\tmin-height: 1.5em;\n}\n\n.notectl-code-block--selected {\n\toutline: 2px solid var(--notectl-primary);\n\toutline-offset: 2px;\n}\n\n.notectl-code-block__esc-hint {\n\tdisplay: none;\n\tposition: absolute;\n\tbottom: 4px;\n\tinset-inline-end: 8px;\n\tfont-size: 11px;\n\tcolor: var(--notectl-code-block-header-color);\n\topacity: 0.5;\n\tpointer-events: none;\n\tuser-select: none;\n\tfont-family: system-ui, sans-serif;\n}\n\n.notectl-code-block--focused .notectl-code-block__esc-hint {\n\tdisplay: block;\n}\n\n/* Language picker popup */\n.notectl-language-picker {\n\tmin-width: 120px;\n\tmax-height: 200px;\n\toverflow-y: auto;\n\tpadding: 4px;\n\tbackground: var(--notectl-surface-raised, #fff);\n\tborder: 1px solid var(--notectl-border, #e0e0e0);\n\tborder-radius: 6px;\n\tbox-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);\n}\n\n.notectl-language-picker__option {\n\tpadding: 6px 10px;\n\tborder-radius: 4px;\n\tcursor: pointer;\n\tfont-size: 13px;\n\tcolor: var(--notectl-fg, #333);\n\twhite-space: nowrap;\n}\n\n.notectl-language-picker__option:hover {\n\tbackground: rgba(128, 128, 128, 0.1);\n}\n\n.notectl-language-picker__option:focus {\n\toutline: none;\n\tbackground: rgba(128, 128, 128, 0.15);\n}\n\n.notectl-language-picker__option[aria-selected="true"] {\n\tfont-weight: 600;\n\tcolor: var(--notectl-primary, #2563eb);\n}\n\n/* Syntax highlighting token classes — generated from canonical token type list */\n${T.map(t=>`.notectl-token--${t} {\n\tcolor: var(--notectl-code-token-${t});\n\tfont-style: var(--notectl-code-token-${t}-font-style, inherit);\n\tfont-weight: var(--notectl-code-token-${t}-font-weight, inherit);\n}`).join("\n")}\n`,R=[{open:"(",close:")",kind:"bracket"},{open:"[",close:"]",kind:"bracket"},{open:"{",close:"}",kind:"bracket"},{open:'"',close:'"',kind:"quote"},{open:"'",close:"'",kind:"quote"},{open:"`",close:"`",kind:"quote"}],V=new Map(R.map(t=>[t.open,t])),F=new Map(R.filter(t=>"bracket"===t.kind).map(t=>[t.close,t]));var K=new Set(["{","[","("]),W={"}":"{","]":"[",")":"("};function U(t,e){const n=t.lastIndexOf("\n",e-1)+1,o=t.indexOf("\n",e);return{start:n,end:-1===o?t.length:o}}function X(t,e){const{start:n,end:o}=U(t,e);let r=n;for(;r<o;){const e=t[r];if(" "!==e&&"\t"!==e)break;r++}return t.slice(n,r)}function Z(t,e){return t?" ".repeat(e):"\t"}function Q(t,e,n){if(0===t.length)return{removed:"",rest:t};if(!e&&"\t"===t[0])return{removed:"\t",rest:t.slice(1)};let o=0;for(;o<n&&" "===t[o];)o++;return{removed:t.slice(0,o),rest:t.slice(o)}}var Y=class{buckets=/* @__PURE__ */new Map;push(t,e){const n=this.buckets.get(t.blockId)??[];n.push({pos:t,char:e}),this.buckets.set(t.blockId,n)}take(t,e){const n=this.buckets.get(t);if(n)for(let o=n.length-1;o>=0;o--){const r=n[o];if(r&&r.pos.offset===e)return n.splice(o,1),0===n.length&&this.buckets.delete(t),r}}peek(t,e){const n=this.buckets.get(t);if(n)for(let o=n.length-1;o>=0;o--){const t=n[o];if(t&&t.pos.offset===e)return t}}clearBlock(t){this.buckets.delete(t)}clear(){this.buckets.clear()}sizeForBlock(t){return this.buckets.get(t)?.length??0}get size(){let t=0;for(const e of this.buckets.values())t+=e.length;return t}migrate(t){if(t.isEmpty)return;const e=/* @__PURE__ */new Map;for(const n of this.buckets.values())for(const o of n){const n=t.mapResult(o.pos,1);if(n.deleted)continue;const r={pos:n.pos,char:o.char},c=n.pos.blockId,s=e.get(c)??[];s.push(r),e.set(c,s)}this.buckets.clear();for(const[n,o]of e)this.buckets.set(n,o)}static makePos(t,e){return d(t,e)}},G=class{resolvedIndent;resolvedPairing;getTokenAt;getCompositionState;pairs=new Y;pendingPairOps=[];constructor(t){this.resolvedIndent=t.resolvedIndent,this.resolvedPairing=t.resolvedPairing,this.getTokenAt=t.getTokenAt,this.getCompositionState=t.getCompositionState}get pairStack(){return this.pairs}clear(){this.pairs.clear(),this.pendingPairOps.length=0}syncOnStateChange(t,e){this.pairs.size>0&&!e.mapping.isEmpty&&this.pairs.migrate(e.mapping);for(const n of this.pendingPairOps)"push"===n.kind?this.pairs.push(d(n.blockId,n.offset),n.char):this.pairs.take(n.blockId,n.offset);this.pendingPairOps.length=0;for(const n of e.steps){if("setBlockType"!==n.type)continue;const e=t.getBlock(n.blockId);e&&"code_block"===e.type||this.pairs.clearBlock(n.blockId)}}handleTextInput=(t,e)=>{this.pendingPairOps.length=0;const o=this.getCompositionState();if(!o)return null;if(o.isComposing)return null;if(!f(e.selection))return null;if(1!==t.length)return null;const r=e.selection,c=e.getBlock(r.anchor.blockId);if(!c||"code_block"!==c.type)return null;const s=this.tryDedentOnCloseBracket(e,c,t);if(s)return s;const i=function(t){const{state:e,char:o,config:r}=t;if(!f(e.selection))return{kind:"passthrough"};const c=e.selection,s=V.get(o);if(s&&!u(c)&&function(t,e){switch(e.surround){case"never":return!1;case"brackets":return"bracket"===t.kind;case"quotes":return"quote"===t.kind;case"languageDefined":return!0}}(s,r)){const e=function(t,e,n){const{state:o}=n,r=l(e,o.getBlockOrder());return r.from.blockId!==r.to.blockId||r.from.blockId!==n.blockId?null:{kind:"wrap",open:t.open,close:t.close}}(s,c,t);if(e)return e}return u(c)?r.overtype&&function(t,e){if(!function(t){const e=V.get(t);return"quote"===e?.kind?e:F.get(t)}(e))return!1;const o=t.state.selection;if(!f(o))return!1;const r=n(t.block),c=o.anchor.offset;if(r[c]!==e)return!1;const s=t.pairStack.peek(t.blockId,c);return Boolean(s&&s.char===e)}(t,o)?{kind:"overtype"}:s&&function(t,e){const o="quote"===t.kind?e.config.quotes:e.config.brackets;if("never"===o)return!1;const r=e.state.selection;if(!f(r))return!0;const c=n(e.block),s=r.anchor.offset;if("quote"===t.kind&&"'"===t.open&&function(t,e){if(e<=0)return!1;const n=t[e-1];return!!n&&/[A-Za-z0-9_]/.test(n)}(c,s))return!1;if("always"===o)return!0;if("beforeWhitespace"===o)return function(t,e){if(e>=t.length)return!0;const n=t[e];return!n||!!/\s/.test(n)||!!F.has(n)}(c,s);if("quote"===t.kind){const t=e.getTokenAt(e.blockId,s);return!t||"string"!==t.type&&"comment"!==t.type}return!0}(s,t)?{kind:"pair",close:s.close}:{kind:"passthrough"}:{kind:"passthrough"}}({state:e,block:c,blockId:r.anchor.blockId,char:t,config:this.resolvedPairing,pairStack:this.pairs,getTokenAt:this.getTokenAt});switch(i.kind){case"pair":return this.buildAutoPairTransaction(e,r.anchor.blockId,i.close,t);case"overtype":return this.buildOvertypeTransaction(e,r.anchor.blockId);case"wrap":return this.buildWrapTransaction(e,r.anchor.blockId,i.open,i.close);case"passthrough":return null}};tryDedentOnCloseBracket(t,e,o){if("brackets"!==this.resolvedIndent.mode)return null;if("}"!==o&&"]"!==o&&")"!==o)return null;const r=t.selection;if(!f(r)||!u(r))return null;const c=n(e),s=r.anchor.offset;if(!function(t,e){const{start:n}=U(t,e);for(let o=n;o<e;o++){const e=t[o];if(" "!==e&&"\t"!==e)return!1}return!0}(c,s))return null;const{start:i}=U(c,s);if(i===s)return null;const a=r.anchor.blockId,l=this.findTrackedCloseAfter(c,s,o,a);if(null!==l)return t.transaction("input").deleteTextAt(a,i,l).setSelection(p(a,i+1)).build();const d=Q(c.slice(i,s),this.resolvedIndent.useSpaces,this.resolvedIndent.spaceCount);if(0===d.removed.length)return null;const g=s-d.removed.length;return t.transaction("input").deleteTextAt(a,g,s).insertText(a,g,o,[]).setSelection(p(a,g+1)).build()}findTrackedCloseAfter(t,e,n,o){for(let r=e;r<t.length;r++){const e=t[r];if(" "!==e&&"\t"!==e&&"\n"!==e){if(e===n){const t=this.pairs.peek(o,r);if(t&&t.char===n)return r}return null}}return null}buildAutoPairTransaction(t,e,n,o){const r=t.selection;if(!f(r))throw new Error("buildAutoPairTransaction requires a text selection");const c=r.anchor.offset,s=`${o}${n}`,i=t.transaction("input").insertText(e,c,s,[]).setSelection(p(e,c+1)).build();return this.pendingPairOps.push({kind:"push",blockId:e,offset:c+1,char:n}),i}buildOvertypeTransaction(t,e){const n=t.selection;if(!f(n))throw new Error("buildOvertypeTransaction requires a text selection");const o=n.anchor.offset;return this.pendingPairOps.push({kind:"take",blockId:e,offset:o}),t.transaction("input").setSelection(p(e,o+1)).build()}buildWrapTransaction(t,e,n,o){const r=t.selection;if(!f(r))throw new Error("buildWrapTransaction requires a text selection");const c=function(t,e){const n=l(t,e);return{fromOffset:n.from.offset,toOffset:n.to.offset}}(r,t.getBlockOrder()),s=l(r,t.getBlockOrder()).from===r.anchor,i=c.fromOffset+1,a=c.toOffset+1,d=s?i:a,u=s?a:i;return t.transaction("input").insertText(e,c.toOffset,o,[]).insertText(e,c.fromOffset,n,[]).setSelection({anchor:{blockId:e,offset:d},head:{blockId:e,offset:u}}).build()}};function J(t,e){const n=t.getState();if(!f(n.selection))return!1;const o=n.selection,r=n.getBlock(o.anchor.blockId);return!(!r||"code_block"!==r.type)&&e({state:n,sel:o,block:r,blockId:o.anchor.blockId,offset:o.anchor.offset})}function tt(t,e,o,r){const s={Enter:()=>function(t,e){return J(t,({state:o,block:r,blockId:s,offset:i})=>{if(!u(o.selection))return!1;const a=n(r);if(a.endsWith("\n")&&i===a.length)return function(t,e,n){const o=t.getState(),r=n.length-1,s=c(),i=o.transaction("input").deleteTextAt(e,r,n.length).splitBlock(e,r,s).setBlockType(s,k("paragraph")).setSelection(p(s,0)).build();return t.dispatch(i),!0}(t,s,a);const l=Z(e.indent.useSpaces,e.indent.spaceCount);if("brackets"===e.indent.mode&&function(t,e){return function(t,e){if(e<=0||e>=t.length)return!1;const n=t[e-1],o=t[e];return!(!n||!o)&&W[o]===n}(t,e)}(a,i)){const e=X(a,i),n=`\n${e}${l}\n${e}`,r=i+1+e.length+l.length,c=o.transaction("input").insertText(s,i,n,[]).setSelection(p(s,r)).build();return t.dispatch(c),!0}const d=`\n${function(t,e,n,o){if("none"===n)return"";const r=X(t,e);return"keep"===n?r:function(t,e){const n=function(t,e){const{start:n}=U(t,e);for(let o=e-1;o>=n;o--){const e=t[o];if(e&&" "!==e&&"\t"!==e)return e}return""}(t,e);return K.has(n)}(t,e)?r+o:r}(a,i,e.indent.mode,l)}`,g=o.transaction("input").insertText(s,i,d,[]).setSelection(p(s,i+d.length)).build();return t.dispatch(g),!0})}(t,r),Backspace:()=>function(t,e){return J(t,({state:o,block:r,blockId:c,offset:s})=>{if(!u(o.selection))return!1;if(e.pairing.deletePair&&s>0){const i=n(r),a=i[s-1],l=i[s];if(a&&l&&function(t,e){switch(t){case"(":return")"===e;case"[":return"]"===e;case"{":return"}"===e;case'"':case"'":case"`":return e===t;default:return!1}}(a,l)){const n=e.pairStack.peek(c,s);if(n&&n.char===l){const e=o.transaction("input").deleteTextAt(c,s-1,s+1).setSelection(p(c,s-1)).build();return t.dispatch(e),!0}}}if(0!==s)return!1;const i=o.transaction("input").setBlockType(c,k("paragraph")).setSelection(o.selection).build();return t.dispatch(i),!0})}(t,r),Tab:()=>function(t,e){return J(t,({state:o,sel:r,block:c,blockId:s,offset:i})=>{const d=Z(e.indent.useSpaces,e.indent.spaceCount);if(u(r)){const e=o.transaction("input").insertText(s,i,d,[]).setSelection(p(s,i+d.length)).build();return t.dispatch(e),!0}if(r.anchor.blockId!==s||r.head.blockId!==s)return!1;const f=n(c),h=l(r,o.getBlockOrder()),k=h.from.offset,b=h.to.offset;if(!f.slice(k,b).includes("\n")){const e=o.transaction("input").deleteTextAt(s,k,b).insertText(s,k,d,[]).setSelection(p(s,k+d.length)).build();return t.dispatch(e),!0}const m=function(t,e,n,o){const r=t.lastIndexOf("\n",e-1)+1,c=[];let s=0,i=r;for(;i<n;){c.push({offset:i,text:o}),s++;const e=t.indexOf("\n",i);if(-1===e||e>=n)break;i=e+1}return{inserts:c,totalInserted:s*o.length,lineCount:s,lineStart:r}}(f,k,b,d),v=o.transaction("input");for(let t=m.inserts.length-1;t>=0;t--){const e=m.inserts[t];e&&v.insertText(s,e.offset,e.text,[])}const x=g(r,o.getBlockOrder()),C=m.lineStart,y=b+m.totalInserted,S=x?C:y,w=x?y:C;return v.setSelection(a({blockId:s,offset:S},{blockId:s,offset:w})),t.dispatch(v.build()),m.lineCount>=2&&t.announce(e.locale().indentedNLines(m.lineCount)),!0})}(t,r),"Shift-Tab":()=>function(t,e){return J(t,({state:o,sel:r,block:c,blockId:s,offset:i})=>{const d=n(c);if(u(r))return et(t,o,s,i,d,e);if(r.anchor.blockId!==s||r.head.blockId!==s)return!1;const p=l(r,o.getBlockOrder()),f=p.from.offset,h=p.to.offset;if(!d.slice(f,h).includes("\n"))return et(t,o,s,i,d,e);const k=function(t,e,n,o,r){const c=t.lastIndexOf("\n",e-1)+1,s=[];let i=0,a=0,l=c;for(;l<n;){a++;const e=Q(t.slice(l),o,r);e.removed.length>0&&(s.push({from:l,to:l+e.removed.length}),i+=e.removed.length);const c=t.indexOf("\n",l);if(-1===c||c>=n)break;l=c+1}return{deletes:s,totalRemoved:i,lineCount:a,lineStart:c}}(d,f,h,e.indent.useSpaces,e.indent.spaceCount);if(0===k.totalRemoved)return!0;const b=o.transaction("input");for(let t=k.deletes.length-1;t>=0;t--){const e=k.deletes[t];e&&b.deleteTextAt(s,e.from,e.to)}const m=g(r,o.getBlockOrder()),v=k.lineStart,x=h-k.totalRemoved,C=m?v:Math.max(v,x),y=m?Math.max(v,x):v;return b.setSelection(a({blockId:s,offset:C},{blockId:s,offset:y})),t.dispatch(b.build()),k.lineCount>=2&&t.announce(e.locale().dedentedNLines(k.lineCount)),!0})}(t,r),Escape:()=>nt(t),ArrowDown:()=>function(t){return J(t,({state:e,block:o,blockId:r,offset:c})=>!!u(e.selection)&&-1===n(o).indexOf("\n",c)&&(rt(t,e,r),!0))}(t),ArrowUp:()=>function(t){return J(t,({state:e,block:o,blockId:r,offset:c})=>{if(!u(e.selection))return!1;const s=n(o).indexOf("\n");return!(-1!==s&&c>s)&&ct(t,e,r)})}(t),ArrowRight:()=>function(t){return J(t,({state:e,block:o,blockId:r,offset:c})=>!!u(e.selection)&&c===n(o).length&&(rt(t,e,r),!0))}(t),ArrowLeft:()=>function(t){return J(t,({state:e,blockId:n,offset:o})=>!!u(e.selection)&&0===o&&ct(t,e,n))}(t)},{insertAfter:i,toggle:d}=o;i&&(s[i]=()=>function(t){return J(t,({blockId:e})=>(ot(t,e),!0))}(t)),d&&(s[d]=()=>t.executeCommand("toggleCodeBlock")),t.registerKeymap(s,{priority:"context"})}function et(t,e,n,o,r,c){const{start:s}=U(r,o),i=Q(r.slice(s),c.indent.useSpaces,c.indent.spaceCount);if(0===i.removed.length)return!0;const a=e.transaction("input").deleteTextAt(n,s,s+i.removed.length).setSelection(p(n,Math.max(s,o-i.removed.length))).build();return t.dispatch(a),!0}function nt(t){return J(t,({state:e,blockId:n})=>(rt(t,e,n),!0))}function ot(t,e){const n=t.getState(),o=n.getBlock(e);if(!o)return;const r=s(o),i=c(),a=n.transaction("command").splitBlock(e,r,i).setBlockType(i,k("paragraph")).setSelection(p(i,0)).build();t.dispatch(a)}function rt(t,e,n){const o=e.getBlockOrder(),r=o.indexOf(n);if(r<o.length-1){const n=o[r+1],c=e.transaction("command").setSelection(p(n,0)).build();return void t.dispatch(c)}ot(t,n)}function ct(t,e,n){const o=e.getBlockOrder(),r=o.indexOf(n);if(r<=0)return!1;const c=o[r-1],i=e.getBlock(c),a=i?s(i):0,l=e.transaction("command").setSelection(p(c,a)).build();return t.dispatch(l),!0}function st(t,n){const r=t.getState(),c=r.selection;if(!f(c))return!1;const i=r.getBlock(c.anchor.blockId);if(!i||"code_block"===i.type)return!1;const a={language:n.defaultLanguage??"",backgroundColor:""},l=r.transaction("command");return function(t,n){if(0===s(n))return;const r=o(n);let c=0;for(const o of r)if(e(o)){if(o.text.length>0)for(const e of o.marks)t.removeMark(n.id,c,c+o.text.length,e);c+=o.text.length}else c+=1}(l,i),l.setBlockType(c.anchor.blockId,k("code_block"),a).setSelection(p(c.anchor.blockId,0)),t.dispatch(l.build()),!0}function it(t,e){const n=m(t.doc,e);if(!n)return null;const o=I(n),s=y(t,o),a=S(s,e);if(a<0)return null;const l=t.transaction("command");if(1===s.length){const t=c();return l.insertNode(o,0,r(t)),l.removeNode(o,1),l.setSelection(p(t,0)),l.build()}l.removeNode(o,a);const d=function(t,e,n,o){const s=n[o-1];if(s&&i(s)){const e=w(t,s.id,"end");if(e)return e}const a=n[o+1];if(a&&i(a)){const e=w(t,a.id,"start");if(e)return e}const l=n[o],d=_(t,"start",l&&i(l)?l.id:void 0);if(d)return d;const u=c();return e.insertNode([],0,r(u)),p(u,0)}(t,l,s,a);return l.setSelection(d),l.build()}var at=class{bundles=/* @__PURE__ */new Map;listeners=[];register(t){this.bundles.set(t.id,t);for(const e of this.listeners)e(t)}onRegister(t){this.listeners.push(t);for(const e of this.bundles.values())t(e)}get(t){return this.bundles.get(t)}getAll(){return[...this.bundles.values()]}},lt={insertAfter:"Mod-Enter",toggle:"Mod-Shift-M"},dt={defaultLanguage:"",useSpaces:!1,spaceCount:2,showCopyButton:!0},ut=new A("codeBlock"),gt=new A("syntaxHighlighter"),pt=class{languageMap=/* @__PURE__ */new Map;constructor(t){if(t)for(const e of t)this.registerLanguageInternal(e)}registerLanguage(t){this.registerLanguageInternal(t)}tokenize(t,e){const n=this.languageMap.get(e.toLowerCase());if(!n)return[];const o=[];for(const r of N(t,n))o.push({from:r.from,to:r.to,type:r.type});return o}getSupportedLanguages(){const t=/* @__PURE__ */new Set;for(const e of this.languageMap.values()){t.add(e.name);for(const n of e.aliases)t.add(n)}return[...t]}registerLanguageInternal(t){this.languageMap.set(t.name.toLowerCase(),t);for(const e of t.aliases)this.languageMap.set(e.toLowerCase(),t)}},ft={label:"Code Block",tooltip:t=>t?`Code Block (${t})`:"Code Block",enteredCodeBlock:"Entered code block. Press Escape to exit.",leftCodeBlock:"Left code block.",copyCodeAria:"Copy code",escToExit:"Esc to exit",codeBlockAriaLabel:t=>`${t} code block. Press Escape to exit.`,copiedToClipboard:"Copied to clipboard",copyFailed:"Failed to copy code",deleteCodeBlockAria:"Delete code block",deletedCodeBlock:"Code block deleted",selectLanguageAria:"Select language",languageChanged:t=>`Language changed to ${t}`,plainText:"plain",indentedNLines:t=>1===t?"1 line indented":`${t} lines indented`,dedentedNLines:t=>1===t?"1 line dedented":`${t} lines dedented`},ht=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar--Isa9OHJ.mjs"),"./locales/de.ts":()=>import("./de-Dl4QFHMa.mjs"),"./locales/es.ts":()=>import("./es-DD01rZ6N.mjs"),"./locales/fr.ts":()=>import("./fr-CfhyYN-t.mjs"),"./locales/hi.ts":()=>import("./hi-B2YB3Bo4.mjs"),"./locales/pt.ts":()=>import("./pt-DYMyMgKQ.mjs"),"./locales/ru.ts":()=>import("./ru-l73diFXn.mjs"),"./locales/zh.ts":()=>import("./zh-Baxh6v0j.mjs")});async function kt(t){return L(ht,t,ft)}var bt='[role="option"]';function mt(t,e,n,o){const r=document.createElement("div");r.className="notectl-language-picker__option",r.setAttribute("role","option"),r.setAttribute("data-language",n),r.setAttribute("aria-selected",String(o)),r.setAttribute("tabindex",o?"0":"-1"),r.textContent=e,t.appendChild(r)}function vt(t,e,n,o){const r=t.getState(),c=r.getBlock(e);if(!c||"code_block"!==c.type)return;const s=r.getNodePath(e);if(!s)return;const i={...c.attrs,[n]:o},a=r.transaction("command").setNodeAttr(s,i).build();t.dispatch(a)}var xt=class{entries=/* @__PURE__ */new Map;getTokens(t,e,n,o){const r=this.entries.get(t);if(r&&r.text===e&&r.language===n)return r.tokens;const c=o?.tokenize(e,n)??[];return this.entries.set(t,{text:e,language:n,tokens:c}),c}findTokenAt(t,e){const n=this.entries.get(t);if(!n)return;const o=n.tokens;let r=0,c=o.length-1;for(;r<=c;){const t=r+c>>>1,n=o[t];if(!n)return;if(e<n.from)c=t-1;else{if(!(e>=n.to))return n;r=t+1}}}retain(t){for(const e of this.entries.keys())t.has(e)||this.entries.delete(e)}clear(){this.entries.clear()}},Ct=class{id="code-block";name="Code Block";priority=36;config;resolvedIndent;resolvedPairing;resolvedKeymap;context=null;locale;highlighter=null;tokenCache=new xt;autoPair;constructor(t){this.config={...dt,...t},this.resolvedIndent=function(t){const e=t.indent?.useSpaces??t.useSpaces??false,n=t.indent?.spaceCount??t.spaceCount??2,o=Math.max(1,Math.min(16,Math.trunc(n)));return{mode:t.indent?.mode??"brackets",useSpaces:e,spaceCount:o}}(this.config),this.resolvedPairing=function(t){const e=t.pairing;return{brackets:e?.brackets??"languageDefined",quotes:e?.quotes??"languageDefined",overtype:e?.overtype??true,deletePair:e?.deletePair??true,surround:e?.surround??"languageDefined"}}(this.config),this.resolvedKeymap={...lt,...t?.keymap},this.autoPair=new G({resolvedIndent:this.resolvedIndent,resolvedPairing:this.resolvedPairing,getTokenAt:(t,e)=>this.tokenCache.findTokenAt(t,e),getCompositionState:()=>this.context?.getCompositionState()??null})}async init(e){this.locale=await M(e,this.config.locale,ft,kt),e.registerStyleSheet(H),this.context=e,this.highlighter=function(t,e,n){const o=e.highlighter??new pt,r=new at;return r.onRegister(t=>{t.highlighting&&o.registerLanguage&&(o.registerLanguage(t.highlighting),n.clear())}),t.registerService(j,r),r.register($),r.register(E),r.register(z),r.register(D),t.registerService(gt,{registerLanguage:t=>{o.registerLanguage?.(t),n.clear()},getSupportedLanguages:()=>o.getSupportedLanguages(),tokenize:(t,e)=>o.tokenize(t,e),getTokenAt:(t,e)=>n.findTokenAt(t,e)}),o}(e,this.config,this.tokenCache),function(e){e.registerNodeSpec({type:"code_block",group:"block",content:{allow:["text"]},selectable:!0,attrs:{language:{default:""},backgroundColor:{default:""}},toDOM(t){const e=b("pre",t.id);e.className="notectl-code-block",e.setAttribute("dir","ltr"),e.setAttribute("part","code-block");const n=document.createElement("code");return n.className="notectl-code-block__content",n.setAttribute("part","code-block-content"),e.appendChild(n),e},toHTML(e,n,o){const r=t(e.attrs?.language??""),c=t(e.attrs?.backgroundColor??""),s=r?` class="language-${r}"`:"";return`<pre dir="ltr"${c?o?.styleAttr(`background-color: ${c}`)??` style="background-color: ${c}"`:""}><code${s}>${n||""}</code></pre>`},parseHTML:[{tag:"pre",getAttrs(t){const e=t.querySelector("code"),n=e?.className.match(/language-(\S+)/)?.[1]??"";return{language:(e?.getAttribute("data-language")??"")||n}}}],sanitize:{tags:["pre","code"],attrs:["data-language","class","style"]}})}(e),this.registerNodeView(e),function(t,e){t.registerCommand("toggleCodeBlock",()=>function(t,e){const n=t.getState();if(!f(n.selection))return!1;const o=n.getBlock(n.selection.anchor.blockId);if(!o)return!1;if("code_block"===o.type){const e=n.transaction("command").setBlockType(n.selection.anchor.blockId,k("paragraph")).setSelection(n.selection).build();return t.dispatch(e),!0}return st(t,e)}(t,e)),t.registerCommand("insertCodeBlock",()=>st(t,e)),t.registerCommand("setCodeBlockLanguage",()=>!1),t.registerCommand("setCodeBlockBackground",()=>!1),t.registerCommand("exitCodeBlock",()=>nt(t)),t.registerCommand("deleteCodeBlock",()=>function(t){const e=t.getState();if(!f(e.selection))return!1;const n=e.getBlock(e.selection.anchor.blockId);if(!n||"code_block"!==n.type)return!1;const o=it(e,n.id);return!!o&&(t.dispatch(o),!0)}(t))}(e,this.config),tt(e,this.config,this.resolvedKeymap,{indent:this.resolvedIndent,pairing:this.resolvedPairing,pairStack:this.autoPair.pairStack,locale:()=>this.locale}),!1!==this.config.inputRule&&function(t){t.registerInputRule({pattern:/^```(\w*) $/,handler:(t,e,n,o)=>{const r=t.selection;if(!f(r))return null;if(!u(r))return null;const c=t.getBlock(r.anchor.blockId);if(!c||"paragraph"!==c.type)return null;const s={language:e[1]??"",backgroundColor:""};return t.transaction("input").deleteTextAt(r.anchor.blockId,n,n+e[0].length).setBlockType(r.anchor.blockId,k("code_block"),s).setSelection(p(r.anchor.blockId,0)).build()}})}(e),function(t,e,n){t.registerToolbarItem({id:"code_block",group:"block",icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V5h14v14z"/><path d="M11 14.17L8.83 12 11 9.83 9.59 8.41 6 12l3.59 3.59L11 14.17zm3.41 1.42L18 12l-3.59-3.59L13 9.83 15.17 12 13 14.17l1.41 1.42z"/></svg>',label:e.label,tooltip:e.tooltip(n?P(n):void 0),command:"toggleCodeBlock",isActive:t=>!!f(t.selection)&&"code_block"===t.getBlock(t.selection.anchor.blockId)?.type})}(e,this.locale,this.resolvedKeymap.toggle),function(t){t.registerMiddleware((t,e,n)=>{if(!t.steps.some(t=>"addMark"===t.type&&"code_block"===e.getBlock(t.blockId)?.type))return void n(t);const o=t.steps.filter(t=>"addMark"!==t.type||"code_block"!==e.getBlock(t.blockId)?.type);n({...t,steps:o})},{name:"code-block:mark-guard",priority:50})}(e),function(t,e,n){t.registerService(ut,{setLanguage(e,n){vt(t,e,"language",n)},getLanguage(t){const e=n();if(!e)return"";const o=e.getState().getBlock(t);return o&&"code_block"===o.type?o.attrs?.language??"":""},setBackground(e,n){vt(t,e,"backgroundColor",n)},getBackground(t){const e=n();if(!e)return"";const o=e.getState().getBlock(t);return o&&"code_block"===o.type?o.attrs?.backgroundColor??"":""},isCodeBlock(t){const e=n();return!!e&&"code_block"===e.getState().getBlock(t)?.type},getSupportedLanguages(){const t=e();return t?t.getSupportedLanguages():[]}})}(e,()=>this.highlighter,()=>this.context),function(t){t.registerPasteInterceptor((t,e,n)=>{if(!t)return null;if(!f(n.selection))return null;const o=n.getBlock(n.selection.anchor.blockId);if(!o||"code_block"!==o.type)return null;const r=n.transaction("paste");let c=n.selection.anchor.blockId,s=n.selection.anchor.offset;if(!u(n.selection)){const t=h(n,r);t&&(c=t,s=0)}return r.insertText(c,s,t,[]),r.setSelection(p(c,s+t.length)),r.build()},{name:"code-block:paste",priority:10})}(e),e.registerTextInputInterceptor(this.autoPair.handleTextInput,{name:"code-block:auto-pair",priority:10}),function(t){const e=t.getSchemaRegistry(),n=e.getNodeSpec("table_cell");if(!n?.content)return;const o=n.content.allow??[];o.includes("code_block")||(e.removeNodeSpec("table_cell"),e.registerNodeSpec({...n,content:{...n.content,allow:[...o,"code_block"]}}))}(e)}destroy(){this.context=null,this.highlighter=null,this.tokenCache.clear(),this.autoPair.clear()}onStateChange(t,e,n){if(this.autoPair.syncOnStateChange(e,n),!this.context)return;const o=f(t.selection)?t.selection.anchor.blockId:null,r=f(e.selection)?e.selection.anchor.blockId:null,c=o?t.getBlock(o):void 0,s=r?e.getBlock(r):void 0,i="code_block"===c?.type,a="code_block"===s?.type;!i&&a?this.context.announce(this.locale.enteredCodeBlock):i&&!a&&this.context.announce(this.locale.leftCodeBlock)}decorations(t){return function(t,e){const o=[],r=function(t){if(!f(t.selection))return null;const e=t.selection.anchor.blockId;return"code_block"===t.getBlock(e)?.type?e:null}(t);if(r&&o.push(v(r,{class:"notectl-code-block--focused"})),e.highlighter){const r=/* @__PURE__ */new Set;for(const c of t.getBlockOrder()){const s=t.getBlock(c);if(!s||"code_block"!==s.type)continue;const i=s.attrs?.language??"";if(!i)continue;const a=n(s);if(!a)continue;r.add(c);const l=e.tokenCache.getTokens(c,a,i,e.highlighter);for(const t of l)o.push(x(c,t.from,t.to,{class:`notectl-token--${t.type}`}))}e.tokenCache.retain(r)}return 0===o.length?C.empty:C.create(o)}(t,{highlighter:this.highlighter,tokenCache:this.tokenCache})}registerNodeView(t){const e=new O(t.getContainer()),o=this.highlighter,r={popupManager:e,getSupportedLanguages:()=>o?.getSupportedLanguages()??[]};t.registerNodeView("code_block",function(t,e=ft,o){return(r,c,s)=>{const i=document.createElement("pre");i.className="notectl-code-block",i.setAttribute("data-block-id",r.id),i.setAttribute("dir","ltr"),i.setAttribute("role","group"),i.setAttribute("aria-roledescription","code block"),i.setAttribute("part","code-block");const a=document.createElement("div");a.className="notectl-code-block__header",a.setAttribute("contenteditable","false"),a.setAttribute("part","code-block-header");const l=document.createElement("button");l.className="notectl-code-block__language-btn",l.type="button",l.setAttribute("aria-haspopup","listbox"),l.setAttribute("aria-expanded","false"),l.setAttribute("aria-label",e.selectLanguageAria);let d=null;!1!==t.showCopyButton&&(d=document.createElement("button"),d.className="notectl-code-block__copy",d.setAttribute("aria-label",e.copyCodeAria),d.setAttribute("data-notectl-no-print",""),d.type="button",d.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="14" height="14"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg>');const u=document.createElement("button");u.className="notectl-code-block__delete",u.setAttribute("aria-label",e.deleteCodeBlockAria),u.title=e.deleteCodeBlockAria,u.setAttribute("data-notectl-no-print",""),u.type="button",u.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="14" height="14"><path d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"/></svg>';const g=document.createElement("span");g.className="notectl-sr-only",g.setAttribute("aria-live","assertive"),g.setAttribute("aria-atomic","true");const p=document.createElement("div");p.className="notectl-code-block__actions",d&&p.appendChild(d),p.appendChild(u),a.appendChild(l),a.appendChild(p),a.appendChild(g);const f=document.createElement("code");f.className="notectl-code-block__content",f.setAttribute("part","code-block-content");const h=document.createElement("div");h.className="notectl-code-block__esc-hint",h.setAttribute("contenteditable","false"),h.setAttribute("aria-hidden","true"),h.setAttribute("data-notectl-no-print",""),h.textContent=e.escToExit,i.appendChild(a),i.appendChild(f),i.appendChild(h),t.background&&B(i,"--notectl-code-block-bg",t.background),t.headerBackground&&B(i,"--notectl-code-block-header-bg",t.headerBackground),t.textColor&&B(i,"--notectl-code-block-color",t.textColor),t.headerColor&&B(i,"--notectl-code-block-header-color",t.headerColor);let k=r.id;function b(t){const n=t.attrs?.language??"",r=n||e.plainText;l.innerHTML="";const c=document.createElement("span");if(c.className="notectl-code-block__language",c.textContent=r,l.appendChild(c),o){const t=document.createElement("span");t.className="notectl-code-block__chevron",t.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="10" height="10"><path d="M4 6l4 4 4-4" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>',l.appendChild(t)}i.setAttribute("aria-label",e.codeBlockAriaLabel(r)),n?f.setAttribute("data-language",n):f.removeAttribute("data-language"),B(i,"backgroundColor",(t.attrs?.backgroundColor??"")||"")}function m(t){g.textContent=t,setTimeout(()=>{g.textContent=""},1e3)}return b(r),d&&d.addEventListener("click",t=>{t.preventDefault(),t.stopPropagation();const o=c().getBlock(k);o&&function(t){const e=globalThis.navigator?.clipboard;return e&&"function"==typeof e.writeText?e.writeText(t):Promise.reject(/* @__PURE__ */new Error("Clipboard API unavailable"))}(n(o)).then(()=>m(e.copiedToClipboard),()=>m(e.copyFailed))}),u.addEventListener("click",t=>{t.preventDefault(),t.stopPropagation();const n=it(c(),k);n&&(g.textContent=e.deletedCodeBlock,s(n))}),o&&l.addEventListener("click",t=>{t.preventDefault(),t.stopPropagation();const n=c().getBlock(k);if(!n)return;const r=n.attrs?.language??"";!function(t){const{anchor:e,languages:n,currentLanguage:o,onSelect:r,popupManager:c,locale:s}=t;c.open({anchor:e,ariaRole:"listbox",ariaLabel:s.selectLanguageAria,className:"notectl-language-picker",position:"below-start",restoreFocusTo:e,content(t,e){const c=o.toLowerCase();mt(t,s.plainText,"",""===c);const i=[...n].sort((t,e)=>t.localeCompare(e));for(const n of i)mt(t,n,n,c===n.toLowerCase());q({container:t,itemSelector:bt,onSelect(t){r(t.getAttribute("data-language")??""),e()},onClose(){e()}}),t.addEventListener("click",t=>{const n=t.target.closest(bt);n&&(r(n.getAttribute("data-language")??""),e())})},onClose(){e.setAttribute("aria-expanded","false")}}),e.setAttribute("aria-expanded","true")}({anchor:l,languages:o.getSupportedLanguages(),currentLanguage:r,locale:e,popupManager:o.popupManager,onSelect(t){if(t===r)return;const n=c(),o=n.getBlock(k);if(!o)return;const i=n.getNodePath(k);if(!i)return;const a={...o.attrs,language:t};s(n.transaction("command").setNodeAttr(i,a).build());const l=t||e.plainText;m(e.languageChanged(l))}})}),{dom:i,contentDOM:f,update:t=>"code_block"===t.type&&(k=t.id,i.setAttribute("data-block-id",t.id),b(t),!0),selectNode(){i.classList.add("notectl-code-block--selected")},deselectNode(){i.classList.remove("notectl-code-block--selected")},destroy(){}}}}(this.config,this.locale,r))}};export{ut as a,pt as i,ft as n,gt as o,kt as r,Ct as t};
|
|
2
|
-
//# sourceMappingURL=CodeBlockPlugin-C1hrdbSZ.mjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./Platform-ByobkiCc.mjs";import{c as a,s as r}from"./StyleRuntime-DW6omotc.mjs";import{r as t,t as f}from"./KeyboardNav-D0my3wuy.mjs";var o=new Map([["#000000","Black"],["#434343","Dark Gray 4"],["#666666","Dark Gray 3"],["#999999","Dark Gray 2"],["#b7b7b7","Dark Gray 1"],["#cccccc","Light Gray 3"],["#d9d9d9","Light Gray 2"],["#efefef","Light Gray 1"],["#f3f3f3","Near White"],["#ffffff","White"],["#980000","Dark Red Berry"],["#ff0000","Red"],["#ff9900","Orange"],["#ffff00","Yellow"],["#00ff00","Green"],["#00ffff","Cyan"],["#4a86e8","Cornflower Blue"],["#0000ff","Blue"],["#9900ff","Purple"],["#ff00ff","Magenta"],["#e6b8af","Light Red Berry 3"],["#f4cccc","Light Red 3"],["#fce5cd","Light Orange 3"],["#fff2cc","Light Yellow 3"],["#d9ead3","Light Green 3"],["#d0e0e3","Light Cyan 3"],["#c9daf8","Light Cornflower Blue 3"],["#cfe2f3","Light Blue 3"],["#d9d2e9","Light Purple 3"],["#ead1dc","Light Magenta 3"],["#dd7e6b","Light Red Berry 2"],["#ea9999","Light Red 2"],["#f9cb9c","Light Orange 2"],["#ffe599","Light Yellow 2"],["#b6d7a8","Light Green 2"],["#a2c4c9","Light Cyan 2"],["#a4c2f4","Light Cornflower Blue 2"],["#9fc5e8","Light Blue 2"],["#b4a7d6","Light Purple 2"],["#d5a6bd","Light Magenta 2"],["#cc4125","Light Red Berry 1"],["#e06666","Light Red 1"],["#f6b26b","Light Orange 1"],["#ffd966","Light Yellow 1"],["#93c47d","Light Green 1"],["#76a5af","Light Cyan 1"],["#6d9eeb","Light Cornflower Blue 1"],["#6fa8dc","Light Blue 1"],["#8e7cc3","Light Purple 1"],["#c27ba0","Light Magenta 1"],["#a61c00","Dark Red Berry 1"],["#cc0000","Dark Red 1"],["#e69138","Dark Orange 1"],["#f1c232","Dark Yellow 1"],["#6aa84f","Dark Green 1"],["#45818e","Dark Cyan 1"],["#3c78d8","Dark Cornflower Blue 1"],["#3d85c6","Dark Blue 1"],["#674ea7","Dark Purple 1"],["#a64d79","Dark Magenta 1"],["#85200c","Dark Red Berry 2"],["#990000","Dark Red 2"],["#b45f06","Dark Orange 2"],["#bf9000","Dark Yellow 2"],["#38761d","Dark Green 2"],["#134f5c","Dark Cyan 2"],["#1155cc","Dark Cornflower Blue 2"],["#0b5394","Dark Blue 2"],["#351c75","Dark Purple 2"],["#741b47","Dark Magenta 2"],["#fff176","Bright Yellow"],["#aed581","Light Green"],["#4dd0e1","Bright Cyan"],["#64b5f6","Sky Blue"],["#ce93d8","Lavender"],["#f48fb1","Pink"],["#ffab91","Peach"],["#ff8a65","Coral"],["#e6ee9c","Lime"],["#80cbc4","Teal"],["#fff9c4","Pale Yellow"],["#dcedc8","Pale Green"],["#e0f7fa","Pale Cyan"],["#e3f2fd","Pale Blue"],["#f3e5f5","Pale Purple"],["#fce4ec","Pale Pink"],["#fff3e0","Pale Orange"],["#fbe9e7","Pale Red"],["#f9fbe7","Pale Lime"],["#e0f2f1","Pale Teal"],["#fff59d","Soft Yellow"],["#c5e1a5","Soft Green"],["#80deea","Soft Cyan"],["#90caf9","Soft Blue"],["#e1bee7","Soft Purple"],["#f8bbd0","Soft Pink"],["#ffcc80","Soft Orange"],["#a5d6a7","Mint"],["#ffee58","Vivid Yellow"],["#9ccc65","Vivid Green"],["#26c6da","Vivid Cyan"],["#42a5f5","Vivid Blue"],["#ab47bc","Vivid Purple"],["#ec407a","Vivid Pink"],["#ffa726","Vivid Orange"],["#ff7043","Red Orange"],["#d4e157","Vivid Lime"],["#66bb6a","Emerald"],["#fafafa","Almost White"],["#f5f5f5","Lightest Gray"],["#eeeeee","Very Light Gray"],["#e0e0e0","Silver"],["#bdbdbd","Medium Gray"],["#e8eaf6","Lavender Gray"],["#efebe9","Warm Gray"],["#eceff1","Cool Gray"]]);function n(e){return o.get(e.toLowerCase())||function(e){const a=l(e),r=Number.parseInt(a.slice(1,3),16)/255,t=Number.parseInt(a.slice(3,5),16)/255,f=Number.parseInt(a.slice(5,7),16)/255,o=Math.max(r,t,f),n=Math.min(r,t,f),i=(o+n)/2,c=o-n;if(c<.05)return i<.15?"Black":i<.35?"Dark Gray":i<.65?"Gray":i<.85?"Light Gray":"Near White";let s=0;s=o===r?60*((t-f)/c+(t<f?6:0)):o===t?60*((f-r)/c+2):60*((r-t)/c+4);let u="Red";for(const[l,g]of d)if(s<l){u=g;break}return i<.25?`Very Dark ${u}`:i<.4?`Dark ${u}`:i>.8?`Very Light ${u}`:i>.65?`Light ${u}`:u}(e)}function i(e){return function(e){const a=l(e);return.2126*c(Number.parseInt(a.slice(1,3),16)/255)+.7152*c(Number.parseInt(a.slice(3,5),16)/255)+.0722*c(Number.parseInt(a.slice(5,7),16)/255)}(e)>.3}function l(e){const a=e.toLowerCase();return 4===a.length?`#${a[1]}${a[1]}${a[2]}${a[2]}${a[3]}${a[3]}`:a}function c(e){return e<=.03928?e/12.92:((e+.055)/1.055)**2.4}var d=[[15,"Red"],[45,"Orange"],[65,"Yellow"],[150,"Green"],[190,"Cyan"],[250,"Blue"],[290,"Purple"],[330,"Pink"],[361,"Red"]],s=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"]);function u(o,l){const c=l.columns,d=l.colors.length,u=Math.ceil(d/c),g=document.createElement("div");g.className="notectl-color-picker__grid",g.setAttribute("role","grid"),g.setAttribute("aria-label",l.ariaLabel);const h=[];let b=0;for(let e=0;e<u;e++){const t=document.createElement("div");t.setAttribute("role","row");for(let f=0;f<c;f++){const o=e*c+f;if(o>=d)break;const s=l.colors[o],u=n(s),g=!!l.activeColor&&l.activeColor.toLowerCase()===s.toLowerCase(),L=document.createElement("button");L.type="button",L.className="notectl-color-picker__swatch",L.setAttribute("role","gridcell");const k=l.swatchLabel?l.swatchLabel(u):`${l.ariaLabelPrefix} ${u}`;L.setAttribute("aria-label",k),L.setAttribute("aria-selected",String(g)),L.dataset.index=String(o),a(L,"backgroundColor",s),L.title=l.titleAsName?u:s,i(s)&&r(L,{border:"1px solid #d0d0d0"}),g&&(L.classList.add("notectl-color-picker__swatch--active"),b=o),L.addEventListener("mousedown",e=>{e.preventDefault(),e.stopPropagation(),l.onSelect(s)}),h.push(L),t.appendChild(L)}g.appendChild(t)}f(h,b),g.addEventListener("keydown",a=>{if("Escape"===a.key)return a.preventDefault(),a.stopPropagation(),void l.onClose();if("Enter"===a.key||" "===a.key){a.preventDefault(),a.stopPropagation();const e=a.target.dataset.index;if(void 0!==e){const a=l.colors[Number(e)];a&&l.onSelect(a)}return}if(s.has(a.key)){a.preventDefault(),a.stopPropagation();const r=Math.floor(b/c)+1,n=b%c+1,i=e(o),[l,s]=t(r,n,u,c,a.key,i);let g=(l-1)*c+(s-1);return g>=d&&(g=d-1),b=g,f(h,b),void h[b]?.focus()}if("Home"===a.key||"End"===a.key){a.preventDefault(),a.stopPropagation();const e=Math.floor(b/c)*c,r=Math.min(e+c-1,d-1);b="Home"===a.key?e:r,f(h,b),h[b]?.focus()}}),o.appendChild(g)}export{n,i as r,u as t};
|
|
2
|
-
//# sourceMappingURL=ColorGrid-C9RQoEWF.mjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./TypeBrands-Ch9856Gb.mjs";import{i as t,n as o,t as r}from"./AttributedMarkCommands-bagbH8Qt.mjs";import{t as a}from"./ColorValidation-DAijTjG9.mjs";import{t as n}from"./ColorGrid-C9RQoEWF.mjs";function s(e,t){return o(e,t,e=>e.attrs.color??null)}function i(e,t){return null!==s(e,t)}function l(t,o,n,s){if(!a(s))return!1;const i=r(o,{type:e(n),attrs:{color:s}});return!!i&&(t.dispatch(i),!0)}function c(o,r,a){const n=t(r,e(a));return!!n&&(o.dispatch(n),!0)}function m(e,t,o){e.classList.add("notectl-color-picker");const r=s(t.getState(),o.markType),a=o.columns||10,i=t.getContainer(),c=document.createElement("button");c.type="button",c.className="notectl-color-picker__default",c.textContent=o.resetLabel,c.addEventListener("mousedown",e=>{e.preventDefault(),e.stopPropagation(),t.executeCommand(o.resetCommand),o.onClose({restoreFocusTo:i})}),c.addEventListener("keydown",e=>{"Escape"===e.key&&(e.preventDefault(),o.onClose())}),e.appendChild(c),n(e,{colors:o.colors,columns:a,ariaLabel:`${o.ariaLabelPrefix} color picker`,ariaLabelPrefix:o.ariaLabelPrefix,activeColor:r,onSelect:e=>{l(t,t.getState(),o.markType,e),o.onClose({restoreFocusTo:i})},onClose:o.onClose})}export{c as a,i,l as n,s as r,m as t};
|
|
2
|
-
//# sourceMappingURL=ColorPickerPopup-DiA68Pzz.mjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var e=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i;function r(r){return e.test(r)}var a=/^rgba?\(\s*(\d{1,3}%?\s*,\s*){2}\d{1,3}%?(\s*,\s*(0|1|0?\.\d+))?\s*\)$/,l=/^hsla?\(\s*\d{1,3}\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%(\s*,\s*(0|1|0?\.\d+))?\s*\)$/,t=new Set(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","transparent","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"]);function n(r){if(!r)return!1;const n=r.trim().toLowerCase();return!!n&&(e.test(n)||a.test(n)||l.test(n)||t.has(n))}function i(e,a,l){if(!e||0===e.length)return a;const t=e.filter(e=>!r(e));if(t.length>0)throw new Error(`${l}: invalid hex color(s): ${t.join(", ")}. Expected format: #RGB or #RRGGBB.`);const n=/* @__PURE__ */new Set,i=[];for(const r of e){const e=r.toLowerCase();n.has(e)||(n.add(e),i.push(e))}return i}var o=/[{}<>;]|url\(|expression\(/i;function s(e){if(!e)return!1;const r=e.trim();return!!r&&!o.test(r)}var d=/^\d+(\.\d+)?(px|pt|em|rem|%)$/i;function u(e){return!!e&&d.test(e.trim())}export{i as a,r as i,s as n,u as r,n as t};
|
|
2
|
-
//# sourceMappingURL=ColorValidation-DAijTjG9.mjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{D as t,E as e,S as n,_ as o,b as r,c,f as i,g as s,h as l,i as f,l as u,p as d,v as a,y as k}from"./Document-827l3P80.mjs";import{i as m,n as b,r as g,t as I}from"./WordBoundary-CFpIJDNP.mjs";import{a as p,c as h,d as S,l as x,o as B,r as T,t as O,u as N}from"./Selection-HYoVFpAx.mjs";import{i as y,r as v}from"./TypeBrands-Ch9856Gb.mjs";import{r as A}from"./NodeResolver-Dleih-8R.mjs";import{i as j,n as M,o as w,r as _}from"./NavigationQueries-Bt4zZ17v.mjs";import{T as C,b as D,w as P,x as R}from"./BlockInsertion-CJusvrDL.mjs";import{a as q,o as E}from"./AttributedMarkCommands-bagbH8Qt.mjs";import{n as Q,r as W,t as z}from"./NodeSelectionCommands-1PjwUDTJ.mjs";import{n as F}from"./RangeIterator-DP7Ud3Gp.mjs";function G(){return{nodeTypes:["paragraph"],markTypes:["bold","italic","underline"],getNodeSpec:()=>{}}}function H(t){return{nodeTypes:t.getNodeTypes(),markTypes:t.getMarkTypes(),getNodeSpec:e=>t.getNodeSpec(e),getInlineNodeSpec:e=>t.getInlineNodeSpec(e),getMarkSpec:e=>t.getMarkSpec(e)}}function J(t,e){return t.markTypes.includes(e)}function K(t,e){return t.nodeTypes.includes(e)}function L(t,e){if("after"===e.side)return V(t,e);const n=t.getBlockOrder(),o=n.indexOf(e.blockId);if(o<=0)return null;const r=n[o-1];if(!r)return null;if(j(t,r)){const e=A(t.doc,r)??[];return t.transaction("input").setSelection(T(r,e)).build()}const c=t.getBlock(r);if(!c)return null;const i=l(c);return t.transaction("input").setSelection(O(r,i)).build()}function U(t,e){if("before"===e.side)return V(t,e);const n=t.getBlockOrder(),o=n.indexOf(e.blockId);if(o>=n.length-1)return null;const r=n[o+1];if(!r)return null;if(j(t,r)){const e=A(t.doc,r)??[];return t.transaction("input").setSelection(T(r,e)).build()}return t.transaction("input").setSelection(O(r,0)).build()}function V(t,e){const n=A(t.doc,e.blockId)??[];return z(t,T(e.blockId,n))}var X=new Set(["blockquote","list_item"]);function Y(t,e){const n=A(t.doc,e);if(!n||0===n.length)return-1;const o=n[0];return t.doc.children.findIndex(t=>t.id===o)}function Z(t,n,o,r,s){const f=t.doc.children[r],u=t.doc.children[s];if(!f||!u)return;const d=t.getBlock(o.to.blockId);if(!d)return;const a=e(f),k=e(u),m=0===o.from.offset&&$(f)===o.from.blockId,b=o.to.offset===l(d)&&tt(u)===o.to.blockId,g=!a&&(!X.has(f.type)||m),I=!k&&(!X.has(u.type)||b);if(a){const t=l(f);o.from.offset<t&&n.deleteTextAt(o.from.blockId,o.from.offset,t)}else g||et(n,[f.id],f,A(t.doc,o.from.blockId)??[],o.from.blockId,o.from.offset);let p;k?o.to.offset>0&&n.deleteTextAt(o.to.blockId,0,o.to.offset):I||nt(n,[u.id],u,A(t.doc,o.to.blockId)??[],o.to.blockId,o.to.offset);let h=0;g&&(p=i(),n.insertNode([],r,c(p)),h=1);const S=[];g&&S.push(r);for(let e=r+1;e<s;e++)S.push(e);I&&S.push(s);for(let e=S.length-1;e>=0;e--)n.removeNode([],S[e]+h);return a&&k&&n.mergeBlocksAt(o.from.blockId,o.to.blockId),p}function $(t){if(e(t))return t.id;const n=d(t)[0];return n?$(n):t.id}function tt(t){if(e(t))return t.id;const n=d(t),o=n[n.length-1];return o?tt(o):t.id}function et(t,e,n,o,r,c){const i=d(n),s=o.indexOf(n.id),f=s>=0?o[s+1]:void 0,u=i.findIndex(t=>t.id===f);if(u<0)return;for(let l=i.length-1;l>u;l--)t.removeNode(e,l);const a=i[u];if(a.id===r){const e=l(a);return void(c<e&&t.deleteTextAt(r,c,e))}et(t,[...e,a.id],a,o,r,c)}function nt(t,e,n,o,r,c){const i=d(n),s=o.indexOf(n.id),l=s>=0?o[s+1]:void 0,f=i.findIndex(t=>t.id===l);if(f<0)return;for(let d=f-1;d>=0;d--)t.removeNode(e,d);const u=i[f];u.id!==r?nt(t,[...e,u.id],u,o,r,c):c>0&&t.deleteTextAt(r,0,c)}var ot={bold:!0,italic:!0,underline:!0};function rt(t,e,o=ot){if(function(t,e){const n=t;return"bold"===n?!e.bold:"italic"===n?!e.italic:"underline"===n&&!e.underline}(e,o))return null;if(!J(t.schema,e))return null;if(!N(t.selection))return null;const r={type:e},c=t.selection;if(B(c)){if(!t.getBlock(c.anchor.blockId))return null;const o=E(t),i=n(o,e)?o.filter(t=>t.type!==e):[...o,r];return t.transaction("command").setStoredMarks(i,t.storedMarks).setSelection(c).build()}const i=S(c,t.getBlockOrder()),s=t.transaction("command"),l=ft(t,e);return F(t,i,(t,e,n)=>{l?s.removeMark(t,e,n,r):s.addMark(t,e,n,r)}),s.setSelection(c),s.build()}function ct(t,e){return rt(t,y("bold"),e)}function it(t,e){return rt(t,y("italic"),e)}function st(t,e){return rt(t,y("underline"),e)}function lt(t,e){const o=t.selection;return!!N(o)&&(B(o)?n(E(t),e):ft(t,e))}function ft(t,e){const n=t.selection;if(!N(n))return!1;const o=t.getBlockOrder(),r=S(n,o),c=o.indexOf(r.from.blockId),i=o.indexOf(r.to.blockId);let s=!1;for(let f=c;f<=i;f++){const n=o[f];if(!n)continue;const u=t.getBlock(n);if(!u)continue;const d=l(u),a=ut(u,f===c?r.from.offset:0,f===i?r.to.offset:d,e);if("missing"===a)return!1;"present"===a&&(s=!0)}return s}function ut(e,o,c,i){let s=0,l=!1;for(const f of r(e))if(t(f)){const t=s+f.text.length;if(t>o&&s<c&&(l=!0,!n(f.marks,i)))return"missing";s=t}else s+=1;return l?"present":"empty"}function dt(t,e){const n=t.selection;if(x(n))return z(t,n);if(h(n))return null;if(!B(n))return ht(t);const o=t.getBlock(n.anchor.blockId);if(!o)return null;const r=e.range(o,n.anchor.offset);if(!r)return e.merge(t);const[c,i]=r;return t.transaction("input").deleteTextAt(o.id,c,i).setSelection(O(o.id,c)).build()}function at(t){return dt(t,{merge:Bt,range:(t,e)=>e<=0?null:"inline"===a(t,e-1)?.kind?[e-1,e]:[e-(m(o(t),f(t,e))||1),e]})}function kt(t){return dt(t,{merge:Tt,range:(t,e)=>e>=l(t)?null:"inline"===a(t,e)?.kind?[e,e+1]:[e,e+(g(o(t),f(t,e))||1)]})}function mt(t){return dt(t,{merge:Bt,range:(t,e)=>e>0?[I(t,e),e]:null})}function bt(t){return dt(t,{merge:Tt,range:(t,e)=>e<l(t)?[e,b(t,e)]:null})}function gt(t){return dt(t,{merge:Bt,range:(t,e)=>e>0?[0,e]:null})}function It(t){return dt(t,{merge:Tt,range:(t,e)=>{const n=l(t);return e<n?[e,n]:null}})}function pt(t,e,n="input"){const o=t.selection;if(x(o))return W(t,o,e,n);if(h(o))return function(t,e,n,o){const{parentPath:r,siblings:s,index:l}=C(t,e.blockId),f="before"===e.side?Math.max(l,0):l>=0?l+1:s.length,u=i(),d=t.transaction(o);return d.insertNode(r,f,c(u)),d.insertText(u,0,n,[]),d.setSelection(O(u,n.length)),d.build()}(t,o,e,n);const r=t.transaction(n),l=function(t){if(t.storedMarks)return t.storedMarks;const e=t.selection;if(!N(e))return[];const n=t.getBlock(e.anchor.blockId);return n?B(e)?k(n,e.anchor.offset,e=>q(t.schema,e)):s(n,e.anchor.offset):[]}(t);let f;B(o)||(f=vt(t,r));const u=P(o,t.getBlockOrder()),d=f??u.blockId,a=f?0:u.offset;return r.insertText(d,a,e,l),r.setSelection(O(d,a+e.length)),r.build()}function ht(t){if(x(t.selection))return z(t,t.selection);if(h(t.selection))return null;if(B(t.selection))return null;if(function(t){if(!N(t.selection))return!1;const e=yt(t);if(!e)return!1;const n=S(t.selection,t.getBlockOrder());return n.from.blockId===e.from.blockId&&n.from.offset===e.from.offset&&n.to.blockId===e.to.blockId&&n.to.offset===e.to.offset}(t))return function(t){const e=i(),n=t.transaction("input"),o=t.doc.children.length;n.insertNode([],0,c(e));for(let r=o;r>=1;r--)n.removeNode([],r);return n.setSelection(O(e,0)),n.build()}(t);const e=t.transaction("input"),n=vt(t,e),o=S(t.selection,t.getBlockOrder()),r=n??o.from.blockId,s=n?0:o.from.offset;return e.setSelection(O(r,s)),e.build()}function St(t){const e=t.selection;if(x(e))return Q(t,e);if(h(e))return function(t,e){const{parentPath:n,index:o}=C(t,e.blockId);if(o<0)return null;const r="before"===e.side?o:o+1,s=i(),l=t.transaction("input");return l.insertNode(n,r,c(s)),l.setSelection(O(s,0)),l.build()}(t,e);const n=t.transaction("input");let o;B(e)||(o=vt(t,n));const r=P(e,t.getBlockOrder()),s=o??r.blockId,l=o?0:r.offset,f=i();return n.splitBlock(s,l,f),n.setSelection(O(f,0)),n.build()}function xt(t){const e=t.selection;if(!N(e))return null;const n=t.transaction("input");let o;if(B(e)||(o=vt(t,n)),o)n.insertInlineNode(o,0,u(v("hard_break"))),n.setSelection(O(o,1));else{const{blockId:o,offset:r}=P(e,t.getBlockOrder());n.insertInlineNode(o,r,u(v("hard_break"))),n.setSelection(O(o,r+1))}return n.build()}function Bt(t){return Ot(t,"backward")}function Tt(t){return Ot(t,"forward")}function Ot(t,e){const n=t.selection;if(!N(n))return null;const o=t.getBlockOrder(),r=o.indexOf(n.anchor.blockId),c="backward"===e?r-1:r+1;if(c<0||c>=o.length)return null;const i=o[c];if(!i)return null;if(_(t,n.anchor.blockId)||_(t,i))return null;if(!w(t,n.anchor.blockId,i)&&M(t,n.anchor.blockId))return null;if(j(t,i)){const e=A(t.doc,i)??[];return t.transaction("input").setSelection(T(i,e)).build()}if("backward"===e){const e=t.getBlock(i);if(!e)return null;const o=l(e);return t.transaction("input").mergeBlocksAt(i,n.anchor.blockId).setSelection(O(i,o)).build()}return t.transaction("input").mergeBlocksAt(n.anchor.blockId,i).setSelection(O(n.anchor.blockId,n.anchor.offset)).build()}function Nt(t){const e=yt(t);return e?t.transaction("command").setSelection(p(e.from,e.to)).build():t.transaction("command").setSelection(t.selection).build()}function yt(t){const e=t.doc.children,n=e[0],o=e[e.length-1];if(!n||!o)return null;const r=D(n),c=R(o),i=t.getBlock(c);return{from:{blockId:r,offset:0},to:{blockId:c,offset:i?l(i):0}}}function vt(t,e){if(!N(t.selection))return;const n=t.getBlockOrder(),o=S(t.selection,n),r=n.indexOf(o.from.blockId),c=n.indexOf(o.to.blockId);if(r===c)return void e.deleteTextAt(o.from.blockId,o.from.offset,o.to.offset);const i=Y(t,o.from.blockId),s=Y(t,o.to.blockId);if(!(i===s||i<0||s<0))return Z(t,e,o,i,s);!function(t,e,n,o,r,c){const i=t.getBlock(o.from.blockId);if(!i)return;const s=l(i);o.from.offset<s&&e.deleteTextAt(o.from.blockId,o.from.offset,s),o.to.offset>0&&e.deleteTextAt(o.to.blockId,0,o.to.offset);for(let f=r+1;f<c;f++){const r=n[f];if(!r)continue;const c=t.getBlock(r);if(!c)continue;const i=l(c);i>0&&e.deleteTextAt(r,0,i),e.mergeBlocksAt(o.from.blockId,r)}e.mergeBlocksAt(o.from.blockId,o.to.blockId)}(t,e,n,o,r,c)}export{K as C,J as S,rt as _,Bt as a,U as b,at as c,It as d,mt as f,it as g,ct as h,pt as i,kt as l,lt as m,ht as n,Nt as o,bt as p,xt as r,St as s,vt as t,gt as u,st as v,H as w,G as x,L as y};
|
|
2
|
-
//# sourceMappingURL=Commands-1dFFldi7.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Commands-1dFFldi7.mjs","names":[],"sources":["../../src/model/Schema.ts","../../src/commands/GapCursorCommands.ts","../../src/commands/SelectionDeletion.ts","../../src/commands/MarkCommands.ts","../../src/commands/DeleteCommands.ts","../../src/commands/Commands.ts"],"sourcesContent":["/**\n * Schema definition for the Notectl editor.\n * Defines which node types and marks are allowed.\n */\n\nimport type { InlineNodeSpec } from './InlineNodeSpec.js';\nimport type { MarkSpec } from './MarkSpec.js';\nimport type { NodeSpec } from './NodeSpec.js';\nimport type { SchemaRegistry } from './SchemaRegistry.js';\n\nexport interface Schema {\n\treadonly nodeTypes: readonly string[];\n\treadonly markTypes: readonly string[];\n\t/** Looks up the full NodeSpec for a given type. Available when created via schemaFromRegistry. */\n\treadonly getNodeSpec?: (type: string) => NodeSpec | undefined;\n\t/** Looks up the full InlineNodeSpec for a given type. Available via schemaFromRegistry. */\n\treadonly getInlineNodeSpec?: (type: string) => InlineNodeSpec | undefined;\n\t/** Looks up the full MarkSpec for a given type. Available via schemaFromRegistry. */\n\treadonly getMarkSpec?: (type: string) => MarkSpec | undefined;\n}\n\n/** Creates the default schema with paragraph nodes and bold/italic/underline marks. */\nexport function defaultSchema(): Schema {\n\treturn {\n\t\tnodeTypes: ['paragraph'],\n\t\tmarkTypes: ['bold', 'italic', 'underline'],\n\t\tgetNodeSpec: () => undefined,\n\t};\n}\n\n/** Derives a Schema from a SchemaRegistry's registered specs. */\nexport function schemaFromRegistry(registry: SchemaRegistry): Schema {\n\treturn {\n\t\tnodeTypes: registry.getNodeTypes(),\n\t\tmarkTypes: registry.getMarkTypes(),\n\t\tgetNodeSpec: (type: string) => registry.getNodeSpec(type),\n\t\tgetInlineNodeSpec: (type: string) => registry.getInlineNodeSpec(type),\n\t\tgetMarkSpec: (type: string) => registry.getMarkSpec(type),\n\t};\n}\n\n/** Checks whether the given mark type is allowed by the schema. */\nexport function isMarkAllowed(schema: Schema, markType: string): boolean {\n\treturn schema.markTypes.includes(markType);\n}\n\n/** Checks whether the given node type is allowed by the schema. */\nexport function isNodeTypeAllowed(schema: Schema, nodeType: string): boolean {\n\treturn schema.nodeTypes.includes(nodeType);\n}\n","/**\n * Commands for GapCursor: deleting void blocks adjacent to gap cursors\n * and inserting paragraphs at gap positions.\n */\n\nimport { createEmptyParagraph, generateBlockId, getBlockLength } from '../model/Document.js';\nimport { findNodePath } from '../model/NodeResolver.js';\nimport type { GapCursorSelection, NodeSelection } from '../model/Selection.js';\nimport { createCollapsedSelection, createNodeSelection } from '../model/Selection.js';\nimport type { BlockId } from '../model/TypeBrands.js';\nimport type { EditorState } from '../state/EditorState.js';\nimport { isVoidBlock } from '../state/NavigationQueries.js';\nimport type { Transaction } from '../state/Transaction.js';\nimport { resolveSiblingContext } from './CommandHelpers.js';\nimport { deleteNodeSelection } from './NodeSelectionCommands.js';\n\n/**\n * Deletes the void block adjacent to a GapCursor when pressing Backspace.\n *\n * - `side === 'after'` → void block is behind the cursor → delete it.\n * - `side === 'before'` → void block is ahead → navigate backward (to previous block).\n * - At document start with `side === 'before'` → `null` (no-op).\n */\nexport function deleteBackwardAtGap(\n\tstate: EditorState,\n\tsel: GapCursorSelection,\n): Transaction | null {\n\tif (sel.side === 'after') {\n\t\treturn deleteVoidAtGap(state, sel);\n\t}\n\n\t// side === 'before': navigate to previous block\n\tconst blockOrder: readonly BlockId[] = state.getBlockOrder();\n\tconst blockIdx: number = blockOrder.indexOf(sel.blockId);\n\n\tif (blockIdx <= 0) return null;\n\n\tconst prevId: BlockId | undefined = blockOrder[blockIdx - 1];\n\tif (!prevId) return null;\n\n\tif (isVoidBlock(state, prevId)) {\n\t\tconst path = findNodePath(state.doc, prevId) ?? [];\n\t\treturn state\n\t\t\t.transaction('input')\n\t\t\t.setSelection(createNodeSelection(prevId, path as BlockId[]))\n\t\t\t.build();\n\t}\n\n\tconst prevBlock = state.getBlock(prevId);\n\tif (!prevBlock) return null;\n\tconst prevLen: number = getBlockLength(prevBlock);\n\treturn state.transaction('input').setSelection(createCollapsedSelection(prevId, prevLen)).build();\n}\n\n/**\n * Deletes the void block adjacent to a GapCursor when pressing Delete.\n *\n * - `side === 'before'` → void block is ahead of the cursor → delete it.\n * - `side === 'after'` → void block is behind → navigate forward (to next block).\n * - At document end with `side === 'after'` → `null` (no-op).\n */\nexport function deleteForwardAtGap(\n\tstate: EditorState,\n\tsel: GapCursorSelection,\n): Transaction | null {\n\tif (sel.side === 'before') {\n\t\treturn deleteVoidAtGap(state, sel);\n\t}\n\n\t// side === 'after': navigate to next block\n\tconst blockOrder: readonly BlockId[] = state.getBlockOrder();\n\tconst blockIdx: number = blockOrder.indexOf(sel.blockId);\n\n\tif (blockIdx >= blockOrder.length - 1) return null;\n\n\tconst nextId: BlockId | undefined = blockOrder[blockIdx + 1];\n\tif (!nextId) return null;\n\n\tif (isVoidBlock(state, nextId)) {\n\t\tconst path = findNodePath(state.doc, nextId) ?? [];\n\t\treturn state\n\t\t\t.transaction('input')\n\t\t\t.setSelection(createNodeSelection(nextId, path as BlockId[]))\n\t\t\t.build();\n\t}\n\n\treturn state.transaction('input').setSelection(createCollapsedSelection(nextId, 0)).build();\n}\n\n/** Deletes the void block that the GapCursor is adjacent to, delegating to deleteNodeSelection. */\nfunction deleteVoidAtGap(state: EditorState, sel: GapCursorSelection): Transaction | null {\n\tconst path = (findNodePath(state.doc, sel.blockId) ?? []) as BlockId[];\n\tconst nodeSel: NodeSelection = createNodeSelection(sel.blockId, path);\n\treturn deleteNodeSelection(state, nodeSel);\n}\n\n/** Inserts a new paragraph at a GapCursor position (before or after the void block). */\nexport function insertParagraphAtGap(\n\tstate: EditorState,\n\tsel: GapCursorSelection,\n): Transaction | null {\n\tconst { parentPath, index } = resolveSiblingContext(state, sel.blockId);\n\tif (index < 0) return null;\n\n\tconst insertIdx: number = sel.side === 'before' ? index : index + 1;\n\tconst newId = generateBlockId();\n\tconst builder = state.transaction('input');\n\tbuilder.insertNode(parentPath, insertIdx, createEmptyParagraph(newId));\n\tbuilder.setSelection(createCollapsedSelection(newId, 0));\n\treturn builder.build();\n}\n\n/** Inserts text in a new paragraph at a GapCursor position. */\nexport function insertTextAtGap(\n\tstate: EditorState,\n\tsel: GapCursorSelection,\n\ttext: string,\n\torigin: 'input' | 'paste',\n): Transaction {\n\tconst { parentPath, siblings, index } = resolveSiblingContext(state, sel.blockId);\n\tconst insertIdx: number =\n\t\tsel.side === 'before' ? Math.max(index, 0) : index >= 0 ? index + 1 : siblings.length;\n\n\tconst newId = generateBlockId();\n\tconst builder = state.transaction(origin);\n\tbuilder.insertNode(parentPath, insertIdx, createEmptyParagraph(newId));\n\tbuilder.insertText(newId, 0, text, []);\n\tbuilder.setSelection(createCollapsedSelection(newId, text.length));\n\treturn builder.build();\n}\n","/**\n * Range-deletion helpers for multi-block text selections, split out of\n * Commands.ts. Handles two cases: a selection whose blocks share one root\n * ancestor (leaf range) and a selection spanning different root ancestors\n * (cross-root range).\n */\n\nimport type { BlockNode } from '../model/Document.js';\nimport {\n\tcreateEmptyParagraph,\n\tgenerateBlockId,\n\tgetBlockChildren,\n\tgetBlockLength,\n\tisLeafBlock,\n} from '../model/Document.js';\nimport { findNodePath } from '../model/NodeResolver.js';\nimport type { BlockId } from '../model/TypeBrands.js';\nimport type { EditorState } from '../state/EditorState.js';\nimport type { TransactionBuilder } from '../state/Transaction.js';\n\n/**\n * Root container types whose children are free-flowing blocks and may be\n * removed individually when trimming a partially-selected root. Structured\n * containers (a `table`, whose rows must keep equal cell counts) are excluded:\n * trimming their children would leave a schema-invalid shape, so a\n * partially-selected one is removed wholesale instead — valid, if blunt, and\n * the behavior these containers already had before trimming existed.\n */\nconst FLAT_BLOCK_CONTAINERS: ReadonlySet<string> = new Set(['blockquote', 'list_item']);\n\n/** A normalized text-selection range (document-order from/to positions). */\nexport interface DeletionRange {\n\treadonly from: { readonly blockId: BlockId; readonly offset: number };\n\treadonly to: { readonly blockId: BlockId; readonly offset: number };\n}\n\n/** Returns the root-level ancestor index in `doc.children` for a given block. */\nexport function getRootBlockIndex(state: EditorState, blockId: BlockId): number {\n\tconst path = findNodePath(state.doc, blockId);\n\tif (!path || path.length === 0) return -1;\n\tconst rootId: string = path[0] as string;\n\treturn state.doc.children.findIndex((c) => c.id === rootId);\n}\n\n/** Deletes a multi-block selection where all blocks share the same root ancestor. */\nexport function deleteLeafRange(\n\tstate: EditorState,\n\tbuilder: TransactionBuilder,\n\tblockOrder: readonly BlockId[],\n\trange: DeletionRange,\n\tfromIdx: number,\n\ttoIdx: number,\n): void {\n\tconst firstBlock = state.getBlock(range.from.blockId);\n\tif (!firstBlock) return;\n\tconst firstLen = getBlockLength(firstBlock);\n\n\tif (range.from.offset < firstLen) {\n\t\tbuilder.deleteTextAt(range.from.blockId, range.from.offset, firstLen);\n\t}\n\n\tif (range.to.offset > 0) {\n\t\tbuilder.deleteTextAt(range.to.blockId, 0, range.to.offset);\n\t}\n\n\tfor (let i = fromIdx + 1; i < toIdx; i++) {\n\t\tconst midBlockId = blockOrder[i];\n\t\tif (!midBlockId) continue;\n\t\tconst midBlock = state.getBlock(midBlockId);\n\t\tif (!midBlock) continue;\n\t\tconst midLen = getBlockLength(midBlock);\n\t\tif (midLen > 0) {\n\t\t\tbuilder.deleteTextAt(midBlockId, 0, midLen);\n\t\t}\n\t\tbuilder.mergeBlocksAt(range.from.blockId, midBlockId);\n\t}\n\n\tbuilder.mergeBlocksAt(range.from.blockId, range.to.blockId);\n}\n\n/**\n * Deletes a selection spanning different root-level ancestors.\n *\n * The selected span is deleted while every unselected leaf survives. A\n * composite/container root (a multi-block `list_item`, a `blockquote`, a\n * `table`) whose boundary sits *inside* it is trimmed, not wiped: the from-root\n * keeps everything before `range.from`, the to-root keeps everything after\n * `range.to`. A container is removed wholesale only when the boundary lands at\n * its very edge (offset 0 of its first leaf, or the end of its last leaf), so\n * the whole container is genuinely inside the selection. Root blocks strictly\n * between the endpoints are always removed.\n *\n * Returns a replacement cursor block ID when the from-root was removed wholesale\n * (its cursor block went with it); undefined otherwise, since the from boundary\n * leaf then survives and hosts the caret.\n */\nexport function deleteCrossRootRange(\n\tstate: EditorState,\n\tbuilder: TransactionBuilder,\n\trange: DeletionRange,\n\tfromRootIdx: number,\n\ttoRootIdx: number,\n): BlockId | undefined {\n\tconst fromRoot = state.doc.children[fromRootIdx];\n\tconst toRoot = state.doc.children[toRootIdx];\n\tif (!fromRoot || !toRoot) return undefined;\n\n\tconst toLeaf = state.getBlock(range.to.blockId);\n\tif (!toLeaf) return undefined;\n\n\tconst fromIsLeaf: boolean = isLeafBlock(fromRoot);\n\tconst toIsLeaf: boolean = isLeafBlock(toRoot);\n\n\t// A composite root is removed wholesale (rather than trimmed) when it is not\n\t// a flat block container, or when the boundary sits at its very edge and so\n\t// covers the whole container: the from-root's edge is offset 0 of its first\n\t// leaf, the to-root's is the end of its last leaf.\n\tconst fromAtStart: boolean =\n\t\trange.from.offset === 0 && firstLeafId(fromRoot) === range.from.blockId;\n\tconst toAtEnd: boolean =\n\t\trange.to.offset === getBlockLength(toLeaf) && lastLeafId(toRoot) === range.to.blockId;\n\tconst fromWholesale: boolean =\n\t\t!fromIsLeaf && (!FLAT_BLOCK_CONTAINERS.has(fromRoot.type) || fromAtStart);\n\tconst toWholesale: boolean = !toIsLeaf && (!FLAT_BLOCK_CONTAINERS.has(toRoot.type) || toAtEnd);\n\n\t// --- from side: keep everything before range.from within the from-root ---\n\tif (fromIsLeaf) {\n\t\tconst fromLen: number = getBlockLength(fromRoot);\n\t\tif (range.from.offset < fromLen) {\n\t\t\tbuilder.deleteTextAt(range.from.blockId, range.from.offset, fromLen);\n\t\t}\n\t} else if (!fromWholesale) {\n\t\ttrimContainerTail(\n\t\t\tbuilder,\n\t\t\t[fromRoot.id],\n\t\t\tfromRoot,\n\t\t\tfindNodePath(state.doc, range.from.blockId) ?? [],\n\t\t\trange.from.blockId,\n\t\t\trange.from.offset,\n\t\t);\n\t}\n\n\t// --- to side: keep everything after range.to within the to-root ---\n\tif (toIsLeaf) {\n\t\tif (range.to.offset > 0) builder.deleteTextAt(range.to.blockId, 0, range.to.offset);\n\t} else if (!toWholesale) {\n\t\ttrimContainerHead(\n\t\t\tbuilder,\n\t\t\t[toRoot.id],\n\t\t\ttoRoot,\n\t\t\tfindNodePath(state.doc, range.to.blockId) ?? [],\n\t\t\trange.to.blockId,\n\t\t\trange.to.offset,\n\t\t);\n\t}\n\n\t// --- root-level removals: middle roots always, endpoints only when wholesale ---\n\t// A wholesale-removed from-root takes its cursor block with it, so a landing\n\t// paragraph is inserted to host the caret and any follow-up insert.\n\tlet landingId: BlockId | undefined;\n\tlet shift = 0;\n\tif (fromWholesale) {\n\t\tlandingId = generateBlockId();\n\t\tbuilder.insertNode([], fromRootIdx, createEmptyParagraph(landingId));\n\t\tshift = 1;\n\t}\n\n\tconst removeIdxs: number[] = [];\n\tif (fromWholesale) removeIdxs.push(fromRootIdx);\n\tfor (let i = fromRootIdx + 1; i < toRootIdx; i++) removeIdxs.push(i);\n\tif (toWholesale) removeIdxs.push(toRootIdx);\n\t// Descending so each positional removal stays valid against the evolving doc.\n\tfor (let k = removeIdxs.length - 1; k >= 0; k--) {\n\t\tbuilder.removeNode([], (removeIdxs[k] as number) + shift);\n\t}\n\n\t// Join the boundary only when both roots are leaves: their inline content\n\t// merges into one block (the \"outta\" behavior). Merging across a composite\n\t// boundary is deliberately skipped — trimming already preserved every\n\t// unselected leaf, and there is no single valid block to merge into.\n\tif (fromIsLeaf && toIsLeaf) {\n\t\tbuilder.mergeBlocksAt(range.from.blockId, range.to.blockId);\n\t}\n\n\treturn landingId;\n}\n\n/** The id of a block's first leaf descendant (itself when already a leaf). */\nfunction firstLeafId(block: BlockNode): BlockId {\n\tif (isLeafBlock(block)) return block.id;\n\tconst first: BlockNode | undefined = getBlockChildren(block)[0];\n\treturn first ? firstLeafId(first) : block.id;\n}\n\n/** The id of a block's last leaf descendant (itself when already a leaf). */\nfunction lastLeafId(block: BlockNode): BlockId {\n\tif (isLeafBlock(block)) return block.id;\n\tconst children: readonly BlockNode[] = getBlockChildren(block);\n\tconst last: BlockNode | undefined = children[children.length - 1];\n\treturn last ? lastLeafId(last) : block.id;\n}\n\n/**\n * Trims a container to keep only content up to `(leafId, leafOffset)`, removing\n * every child after the boundary at each level and the boundary leaf's tail\n * text. `containerPath` is the path to (and including) `container`; `leafPath`\n * is the boundary leaf's full node path, used to descend to the boundary child.\n */\nfunction trimContainerTail(\n\tbuilder: TransactionBuilder,\n\tcontainerPath: readonly BlockId[],\n\tcontainer: BlockNode,\n\tleafPath: readonly string[],\n\tleafId: BlockId,\n\tleafOffset: number,\n): void {\n\tconst children: readonly BlockNode[] = getBlockChildren(container);\n\tconst pos: number = leafPath.indexOf(container.id);\n\tconst targetChildId: string | undefined = pos >= 0 ? leafPath[pos + 1] : undefined;\n\tconst boundaryIdx: number = children.findIndex((c) => c.id === targetChildId);\n\tif (boundaryIdx < 0) return;\n\n\tfor (let i = children.length - 1; i > boundaryIdx; i--) {\n\t\tbuilder.removeNode(containerPath, i);\n\t}\n\n\tconst boundaryChild: BlockNode = children[boundaryIdx] as BlockNode;\n\tif (boundaryChild.id === leafId) {\n\t\tconst len: number = getBlockLength(boundaryChild);\n\t\tif (leafOffset < len) builder.deleteTextAt(leafId, leafOffset, len);\n\t\treturn;\n\t}\n\ttrimContainerTail(\n\t\tbuilder,\n\t\t[...containerPath, boundaryChild.id],\n\t\tboundaryChild,\n\t\tleafPath,\n\t\tleafId,\n\t\tleafOffset,\n\t);\n}\n\n/**\n * Trims a container to keep only content from `(leafId, leafOffset)` onward,\n * removing every child before the boundary at each level and the boundary\n * leaf's head text. Mirrors {@link trimContainerTail}.\n */\nfunction trimContainerHead(\n\tbuilder: TransactionBuilder,\n\tcontainerPath: readonly BlockId[],\n\tcontainer: BlockNode,\n\tleafPath: readonly string[],\n\tleafId: BlockId,\n\tleafOffset: number,\n): void {\n\tconst children: readonly BlockNode[] = getBlockChildren(container);\n\tconst pos: number = leafPath.indexOf(container.id);\n\tconst targetChildId: string | undefined = pos >= 0 ? leafPath[pos + 1] : undefined;\n\tconst boundaryIdx: number = children.findIndex((c) => c.id === targetChildId);\n\tif (boundaryIdx < 0) return;\n\n\t// Descending so each removal stays valid; the boundary keeps its identity.\n\tfor (let i = boundaryIdx - 1; i >= 0; i--) {\n\t\tbuilder.removeNode(containerPath, i);\n\t}\n\n\tconst boundaryChild: BlockNode = children[boundaryIdx] as BlockNode;\n\tif (boundaryChild.id === leafId) {\n\t\tif (leafOffset > 0) builder.deleteTextAt(leafId, 0, leafOffset);\n\t\treturn;\n\t}\n\ttrimContainerHead(\n\t\tbuilder,\n\t\t[...containerPath, boundaryChild.id],\n\t\tboundaryChild,\n\t\tleafPath,\n\t\tleafId,\n\t\tleafOffset,\n\t);\n}\n","/**\n * Mark-related commands: toggling bold/italic/underline and checking\n * whether a mark is active.\n */\n\nimport {\n\ttype BlockNode,\n\ttype Mark,\n\tgetBlockLength,\n\tgetInlineChildren,\n\thasMark,\n\tisTextNode,\n} from '../model/Document.js';\nimport { isMarkAllowed } from '../model/Schema.js';\nimport { isCollapsed, isTextSelection, selectionRange } from '../model/Selection.js';\nimport type { MarkTypeName } from '../model/TypeBrands.js';\nimport { markType as mkType } from '../model/TypeBrands.js';\nimport type { EditorState } from '../state/EditorState.js';\nimport type { Transaction } from '../state/Transaction.js';\nimport { resolveCursorMarks } from './CursorMarks.js';\nimport { forEachBlockInRange } from './RangeIterator.js';\n\n// --- Feature Configuration ---\n\nexport interface FeatureConfig {\n\treadonly bold: boolean;\n\treadonly italic: boolean;\n\treadonly underline: boolean;\n}\n\nconst defaultFeatures: FeatureConfig = { bold: true, italic: true, underline: true };\n\n/**\n * Toggles a mark on the current selection.\n * If collapsed, toggles stored marks. If range, applies/removes from text.\n */\nexport function toggleMark(\n\tstate: EditorState,\n\tmarkType: MarkTypeName,\n\tfeatures: FeatureConfig = defaultFeatures,\n): Transaction | null {\n\tif (isFeatureGated(markType, features)) return null;\n\tif (!isMarkAllowed(state.schema, markType)) return null;\n\tif (!isTextSelection(state.selection)) return null;\n\n\tconst mark: Mark = { type: markType };\n\tconst sel = state.selection;\n\n\tif (isCollapsed(sel)) {\n\t\t// Toggle stored marks\n\t\tconst anchorBlock = state.getBlock(sel.anchor.blockId);\n\t\tif (!anchorBlock) return null;\n\t\tconst currentMarks = resolveCursorMarks(state);\n\t\tconst hasIt = hasMark(currentMarks, markType);\n\t\tconst newMarks = hasIt\n\t\t\t? currentMarks.filter((m) => m.type !== markType)\n\t\t\t: [...currentMarks, mark];\n\n\t\treturn state\n\t\t\t.transaction('command')\n\t\t\t.setStoredMarks(newMarks, state.storedMarks)\n\t\t\t.setSelection(sel)\n\t\t\t.build();\n\t}\n\n\t// Range selection — apply/remove mark to all blocks in range\n\tconst range = selectionRange(sel, state.getBlockOrder());\n\tconst builder = state.transaction('command');\n\n\t// Determine if we should add or remove\n\tconst shouldRemove = isMarkActiveInRange(state, markType);\n\n\tforEachBlockInRange(state, range, (blockId, from, to) => {\n\t\tif (shouldRemove) {\n\t\t\tbuilder.removeMark(blockId, from, to, mark);\n\t\t} else {\n\t\t\tbuilder.addMark(blockId, from, to, mark);\n\t\t}\n\t});\n\n\tbuilder.setSelection(sel);\n\treturn builder.build();\n}\n\nexport function toggleBold(state: EditorState, features?: FeatureConfig): Transaction | null {\n\treturn toggleMark(state, mkType('bold'), features);\n}\n\nexport function toggleItalic(state: EditorState, features?: FeatureConfig): Transaction | null {\n\treturn toggleMark(state, mkType('italic'), features);\n}\n\nexport function toggleUnderline(state: EditorState, features?: FeatureConfig): Transaction | null {\n\treturn toggleMark(state, mkType('underline'), features);\n}\n\n/** Checks if a mark is active at the current selection. */\nexport function isMarkActive(state: EditorState, markType: MarkTypeName): boolean {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return false;\n\n\tif (isCollapsed(sel)) {\n\t\treturn hasMark(resolveCursorMarks(state), markType);\n\t}\n\n\treturn isMarkActiveInRange(state, markType);\n}\n\n/** Per-slice result of scanning a block for a mark. */\ntype SliceMarkStatus = 'present' | 'missing' | 'empty';\n\n/** Checks if a mark is active across the entire selection range. */\nfunction isMarkActiveInRange(state: EditorState, markType: MarkTypeName): boolean {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return false;\n\tconst blockOrder = state.getBlockOrder();\n\tconst range = selectionRange(sel, blockOrder);\n\n\tconst fromIdx = blockOrder.indexOf(range.from.blockId);\n\tconst toIdx = blockOrder.indexOf(range.to.blockId);\n\n\tlet sawMarkedText = false;\n\tfor (let i = fromIdx; i <= toIdx; i++) {\n\t\tconst blockId = blockOrder[i];\n\t\tif (!blockId) continue;\n\t\tconst block = state.getBlock(blockId);\n\t\tif (!block) continue;\n\t\tconst blockLen = getBlockLength(block);\n\t\tconst from = i === fromIdx ? range.from.offset : 0;\n\t\tconst to = i === toIdx ? range.to.offset : blockLen;\n\n\t\tconst status = markStatusInBlock(block, from, to, markType);\n\t\tif (status === 'missing') return false;\n\t\tif (status === 'present') sawMarkedText = true;\n\t}\n\n\t// Active only when the range actually contains text that carries the mark.\n\t// A range with no markable text (only empty blocks, or a void block such as a\n\t// lone display formula on Ctrl+A) is NOT active — returning true there would\n\t// light up every toolbar format button.\n\treturn sawMarkedText;\n}\n\n/**\n * Scans a block's `[from, to)` slice for `markType`. Returns:\n * - `missing` when some text character in the slice lacks the mark,\n * - `present` when the slice has text and all of it carries the mark,\n * - `empty` when the slice has no markable text (empty slice or only InlineNodes).\n *\n * An `empty` slice is neutral: it neither activates nor inverts the range check,\n * so an empty paragraph in the middle of a multi-block selection does not flip\n * the result (regression #130).\n */\nfunction markStatusInBlock(\n\tblock: BlockNode,\n\tfrom: number,\n\tto: number,\n\tmarkType: MarkTypeName,\n): SliceMarkStatus {\n\tlet pos = 0;\n\tlet sawText = false;\n\tfor (const child of getInlineChildren(block)) {\n\t\tif (isTextNode(child)) {\n\t\t\tconst childEnd = pos + child.text.length;\n\t\t\tif (childEnd > from && pos < to) {\n\t\t\t\tsawText = true;\n\t\t\t\tif (!hasMark(child.marks, markType)) return 'missing';\n\t\t\t}\n\t\t\tpos = childEnd;\n\t\t} else {\n\t\t\t// InlineNode: atomic, width 1, carries no marks.\n\t\t\tpos += 1;\n\t\t}\n\t}\n\treturn sawText ? 'present' : 'empty';\n}\n\nfunction isFeatureGated(type: MarkTypeName, features: FeatureConfig): boolean {\n\tconst key = type as string;\n\tif (key === 'bold') return !features.bold;\n\tif (key === 'italic') return !features.italic;\n\tif (key === 'underline') return !features.underline;\n\treturn false;\n}\n","/**\n * Delete commands: character, word, and soft-line deletion in both directions.\n */\n\nimport {\n\ttype BlockNode,\n\tblockOffsetToTextOffset,\n\tgetBlockLength,\n\tgetBlockText,\n\tgetContentAtOffset,\n} from '../model/Document.js';\nimport { nextGraphemeSize, prevGraphemeSize } from '../model/GraphemeUtils.js';\nimport {\n\tcreateCollapsedSelection,\n\tisCollapsed,\n\tisGapCursor,\n\tisNodeSelection,\n} from '../model/Selection.js';\nimport type { EditorState } from '../state/EditorState.js';\nimport type { Transaction } from '../state/Transaction.js';\nimport { deleteSelectionCommand, mergeBlockBackward, mergeBlockForward } from './Commands.js';\nimport { deleteNodeSelection } from './NodeSelectionCommands.js';\nimport { findWordBoundaryBackward, findWordBoundaryForward } from './WordBoundary.js';\n\ninterface DeleteConfig {\n\treadonly merge: (state: EditorState) => Transaction | null;\n\treadonly range: (block: BlockNode, offset: number) => readonly [number, number] | null;\n}\n\nfunction deleteInDirection(state: EditorState, config: DeleteConfig): Transaction | null {\n\tconst sel = state.selection;\n\n\tif (isNodeSelection(sel)) return deleteNodeSelection(state, sel);\n\tif (isGapCursor(sel)) return null;\n\tif (!isCollapsed(sel)) return deleteSelectionCommand(state);\n\n\tconst block = state.getBlock(sel.anchor.blockId);\n\tif (!block) return null;\n\n\tconst range = config.range(block, sel.anchor.offset);\n\tif (!range) return config.merge(state);\n\n\tconst [from, to] = range;\n\treturn state\n\t\t.transaction('input')\n\t\t.deleteTextAt(block.id, from, to)\n\t\t.setSelection(createCollapsedSelection(block.id, from))\n\t\t.build();\n}\n\n/** Handles backspace key. */\nexport function deleteBackward(state: EditorState): Transaction | null {\n\treturn deleteInDirection(state, {\n\t\tmerge: mergeBlockBackward,\n\t\trange: (block, offset) => {\n\t\t\tif (offset <= 0) return null;\n\t\t\tconst content = getContentAtOffset(block, offset - 1);\n\t\t\tif (content?.kind === 'inline') return [offset - 1, offset];\n\t\t\tconst text: string = getBlockText(block);\n\t\t\tconst textOffset: number = blockOffsetToTextOffset(block, offset);\n\t\t\tconst step: number = prevGraphemeSize(text, textOffset) || 1;\n\t\t\treturn [offset - step, offset];\n\t\t},\n\t});\n}\n\n/** Handles delete key. */\nexport function deleteForward(state: EditorState): Transaction | null {\n\treturn deleteInDirection(state, {\n\t\tmerge: mergeBlockForward,\n\t\trange: (block, offset) => {\n\t\t\tconst len: number = getBlockLength(block);\n\t\t\tif (offset >= len) return null;\n\t\t\tconst content = getContentAtOffset(block, offset);\n\t\t\tif (content?.kind === 'inline') return [offset, offset + 1];\n\t\t\tconst text: string = getBlockText(block);\n\t\t\tconst textOffset: number = blockOffsetToTextOffset(block, offset);\n\t\t\tconst step: number = nextGraphemeSize(text, textOffset) || 1;\n\t\t\treturn [offset, offset + step];\n\t\t},\n\t});\n}\n\n/** Handles Ctrl+Backspace: delete word backward. */\nexport function deleteWordBackward(state: EditorState): Transaction | null {\n\treturn deleteInDirection(state, {\n\t\tmerge: mergeBlockBackward,\n\t\trange: (block, offset) =>\n\t\t\toffset > 0 ? [findWordBoundaryBackward(block, offset), offset] : null,\n\t});\n}\n\n/** Handles Ctrl+Delete: delete word forward. */\nexport function deleteWordForward(state: EditorState): Transaction | null {\n\treturn deleteInDirection(state, {\n\t\tmerge: mergeBlockForward,\n\t\trange: (block, offset) => {\n\t\t\tconst len = getBlockLength(block);\n\t\t\treturn offset < len ? [offset, findWordBoundaryForward(block, offset)] : null;\n\t\t},\n\t});\n}\n\n/** Handles Cmd+Backspace: delete to start of line/block. */\nexport function deleteSoftLineBackward(state: EditorState): Transaction | null {\n\treturn deleteInDirection(state, {\n\t\tmerge: mergeBlockBackward,\n\t\trange: (_block, offset) => (offset > 0 ? [0, offset] : null),\n\t});\n}\n\n/** Handles Cmd+Delete: delete to end of line/block. */\nexport function deleteSoftLineForward(state: EditorState): Transaction | null {\n\treturn deleteInDirection(state, {\n\t\tmerge: mergeBlockForward,\n\t\trange: (block, offset) => {\n\t\t\tconst len = getBlockLength(block);\n\t\t\treturn offset < len ? [offset, len] : null;\n\t\t},\n\t});\n}\n","/**\n * Core editor commands and barrel re-exports from submodules.\n *\n * This module contains text insertion, block splitting, block merging,\n * selection deletion, and select-all. Mark, delete, gap-cursor, node-selection,\n * and word-boundary commands are re-exported from their respective modules.\n */\n\nimport {\n\ttype Mark,\n\tcreateEmptyParagraph,\n\tcreateInlineNode,\n\tgenerateBlockId,\n\tgetBlockLength,\n\tgetBlockMarksAtOffset,\n\tgetCursorMarks,\n} from '../model/Document.js';\nimport { findNodePath } from '../model/NodeResolver.js';\nimport {\n\tcreateCollapsedSelection,\n\tcreateNodeSelection,\n\tcreateSelection,\n\tisCollapsed,\n\tisGapCursor,\n\tisNodeSelection,\n\tisTextSelection,\n\tselectionRange,\n} from '../model/Selection.js';\nimport { type BlockId, inlineType } from '../model/TypeBrands.js';\nimport type { EditorState } from '../state/EditorState.js';\nimport {\n\tisInsideIsolating,\n\tisIsolatingBlock,\n\tisVoidBlock,\n\tsharesParent,\n} from '../state/NavigationQueries.js';\nimport type { Transaction } from '../state/Transaction.js';\nimport type { TransactionBuilder } from '../state/Transaction.js';\nimport { resolveInsertPoint } from './CommandHelpers.js';\nimport { isMarkInclusive } from './CursorMarks.js';\nimport { insertParagraphAtGap, insertTextAtGap } from './GapCursorCommands.js';\nimport {\n\tdeleteNodeSelection,\n\tfindFirstLeafBlockId,\n\tfindLastLeafBlockId,\n\tinsertParagraphAfterNodeSelection,\n\tinsertTextAfterNodeSelection,\n} from './NodeSelectionCommands.js';\nimport { deleteCrossRootRange, deleteLeafRange, getRootBlockIndex } from './SelectionDeletion.js';\n\n// --- Re-exports from submodules ---\n\nexport {\n\tcanCrossBlockBoundary,\n\tisInsideIsolating,\n\tisIsolatingBlock,\n\tisVoidBlock,\n\tsharesParent,\n} from '../state/NavigationQueries.js';\n\nexport type { FeatureConfig } from './MarkCommands.js';\nexport {\n\tisMarkActive,\n\ttoggleBold,\n\ttoggleItalic,\n\ttoggleMark,\n\ttoggleUnderline,\n} from './MarkCommands.js';\n\nexport {\n\tdeleteBackward,\n\tdeleteForward,\n\tdeleteSoftLineBackward,\n\tdeleteSoftLineForward,\n\tdeleteWordBackward,\n\tdeleteWordForward,\n} from './DeleteCommands.js';\n\nexport {\n\tdeleteNodeSelection,\n\tfindFirstLeafBlockId,\n\tfindLastLeafBlockId,\n\tinsertParagraphAfterNodeSelection,\n\tinsertTextAfterNodeSelection,\n\tnavigateArrowIntoVoid,\n} from './NodeSelectionCommands.js';\n\nexport {\n\tdeleteBackwardAtGap,\n\tdeleteForwardAtGap,\n\tinsertParagraphAtGap,\n\tinsertTextAtGap,\n} from './GapCursorCommands.js';\n\nexport {\n\tfindWordBoundaryBackward,\n\tfindWordBoundaryForward,\n} from './WordBoundary.js';\n\nexport {\n\tapplyAttributedMark,\n\tgetMarkAttrAtSelection,\n\tisAttributedMarkActive,\n\tremoveAttributedMark,\n} from './AttributedMarkCommands.js';\n\nexport { forEachBlockIdInRange, forEachBlockInRange } from './RangeIterator.js';\n\n// --- Text Commands ---\n\n/** Inserts text at the current selection, replacing any selected range. */\nexport function insertTextCommand(\n\tstate: EditorState,\n\ttext: string,\n\torigin: 'input' | 'paste' = 'input',\n): Transaction {\n\tconst sel = state.selection;\n\n\t// NodeSelection: insert paragraph after void block with the text\n\tif (isNodeSelection(sel)) {\n\t\treturn insertTextAfterNodeSelection(state, sel, text, origin);\n\t}\n\n\t// GapCursor: insert paragraph at the gap position with the text\n\tif (isGapCursor(sel)) {\n\t\treturn insertTextAtGap(state, sel, text, origin);\n\t}\n\n\tconst builder = state.transaction(origin);\n\tconst marks = resolveActiveMarks(state);\n\n\tlet landingId: BlockId | undefined;\n\tif (!isCollapsed(sel)) {\n\t\tlandingId = addDeleteSelectionSteps(state, builder);\n\t}\n\n\tconst resolved = resolveInsertPoint(sel, state.getBlockOrder());\n\tconst insertBlockId: BlockId = landingId ?? resolved.blockId;\n\tconst insertOffset: number = landingId ? 0 : resolved.offset;\n\n\tbuilder.insertText(insertBlockId, insertOffset, text, marks);\n\tbuilder.setSelection(createCollapsedSelection(insertBlockId, insertOffset + text.length));\n\n\treturn builder.build();\n}\n\n/** Deletes the current selection. */\nexport function deleteSelectionCommand(state: EditorState): Transaction | null {\n\tif (isNodeSelection(state.selection)) {\n\t\treturn deleteNodeSelection(state, state.selection);\n\t}\n\tif (isGapCursor(state.selection)) return null;\n\tif (isCollapsed(state.selection)) return null;\n\n\t// Deleting a selection that spans the whole document resets it to the\n\t// canonical empty state (a single empty paragraph). Without this, the range\n\t// merge keeps the first block's type and attributes, leaving e.g. an empty\n\t// centered title behind so the placeholder never returns.\n\tif (selectionCoversDocument(state)) {\n\t\treturn clearDocument(state);\n\t}\n\n\tconst builder = state.transaction('input');\n\tconst landingId: BlockId | undefined = addDeleteSelectionSteps(state, builder);\n\n\tconst range = selectionRange(state.selection, state.getBlockOrder());\n\tconst cursorBlockId: BlockId = landingId ?? range.from.blockId;\n\tconst cursorOffset: number = landingId ? 0 : range.from.offset;\n\tbuilder.setSelection(createCollapsedSelection(cursorBlockId, cursorOffset));\n\n\treturn builder.build();\n}\n\n/** Splits the current block at the cursor position (Enter key). */\nexport function splitBlockCommand(state: EditorState): Transaction | null {\n\tconst sel = state.selection;\n\n\t// NodeSelection: insert empty paragraph after the void block\n\tif (isNodeSelection(sel)) {\n\t\treturn insertParagraphAfterNodeSelection(state, sel);\n\t}\n\n\t// GapCursor: insert empty paragraph at the gap position\n\tif (isGapCursor(sel)) {\n\t\treturn insertParagraphAtGap(state, sel);\n\t}\n\n\tconst builder = state.transaction('input');\n\n\tlet landingId: BlockId | undefined;\n\tif (!isCollapsed(sel)) {\n\t\tlandingId = addDeleteSelectionSteps(state, builder);\n\t}\n\n\tconst resolved = resolveInsertPoint(sel, state.getBlockOrder());\n\tconst blockId: BlockId = landingId ?? resolved.blockId;\n\tconst offset: number = landingId ? 0 : resolved.offset;\n\tconst newBlockId = generateBlockId();\n\n\t// splitBlock operates at the same level in the tree — the StepApplication\n\t// handles this correctly because it looks up the block by ID recursively.\n\tbuilder.splitBlock(blockId, offset, newBlockId);\n\tbuilder.setSelection(createCollapsedSelection(newBlockId, 0));\n\n\treturn builder.build();\n}\n\n/** Inserts a hard line break (InlineNode) at the current cursor position. */\nexport function insertHardBreakCommand(state: EditorState): Transaction | null {\n\tconst sel = state.selection;\n\n\tif (!isTextSelection(sel)) return null;\n\n\tconst builder = state.transaction('input');\n\n\tlet cursorBlockId: BlockId | undefined;\n\tif (!isCollapsed(sel)) {\n\t\tconst landingId: BlockId | undefined = addDeleteSelectionSteps(state, builder);\n\t\tcursorBlockId = landingId;\n\t}\n\n\tif (cursorBlockId) {\n\t\t// Cross-root deletion replaced from-block; insert hard break in landing block\n\t\tbuilder.insertInlineNode(cursorBlockId, 0, createInlineNode(inlineType('hard_break')));\n\t\tbuilder.setSelection(createCollapsedSelection(cursorBlockId, 1));\n\t} else {\n\t\tconst { blockId: insertBlockId, offset: insertOffset } = resolveInsertPoint(\n\t\t\tsel,\n\t\t\tstate.getBlockOrder(),\n\t\t);\n\t\tbuilder.insertInlineNode(\n\t\t\tinsertBlockId,\n\t\t\tinsertOffset,\n\t\t\tcreateInlineNode(inlineType('hard_break')),\n\t\t);\n\t\tbuilder.setSelection(createCollapsedSelection(insertBlockId, insertOffset + 1));\n\t}\n\n\treturn builder.build();\n}\n\n/**\n * Merges the current block with the previous block, respecting\n * isolating boundaries and void blocks.\n */\nexport function mergeBlockBackward(state: EditorState): Transaction | null {\n\treturn mergeAdjacentBlock(state, 'backward');\n}\n\n/**\n * Merges the next block into the current block, respecting\n * isolating boundaries and void blocks.\n */\nexport function mergeBlockForward(state: EditorState): Transaction | null {\n\treturn mergeAdjacentBlock(state, 'forward');\n}\n\n/**\n * Shared implementation for merging adjacent blocks in either direction.\n * Validates selection, isolating boundaries, and void blocks before merging.\n */\nfunction mergeAdjacentBlock(\n\tstate: EditorState,\n\tdirection: 'backward' | 'forward',\n): Transaction | null {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return null;\n\n\tconst blockOrder = state.getBlockOrder();\n\tconst blockIdx: number = blockOrder.indexOf(sel.anchor.blockId);\n\n\tconst adjacentIdx: number = direction === 'backward' ? blockIdx - 1 : blockIdx + 1;\n\tif (adjacentIdx < 0 || adjacentIdx >= blockOrder.length) return null;\n\n\tconst adjacentId: BlockId | undefined = blockOrder[adjacentIdx];\n\tif (!adjacentId) return null;\n\n\tif (isIsolatingBlock(state, sel.anchor.blockId) || isIsolatingBlock(state, adjacentId)) {\n\t\treturn null;\n\t}\n\tif (!sharesParent(state, sel.anchor.blockId, adjacentId)) {\n\t\tif (isInsideIsolating(state, sel.anchor.blockId)) return null;\n\t}\n\n\tif (isVoidBlock(state, adjacentId)) {\n\t\tconst path = findNodePath(state.doc, adjacentId) ?? [];\n\t\treturn state\n\t\t\t.transaction('input')\n\t\t\t.setSelection(createNodeSelection(adjacentId, path as BlockId[]))\n\t\t\t.build();\n\t}\n\n\tif (direction === 'backward') {\n\t\tconst prevBlock = state.getBlock(adjacentId);\n\t\tif (!prevBlock) return null;\n\t\tconst prevLen: number = getBlockLength(prevBlock);\n\t\treturn state\n\t\t\t.transaction('input')\n\t\t\t.mergeBlocksAt(adjacentId, sel.anchor.blockId)\n\t\t\t.setSelection(createCollapsedSelection(adjacentId, prevLen))\n\t\t\t.build();\n\t}\n\n\treturn state\n\t\t.transaction('input')\n\t\t.mergeBlocksAt(sel.anchor.blockId, adjacentId)\n\t\t.setSelection(createCollapsedSelection(sel.anchor.blockId, sel.anchor.offset))\n\t\t.build();\n}\n\n/** Selects all content in the editor, using leaf block endpoints. */\nexport function selectAll(state: EditorState): Transaction {\n\tconst docRange = documentRange(state);\n\tif (!docRange) return state.transaction('command').setSelection(state.selection).build();\n\n\treturn state\n\t\t.transaction('command')\n\t\t.setSelection(createSelection(docRange.from, docRange.to))\n\t\t.build();\n}\n\n// --- Internal Helpers ---\n\ninterface DocumentPosition {\n\treadonly blockId: BlockId;\n\treadonly offset: number;\n}\n\n/**\n * Endpoints of a full-document selection: the start of the first leaf block to\n * the end of the last leaf block. Returns `null` for an empty document.\n */\nfunction documentRange(\n\tstate: EditorState,\n): { from: DocumentPosition; to: DocumentPosition } | null {\n\tconst blocks = state.doc.children;\n\tconst firstBlock = blocks[0];\n\tconst lastBlock = blocks[blocks.length - 1];\n\tif (!firstBlock || !lastBlock) return null;\n\n\tconst firstLeafId: BlockId = findFirstLeafBlockId(firstBlock);\n\tconst lastLeafId: BlockId = findLastLeafBlockId(lastBlock);\n\tconst lastLeaf = state.getBlock(lastLeafId);\n\tconst lastLeafLen: number = lastLeaf ? getBlockLength(lastLeaf) : 0;\n\n\treturn {\n\t\tfrom: { blockId: firstLeafId, offset: 0 },\n\t\tto: { blockId: lastLeafId, offset: lastLeafLen },\n\t};\n}\n\n/** True when the current text selection spans the entire document. */\nfunction selectionCoversDocument(state: EditorState): boolean {\n\tif (!isTextSelection(state.selection)) return false;\n\tconst docRange = documentRange(state);\n\tif (!docRange) return false;\n\n\tconst range = selectionRange(state.selection, state.getBlockOrder());\n\treturn (\n\t\trange.from.blockId === docRange.from.blockId &&\n\t\trange.from.offset === docRange.from.offset &&\n\t\trange.to.blockId === docRange.to.blockId &&\n\t\trange.to.offset === docRange.to.offset\n\t);\n}\n\n/**\n * Replaces the whole document with a single empty paragraph and places the\n * cursor inside it. The fresh paragraph is inserted before the originals are\n * removed so the document never passes through a zero-children state.\n */\nfunction clearDocument(state: EditorState): Transaction {\n\tconst newBlockId: BlockId = generateBlockId();\n\tconst builder = state.transaction('input');\n\tconst originalCount: number = state.doc.children.length;\n\n\tbuilder.insertNode([], 0, createEmptyParagraph(newBlockId));\n\t// The originals shifted to indices 1..originalCount; remove them descending\n\t// so each index stays valid as the document shrinks.\n\tfor (let i = originalCount; i >= 1; i--) {\n\t\tbuilder.removeNode([], i);\n\t}\n\tbuilder.setSelection(createCollapsedSelection(newBlockId, 0));\n\n\treturn builder.build();\n}\n\nfunction resolveActiveMarks(state: EditorState): readonly Mark[] {\n\tif (state.storedMarks) return state.storedMarks;\n\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return [];\n\n\tconst block = state.getBlock(sel.anchor.blockId);\n\tif (!block) return [];\n\n\t// A range replaced by typing inherits the marks at its anchor (raw content\n\t// marks); only a collapsed cursor honors right-boundary inclusivity.\n\tif (!isCollapsed(sel)) return getBlockMarksAtOffset(block, sel.anchor.offset);\n\n\treturn getCursorMarks(block, sel.anchor.offset, (type) => isMarkInclusive(state.schema, type));\n}\n\n/**\n * Adds steps to delete the current text selection.\n * Returns a replacement cursor block ID when the original from-block\n * was inside a composite root that got removed (undefined otherwise).\n */\nexport function addDeleteSelectionSteps(\n\tstate: EditorState,\n\tbuilder: TransactionBuilder,\n): BlockId | undefined {\n\tif (!isTextSelection(state.selection)) return undefined;\n\tconst blockOrder = state.getBlockOrder();\n\tconst range = selectionRange(state.selection, blockOrder);\n\tconst fromIdx = blockOrder.indexOf(range.from.blockId);\n\tconst toIdx = blockOrder.indexOf(range.to.blockId);\n\n\tif (fromIdx === toIdx) {\n\t\tbuilder.deleteTextAt(range.from.blockId, range.from.offset, range.to.offset);\n\t\treturn undefined;\n\t}\n\n\tconst fromRootIdx: number = getRootBlockIndex(state, range.from.blockId);\n\tconst toRootIdx: number = getRootBlockIndex(state, range.to.blockId);\n\n\tif (fromRootIdx === toRootIdx || fromRootIdx < 0 || toRootIdx < 0) {\n\t\tdeleteLeafRange(state, builder, blockOrder, range, fromIdx, toIdx);\n\t\treturn undefined;\n\t}\n\n\treturn deleteCrossRootRange(state, builder, range, fromRootIdx, toRootIdx);\n}\n"],"mappings":"otBAsBA,SAAgB,IACf,MAAO,CACN,UAAW,CAAC,aACZ,UAAW,CAAC,OAAQ,SAAU,aAC9B,YAAA,OAEF,CAGA,SAAgB,EAAmB,GAClC,MAAO,CACN,UAAW,EAAS,eACpB,UAAW,EAAS,eACpB,YAAc,GAAiB,EAAS,YAAY,GACpD,kBAAoB,GAAiB,EAAS,kBAAkB,GAChE,YAAc,GAAiB,EAAS,YAAY,GAEtD,CAGA,SAAgB,EAAc,EAAgB,GAC7C,OAAO,EAAO,UAAU,SAAS,EAClC,CAGA,SAAgB,EAAkB,EAAgB,GACjD,OAAO,EAAO,UAAU,SAAS,EAClC,CC1BA,SAAgB,EACf,EACA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EAEf,YADA,EAAQ,aAAa,EAAM,KAAK,QAAS,EAAM,KAAK,OAAQ,EAAM,GAAG,QAItE,MAAM,EAAsB,EAAkB,EAAO,EAAM,KAAK,SAC1D,EAAoB,EAAkB,EAAO,EAAM,GAAG,SAE5D,KAAI,IAAgB,GAAa,EAAc,GAAK,EAAY,GAKhE,OAAO,EAAqB,EAAO,EAAS,EAAO,EAAa,IHlYjE,SACC,EACA,EACA,EACA,EACA,EACA,GAEA,MAAM,EAAa,EAAM,SAAS,EAAM,KAAK,SAC7C,IAAK,EAAY,OACjB,MAAM,EAAW,EAAe,GAE5B,EAAM,KAAK,OAAS,GACvB,EAAQ,aAAa,EAAM,KAAK,QAAS,EAAM,KAAK,OAAQ,GAGzD,EAAM,GAAG,OAAS,GACrB,EAAQ,aAAa,EAAM,GAAG,QAAS,EAAG,EAAM,GAAG,QAGpD,IAAK,IAAI,EAAI,EAAU,EAAG,EAAI,EAAO,IAAK,CACzC,MAAM,EAAa,EAAW,GAC9B,IAAK,EAAY,SACjB,MAAM,EAAW,EAAM,SAAS,GAChC,IAAK,EAAU,SACf,MAAM,EAAS,EAAe,GAC1B,EAAS,GACZ,EAAQ,aAAa,EAAY,EAAG,GAErC,EAAQ,cAAc,EAAM,KAAK,QAAS,EAC3C,CAEA,EAAQ,cAAc,EAAM,KAAK,QAAS,EAAM,GAAG,QACpD,CG6VE,CAAgB,EAAO,EAAS,EAAY,EAAO,EAAS,EAK9D"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{E as t,b as n,o as e,u as o,w as r}from"./Document-827l3P80.mjs";import{a as s}from"./TypeBrands-Ch9856Gb.mjs";function c(t,n,e){const o=t.getNodeSpec(n);if(!o?.content)return!0;const r=t.getNodeSpec(e)?.group;for(const s of o.content.allow){if(s===e)return!0;if("text"!==s&&r&&s===r)return!0}return!1}function i(t,n,e){const o=t.getNodeSpec(n);if(!o?.content)return!0;const{min:r=0,max:s=Number.POSITIVE_INFINITY}=o.content,i=e.filter(t=>"text"!==t);if(i.length<r||i.length>s)return!1;for(const u of i)if(!c(t,n,u))return!1;return!0}function u(t,n){const e=[];let o=!1;for(const r of t.children){const{node:t,hoisted:s}=f(r,n);(t!==r||s.length>0)&&(o=!0),e.push(t,...s)}return o?{children:e}:t}function f(i,u){if(t(i))return{node:i,hoisted:[]};const d=[],a=[];let h=!1;const p=t=>{c(u,i.type,t.type)?d.push(t):(a.push(t),h=!0)};for(const t of i.children){if(!r(t)){d.push(t);continue}const n=f(t,u);n.node!==t&&(h=!0),p(n.node);for(const t of n.hoisted)p(t)}if(!h)return{node:i,hoisted:[]};const l=function(t,c,i){const u=(i.getNodeSpec(t.type)?.content?.allow)?.includes("text")??!1;if(0===c.length)return u?[o("")]:[e(s("paragraph"),[o("")])];const f=1===c.length?c[0]:void 0;if(u&&f&&r(f)&&"paragraph"===f.type&&!f.attrs&&!f.htmlId){const t=n(f);return t.length>0?[...t]:[o("")]}return c}(i,d,u);return{node:e(i.type,l,i.id,i.attrs,i.htmlId),hoisted:a}}export{u as n,i as r,c as t};
|
|
2
|
-
//# sourceMappingURL=ContentModel-NpAj7vGW.mjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{A as t,D as e,N as o,T as n,_ as r,a as s,b as c,g as d,h as l,j as f,k as i,m as u,o as a,r as p,t as m,u as k,v as I,w as h}from"./Document-827l3P80.mjs";import{i as b}from"./Selection-HYoVFpAx.mjs";import{a as y}from"./TypeBrands-Ch9856Gb.mjs";import{n as g,o as x,s as B}from"./NodeResolver-Dleih-8R.mjs";var v={type:"identity"};function P(t){const e=/* @__PURE__ */new Set,o=t=>{e.add(t.id);for(const e of t.children)h(e)&&o(e)};return o(t),e}function w(t,e,o=-1){switch(e.type){case"identity":case"childIndexShift":case"moveNode":return{pos:t,deleted:!1};case"shift":return function(t,e,o){if(t.blockId!==e.blockId)return{pos:t,deleted:!1};const n=e.newLen-(e.to-e.from),r=t.offset;if(r<e.from)return{pos:t,deleted:!1};if(r===e.from){if(e.from===e.to){const n=1===o?e.from+e.newLen:e.from;return n===r?{pos:t,deleted:!1}:{pos:N(t,n),deleted:!1}}return{pos:t,deleted:!1}}if(r<e.to)return{pos:N(t,1===o?e.from+e.newLen:e.from),deleted:!0};const s=r+n;return s===r?{pos:t,deleted:!1}:{pos:N(t,s),deleted:!1}}(t,e,o);case"split":return function(t,e,o){return t.blockId!==e.blockId||t.offset<e.offset?{pos:t,deleted:!1}:t.offset>e.offset?{pos:b(e.newBlockId,t.offset-e.offset),deleted:!1}:1===o?{pos:b(e.newBlockId,0),deleted:!1}:{pos:t,deleted:!1}}(t,e,o);case"merge":return function(t,e){return t.blockId!==e.sourceBlockId?{pos:t,deleted:!1}:{pos:b(e.targetBlockId,t.offset+e.targetLengthBefore),deleted:!1}}(t,e);case"blockRemoval":return function(t,e){return e.removedBlockIds.has(t.blockId)?{pos:t,deleted:!0}:{pos:t,deleted:!1}}(t,e)}}function N(t,e){return b(t.blockId,e,t.path)}var M=class t{static empty=new t([]);maps;constructor(t){this.maps=t}static from(e){const o=[];for(const t of e)"identity"!==t.type&&o.push(t);return 0===o.length?t.empty:new t(o)}appendMap(e){return"identity"===e.type?this:new t([...this.maps,e])}appendMapping(e){return 0===e.maps.length?this:0===this.maps.length?e:new t([...this.maps,...e.maps])}get isEmpty(){return 0===this.maps.length}map(t,e=-1){return this.mapResult(t,e).pos}mapResult(t,e=-1){let o=t,n=!1,r=!1;for(const s of this.maps){const t=w(o,s,e);o=t.pos,t.deleted?"blockRemoval"===s.type?r=!0:n=!0:"childIndexShift"===s.type&&s.insertedBlockIds?.has(o.blockId)&&(r=!1)}return{pos:o,deleted:n||r}}mapRange(t,e=-1,o=1){const n=this.mapResult(t.from,e),r=this.mapResult(t.to,o);return n.deleted&&r.deleted&&n.pos.blockId===r.pos.blockId&&n.pos.offset>=r.pos.offset?null:{from:n.pos,to:r.pos}}};function T(t,e,o,n,r=1,s=-1){if(n.isEmpty)return{blockId:t,from:e,to:o};const c=b(t,e),d=b(t,o),l=n.mapResult(c,r),f=n.mapResult(d,s);return l.deleted&&f.deleted||l.pos.blockId!==f.pos.blockId||l.pos.offset>f.pos.offset?null:{blockId:l.pos.blockId,from:l.pos.offset,to:f.pos.offset}}function L(t,e,o,n=-1){if(o.isEmpty)return{blockId:t,from:e,to:e};const r=b(t,e),s=o.mapResult(r,n);return s.deleted?null:{blockId:s.pos.blockId,from:s.pos.offset,to:s.pos.offset}}function A(t,e,o){return S(t,e,o,"existing")}function R(t,e,o){return S(t,e,o,"insertion")}function S(t,e,o,n){if(o.isEmpty)return e;let r=e;for(const s of o.maps){const e=E(t,r,s,n);if(null===e)return null;r=e}return r}function E(t,e,o,n){switch(o.type){case"identity":case"shift":case"split":case"merge":return e;case"blockRemoval":return H(t,o.parentPath)?e===o.index?"existing"===n?null:e:e>o.index?e-1:e:e;case"childIndexShift":return H(t,o.parentPath)&&e>=o.fromIndex?e+o.delta:e;case"moveNode":return function(t,e,o,n){const r=H(o.fromParentPath,o.toParentPath);if(r&&o.fromIndex===o.destinationIndex)return e;if("existing"===n&&r&&H(t,o.fromParentPath)&&e===o.fromIndex)return o.destinationIndex;let s=e;if(H(t,o.fromParentPath))if(s===o.fromIndex){if("existing"===n)return null}else s>o.fromIndex&&s--;return H(t,o.toParentPath)&&s>=o.destinationIndex&&s++,s}(t,e,o,n)}}function H(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(let o=0;o<t.length;o++)if(t[o]!==e[o])return!1;return!0}function z(t){switch(t.type){case"identity":return v;case"shift":return{type:"shift",blockId:t.blockId,from:t.from,to:t.from+t.newLen,newLen:t.to-t.from};case"split":return{type:"merge",targetBlockId:t.blockId,sourceBlockId:t.newBlockId,targetLengthBefore:t.offset};case"merge":return{type:"split",blockId:t.targetBlockId,offset:t.targetLengthBefore,newBlockId:t.sourceBlockId};case"blockRemoval":return{type:"childIndexShift",parentPath:t.parentPath,fromIndex:t.index,delta:1,insertedBlockIds:t.removedBlockIds};case"childIndexShift":return 1===t.delta&&t.insertedBlockIds?{type:"blockRemoval",removedBlockIds:t.insertedBlockIds,parentPath:t.parentPath,index:t.fromIndex}:v;case"moveNode":return{type:"moveNode",movedNodeId:t.movedNodeId,fromParentPath:t.toParentPath,fromIndex:t.destinationIndex,toParentPath:t.fromParentPath,destinationIndex:t.fromIndex}}}function j(t,e){if(t.type!==e.type)return!1;switch(t.type){case"identity":return!0;case"shift":{const o=e;return t.blockId===o.blockId&&t.from===o.from&&t.to===o.to&&t.newLen===o.newLen}case"split":{const o=e;return t.blockId===o.blockId&&t.offset===o.offset&&t.newBlockId===o.newBlockId}case"merge":{const o=e;return t.targetBlockId===o.targetBlockId&&t.sourceBlockId===o.sourceBlockId&&t.targetLengthBefore===o.targetLengthBefore}case"blockRemoval":{const o=e;if(t.index!==o.index)return!1;if(!H(t.parentPath,o.parentPath))return!1;if(t.removedBlockIds.size!==o.removedBlockIds.size)return!1;for(const e of t.removedBlockIds)if(!o.removedBlockIds.has(e))return!1;return!0}case"childIndexShift":{const o=e;return t.fromIndex===o.fromIndex&&t.delta===o.delta&&H(t.parentPath,o.parentPath)&&function(t,e){if(t===e)return!0;if(!t||!e||t.size!==e.size)return!1;for(const o of t)if(!e.has(o))return!1;return!0}(t.insertedBlockIds,o.insertedBlockIds)}case"moveNode":return"moveNode"===e.type&&t.movedNodeId===e.movedNodeId&&t.fromIndex===e.fromIndex&&t.destinationIndex===e.destinationIndex&&H(t.fromParentPath,e.fromParentPath)&&H(t.toParentPath,e.toParentPath)}}function D(t,e,o){return{children:O(t.children,e,o)}}function O(t,e,o){let n=!1;const r=t.map(t=>{if(!h(t))return t;if(t.id===e)return n=!0,o(t);const r=O(t.children,e,o);return r===t.children?t:(n=!0,{...t,children:r})});return n?r:t}function _(t,e,o){if(0===e.length)return t;const n=e[0];return n?{children:t.children.map(t=>h(t)&&t.id===n?1===e.length?o(t):q(t,e,1,o):t)}:t}function q(t,e,o,n){const r=e[o];if(!r)return t;const s=t.children.map(t=>h(t)&&t.id===r?o===e.length-1?n(t):q(t,e,o+1,n):t);return{...t,children:s}}function C(t,e,o){if(e(t))return o(t);let n=!1;const r=t.map(t=>{if(!h(t))return t;const r=C(t.children,e,o);return r?(n=!0,{...t,children:r}):t});return n?r:null}function W(t,e,o){const r=[];let s=0,c=!1;for(const d of t){if(n(d)){c||e!==s||(r.push(...o()),c=!0),r.push(d),s+=1;continue}const t=s+d.text.length;if(!c&&e>=s&&e<=t){const t=e-s,n=d.text.slice(0,t),l=d.text.slice(t);n&&r.push(k(n,d.marks)),r.push(...o()),l&&r.push(k(l,d.marks)),c=!0}else r.push(d);s=t}return c||r.push(...o()),r}function F(t,e,o){const r=[];let s=0;for(const c of t){if(n(c)){const t=s+1;t>e&&s<o&&r.push(c),s=t;continue}const t=s+c.text.length;if(t<=e||s>=o);else{const t=Math.max(0,e-s),n=Math.min(c.text.length,o-s),d=c.text.slice(t,n);d.length>0&&r.push(k(d,c.marks))}s=t}return 0===r.length&&r.push(k("")),r}function G(t,e,o,r,s){const c=[];let d=0;for(const l of t){if(n(l)){c.push(l),d+=1;continue}const t=d+l.text.length;if(t<=e||d>=o)c.push(l);else if(d>=e&&t<=o){const t=s?m(l.marks,r):f(l.marks,r.type);c.push(k(l.text,t))}else{const t=Math.max(0,e-d),n=Math.min(l.text.length,o-d),i=l.text.slice(0,t),u=l.text.slice(t,n),a=l.text.slice(n);if(i&&c.push(k(i,l.marks)),u){const t=s?m(l.marks,r):f(l.marks,r.type);c.push(k(u,t))}a&&c.push(k(a,l.marks))}d=t}return c}function J(t,e,o,r){const s=[];if(e>=o)return s;let c=null,d=0;const l=()=>{c&&(s.push(c),c=null)};for(const f of t){const t=d+(n(f)?1:f.text.length);if(t<=e||d>=o){d=t;continue}const s=Math.max(d,e),i=Math.min(t,o);n(f)?c&&(c.to=i):f.marks.some(t=>t.type===r)?l():c?c.to=i:c={from:s,to:i},d=t}return l(),s}function K(t,e,o,r){const s=[];if(e>=o)return s;let c=null,d=0;const l=()=>{c&&(s.push(c),c=null)};for(const f of t){const t=d+(n(f)?1:f.text.length);if(t<=e||d>=o){d=t;continue}const s=Math.max(d,e),u=Math.min(t,o);if(n(f))c&&(c.to=u);else{const t=f.marks.find(t=>t.type===r);t?c&&i(c.mark,t)?c.to=u:(l(),c={from:s,to:u,mark:t}):l()}d=t}return l(),s}function Q(t,o){if(t.every(t=>e(t)||n(t)))return o;const r=t.filter(t=>!e(t)&&!n(t));return[...o,...r]}function U(t){return t.reduce((t,e)=>t+("inline"===e.kind?1:e.text.length),0)}function V(t){return{blocks:t.split(/\r?\n/).map(t=>({type:y("paragraph"),segments:[o(t)]}))}}function X(t){return $(t.fromParentPath,t.toParentPath)&&t.toIndex>t.fromIndex?t.toIndex-1:t.toIndex}function Y(t){return $(t.fromParentPath,t.toParentPath)&&X(t)===t.fromIndex}function Z(t,e){const o=x(t,e.fromParentPath,e.fromIndex);if(!o||o.id!==e.movedNode.id)return null;if(e.toParentPath.includes(o.id))return null;const n=0===e.toParentPath.length?t.children.length:B(t,e.toParentPath)?.children.length??null;if(null===n||!Number.isInteger(e.toIndex)||e.toIndex<0||e.toIndex>n)return null;const r=$(e.fromParentPath,e.toParentPath),s=X(e);return s<0||s>n-(r?1:0)?null:{movedNode:o,destinationIndex:s}}function $(t,e){return t.length===e.length&&t.every((t,o)=>t===e[o])}function tt(t){return t.segments?U(t.segments):t.text.length}function et(e,o,n,r=!0){return D(e,o,e=>{const o=n(c(e));return{...e,children:Q(e.children,r?t(o):o)}})}function ot(t,e){if(0===e.parentPath.length){const o=[...t.children];return o.splice(e.index,0,e.node),{children:o}}return _(t,e.parentPath,t=>{const o=[...t.children];return o.splice(e.index,0,e.node),{...t,children:o}})}function nt(t,e){if(0===e.parentPath.length){const o=[...t.children];return o.splice(e.index,1),{children:o}}return _(t,e.parentPath,t=>{const o=[...t.children];return o.splice(e.index,1),{...t,children:o}})}function rt(t){return t.path?{path:t.path}:{}}function st(t){for(const e of t.steps)if("setStoredMarks"===e.type)return e.previousMarks;return t.storedMarksAfter}function ct(t,e,o){return o?t!==e?{}:{path:o}:{}}function dt(t,e,o){if(0===t.length)return!0;for(const n of t){const t=e.mapResult({blockId:n,offset:0},-1);if(t.deleted)return!1;if(t.pos.blockId!==n)return!1}return void 0!==B(o,t)}function lt(t,e){return e.blockId===t.blockId&&e.from===t.from&&e.to===t.to}var ft={insertText:{apply:function(t,e){return et(t,e.blockId,t=>{return e.segments?(o=t,n=e.offset,r=e.segments,W(o,n,()=>r.map(s))):function(t,e,o,n){return W(t,e,()=>[k(o,n)])}(t,e.offset,e.text,e.marks);var o,n,r})},invert:function(t){return{type:"deleteText",blockId:t.blockId,from:t.offset,to:t.offset+tt(t),deletedText:t.text,deletedMarks:t.marks,deletedSegments:t.segments??[o(t.text,[...t.marks])],...rt(t)}},getMap:function(t,e){return{type:"shift",blockId:e.blockId,from:e.offset,to:e.offset,newLen:tt(e)}},map:function(t,e,o){const n=L(t.blockId,t.offset,e,-1);return n?n.blockId===t.blockId&&n.from===t.offset?t:{type:"insertText",blockId:n.blockId,offset:n.from,text:t.text,marks:t.marks,...t.segments?{segments:t.segments}:{},...ct(t.blockId,n.blockId,t.path)}:null}},deleteText:{apply:function(t,e){return et(t,e.blockId,t=>function(t,e,o){const r=[];let s=0;for(const c of t){if(n(c)){const t=s+1;(t<=e||s>=o)&&r.push(c),s=t;continue}const t=s+c.text.length;if(t<=e||s>=o)r.push(c);else{const t=Math.max(0,e-s),n=Math.min(c.text.length,o-s),d=c.text.slice(0,t)+c.text.slice(n);d.length>0&&r.push(k(d,c.marks))}s=t}return r}(t,e.from,e.to))},invert:function(t){return{type:"insertText",blockId:t.blockId,offset:t.from,text:t.deletedText,marks:t.deletedMarks,segments:t.deletedSegments,...rt(t)}},getMap:function(t,e){return{type:"shift",blockId:e.blockId,from:e.from,to:e.to,newLen:0}},map:function(t,e,o){const n=T(t.blockId,t.from,t.to,e);if(!n)return null;if(lt({blockId:t.blockId,from:t.from,to:t.to},n))return t;const s=g(o,n.blockId);if(!s)return null;const c=r(s).slice(n.from,n.to),l=d(s,n.from),f=u(s,n.from,n.to);return{type:"deleteText",blockId:n.blockId,from:n.from,to:n.to,deletedText:c,deletedMarks:l,deletedSegments:f,...ct(t.blockId,n.blockId,t.path)}}},splitBlock:{apply:function(e,o){const n=C(e.children,t=>t.some(t=>h(t)&&t.id===o.blockId),e=>{const n=e.findIndex(t=>h(t)&&t.id===o.blockId);if(-1===n)return e;const r=e[n],s=c(r),d=l(r),f=F(s,0,o.offset),i=F(s,o.offset,d),u={...r,children:t(f)},p=void 0!==o.newBlockType,m=o.newBlockType??r.type,k=p?o.newBlockAttrs:r.attrs,I=a(m,t(i),o.newBlockId,k,o.newBlockHTMLId),b=[...e];return b.splice(n,1,u,I),b});return n?{children:n}:e},invert:function(t){return{type:"mergeBlocks",targetBlockId:t.blockId,sourceBlockId:t.newBlockId,targetLengthBefore:t.offset,...void 0!==t.newBlockType?{sourceType:t.newBlockType}:{},...t.newBlockAttrs?{sourceAttrs:t.newBlockAttrs}:{},...void 0!==t.newBlockHTMLId?{sourceHTMLId:t.newBlockHTMLId}:{},...rt(t)}},getMap:function(t,e){return{type:"split",blockId:e.blockId,offset:e.offset,newBlockId:e.newBlockId}},map:function(t,e,o){const n=L(t.blockId,t.offset,e,-1);return n?n.blockId===t.blockId&&n.from===t.offset?t:{type:"splitBlock",blockId:n.blockId,offset:n.from,newBlockId:t.newBlockId,...void 0!==t.newBlockType?{newBlockType:t.newBlockType}:{},...t.newBlockAttrs?{newBlockAttrs:t.newBlockAttrs}:{},...void 0!==t.newBlockHTMLId?{newBlockHTMLId:t.newBlockHTMLId}:{},...ct(t.blockId,n.blockId,t.path)}:null}},mergeBlocks:{apply:function(e,o){const n=C(e.children,t=>t.some(t=>h(t)&&t.id===o.targetBlockId)&&t.some(t=>h(t)&&t.id===o.sourceBlockId),e=>{const n=e.findIndex(t=>h(t)&&t.id===o.targetBlockId),r=e.findIndex(t=>h(t)&&t.id===o.sourceBlockId);if(-1===n||-1===r)return e;const s=e[n],d=e[r],l=c(s),f=c(d),i=t([...l,...f]),u={...s,children:i};return e.filter(t=>!h(t)||t.id!==o.sourceBlockId).map(t=>h(t)&&t.id===o.targetBlockId?u:t)});return n?{children:n}:e},invert:function(t){return{type:"splitBlock",blockId:t.targetBlockId,offset:t.targetLengthBefore,newBlockId:t.sourceBlockId,...void 0!==t.sourceType?{newBlockType:t.sourceType}:{},...t.sourceAttrs?{newBlockAttrs:t.sourceAttrs}:{},...void 0!==t.sourceHTMLId?{newBlockHTMLId:t.sourceHTMLId}:{},...rt(t)}},getMap:function(t,e){return{type:"merge",targetBlockId:e.targetBlockId,sourceBlockId:e.sourceBlockId,targetLengthBefore:e.targetLengthBefore}},map:function(t,e,o){if(e.isEmpty)return t;const n=e.mapResult({blockId:t.targetBlockId,offset:0},-1),r=e.mapResult({blockId:t.sourceBlockId,offset:0},-1);if(n.deleted||r.deleted)return null;const s=n.pos.blockId,c=r.pos.blockId;if(s===c)return null;const d=g(o,s);if(!d)return null;const f=l(d);return s===t.targetBlockId&&c===t.sourceBlockId&&f===t.targetLengthBefore?t:{type:"mergeBlocks",targetBlockId:s,sourceBlockId:c,targetLengthBefore:f,...void 0!==t.sourceType?{sourceType:t.sourceType}:{},...t.sourceAttrs?{sourceAttrs:t.sourceAttrs}:{},...void 0!==t.sourceHTMLId?{sourceHTMLId:t.sourceHTMLId}:{},...ct(t.targetBlockId,s,t.path)}}},addMark:{apply:function(t,e){return et(t,e.blockId,t=>G(t,e.from,e.to,e.mark,!0))},invert:function(t){return{type:"removeMark",blockId:t.blockId,from:t.from,to:t.to,mark:t.mark,...rt(t)}},getMap:function(t,e){return v},map:function(t,e,o){const n=T(t.blockId,t.from,t.to,e);return n?lt({blockId:t.blockId,from:t.from,to:t.to},n)?t:{type:"addMark",blockId:n.blockId,from:n.from,to:n.to,mark:t.mark,...ct(t.blockId,n.blockId,t.path)}:null}},removeMark:{apply:function(t,e){return et(t,e.blockId,t=>G(t,e.from,e.to,e.mark,!1))},invert:function(t){return{type:"addMark",blockId:t.blockId,from:t.from,to:t.to,mark:t.mark,...rt(t)}},getMap:function(t,e){return v},map:function(t,e,o){const n=T(t.blockId,t.from,t.to,e);return n?lt({blockId:t.blockId,from:t.from,to:t.to},n)?t:{type:"removeMark",blockId:n.blockId,from:n.from,to:n.to,mark:t.mark,...ct(t.blockId,n.blockId,t.path)}:null}},setStoredMarks:{apply:function(t){return t},invert:function(t){return{type:"setStoredMarks",marks:t.previousMarks,previousMarks:t.marks}},getMap:function(t,e){return v},map:function(t,e,o){return t}},setBlockType:{apply:function(t,e){return D(t,e.blockId,t=>{const{attrs:o,...n}=t;return{...n,type:e.nodeType,...e.attrs?{attrs:e.attrs}:{}}})},invert:function(t){return{type:"setBlockType",blockId:t.blockId,nodeType:t.previousNodeType,attrs:t.previousAttrs,previousNodeType:t.nodeType,previousAttrs:t.attrs,...rt(t)}},getMap:function(t,e){return v},map:function(t,e,o){if(e.isEmpty)return t;const n=e.mapResult({blockId:t.blockId,offset:0},-1);if(n.deleted)return null;const r=n.pos.blockId,s=g(o,r);return s?r===t.blockId&&s.type===t.previousNodeType&&p(s.attrs,t.previousAttrs)?t:{type:"setBlockType",blockId:r,nodeType:t.nodeType,...t.attrs?{attrs:t.attrs}:{},previousNodeType:s.type,...s.attrs?{previousAttrs:s.attrs}:{},...ct(t.blockId,r,t.path)}:null}},insertNode:{apply:ot,invert:function(t){return{type:"removeNode",parentPath:t.parentPath,index:t.index,removedNode:t.node}},getMap:function(t,e){return{type:"childIndexShift",parentPath:e.parentPath,fromIndex:e.index,delta:1,insertedBlockIds:P(e.node)}},map:function(t,e,o){if(!dt(t.parentPath,e,o))return null;const n=R(t.parentPath,t.index,e);return n===t.index?t:{type:"insertNode",parentPath:t.parentPath,index:n,node:t.node}}},removeNode:{apply:nt,invert:function(t){return{type:"insertNode",parentPath:t.parentPath,index:t.index,node:t.removedNode}},getMap:function(t,e){return{type:"blockRemoval",removedBlockIds:P(e.removedNode),parentPath:e.parentPath,index:e.index}},map:function(t,e,o){if(!dt(t.parentPath,e,o))return null;const n=e.mapResult({blockId:t.removedNode.id,offset:0},-1);if(n.deleted)return null;if(n.pos.blockId!==t.removedNode.id)return null;const r=A(t.parentPath,t.index,e);if(null===r)return null;const s=x(o,t.parentPath,r);return s?s.id!==t.removedNode.id?null:r===t.index&&s===t.removedNode?t:{type:"removeNode",parentPath:t.parentPath,index:r,removedNode:s}:null}},moveNode:{apply:function(t,e){const o=Z(t,e);return!o||Y(e)?t:ot(nt(t,{type:"removeNode",parentPath:e.fromParentPath,index:e.fromIndex,removedNode:o.movedNode}),{type:"insertNode",parentPath:e.toParentPath,index:o.destinationIndex,node:o.movedNode})},invert:function(t){const e=X(t),o=t.fromParentPath.length===t.toParentPath.length&&t.fromParentPath.every((e,o)=>e===t.toParentPath[o])&&t.fromIndex>e?t.fromIndex+1:t.fromIndex;return{type:"moveNode",fromParentPath:t.toParentPath,fromIndex:e,toParentPath:t.fromParentPath,toIndex:o,movedNode:t.movedNode}},getMap:function(t,e){const o=Z(t,e);return!o||Y(e)?v:{type:"moveNode",movedNodeId:e.movedNode.id,fromParentPath:e.fromParentPath,fromIndex:e.fromIndex,toParentPath:e.toParentPath,destinationIndex:o.destinationIndex}},map:function(t,e,o){if(!dt(t.fromParentPath,e,o))return null;if(!dt(t.toParentPath,e,o))return null;const n=e.mapResult({blockId:t.movedNode.id,offset:0},-1);if(n.deleted||n.pos.blockId!==t.movedNode.id)return null;const r=A(t.fromParentPath,t.fromIndex,e);if(null===r)return null;const s=R(t.toParentPath,t.toIndex,e),c=x(o,t.fromParentPath,r);if(!c||c.id!==t.movedNode.id)return null;const d={type:"moveNode",fromParentPath:t.fromParentPath,fromIndex:r,toParentPath:t.toParentPath,toIndex:s,movedNode:c};return Z(o,d)?r===t.fromIndex&&s===t.toIndex&&c===t.movedNode?t:d:null}},setNodeAttr:{apply:function(t,e){const o=e.path[e.path.length-1];return o?D(t,o,t=>({...t,attrs:e.attrs})):t},invert:function(t){return{type:"setNodeAttr",path:t.path,attrs:t.previousAttrs,previousAttrs:t.attrs}},getMap:function(t,e){return v},map:function(t,e,o){if(e.isEmpty)return t;if(!dt(t.path,e,o))return null;const n=B(o,t.path);return n?{type:"setNodeAttr",path:t.path,attrs:t.attrs,...n.attrs?{previousAttrs:n.attrs}:{}}:null}},insertInlineNode:{apply:function(t,e){return et(t,e.blockId,t=>function(t,e,o){const r=[];let s=0,c=!1;for(const d of t){if(n(d)){c||e!==s||(r.push(o),c=!0),r.push(d),s+=1;continue}const t=s+d.text.length;if(!c&&e>=s&&e<=t){const t=e-s,n=d.text.slice(0,t),l=d.text.slice(t);n&&r.push(k(n,d.marks)),r.push(o),l&&r.push(k(l,d.marks)),c=!0}else r.push(d);s=t}return c||r.push(o),r}(t,e.offset,e.node))},invert:function(t){return{type:"removeInlineNode",blockId:t.blockId,offset:t.offset,removedNode:t.node,...rt(t)}},getMap:function(t,e){return{type:"shift",blockId:e.blockId,from:e.offset,to:e.offset,newLen:1}},map:function(t,e,o){const n=L(t.blockId,t.offset,e,-1);return n?n.blockId===t.blockId&&n.from===t.offset?t:{type:"insertInlineNode",blockId:n.blockId,offset:n.from,node:t.node,...ct(t.blockId,n.blockId,t.path)}:null}},removeInlineNode:{apply:function(t,e){return et(t,e.blockId,t=>function(t,e){const o=[];let r=0;for(const s of t)n(s)?(r!==e&&o.push(s),r+=1):(o.push(s),r+=s.text.length);return o}(t,e.offset))},invert:function(t){return{type:"insertInlineNode",blockId:t.blockId,offset:t.offset,node:t.removedNode,...rt(t)}},getMap:function(t,e){return{type:"shift",blockId:e.blockId,from:e.offset,to:e.offset+1,newLen:0}},map:function(t,e,o){const r=T(t.blockId,t.offset,t.offset+1,e,1,1);if(!r)return null;if(r.to-r.from!==1)return null;const s=g(o,r.blockId);if(!s)return null;const c=I(s,r.from);return c&&"inline"===c.kind&&n(c.node)?(d=t.removedNode)===(l=c.node)||d.inlineType===l.inlineType&&p(d.attrs,l.attrs)?r.blockId===t.blockId&&r.from===t.offset?t:{type:"removeInlineNode",blockId:r.blockId,offset:r.from,removedNode:c.node,...ct(t.blockId,r.blockId,t.path)}:null:null;var d,l}},setInlineNodeAttr:{apply:function(t,e){return et(t,e.blockId,t=>function(t,e,o){const r=[];let s=0;for(const c of t)n(c)?(s===e?r.push({...c,attrs:o}):r.push(c),s+=1):(r.push(c),s+=c.text.length);return r}(t,e.offset,e.attrs),!1)},invert:function(t){return{type:"setInlineNodeAttr",blockId:t.blockId,offset:t.offset,attrs:t.previousAttrs,previousAttrs:t.attrs,...rt(t)}},getMap:function(t,e){return v},map:function(t,e,o){const r=T(t.blockId,t.offset,t.offset+1,e,1,1);if(!r)return null;if(r.to-r.from!==1)return null;if(r.blockId===t.blockId&&r.from===t.offset)return t;const s=g(o,r.blockId);if(!s)return null;const c=I(s,r.from);return c&&"inline"===c.kind&&n(c.node)?{type:"setInlineNodeAttr",blockId:r.blockId,offset:r.from,attrs:t.attrs,previousAttrs:c.node.attrs,...ct(t.blockId,r.blockId,t.path)}:null}}};function it(t){return ft[t.type]}function ut(t,e){return it(e).apply(t,e)}function at(t){return it(t).invert(t)}function pt(t,e){return it(e).getMap(t,e)}function mt(t,e,o){return e.isEmpty?t:it(t).map(t,e,o)}function kt(t){const e=t.steps.map(at).reverse();return{steps:e,selectionBefore:t.selectionAfter,selectionAfter:t.selectionBefore,storedMarksAfter:st(t),mapping:M.empty,forwardStepMaps:e.map(()=>v),metadata:{origin:"history",timestamp:Date.now()}}}function It(t,e){switch(t.type){case"inline":return function(t,e){switch(e.type){case"identity":case"childIndexShift":case"moveNode":return t;case"shift":return function(t,e){if(t.blockId!==e.blockId)return t;const o=w(b(t.blockId,t.from),e,-1).pos,n=w(b(t.blockId,t.to),e,1).pos;return o.offset>=n.offset?null:o.offset===t.from&&n.offset===t.to?t:{...t,from:o.offset,to:n.offset}}(t,e);case"split":return function(t,e){return t.blockId!==e.blockId||t.to<=e.offset?t:t.from>=e.offset?{...t,blockId:e.newBlockId,from:t.from-e.offset,to:t.to-e.offset}:[{...t,to:e.offset},{...t,blockId:e.newBlockId,from:0,to:t.to-e.offset}]}(t,e);case"merge":return function(t,e){return t.blockId!==e.sourceBlockId?t:{...t,blockId:e.targetBlockId,from:t.from+e.targetLengthBefore,to:t.to+e.targetLengthBefore}}(t,e);case"blockRemoval":return e.removedBlockIds.has(t.blockId)?null:t}}(t,e);case"widget":return function(t,e){switch(e.type){case"identity":case"childIndexShift":case"moveNode":return t;case"shift":return function(t,e){if(t.blockId!==e.blockId)return t;const o=w(b(t.blockId,t.offset),e,t.side);return o.deleted?null:o.pos.offset===t.offset?t:{...t,offset:o.pos.offset}}(t,e);case"split":return function(t,e){if(t.blockId!==e.blockId)return t;const o=w(b(t.blockId,t.offset),e,t.side);return o.pos.blockId===t.blockId&&o.pos.offset===t.offset?t:{...t,blockId:o.pos.blockId,offset:o.pos.offset}}(t,e);case"merge":return function(t,e){return t.blockId!==e.sourceBlockId?t:{...t,blockId:e.targetBlockId,offset:t.offset+e.targetLengthBefore}}(t,e);case"blockRemoval":return e.removedBlockIds.has(t.blockId)?null:t}}(t,e);case"node":return function(t,e){switch(e.type){case"identity":case"shift":case"split":case"childIndexShift":case"moveNode":return t;case"merge":return t.blockId===e.sourceBlockId?null:t;case"blockRemoval":return e.removedBlockIds.has(t.blockId)?null:t}}(t,e)}}function ht(t,e,o,n){return{type:"inline",blockId:t,from:e,to:o,attrs:n}}function bt(t,e){return{type:"node",blockId:t,attrs:e}}function yt(t,e,o,n){return{type:"widget",blockId:t,offset:e,toDOM:o,side:n?.side??-1,key:n?.key}}var gt=class t{byBlock;static empty=new t(/* @__PURE__ */new Map);constructor(t){this.byBlock=t}static create(e){if(0===e.length)return t.empty;const o=/* @__PURE__ */new Map;for(const t of e){const e=o.get(t.blockId);e?e.push(t):o.set(t.blockId,[t])}return new t(o)}find(t){return this.byBlock.get(t)??[]}findInline(t){const e=this.byBlock.get(t);return e?e.filter(t=>"inline"===t.type):[]}findNode(t){const e=this.byBlock.get(t);return e?e.filter(t=>"node"===t.type):[]}findWidget(t){const e=this.byBlock.get(t);return e?e.filter(t=>"widget"===t.type):[]}add(e){if(0===e.length)return this;if(this.isEmpty)return t.create(e);const o=/* @__PURE__ */new Map;for(const[t,n]of this.byBlock)o.set(t,[...n]);for(const t of e){const e=o.get(t.blockId);e?e.push(t):o.set(t.blockId,[t])}return new t(o)}remove(e){const o=/* @__PURE__ */new Map;let n=!1;for(const[t,r]of this.byBlock){const s=r.filter(t=>!e(t));s.length!==r.length&&(n=!0),s.length>0&&o.set(t,s)}return n?0===o.size?t.empty:new t(o):this}merge(e){if(e.isEmpty)return this;if(this.isEmpty)return e;const o=/* @__PURE__ */new Map;for(const[t,n]of this.byBlock)o.set(t,[...n]);for(const[t,n]of e.byBlock){const e=o.get(t);e?e.push(...n):o.set(t,[...n])}return new t(o)}equals(t){if(this===t)return!0;if(this.byBlock.size!==t.byBlock.size)return!1;for(const[e,o]of this.byBlock){const n=t.byBlock.get(e);if(!n)return!1;if(!xt(o,n))return!1}return!0}get isEmpty(){return 0===this.byBlock.size}map(e){if(this.isEmpty||e.mapping.isEmpty)return this;let o=[];for(const t of this.byBlock.values())for(const e of t)o.push(e);for(const t of e.mapping.maps){const e=[];for(const n of o){const o=It(n,t);if(null!==o)if(Array.isArray(o))for(const t of o)e.push(t);else e.push(o)}o=e}return 0===o.length?t.empty:t.create(o)}};function xt(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(let o=0;o<t.length;o++){const n=t[o],r=e[o];if(!n||!r||!Bt(n,r))return!1}return!0}function Bt(t,e){if(t.type!==e.type)return!1;if(t.blockId!==e.blockId)return!1;switch(t.type){case"inline":{const o=e;return t.from===o.from&&t.to===o.to&&vt(t.attrs,o.attrs)}case"node":{const o=e;return vt(t.attrs,o.attrs)}case"widget":{const o=e;return t.offset===o.offset&&t.side===o.side&&t.key===o.key&&t.toDOM===o.toDOM}}}function vt(t,e){if(t===e)return!0;const o=Object.keys(t),n=Object.keys(e);if(o.length!==n.length)return!1;for(const r of o)if(t[r]!==e[r])return!1;return!0}export{w as C,R as S,v as _,yt as a,z as b,at as c,st as d,Y as f,K as g,J as h,bt as i,kt as l,U as m,xt as n,ut as o,V as p,ht as r,pt as s,gt as t,mt as u,M as v,j as w,A as x,P as y};
|
|
2
|
-
//# sourceMappingURL=Decoration-BpoEOANl.mjs.map
|