@notectl/core 2.3.7 → 2.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/chunks/AlignmentPlugin-Cp7HYGaH.mjs +2 -0
- package/dist/chunks/AlignmentPlugin-Cp7HYGaH.mjs.map +1 -0
- package/dist/chunks/{AttrRegistry-CtNhf2EF.mjs → AttrRegistry-Di936wMv.mjs} +2 -2
- package/dist/chunks/AttrRegistry-Di936wMv.mjs.map +1 -0
- package/dist/chunks/{AttributedMarkCommands-B3MQdob_.mjs → AttributedMarkCommands-DKHuhZA7.mjs} +2 -2
- package/dist/chunks/AttributedMarkCommands-DKHuhZA7.mjs.map +1 -0
- package/dist/chunks/BidiIsolationPlugin-GWukKdgJ.mjs +2 -0
- package/dist/chunks/BidiIsolationPlugin-GWukKdgJ.mjs.map +1 -0
- package/dist/chunks/BlockAlignment-BqyBQ4uV.mjs +2 -0
- package/dist/chunks/BlockAlignment-BqyBQ4uV.mjs.map +1 -0
- package/dist/chunks/BlockInsertion-CXfXqUZl.mjs +2 -0
- package/dist/chunks/BlockInsertion-CXfXqUZl.mjs.map +1 -0
- package/dist/chunks/BlockTypePickerRegistry-BTET9jM-.mjs.map +1 -1
- package/dist/chunks/BlockquotePlugin-CSL_7Yit.mjs +2 -0
- package/dist/chunks/BlockquotePlugin-CSL_7Yit.mjs.map +1 -0
- package/dist/chunks/CSSValueEquivalence-DeyUKPQ7.mjs +2 -0
- package/dist/chunks/CSSValueEquivalence-DeyUKPQ7.mjs.map +1 -0
- package/dist/chunks/{CaretNavigationPlugin-DEZU09LJ.mjs → CaretNavigationPlugin-BQPqqK4n.mjs} +2 -2
- package/dist/chunks/CaretNavigationPlugin-BQPqqK4n.mjs.map +1 -0
- package/dist/chunks/CodeBlockPlugin-B4AcDJRK.mjs +2 -0
- package/dist/chunks/CodeBlockPlugin-B4AcDJRK.mjs.map +1 -0
- package/dist/chunks/ColorGrid-DAs0--ty.mjs.map +1 -1
- package/dist/chunks/ColorPickerPopup-B6340f3p.mjs +2 -0
- package/dist/chunks/ColorPickerPopup-B6340f3p.mjs.map +1 -0
- package/dist/chunks/{ColorValidation-B9d_umnf.mjs → ColorValidation-ZBKZ_gTr.mjs} +2 -2
- package/dist/chunks/ColorValidation-ZBKZ_gTr.mjs.map +1 -0
- package/dist/chunks/Commands-Bk7Cl1nH.mjs +2 -0
- package/dist/chunks/Commands-Bk7Cl1nH.mjs.map +1 -0
- package/dist/chunks/ContentModel-dkGOh3N7.mjs +2 -0
- package/dist/chunks/ContentModel-dkGOh3N7.mjs.map +1 -0
- package/dist/chunks/{CursorMarks-dx51OGBf.mjs → CursorMarks-CqHLzGNI.mjs} +2 -2
- package/dist/chunks/CursorMarks-CqHLzGNI.mjs.map +1 -0
- package/dist/chunks/{Decoration-BwhoA4MU.mjs → Decoration-BoFcdSXk.mjs} +2 -2
- package/dist/chunks/Decoration-BoFcdSXk.mjs.map +1 -0
- package/dist/chunks/{DirectionDetection-ZrkMhyaL.mjs → DirectionDetection-a-1iksmh.mjs} +2 -2
- package/dist/chunks/DirectionDetection-a-1iksmh.mjs.map +1 -0
- package/dist/chunks/DirectionIcons-Bbawl9ei.mjs.map +1 -1
- package/dist/chunks/{Document-D_2cIBJG.mjs → Document-ssR6hBzG.mjs} +2 -2
- package/dist/chunks/Document-ssR6hBzG.mjs.map +1 -0
- package/dist/chunks/DocumentParser-C99N0MWF.mjs +2 -0
- package/dist/chunks/DocumentParser-C99N0MWF.mjs.map +1 -0
- package/dist/chunks/DomUtils-Bf7JLFlx.mjs.map +1 -1
- package/dist/chunks/EditorEventBoundary-zpYRxryo.mjs.map +1 -1
- package/dist/chunks/FontPlugin-BcXNFqqO.mjs +2 -0
- package/dist/chunks/FontPlugin-BcXNFqqO.mjs.map +1 -0
- package/dist/chunks/FontSizePlugin-Dswra3oU.mjs +2 -0
- package/dist/chunks/FontSizePlugin-Dswra3oU.mjs.map +1 -0
- package/dist/chunks/FormulaPlugin-DVpLaKi5.mjs +2 -0
- package/dist/chunks/FormulaPlugin-DVpLaKi5.mjs.map +1 -0
- package/dist/chunks/GapCursorPlugin-QDGwnaRR.mjs +2 -0
- package/dist/chunks/GapCursorPlugin-QDGwnaRR.mjs.map +1 -0
- package/dist/chunks/HTMLSanitization-Ce9dVT1q.mjs.map +1 -1
- package/dist/chunks/HTMLUtils-DTpsjZyK.mjs +2 -0
- package/dist/chunks/HTMLUtils-DTpsjZyK.mjs.map +1 -0
- package/dist/chunks/{HardBreakPlugin-CC4rntSX.mjs → HardBreakPlugin-gjCq8prD.mjs} +2 -2
- package/dist/chunks/HardBreakPlugin-gjCq8prD.mjs.map +1 -0
- package/dist/chunks/HeadingPlugin-B7EfynaH.mjs +2 -0
- package/dist/chunks/HeadingPlugin-B7EfynaH.mjs.map +1 -0
- package/dist/chunks/HighlightPlugin-LdO0INtJ.mjs +2 -0
- package/dist/chunks/HighlightPlugin-LdO0INtJ.mjs.map +1 -0
- package/dist/chunks/HorizontalRulePlugin-YywXVZYr.mjs +2 -0
- package/dist/chunks/HorizontalRulePlugin-YywXVZYr.mjs.map +1 -0
- package/dist/chunks/ImagePlugin-BAhZuVdE.mjs +2 -0
- package/dist/chunks/ImagePlugin-BAhZuVdE.mjs.map +1 -0
- package/dist/chunks/InlineCodePlugin-Bu9-rE4B.mjs +2 -0
- package/dist/chunks/InlineCodePlugin-Bu9-rE4B.mjs.map +1 -0
- package/dist/chunks/InlineStyleMarkSpec-BhfGgfH9.mjs +2 -0
- package/dist/chunks/InlineStyleMarkSpec-BhfGgfH9.mjs.map +1 -0
- package/dist/chunks/KeyboardNav-D0my3wuy.mjs.map +1 -1
- package/dist/chunks/LinkPlugin-CAUaWW5-.mjs +2 -0
- package/dist/chunks/LinkPlugin-CAUaWW5-.mjs.map +1 -0
- package/dist/chunks/{ListPlugin--dqEctgn.mjs → ListPlugin-U1r4p_fE.mjs} +2 -2
- package/dist/chunks/ListPlugin-U1r4p_fE.mjs.map +1 -0
- package/dist/chunks/MarkCommands-C0ps9h0z.mjs +2 -0
- package/dist/chunks/MarkCommands-C0ps9h0z.mjs.map +1 -0
- package/dist/chunks/MarkInputRule-DNneF2gp.mjs.map +1 -1
- package/dist/chunks/MarkdownHTMLRegistry-BunUDiza.mjs +2 -0
- package/dist/chunks/MarkdownHTMLRegistry-BunUDiza.mjs.map +1 -0
- package/dist/chunks/{MarkdownParser-D1d9zB0R.mjs → MarkdownParser-uX1p_GQk.mjs} +2 -2
- package/dist/chunks/MarkdownParser-uX1p_GQk.mjs.map +1 -0
- package/dist/chunks/MarkdownSerializer--MrgJTdJ.mjs +2 -0
- package/dist/chunks/MarkdownSerializer--MrgJTdJ.mjs.map +1 -0
- package/dist/chunks/MathFont-BS8IwYh2.mjs.map +1 -1
- package/dist/chunks/NavigationQueries-CaKfccu7.mjs +2 -0
- package/dist/chunks/NavigationQueries-CaKfccu7.mjs.map +1 -0
- package/dist/chunks/NodeResolver-F4RtpoEd.mjs +2 -0
- package/dist/chunks/NodeResolver-F4RtpoEd.mjs.map +1 -0
- package/dist/chunks/{NodeSelectionCommands-DK3iEh18.mjs → NodeSelectionCommands-CAqIHW_6.mjs} +2 -2
- package/dist/chunks/NodeSelectionCommands-CAqIHW_6.mjs.map +1 -0
- package/dist/chunks/NodeSpecPatching-BrjPAbqe.mjs.map +1 -1
- package/dist/chunks/Platform-ByobkiCc.mjs.map +1 -1
- package/dist/chunks/PluginHelpers-B3gk3VB3.mjs +2 -0
- package/dist/chunks/PluginHelpers-B3gk3VB3.mjs.map +1 -0
- package/dist/chunks/PopupKeyboardPatterns-BcwdDxRq.mjs.map +1 -1
- package/dist/chunks/PopupManager-Dxv0OVMo.mjs +2 -0
- package/dist/chunks/PopupManager-Dxv0OVMo.mjs.map +1 -0
- package/dist/chunks/PopupPositioning-CIqgpqlW.mjs.map +1 -1
- package/dist/chunks/{PrintPlugin-BQ7LWbEB.mjs → PrintPlugin-DAEiEyKQ.mjs} +2 -2
- package/dist/chunks/PrintPlugin-DAEiEyKQ.mjs.map +1 -0
- package/dist/chunks/{RangeIterator-DDOxTQIf.mjs → RangeIterator-sJ_c9MNr.mjs} +2 -2
- package/dist/chunks/RangeIterator-sJ_c9MNr.mjs.map +1 -0
- package/dist/chunks/Schema-BSM4YLNT.mjs +2 -0
- package/dist/chunks/Schema-BSM4YLNT.mjs.map +1 -0
- package/dist/chunks/SchemaRegistry-Cs7rxafF.mjs +2 -0
- package/dist/chunks/SchemaRegistry-Cs7rxafF.mjs.map +1 -0
- package/dist/chunks/Selection-DC6AOGgF.mjs.map +1 -1
- package/dist/chunks/SelectionReplacement-vC1xhFS0.mjs +2 -0
- package/dist/chunks/SelectionReplacement-vC1xhFS0.mjs.map +1 -0
- package/dist/chunks/SelectionSync-BkjCwGp-.mjs +2 -0
- package/dist/chunks/SelectionSync-BkjCwGp-.mjs.map +1 -0
- package/dist/chunks/{SelectionTransactions-DNCzsl_b.mjs → SelectionTransactions-mQ1NfMEg.mjs} +2 -2
- package/dist/chunks/SelectionTransactions-mQ1NfMEg.mjs.map +1 -0
- package/dist/chunks/ShortcutFormatting-TwiufqeV.mjs.map +1 -1
- package/dist/chunks/SimpleMark-D6vz3Nfd.mjs +2 -0
- package/dist/chunks/SimpleMark-D6vz3Nfd.mjs.map +1 -0
- package/dist/chunks/SmartPastePlugin-BHsYKbgd.mjs +2 -0
- package/dist/chunks/SmartPastePlugin-BHsYKbgd.mjs.map +1 -0
- package/dist/chunks/StarterFonts-BDQPg-cu.mjs.map +1 -1
- package/dist/chunks/{StrikethroughPlugin-d-EW2YYx.mjs → StrikethroughPlugin-v-VJZzUZ.mjs} +2 -2
- package/dist/chunks/StrikethroughPlugin-v-VJZzUZ.mjs.map +1 -0
- package/dist/chunks/StyleClassNames-BsAx7k5T.mjs +2 -0
- package/dist/chunks/StyleClassNames-BsAx7k5T.mjs.map +1 -0
- package/dist/chunks/StyleRuntime-C0RSqKzG.mjs.map +1 -1
- package/dist/chunks/{SuperSubPlugin-C-kvFQyx.mjs → SuperSubPlugin-x1iPnZyt.mjs} +2 -2
- package/dist/chunks/SuperSubPlugin-x1iPnZyt.mjs.map +1 -0
- package/dist/chunks/SyntaxTokenTypes-BUCOMtL8.mjs.map +1 -1
- package/dist/chunks/TableDimensions-BSEOEox2.mjs +2 -0
- package/dist/chunks/TableDimensions-BSEOEox2.mjs.map +1 -0
- package/dist/chunks/TablePlugin-CjKThPug.mjs +2 -0
- package/dist/chunks/TablePlugin-CjKThPug.mjs.map +1 -0
- package/dist/chunks/TextColorPlugin-Bnl9of9E.mjs +2 -0
- package/dist/chunks/TextColorPlugin-Bnl9of9E.mjs.map +1 -0
- package/dist/chunks/{TextDirectionAutoPlugin-LVDkKdDX.mjs → TextDirectionAutoPlugin-DOH5cfyy.mjs} +2 -2
- package/dist/chunks/TextDirectionAutoPlugin-DOH5cfyy.mjs.map +1 -0
- package/dist/chunks/{TextDirectionPlugin-CtGwof7i.mjs → TextDirectionPlugin-JwlR-R-b.mjs} +2 -2
- package/dist/chunks/TextDirectionPlugin-JwlR-R-b.mjs.map +1 -0
- package/dist/chunks/TextDirectionService-BcX07mw2.mjs +2 -0
- package/dist/chunks/TextDirectionService-BcX07mw2.mjs.map +1 -0
- package/dist/chunks/{TextFormattingPlugin-DlS0SeW7.mjs → TextFormattingPlugin-Kc_UNoOz.mjs} +2 -2
- package/dist/chunks/TextFormattingPlugin-Kc_UNoOz.mjs.map +1 -0
- package/dist/chunks/ThemeEngine-kIXtSRkI.mjs.map +1 -1
- package/dist/chunks/ToolbarPlugin-CgZA2hz8.mjs +2 -0
- package/dist/chunks/ToolbarPlugin-CgZA2hz8.mjs.map +1 -0
- package/dist/chunks/TypeBrands-Ch9856Gb.mjs.map +1 -1
- package/dist/chunks/TypedKeys-CA4bfw9O.mjs.map +1 -1
- package/dist/chunks/VideoPlugin-DJXfuNA9.mjs +2 -0
- package/dist/chunks/VideoPlugin-DJXfuNA9.mjs.map +1 -0
- package/dist/chunks/XmlPatterns-RN32-0ob.mjs.map +1 -1
- package/dist/chunks/XmlSupport-3Za6SIqF.mjs.map +1 -1
- package/dist/chunks/ar--Isa9OHJ.mjs.map +1 -1
- package/dist/chunks/ar--O0A9OTR.mjs.map +1 -1
- package/dist/chunks/ar-0g2bmXTn.mjs.map +1 -1
- package/dist/chunks/ar-4b8e2YSc.mjs.map +1 -1
- package/dist/chunks/ar-B03uY4xr.mjs.map +1 -1
- package/dist/chunks/ar-BAfInw85.mjs.map +1 -1
- package/dist/chunks/ar-BRX5E_Pw.mjs.map +1 -1
- package/dist/chunks/ar-BWOue6jG.mjs.map +1 -1
- package/dist/chunks/ar-Bdmunk5h.mjs.map +1 -1
- package/dist/chunks/ar-BwaoCUVN.mjs.map +1 -1
- package/dist/chunks/ar-BzqAYGER.mjs.map +1 -1
- package/dist/chunks/ar-C9lO1jsY.mjs.map +1 -1
- package/dist/chunks/ar-CMXjVzFx.mjs.map +1 -1
- package/dist/chunks/ar-CR6UdFL9.mjs.map +1 -1
- package/dist/chunks/ar-CrOb0jL2.mjs.map +1 -1
- package/dist/chunks/ar-Cy_77yRf.mjs.map +1 -1
- package/dist/chunks/ar-D1jFXqLJ.mjs.map +1 -1
- package/dist/chunks/ar-DahJwMI9.mjs.map +1 -1
- package/dist/chunks/ar-Dcl3kgtd.mjs.map +1 -1
- package/dist/chunks/ar-Dg9PdDet.mjs.map +1 -1
- package/dist/chunks/ar-DhwCFHql.mjs +2 -0
- package/dist/chunks/ar-DhwCFHql.mjs.map +1 -0
- package/dist/chunks/ar-Dx2lO0Nm.mjs.map +1 -1
- package/dist/chunks/ar-NV_puwI2.mjs.map +1 -1
- package/dist/chunks/ar-Uzo1Azdw.mjs.map +1 -1
- package/dist/chunks/ar-XmSFrtmd.mjs.map +1 -1
- package/dist/chunks/ar-eOA3UmiE.mjs.map +1 -1
- package/dist/chunks/ar-sGZ-oZqB.mjs.map +1 -1
- package/dist/chunks/color-picker-D6HrTsDM.mjs +2 -0
- package/dist/chunks/color-picker-D6HrTsDM.mjs.map +1 -0
- package/dist/chunks/de-B8-w9gPi.mjs.map +1 -1
- package/dist/chunks/de-B9zSHWqY.mjs.map +1 -1
- package/dist/chunks/de-BX4y4PlH.mjs.map +1 -1
- package/dist/chunks/de-BXQBXxFJ.mjs.map +1 -1
- package/dist/chunks/de-BcPntcnr.mjs.map +1 -1
- package/dist/chunks/de-BdD3DpUB.mjs.map +1 -1
- package/dist/chunks/de-Bwxlcuee.mjs.map +1 -1
- package/dist/chunks/de-BxQIt_1Y.mjs.map +1 -1
- package/dist/chunks/de-C-Yf378-.mjs.map +1 -1
- package/dist/chunks/de-C7uehgMu.mjs.map +1 -1
- package/dist/chunks/de-C9ZhDqPi.mjs.map +1 -1
- package/dist/chunks/de-CHcv_Vmf.mjs.map +1 -1
- package/dist/chunks/de-CTzAMkXC.mjs.map +1 -1
- package/dist/chunks/de-CaeEIyzV.mjs.map +1 -1
- package/dist/chunks/de-CjLUbQmg.mjs +2 -0
- package/dist/chunks/de-CjLUbQmg.mjs.map +1 -0
- package/dist/chunks/de-DHs9i4af.mjs.map +1 -1
- package/dist/chunks/de-DJ5EkXQo.mjs.map +1 -1
- package/dist/chunks/de-DRbhnS4T.mjs.map +1 -1
- package/dist/chunks/de-DViI26lG.mjs.map +1 -1
- package/dist/chunks/de-DY3obIAF.mjs.map +1 -1
- package/dist/chunks/de-DcMhfRBu.mjs.map +1 -1
- package/dist/chunks/de-DiPz7abS.mjs.map +1 -1
- package/dist/chunks/de-Dl4QFHMa.mjs.map +1 -1
- package/dist/chunks/de-XCCpWyg0.mjs.map +1 -1
- package/dist/chunks/de-e6J6nvAD.mjs.map +1 -1
- package/dist/chunks/de-i95F9SDy.mjs.map +1 -1
- package/dist/chunks/de-uKR7koQe.mjs.map +1 -1
- package/dist/chunks/es-B0Za939C.mjs.map +1 -1
- package/dist/chunks/es-B8K3Yvf3.mjs.map +1 -1
- package/dist/chunks/es-BIXm2Coj.mjs.map +1 -1
- package/dist/chunks/es-BJHF95J_.mjs.map +1 -1
- package/dist/chunks/es-BMm9kqjC.mjs.map +1 -1
- package/dist/chunks/es-BQ9dox_E.mjs.map +1 -1
- package/dist/chunks/es-BQweZX6P.mjs.map +1 -1
- package/dist/chunks/es-BdpTTRuX.mjs.map +1 -1
- package/dist/chunks/es-C7uVqFYr.mjs.map +1 -1
- package/dist/chunks/es-CCQFu1t1.mjs.map +1 -1
- package/dist/chunks/es-CEAJj7aB.mjs.map +1 -1
- package/dist/chunks/es-CMSzvjOT.mjs +2 -0
- package/dist/chunks/es-CMSzvjOT.mjs.map +1 -0
- package/dist/chunks/es-CUKJujcb.mjs.map +1 -1
- package/dist/chunks/es-CXuMz87y.mjs.map +1 -1
- package/dist/chunks/es-CgMfhkJJ.mjs.map +1 -1
- package/dist/chunks/es-CtOtKQCP.mjs.map +1 -1
- package/dist/chunks/es-DD01rZ6N.mjs.map +1 -1
- package/dist/chunks/es-DDoqchUq.mjs.map +1 -1
- package/dist/chunks/es-DFokqQst.mjs.map +1 -1
- package/dist/chunks/es-DHxdoEzR.mjs.map +1 -1
- package/dist/chunks/es-DehVGwQ8.mjs.map +1 -1
- package/dist/chunks/es-DrJyl38L.mjs.map +1 -1
- package/dist/chunks/es-fTW0TkYV.mjs.map +1 -1
- package/dist/chunks/es-kfKiqpyD.mjs.map +1 -1
- package/dist/chunks/es-nRLq7bgP.mjs.map +1 -1
- package/dist/chunks/es-paXY7HFt.mjs.map +1 -1
- package/dist/chunks/es-xuahrvJN.mjs.map +1 -1
- package/dist/chunks/fr-0qEo3bRP.mjs.map +1 -1
- package/dist/chunks/fr-5HkMazAf.mjs.map +1 -1
- package/dist/chunks/fr-B9pBLaVx.mjs.map +1 -1
- package/dist/chunks/fr-BRXUnq3R.mjs.map +1 -1
- package/dist/chunks/fr-BSUKEtTk.mjs.map +1 -1
- package/dist/chunks/fr-BeRlON1t.mjs.map +1 -1
- package/dist/chunks/fr-Bg937iAy.mjs.map +1 -1
- package/dist/chunks/fr-BwWrFThE.mjs.map +1 -1
- package/dist/chunks/fr-C3EKRThN.mjs.map +1 -1
- package/dist/chunks/fr-CKjH6tJI.mjs.map +1 -1
- package/dist/chunks/fr-CQs0-pNX.mjs.map +1 -1
- package/dist/chunks/fr-CfhyYN-t.mjs.map +1 -1
- package/dist/chunks/fr-D0MDdoir.mjs.map +1 -1
- package/dist/chunks/fr-D5ulA3Z6.mjs.map +1 -1
- package/dist/chunks/fr-DB_OvHWH.mjs +2 -0
- package/dist/chunks/fr-DB_OvHWH.mjs.map +1 -0
- package/dist/chunks/fr-DEZ_oxzS.mjs.map +1 -1
- package/dist/chunks/fr-DciSEykY.mjs.map +1 -1
- package/dist/chunks/fr-DhWQzZy3.mjs.map +1 -1
- package/dist/chunks/fr-DiDhVhyV.mjs.map +1 -1
- package/dist/chunks/fr-DjMZ-3K5.mjs.map +1 -1
- package/dist/chunks/fr-F2ZrfVaF.mjs.map +1 -1
- package/dist/chunks/fr-KXmbys88.mjs.map +1 -1
- package/dist/chunks/fr-NVOinLyF.mjs.map +1 -1
- package/dist/chunks/fr-SbpHNrQ-.mjs.map +1 -1
- package/dist/chunks/fr-ZsRdLuys.mjs.map +1 -1
- package/dist/chunks/fr-eC0UdAPu.mjs.map +1 -1
- package/dist/chunks/fr-fshsDD66.mjs.map +1 -1
- package/dist/chunks/full-BsWAZr1w.mjs +2 -0
- package/dist/chunks/full-BsWAZr1w.mjs.map +1 -0
- package/dist/chunks/hi-4CiAKVjT.mjs.map +1 -1
- package/dist/chunks/hi-B-ZuX4aN.mjs.map +1 -1
- package/dist/chunks/hi-B2YB3Bo4.mjs.map +1 -1
- package/dist/chunks/hi-B2uhiPCN.mjs.map +1 -1
- package/dist/chunks/hi-B5cl8TWK.mjs.map +1 -1
- package/dist/chunks/hi-BNJIGWQQ.mjs.map +1 -1
- package/dist/chunks/hi-BOMkDPqC.mjs.map +1 -1
- package/dist/chunks/hi-Bl-yeeOI.mjs.map +1 -1
- package/dist/chunks/hi-BsZzSMfL.mjs.map +1 -1
- package/dist/chunks/hi-By8YwVIX.mjs.map +1 -1
- package/dist/chunks/hi-BzbMD_cP.mjs.map +1 -1
- package/dist/chunks/hi-C2jEsf8v.mjs.map +1 -1
- package/dist/chunks/hi-CTWubxLY.mjs.map +1 -1
- package/dist/chunks/hi-ChNQZZ1z.mjs +2 -0
- package/dist/chunks/hi-ChNQZZ1z.mjs.map +1 -0
- package/dist/chunks/hi-CoclKAUM.mjs.map +1 -1
- package/dist/chunks/hi-CrmakMVj.mjs.map +1 -1
- package/dist/chunks/hi-DWX6k5ZD.mjs.map +1 -1
- package/dist/chunks/hi-DY55FuDK.mjs.map +1 -1
- package/dist/chunks/hi-DrC2H81d.mjs.map +1 -1
- package/dist/chunks/hi-DsdXcOB6.mjs.map +1 -1
- package/dist/chunks/hi-Dt89SxNy.mjs.map +1 -1
- package/dist/chunks/hi-J8ErB5nB.mjs.map +1 -1
- package/dist/chunks/hi-L6pJxZam.mjs.map +1 -1
- package/dist/chunks/hi-SECtQQzq.mjs.map +1 -1
- package/dist/chunks/hi-j3TDLMYd.mjs.map +1 -1
- package/dist/chunks/hi-l6DA-aOw.mjs.map +1 -1
- package/dist/chunks/hi-uACJUw53.mjs.map +1 -1
- package/dist/chunks/minimal-DO7LiFTa.mjs +2 -0
- package/dist/chunks/minimal-DO7LiFTa.mjs.map +1 -0
- package/dist/chunks/pt-5VeuNDd2.mjs.map +1 -1
- package/dist/chunks/pt-BCXgUDiU.mjs.map +1 -1
- package/dist/chunks/pt-BDam9cDu.mjs.map +1 -1
- package/dist/chunks/pt-Bb908r0n.mjs.map +1 -1
- package/dist/chunks/pt-BkpVtod-.mjs.map +1 -1
- package/dist/chunks/pt-BlFAJZo7.mjs.map +1 -1
- package/dist/chunks/pt-Bu7Mbz67.mjs.map +1 -1
- package/dist/chunks/pt-BuZ7acHF.mjs.map +1 -1
- package/dist/chunks/pt-C8sOyw0V.mjs.map +1 -1
- package/dist/chunks/pt-CEUgbrii.mjs.map +1 -1
- package/dist/chunks/pt-CFrcl1v_.mjs.map +1 -1
- package/dist/chunks/pt-CI8t6oul.mjs +2 -0
- package/dist/chunks/pt-CI8t6oul.mjs.map +1 -0
- package/dist/chunks/pt-CMrFpUWS.mjs.map +1 -1
- package/dist/chunks/pt-CMx2wPPY.mjs.map +1 -1
- package/dist/chunks/pt-CR4j8gtE.mjs.map +1 -1
- package/dist/chunks/pt-Cc4zysaT.mjs.map +1 -1
- package/dist/chunks/pt-Cv6q7x5x.mjs.map +1 -1
- package/dist/chunks/pt-DFKJVh7k.mjs.map +1 -1
- package/dist/chunks/pt-DYMyMgKQ.mjs.map +1 -1
- package/dist/chunks/pt-D__tcM2T.mjs.map +1 -1
- package/dist/chunks/pt-Dg2ctkug.mjs.map +1 -1
- package/dist/chunks/pt-DgfMoLWR.mjs.map +1 -1
- package/dist/chunks/pt-OXa_IR4Q.mjs.map +1 -1
- package/dist/chunks/pt-UPF7DBlz.mjs.map +1 -1
- package/dist/chunks/pt-_qxIe7zX.mjs.map +1 -1
- package/dist/chunks/pt-paXY7HFt.mjs.map +1 -1
- package/dist/chunks/pt-zMHcNGPk.mjs.map +1 -1
- package/dist/chunks/register-DXLu8Njp.mjs +3 -0
- package/dist/chunks/register-DXLu8Njp.mjs.map +1 -0
- package/dist/chunks/ru-9WtNGZtl.mjs +2 -0
- package/dist/chunks/ru-9WtNGZtl.mjs.map +1 -0
- package/dist/chunks/ru-B1m8J9dl.mjs.map +1 -1
- package/dist/chunks/ru-BNPUT-3S.mjs.map +1 -1
- package/dist/chunks/ru-BotG0MFT.mjs.map +1 -1
- package/dist/chunks/ru-C-APN_dm.mjs.map +1 -1
- package/dist/chunks/ru-C9yFslEG.mjs.map +1 -1
- package/dist/chunks/ru-CkG_bpfo.mjs.map +1 -1
- package/dist/chunks/ru-Cs8KCNyq.mjs.map +1 -1
- package/dist/chunks/ru-CsP6mLxp.mjs.map +1 -1
- package/dist/chunks/ru-CvDl-yEd.mjs.map +1 -1
- package/dist/chunks/ru-CwyPz2Va.mjs.map +1 -1
- package/dist/chunks/ru-D53d-_UB.mjs.map +1 -1
- package/dist/chunks/ru-DJMpeuey.mjs.map +1 -1
- package/dist/chunks/ru-DSRv3_Rg.mjs.map +1 -1
- package/dist/chunks/ru-DV-lgEtM.mjs.map +1 -1
- package/dist/chunks/ru-DiwQV30V.mjs.map +1 -1
- package/dist/chunks/ru-DkW9XZFy.mjs.map +1 -1
- package/dist/chunks/ru-DyCTlhjg.mjs.map +1 -1
- package/dist/chunks/ru-QGX8lOTs.mjs.map +1 -1
- package/dist/chunks/ru-QcTo2yoL.mjs.map +1 -1
- package/dist/chunks/ru-Y11wuxOB.mjs.map +1 -1
- package/dist/chunks/ru-Yngw7nFP.mjs.map +1 -1
- package/dist/chunks/ru-d68SZpEe.mjs.map +1 -1
- package/dist/chunks/ru-gxbzqLL8.mjs.map +1 -1
- package/dist/chunks/ru-k7o3Qks3.mjs.map +1 -1
- package/dist/chunks/ru-l73diFXn.mjs.map +1 -1
- package/dist/chunks/ru-q8kz-237.mjs.map +1 -1
- package/dist/chunks/src-5GKFQ2mQ.mjs.map +1 -1
- package/dist/chunks/xml-BsV44TrJ.mjs.map +1 -1
- package/dist/chunks/zh-BFZOM3lF.mjs.map +1 -1
- package/dist/chunks/zh-BGYJXxVl.mjs.map +1 -1
- package/dist/chunks/zh-BP97XjlS.mjs.map +1 -1
- package/dist/chunks/zh-BQ73oqxc.mjs.map +1 -1
- package/dist/chunks/zh-BQqf3wJZ.mjs.map +1 -1
- package/dist/chunks/zh-Baxh6v0j.mjs.map +1 -1
- package/dist/chunks/zh-BrqJ4ywP.mjs +2 -0
- package/dist/chunks/zh-BrqJ4ywP.mjs.map +1 -0
- package/dist/chunks/zh-BvuAbM2S.mjs.map +1 -1
- package/dist/chunks/zh-C-wHnDo5.mjs.map +1 -1
- package/dist/chunks/zh-C7iCgCRP.mjs.map +1 -1
- package/dist/chunks/zh-CRsDvfPR.mjs.map +1 -1
- package/dist/chunks/zh-CWGAPVei.mjs.map +1 -1
- package/dist/chunks/zh-CWIzJcXi.mjs.map +1 -1
- package/dist/chunks/zh-CYV-db-K.mjs.map +1 -1
- package/dist/chunks/zh-CiIyOm6U.mjs.map +1 -1
- package/dist/chunks/zh-CnW44JEw.mjs.map +1 -1
- package/dist/chunks/zh-D1HSmSOf.mjs.map +1 -1
- package/dist/chunks/zh-DWN1Jqn3.mjs.map +1 -1
- package/dist/chunks/zh-DYD476c5.mjs.map +1 -1
- package/dist/chunks/zh-DdzgYD7k.mjs.map +1 -1
- package/dist/chunks/zh-DgSmvLyw.mjs.map +1 -1
- package/dist/chunks/zh-DlVfQn4z.mjs.map +1 -1
- package/dist/chunks/zh-Oj-qSUEp.mjs.map +1 -1
- package/dist/chunks/zh-YfuE_m2y.mjs.map +1 -1
- package/dist/chunks/zh-dGSDBBzb.mjs.map +1 -1
- package/dist/chunks/zh-ikm3rSTR.mjs.map +1 -1
- package/dist/chunks/zh-oZl1P_p0.mjs.map +1 -1
- package/dist/commands/BlockInsertion.d.ts +15 -19
- package/dist/commands/BlockInsertion.d.ts.map +1 -1
- package/dist/commands/Commands.d.ts.map +1 -1
- package/dist/commands/CompositionCommands.d.ts +47 -0
- package/dist/commands/CompositionCommands.d.ts.map +1 -0
- package/dist/commands/CompositionRebase.d.ts +24 -0
- package/dist/commands/CompositionRebase.d.ts.map +1 -0
- package/dist/commands/PasteCommand.d.ts.map +1 -1
- package/dist/commands/SelectionDeletion.d.ts +20 -8
- package/dist/commands/SelectionDeletion.d.ts.map +1 -1
- package/dist/commands/SelectionReplacement.d.ts +42 -0
- package/dist/commands/SelectionReplacement.d.ts.map +1 -0
- package/dist/editor/BlockIdentity.d.ts +16 -0
- package/dist/editor/BlockIdentity.d.ts.map +1 -0
- package/dist/editor/ContentSerializer.d.ts +13 -11
- package/dist/editor/ContentSerializer.d.ts.map +1 -1
- package/dist/editor/NotectlEditor.d.ts +6 -5
- package/dist/editor/NotectlEditor.d.ts.map +1 -1
- package/dist/editor/styles/link.d.ts +3 -0
- package/dist/editor/styles/link.d.ts.map +1 -0
- package/dist/fonts.mjs +1 -1
- package/dist/full.mjs +1 -1
- package/dist/html.mjs +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/input/CompositionController.d.ts +78 -0
- package/dist/input/CompositionController.d.ts.map +1 -0
- package/dist/input/HTMLParser.d.ts +15 -2
- package/dist/input/HTMLParser.d.ts.map +1 -1
- package/dist/input/InputHandler.d.ts +34 -1
- package/dist/input/InputHandler.d.ts.map +1 -1
- package/dist/input/InputManager.d.ts +3 -0
- package/dist/input/InputManager.d.ts.map +1 -1
- package/dist/input/PasteHTMLHandler.d.ts.map +1 -1
- package/dist/input/PasteHandler.d.ts.map +1 -1
- package/dist/input/PasteRichBlockHandler.d.ts +10 -17
- package/dist/input/PasteRichBlockHandler.d.ts.map +1 -1
- package/dist/markdown.mjs +1 -1
- package/dist/model/BlockAlignment.d.ts +6 -0
- package/dist/model/BlockAlignment.d.ts.map +1 -1
- package/dist/model/BlockOffsetText.d.ts +11 -0
- package/dist/model/BlockOffsetText.d.ts.map +1 -0
- package/dist/model/CompositionState.d.ts +14 -0
- package/dist/model/CompositionState.d.ts.map +1 -1
- package/dist/model/ContentModel.d.ts +6 -1
- package/dist/model/ContentModel.d.ts.map +1 -1
- package/dist/model/FileHandlerDispatcher.d.ts +3 -1
- package/dist/model/FileHandlerDispatcher.d.ts.map +1 -1
- package/dist/model/FileHandlerRegistry.d.ts +11 -2
- package/dist/model/FileHandlerRegistry.d.ts.map +1 -1
- package/dist/model/HTMLUtils.d.ts +16 -3
- package/dist/model/HTMLUtils.d.ts.map +1 -1
- package/dist/model/MarkSpec.d.ts +5 -3
- package/dist/model/MarkSpec.d.ts.map +1 -1
- package/dist/model/NodeResolver.d.ts +2 -0
- package/dist/model/NodeResolver.d.ts.map +1 -1
- package/dist/model/NodeSpec.d.ts +2 -1
- package/dist/model/NodeSpec.d.ts.map +1 -1
- package/dist/model/Schema.d.ts +2 -0
- package/dist/model/Schema.d.ts.map +1 -1
- package/dist/model/SchemaRegistry.d.ts +26 -1
- package/dist/model/SchemaRegistry.d.ts.map +1 -1
- package/dist/model/StyleClass.d.ts +45 -0
- package/dist/model/StyleClass.d.ts.map +1 -0
- package/dist/model/StyleClassRegistry.d.ts +28 -0
- package/dist/model/StyleClassRegistry.d.ts.map +1 -0
- package/dist/model/TextChange.d.ts +40 -0
- package/dist/model/TextChange.d.ts.map +1 -0
- package/dist/notectl-core.mjs +1 -1
- package/dist/notectl-core.umd.js +1 -1
- package/dist/notectl-core.umd.js.map +1 -1
- package/dist/plugins/Plugin.d.ts +11 -0
- package/dist/plugins/Plugin.d.ts.map +1 -1
- package/dist/plugins/PluginContextFactory.d.ts +2 -0
- package/dist/plugins/PluginContextFactory.d.ts.map +1 -1
- package/dist/plugins/RegistrationTracker.d.ts.map +1 -1
- package/dist/plugins/alignment/AlignmentPlugin.d.ts +17 -0
- package/dist/plugins/alignment/AlignmentPlugin.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/CodeBlockSchema.d.ts.map +1 -1
- package/dist/plugins/code-block.mjs +1 -1
- package/dist/plugins/font/FontPlugin.d.ts +13 -0
- package/dist/plugins/font/FontPlugin.d.ts.map +1 -1
- package/dist/plugins/font-size/FontSizeOperations.d.ts +2 -0
- package/dist/plugins/font-size/FontSizeOperations.d.ts.map +1 -1
- package/dist/plugins/font-size/FontSizePlugin.d.ts +11 -0
- package/dist/plugins/font-size/FontSizePlugin.d.ts.map +1 -1
- package/dist/plugins/font-size.mjs +1 -1
- package/dist/plugins/font.mjs +1 -1
- package/dist/plugins/formula/FormulaCommands.d.ts +6 -4
- package/dist/plugins/formula/FormulaCommands.d.ts.map +1 -1
- package/dist/plugins/formula/FormulaPlugin.d.ts.map +1 -1
- package/dist/plugins/formula/latex/LatexParser.d.ts.map +1 -1
- package/dist/plugins/formula/latex/LatexSymbols.d.ts.map +1 -1
- package/dist/plugins/formula/latex/LookupOwn.d.ts +6 -0
- package/dist/plugins/formula/latex/LookupOwn.d.ts.map +1 -0
- package/dist/plugins/formula/latex/handlers/Accents.d.ts.map +1 -1
- package/dist/plugins/formula/latex/handlers/Delimiters.d.ts.map +1 -1
- package/dist/plugins/formula/latex/handlers/Environments.d.ts.map +1 -1
- package/dist/plugins/formula/latex/handlers/Fonts.d.ts.map +1 -1
- package/dist/plugins/formula/latex/handlers/Spacing.d.ts.map +1 -1
- package/dist/plugins/formula.mjs +1 -1
- package/dist/plugins/gap-cursor/GapCursorPlugin.d.ts.map +1 -1
- package/dist/plugins/gap-cursor.mjs +1 -1
- package/dist/plugins/hard-break.mjs +1 -1
- package/dist/plugins/heading.mjs +1 -1
- package/dist/plugins/highlight/HighlightPlugin.d.ts +11 -0
- package/dist/plugins/highlight/HighlightPlugin.d.ts.map +1 -1
- package/dist/plugins/highlight.mjs +1 -1
- package/dist/plugins/horizontal-rule.mjs +1 -1
- package/dist/plugins/image/ImageCommands.d.ts +15 -3
- package/dist/plugins/image/ImageCommands.d.ts.map +1 -1
- package/dist/plugins/image/ImagePlugin.d.ts.map +1 -1
- package/dist/plugins/image.mjs +1 -1
- package/dist/plugins/inline-code/InlineCodePlugin.d.ts.map +1 -1
- package/dist/plugins/inline-code.mjs +1 -1
- package/dist/plugins/link/LinkInteractionController.d.ts +26 -0
- package/dist/plugins/link/LinkInteractionController.d.ts.map +1 -0
- package/dist/plugins/link/LinkLocale.d.ts +7 -1
- package/dist/plugins/link/LinkLocale.d.ts.map +1 -1
- package/dist/plugins/link/LinkNavigation.d.ts +12 -0
- package/dist/plugins/link/LinkNavigation.d.ts.map +1 -0
- package/dist/plugins/link/LinkPlugin.d.ts +4 -4
- package/dist/plugins/link/LinkPlugin.d.ts.map +1 -1
- package/dist/plugins/link/LinkPreview.d.ts +28 -0
- package/dist/plugins/link/LinkPreview.d.ts.map +1 -0
- package/dist/plugins/link/locales/ar.d.ts.map +1 -1
- package/dist/plugins/link/locales/de.d.ts.map +1 -1
- package/dist/plugins/link/locales/es.d.ts.map +1 -1
- package/dist/plugins/link/locales/fr.d.ts.map +1 -1
- package/dist/plugins/link/locales/hi.d.ts.map +1 -1
- package/dist/plugins/link/locales/pt.d.ts.map +1 -1
- package/dist/plugins/link/locales/ru.d.ts.map +1 -1
- package/dist/plugins/link/locales/zh.d.ts.map +1 -1
- package/dist/plugins/link.mjs +1 -1
- package/dist/plugins/list.mjs +1 -1
- package/dist/plugins/print.mjs +1 -1
- package/dist/plugins/shared/ColorValidation.d.ts +12 -4
- package/dist/plugins/shared/ColorValidation.d.ts.map +1 -1
- package/dist/plugins/shared/InlineStyleMarkSpec.d.ts +10 -0
- package/dist/plugins/shared/InlineStyleMarkSpec.d.ts.map +1 -1
- package/dist/plugins/shared/PopupManager.d.ts +5 -0
- package/dist/plugins/shared/PopupManager.d.ts.map +1 -1
- package/dist/plugins/shared/StyleClassNames.d.ts +10 -0
- package/dist/plugins/shared/StyleClassNames.d.ts.map +1 -0
- package/dist/plugins/shared.mjs +1 -1
- package/dist/plugins/smart-paste/SmartPastePlugin.d.ts +0 -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/TextColorPlugin.d.ts +11 -0
- package/dist/plugins/text-color/TextColorPlugin.d.ts.map +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.mjs +1 -1
- package/dist/presets/full.mjs +1 -1
- package/dist/presets/minimal.mjs +1 -1
- package/dist/presets.mjs +1 -1
- package/dist/register.mjs +1 -1
- package/dist/serialization/AlignmentHTML.d.ts +43 -0
- package/dist/serialization/AlignmentHTML.d.ts.map +1 -0
- package/dist/serialization/CSSClassCollector.d.ts +20 -17
- package/dist/serialization/CSSClassCollector.d.ts.map +1 -1
- package/dist/serialization/CSSValueEquivalence.d.ts +24 -0
- package/dist/serialization/CSSValueEquivalence.d.ts.map +1 -0
- package/dist/serialization/DocumentParser.d.ts +2 -1
- package/dist/serialization/DocumentParser.d.ts.map +1 -1
- package/dist/serialization/DocumentSerializer.d.ts +0 -4
- package/dist/serialization/DocumentSerializer.d.ts.map +1 -1
- package/dist/serialization/FirstTagAttributes.d.ts +16 -0
- package/dist/serialization/FirstTagAttributes.d.ts.map +1 -0
- package/dist/serialization/HTMLParseRules.d.ts +32 -0
- package/dist/serialization/HTMLParseRules.d.ts.map +1 -0
- package/dist/serialization/HTMLParseSession.d.ts +21 -0
- package/dist/serialization/HTMLParseSession.d.ts.map +1 -0
- package/dist/serialization/MarkSerializer.d.ts.map +1 -1
- package/dist/serialization/StyleClassHTML.d.ts +37 -0
- package/dist/serialization/StyleClassHTML.d.ts.map +1 -0
- package/dist/serialization/StyleRehydration.d.ts +16 -0
- package/dist/serialization/StyleRehydration.d.ts.map +1 -0
- package/dist/serialization/TableDimensions.d.ts.map +1 -1
- package/dist/serialization/index.d.ts +2 -1
- package/dist/serialization/index.d.ts.map +1 -1
- package/dist/serialization/markdown/InlineSerializers.d.ts.map +1 -1
- package/dist/state/EditorState.d.ts.map +1 -1
- package/dist/state/History.d.ts +2 -1
- package/dist/state/History.d.ts.map +1 -1
- package/dist/state/NavigationQueries.d.ts.map +1 -1
- package/dist/state/SelectionValidation.d.ts +12 -0
- package/dist/state/SelectionValidation.d.ts.map +1 -0
- package/dist/state/StepApplication.d.ts.map +1 -1
- package/dist/state/StepMapping.d.ts.map +1 -1
- package/dist/state/Steps.d.ts +3 -0
- package/dist/state/Steps.d.ts.map +1 -1
- package/dist/state/StructuralPositions.d.ts +15 -0
- package/dist/state/StructuralPositions.d.ts.map +1 -0
- package/dist/state/TransactionBuilder.d.ts +13 -15
- package/dist/state/TransactionBuilder.d.ts.map +1 -1
- package/dist/test/TestUtils.d.ts.map +1 -1
- package/dist/view/CursorWrapper.d.ts.map +1 -1
- package/dist/view/EditorView.d.ts +25 -1
- package/dist/view/EditorView.d.ts.map +1 -1
- package/dist/view/EditorViewEvents.d.ts.map +1 -1
- package/dist/view/InlineContentDOM.d.ts +44 -0
- package/dist/view/InlineContentDOM.d.ts.map +1 -0
- package/dist/view/Reconciler.d.ts +20 -1
- package/dist/view/Reconciler.d.ts.map +1 -1
- package/dist/view/RenderedBlockText.d.ts +27 -0
- package/dist/view/RenderedBlockText.d.ts.map +1 -0
- package/dist/view/SelectionSync.d.ts.map +1 -1
- package/package.json +9 -8
- package/dist/chunks/AlignmentPlugin-DIwrRsHd.mjs +0 -2
- package/dist/chunks/AlignmentPlugin-DIwrRsHd.mjs.map +0 -1
- package/dist/chunks/AttrRegistry-CtNhf2EF.mjs.map +0 -1
- package/dist/chunks/AttributedMarkCommands-B3MQdob_.mjs.map +0 -1
- package/dist/chunks/BidiIsolationPlugin-cOLlL3Y9.mjs +0 -2
- package/dist/chunks/BidiIsolationPlugin-cOLlL3Y9.mjs.map +0 -1
- package/dist/chunks/BlockInsertion-O5pAFKid.mjs +0 -2
- package/dist/chunks/BlockInsertion-O5pAFKid.mjs.map +0 -1
- package/dist/chunks/BlockquotePlugin-D-jRWLQB.mjs +0 -2
- package/dist/chunks/BlockquotePlugin-D-jRWLQB.mjs.map +0 -1
- package/dist/chunks/CaretNavigationPlugin-DEZU09LJ.mjs.map +0 -1
- package/dist/chunks/CodeBlockPlugin-BandNM3t.mjs +0 -2
- package/dist/chunks/CodeBlockPlugin-BandNM3t.mjs.map +0 -1
- package/dist/chunks/ColorPickerPopup-CFYCCN7m.mjs +0 -2
- package/dist/chunks/ColorPickerPopup-CFYCCN7m.mjs.map +0 -1
- package/dist/chunks/ColorValidation-B9d_umnf.mjs.map +0 -1
- package/dist/chunks/Commands-D-0UXYvo.mjs +0 -2
- package/dist/chunks/Commands-D-0UXYvo.mjs.map +0 -1
- package/dist/chunks/ContentModel-Bzmzeqwg.mjs +0 -2
- package/dist/chunks/ContentModel-Bzmzeqwg.mjs.map +0 -1
- package/dist/chunks/CursorMarks-dx51OGBf.mjs.map +0 -1
- package/dist/chunks/Decoration-BwhoA4MU.mjs.map +0 -1
- package/dist/chunks/DirectionDetection-ZrkMhyaL.mjs.map +0 -1
- package/dist/chunks/Document-D_2cIBJG.mjs.map +0 -1
- package/dist/chunks/DocumentParser-i-CreJ48.mjs +0 -2
- package/dist/chunks/DocumentParser-i-CreJ48.mjs.map +0 -1
- package/dist/chunks/FontPlugin-BySgRcF3.mjs +0 -2
- package/dist/chunks/FontPlugin-BySgRcF3.mjs.map +0 -1
- package/dist/chunks/FontSizePlugin-zJDiyhUv.mjs +0 -2
- package/dist/chunks/FontSizePlugin-zJDiyhUv.mjs.map +0 -1
- package/dist/chunks/FormulaPlugin-CI0r4X1o.mjs +0 -2
- package/dist/chunks/FormulaPlugin-CI0r4X1o.mjs.map +0 -1
- package/dist/chunks/GapCursorPlugin-NozsEK9J.mjs +0 -2
- package/dist/chunks/GapCursorPlugin-NozsEK9J.mjs.map +0 -1
- package/dist/chunks/HTMLUtils-B0nGyFLb.mjs +0 -2
- package/dist/chunks/HTMLUtils-B0nGyFLb.mjs.map +0 -1
- package/dist/chunks/HardBreakPlugin-CC4rntSX.mjs.map +0 -1
- package/dist/chunks/HeadingPlugin-BCh12hFT.mjs +0 -2
- package/dist/chunks/HeadingPlugin-BCh12hFT.mjs.map +0 -1
- package/dist/chunks/HighlightPlugin-By7CWUss.mjs +0 -2
- package/dist/chunks/HighlightPlugin-By7CWUss.mjs.map +0 -1
- package/dist/chunks/HorizontalRulePlugin-CxmUMM34.mjs +0 -2
- package/dist/chunks/HorizontalRulePlugin-CxmUMM34.mjs.map +0 -1
- package/dist/chunks/ImagePlugin-C_MuvfYo.mjs +0 -2
- package/dist/chunks/ImagePlugin-C_MuvfYo.mjs.map +0 -1
- package/dist/chunks/InlineCodePlugin-C1SqGfv5.mjs +0 -2
- package/dist/chunks/InlineCodePlugin-C1SqGfv5.mjs.map +0 -1
- package/dist/chunks/InlineStyleMarkSpec-Cx3goc3W.mjs +0 -2
- package/dist/chunks/InlineStyleMarkSpec-Cx3goc3W.mjs.map +0 -1
- package/dist/chunks/LinkPlugin-Bsmt97Kw.mjs +0 -2
- package/dist/chunks/LinkPlugin-Bsmt97Kw.mjs.map +0 -1
- package/dist/chunks/ListPlugin--dqEctgn.mjs.map +0 -1
- package/dist/chunks/MarkCommands-CJvLGL5G.mjs +0 -2
- package/dist/chunks/MarkCommands-CJvLGL5G.mjs.map +0 -1
- package/dist/chunks/MarkdownHTMLRegistry-CISsC0lH.mjs +0 -2
- package/dist/chunks/MarkdownHTMLRegistry-CISsC0lH.mjs.map +0 -1
- package/dist/chunks/MarkdownParser-D1d9zB0R.mjs.map +0 -1
- package/dist/chunks/MarkdownSerializer-Oex2RzNw.mjs +0 -2
- package/dist/chunks/MarkdownSerializer-Oex2RzNw.mjs.map +0 -1
- package/dist/chunks/NavigationQueries-Bt4zZ17v.mjs +0 -2
- package/dist/chunks/NavigationQueries-Bt4zZ17v.mjs.map +0 -1
- package/dist/chunks/NodeResolver-BtIknXqD.mjs +0 -2
- package/dist/chunks/NodeResolver-BtIknXqD.mjs.map +0 -1
- package/dist/chunks/NodeSelectionCommands-DK3iEh18.mjs.map +0 -1
- package/dist/chunks/PluginHelpers-WG1Lzzh3.mjs +0 -2
- package/dist/chunks/PluginHelpers-WG1Lzzh3.mjs.map +0 -1
- package/dist/chunks/PopupManager-Jz5JrUdC.mjs +0 -2
- package/dist/chunks/PopupManager-Jz5JrUdC.mjs.map +0 -1
- package/dist/chunks/PrintPlugin-BQ7LWbEB.mjs.map +0 -1
- package/dist/chunks/RangeIterator-DDOxTQIf.mjs.map +0 -1
- package/dist/chunks/SchemaRegistry-acc6q_5x.mjs +0 -2
- package/dist/chunks/SchemaRegistry-acc6q_5x.mjs.map +0 -1
- package/dist/chunks/SelectionSync-CwOHMMfI.mjs +0 -2
- package/dist/chunks/SelectionSync-CwOHMMfI.mjs.map +0 -1
- package/dist/chunks/SelectionTransactions-DNCzsl_b.mjs.map +0 -1
- package/dist/chunks/SimpleMark-CTDtEIMV.mjs +0 -2
- package/dist/chunks/SimpleMark-CTDtEIMV.mjs.map +0 -1
- package/dist/chunks/SmartPastePlugin-CjExbE9Q.mjs +0 -2
- package/dist/chunks/SmartPastePlugin-CjExbE9Q.mjs.map +0 -1
- package/dist/chunks/StrikethroughPlugin-d-EW2YYx.mjs.map +0 -1
- package/dist/chunks/SuperSubPlugin-C-kvFQyx.mjs.map +0 -1
- package/dist/chunks/TableDimensions-BcARMxQB.mjs +0 -2
- package/dist/chunks/TableDimensions-BcARMxQB.mjs.map +0 -1
- package/dist/chunks/TablePlugin-CdXY0Px5.mjs +0 -2
- package/dist/chunks/TablePlugin-CdXY0Px5.mjs.map +0 -1
- package/dist/chunks/TextColorPlugin-BLTKft_Z.mjs +0 -2
- package/dist/chunks/TextColorPlugin-BLTKft_Z.mjs.map +0 -1
- package/dist/chunks/TextDirectionAutoPlugin-LVDkKdDX.mjs.map +0 -1
- package/dist/chunks/TextDirectionPlugin-CtGwof7i.mjs.map +0 -1
- package/dist/chunks/TextDirectionService-OFOU6r_s.mjs +0 -2
- package/dist/chunks/TextDirectionService-OFOU6r_s.mjs.map +0 -1
- package/dist/chunks/TextFormattingPlugin-DlS0SeW7.mjs.map +0 -1
- package/dist/chunks/ToolbarPlugin-CMHJCdYY.mjs +0 -2
- package/dist/chunks/ToolbarPlugin-CMHJCdYY.mjs.map +0 -1
- package/dist/chunks/VideoPlugin-C9z4JfP_.mjs +0 -2
- package/dist/chunks/VideoPlugin-C9z4JfP_.mjs.map +0 -1
- package/dist/chunks/ar-Ctrv6cIi.mjs +0 -2
- package/dist/chunks/ar-Ctrv6cIi.mjs.map +0 -1
- package/dist/chunks/color-picker-DJ05ey9o.mjs +0 -2
- package/dist/chunks/color-picker-DJ05ey9o.mjs.map +0 -1
- package/dist/chunks/de-JhGflzS5.mjs +0 -2
- package/dist/chunks/de-JhGflzS5.mjs.map +0 -1
- package/dist/chunks/es-Bv7bDbMp.mjs +0 -2
- package/dist/chunks/es-Bv7bDbMp.mjs.map +0 -1
- package/dist/chunks/fr-DtzIu6tU.mjs +0 -2
- package/dist/chunks/fr-DtzIu6tU.mjs.map +0 -1
- package/dist/chunks/full-9sO5JbWG.mjs +0 -2
- package/dist/chunks/full-9sO5JbWG.mjs.map +0 -1
- package/dist/chunks/hi-Bu799xIO.mjs +0 -2
- package/dist/chunks/hi-Bu799xIO.mjs.map +0 -1
- package/dist/chunks/minimal-C07d5reO.mjs +0 -2
- package/dist/chunks/minimal-C07d5reO.mjs.map +0 -1
- package/dist/chunks/pt-DmN9u3NX.mjs +0 -2
- package/dist/chunks/pt-DmN9u3NX.mjs.map +0 -1
- package/dist/chunks/register-DMdtiQ_Z.mjs +0 -3
- package/dist/chunks/register-DMdtiQ_Z.mjs.map +0 -1
- package/dist/chunks/ru-BxySx7an.mjs +0 -2
- package/dist/chunks/ru-BxySx7an.mjs.map +0 -1
- package/dist/chunks/zh-DuucmOns.mjs +0 -2
- package/dist/chunks/zh-DuucmOns.mjs.map +0 -1
- package/dist/editor/styles/base.d.ts +0 -3
- package/dist/editor/styles/base.d.ts.map +0 -1
- package/dist/editor/styles/color-picker.d.ts +0 -3
- package/dist/editor/styles/color-picker.d.ts.map +0 -1
- package/dist/editor/styles/font-select.d.ts +0 -3
- package/dist/editor/styles/font-select.d.ts.map +0 -1
- package/dist/editor/styles/font-size-select.d.ts +0 -3
- package/dist/editor/styles/font-size-select.d.ts.map +0 -1
- package/dist/editor/styles/heading-select.d.ts +0 -3
- package/dist/editor/styles/heading-select.d.ts.map +0 -1
- package/dist/editor/styles/image.d.ts +0 -3
- package/dist/editor/styles/image.d.ts.map +0 -1
- package/dist/editor/styles/reduced-motion.d.ts +0 -3
- package/dist/editor/styles/reduced-motion.d.ts.map +0 -1
- package/dist/editor/styles/table.d.ts +0 -3
- package/dist/editor/styles/table.d.ts.map +0 -1
- package/dist/editor/styles/toolbar.d.ts +0 -3
- package/dist/editor/styles/toolbar.d.ts.map +0 -1
- package/dist/plugins/blockquote/BlockquoteStyles.d.ts +0 -3
- package/dist/plugins/blockquote/BlockquoteStyles.d.ts.map +0 -1
- package/dist/plugins/formula/FormulaStyles.d.ts +0 -12
- package/dist/plugins/formula/FormulaStyles.d.ts.map +0 -1
- package/dist/plugins/image/ImagePopupStyles.d.ts +0 -3
- package/dist/plugins/image/ImagePopupStyles.d.ts.map +0 -1
- package/dist/plugins/video/VideoPopupStyles.d.ts +0 -3
- package/dist/plugins/video/VideoPopupStyles.d.ts.map +0 -1
- package/dist/plugins/video/VideoStyles.d.ts +0 -3
- package/dist/plugins/video/VideoStyles.d.ts.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Decoration-BwhoA4MU.mjs","names":["#values"],"sources":["../../src/state/Mapping.ts","../../src/decorations/PositionMapping.ts","../../src/decorations/Decoration.ts"],"sourcesContent":["/**\n * Generic position-mapping primitive.\n *\n * Each {@link Step} produces a {@link StepMap} that describes how positions\n * in `{blockId, offset}` space shift when the step is applied. A\n * {@link Mapping} composes a sequence of `StepMap`s — typically all the maps\n * of a transaction — into a single mapper, so any consumer (decorations,\n * comments, selections, remote cursors, history) can fold a position\n * through an entire change set without re-implementing per-step math.\n *\n * The model mirrors ProseMirror's `StepMap` / `Mapping`, adapted to\n * notectl's `{blockId, offset}` position space (positions are scoped to\n * blocks, not a flat document offset).\n *\n * ## Association (bias) semantics\n *\n * The optional `assoc` argument decides which side of a boundary a position\n * sticks to:\n *\n * - `assoc = -1` (\"sticky left\"): the position stays at the boundary when\n * content is inserted at, or split exactly at, the position. This is the\n * semantics expected by an inclusive-start range marker (a decoration's\n * `from`, the left edge of a selection).\n * - `assoc = +1` (\"sticky right\"): the position moves past inserted content\n * and migrates to the new block when its host block is split exactly at\n * the position. This is the semantics expected by an exclusive-end range\n * marker (a decoration's `to`, the right edge of a selection).\n *\n * The default is `-1`, matching the most common case (cursor and from-side\n * mappers).\n *\n * ## StepMap categories\n *\n * Every {@link Step} produces exactly one of six categories:\n *\n * 1. `identity` — no position shift (mark, attribute, schema, block-type).\n * 2. `shift` — within a single block, the range `[from, to)` is replaced\n * with content of length `newLen`. Covers `insertText`, `deleteText`,\n * `insertInlineNode`, `removeInlineNode` as a single primitive.\n * 3. `split` — a block is split at an offset; positions past the split\n * migrate to the new block with rebased offsets.\n * 4. `merge` — a source block is appended to a target block; positions in\n * the source block migrate to the target block with offsets shifted by\n * the target's previous length.\n * 5. `blockRemoval` — one block subtree vanishes; positions inside any\n * removed block are marked deleted, and sibling child-indices in the\n * same parent shift down by one past the removed index.\n * 6. `childIndexShift` — a new block was inserted at `fromIndex` in\n * `parentPath`'s children; sibling child-indices `≥ fromIndex` shift up.\n * Position space ({blockId, offset}) is unaffected.\n *\n * `blockRemoval` and `childIndexShift` are the two categories that carry\n * **structural** information about a parent's child list. They are\n * orthogonal to positions ({blockId, offset}) and are interpreted by\n * {@link mapChildIndex} when rebasing tree-structural steps\n * (`insertNode` / `removeNode`).\n */\n\nimport { isBlockNode } from '../model/Document.js';\nimport type { BlockNode } from '../model/Document.js';\nimport type { Position } from '../model/Selection.js';\nimport { createPosition } from '../model/Selection.js';\nimport type { BlockId } from '../model/TypeBrands.js';\n\n/**\n * Result of mapping an `(blockId, [from, to))` range through a {@link Mapping}.\n *\n * Both endpoints are guaranteed to live in the same block. Callers can rely\n * on `from <= to` (the helper returns `null` rather than producing an\n * inverted range).\n */\nexport interface MappedInBlockRange {\n\treadonly blockId: BlockId;\n\treadonly from: number;\n\treadonly to: number;\n}\n\n/** Position-mapping bias at a boundary. */\nexport type Assoc = -1 | 1;\n\n// --- StepMap variants ---\n\n/** No-op map: positions pass through unchanged. */\nexport interface IdentityMap {\n\treadonly type: 'identity';\n}\n\n/**\n * Within `blockId`, the offset range `[from, to)` is replaced with content\n * of length `newLen`. Covers all in-block content edits with a single\n * primitive:\n *\n * - `insertText(blockId, off, text)` → `{from: off, to: off, newLen: text.length}`.\n * - `deleteText(blockId, f, t)` → `{from: f, to: t, newLen: 0}`.\n * - `insertInlineNode(blockId, off)` → `{from: off, to: off, newLen: 1}`.\n * - `removeInlineNode(blockId, off)` → `{from: off, to: off + 1, newLen: 0}`.\n */\nexport interface ShiftMap {\n\treadonly type: 'shift';\n\treadonly blockId: BlockId;\n\treadonly from: number;\n\treadonly to: number;\n\treadonly newLen: number;\n}\n\n/**\n * A block is split at `offset`. Content `[0, offset)` stays in `blockId`;\n * content `[offset, length)` migrates to `newBlockId` rebased to start at 0.\n */\nexport interface SplitMap {\n\treadonly type: 'split';\n\treadonly blockId: BlockId;\n\treadonly offset: number;\n\treadonly newBlockId: BlockId;\n}\n\n/**\n * `sourceBlockId` is appended to `targetBlockId`. Positions in the source\n * block migrate to the target block with offset shifted by\n * `targetLengthBefore` (the target's length before the merge).\n */\nexport interface MergeMap {\n\treadonly type: 'merge';\n\treadonly targetBlockId: BlockId;\n\treadonly sourceBlockId: BlockId;\n\treadonly targetLengthBefore: number;\n}\n\n/**\n * A block subtree is removed from the document. Positions whose `blockId`\n * is in `removedBlockIds` are marked deleted; `removedBlockIds` covers the\n * removed root **plus all descendant block IDs** (see\n * {@link collectRemovedBlockIds}).\n *\n * `parentPath` and `index` carry the removal's structural coordinates so\n * sibling child-indices in the same parent can be rebased: any\n * `(parentPath, i)` with `i === index` becomes invalid (the block is gone),\n * and `i > index` shifts down by one. See {@link mapChildIndex}.\n */\nexport interface BlockRemovalMap {\n\treadonly type: 'blockRemoval';\n\treadonly removedBlockIds: ReadonlySet<BlockId>;\n\treadonly parentPath: readonly BlockId[];\n\treadonly index: number;\n}\n\n/**\n * A new block was inserted at `fromIndex` in `parentPath`'s child list.\n * Sibling child-indices `≥ fromIndex` shift up by `delta` (always `+1`\n * since {@link InsertNodeStep} inserts a single block). Position space\n * (`{blockId, offset}`) is unaffected — the new block has no prior\n * positions, and positions inside other siblings keep their offsets.\n *\n * Consumed by {@link mapChildIndex}, {@link mapInsertionIndex}, and exact\n * structural inverse detection during history replay.\n */\nexport interface ChildIndexShiftMap {\n\treadonly type: 'childIndexShift';\n\treadonly parentPath: readonly BlockId[];\n\treadonly fromIndex: number;\n\treadonly delta: number;\n\t/**\n\t * IDs introduced by an InsertNodeStep. Optional for synthetic/test maps;\n\t * when present it makes the map an exact structural inverse of the matching\n\t * BlockRemovalMap during history replay.\n\t */\n\treadonly insertedBlockIds?: ReadonlySet<BlockId>;\n}\n\n/**\n * One existing subtree moves between child lists. Positions inside the moved\n * subtree keep their block IDs and offsets; sibling child indices in both\n * parents are shifted by the removal followed by the insertion.\n */\nexport interface MoveNodeMap {\n\treadonly type: 'moveNode';\n\treadonly movedNodeId: BlockId;\n\treadonly fromParentPath: readonly BlockId[];\n\treadonly fromIndex: number;\n\treadonly toParentPath: readonly BlockId[];\n\t/** Destination index after removing the source node. */\n\treadonly destinationIndex: number;\n}\n\n/** Discriminated union of all StepMap variants. */\nexport type StepMap =\n\t| IdentityMap\n\t| ShiftMap\n\t| SplitMap\n\t| MergeMap\n\t| BlockRemovalMap\n\t| ChildIndexShiftMap\n\t| MoveNodeMap;\n\n// --- Map results ---\n\n/** Result of mapping a single position. */\nexport interface MapResult {\n\treadonly pos: Position;\n\t/** True if the input position fell inside content removed by the map. */\n\treadonly deleted: boolean;\n}\n\n/** A range expressed in `Position` space. */\nexport interface PositionRange {\n\treadonly from: Position;\n\treadonly to: Position;\n}\n\n// --- Singletons / factories ---\n\n/** The shared identity StepMap; reuse instead of allocating per step. */\nexport const IDENTITY_MAP: IdentityMap = Object.freeze({ type: 'identity' });\n\n/**\n * Runtime-immutable ReadonlySet facade.\n *\n * `Object.freeze(new Set())` only freezes the wrapper object; its internal\n * slots remain mutable through `add`, `delete`, and `clear`. Keeping the real\n * Set in an ECMAScript private field and exposing only ReadonlySet operations\n * makes structural StepMap snapshots immutable at runtime as well as by type.\n */\nclass ImmutableReadonlySet<T> implements ReadonlySet<T> {\n\treadonly #values: Set<T>;\n\n\tconstructor(values: Iterable<T>) {\n\t\tthis.#values = new Set(values);\n\t\tObject.freeze(this);\n\t}\n\n\tget size(): number {\n\t\treturn this.#values.size;\n\t}\n\n\thas(value: T): boolean {\n\t\treturn this.#values.has(value);\n\t}\n\n\tentries(): SetIterator<[T, T]> {\n\t\treturn this.#values.entries();\n\t}\n\n\tkeys(): SetIterator<T> {\n\t\treturn this.#values.keys();\n\t}\n\n\tvalues(): SetIterator<T> {\n\t\treturn this.#values.values();\n\t}\n\n\t[Symbol.iterator](): SetIterator<T> {\n\t\treturn this.#values[Symbol.iterator]();\n\t}\n\n\tforEach(callback: (value: T, value2: T, set: ReadonlySet<T>) => void, thisArg?: unknown): void {\n\t\tfor (const value of this.#values) callback.call(thisArg, value, value, this);\n\t}\n\n\tunion<U>(other: ReadonlySetLike<U>): Set<T | U> {\n\t\treturn new Set<T | U>([...this.#values, ...setLikeValues(other)]);\n\t}\n\n\tintersection<U>(other: ReadonlySetLike<U>): Set<T & U> {\n\t\tconst otherValues = setLikeValues(other);\n\t\tconst intersection = new Set<T & U>();\n\t\tfor (const value of this.#values) {\n\t\t\tif (hasSetValue(otherValues, value)) intersection.add(value as T & U);\n\t\t}\n\t\treturn intersection;\n\t}\n\n\tdifference<U>(other: ReadonlySetLike<U>): Set<T> {\n\t\tconst otherValues = setLikeValues(other);\n\t\treturn new Set([...this.#values].filter((value) => !hasSetValue(otherValues, value)));\n\t}\n\n\tsymmetricDifference<U>(other: ReadonlySetLike<U>): Set<T | U> {\n\t\tconst otherValues = setLikeValues(other);\n\t\tconst difference = new Set<T | U>();\n\t\tfor (const value of this.#values) {\n\t\t\tif (!hasSetValue(otherValues, value)) difference.add(value);\n\t\t}\n\t\tfor (const value of otherValues) {\n\t\t\tif (!hasSetValue(this.#values, value)) difference.add(value);\n\t\t}\n\t\treturn difference;\n\t}\n\n\tisSubsetOf(other: ReadonlySetLike<unknown>): boolean {\n\t\tconst otherValues = setLikeValues(other);\n\t\tfor (const value of this.#values) {\n\t\t\tif (!otherValues.has(value)) return false;\n\t\t}\n\t\treturn true;\n\t}\n\n\tisSupersetOf(other: ReadonlySetLike<unknown>): boolean {\n\t\tfor (const value of setLikeValues(other)) {\n\t\t\tif (!hasSetValue(this.#values, value)) return false;\n\t\t}\n\t\treturn true;\n\t}\n\n\tisDisjointFrom(other: ReadonlySetLike<unknown>): boolean {\n\t\tfor (const value of setLikeValues(other)) {\n\t\t\tif (hasSetValue(this.#values, value)) return false;\n\t\t}\n\t\treturn true;\n\t}\n}\n\nfunction setLikeValues<T>(values: ReadonlySetLike<T>): Set<T> {\n\tconst copy = new Set<T>();\n\tconst iterator = values.keys();\n\tfor (let next = iterator.next(); !next.done; next = iterator.next()) copy.add(next.value);\n\treturn copy;\n}\n\nfunction hasSetValue(values: ReadonlySetLike<unknown>, value: unknown): boolean {\n\treturn values.has(value);\n}\n\n/** Creates a detached, deeply immutable snapshot of a StepMap payload. */\nexport function snapshotStepMap(stepMap: StepMap): StepMap {\n\tswitch (stepMap.type) {\n\t\tcase 'identity':\n\t\t\treturn IDENTITY_MAP;\n\t\tcase 'blockRemoval':\n\t\t\treturn Object.freeze({\n\t\t\t\t...stepMap,\n\t\t\t\tremovedBlockIds: new ImmutableReadonlySet(stepMap.removedBlockIds),\n\t\t\t\tparentPath: Object.freeze([...stepMap.parentPath]),\n\t\t\t});\n\t\tcase 'childIndexShift':\n\t\t\treturn Object.freeze({\n\t\t\t\t...stepMap,\n\t\t\t\tparentPath: Object.freeze([...stepMap.parentPath]),\n\t\t\t\t...(stepMap.insertedBlockIds\n\t\t\t\t\t? { insertedBlockIds: new ImmutableReadonlySet(stepMap.insertedBlockIds) }\n\t\t\t\t\t: {}),\n\t\t\t});\n\t\tcase 'moveNode':\n\t\t\treturn Object.freeze({\n\t\t\t\t...stepMap,\n\t\t\t\tfromParentPath: Object.freeze([...stepMap.fromParentPath]),\n\t\t\t\ttoParentPath: Object.freeze([...stepMap.toParentPath]),\n\t\t\t});\n\t\tdefault:\n\t\t\treturn Object.freeze({ ...stepMap });\n\t}\n}\n\n/**\n * Walks a block subtree and returns the set of its own ID plus every\n * descendant block ID. Used to build {@link BlockRemovalMap.removedBlockIds}.\n */\nexport function collectRemovedBlockIds(node: BlockNode): Set<BlockId> {\n\tconst ids = new Set<BlockId>();\n\tconst walk = (n: BlockNode): void => {\n\t\tids.add(n.id);\n\t\tfor (const child of n.children) {\n\t\t\tif (isBlockNode(child)) walk(child);\n\t\t}\n\t};\n\twalk(node);\n\treturn ids;\n}\n\n// --- Single-StepMap application ---\n\n/**\n * Maps a single position through one {@link StepMap}.\n *\n * @param pos input position\n * @param map the StepMap describing the change\n * @param assoc which side of a boundary to stick to (default `-1`)\n * @returns mapped position plus a `deleted` flag indicating whether `pos`\n * fell inside content that the step removed\n */\nexport function mapPositionThroughStep(pos: Position, map: StepMap, assoc: Assoc = -1): MapResult {\n\tswitch (map.type) {\n\t\tcase 'identity':\n\t\t\treturn { pos, deleted: false };\n\t\tcase 'shift':\n\t\t\treturn mapPositionThroughShift(pos, map, assoc);\n\t\tcase 'split':\n\t\t\treturn mapPositionThroughSplit(pos, map, assoc);\n\t\tcase 'merge':\n\t\t\treturn mapPositionThroughMerge(pos, map);\n\t\tcase 'blockRemoval':\n\t\t\treturn mapPositionThroughBlockRemoval(pos, map);\n\t\tcase 'childIndexShift':\n\t\t\t// Child-index shifts do not touch position space ({blockId, offset}):\n\t\t\t// a new sibling block has no prior positions to map, and existing\n\t\t\t// siblings keep their internal offsets even if their parent-relative\n\t\t\t// index changed. Consumed only by {@link mapChildIndex}.\n\t\t\treturn { pos, deleted: false };\n\t\tcase 'moveNode':\n\t\t\t// A move preserves block identity and in-block offsets. Structural\n\t\t\t// child-index consumers handle the parent-list shifts separately.\n\t\t\treturn { pos, deleted: false };\n\t}\n}\n\nfunction mapPositionThroughShift(pos: Position, map: ShiftMap, assoc: Assoc): MapResult {\n\tif (pos.blockId !== map.blockId) return { pos, deleted: false };\n\n\tconst delta: number = map.newLen - (map.to - map.from);\n\tconst off: number = pos.offset;\n\n\t// Strictly before the affected range\n\tif (off < map.from) return { pos, deleted: false };\n\n\t// At the start boundary\n\tif (off === map.from) {\n\t\t// Pure insertion (from === to): assoc decides whether we stick before\n\t\t// or after the inserted run.\n\t\tif (map.from === map.to) {\n\t\t\tconst newOff: number = assoc === 1 ? map.from + map.newLen : map.from;\n\t\t\treturn newOff === off\n\t\t\t\t? { pos, deleted: false }\n\t\t\t\t: { pos: shiftedPos(pos, newOff), deleted: false };\n\t\t}\n\t\t// Deletion starts at this point — position stays at `from` regardless\n\t\t// of assoc; nothing was inserted to skip past.\n\t\treturn { pos, deleted: false };\n\t}\n\n\t// Strictly inside [from, to): position fell into removed content\n\tif (off < map.to) {\n\t\tconst newOff: number = assoc === 1 ? map.from + map.newLen : map.from;\n\t\treturn { pos: shiftedPos(pos, newOff), deleted: true };\n\t}\n\n\t// At or past the end boundary: shift by delta\n\tconst newOff: number = off + delta;\n\treturn newOff === off\n\t\t? { pos, deleted: false }\n\t\t: { pos: shiftedPos(pos, newOff), deleted: false };\n}\n\nfunction mapPositionThroughSplit(pos: Position, map: SplitMap, assoc: Assoc): MapResult {\n\tif (pos.blockId !== map.blockId) return { pos, deleted: false };\n\n\tif (pos.offset < map.offset) return { pos, deleted: false };\n\n\tif (pos.offset > map.offset) {\n\t\treturn {\n\t\t\tpos: createPosition(map.newBlockId, pos.offset - map.offset),\n\t\t\tdeleted: false,\n\t\t};\n\t}\n\n\t// At the split boundary: assoc decides which side keeps the cursor.\n\tif (assoc === 1) {\n\t\treturn { pos: createPosition(map.newBlockId, 0), deleted: false };\n\t}\n\treturn { pos, deleted: false };\n}\n\nfunction mapPositionThroughMerge(pos: Position, map: MergeMap): MapResult {\n\tif (pos.blockId !== map.sourceBlockId) return { pos, deleted: false };\n\treturn {\n\t\tpos: createPosition(map.targetBlockId, pos.offset + map.targetLengthBefore),\n\t\tdeleted: false,\n\t};\n}\n\nfunction mapPositionThroughBlockRemoval(pos: Position, map: BlockRemovalMap): MapResult {\n\tif (map.removedBlockIds.has(pos.blockId)) {\n\t\treturn { pos, deleted: true };\n\t}\n\treturn { pos, deleted: false };\n}\n\n/** Allocates a new Position with the given offset, preserving an optional `path`. */\nfunction shiftedPos(original: Position, newOffset: number): Position {\n\treturn createPosition(original.blockId, newOffset, original.path);\n}\n\n// --- Mapping ---\n\n/**\n * Composes a sequence of {@link StepMap}s into a single mapper. A `Mapping`\n * is immutable; `appendMap` returns a new instance.\n *\n * Construction always normalizes by dropping identity maps — they're a\n * common case and would otherwise inflate every transaction's mapping\n * pipeline with no-ops.\n */\nexport class Mapping {\n\t/** Shared empty Mapping. */\n\tstatic readonly empty: Mapping = new Mapping([]);\n\n\treadonly maps: readonly StepMap[];\n\n\tprivate constructor(maps: readonly StepMap[]) {\n\t\tthis.maps = Object.freeze(maps.map(snapshotStepMap));\n\t\tObject.freeze(this);\n\t}\n\n\t/** Creates a Mapping from a list of StepMaps, dropping identity maps. */\n\tstatic from(maps: readonly StepMap[]): Mapping {\n\t\tconst filtered: StepMap[] = [];\n\t\tfor (const m of maps) {\n\t\t\tif (m.type !== 'identity') filtered.push(m);\n\t\t}\n\t\tif (filtered.length === 0) return Mapping.empty;\n\t\treturn new Mapping(filtered);\n\t}\n\n\t/** Returns a new Mapping with `map` appended. */\n\tappendMap(map: StepMap): Mapping {\n\t\tif (map.type === 'identity') return this;\n\t\treturn new Mapping([...this.maps, map]);\n\t}\n\n\t/** Concatenates two mappings into a new one. */\n\tappendMapping(other: Mapping): Mapping {\n\t\tif (other.maps.length === 0) return this;\n\t\tif (this.maps.length === 0) return other;\n\t\treturn new Mapping([...this.maps, ...other.maps]);\n\t}\n\n\t/** True if the mapping contains no position-changing maps. */\n\tget isEmpty(): boolean {\n\t\treturn this.maps.length === 0;\n\t}\n\n\t/**\n\t * Folds a position through every contained StepMap in order.\n\t * Returns the mapped position; the `deleted` flag is **not** preserved\n\t * (use {@link mapResult} when you need it).\n\t */\n\tmap(pos: Position, assoc: Assoc = -1): Position {\n\t\treturn this.mapResult(pos, assoc).pos;\n\t}\n\n\t/**\n\t * Like {@link map}, but returns whether the position is deleted in the final\n\t * frame. Content deletion remains sticky across every later map. Structural\n\t * deletion can be recovered by an `insertNode` map carrying the same block\n\t * ID; a later removal can mark that identity deleted again.\n\t */\n\tmapResult(pos: Position, assoc: Assoc = -1): MapResult {\n\t\tlet current: Position = pos;\n\t\tlet contentDeleted = false;\n\t\tlet structurallyDeleted = false;\n\t\tfor (const m of this.maps) {\n\t\t\tconst result: MapResult = mapPositionThroughStep(current, m, assoc);\n\t\t\tcurrent = result.pos;\n\t\t\tif (result.deleted) {\n\t\t\t\tif (m.type === 'blockRemoval') {\n\t\t\t\t\tstructurallyDeleted = true;\n\t\t\t\t} else {\n\t\t\t\t\tcontentDeleted = true;\n\t\t\t\t}\n\t\t\t} else if (m.type === 'childIndexShift' && m.insertedBlockIds?.has(current.blockId)) {\n\t\t\t\tstructurallyDeleted = false;\n\t\t\t}\n\t\t}\n\t\treturn { pos: current, deleted: contentDeleted || structurallyDeleted };\n\t}\n\n\t/**\n\t * Maps a range. By convention, `from` is mapped with `assoc = -1`\n\t * (inclusive-start) and `to` with `assoc = +1` (exclusive-end). The\n\t * caller may override either bias.\n\t *\n\t * Returns `null` when both endpoints land in deleted content **and** the\n\t * mapped range would collapse to length zero or negative — i.e. the\n\t * range no longer covers any live content.\n\t *\n\t * The returned `from`/`to` may live in different blocks (e.g. after a\n\t * `split` map). Callers that require an in-block range (decorations,\n\t * inline selections) must detect and split accordingly.\n\t */\n\tmapRange(range: PositionRange, assocFrom: Assoc = -1, assocTo: Assoc = 1): PositionRange | null {\n\t\tconst from: MapResult = this.mapResult(range.from, assocFrom);\n\t\tconst to: MapResult = this.mapResult(range.to, assocTo);\n\n\t\tif (from.deleted && to.deleted) {\n\t\t\tif (from.pos.blockId === to.pos.blockId && from.pos.offset >= to.pos.offset) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t}\n\t\treturn { from: from.pos, to: to.pos };\n\t}\n}\n\n// --- In-block range helpers (used by per-step Step→Step mapping) ---\n\n/**\n * Maps an `(blockId, [from, to))` range through `mapping`, asserting the\n * result lives in a single block.\n *\n * Returns `null` when the range no longer addresses live content in a single\n * block:\n *\n * - the host block was removed;\n * - the range was fully deleted (both endpoints flagged deleted and collapse);\n * - the endpoints migrated to different blocks (range fragmented, e.g. a\n * `split` map placed `from` and `to` on opposite sides of the cut).\n *\n * Default biases are **conservative for step rebasing**: `assocFrom = +1`,\n * `assocTo = -1`. An intervening insertion at either boundary therefore\n * does NOT expand the rebased range to cover the new content — the user's\n * original edit only addressed the original content, and the agent's\n * intervening insertion should be preserved across an undo/redo. This is\n * the opposite of {@link Mapping.mapRange}'s default biases, which model\n * selections (inclusive-start, exclusive-end) where boundary insertions\n * naturally extend the selection.\n */\nexport function mapInBlockRange(\n\tblockId: BlockId,\n\tfrom: number,\n\tto: number,\n\tmapping: Mapping,\n\tassocFrom: Assoc = 1,\n\tassocTo: Assoc = -1,\n): MappedInBlockRange | null {\n\tif (mapping.isEmpty) return { blockId, from, to };\n\n\tconst fromPos: Position = createPosition(blockId, from);\n\tconst toPos: Position = createPosition(blockId, to);\n\tconst fromResult: MapResult = mapping.mapResult(fromPos, assocFrom);\n\tconst toResult: MapResult = mapping.mapResult(toPos, assocTo);\n\n\t// If both endpoints fell inside removed/replaced content, the range no\n\t// longer addresses live document territory — abandon. A partial overlap\n\t// (one endpoint deleted, the other shifted) still survives clamped.\n\tif (fromResult.deleted && toResult.deleted) return null;\n\n\t// Range must remain within a single block. A split could have moved one\n\t// endpoint to the new block; that's a fragmentation we cannot represent\n\t// as a single in-block step.\n\tif (fromResult.pos.blockId !== toResult.pos.blockId) return null;\n\n\t// Defensive: a range whose endpoints inverted (from > to) is invalid.\n\t// An empty range with from === to is still valid (e.g. a pure-insertion\n\t// `shift` whose offset survived).\n\tif (fromResult.pos.offset > toResult.pos.offset) return null;\n\n\treturn {\n\t\tblockId: fromResult.pos.blockId,\n\t\tfrom: fromResult.pos.offset,\n\t\tto: toResult.pos.offset,\n\t};\n}\n\n/**\n * Maps an `(blockId, offset)` point through `mapping`, returning the\n * equivalent in-block position or `null` when the host block was removed.\n *\n * Convenience wrapper around {@link mapInBlockRange} for steps that carry a\n * single offset (`insertText`, `insertInlineNode`, `splitBlock`).\n */\nexport function mapOffsetInBlock(\n\tblockId: BlockId,\n\toffset: number,\n\tmapping: Mapping,\n\tassoc: Assoc = -1,\n): MappedInBlockRange | null {\n\tif (mapping.isEmpty) return { blockId, from: offset, to: offset };\n\n\tconst pos: Position = createPosition(blockId, offset);\n\tconst result: MapResult = mapping.mapResult(pos, assoc);\n\tif (result.deleted) return null;\n\treturn { blockId: result.pos.blockId, from: result.pos.offset, to: result.pos.offset };\n}\n\n// --- Child-index mapping (used by structural step rebasing) ---\n\n/**\n * Rebases a child-index `(parentPath, index)` through `mapping`. The\n * `index` is interpreted as the position of an **existing** child block:\n * if an intervening edit removed exactly that child, the result is\n * `null`. For an **insertion slot** (the target index of a future\n * `insertNode`), use {@link mapInsertionIndex} — slots stay valid even\n * when the block previously at that index is removed.\n *\n * Child-indices live in a coordinate space orthogonal to positions\n * (`{blockId, offset}`): they describe a slot in a parent's child list,\n * not a place inside text. Three {@link StepMap} categories carry\n * child-index-affecting information:\n *\n * - {@link ChildIndexShiftMap} (produced by `insertNode`): shifts\n * sibling indices `≥ fromIndex` by `delta` (always `+1` today).\n * - {@link BlockRemovalMap} (produced by `removeNode`): removes the child\n * at `index` (the input index becomes invalid → `null`), and shifts\n * sibling indices `> index` down by `1`.\n * - {@link MoveNodeMap} (produced by `moveNode`): combines the source removal\n * and destination insertion while preserving the moved subtree's identity.\n *\n * Maps whose `parentPath` differs from the input pass through; all\n * non-structural categories (`shift`, `split`, `merge`, `identity`) are\n * no-ops here.\n */\nexport function mapChildIndex(\n\tparentPath: readonly BlockId[],\n\tindex: number,\n\tmapping: Mapping,\n): number | null {\n\treturn foldChildIndex(parentPath, index, mapping, 'existing');\n}\n\n/**\n * Rebases an **insertion slot** `(parentPath, index)` through `mapping`.\n * An insertion slot lives in `[0, children.length]` (inclusive of the\n * end) and represents \"where to insert\", not an existing block. Slots\n * remain valid across intervening edits — even when the block previously\n * at that index is removed — so this function never returns `null`.\n *\n * Difference from {@link mapChildIndex}: for a `BlockRemovalMap` with\n * matching parent and `index === map.index`, this function keeps the\n * slot (returning `map.index`, which is the same numeric position in the\n * post-removal frame); {@link mapChildIndex} would return `null`.\n * {@link ChildIndexShiftMap} handling is identical.\n */\nexport function mapInsertionIndex(\n\tparentPath: readonly BlockId[],\n\tindex: number,\n\tmapping: Mapping,\n): number {\n\t// `foldChildIndex` with `'insertion'` provably never returns `null` —\n\t// the only path that would (BlockRemovalMap, matching parent, matching\n\t// index) is short-circuited inside `mapChildIndexThroughStep`. The\n\t// overload signature carries that invariant into the type system.\n\treturn foldChildIndex(parentPath, index, mapping, 'insertion');\n}\n\ntype ChildIndexKind = 'existing' | 'insertion';\n\nfunction foldChildIndex(\n\tparentPath: readonly BlockId[],\n\tindex: number,\n\tmapping: Mapping,\n\tkind: 'existing',\n): number | null;\nfunction foldChildIndex(\n\tparentPath: readonly BlockId[],\n\tindex: number,\n\tmapping: Mapping,\n\tkind: 'insertion',\n): number;\nfunction foldChildIndex(\n\tparentPath: readonly BlockId[],\n\tindex: number,\n\tmapping: Mapping,\n\tkind: ChildIndexKind,\n): number | null {\n\tif (mapping.isEmpty) return index;\n\n\tlet current: number = index;\n\tfor (const m of mapping.maps) {\n\t\tconst next: number | null = mapChildIndexThroughStep(parentPath, current, m, kind);\n\t\tif (next === null) return null;\n\t\tcurrent = next;\n\t}\n\treturn current;\n}\n\nfunction mapChildIndexThroughStep(\n\tparentPath: readonly BlockId[],\n\tindex: number,\n\tmap: StepMap,\n\tkind: ChildIndexKind,\n): number | null {\n\tswitch (map.type) {\n\t\tcase 'identity':\n\t\tcase 'shift':\n\t\tcase 'split':\n\t\tcase 'merge':\n\t\t\treturn index;\n\t\tcase 'blockRemoval':\n\t\t\tif (!sameParentPath(parentPath, map.parentPath)) return index;\n\t\t\tif (index === map.index) {\n\t\t\t\t// Existing-child semantics: that child is gone → invalid.\n\t\t\t\t// Insertion-slot semantics: the slot survives; nothing was\n\t\t\t\t// inserted/removed *to the left* of `index`, so the slot\n\t\t\t\t// number is unchanged in the post-removal frame.\n\t\t\t\treturn kind === 'existing' ? null : index;\n\t\t\t}\n\t\t\tif (index > map.index) return index - 1;\n\t\t\treturn index;\n\t\tcase 'childIndexShift':\n\t\t\tif (!sameParentPath(parentPath, map.parentPath)) return index;\n\t\t\tif (index >= map.fromIndex) return index + map.delta;\n\t\t\treturn index;\n\t\tcase 'moveNode':\n\t\t\treturn mapChildIndexThroughMove(parentPath, index, map, kind);\n\t}\n}\n\nfunction mapChildIndexThroughMove(\n\tparentPath: readonly BlockId[],\n\tindex: number,\n\tmap: MoveNodeMap,\n\tkind: ChildIndexKind,\n): number | null {\n\tconst sameParent: boolean = sameParentPath(map.fromParentPath, map.toParentPath);\n\tif (sameParent && map.fromIndex === map.destinationIndex) return index;\n\tif (\n\t\tkind === 'existing' &&\n\t\tsameParent &&\n\t\tsameParentPath(parentPath, map.fromParentPath) &&\n\t\tindex === map.fromIndex\n\t) {\n\t\treturn map.destinationIndex;\n\t}\n\n\tlet current: number = index;\n\tif (sameParentPath(parentPath, map.fromParentPath)) {\n\t\tif (current === map.fromIndex) {\n\t\t\tif (kind === 'existing') return null;\n\t\t} else if (current > map.fromIndex) {\n\t\t\tcurrent--;\n\t\t}\n\t}\n\n\tif (sameParentPath(parentPath, map.toParentPath) && current >= map.destinationIndex) {\n\t\tcurrent++;\n\t}\n\treturn current;\n}\n\nfunction sameParentPath(a: readonly BlockId[], b: readonly BlockId[]): boolean {\n\tif (a === b) return true;\n\tif (a.length !== b.length) return false;\n\tfor (let i = 0; i < a.length; i++) {\n\t\tif (a[i] !== b[i]) return false;\n\t}\n\treturn true;\n}\n\n// --- StepMap inversion (used by history's frame-walk cancellation) ---\n\n/**\n * Returns the {@link StepMap} that undoes `map` in position space — i.e.\n * composing `map` with `invertStepMap(map)` is content-preserving (though\n * the composed position-mapping is *not* a true identity in our framework:\n * positions interior to a delete-then-reinsert round-trip clamp to the\n * deletion start during the deletion half and don't return on the insert\n * half).\n *\n * Used by history to detect mutually-inverse stepmaps in the rebase chain\n * and cancel them, sidestepping the round-trip clamping for cases where\n * the rebase is a no-op in content terms.\n *\n * Structural maps include enough metadata to recover their exact inverse\n * where possible. Synthetic ChildIndexShiftMaps without inserted subtree IDs\n * remain position-only and therefore invert to {@link IDENTITY_MAP}.\n */\nexport function invertStepMap(map: StepMap): StepMap {\n\tswitch (map.type) {\n\t\tcase 'identity':\n\t\t\treturn IDENTITY_MAP;\n\t\tcase 'shift':\n\t\t\treturn {\n\t\t\t\ttype: 'shift',\n\t\t\t\tblockId: map.blockId,\n\t\t\t\tfrom: map.from,\n\t\t\t\tto: map.from + map.newLen,\n\t\t\t\tnewLen: map.to - map.from,\n\t\t\t};\n\t\tcase 'split':\n\t\t\treturn {\n\t\t\t\ttype: 'merge',\n\t\t\t\ttargetBlockId: map.blockId,\n\t\t\t\tsourceBlockId: map.newBlockId,\n\t\t\t\ttargetLengthBefore: map.offset,\n\t\t\t};\n\t\tcase 'merge':\n\t\t\treturn {\n\t\t\t\ttype: 'split',\n\t\t\t\tblockId: map.targetBlockId,\n\t\t\t\toffset: map.targetLengthBefore,\n\t\t\t\tnewBlockId: map.sourceBlockId,\n\t\t\t};\n\t\tcase 'blockRemoval':\n\t\t\treturn {\n\t\t\t\ttype: 'childIndexShift',\n\t\t\t\tparentPath: map.parentPath,\n\t\t\t\tfromIndex: map.index,\n\t\t\t\tdelta: 1,\n\t\t\t\tinsertedBlockIds: map.removedBlockIds,\n\t\t\t};\n\t\tcase 'childIndexShift':\n\t\t\tif (map.delta === 1 && map.insertedBlockIds) {\n\t\t\t\treturn {\n\t\t\t\t\ttype: 'blockRemoval',\n\t\t\t\t\tremovedBlockIds: map.insertedBlockIds,\n\t\t\t\t\tparentPath: map.parentPath,\n\t\t\t\t\tindex: map.fromIndex,\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn IDENTITY_MAP;\n\t\tcase 'moveNode':\n\t\t\treturn {\n\t\t\t\ttype: 'moveNode',\n\t\t\t\tmovedNodeId: map.movedNodeId,\n\t\t\t\tfromParentPath: map.toParentPath,\n\t\t\t\tfromIndex: map.destinationIndex,\n\t\t\t\ttoParentPath: map.fromParentPath,\n\t\t\t\tdestinationIndex: map.fromIndex,\n\t\t\t};\n\t}\n}\n\n/**\n * Structural equality for {@link StepMap}s. Used by history to recognize\n * cancelling pairs in the rebase chain ({@link invertStepMap}(a) ≡ b).\n */\nexport function stepMapsEqual(a: StepMap, b: StepMap): boolean {\n\tif (a.type !== b.type) return false;\n\tswitch (a.type) {\n\t\tcase 'identity':\n\t\t\treturn true;\n\t\tcase 'shift': {\n\t\t\tconst bs = b as ShiftMap;\n\t\t\treturn (\n\t\t\t\ta.blockId === bs.blockId && a.from === bs.from && a.to === bs.to && a.newLen === bs.newLen\n\t\t\t);\n\t\t}\n\t\tcase 'split': {\n\t\t\tconst bs = b as SplitMap;\n\t\t\treturn a.blockId === bs.blockId && a.offset === bs.offset && a.newBlockId === bs.newBlockId;\n\t\t}\n\t\tcase 'merge': {\n\t\t\tconst bm = b as MergeMap;\n\t\t\treturn (\n\t\t\t\ta.targetBlockId === bm.targetBlockId &&\n\t\t\t\ta.sourceBlockId === bm.sourceBlockId &&\n\t\t\t\ta.targetLengthBefore === bm.targetLengthBefore\n\t\t\t);\n\t\t}\n\t\tcase 'blockRemoval': {\n\t\t\tconst br = b as BlockRemovalMap;\n\t\t\tif (a.index !== br.index) return false;\n\t\t\tif (!sameParentPath(a.parentPath, br.parentPath)) return false;\n\t\t\tif (a.removedBlockIds.size !== br.removedBlockIds.size) return false;\n\t\t\tfor (const id of a.removedBlockIds) {\n\t\t\t\tif (!br.removedBlockIds.has(id)) return false;\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t\tcase 'childIndexShift': {\n\t\t\tconst cs = b as ChildIndexShiftMap;\n\t\t\treturn (\n\t\t\t\ta.fromIndex === cs.fromIndex &&\n\t\t\t\ta.delta === cs.delta &&\n\t\t\t\tsameParentPath(a.parentPath, cs.parentPath) &&\n\t\t\t\toptionalIdSetsEqual(a.insertedBlockIds, cs.insertedBlockIds)\n\t\t\t);\n\t\t}\n\t\tcase 'moveNode': {\n\t\t\tif (b.type !== 'moveNode') return false;\n\t\t\treturn (\n\t\t\t\ta.movedNodeId === b.movedNodeId &&\n\t\t\t\ta.fromIndex === b.fromIndex &&\n\t\t\t\ta.destinationIndex === b.destinationIndex &&\n\t\t\t\tsameParentPath(a.fromParentPath, b.fromParentPath) &&\n\t\t\t\tsameParentPath(a.toParentPath, b.toParentPath)\n\t\t\t);\n\t\t}\n\t}\n}\n\nfunction optionalIdSetsEqual(\n\ta: ReadonlySet<BlockId> | undefined,\n\tb: ReadonlySet<BlockId> | undefined,\n): boolean {\n\tif (a === b) return true;\n\tif (!a || !b || a.size !== b.size) return false;\n\tfor (const id of a) {\n\t\tif (!b.has(id)) return false;\n\t}\n\treturn true;\n}\n","/**\n * Thin decoration-specific adapters over the generic {@link StepMap}\n * primitive. Position-shift arithmetic lives in `state/Mapping.ts`; this\n * module only contains the decoration-shape concerns:\n *\n * - splitting an {@link InlineDecoration} into two when a `splitBlock`\n * crosses its range,\n * - dropping a {@link NodeDecoration} when its block disappears\n * (`removeNode`) or is absorbed by a merge,\n * - applying widget `side` as the mapping `assoc`.\n *\n * The legacy entry point `mapDecorationThroughStep(deco, step)` is\n * preserved as a thin shim over `mapDecorationThroughStepMap` so existing\n * tests keep working; new consumers should reach for `Transaction.mapping`\n * directly via `DecorationSet.map(tr)`.\n */\n\nimport type { Document } from '../model/Document.js';\nimport { createPosition } from '../model/Selection.js';\nimport type { MergeMap, ShiftMap, SplitMap, StepMap } from '../state/Mapping.js';\nimport { mapPositionThroughStep } from '../state/Mapping.js';\nimport { getStepMap } from '../state/StepHandlers.js';\nimport type { Step } from '../state/Transaction.js';\nimport type {\n\tDecoration,\n\tInlineDecoration,\n\tNodeDecoration,\n\tWidgetDecoration,\n} from './Decoration.js';\n\nconst EMPTY_DOC: Document = { children: [] };\n\n/**\n * Maps a decoration through a single {@link StepMap}. Returns:\n * - the (possibly identical) decoration,\n * - an array of two decorations when a `splitBlock` cuts an inline range,\n * - or `null` when the decoration was deleted.\n */\nexport function mapDecorationThroughStepMap(\n\tdeco: Decoration,\n\tstepMap: StepMap,\n): Decoration | readonly Decoration[] | null {\n\tswitch (deco.type) {\n\t\tcase 'inline':\n\t\t\treturn mapInline(deco, stepMap);\n\t\tcase 'widget':\n\t\t\treturn mapWidget(deco, stepMap);\n\t\tcase 'node':\n\t\t\treturn mapNode(deco, stepMap);\n\t}\n}\n\n/**\n * Legacy entry point — kept for backward compatibility with callers and\n * tests that hold a {@link Step} rather than a {@link StepMap}. Internally\n * converts step → StepMap (cheap, no doc state needed for any of the\n * shape categories used here) and delegates to\n * {@link mapDecorationThroughStepMap}.\n */\nexport function mapDecorationThroughStep(\n\tdeco: Decoration,\n\tstep: Step,\n): Decoration | readonly Decoration[] | null {\n\treturn mapDecorationThroughStepMap(deco, getStepMap(EMPTY_DOC, step));\n}\n\n// --- Inline ---\n\nfunction mapInline(\n\tdeco: InlineDecoration,\n\tstepMap: StepMap,\n): InlineDecoration | readonly InlineDecoration[] | null {\n\tswitch (stepMap.type) {\n\t\tcase 'identity':\n\t\t\treturn deco;\n\t\tcase 'shift':\n\t\t\treturn mapInlineShift(deco, stepMap);\n\t\tcase 'split':\n\t\t\treturn mapInlineSplit(deco, stepMap);\n\t\tcase 'merge':\n\t\t\treturn mapInlineMerge(deco, stepMap);\n\t\tcase 'blockRemoval':\n\t\t\treturn stepMap.removedBlockIds.has(deco.blockId) ? null : deco;\n\t\tcase 'childIndexShift':\n\t\tcase 'moveNode':\n\t\t\t// Sibling-index shifts don't move text positions.\n\t\t\treturn deco;\n\t}\n}\n\nfunction mapInlineShift(deco: InlineDecoration, map: ShiftMap): InlineDecoration | null {\n\tif (deco.blockId !== map.blockId) return deco;\n\n\tconst fromPos = mapPositionThroughStep(createPosition(deco.blockId, deco.from), map, -1).pos;\n\tconst toPos = mapPositionThroughStep(createPosition(deco.blockId, deco.to), map, 1).pos;\n\n\tif (fromPos.offset >= toPos.offset) return null;\n\tif (fromPos.offset === deco.from && toPos.offset === deco.to) return deco;\n\treturn { ...deco, from: fromPos.offset, to: toPos.offset };\n}\n\nfunction mapInlineSplit(\n\tdeco: InlineDecoration,\n\tmap: SplitMap,\n): InlineDecoration | readonly InlineDecoration[] {\n\tif (deco.blockId !== map.blockId) return deco;\n\n\tif (deco.to <= map.offset) return deco;\n\n\tif (deco.from >= map.offset) {\n\t\treturn {\n\t\t\t...deco,\n\t\t\tblockId: map.newBlockId,\n\t\t\tfrom: deco.from - map.offset,\n\t\t\tto: deco.to - map.offset,\n\t\t};\n\t}\n\n\t// Spans the split — return both halves\n\tconst left: InlineDecoration = { ...deco, to: map.offset };\n\tconst right: InlineDecoration = {\n\t\t...deco,\n\t\tblockId: map.newBlockId,\n\t\tfrom: 0,\n\t\tto: deco.to - map.offset,\n\t};\n\treturn [left, right];\n}\n\nfunction mapInlineMerge(deco: InlineDecoration, map: MergeMap): InlineDecoration {\n\tif (deco.blockId !== map.sourceBlockId) return deco;\n\treturn {\n\t\t...deco,\n\t\tblockId: map.targetBlockId,\n\t\tfrom: deco.from + map.targetLengthBefore,\n\t\tto: deco.to + map.targetLengthBefore,\n\t};\n}\n\n// --- Widget ---\n\nfunction mapWidget(deco: WidgetDecoration, stepMap: StepMap): WidgetDecoration | null {\n\tswitch (stepMap.type) {\n\t\tcase 'identity':\n\t\t\treturn deco;\n\t\tcase 'shift':\n\t\t\treturn mapWidgetShift(deco, stepMap);\n\t\tcase 'split':\n\t\t\treturn mapWidgetSplit(deco, stepMap);\n\t\tcase 'merge':\n\t\t\treturn mapWidgetMerge(deco, stepMap);\n\t\tcase 'blockRemoval':\n\t\t\treturn stepMap.removedBlockIds.has(deco.blockId) ? null : deco;\n\t\tcase 'childIndexShift':\n\t\tcase 'moveNode':\n\t\t\treturn deco;\n\t}\n}\n\nfunction mapWidgetShift(deco: WidgetDecoration, map: ShiftMap): WidgetDecoration | null {\n\tif (deco.blockId !== map.blockId) return deco;\n\n\tconst result = mapPositionThroughStep(createPosition(deco.blockId, deco.offset), map, deco.side);\n\t// A widget that lands strictly inside removed content is deleted.\n\tif (result.deleted) return null;\n\tif (result.pos.offset === deco.offset) return deco;\n\treturn { ...deco, offset: result.pos.offset };\n}\n\nfunction mapWidgetSplit(deco: WidgetDecoration, map: SplitMap): WidgetDecoration {\n\tif (deco.blockId !== map.blockId) return deco;\n\tconst result = mapPositionThroughStep(createPosition(deco.blockId, deco.offset), map, deco.side);\n\tif (result.pos.blockId === deco.blockId && result.pos.offset === deco.offset) return deco;\n\treturn { ...deco, blockId: result.pos.blockId, offset: result.pos.offset };\n}\n\nfunction mapWidgetMerge(deco: WidgetDecoration, map: MergeMap): WidgetDecoration {\n\tif (deco.blockId !== map.sourceBlockId) return deco;\n\treturn {\n\t\t...deco,\n\t\tblockId: map.targetBlockId,\n\t\toffset: deco.offset + map.targetLengthBefore,\n\t};\n}\n\n// --- Node ---\n\nfunction mapNode(deco: NodeDecoration, stepMap: StepMap): NodeDecoration | null {\n\tswitch (stepMap.type) {\n\t\tcase 'identity':\n\t\tcase 'shift':\n\t\tcase 'split':\n\t\t\t// Node decorations are bound to a block; in-block content edits\n\t\t\t// and splits don't affect them. Splits keep the decoration on the\n\t\t\t// original block (the new block has no decoration of its own).\n\t\t\treturn deco;\n\t\tcase 'merge':\n\t\t\t// Source block disappears as a separate block → its decoration is dropped.\n\t\t\treturn deco.blockId === stepMap.sourceBlockId ? null : deco;\n\t\tcase 'blockRemoval':\n\t\t\treturn stepMap.removedBlockIds.has(deco.blockId) ? null : deco;\n\t\tcase 'childIndexShift':\n\t\tcase 'moveNode':\n\t\t\treturn deco;\n\t}\n}\n","/**\n * Decoration types and DecorationSet for transient, view-only annotations.\n * Decorations are NOT part of the document model and do NOT affect undo/redo.\n */\n\nimport type { PluginCallbackRegistration } from '../model/PluginCallbackExecutor.js';\nimport type { BlockId } from '../model/TypeBrands.js';\nimport type { Transaction } from '../state/Transaction.js';\nimport { mapDecorationThroughStepMap } from './PositionMapping.js';\n\n// --- Decoration Attrs ---\n\nexport interface DecorationAttrs {\n\treadonly class?: string;\n\treadonly style?: string;\n\treadonly nodeName?: string;\n\treadonly [key: string]: string | undefined;\n}\n\n// --- Decoration Types ---\n\nconst WIDGET_CALLBACK_OWNER: unique symbol = Symbol('notectl.widget-callback-owner');\n\nexport interface InlineDecoration {\n\treadonly type: 'inline';\n\treadonly blockId: BlockId;\n\treadonly from: number;\n\treadonly to: number;\n\treadonly attrs: DecorationAttrs;\n}\n\nexport interface NodeDecoration {\n\treadonly type: 'node';\n\treadonly blockId: BlockId;\n\treadonly attrs: DecorationAttrs;\n}\n\nexport interface WidgetDecoration {\n\treadonly type: 'widget';\n\treadonly blockId: BlockId;\n\treadonly offset: number;\n\treadonly toDOM: () => HTMLElement;\n\treadonly side: -1 | 1;\n\treadonly key?: string;\n\t/** Plugin ownership attached by PluginLifecycle before the decoration reaches the view. */\n\treadonly [WIDGET_CALLBACK_OWNER]?: PluginCallbackRegistration;\n}\n\nexport type Decoration = InlineDecoration | NodeDecoration | WidgetDecoration;\n\n/** Returns lifecycle-owned attribution for a widget renderer, when available. */\nexport function getWidgetCallbackOwner(\n\tdecoration: WidgetDecoration,\n): PluginCallbackRegistration | undefined {\n\treturn decoration[WIDGET_CALLBACK_OWNER];\n}\n\n// --- Factory Functions ---\n\n/** Creates an inline decoration for a text range within a block. */\nexport function inline(\n\tblockId: BlockId,\n\tfrom: number,\n\tto: number,\n\tattrs: DecorationAttrs,\n): InlineDecoration {\n\treturn { type: 'inline', blockId, from, to, attrs };\n}\n\n/** Creates a node decoration that applies to a whole block element. */\nexport function node(blockId: BlockId, attrs: DecorationAttrs): NodeDecoration {\n\treturn { type: 'node', blockId, attrs };\n}\n\n/** Creates a widget decoration that inserts a DOM element at a position. */\nexport function widget(\n\tblockId: BlockId,\n\toffset: number,\n\ttoDOM: () => HTMLElement,\n\toptions?: { readonly side?: -1 | 1; readonly key?: string },\n): WidgetDecoration {\n\treturn {\n\t\ttype: 'widget',\n\t\tblockId,\n\t\toffset,\n\t\ttoDOM,\n\t\tside: options?.side ?? -1,\n\t\tkey: options?.key,\n\t};\n}\n\n// --- DecorationSet ---\n\n/**\n * Immutable set of decorations indexed by block ID.\n * Provides efficient lookup and merging of decoration collections.\n */\nexport class DecorationSet {\n\tstatic readonly empty: DecorationSet = new DecorationSet(new Map());\n\n\tprivate constructor(private readonly byBlock: ReadonlyMap<BlockId, readonly Decoration[]>) {}\n\n\t/** Creates a DecorationSet from a flat array of decorations. */\n\tstatic create(decorations: readonly Decoration[]): DecorationSet {\n\t\tif (decorations.length === 0) return DecorationSet.empty;\n\n\t\tconst map = new Map<BlockId, Decoration[]>();\n\t\tfor (const deco of decorations) {\n\t\t\tconst existing = map.get(deco.blockId);\n\t\t\tif (existing) {\n\t\t\t\texisting.push(deco);\n\t\t\t} else {\n\t\t\t\tmap.set(deco.blockId, [deco]);\n\t\t\t}\n\t\t}\n\t\treturn new DecorationSet(map);\n\t}\n\n\t/** Returns all decorations for a given block. */\n\tfind(blockId: BlockId): readonly Decoration[] {\n\t\treturn this.byBlock.get(blockId) ?? [];\n\t}\n\n\t/** Returns only inline decorations for a given block. */\n\tfindInline(blockId: BlockId): readonly InlineDecoration[] {\n\t\tconst decos = this.byBlock.get(blockId);\n\t\tif (!decos) return [];\n\t\treturn decos.filter((d): d is InlineDecoration => d.type === 'inline');\n\t}\n\n\t/** Returns only node decorations for a given block. */\n\tfindNode(blockId: BlockId): readonly NodeDecoration[] {\n\t\tconst decos = this.byBlock.get(blockId);\n\t\tif (!decos) return [];\n\t\treturn decos.filter((d): d is NodeDecoration => d.type === 'node');\n\t}\n\n\t/** Returns only widget decorations for a given block. */\n\tfindWidget(blockId: BlockId): readonly WidgetDecoration[] {\n\t\tconst decos = this.byBlock.get(blockId);\n\t\tif (!decos) return [];\n\t\treturn decos.filter((d): d is WidgetDecoration => d.type === 'widget');\n\t}\n\n\t/** Returns a new DecorationSet with the given decorations added. */\n\tadd(decorations: readonly Decoration[]): DecorationSet {\n\t\tif (decorations.length === 0) return this;\n\t\tif (this.isEmpty) return DecorationSet.create(decorations);\n\n\t\tconst map = new Map<BlockId, Decoration[]>();\n\t\tfor (const [bid, decos] of this.byBlock) {\n\t\t\tmap.set(bid, [...decos]);\n\t\t}\n\t\tfor (const deco of decorations) {\n\t\t\tconst existing = map.get(deco.blockId);\n\t\t\tif (existing) {\n\t\t\t\texisting.push(deco);\n\t\t\t} else {\n\t\t\t\tmap.set(deco.blockId, [deco]);\n\t\t\t}\n\t\t}\n\t\treturn new DecorationSet(map);\n\t}\n\n\t/** Returns a new DecorationSet with decorations matching the predicate removed. */\n\tremove(predicate: (d: Decoration) => boolean): DecorationSet {\n\t\tconst map = new Map<BlockId, Decoration[]>();\n\t\tlet changed = false;\n\n\t\tfor (const [bid, decos] of this.byBlock) {\n\t\t\tconst filtered = decos.filter((d) => !predicate(d));\n\t\t\tif (filtered.length !== decos.length) changed = true;\n\t\t\tif (filtered.length > 0) {\n\t\t\t\tmap.set(bid, filtered);\n\t\t\t}\n\t\t}\n\n\t\tif (!changed) return this;\n\t\tif (map.size === 0) return DecorationSet.empty;\n\t\treturn new DecorationSet(map);\n\t}\n\n\t/** Returns a new DecorationSet merging this set with another. */\n\tmerge(other: DecorationSet): DecorationSet {\n\t\tif (other.isEmpty) return this;\n\t\tif (this.isEmpty) return other;\n\n\t\tconst map = new Map<BlockId, Decoration[]>();\n\t\tfor (const [bid, decos] of this.byBlock) {\n\t\t\tmap.set(bid, [...decos]);\n\t\t}\n\t\tfor (const [bid, decos] of other.byBlock) {\n\t\t\tconst existing = map.get(bid);\n\t\t\tif (existing) {\n\t\t\t\texisting.push(...decos);\n\t\t\t} else {\n\t\t\t\tmap.set(bid, [...decos]);\n\t\t\t}\n\t\t}\n\t\treturn new DecorationSet(map);\n\t}\n\n\t/** Attaches plugin attribution to widget callbacks without mutating plugin-owned objects. */\n\twithWidgetOwner(pluginId: string): DecorationSet {\n\t\tlet changed = false;\n\t\tconst map = new Map<BlockId, Decoration[]>();\n\t\tfor (const [bid, decorations] of this.byBlock) {\n\t\t\tconst attributed = decorations.map((decoration): Decoration => {\n\t\t\t\tif (decoration.type !== 'widget') return decoration;\n\t\t\t\tchanged = true;\n\t\t\t\treturn {\n\t\t\t\t\t...decoration,\n\t\t\t\t\t[WIDGET_CALLBACK_OWNER]: { pluginId, name: 'widget' },\n\t\t\t\t};\n\t\t\t});\n\t\t\tmap.set(bid, attributed);\n\t\t}\n\t\treturn changed ? new DecorationSet(map) : this;\n\t}\n\n\t/** Checks equality — reference first, then structural comparison. */\n\tequals(other: DecorationSet): boolean {\n\t\tif (this === other) return true;\n\t\tif (this.byBlock.size !== other.byBlock.size) return false;\n\n\t\tfor (const [bid, decos] of this.byBlock) {\n\t\t\tconst otherDecos = other.byBlock.get(bid);\n\t\t\tif (!otherDecos) return false;\n\t\t\tif (!decorationArraysEqual(decos, otherDecos)) return false;\n\t\t}\n\t\treturn true;\n\t}\n\n\t/** True if the set contains no decorations. */\n\tget isEmpty(): boolean {\n\t\treturn this.byBlock.size === 0;\n\t}\n\n\t/**\n\t * Maps decorations through document changes described by a transaction.\n\t * Decorations that become invalid (e.g. fully deleted range) are removed.\n\t * Decorations that span a split point are split into two.\n\t *\n\t * Iterates over `tr.mapping.maps` (the position-space {@link StepMap}s)\n\t * rather than `tr.steps`. This means selection-only or other identity\n\t * transactions short-circuit (`tr.mapping.isEmpty`) without rebuilding\n\t * the set, and the decoration-specific shape concerns (split-into-two,\n\t * drop-on-block-removal) are the only logic that lives here.\n\t */\n\tmap(tr: Transaction): DecorationSet {\n\t\tif (this.isEmpty || tr.mapping.isEmpty) return this;\n\n\t\tlet mapped: Decoration[] = [];\n\t\tfor (const decos of this.byBlock.values()) {\n\t\t\tfor (const d of decos) {\n\t\t\t\tmapped.push(d);\n\t\t\t}\n\t\t}\n\n\t\tfor (const stepMap of tr.mapping.maps) {\n\t\t\tconst next: Decoration[] = [];\n\t\t\tfor (const deco of mapped) {\n\t\t\t\tconst result = mapDecorationThroughStepMap(deco, stepMap);\n\t\t\t\tif (result === null) continue;\n\t\t\t\tif (Array.isArray(result)) {\n\t\t\t\t\tfor (const r of result) {\n\t\t\t\t\t\tnext.push(r);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tnext.push(result as Decoration);\n\t\t\t\t}\n\t\t\t}\n\t\t\tmapped = next;\n\t\t}\n\n\t\tif (mapped.length === 0) return DecorationSet.empty;\n\t\treturn DecorationSet.create(mapped);\n\t}\n}\n\n// --- Helpers ---\n\n/** Compares two decoration arrays for structural equality. */\nexport function decorationArraysEqual(a: readonly Decoration[], b: readonly Decoration[]): boolean {\n\tif (a === b) return true;\n\tif (a.length !== b.length) return false;\n\n\tfor (let i = 0; i < a.length; i++) {\n\t\tconst ai = a[i];\n\t\tconst bi = b[i];\n\t\tif (!ai || !bi || !decorationsEqual(ai, bi)) return false;\n\t}\n\treturn true;\n}\n\n/** Compares two individual decorations for structural equality. */\nfunction decorationsEqual(a: Decoration, b: Decoration): boolean {\n\tif (a.type !== b.type) return false;\n\tif (a.blockId !== b.blockId) return false;\n\n\tswitch (a.type) {\n\t\tcase 'inline': {\n\t\t\tconst bi = b as InlineDecoration;\n\t\t\treturn a.from === bi.from && a.to === bi.to && attrsEqual(a.attrs, bi.attrs);\n\t\t}\n\t\tcase 'node': {\n\t\t\tconst bn = b as NodeDecoration;\n\t\t\treturn attrsEqual(a.attrs, bn.attrs);\n\t\t}\n\t\tcase 'widget': {\n\t\t\tconst bw = b as WidgetDecoration;\n\t\t\tconst sameIdentity: boolean =\n\t\t\t\ta.key !== undefined || bw.key !== undefined ? a.key === bw.key : a.toDOM === bw.toDOM;\n\t\t\treturn a.offset === bw.offset && a.side === bw.side && a.key === bw.key && sameIdentity;\n\t\t}\n\t}\n}\n\n/** Compares two DecorationAttrs objects. */\nfunction attrsEqual(a: DecorationAttrs, b: DecorationAttrs): boolean {\n\tif (a === b) return true;\n\tconst aKeys = Object.keys(a);\n\tconst bKeys = Object.keys(b);\n\tif (aKeys.length !== bKeys.length) return false;\n\tfor (const key of aKeys) {\n\t\tif (a[key] !== b[key]) return false;\n\t}\n\treturn true;\n}\n"],"mappings":"yFAoNA,IAAa,EAA4B,OAAO,OAAO,CAAE,KAAM,aAUzD,EAAN,MACC,GAEA,WAAA,CAAY,GACX,MAAKA,EAAU,IAAI,IAAI,GACvB,OAAO,OAAO,KACf,CAEA,QAAI,GACH,OAAO,MAAKA,EAAQ,IACrB,CAEA,GAAA,CAAI,GACH,OAAO,MAAKA,EAAQ,IAAI,EACzB,CAEA,OAAA,GACC,OAAO,MAAKA,EAAQ,SACrB,CAEA,IAAA,GACC,OAAO,MAAKA,EAAQ,MACrB,CAEA,MAAA,GACC,OAAO,MAAKA,EAAQ,QACrB,CAEA,CAAC,OAAO,YACP,OAAO,MAAKA,EAAQ,OAAO,WAC5B,CAEA,OAAA,CAAQ,EAA8D,GACrE,IAAK,MAAM,KAAS,MAAKA,EAAS,EAAS,KAAK,EAAS,EAAO,EAAO,KACxE,CAEA,KAAA,CAAS;AACR,OAAO,IAAI,IAAW,IAAI,MAAKA,KAAY,EAAc,IAC1D,CAEA,YAAA,CAAgB,GACf,MAAM,EAAc,EAAc,GAC5B,iBAAe,IAAI,IACzB,IAAK,MAAM,KAAS,MAAKA,EACpB,EAAY,EAAa,IAAQ,EAAa,IAAI,GAEvD,OA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EAAK,EACX,OAAO,EAAW,EAAE,MAAO,EAAG,MAC/B,CACA,IAAK,SAAU,CACd,MAAM,EAAK,EACL,OACK,IAAV,EAAE,UAAgC,IAAX,EAAG,IAAoB,EAAE,MAAQ,EAAG,IAAM,EAAE,QAAU,EAAG,MACjF,OAAO,EAAE,SAAW,EAAG,QAAU,EAAE,OAAS,EAAG,MAAQ,EAAE,MAAQ,EAAG,KAAO,CAC5E,EAEF,CAGA,SAAS,EAAW,EAAoB,GACvC,GAAI,IAAM,EAAG,OAAO,EACpB,MAAM,EAAQ,OAAO,KAAK,GACpB,EAAQ,OAAO,KAAK,GAC1B,GAAI,EAAM,SAAW,EAAM,OAAQ,OAAO,EAC1C,IAAK,MAAM,KAAO,EACjB,GAAI,EAAE,KAAS,EAAE,GAAM,OAAO,EAE/B,OAAO,CACR"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DirectionDetection-ZrkMhyaL.mjs","names":[],"sources":["../../src/plugins/text-direction/DirectionDetection.ts"],"sourcesContent":["/**\n * Direction detection utilities for the TextDirectionPlugin.\n * Detects text direction based on the first strong directional character\n * and finds sibling block direction for inheritance.\n */\n\nimport { type BlockNode, isBlockNode } from '../../model/Document.js';\nimport type { BlockId } from '../../model/TypeBrands.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { TextDirection } from './TextDirectionPlugin.js';\n\n// --- RTL Detection ---\n\n/**\n * Regex matching strong RTL characters using Unicode Script property escapes.\n * Auto-maintained by the Unicode standard — no manual code-point ranges needed.\n * Covers all RTL scripts: Hebrew, Arabic, Syriac, Thaana, N'Ko, Samaritan,\n * Mandaic, Adlam, Hanifi Rohingya, Mende Kikakui, Yezidi, and historic scripts.\n * Includes U+200F (RLM) and U+061C (ALM) as strong directional markers.\n */\nconst RTL_CHAR_RE: RegExp =\n\t/[\\p{Script=Hebrew}\\p{Script=Arabic}\\p{Script=Syriac}\\p{Script=Thaana}\\p{Script=Mandaic}\\p{Script=Nko}\\p{Script=Samaritan}\\p{Script=Adlam}\\p{Script=Hanifi_Rohingya}\\p{Script=Mende_Kikakui}\\p{Script=Yezidi}\\p{Script=Old_South_Arabian}\\p{Script=Old_North_Arabian}\\p{Script=Avestan}\\p{Script=Imperial_Aramaic}\\p{Script=Phoenician}\\p{Script=Lydian}\\u200F\\u061C]/u;\n\n/**\n * Regex matching strong LTR characters using Unicode Script property escapes.\n * Covers all major LTR scripts: Latin, Greek, Cyrillic, Armenian, Indic scripts,\n * Southeast Asian scripts, East Asian scripts, Georgian, Ethiopic, and more.\n * Includes U+200E (LRM) as a strong directional marker.\n */\nconst LTR_CHAR_RE: RegExp =\n\t/[\\p{Script=Latin}\\p{Script=Greek}\\p{Script=Cyrillic}\\p{Script=Armenian}\\p{Script=Devanagari}\\p{Script=Bengali}\\p{Script=Gurmukhi}\\p{Script=Gujarati}\\p{Script=Oriya}\\p{Script=Tamil}\\p{Script=Telugu}\\p{Script=Kannada}\\p{Script=Malayalam}\\p{Script=Sinhala}\\p{Script=Thai}\\p{Script=Lao}\\p{Script=Tibetan}\\p{Script=Myanmar}\\p{Script=Georgian}\\p{Script=Hangul}\\p{Script=Hiragana}\\p{Script=Katakana}\\p{Script=Han}\\p{Script=Ethiopic}\\p{Script=Cherokee}\\p{Script=Khmer}\\u200E]/u;\n\n/**\n * Detects the dominant text direction based on the first strong directional character.\n * Returns `null` if no strong character is found (all neutral/numeric/whitespace).\n */\nexport function detectTextDirection(text: string): TextDirection | null {\n\tconst rtlIdx: number = text.search(RTL_CHAR_RE);\n\tconst ltrIdx: number = text.search(LTR_CHAR_RE);\n\n\tif (rtlIdx === -1 && ltrIdx === -1) return null;\n\tif (rtlIdx === -1) return 'ltr';\n\tif (ltrIdx === -1) return 'rtl';\n\treturn rtlIdx < ltrIdx ? 'rtl' : 'ltr';\n}\n\n// --- Block Direction Accessor ---\n\n/** Returns the current `dir` attribute of a block, defaulting to `'auto'`. */\nexport function getBlockDir(block: BlockNode): TextDirection {\n\tconst dir: unknown = block.attrs?.dir;\n\tif (dir === 'ltr' || dir === 'rtl') return dir;\n\treturn 'auto';\n}\n\n// --- Sibling Direction Lookup ---\n\n/**\n * Finds the `dir` attribute of the nearest sibling with an explicit direction\n * (not `'auto'`) before the insert position, walking backwards.\n */\nexport function findSiblingDirection(\n\tstate: EditorState,\n\tparentPath: readonly BlockId[],\n\tindex: number,\n): TextDirection | undefined {\n\tconst siblings: readonly BlockNode[] = getSiblings(state, parentPath);\n\n\t// Walk backward first (preceding siblings take priority)\n\tfor (let i: number = index - 1; i >= 0; i--) {\n\t\tconst dir: unknown = siblings[i]?.attrs?.dir;\n\t\tif (dir === 'ltr' || dir === 'rtl') return dir;\n\t}\n\n\t// Walk forward when no backward sibling has explicit direction\n\tfor (let i: number = index; i < siblings.length; i++) {\n\t\tconst dir: unknown = siblings[i]?.attrs?.dir;\n\t\tif (dir === 'ltr' || dir === 'rtl') return dir;\n\t}\n\n\treturn undefined;\n}\n\n/** Returns the sibling list for the given parent path. */\nfunction getSiblings(state: EditorState, parentPath: readonly BlockId[]): readonly BlockNode[] {\n\tif (parentPath.length === 0) {\n\t\treturn state.doc.children;\n\t}\n\n\tconst parentId: BlockId | undefined = parentPath[parentPath.length - 1];\n\tif (!parentId) return [];\n\tconst parent: BlockNode | undefined = state.getBlock(parentId);\n\tif (!parent) return [];\n\n\treturn parent.children.filter(isBlockNode);\n}\n"],"mappings":"4CAoBA,IAAM,EACL,wWAQK,EACL,udAMD,SAAgB,EAAoB,GACnC,MAAM,EAAiB,EAAK,OAAO,GAC7B,EAAiB,EAAK,OAAO,GAEnC,OAAe,IAAX,IAA4B,IAAX,EAAsB,MAC5B,IAAX,EAAsB,OACX,IAAX,GACG,EAAS,EADU,MACO,KAClC,CAKA,SAAgB,EAAY,GAC3B,MAAM,EAAe,EAAM,OAAO,IAClC,MAAY,QAAR,GAAyB,QAAR,EAAsB,EACpC,MACR,CAQA,SAAgB,EACf,EACA,EACA,GAEA,MAAM,EAkBP,SAAqB,EAAoB,GACxC,GAA0B,IAAtB,EAAW,OACd,OAAO,EAAM,IAAI,SAGlB,MAAM,EAAgC,EAAW,EAAW,OAAS,GACrE,IAAK,EAAU,MAAO,GACtB,MAAM,EAAgC,EAAM,SAAS,GACrD,OAAK,EAEE,EAAO,SAAS,OAAO,GAFV,EAGrB,CA7BwC,CAAY,EAAO,GAG1D,IAAK,IAAI,EAAY,EAAQ,EAAG,GAAK,EAAG,IAAK,CAC5C,MAAM,EAAe,EAAS,IAAI,OAAO,IACzC,GAAY,QAAR,GAAyB,QAAR,EAAe,OAAO,CAC5C,CAGA,IAAK,IAAI,EAAY,EAAO,EAAI,EAAS,OAAQ,IAAK,CACrD,MAAM,EAAe,EAAS,IAAI,OAAO,IACzC,GAAY,QAAR,GAAyB,QAAR,EAAe,OAAO,CAC5C,CAGD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Document-D_2cIBJG.mjs","names":[],"sources":["../../src/model/Document.ts"],"sourcesContent":["/**\n * Core document model types for the Notectl editor.\n * All types are deeply readonly — mutations create new instances.\n */\n\nimport { normalizeHTMLId } from './HTMLUtils.js';\nimport type { BlockId, InlineTypeName, MarkTypeName, NodeTypeName } from './TypeBrands.js';\n\n// --- Mark Types ---\n\nexport interface Mark {\n\treadonly type: MarkTypeName;\n\treadonly attrs?: Readonly<Record<string, string | number | boolean>>;\n}\n\nexport interface BoldMark extends Mark {\n\treadonly type: MarkTypeName & 'bold';\n}\n\nexport interface ItalicMark extends Mark {\n\treadonly type: MarkTypeName & 'italic';\n}\n\nexport interface UnderlineMark extends Mark {\n\treadonly type: MarkTypeName & 'underline';\n}\n\n// --- Node Types ---\n\n/** JSON-compatible primitive stored in a block attribute. */\nexport type BlockAttrPrimitive = string | number | boolean | null;\n\n/** Scalar member permitted inside a structured block-attribute array. */\nexport type BlockAttrArrayValue = BlockAttrPrimitive;\n\n/**\n * Immutable JSON-compatible block attribute value.\n *\n * Marks and inline nodes intentionally retain their scalar-only attributes.\n * Block nodes may additionally own structured state (for example a table's\n * logical column-width vector) without encoding it in delimiter strings.\n */\nexport type BlockAttrValue = Exclude<BlockAttrPrimitive, null> | readonly BlockAttrArrayValue[];\n\nexport interface BlockAttrs {\n\treadonly [key: string]: BlockAttrValue;\n}\n\nexport interface TextNode {\n\treadonly type: 'text';\n\treadonly text: string;\n\treadonly marks: readonly Mark[];\n}\n\n/** Atomic inline element (width 1 in offset space). */\nexport interface InlineNode {\n\treadonly type: 'inline';\n\treadonly inlineType: InlineTypeName;\n\treadonly attrs: Readonly<Record<string, string | number | boolean>>;\n\t/**\n\t * Marks applied to this atomic node (e.g. a `link` on an inline image). Inline\n\t * nodes carry marks just like text nodes do, so a linked inline image survives\n\t * import, export, and rendering without the link being dropped.\n\t */\n\treadonly marks: readonly Mark[];\n}\n\n/** A child of a BlockNode: text, inline element, or nested block. */\nexport type ChildNode = TextNode | InlineNode | BlockNode;\n\nexport interface BlockNode {\n\t/** Internal editor identity, serialized to HTML as `data-block-id`. */\n\treadonly id: BlockId;\n\t/** Optional document-local HTML target, serialized to the block element's `id` attribute. */\n\treadonly htmlId?: string;\n\treadonly type: NodeTypeName;\n\treadonly attrs?: BlockAttrs;\n\treadonly children: readonly ChildNode[];\n}\n\nexport interface Document {\n\treadonly children: readonly BlockNode[];\n}\n\n// --- Text Segment (for mark-preserving undo) ---\n\nexport interface TextSegment {\n\treadonly text: string;\n\treadonly marks: readonly Mark[];\n}\n\n/** A content segment: either text (with marks) or an inline node. */\nexport type ContentSegment =\n\t| { readonly kind: 'text'; readonly text: string; readonly marks: readonly Mark[] }\n\t| { readonly kind: 'inline'; readonly node: InlineNode };\n\n/** Creates a text {@link ContentSegment}. */\nexport function textSegment(text: string, marks: readonly Mark[] = []): ContentSegment {\n\treturn { kind: 'text', text, marks };\n}\n\n/** Creates an inline {@link ContentSegment} wrapping an {@link InlineNode}. */\nexport function inlineSegment(node: InlineNode): ContentSegment {\n\treturn { kind: 'inline', node };\n}\n\n/** Returns content segments (text and inline) for a block range. */\nexport function getBlockContentSegmentsInRange(\n\tblock: BlockNode,\n\tfrom: number,\n\tto: number,\n): readonly ContentSegment[] {\n\tconst segments: ContentSegment[] = [];\n\tforEachInlineChildInRange(block, from, to, {\n\t\tonText(text: string, marks: readonly Mark[]): void {\n\t\t\tsegments.push({ kind: 'text', text, marks });\n\t\t},\n\t\tonInline(node: InlineNode): void {\n\t\t\tsegments.push({ kind: 'inline', node });\n\t\t},\n\t});\n\treturn segments;\n}\n\n/** Visitor callbacks invoked by {@link forEachInlineChildInRange} for each in-range child. */\nexport interface BlockRangeVisitor {\n\t/** Called with the clipped text and its marks for each text node overlapping the range. */\n\treadonly onText: (text: string, marks: readonly Mark[]) => void;\n\t/** Called for each inline node falling within the range. */\n\treadonly onInline?: (node: InlineNode) => void;\n}\n\n/**\n * Walks the inline children of `block` overlapping `[from, to)` and invokes the\n * matching visitor callback for each. Text nodes are clipped to the range before\n * `onText` fires; empty slices are skipped. This is the single read-only walker\n * for range-based inline serialization (segments, HTML, clipboard).\n */\nexport function forEachInlineChildInRange(\n\tblock: BlockNode,\n\tfrom: number,\n\tto: number,\n\tvisitor: BlockRangeVisitor,\n): void {\n\tfor (const { child, from: childFrom, to: childEnd } of walkInlineContent(\n\t\tgetInlineChildren(block),\n\t)) {\n\t\tif (childEnd <= from || childFrom >= to) continue;\n\n\t\tif (isInlineNode(child)) {\n\t\t\tvisitor.onInline?.(child);\n\t\t} else {\n\t\t\tconst sliceFrom: number = Math.max(0, from - childFrom);\n\t\t\tconst sliceTo: number = Math.min(child.text.length, to - childFrom);\n\t\t\tconst text: string = child.text.slice(sliceFrom, sliceTo);\n\t\t\tif (text.length > 0) {\n\t\t\t\tvisitor.onText(text, child.marks);\n\t\t\t}\n\t\t}\n\t}\n}\n\n// --- Type Guards ---\n\n/** Checks whether a value is a {@link TextNode}. */\nexport function isTextNode(node: unknown): node is TextNode {\n\treturn (\n\t\ttypeof node === 'object' &&\n\t\tnode !== null &&\n\t\t(node as TextNode).type === 'text' &&\n\t\ttypeof (node as TextNode).text === 'string'\n\t);\n}\n\n/** Checks whether a value is an {@link InlineNode}. */\nexport function isInlineNode(node: unknown): node is InlineNode {\n\treturn (\n\t\ttypeof node === 'object' &&\n\t\tnode !== null &&\n\t\t(node as InlineNode).type === 'inline' &&\n\t\ttypeof (node as InlineNode).inlineType === 'string'\n\t);\n}\n\n/** Checks whether a value is a {@link BlockNode}. */\nexport function isBlockNode(node: unknown): node is BlockNode {\n\treturn (\n\t\ttypeof node === 'object' &&\n\t\tnode !== null &&\n\t\ttypeof (node as BlockNode).id === 'string' &&\n\t\ttypeof (node as BlockNode).type === 'string' &&\n\t\t(node as BlockNode).type !== ('text' as string) &&\n\t\t(node as BlockNode).type !== ('inline' as string) &&\n\t\tArray.isArray((node as BlockNode).children)\n\t);\n}\n\n// --- Child Node Helpers ---\n\n/** Returns true if a block has only inline content (TextNodes and InlineNodes). */\nexport function isLeafBlock(node: BlockNode): boolean {\n\treturn node.children.every((c) => isTextNode(c) || isInlineNode(c));\n}\n\n/** Returns only the TextNode children of a block. */\nexport function getTextChildren(node: BlockNode): readonly TextNode[] {\n\treturn node.children.filter((c): c is TextNode => isTextNode(c));\n}\n\n/** Returns the inline content children (TextNode | InlineNode) of a block. */\nexport function getInlineChildren(node: BlockNode): readonly (TextNode | InlineNode)[] {\n\treturn node.children.filter((c): c is TextNode | InlineNode => isTextNode(c) || isInlineNode(c));\n}\n\n/** Returns only the BlockNode children of a block. */\nexport function getBlockChildren(node: BlockNode): readonly BlockNode[] {\n\treturn node.children.filter((c): c is BlockNode => isBlockNode(c));\n}\n\n// --- Factory Functions ---\n\n/** Generates a unique block ID using crypto.randomUUID(). */\nexport function generateBlockId(): BlockId {\n\treturn `block-${crypto.randomUUID()}` as BlockId;\n}\n\n/** Creates a new empty {@link Document} with a single empty paragraph. */\nexport function createDocument(children?: readonly BlockNode[]): Document {\n\treturn {\n\t\tchildren: children ? [...children] : [createBlockNode('paragraph' as NodeTypeName)],\n\t};\n}\n\n/** Creates a new {@link BlockNode}. */\nexport function createBlockNode(\n\ttype: NodeTypeName,\n\tchildren?: readonly ChildNode[],\n\tid?: BlockId,\n\tattrs?: BlockAttrs,\n\thtmlId?: string,\n): BlockNode {\n\tconst normalizedHTMLId: string | undefined = normalizeHTMLId(htmlId);\n\treturn {\n\t\tid: id ?? generateBlockId(),\n\t\t...(normalizedHTMLId ? { htmlId: normalizedHTMLId } : {}),\n\t\ttype,\n\t\t...(attrs ? { attrs: cloneBlockAttrs(attrs) } : {}),\n\t\tchildren: children ? [...children] : [createTextNode('')],\n\t};\n}\n\n/** Creates a new {@link TextNode}. */\nexport function createTextNode(text: string, marks?: readonly Mark[]): TextNode {\n\treturn {\n\t\ttype: 'text',\n\t\ttext,\n\t\tmarks: cloneMarks(marks ?? []),\n\t};\n}\n\n/** Creates a new {@link InlineNode}. */\nexport function createInlineNode(\n\tinlineType: InlineTypeName,\n\tattrs?: Readonly<Record<string, string | number | boolean>>,\n\tmarks?: readonly Mark[],\n): InlineNode {\n\treturn {\n\t\ttype: 'inline',\n\t\tinlineType,\n\t\tattrs: attrs ? { ...attrs } : {},\n\t\tmarks: cloneMarks(marks ?? []),\n\t};\n}\n\n/** Creates an empty paragraph block node with the given ID. */\nexport function createEmptyParagraph(id?: BlockId): BlockNode {\n\treturn createBlockNode('paragraph' as NodeTypeName, [createTextNode('')], id);\n}\n\n// --- Snapshot Ownership -------------------------------------------------\n\n// `Object.isFrozen` is shallow and therefore cannot prove our deep-immutability\n// invariant for external values. These private brands are added only after a\n// complete traversal, allowing persistent state to skip verified shared\n// subtrees without trusting caller-applied shallow freezes.\nconst VERIFIED_DOCUMENTS = new WeakSet<Document>();\nconst VERIFIED_BLOCKS = new WeakSet<BlockNode>();\nconst VERIFIED_BLOCK_ATTRS = new WeakSet<BlockAttrs>();\nconst VERIFIED_MARKS = new WeakSet<Mark>();\nconst VERIFIED_MARK_LISTS = new WeakSet<readonly Mark[]>();\nconst VERIFIED_INLINE_NODES = new WeakSet<InlineNode>();\nconst VERIFIED_TEXT_NODES = new WeakSet<TextNode>();\nconst VERIFIED_SEGMENT_LISTS = new WeakSet<readonly ContentSegment[]>();\n\n/**\n * Creates a fully detached document snapshot.\n *\n * Public JSON boundaries use this instead of exposing the structurally shared\n * objects owned by an {@link EditorState}. Besides child arrays, attribute\n * records, structured block attributes, marks, and mark attributes are copied.\n */\nexport function cloneDocument(doc: Document): Document {\n\treturn { ...doc, children: doc.children.map(cloneBlockNode) };\n}\n\n/** Creates a fully detached block snapshot, preserving its stable block ID. */\nexport function cloneBlockNode(block: BlockNode): BlockNode {\n\tconst attrs: BlockAttrs | undefined = block.attrs ? cloneBlockAttrs(block.attrs) : undefined;\n\treturn {\n\t\t...block,\n\t\t...(attrs ? { attrs } : {}),\n\t\tchildren: block.children.map(cloneChildNode),\n\t};\n}\n\n/** Creates a detached mark set, including each mark's attribute record. */\nexport function cloneMarks(marks: readonly Mark[]): Mark[] {\n\treturn marks.map(cloneMark);\n}\n\n/** Creates a detached mark, including its attribute record. */\nexport function cloneMark(mark: Mark): Mark {\n\treturn {\n\t\t...mark,\n\t\t...(mark.attrs ? { attrs: { ...mark.attrs } } : {}),\n\t};\n}\n\n/** Creates a detached inline node, including attrs, marks, and mark attrs. */\nexport function cloneInlineNode(node: InlineNode): InlineNode {\n\treturn {\n\t\t...node,\n\t\tattrs: { ...node.attrs },\n\t\tmarks: cloneMarks(node.marks),\n\t};\n}\n\n/** Creates a detached content-segment payload for transaction/history ownership. */\nexport function cloneContentSegment(segment: ContentSegment): ContentSegment {\n\treturn segment.kind === 'text'\n\t\t? { ...segment, marks: cloneMarks(segment.marks) }\n\t\t: { ...segment, node: cloneInlineNode(segment.node) };\n}\n\n/** Creates a detached list of content-segment payloads. */\nexport function cloneContentSegments(segments: readonly ContentSegment[]): ContentSegment[] {\n\treturn segments.map(cloneContentSegment);\n}\n\n/**\n * Freezes a document and every mutable collection reachable from it.\n *\n * Already-frozen nodes are skipped. This keeps transaction application\n * proportional to the changed branch because unchanged subtrees are\n * structurally shared between states.\n */\nexport function freezeDocument(doc: Document): Document {\n\tif (VERIFIED_DOCUMENTS.has(doc)) return doc;\n\tfor (const block of doc.children) freezeBlockNode(block);\n\tif (!Object.isFrozen(doc.children)) Object.freeze(doc.children);\n\tif (!Object.isFrozen(doc)) Object.freeze(doc);\n\tVERIFIED_DOCUMENTS.add(doc);\n\treturn doc;\n}\n\nfunction cloneChildNode(child: ChildNode): ChildNode {\n\tif (isTextNode(child)) {\n\t\tconst marks: readonly Mark[] | undefined = Array.isArray(child.marks)\n\t\t\t? cloneMarks(child.marks)\n\t\t\t: undefined;\n\t\treturn {\n\t\t\t...child,\n\t\t\t...(marks ? { marks } : {}),\n\t\t};\n\t}\n\tif (isInlineNode(child)) {\n\t\treturn cloneInlineNode(child);\n\t}\n\treturn cloneBlockNode(child);\n}\n\n/** Creates a detached block-attribute record, including structured array values. */\nexport function cloneBlockAttrs(attrs: BlockAttrs): BlockAttrs {\n\tconst copy: Record<string, BlockAttrValue> = {};\n\tfor (const [key, value] of Object.entries(attrs)) {\n\t\tcopy[key] = Array.isArray(value) ? [...value] : value;\n\t}\n\treturn copy;\n}\n\n/** Deep-freezes one detached block snapshot in place. */\nexport function freezeBlockNode(block: BlockNode): void {\n\tif (VERIFIED_BLOCKS.has(block)) return;\n\tif (block.attrs) freezeBlockAttrs(block.attrs);\n\tfor (const child of block.children) {\n\t\tif (isTextNode(child) || isInlineNode(child)) {\n\t\t\tfreezeInlineChild(child);\n\t\t} else {\n\t\t\tfreezeBlockNode(child);\n\t\t}\n\t}\n\tif (!Object.isFrozen(block.children)) Object.freeze(block.children);\n\tif (!Object.isFrozen(block)) Object.freeze(block);\n\tVERIFIED_BLOCKS.add(block);\n}\n\n/** Deep-freezes a block-attribute record in place. */\nexport function freezeBlockAttrs(attrs: BlockAttrs): void {\n\tif (VERIFIED_BLOCK_ATTRS.has(attrs)) return;\n\tfor (const value of Object.values(attrs)) {\n\t\tif (Array.isArray(value) && !Object.isFrozen(value)) Object.freeze(value);\n\t}\n\tif (!Object.isFrozen(attrs)) Object.freeze(attrs);\n\tVERIFIED_BLOCK_ATTRS.add(attrs);\n}\n\n/** Deep-freezes a mark and its attrs in place. */\nexport function freezeMark(mark: Mark): void {\n\tif (VERIFIED_MARKS.has(mark)) return;\n\tif (mark.attrs && !Object.isFrozen(mark.attrs)) Object.freeze(mark.attrs);\n\tif (!Object.isFrozen(mark)) Object.freeze(mark);\n\tVERIFIED_MARKS.add(mark);\n}\n\n/** Deep-freezes a mark list in place. */\nexport function freezeMarks(marks: readonly Mark[]): void {\n\tif (VERIFIED_MARK_LISTS.has(marks)) return;\n\tfor (const mark of marks) freezeMark(mark);\n\tif (!Object.isFrozen(marks)) Object.freeze(marks);\n\tVERIFIED_MARK_LISTS.add(marks);\n}\n\n/** Deep-freezes an inline node and all of its payload records in place. */\nexport function freezeInlineNode(node: InlineNode): void {\n\tif (VERIFIED_INLINE_NODES.has(node)) return;\n\tif (!Object.isFrozen(node.attrs)) Object.freeze(node.attrs);\n\tfreezeMarks(node.marks);\n\tif (!Object.isFrozen(node)) Object.freeze(node);\n\tVERIFIED_INLINE_NODES.add(node);\n}\n\n/** Deep-freezes transaction/history content-segment payloads in place. */\nexport function freezeContentSegments(segments: readonly ContentSegment[]): void {\n\tif (VERIFIED_SEGMENT_LISTS.has(segments)) return;\n\tfor (const segment of segments) {\n\t\tif (segment.kind === 'text') freezeMarks(segment.marks);\n\t\telse freezeInlineNode(segment.node);\n\t\tif (!Object.isFrozen(segment)) Object.freeze(segment);\n\t}\n\tif (!Object.isFrozen(segments)) Object.freeze(segments);\n\tVERIFIED_SEGMENT_LISTS.add(segments);\n}\n\nfunction freezeInlineChild(child: TextNode | InlineNode): void {\n\tif (isInlineNode(child)) {\n\t\tfreezeInlineNode(child);\n\t\treturn;\n\t}\n\tif (VERIFIED_TEXT_NODES.has(child)) return;\n\tfreezeMarks(child.marks);\n\tif (!Object.isFrozen(child)) Object.freeze(child);\n\tVERIFIED_TEXT_NODES.add(child);\n}\n\n// --- Utility Functions ---\n\n/** Extracts plain text from a block (InlineNodes are skipped). */\nexport function getBlockText(block: BlockNode): string {\n\tconst inlineChildren: readonly (TextNode | InlineNode)[] = getInlineChildren(block);\n\tlet text = '';\n\tfor (const child of inlineChildren) {\n\t\tif (isTextNode(child)) {\n\t\t\ttext += child.text;\n\t\t}\n\t}\n\treturn text;\n}\n\n/** Returns the length of a block's inline content (InlineNodes count as 1). */\nexport function getBlockLength(block: BlockNode): number {\n\tlet len = 0;\n\tfor (const { to } of walkInlineContent(getInlineChildren(block))) {\n\t\tlen = to;\n\t}\n\treturn len;\n}\n\n/** Returns the marks active at the given offset (empty for InlineNode offsets). */\nexport function getBlockMarksAtOffset(block: BlockNode, offset: number): readonly Mark[] {\n\tconst inlineChildren: readonly (TextNode | InlineNode)[] = getInlineChildren(block);\n\n\tfor (const { child, from, to } of walkInlineContent(inlineChildren)) {\n\t\tif (isInlineNode(child)) {\n\t\t\tif (offset === from) return [];\n\t\t\tcontinue;\n\t\t}\n\t\tif (offset >= from && offset < to) {\n\t\t\treturn child.marks;\n\t\t}\n\t\t// Empty text node (from === to): match exactly at its position.\n\t\tif (offset === from && child.text.length === 0) {\n\t\t\treturn child.marks;\n\t\t}\n\t}\n\n\t// Fall back to last text child's marks\n\tfor (let i: number = inlineChildren.length - 1; i >= 0; i--) {\n\t\tconst child: TextNode | InlineNode | undefined = inlineChildren[i];\n\t\tif (child && isTextNode(child)) {\n\t\t\treturn child.marks;\n\t\t}\n\t}\n\treturn [];\n}\n\n/** Returns the marks of the text content immediately to the right of `offset`. */\nfunction getMarksAfterOffset(block: BlockNode, offset: number): readonly Mark[] {\n\tfor (const { child, from, to } of walkInlineContent(getInlineChildren(block))) {\n\t\tif (isInlineNode(child)) {\n\t\t\tif (offset === from) return [];\n\t\t\tcontinue;\n\t\t}\n\t\tif (offset >= from && offset < to) return child.marks;\n\t}\n\treturn [];\n}\n\n/**\n * Returns the marks that text typed at a collapsed cursor should carry.\n *\n * Marks are derived from the content around `offset` (via\n * {@link getBlockMarksAtOffset}). A mark whose spec is non-inclusive\n * (`isMarkInclusive` returns `false`) is only kept when it also covers the\n * content to the right of the cursor, so it never bleeds past its right\n * boundary onto newly typed text. Inclusive marks (the default) are unaffected.\n */\nexport function getCursorMarks(\n\tblock: BlockNode,\n\toffset: number,\n\tisMarkInclusive: (type: MarkTypeName) => boolean,\n): readonly Mark[] {\n\tconst marks: readonly Mark[] = getBlockMarksAtOffset(block, offset);\n\tif (marks.length === 0) return marks;\n\n\tconst after: readonly Mark[] = getMarksAfterOffset(block, offset);\n\treturn marks.filter(\n\t\t(mark) => isMarkInclusive(mark.type) || after.some((a) => marksEqual(a, mark)),\n\t);\n}\n\n/** Checks whether two marks are equal by type and attrs. */\nexport function marksEqual(a: Mark, b: Mark): boolean {\n\tif (a.type !== b.type) return false;\n\tconst aAttrs = a.attrs;\n\tconst bAttrs = b.attrs;\n\tif (!aAttrs && !bAttrs) return true;\n\tif (!aAttrs || !bAttrs) return false;\n\tconst aKeys = Object.keys(aAttrs);\n\tconst bKeys = Object.keys(bAttrs);\n\tif (aKeys.length !== bKeys.length) return false;\n\treturn aKeys.every((key) => aAttrs[key] === bAttrs[key]);\n}\n\n/** Deep equality for immutable, JSON-compatible block attribute values. */\nexport function blockAttrValuesEqual(\n\ta: BlockAttrValue | undefined,\n\tb: BlockAttrValue | undefined,\n): boolean {\n\tif (a === b) return true;\n\tif (a === undefined || b === undefined || a === null || b === null) return false;\n\tif (Array.isArray(a) || Array.isArray(b)) {\n\t\tif (!Array.isArray(a) || !Array.isArray(b) || a.length !== b.length) return false;\n\t\treturn a.every((value, index) => value === b[index]);\n\t}\n\treturn false;\n}\n\n/** Deep equality for block attribute records. */\nexport function blockAttrsEqual(a: BlockAttrs | undefined, b: BlockAttrs | undefined): boolean {\n\tif (a === b) return true;\n\tif (!a || !b) return false;\n\tconst aKeys: readonly string[] = Object.keys(a);\n\tconst bKeys: readonly string[] = Object.keys(b);\n\tif (aKeys.length !== bKeys.length) return false;\n\treturn aKeys.every((key) => blockAttrValuesEqual(a[key], b[key]));\n}\n\n/** Checks whether two mark arrays contain the same marks (order-independent). */\nexport function markSetsEqual(a: readonly Mark[], b: readonly Mark[]): boolean {\n\tif (a.length !== b.length) return false;\n\treturn a.every((markA) => b.some((markB) => marksEqual(markA, markB)));\n}\n\n/** Returns true if the mark set contains a mark of the given type. */\nexport function hasMark(marks: readonly Mark[], markType: MarkTypeName): boolean {\n\treturn marks.some((m) => m.type === markType);\n}\n\n/** Adds a mark to a mark set (no duplicates). */\nexport function addMarkToSet(marks: readonly Mark[], mark: Mark): readonly Mark[] {\n\tif (hasMark(marks, mark.type)) return marks;\n\treturn [...marks, mark];\n}\n\n/** Removes a mark type from a mark set. */\nexport function removeMarkFromSet(marks: readonly Mark[], markType: MarkTypeName): readonly Mark[] {\n\treturn marks.filter((m) => m.type !== markType);\n}\n\n/**\n * Normalizes text nodes within a block: merges adjacent nodes with identical marks,\n * removes empty text nodes (keeping at least one).\n */\nexport function normalizeTextNodes(nodes: readonly TextNode[]): readonly TextNode[] {\n\tif (nodes.length === 0) return [createTextNode('')];\n\n\tconst result: TextNode[] = [];\n\tfor (const node of nodes) {\n\t\tconst prev: TextNode | undefined = result[result.length - 1];\n\t\tif (prev && markSetsEqual(prev.marks, node.marks)) {\n\t\t\tresult[result.length - 1] = createTextNode(prev.text + node.text, prev.marks);\n\t\t} else if (node.text.length > 0 || result.length === 0) {\n\t\t\tresult.push(node);\n\t\t}\n\t}\n\n\treturn result.length === 0 ? [createTextNode('')] : result;\n}\n\n/**\n * Normalizes mixed inline content: merges adjacent TextNodes with same marks,\n * removes empty TextNodes adjacent to InlineNodes, preserves InlineNodes as-is.\n * Guarantees at least one TextNode exists if all text is empty.\n */\nexport function normalizeInlineContent(\n\tnodes: readonly (TextNode | InlineNode)[],\n): readonly (TextNode | InlineNode)[] {\n\tif (nodes.length === 0) return [createTextNode('')];\n\n\t// Fast path: no InlineNodes, delegate to normalizeTextNodes\n\tif (nodes.every((n): n is TextNode => isTextNode(n))) {\n\t\treturn normalizeTextNodes(nodes);\n\t}\n\n\tconst result: (TextNode | InlineNode)[] = [];\n\n\tfor (const node of nodes) {\n\t\tif (isInlineNode(node)) {\n\t\t\tresult.push(node);\n\t\t\tcontinue;\n\t\t}\n\t\t// TextNode: try to merge with previous TextNode\n\t\tconst prev: TextNode | InlineNode | undefined = result[result.length - 1];\n\t\tif (prev && isTextNode(prev) && markSetsEqual(prev.marks, node.marks)) {\n\t\t\tresult[result.length - 1] = createTextNode(prev.text + node.text, prev.marks);\n\t\t} else if (node.text.length > 0 || result.length === 0) {\n\t\t\tresult.push(node);\n\t\t}\n\t}\n\n\t// Remove empty TextNodes that are adjacent to InlineNodes\n\tconst cleaned: (TextNode | InlineNode)[] = result.filter((node, i) => {\n\t\tif (isInlineNode(node)) return true;\n\t\tif (node.text.length > 0) return true;\n\t\t// Keep if it's the only node\n\t\tif (result.length === 1) return true;\n\t\t// Remove empty TextNode if adjacent to InlineNode\n\t\tconst prev: TextNode | InlineNode | undefined = result[i - 1];\n\t\tconst next: TextNode | InlineNode | undefined = result[i + 1];\n\t\tif ((prev && isInlineNode(prev)) || (next && isInlineNode(next))) {\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t});\n\n\t// Ensure at least one TextNode exists\n\tif (cleaned.length === 0) return [createTextNode('')];\n\tif (!cleaned.some((n) => isTextNode(n))) {\n\t\treturn [createTextNode(''), ...cleaned];\n\t}\n\n\treturn cleaned;\n}\n\n/** Materializes a single {@link ContentSegment} into its inline child node. */\nexport function contentSegmentToInlineNode(segment: ContentSegment): TextNode | InlineNode {\n\treturn segment.kind === 'inline' ? segment.node : createTextNode(segment.text, segment.marks);\n}\n\n/**\n * Materializes content segments (text + inline) into normalized inline children.\n * Inverse of {@link getBlockContentSegmentsInRange}: used when turning a range of\n * segments back into a block's children (paste insertion, slice extraction).\n */\nexport function segmentsToInlineChildren(\n\tsegments: readonly ContentSegment[],\n): readonly (TextNode | InlineNode)[] {\n\treturn normalizeInlineContent(segments.map(contentSegmentToInlineNode));\n}\n\n/** Yields each inline child with its offset range. InlineNodes have width 1. */\nexport function* walkInlineContent(children: readonly (TextNode | InlineNode)[]): Generator<{\n\treadonly child: TextNode | InlineNode;\n\treadonly from: number;\n\treadonly to: number;\n}> {\n\tlet pos = 0;\n\tfor (const child of children) {\n\t\tconst width: number = isInlineNode(child) ? 1 : child.text.length;\n\t\tyield { child, from: pos, to: pos + width };\n\t\tpos += width;\n\t}\n}\n\n/**\n * Converts a block-space offset to a text-space offset.\n *\n * Block-space counts InlineNodes as width 1, but `getBlockText()` skips them.\n * This function maps a block offset to the equivalent position in the\n * text-only string returned by `getBlockText()`.\n */\nexport function blockOffsetToTextOffset(block: BlockNode, blockOffset: number): number {\n\tlet textPos = 0;\n\n\tfor (const { child, from, to } of walkInlineContent(getInlineChildren(block))) {\n\t\tif (isInlineNode(child)) {\n\t\t\tif (from >= blockOffset) return textPos;\n\t\t} else {\n\t\t\tif (to >= blockOffset) return textPos + (blockOffset - from);\n\t\t\ttextPos += child.text.length;\n\t\t}\n\t}\n\n\treturn textPos;\n}\n\n/** Returns the content at a specific offset: text char, inline node, or null. */\nexport function getContentAtOffset(\n\tblock: BlockNode,\n\toffset: number,\n):\n\t| { readonly kind: 'text'; readonly char: string; readonly marks: readonly Mark[] }\n\t| { readonly kind: 'inline'; readonly node: InlineNode }\n\t| null {\n\tconst inlineChildren: readonly (TextNode | InlineNode)[] = getInlineChildren(block);\n\n\tfor (const { child, from } of walkInlineContent(inlineChildren)) {\n\t\tif (isInlineNode(child)) {\n\t\t\tif (offset === from) return { kind: 'inline', node: child };\n\t\t\tcontinue;\n\t\t}\n\t\tconst localOffset: number = offset - from;\n\t\tif (localOffset >= 0 && localOffset < child.text.length) {\n\t\t\treturn {\n\t\t\t\tkind: 'text',\n\t\t\t\tchar: child.text[localOffset] ?? '',\n\t\t\t\tmarks: child.marks,\n\t\t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AAM,EAAgB,EAAa,GAAS,EAAI,EAAM,KAAK,YACrD,CAAE,QAAO,KAAM,EAAK,GAAI,EAAM,GACpC,GAAO,CACR,CACD,CASA,SAAgB,GAAwB,EAAkB,GACzD,IAAI,EAAU,EAEd,IAAK,MAAM,MAAE,EAAA,KAAO,EAAA,GAAM,KAAQ,GAAkB,EAAkB,IACrE,GAAI,EAAa,IACZ,GAAA,GAAQ,EAAa,OAAO,MAC1B,CACN,GAAI,GAAM,EAAa,OAAO,GAAW,EAAc,GACvD,GAAW,EAAM,KAAK,MACvB,CAGD,OAAO,CACR,CAGA,SAAgB,GACf,EACA,GAKA,MAAM,EAAqD,EAAkB,GAE7E,IAAK,MAAM,MAAE,EAAA,KAAO,KAAU,GAAkB,GAAiB,CAChE,GAAI,EAAa,GAAQ,CACxB,GAAI,IAAW,EAAM,MAAO,CAAE,KAAM,SAAU,KAAM,GACpD,QACD,CACA,MAAM,EAAsB,EAAS,EACrC,GAAI,GAAe,GAAK,EAAc,EAAM,KAAK,OAChD,MAAO,CACN,KAAM,OACN,KAAM,EAAM,KAAK,IAAgB,GACjC,MAAO,EAAM,MAGhB,CAEA,OAAO,IACR"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{o as t,t as e}from"./HTMLUtils-B0nGyFLb.mjs";import{P as o,_ as n,g as r,m as s,p as i,z as a}from"./Document-D_2cIBJG.mjs";import{a as c,i as l,r as u}from"./TypeBrands-Ch9856Gb.mjs";import{n as f}from"./ContentModel-Bzmzeqwg.mjs";import{c as d,f as p,n as h,o as g,p as m,r as y,s as A,t as N,y as T}from"./TableDimensions-BcARMxQB.mjs";import{n as E,t as b}from"./HTMLSanitization-Ce9dVT1q.mjs";var L=/[ \t\n\r\f]+/g,O=/* @__PURE__ */new Set(["P","DIV","H1","H2","H3","H4","H5","H6","BLOCKQUOTE","UL","OL","LI","TABLE","THEAD","TBODY","TFOOT","TR","TD","TH","HR","FIGURE","FIGCAPTION","SECTION","ARTICLE","HEADER","FOOTER","MAIN","ASIDE","NAV","DL","DT","DD"]),w=/* @__PURE__ */new Set(["PRE","TEXTAREA"]),v=/* @__PURE__ */new Set(["pre","pre-wrap","pre-line","break-spaces"]);function k(t){D(t)}function D(t){const e={lastTextNode:null,collapsePending:!0};for(const o of Array.from(t.childNodes))C(o,e);x(e.lastTextNode)}function C(t,e){if(t.nodeType===Node.TEXT_NODE)return void function(t,e){let o=t.data.replace(L," ");e.collapsePending&&o.startsWith(" ")&&(o=o.slice(1)),t.data=o,0!==o.length&&(e.collapsePending=o.endsWith(" "),e.lastTextNode=t)}(t,e);if(t.nodeType!==Node.ELEMENT_NODE)return;const o=t;if(function(t){if(w.has(t.tagName))return!0;const e=(t.style?.whiteSpace??"").toLowerCase();return v.has(e)}(o))_(e);else{if(function(t){return O.has(t.tagName)}(o))return _(e),void D(o);for(const t of Array.from(o.childNodes))C(t,e)}}function _(t){x(t.lastTextNode),t.lastTextNode=null,t.collapsePending=!0}function x(t){t?.data.endsWith(" ")&&(t.data=t.data.slice(0,-1))}function M(t,o,n){const r=o?o.getAllowedTags():["p","br","div","span"],i=o?o.getAllowedAttrs():["style","dir","id"];i.includes("data-block-id")||i.push("data-block-id"),n?.styleMap&&!i.includes("class")&&i.push("class");const a=document.createElement("template");a.innerHTML=E(t,{ALLOWED_TAGS:r,ALLOWED_ATTR:i,ALLOWED_URI_REGEXP:e,...b()},o);const c=a.content;n?.styleMap&&function(t,e){const o=t.querySelectorAll("[class]");for(const n of Array.from(o)){const t=n,o=Array.from(t.classList),r=[];for(const n of o){const o=e.get(n);if(o){const e=t.getAttribute("style")??"",s=e&&!e.endsWith(";")?"; ":"";t.setAttribute("style",e+s+o),r.push(n)}}for(const e of r)t.classList.remove(e)}}(c,n.styleMap),k(c);const l=o?.getBlockParseRules()??[],u=[],d=/* @__PURE__ */new Set;for(const e of Array.from(c.childNodes))P(e,u,l,d,o);if(0===u.length)return s();const p=s(u);return o?f(p,o):p}function P(t,e,o,r,s){if(t.nodeType===Node.ELEMENT_NODE){const a=t,l=a.tagName.toLowerCase();if("ul"===l||"ol"===l){const t="ol"===l?"ordered":"bullet",o=a.getAttribute("dir");return void R(a,t,0,e,r,s,o&&m.has(o)?o:void 0)}if("table"===l)return void function(t,e,o,n){const r=[],s=function(t){const e=[];for(const o of Array.from(t.children)){const t=o.tagName.toLowerCase();if("col"===t){H(o,void 0,e);continue}if("colgroup"!==t)continue;const n=o,r=I(n),s=Array.from(n.children).filter(t=>"col"===t.tagName.toLowerCase());if(0!==s.length)for(const o of s)H(o,r,e);else S(r,A(n.getAttribute("span")),e)}return g(e)}(t),a=function(t){const e=[];for(const o of Array.from(t.children)){const t=o.tagName.toLowerCase();if("tr"===t)e.push(o);else if("thead"===t||"tbody"===t||"tfoot"===t)for(const n of Array.from(o.children))"tr"===n.tagName.toLowerCase()&&e.push(n)}return e}(t);for(const l of a){const t=[];for(const r of Array.from(l.children)){const e=r.tagName.toLowerCase();if("td"!==e&&"th"!==e)continue;const s=r,a=q(s,o,n),l={};X(s,l);const u=i(c("table_cell"),a,T(s,o),Object.keys(l).length>0?l:void 0,Q(s));t.push(u)}const e={};B(l,e),r.push(i(c("table_row"),t,T(l,o),Object.keys(e).length>0?e:void 0,Q(l)))}if(r.length>0){const n={};!function(t,e){const o=t.getAttribute("style")??"",n=W.exec(o);n?.[1]&&(e.borderColor="transparent"===n[1]?"none":n[1])}(t,n),s&&(n.columnWidthsPx=s),e.push(i(c("table"),r,T(t,o),Object.keys(n).length>0?n:void 0,Q(t)))}}(a,e,r,s);if("blockquote"===l)return void function(t,e,o,r){const s=F(t,r?.getBlockParseRules()??[],o,r);0===s.length&&s.push(i(c("paragraph"),[n("")]));const a={};$(t,a),K(t,a),e.push(i(c("blockquote"),s,T(t,o),Object.keys(a).length>0?a:void 0,Q(t)))}(a,e,r,s);const u=J(a,o);if(u){const t=s?.getNodeSpec(u.type),o=t?.isVoid?[n("")]:G(a,s),l={...u.attrs};return t?.attrs?.align&&$(a,l),t?.attrs?.dir&&K(a,l),void e.push(i(c(u.type),o,T(a,r),Object.keys(l).length>0?l:void 0,Q(a)))}const f=G(a,s),d={};$(a,d),K(a,d),e.push(i(c("paragraph"),f,T(a,r),Object.keys(d).length>0?d:void 0,Q(a)))}else t.nodeType===Node.TEXT_NODE&&t.textContent?.trim()&&e.push(i(c("paragraph"),[n(t.textContent.trim())]))}function R(t,e,o,n,r,s,i){for(const a of Array.from(t.children)){const t=a.tagName.toLowerCase();if("li"===t){const t=a,c=t.querySelector(':scope > input[type="checkbox"]'),l={listType:null!==c?"checklist":e,indent:o,checked:c?.hasAttribute("checked")??!1},u=t.getAttribute("dir"),f=u&&m.has(u)?u:i;f&&(l.dir=f),n.push(j(t,l,r,c,s));for(const e of Array.from(t.children)){const t=e.tagName.toLowerCase();if("ul"===t||"ol"===t){const i="ol"===t?"ordered":"bullet",a=e.getAttribute("dir");R(e,i,o+1,n,r,s,a&&m.has(a)?a:f)}}}else if("ul"===t||"ol"===t){const e="ol"===t?"ordered":"bullet",c=a.getAttribute("dir");R(a,e,o+1,n,r,s,c&&m.has(c)?c:i)}}}function j(t,e,r,s,a){const l=Q(t),u=a?.getBlockParseRules()??[],f=t=>{if(t.nodeType!==Node.ELEMENT_NODE)return!1;const e=t.tagName.toLowerCase();return"ul"===e||"ol"===e};if(!Array.from(t.childNodes).some(t=>!f(t)&&U(t,u))){const o=G(t,a,!0);return i(c("list_item"),o,T(t,r),e,l)}const d=F(t,u,r,a,t=>f(t)||t===s),p=1===d.length?d[0]:void 0;return!p||"paragraph"!==p.type||p.attrs||p.htmlId?0===d.length?i(c("list_item"),[n("")],T(t,r),e,l):i(c("list_item"),d,T(t,r),e,l):i(c("list_item"),o(p),T(t,r),e,l)}function H(t,e,o){S(I(t)??e,A(t.getAttribute("span")),o)}function S(t,e,o){const n=N-o.length,r=Math.min(e,Math.max(0,n));for(let s=0;s<r;s++)o.push(t??null)}function I(t){return d(t,h,["width"],"width")}function B(t,e){const o=d(t,y,["min-height","height"],"height");void 0!==o&&(e.minHeightPx=o)}var W=/--ntbl-bc:\s*(#[0-9a-fA-F]{3,8}|transparent)/;function X(t,e){const o=t.getAttribute("colspan");if(o){const t=A(o);t>1&&(e.colspan=t)}const n=t.getAttribute("rowspan");if(n){const t=A(n);t>1&&(e.rowspan=t)}}function q(t,e,o){const r=F(t,o?.getBlockParseRules()??[],e,o);return 0===r.length&&r.push(i(c("paragraph"),[n("")])),r}function F(t,e,o,n,r){const s=[];let a=[];const l=()=>{(function(t){for(const e of t){if(e.nodeType===Node.ELEMENT_NODE)return!0;if(e.nodeType===Node.TEXT_NODE&&e.textContent?.trim())return!0}return!1})(a)&&s.push(i(c("paragraph"),V(a,n))),a=[]};for(const i of Array.from(t.childNodes))r?.(i)||(U(i,e)?(l(),P(i,s,e,o,n)):a.push(i));return l(),s}function U(t,e){if(t.nodeType!==Node.ELEMENT_NODE)return!1;const o=t,n=o.tagName.toLowerCase();return"p"===n||"ul"===n||"ol"===n||"table"===n||"blockquote"===n||null!==J(o,e)}function G(t,e,o){return V([t],e,o)}function V(t,e,o){const r=[],s=e?.getMarkParseRules()??[],i=e?.getInlineParseRules()??[];for(const n of t)z(n,[],r,s,i,o);return 1===r.length&&a(r[0])&&"hard_break"===r[0].inlineType?[n("")]:r.length>0?r:[n("")]}function z(t,e,o,s,i,a){if(t.nodeType===Node.TEXT_NODE){const r=t.textContent??"";return void(r&&o.push(n(r,[...e])))}if(t.nodeType!==Node.ELEMENT_NODE)return;const c=t,f=c.tagName.toLowerCase();if(a&&("ul"===f||"ol"===f))return;if(a&&"input"===f&&"checkbox"===c.getAttribute("type"))return;for(const n of i)if(n.rule.tag===f){if(n.rule.getAttrs){const t=n.rule.getAttrs(c);if(!1===t)continue;return void o.push(r(u(n.type),t,[...e]))}return void o.push(r(u(n.type),void 0,[...e]))}const d=[...e],p=/* @__PURE__ */new Set;for(const n of s)if(n.rule.tag===f&&!p.has(n.type))if(n.rule.getAttrs){const t=n.rule.getAttrs(c);if(!1===t)continue;d.some(t=>t.type===n.type)||(d.push({type:l(n.type),...Object.keys(t).length>0?{attrs:t}:{}}),p.add(n.type))}else d.some(t=>t.type===n.type)||(d.push({type:l(n.type)}),p.add(n.type));for(const n of Array.from(c.childNodes))z(n,d,o,s,i,a)}function K(t,e){const o=t.getAttribute("dir");if(o&&m.has(o))return void(e.dir=o);const n=t.style?.direction??"";n&&m.has(n)&&(e.dir=n)}function Q(e){return t(e.getAttribute("id"))}var Y={left:"start",right:"end"};function $(t,e){let o=t.style?.textAlign??"";const n=Y[o];if(n&&(o=n),o&&p.has(o))e.align=o;else for(const r of Array.from(t.classList)){let t=r.match(/^notectl-align-(\w+)$/)?.[1];const o=Y[t??""];if(o&&(t=o),t&&p.has(t))return void(e.align=t)}}function J(t,e){const o=t.tagName.toLowerCase();for(const n of e)if(n.rule.tag===o){if(n.rule.getAttrs){const e=n.rule.getAttrs(t);if(!1===e)continue;return{type:n.type,attrs:e}}return{type:n.type}}return null}export{k as n,M as t};
|
|
2
|
-
//# sourceMappingURL=DocumentParser-i-CreJ48.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DocumentParser-i-CreJ48.mjs","names":[],"sources":["../../src/serialization/HTMLWhitespace.ts","../../src/serialization/DocumentParser.ts"],"sourcesContent":["/**\n * HTML whitespace normalization, shared by the paste parser (`HTMLParser`) and the\n * `setContentHTML` parser (`DocumentParser`).\n *\n * Per the CSS Text / HTML whitespace processing model for `white-space: normal`,\n * whitespace in normal flow content is *insignificant*: runs of ASCII whitespace\n * (space, tab, line feed, carriage return, form feed) collapse to a single space,\n * and whitespace at the edges of a block collapses away entirely. Only `<br>` is a\n * real line break. Source-formatted HTML (server-rendered, hand-indented, or\n * hard-wrapped by a browser's clipboard serializer) therefore carries newlines and\n * indentation that must NOT survive parsing.\n *\n * This pass rewrites text-node data in place so both parsers can walk a tree whose\n * whitespace already matches what a browser would render. It only touches\n * `Text.data`; marks, block ids, and attributes are left untouched.\n */\n\n/**\n * ASCII whitespace per the HTML spec. Deliberately NOT `\\s`: `\\s` also matches\n * non-breaking space (` `) and other Unicode spaces, which are significant\n * content and must be preserved verbatim.\n */\nconst COLLAPSIBLE_WHITESPACE: RegExp = /[ \\t\\n\\r\\f]+/g;\n\n/**\n * Tags that establish a block formatting context in normal flow. Each starts a\n * fresh inline run whose leading/trailing whitespace is trimmed independently.\n * Self-contained (not coupled to the parsers' tag sets); unknown tags are treated\n * as inline.\n */\nconst FLOW_BLOCK_TAGS: ReadonlySet<string> = new Set([\n\t'P',\n\t'DIV',\n\t'H1',\n\t'H2',\n\t'H3',\n\t'H4',\n\t'H5',\n\t'H6',\n\t'BLOCKQUOTE',\n\t'UL',\n\t'OL',\n\t'LI',\n\t'TABLE',\n\t'THEAD',\n\t'TBODY',\n\t'TFOOT',\n\t'TR',\n\t'TD',\n\t'TH',\n\t'HR',\n\t'FIGURE',\n\t'FIGCAPTION',\n\t'SECTION',\n\t'ARTICLE',\n\t'HEADER',\n\t'FOOTER',\n\t'MAIN',\n\t'ASIDE',\n\t'NAV',\n\t'DL',\n\t'DT',\n\t'DD',\n]);\n\n/** Tags whose descendant whitespace is significant and must be preserved verbatim. */\nconst PRESERVE_TAGS: ReadonlySet<string> = new Set(['PRE', 'TEXTAREA']);\n\n/** `white-space` values that preserve whitespace (the `pre*` family). */\nconst PRESERVE_WHITESPACE_VALUES: ReadonlySet<string> = new Set([\n\t'pre',\n\t'pre-wrap',\n\t'pre-line',\n\t'break-spaces',\n]);\n\n/** Mutable state threaded through a single inline formatting context. */\ninterface CollapseState {\n\t/** Most recent non-empty text node in this context, for trailing-space trimming. */\n\tlastTextNode: Text | null;\n\t/**\n\t * Whether a leading space on the next text node should be dropped. True at the\n\t * start of a context and after any text node that ended with a space.\n\t */\n\tcollapsePending: boolean;\n}\n\n/**\n * Collapses insignificant HTML whitespace throughout `root`, mutating text-node\n * data in place. Call once on a (disposable) parsed fragment before walking it.\n */\nexport function normalizeHTMLWhitespace(root: DocumentFragment | HTMLElement): void {\n\tnormalizeContext(root);\n}\n\n/** Processes one inline formatting context, then trims its trailing whitespace. */\nfunction normalizeContext(container: DocumentFragment | HTMLElement): void {\n\tconst state: CollapseState = { lastTextNode: null, collapsePending: true };\n\tfor (const child of Array.from(container.childNodes)) {\n\t\tprocessNode(child, state);\n\t}\n\ttrimTrailingSpace(state.lastTextNode);\n}\n\nfunction processNode(node: ChildNode, state: CollapseState): void {\n\tif (node.nodeType === Node.TEXT_NODE) {\n\t\tcollapseTextNode(node as Text, state);\n\t\treturn;\n\t}\n\tif (node.nodeType !== Node.ELEMENT_NODE) return;\n\n\tconst el = node as HTMLElement;\n\n\t// Whitespace-preserving subtree (code blocks etc.): end the current inline run\n\t// and leave the subtree untouched.\n\tif (isPreserveElement(el)) {\n\t\tendInlineRun(state);\n\t\treturn;\n\t}\n\n\t// Block element: the current inline run ends here; recurse as a fresh context.\n\tif (isFlowBlockElement(el)) {\n\t\tendInlineRun(state);\n\t\tnormalizeContext(el);\n\t\treturn;\n\t}\n\n\t// Inline element: keep collapsing within the same context.\n\tfor (const child of Array.from(el.childNodes)) {\n\t\tprocessNode(child, state);\n\t}\n}\n\n/** Collapses whitespace runs in a text node and drops a leading space when pending. */\nfunction collapseTextNode(text: Text, state: CollapseState): void {\n\tlet data: string = text.data.replace(COLLAPSIBLE_WHITESPACE, ' ');\n\tif (state.collapsePending && data.startsWith(' ')) {\n\t\tdata = data.slice(1);\n\t}\n\ttext.data = data;\n\n\t// Fully collapsed away (e.g. a whitespace-only node): leave `collapsePending` as\n\t// is so a later node still drops its leading space.\n\tif (data.length === 0) return;\n\n\tstate.collapsePending = data.endsWith(' ');\n\tstate.lastTextNode = text;\n}\n\n/** Ends the current inline run at a block/preserve boundary and resets state. */\nfunction endInlineRun(state: CollapseState): void {\n\ttrimTrailingSpace(state.lastTextNode);\n\tstate.lastTextNode = null;\n\tstate.collapsePending = true;\n}\n\n/** Removes the single (already-collapsed) trailing space from a text node, if any. */\nfunction trimTrailingSpace(node: Text | null): void {\n\tif (node?.data.endsWith(' ')) {\n\t\tnode.data = node.data.slice(0, -1);\n\t}\n}\n\nfunction isFlowBlockElement(el: HTMLElement): boolean {\n\treturn FLOW_BLOCK_TAGS.has(el.tagName);\n}\n\nfunction isPreserveElement(el: HTMLElement): boolean {\n\tif (PRESERVE_TAGS.has(el.tagName)) return true;\n\tconst whiteSpace: string = (el.style?.whiteSpace ?? '').toLowerCase();\n\treturn PRESERVE_WHITESPACE_VALUES.has(whiteSpace);\n}\n","/**\n * DocumentParser: converts sanitized HTML strings into immutable Document instances.\n * Pure functions — no class state, no DOM mutation beyond a temporary `<template>`.\n */\n\nimport { hoistDisallowedBlocks } from '../model/ContentModel.js';\nimport type {\n\tBlockAttrValue,\n\tBlockNode,\n\tDocument,\n\tInlineNode,\n\tMark,\n\tTextNode,\n} from '../model/Document.js';\nimport {\n\tcreateBlockNode,\n\tcreateDocument,\n\tcreateInlineNode,\n\tcreateTextNode,\n\tgetInlineChildren,\n\tisInlineNode,\n} from '../model/Document.js';\nimport { SAFE_URI_REGEXP, normalizeHTMLId } from '../model/HTMLUtils.js';\nimport type { ParseRule } from '../model/ParseRule.js';\nimport type { SchemaRegistry } from '../model/SchemaRegistry.js';\nimport { type InlineTypeName, inlineType, markType, nodeType } from '../model/TypeBrands.js';\nimport { adoptBlockId } from './BlockIdHTML.js';\nimport { VALID_ALIGNMENTS, VALID_DIRECTIONS } from './DocumentSerializer.js';\nimport { preserveHTMLIdSanitizeConfig, sanitizeHTML } from './HTMLSanitization.js';\nimport { normalizeHTMLWhitespace } from './HTMLWhitespace.js';\nimport {\n\tMAX_SERIALIZED_TABLE_COLUMNS,\n\tTABLE_COLUMN_WIDTH_DATA_ATTRIBUTE,\n\tTABLE_ROW_MIN_HEIGHT_DATA_ATTRIBUTE,\n\tnormalizeTableColumnWidthsPx,\n\tparseTableColumnSpan,\n\treadTableDimensionPx,\n} from './TableDimensions.js';\n\n/** Options for `parseHTMLToDocument` when importing class-based HTML. */\nexport interface ParseHTMLOptions {\n\t/**\n\t * Style map from a previous `getContentHTML({ cssMode: 'classes' })` call.\n\t * Used to rehydrate class-based HTML back into styled content.\n\t */\n\treadonly styleMap?: ReadonlyMap<string, string>;\n}\n\n/** Parses an HTML string into a Document, applying sanitization and schema parse rules. */\nexport function parseHTMLToDocument(\n\thtml: string,\n\tregistry?: SchemaRegistry,\n\toptions?: ParseHTMLOptions,\n): Document {\n\tconst allowedTags: string[] = registry ? registry.getAllowedTags() : ['p', 'br', 'div', 'span'];\n\tconst allowedAttrs: string[] = registry ? registry.getAllowedAttrs() : ['style', 'dir', 'id'];\n\n\t// `data-block-id` carries block identity across `setContentHTML(getContentHTML())`.\n\t// Whitelist it through DOMPurify so the adoption logic below sees it.\n\tif (!allowedAttrs.includes('data-block-id')) {\n\t\tallowedAttrs.push('data-block-id');\n\t}\n\n\t// When a styleMap is provided, also allow `class` through DOMPurify\n\t// so we can read class names and rehydrate styles before parsing.\n\tif (options?.styleMap && !allowedAttrs.includes('class')) {\n\t\tallowedAttrs.push('class');\n\t}\n\n\tconst template = document.createElement('template');\n\ttemplate.innerHTML = sanitizeHTML(\n\t\thtml,\n\t\t{\n\t\t\tALLOWED_TAGS: allowedTags,\n\t\t\tALLOWED_ATTR: allowedAttrs,\n\t\t\tALLOWED_URI_REGEXP: SAFE_URI_REGEXP,\n\t\t\t...preserveHTMLIdSanitizeConfig(),\n\t\t},\n\t\tregistry,\n\t);\n\tconst root: DocumentFragment = template.content;\n\n\t// Rehydrate class-based HTML: convert notectl class names back to inline styles\n\tif (options?.styleMap) {\n\t\trehydrateClasses(root, options.styleMap);\n\t}\n\n\t// Collapse insignificant HTML whitespace so source-formatted/indented input does\n\t// not leave stray newlines and indentation inside block text content.\n\tnormalizeHTMLWhitespace(root);\n\n\tconst blockRules = registry?.getBlockParseRules() ?? [];\n\tconst blocks: BlockNode[] = [];\n\tconst adoptedIds = new Set<string>();\n\n\tfor (const child of Array.from(root.childNodes)) {\n\t\tparseChildNode(child, blocks, blockRules, adoptedIds, registry);\n\t}\n\n\tif (blocks.length === 0) return createDocument();\n\tconst doc: Document = createDocument(blocks);\n\t// Repair schema-invalid nesting an importer may have produced (e.g. a `<table>`\n\t// inside an `<li>` builds `list_item > table`, which the flat-with-indent item\n\t// model forbids): the disallowed block is hoisted to a valid ancestor (#194).\n\treturn registry ? hoistDisallowedBlocks(doc, registry) : doc;\n}\n\n/**\n * Parses a single child node into block(s), handling all supported block types:\n * lists, tables, block parse rules (headings, blockquotes, code blocks, images, hr),\n * and fallback paragraphs. Used by both top-level parsing and table cell content parsing.\n */\nfunction parseChildNode(\n\tchild: ChildNode,\n\tblocks: BlockNode[],\n\tblockRules: readonly { readonly rule: ParseRule; readonly type: string }[],\n\tadoptedIds: Set<string>,\n\tregistry?: SchemaRegistry,\n): void {\n\tif (child.nodeType === Node.ELEMENT_NODE) {\n\t\tconst el = child as HTMLElement;\n\t\tconst tag: string = el.tagName.toLowerCase();\n\n\t\t// Lists need cross-element logic — handle before parse rules\n\t\tif (tag === 'ul' || tag === 'ol') {\n\t\t\tconst listType: string = tag === 'ol' ? 'ordered' : 'bullet';\n\t\t\tconst listDir: string | null = el.getAttribute('dir');\n\t\t\tconst parentDir: string | undefined =\n\t\t\t\tlistDir && VALID_DIRECTIONS.has(listDir) ? listDir : undefined;\n\t\t\tparseListElement(el, listType, 0, blocks, adoptedIds, registry, parentDir);\n\t\t\treturn;\n\t\t}\n\n\t\t// Tables produce nested block structure: table > table_row > table_cell > paragraph\n\t\tif (tag === 'table') {\n\t\t\tparseTableElement(el, blocks, adoptedIds, registry);\n\t\t\treturn;\n\t\t}\n\n\t\t// Blockquotes are container blocks (issue #136): parse their children\n\t\t// recursively into block nodes instead of flattening to inline content.\n\t\tif (tag === 'blockquote') {\n\t\t\tparseBlockquoteElement(el, blocks, adoptedIds, registry);\n\t\t\treturn;\n\t\t}\n\n\t\t// Try block parse rules\n\t\tconst match = matchBlockParseRule(el, blockRules);\n\t\tif (match) {\n\t\t\tconst spec = registry?.getNodeSpec(match.type);\n\t\t\tconst children: (TextNode | InlineNode)[] = spec?.isVoid\n\t\t\t\t? [createTextNode('')]\n\t\t\t\t: parseElementToInlineContent(el, registry);\n\t\t\tconst attrs: Record<string, string | number | boolean> = {\n\t\t\t\t...(match.attrs as Record<string, string | number | boolean> | undefined),\n\t\t\t};\n\t\t\tif (spec?.attrs?.align) {\n\t\t\t\textractAlignment(el, attrs);\n\t\t\t}\n\t\t\tif (spec?.attrs?.dir) {\n\t\t\t\textractDirection(el, attrs);\n\t\t\t}\n\t\t\tblocks.push(\n\t\t\t\tcreateBlockNode(\n\t\t\t\t\tnodeType(match.type),\n\t\t\t\t\tchildren,\n\t\t\t\t\tadoptBlockId(el, adoptedIds),\n\t\t\t\t\tObject.keys(attrs).length > 0 ? attrs : undefined,\n\t\t\t\t\textractHTMLId(el),\n\t\t\t\t),\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\t// Fallback to paragraph\n\t\tconst inlineContent = parseElementToInlineContent(el, registry);\n\t\tconst attrs: Record<string, string | number | boolean> = {};\n\t\textractAlignment(el, attrs);\n\t\textractDirection(el, attrs);\n\t\tblocks.push(\n\t\t\tcreateBlockNode(\n\t\t\t\tnodeType('paragraph'),\n\t\t\t\tinlineContent,\n\t\t\t\tadoptBlockId(el, adoptedIds),\n\t\t\t\tObject.keys(attrs).length > 0 ? attrs : undefined,\n\t\t\t\textractHTMLId(el),\n\t\t\t),\n\t\t);\n\t} else if (child.nodeType === Node.TEXT_NODE && child.textContent?.trim()) {\n\t\tblocks.push(createBlockNode(nodeType('paragraph'), [createTextNode(child.textContent.trim())]));\n\t}\n}\n\n/**\n * Recursively parses a list element (`<ul>` or `<ol>`), creating list_item blocks\n * with correct indent depth. Handles nested lists inside `<li>` elements.\n */\nfunction parseListElement(\n\tlistEl: Element,\n\tlistType: string,\n\tdepth: number,\n\tblocks: BlockNode[],\n\tadoptedIds: Set<string>,\n\tregistry?: SchemaRegistry,\n\tparentDir?: string,\n): void {\n\tfor (const child of Array.from(listEl.children)) {\n\t\tconst tag: string = child.tagName.toLowerCase();\n\n\t\tif (tag === 'li') {\n\t\t\tconst li: HTMLElement = child as HTMLElement;\n\n\t\t\t// Check for checklist: <input type=\"checkbox\">\n\t\t\tconst checkbox: HTMLInputElement | null = li.querySelector(':scope > input[type=\"checkbox\"]');\n\t\t\tconst isChecklist: boolean = checkbox !== null;\n\t\t\tconst checked: boolean = checkbox?.hasAttribute('checked') ?? false;\n\n\t\t\tconst resolvedType: string = isChecklist ? 'checklist' : listType;\n\n\t\t\tconst attrs: Record<string, string | number | boolean> = {\n\t\t\t\tlistType: resolvedType,\n\t\t\t\tindent: depth,\n\t\t\t\tchecked,\n\t\t\t};\n\n\t\t\t// Propagate direction: item's own dir > parent list dir\n\t\t\tconst liDir: string | null = li.getAttribute('dir');\n\t\t\tconst effectiveDir: string | undefined =\n\t\t\t\tliDir && VALID_DIRECTIONS.has(liDir) ? liDir : parentDir;\n\t\t\tif (effectiveDir) {\n\t\t\t\tattrs.dir = effectiveDir;\n\t\t\t}\n\n\t\t\tblocks.push(parseListItemBlock(li, attrs, adoptedIds, checkbox, registry));\n\n\t\t\t// Check for nested lists inside this <li>\n\t\t\tfor (const liChild of Array.from(li.children)) {\n\t\t\t\tconst liChildTag: string = liChild.tagName.toLowerCase();\n\t\t\t\tif (liChildTag === 'ul' || liChildTag === 'ol') {\n\t\t\t\t\tconst nestedType: string = liChildTag === 'ol' ? 'ordered' : 'bullet';\n\t\t\t\t\tconst nestedDir: string | null = liChild.getAttribute('dir');\n\t\t\t\t\tconst nestedEffectiveDir: string | undefined =\n\t\t\t\t\t\tnestedDir && VALID_DIRECTIONS.has(nestedDir) ? nestedDir : effectiveDir;\n\t\t\t\t\tparseListElement(\n\t\t\t\t\t\tliChild,\n\t\t\t\t\t\tnestedType,\n\t\t\t\t\t\tdepth + 1,\n\t\t\t\t\t\tblocks,\n\t\t\t\t\t\tadoptedIds,\n\t\t\t\t\t\tregistry,\n\t\t\t\t\t\tnestedEffectiveDir,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (tag === 'ul' || tag === 'ol') {\n\t\t\t// Direct nested list without wrapping <li> — increment depth\n\t\t\tconst nestedType: string = tag === 'ol' ? 'ordered' : 'bullet';\n\t\t\tconst nestedDir: string | null = child.getAttribute('dir');\n\t\t\tconst nestedEffectiveDir: string | undefined =\n\t\t\t\tnestedDir && VALID_DIRECTIONS.has(nestedDir) ? nestedDir : parentDir;\n\t\t\tparseListElement(\n\t\t\t\tchild,\n\t\t\t\tnestedType,\n\t\t\t\tdepth + 1,\n\t\t\t\tblocks,\n\t\t\t\tadoptedIds,\n\t\t\t\tregistry,\n\t\t\t\tnestedEffectiveDir,\n\t\t\t);\n\t\t}\n\t}\n}\n\n/**\n * Parses one `<li>` into its `list_item` block (#194). An item whose children\n * are inline-only stays a leaf; block-level children other than nested lists\n * (a second paragraph, code, a quote, a heading) make it a container with\n * block children. Nested `<ul>`/`<ol>` are excluded here — the caller hoists\n * them into flat siblings one indent deeper. A lone plain paragraph unwraps\n * back to a leaf so the common tight/loose single-paragraph item keeps its\n * inline shape.\n */\nfunction parseListItemBlock(\n\tli: HTMLElement,\n\tattrs: Record<string, string | number | boolean>,\n\tadoptedIds: Set<string>,\n\tcheckbox: HTMLInputElement | null,\n\tregistry?: SchemaRegistry,\n): BlockNode {\n\tconst htmlId: string | undefined = extractHTMLId(li);\n\tconst blockRules = registry?.getBlockParseRules() ?? [];\n\tconst isHoistedList = (node: ChildNode): boolean => {\n\t\tif (node.nodeType !== Node.ELEMENT_NODE) return false;\n\t\tconst tag: string = (node as Element).tagName.toLowerCase();\n\t\treturn tag === 'ul' || tag === 'ol';\n\t};\n\tconst hasBlockContent: boolean = Array.from(li.childNodes).some(\n\t\t(node) => !isHoistedList(node) && isBlockLevelChild(node, blockRules),\n\t);\n\n\tif (!hasBlockContent) {\n\t\tconst inlineContent = parseElementToInlineContent(li, registry, true);\n\t\treturn createBlockNode(\n\t\t\tnodeType('list_item'),\n\t\t\tinlineContent,\n\t\t\tadoptBlockId(li, adoptedIds),\n\t\t\tattrs,\n\t\t\thtmlId,\n\t\t);\n\t}\n\n\tconst skip = (node: ChildNode): boolean => isHoistedList(node) || node === checkbox;\n\tconst innerBlocks: BlockNode[] = parseBlockContainerChildren(\n\t\tli,\n\t\tblockRules,\n\t\tadoptedIds,\n\t\tregistry,\n\t\tskip,\n\t);\n\n\t// A lone attribute-less paragraph is the leaf shape in disguise.\n\tconst only: BlockNode | undefined = innerBlocks.length === 1 ? innerBlocks[0] : undefined;\n\tif (only && only.type === 'paragraph' && !only.attrs && !only.htmlId) {\n\t\treturn createBlockNode(\n\t\t\tnodeType('list_item'),\n\t\t\tgetInlineChildren(only),\n\t\t\tadoptBlockId(li, adoptedIds),\n\t\t\tattrs,\n\t\t\thtmlId,\n\t\t);\n\t}\n\n\tif (innerBlocks.length === 0) {\n\t\treturn createBlockNode(\n\t\t\tnodeType('list_item'),\n\t\t\t[createTextNode('')],\n\t\t\tadoptBlockId(li, adoptedIds),\n\t\t\tattrs,\n\t\t\thtmlId,\n\t\t);\n\t}\n\n\treturn createBlockNode(\n\t\tnodeType('list_item'),\n\t\tinnerBlocks,\n\t\tadoptBlockId(li, adoptedIds),\n\t\tattrs,\n\t\thtmlId,\n\t);\n}\n\n/**\n * Parses a `<table>` element into nested block structure:\n * table > table_row > table_cell > paragraph.\n * Handles `<thead>`, `<tbody>`, `<tfoot>` transparently.\n */\nfunction parseTableElement(\n\ttableEl: Element,\n\tblocks: BlockNode[],\n\tadoptedIds: Set<string>,\n\tregistry?: SchemaRegistry,\n): void {\n\tconst rows: BlockNode[] = [];\n\tconst columnWidthsPx: readonly (number | null)[] | undefined =\n\t\textractTableColumnWidthsPx(tableEl);\n\n\t// Collect <tr> elements, handling <thead>/<tbody>/<tfoot> wrappers\n\tconst rowElements: Element[] = collectTableRows(tableEl);\n\n\tfor (const trEl of rowElements) {\n\t\tconst cells: BlockNode[] = [];\n\n\t\tfor (const cellChild of Array.from(trEl.children)) {\n\t\t\tconst cellTag: string = cellChild.tagName.toLowerCase();\n\t\t\tif (cellTag !== 'td' && cellTag !== 'th') continue;\n\n\t\t\tconst cellEl: HTMLElement = cellChild as HTMLElement;\n\t\t\tconst cellContent: BlockNode[] = parseTableCellContent(cellEl, adoptedIds, registry);\n\t\t\tconst cellAttrs: Record<string, string | number | boolean> = {};\n\t\t\textractCellSpanAttrs(cellEl, cellAttrs);\n\t\t\tconst cellBlock: BlockNode = createBlockNode(\n\t\t\t\tnodeType('table_cell'),\n\t\t\t\tcellContent,\n\t\t\t\tadoptBlockId(cellEl, adoptedIds),\n\t\t\t\tObject.keys(cellAttrs).length > 0 ? cellAttrs : undefined,\n\t\t\t\textractHTMLId(cellEl),\n\t\t\t);\n\t\t\tcells.push(cellBlock);\n\t\t}\n\n\t\tconst rowAttrs: Record<string, string | number | boolean> = {};\n\t\textractTableRowMinHeight(trEl as HTMLElement, rowAttrs);\n\t\t// Preserve empty rows. Besides retaining authored table structure, an empty\n\t\t// `<tr>` may carry the canonical minimum-height metadata by itself.\n\t\trows.push(\n\t\t\tcreateBlockNode(\n\t\t\t\tnodeType('table_row'),\n\t\t\t\tcells,\n\t\t\t\tadoptBlockId(trEl, adoptedIds),\n\t\t\t\tObject.keys(rowAttrs).length > 0 ? rowAttrs : undefined,\n\t\t\t\textractHTMLId(trEl as HTMLElement),\n\t\t\t),\n\t\t);\n\t}\n\n\tif (rows.length > 0) {\n\t\tconst tableAttrs: Record<string, BlockAttrValue> = {};\n\t\textractTableBorderColor(tableEl as HTMLElement, tableAttrs);\n\t\tif (columnWidthsPx) tableAttrs.columnWidthsPx = columnWidthsPx;\n\t\tblocks.push(\n\t\t\tcreateBlockNode(\n\t\t\t\tnodeType('table'),\n\t\t\t\trows,\n\t\t\t\tadoptBlockId(tableEl, adoptedIds),\n\t\t\t\tObject.keys(tableAttrs).length > 0 ? tableAttrs : undefined,\n\t\t\t\textractHTMLId(tableEl as HTMLElement),\n\t\t\t),\n\t\t);\n\t}\n}\n\n/** Collects canonical logical column widths from direct `<colgroup>/<col>` children. */\nfunction extractTableColumnWidthsPx(tableEl: Element): readonly (number | null)[] | undefined {\n\tconst widths: (number | null)[] = [];\n\n\tfor (const child of Array.from(tableEl.children)) {\n\t\tconst tag: string = child.tagName.toLowerCase();\n\t\tif (tag === 'col') {\n\t\t\tappendColumnElementWidths(child as HTMLElement, undefined, widths);\n\t\t\tcontinue;\n\t\t}\n\t\tif (tag !== 'colgroup') continue;\n\n\t\tconst groupEl: HTMLElement = child as HTMLElement;\n\t\tconst groupWidth: number | undefined = readTableColumnWidthPx(groupEl);\n\t\tconst columns: HTMLElement[] = Array.from(groupEl.children).filter(\n\t\t\t(element): element is HTMLElement => element.tagName.toLowerCase() === 'col',\n\t\t);\n\t\tif (columns.length === 0) {\n\t\t\tappendRepeatedWidth(groupWidth, parseTableColumnSpan(groupEl.getAttribute('span')), widths);\n\t\t\tcontinue;\n\t\t}\n\n\t\tfor (const column of columns) appendColumnElementWidths(column, groupWidth, widths);\n\t}\n\n\treturn normalizeTableColumnWidthsPx(widths);\n}\n\nfunction appendColumnElementWidths(\n\tcolumn: HTMLElement,\n\tinheritedWidth: number | undefined,\n\twidths: (number | null)[],\n): void {\n\tconst width: number | undefined = readTableColumnWidthPx(column) ?? inheritedWidth;\n\tappendRepeatedWidth(width, parseTableColumnSpan(column.getAttribute('span')), widths);\n}\n\nfunction appendRepeatedWidth(\n\twidth: number | undefined,\n\tspan: number,\n\twidths: (number | null)[],\n): void {\n\tconst remaining: number = MAX_SERIALIZED_TABLE_COLUMNS - widths.length;\n\tconst count: number = Math.min(span, Math.max(0, remaining));\n\tfor (let index = 0; index < count; index++) widths.push(width ?? null);\n}\n\nfunction readTableColumnWidthPx(element: HTMLElement): number | undefined {\n\treturn readTableDimensionPx(element, TABLE_COLUMN_WIDTH_DATA_ATTRIBUTE, ['width'], 'width');\n}\n\n/** Extracts one row's validated minimum height from canonical or conventional HTML. */\nfunction extractTableRowMinHeight(\n\trow: HTMLElement,\n\tattrs: Record<string, string | number | boolean>,\n): void {\n\tconst minHeightPx: number | undefined = readTableDimensionPx(\n\t\trow,\n\t\tTABLE_ROW_MIN_HEIGHT_DATA_ATTRIBUTE,\n\t\t['min-height', 'height'],\n\t\t'height',\n\t);\n\tif (minHeightPx !== undefined) attrs.minHeightPx = minHeightPx;\n}\n\n/** Collects `<tr>` elements from a table, traversing through `<thead>`/`<tbody>`/`<tfoot>`. */\nfunction collectTableRows(tableEl: Element): Element[] {\n\tconst rows: Element[] = [];\n\tfor (const child of Array.from(tableEl.children)) {\n\t\tconst tag: string = child.tagName.toLowerCase();\n\t\tif (tag === 'tr') {\n\t\t\trows.push(child);\n\t\t} else if (tag === 'thead' || tag === 'tbody' || tag === 'tfoot') {\n\t\t\tfor (const nested of Array.from(child.children)) {\n\t\t\t\tif (nested.tagName.toLowerCase() === 'tr') {\n\t\t\t\t\trows.push(nested);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn rows;\n}\n\n/** Regex to extract the `--ntbl-bc` CSS custom property from inline styles. */\nconst BORDER_COLOR_RE = /--ntbl-bc:\\s*(#[0-9a-fA-F]{3,8}|transparent)/;\n\n/** Extracts `borderColor` from a table element's inline style (`--ntbl-bc` CSS variable). */\nfunction extractTableBorderColor(el: HTMLElement, attrs: Record<string, BlockAttrValue>): void {\n\tconst style: string = el.getAttribute('style') ?? '';\n\tconst match: RegExpMatchArray | null = BORDER_COLOR_RE.exec(style);\n\tif (!match?.[1]) return;\n\tattrs.borderColor = match[1] === 'transparent' ? 'none' : match[1];\n}\n\n/** Extracts `colspan` and `rowspan` attributes from a table cell element. */\nfunction extractCellSpanAttrs(\n\tel: HTMLElement,\n\tattrs: Record<string, string | number | boolean>,\n): void {\n\tconst colspan: string | null = el.getAttribute('colspan');\n\tif (colspan) {\n\t\tconst value: number = parseTableColumnSpan(colspan);\n\t\tif (value > 1) attrs.colspan = value;\n\t}\n\tconst rowspan: string | null = el.getAttribute('rowspan');\n\tif (rowspan) {\n\t\tconst value: number = parseTableColumnSpan(rowspan);\n\t\tif (value > 1) attrs.rowspan = value;\n\t}\n}\n\n/**\n * Parses a `<blockquote>` into a container block whose children are block nodes\n * (issue #136). Block-level children (lists, paragraphs, headings, nested quotes)\n * are parsed recursively; a quote holding only inline content becomes a single\n * paragraph child so the container invariant (block children only) always holds.\n */\nfunction parseBlockquoteElement(\n\tel: HTMLElement,\n\tblocks: BlockNode[],\n\tadoptedIds: Set<string>,\n\tregistry?: SchemaRegistry,\n): void {\n\tconst blockRules = registry?.getBlockParseRules() ?? [];\n\tconst innerBlocks: BlockNode[] = parseBlockContainerChildren(\n\t\tel,\n\t\tblockRules,\n\t\tadoptedIds,\n\t\tregistry,\n\t);\n\n\t// Empty or whitespace-only blockquote: keep a single empty paragraph so the\n\t// container always holds editable content.\n\tif (innerBlocks.length === 0) {\n\t\tinnerBlocks.push(createBlockNode(nodeType('paragraph'), [createTextNode('')]));\n\t}\n\n\t// Preserve direction/alignment on the container so the HTML round-trip is stable.\n\tconst attrs: Record<string, string | number | boolean> = {};\n\textractAlignment(el, attrs);\n\textractDirection(el, attrs);\n\n\tblocks.push(\n\t\tcreateBlockNode(\n\t\t\tnodeType('blockquote'),\n\t\t\tinnerBlocks,\n\t\t\tadoptBlockId(el, adoptedIds),\n\t\t\tObject.keys(attrs).length > 0 ? attrs : undefined,\n\t\t\textractHTMLId(el),\n\t\t),\n\t);\n}\n\n/** Parses a table cell's content into blocks, supporting all block types (lists, quotes, etc.). */\nfunction parseTableCellContent(\n\tcellEl: HTMLElement,\n\tadoptedIds: Set<string>,\n\tregistry?: SchemaRegistry,\n): BlockNode[] {\n\tconst blockRules = registry?.getBlockParseRules() ?? [];\n\tconst cellBlocks: BlockNode[] = parseBlockContainerChildren(\n\t\tcellEl,\n\t\tblockRules,\n\t\tadoptedIds,\n\t\tregistry,\n\t);\n\n\t// No blocks produced: treat the cell as one empty paragraph.\n\tif (cellBlocks.length === 0) {\n\t\tcellBlocks.push(createBlockNode(nodeType('paragraph'), [createTextNode('')]));\n\t}\n\n\treturn cellBlocks;\n}\n\ntype BlockParseRules = readonly { readonly rule: ParseRule; readonly type: string }[];\n\n/**\n * Parses the children of a block container (blockquote, table cell) into block\n * nodes. Consecutive inline content (text nodes and inline elements such as\n * `<em>`, `<strong>`, `<a>`) is coalesced into a single paragraph with its marks\n * intact, while genuine block children (paragraphs, headings, lists, tables,\n * nested blockquotes) are parsed recursively. This preserves the common quote\n * shape that mixes text with inline marks as one paragraph (issue #141).\n */\nfunction parseBlockContainerChildren(\n\tel: HTMLElement,\n\tblockRules: BlockParseRules,\n\tadoptedIds: Set<string>,\n\tregistry?: SchemaRegistry,\n\tskip?: (node: ChildNode) => boolean,\n): BlockNode[] {\n\tconst blocks: BlockNode[] = [];\n\tlet inlineRun: ChildNode[] = [];\n\n\tconst flushInlineRun = (): void => {\n\t\tif (inlineRunHasContent(inlineRun)) {\n\t\t\tblocks.push(\n\t\t\t\tcreateBlockNode(nodeType('paragraph'), parseNodesToInlineContent(inlineRun, registry)),\n\t\t\t);\n\t\t}\n\t\tinlineRun = [];\n\t};\n\n\tfor (const child of Array.from(el.childNodes)) {\n\t\tif (skip?.(child)) continue;\n\t\tif (isBlockLevelChild(child, blockRules)) {\n\t\t\tflushInlineRun();\n\t\t\tparseChildNode(child, blocks, blockRules, adoptedIds, registry);\n\t\t} else {\n\t\t\tinlineRun.push(child);\n\t\t}\n\t}\n\tflushInlineRun();\n\n\treturn blocks;\n}\n\n/**\n * Whether a child node is block-level content. Known container tags (lists,\n * tables, nested blockquotes) and any element matching a block parse rule\n * (paragraphs, headings, code blocks, ...) are block-level; text nodes and\n * inline elements (`<em>`, `<a>`, `<br>`, ...) are not.\n */\nfunction isBlockLevelChild(node: ChildNode, blockRules: BlockParseRules): boolean {\n\tif (node.nodeType !== Node.ELEMENT_NODE) return false;\n\tconst el = node as HTMLElement;\n\tconst tag: string = el.tagName.toLowerCase();\n\tif (tag === 'p' || tag === 'ul' || tag === 'ol' || tag === 'table' || tag === 'blockquote') {\n\t\treturn true;\n\t}\n\treturn matchBlockParseRule(el, blockRules) !== null;\n}\n\n/** Whether an inline run carries meaningful content (non-whitespace text or any element). */\nfunction inlineRunHasContent(nodes: readonly ChildNode[]): boolean {\n\tfor (const node of nodes) {\n\t\tif (node.nodeType === Node.ELEMENT_NODE) return true;\n\t\tif (node.nodeType === Node.TEXT_NODE && node.textContent?.trim()) return true;\n\t}\n\treturn false;\n}\n\n/**\n * Parses an HTML element's inline children into (TextNode | InlineNode)[].\n * Applies mark parse rules and inline node parse rules.\n */\nfunction parseElementToInlineContent(\n\tel: HTMLElement,\n\tregistry?: SchemaRegistry,\n\tskipNestedLists?: boolean,\n): (TextNode | InlineNode)[] {\n\treturn parseNodesToInlineContent([el], registry, skipNestedLists);\n}\n\n/**\n * Walks a list of sibling DOM nodes into inline content, applying mark and\n * inline-node parse rules. Each node is walked from an empty mark set, so a run\n * mixing text and inline elements (e.g. `text <em>x</em> end`) coalesces into a\n * single inline sequence with marks preserved on the styled run.\n */\nfunction parseNodesToInlineContent(\n\tnodes: readonly ChildNode[],\n\tregistry?: SchemaRegistry,\n\tskipNestedLists?: boolean,\n): (TextNode | InlineNode)[] {\n\tconst result: (TextNode | InlineNode)[] = [];\n\tconst markRules = registry?.getMarkParseRules() ?? [];\n\tconst inlineRules = registry?.getInlineParseRules() ?? [];\n\tfor (const node of nodes) {\n\t\twalkElement(node, [], result, markRules, inlineRules, skipNestedLists);\n\t}\n\n\t// A lone <br> as the only content of a block is a placeholder for an empty\n\t// paragraph (e.g. `<p><br></p>`), not a real hard break. Normalize to empty text.\n\tif (result.length === 1 && isInlineNode(result[0]) && result[0].inlineType === 'hard_break') {\n\t\treturn [createTextNode('')];\n\t}\n\n\treturn result.length > 0 ? result : [createTextNode('')];\n}\n\n/**\n * Recursively walks DOM nodes, collecting marks from parse rules,\n * matching inline node parse rules, and producing TextNodes/InlineNodes.\n */\nfunction walkElement(\n\tnode: Node,\n\tcurrentMarks: Mark[],\n\tresult: (TextNode | InlineNode)[],\n\tmarkRules: readonly { readonly rule: ParseRule; readonly type: string }[],\n\tinlineRules: readonly { readonly rule: ParseRule; readonly type: string }[],\n\tskipNestedLists?: boolean,\n): void {\n\tif (node.nodeType === Node.TEXT_NODE) {\n\t\tconst text: string = node.textContent ?? '';\n\t\tif (text) {\n\t\t\tresult.push(createTextNode(text, [...currentMarks]));\n\t\t}\n\t\treturn;\n\t}\n\n\tif (node.nodeType !== Node.ELEMENT_NODE) return;\n\n\tconst el = node as HTMLElement;\n\tconst tag: string = el.tagName.toLowerCase();\n\n\t// Skip nested lists inside <li> (handled by parseListElement)\n\tif (skipNestedLists && (tag === 'ul' || tag === 'ol')) return;\n\n\t// Skip checkbox inputs inside list items (already handled by parseListElement)\n\tif (skipNestedLists && tag === 'input' && el.getAttribute('type') === 'checkbox') return;\n\n\t// Try inline node parse rules first (atomic — no recursion)\n\tfor (const entry of inlineRules) {\n\t\tif (entry.rule.tag !== tag) continue;\n\n\t\tif (entry.rule.getAttrs) {\n\t\t\tconst attrs = entry.rule.getAttrs(el);\n\t\t\tif (attrs === false) continue;\n\t\t\tresult.push(\n\t\t\t\tcreateInlineNode(\n\t\t\t\t\tinlineType(entry.type) as InlineTypeName,\n\t\t\t\t\tattrs as Readonly<Record<string, string | number | boolean>>,\n\t\t\t\t\t[...currentMarks],\n\t\t\t\t),\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tresult.push(\n\t\t\tcreateInlineNode(inlineType(entry.type) as InlineTypeName, undefined, [...currentMarks]),\n\t\t);\n\t\treturn;\n\t}\n\n\tconst marks: Mark[] = [...currentMarks];\n\n\t// Try mark parse rules — collect all matching marks for this element\n\tconst matchedTypes = new Set<string>();\n\tfor (const entry of markRules) {\n\t\tif (entry.rule.tag !== tag) continue;\n\t\tif (matchedTypes.has(entry.type)) continue;\n\n\t\tif (entry.rule.getAttrs) {\n\t\t\tconst attrs = entry.rule.getAttrs(el);\n\t\t\tif (attrs === false) continue;\n\t\t\tif (!marks.some((m) => m.type === entry.type)) {\n\t\t\t\tmarks.push({\n\t\t\t\t\ttype: markType(entry.type),\n\t\t\t\t\t...(Object.keys(attrs).length > 0 ? { attrs } : {}),\n\t\t\t\t} as Mark);\n\t\t\t\tmatchedTypes.add(entry.type);\n\t\t\t}\n\t\t} else {\n\t\t\tif (!marks.some((m) => m.type === entry.type)) {\n\t\t\t\tmarks.push({ type: markType(entry.type) });\n\t\t\t\tmatchedTypes.add(entry.type);\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (const child of Array.from(el.childNodes)) {\n\t\twalkElement(child, marks, result, markRules, inlineRules, skipNestedLists);\n\t}\n}\n\n/** Extracts a validated `dir` attribute or inline `direction` style from an element. */\nfunction extractDirection(el: HTMLElement, attrs: Record<string, string | number | boolean>): void {\n\tconst dir: string | null = el.getAttribute('dir');\n\tif (dir && VALID_DIRECTIONS.has(dir)) {\n\t\tattrs.dir = dir;\n\t\treturn;\n\t}\n\n\t// Fallback: check inline style `direction: rtl/ltr` (common in paste from Word/Docs)\n\tconst styleDir: string = el.style?.direction ?? '';\n\tif (styleDir && VALID_DIRECTIONS.has(styleDir)) {\n\t\tattrs.dir = styleDir;\n\t}\n}\n\n/** Reads a conforming document-local HTML target from a block element. */\nfunction extractHTMLId(el: HTMLElement): string | undefined {\n\treturn normalizeHTMLId(el.getAttribute('id'));\n}\n\n/** Legacy physical → logical alignment mapping for backward-compatible parsing. */\nconst LEGACY_ALIGNMENT_MAP: Readonly<Record<string, string>> = { left: 'start', right: 'end' };\n\n/** Extracts validated `text-align` from an element's style or class and adds it to attrs. */\nfunction extractAlignment(el: HTMLElement, attrs: Record<string, string | number | boolean>): void {\n\t// Check inline style first (works for both normal and rehydrated HTML)\n\tlet align: string = el.style?.textAlign ?? '';\n\tconst mappedAlign: string | undefined = LEGACY_ALIGNMENT_MAP[align];\n\tif (mappedAlign) align = mappedAlign;\n\tif (align && VALID_ALIGNMENTS.has(align)) {\n\t\tattrs.align = align;\n\t\treturn;\n\t}\n\n\t// Check for notectl-align-* class names (from class-based HTML)\n\tfor (const cls of Array.from(el.classList)) {\n\t\tconst match: RegExpMatchArray | null = cls.match(/^notectl-align-(\\w+)$/);\n\t\tlet alignValue: string | undefined = match?.[1];\n\t\tconst mappedAlignValue: string | undefined = LEGACY_ALIGNMENT_MAP[alignValue ?? ''];\n\t\tif (mappedAlignValue) alignValue = mappedAlignValue;\n\t\tif (alignValue && VALID_ALIGNMENTS.has(alignValue)) {\n\t\t\tattrs.align = alignValue;\n\t\t\treturn;\n\t\t}\n\t}\n}\n\n/**\n * Rehydrates class-based HTML by converting notectl class names back to inline styles.\n * This allows existing parse rules (which read inline styles) to work unchanged.\n */\nfunction rehydrateClasses(root: DocumentFragment, styleMap: ReadonlyMap<string, string>): void {\n\tconst elements: NodeListOf<Element> = root.querySelectorAll('[class]');\n\tfor (const el of Array.from(elements)) {\n\t\tconst htmlEl = el as HTMLElement;\n\t\tconst classes: string[] = Array.from(htmlEl.classList);\n\t\tconst toRemove: string[] = [];\n\n\t\tfor (const cls of classes) {\n\t\t\tconst declarations: string | undefined = styleMap.get(cls);\n\t\t\tif (declarations) {\n\t\t\t\t// Append declarations to existing inline style\n\t\t\t\tconst existing: string = htmlEl.getAttribute('style') ?? '';\n\t\t\t\tconst separator: string = existing && !existing.endsWith(';') ? '; ' : '';\n\t\t\t\thtmlEl.setAttribute('style', existing + separator + declarations);\n\t\t\t\ttoRemove.push(cls);\n\t\t\t}\n\t\t}\n\n\t\t// Remove rehydrated class names\n\t\tfor (const cls of toRemove) {\n\t\t\thtmlEl.classList.remove(cls);\n\t\t}\n\t}\n}\n\n/** Matches an element against block parse rules. Returns matched type and attrs. */\nfunction matchBlockParseRule(\n\tel: HTMLElement,\n\trules: readonly { readonly rule: ParseRule; readonly type: string }[],\n): { readonly type: string; readonly attrs?: Record<string, unknown> } | null {\n\tconst tag: string = el.tagName.toLowerCase();\n\tfor (const entry of rules) {\n\t\tif (entry.rule.tag !== tag) continue;\n\t\tif (entry.rule.getAttrs) {\n\t\t\tconst attrs = entry.rule.getAttrs(el);\n\t\t\tif (attrs === false) continue;\n\t\t\treturn { type: entry.type, attrs };\n\t\t}\n\t\treturn { type: entry.type };\n\t}\n\treturn null;\n}\n"],"mappings":"qZAsBA,IAAM,EAAiC,gBAQjC,iBAAuC,IAAI,IAAI,CACpD,IACA,MACA,KACA,KACA,KACA,KACA,KACA,KACA,aACA,KACA,KACA,KACA,QACA,QACA,QACA,QACA,KACA,KACA,KACA,KACA,SACA,aACA,UACA,UACA,SACA,SACA,OACA,QACA,MACA,KACA,KACA,OAIK,iBAAqC,IAAI,IAAI,CAAC,MAAO,aAGrD,iBAAkD,IAAI,IAAI,CAC/D,MACA,WACA,WACA,iBAkBD,SAAgB,EAAwB,GACvC,EAAiB,EAClB,CAGA,SAAS,EAAiB,GACzB,MAAM,EAAuB,CAAE,aAAc,KAAM,iBAAiB,GACpE,IAAK,MAAM,KAAS,MAAM,KAAK,EAAU,YACxC,EAAY,EAAO,GAEpB,EAAkB,EAAM,aACzB,CAEA,SAAS,EAAY,EAAiB,GACrC,GAAI,EAAK,WAAa,KAAK,UAE1B,YA2BF,SAA0B,EAAY,GACrC,IAAI,EAAe,EAAK,KAAK,QAAQ,EAAwB,KACzD,EAAM,iBAAmB,EAAK,WAAW,OAC5C,EAAO,EAAK,MAAM,IAEnB,EAAK,KAAO,EAIQ,IAAhB,EAAK,SAET,EAAM,gBAAkB,EAAK,SAAS,KACtC,EAAM,aAAe,EACtB,CAzCE,CAAiB,EAAc,GAGhC,GAAI,EAAK,WAAa,KAAK,aAAc,OAEzC,MAAM,EAAK,EAIX,GAoDD,SAA2B,GAC1B,GAAI,EAAc,IAAI,EAAG,SAAU,OAAO,EAC1C,MAAM,GAAsB,EAAG,OAAO,YAAc,IAAI,cACxD,OAAO,EAA2B,IAAI,EACvC,CAxDK,CAAkB,GACrB,EAAa,OADd,CAMA,GA0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GA,SAAS,EAAc,GACtB,OAAO,EAAgB,EAAG,aAAa,MACxC,CAGA,IAAM,EAAyD,CAAE,KAAM,QAAS,MAAO,OAGvF,SAAS,EAAiB,EAAiB,GAE1C,IAAI,EAAgB,EAAG,OAAO,WAAa,GAC3C,MAAM,EAAkC,EAAqB,GAE7D,GADI,IAAa,EAAQ,GACrB,GAAS,EAAiB,IAAI,GACjC,EAAM,MAAQ,OAKf,IAAK,MAAM,KAAO,MAAM,KAAK,EAAG,WAAY,CAE3C,IAAI,EADmC,EAAI,MAAM,2BACJ,GAC7C,MAAM,EAAuC,EAAqB,GAAc,IAEhF,GADI,IAAkB,EAAa,GAC/B,GAAc,EAAiB,IAAI,GAEtC,YADA,EAAM,MAAQ,EAGhB,CACD,CAgCA,SAAS,EACR,EACA,GAEA,MAAM,EAAc,EAAG,QAAQ,cAC/B,IAAK,MAAM,KAAS,EACnB,GAAI,EAAM,KAAK,MAAQ,EAAvB,CACA,GAAI,EAAM,KAAK,SAAU,CACxB,MAAM,EAAQ,EAAM,KAAK,SAAS,GAClC,IAAc,IAAV,EAAiB,SACrB,MAAO,CAAE,KAAM,EAAM,KAAM,QAC5B,CACA,MAAO,CAAE,KAAM,EAAM,KANO,CAQ7B,OAAO,IACR"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{i as t}from"./TypeBrands-Ch9856Gb.mjs";import{i as e,n,r as o,t as i}from"./AttributedMarkCommands-B3MQdob_.mjs";import{c as r,n as s,o as a}from"./PluginHelpers-WG1Lzzh3.mjs";import{c as l,n as c}from"./StyleRuntime-C0RSqKzG.mjs";import{n as m}from"./ColorValidation-B9d_umnf.mjs";import{t as p}from"./InlineStyleMarkSpec-Cx3goc3W.mjs";var f={label:"Font",tooltip:"Font Family"},d=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar-DahJwMI9.mjs"),"./locales/de.ts":()=>import("./de-DiPz7abS.mjs"),"./locales/es.ts":()=>import("./es-CCQFu1t1.mjs"),"./locales/fr.ts":()=>import("./fr-BwWrFThE.mjs"),"./locales/hi.ts":()=>import("./hi-B-ZuX4aN.mjs"),"./locales/pt.ts":()=>import("./pt-Dg2ctkug.mjs"),"./locales/ru.ts":()=>import("./ru-DJMpeuey.mjs"),"./locales/zh.ts":()=>import("./zh-CRsDvfPR.mjs")});async function h(t){return r(d,t,f)}var g=class{id="font";name="Font";priority=22;config;locale;injectedStyleElement=null;context=null;constructor(t){this.config=t}async init(t){this.locale=await a(t,this.config.locale,f,h),t.registerStyleSheet("\n/* Font Select — Width overrides for combobox button */\n.notectl-toolbar-btn--font {\n\tmin-width: 100px;\n\tmax-width: 160px;\n}\n\n/* Font Picker Popup */\n.notectl-font-picker {\n\tmin-width: 200px;\n\tmax-height: 320px;\n\toverflow-y: auto;\n}\n\n.notectl-font-picker__list {\n\tpadding: 4px 0;\n}\n\n.notectl-font-picker__item {\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 8px;\n\twidth: 100%;\n\tpadding: 7px 12px;\n\tborder: none;\n\tbackground: none;\n\tcursor: pointer;\n\tfont-size: 14px;\n\tcolor: var(--notectl-fg);\n\tline-height: 1.4;\n\ttext-align: start;\n\twhite-space: nowrap;\n\tfont-family: inherit;\n\ttransition: background 0.1s;\n}\n\n@media (hover: hover) {\n\t.notectl-font-picker__item:hover {\n\t\tbackground: var(--notectl-hover-bg);\n\t}\n}\n\n.notectl-font-picker__item--active {\n\tbackground: var(--notectl-active-bg);\n\tcolor: var(--notectl-accent-fg);\n}\n\n@media (hover: hover) {\n\t.notectl-font-picker__item--active:hover {\n\t\tbackground: var(--notectl-active-bg);\n\t}\n}\n\n.notectl-font-picker__check {\n\tdisplay: inline-flex;\n\talign-items: center;\n\tjustify-content: center;\n\twidth: 16px;\n\tflex-shrink: 0;\n\tfont-size: 13px;\n\tfont-weight: 600;\n\tcolor: var(--notectl-accent-fg);\n}\n\n.notectl-font-picker__label {\n\tflex: 1;\n}\n\n.notectl-font-picker__separator {\n\theight: 1px;\n\tbackground: var(--notectl-border);\n\tmargin: 4px 8px;\n}\n"),this.context=t,this.registerMarkSpec(t),this.registerCommands(t),this.config.fonts.length>0&&this.registerToolbarItem(t),this.injectFontFaces()}destroy(){this.injectedStyleElement?.remove(),this.injectedStyleElement=null,this.context=null}registerMarkSpec(t){t.registerMarkSpec(p({type:"font",rank:6,valueAttr:"family",domStyleProperty:"fontFamily",cssProperty:"font-family",validate:m,transformParsed:t=>t.replace(/"/g,"'")}))}registerCommands(t){t.registerCommand("removeFont",()=>{const e=t.getState();return this.removeFont(t,e)}),t.registerCommand("setFont",()=>!1)}get defaultFont(){if(this.config.defaultFont){const t=this.config.fonts.find(t=>t.name===this.config.defaultFont);if(t)return t}return this.config.fonts[0]}registerToolbarItem(t){t.registerToolbarItem({id:"font",group:"format",label:this.locale.label,tooltip:this.locale.tooltip,command:"removeFont",popupType:"combobox",getLabel:t=>this.resolveFontName(this.getActiveFont(t)),renderPopup:(t,e,n)=>{this.renderFontPopup(t,e,n)},isActive:t=>this.isFontActive(t)})}resolveFontName(t){return t?this.config.fonts.find(e=>e.family===t)?.name??(t.split(",")[0]??"").trim().replace(/['"]/g,""):this.defaultFont?.name??this.locale.label}isFontActive(t){return o(t,"font")}getActiveFont(t){return n(t,"font",t=>t.attrs.family??null)}applyFont(e,n,o){const r={type:t("font"),attrs:{family:o}};return s(e,i(n,r))}removeFont(n,o){return s(n,e(o,t("font")))}injectFontFaces(){const t=[];for(const o of this.config.fonts)if(o.fontFaces?.length)for(const e of o.fontFaces){const n=[`font-family: '${(o.family.split(",")[0]??"").trim().replace(/['"]/g,"")}'`,`src: ${e.src}`];e.weight&&n.push(`font-weight: ${e.weight}`),e.style&&n.push(`font-style: ${e.style}`),n.push(`font-display: ${e.display??"swap"}`),t.push(`@font-face {\n\t${n.join(";\n\t")};\n}`)}if(0===t.length)return;const e=document.createElement("style");e.setAttribute("data-notectl-fonts","");const n=this.context?c(this.context.getContainer()):void 0;n&&e.setAttribute("nonce",n),e.textContent=t.join("\n\n"),document.head.appendChild(e),this.injectedStyleElement=e}renderFontPopup(t,e,n){t.classList.add("notectl-font-picker");const o=e.getState(),i=this.getActiveFont(o),r=this.defaultFont?.family,s=e.getContainer(),a=document.createElement("div");a.className="notectl-font-picker__list",a.setAttribute("role","listbox"),a.setAttribute("aria-label",this.locale.label);for(const l of this.config.fonts){const t=void 0!==r&&l.family===r,o=t&&!i||i===l.family,c=this.createFontItem(l.name,l.family,o,()=>{t?e.executeCommand("removeFont"):this.applyFont(e,e.getState(),l.family),n({restoreFocusTo:s})});l.category&&c.setAttribute("data-category",l.category),a.appendChild(c)}t.appendChild(a)}createFontItem(t,e,n,o){const i=document.createElement("button");i.type="button",i.className="notectl-font-picker__item",i.setAttribute("role","option"),i.setAttribute("aria-selected",String(n)),n&&i.classList.add("notectl-font-picker__item--active");const r=document.createElement("span");r.className="notectl-font-picker__check",r.textContent=n?"✓":"",i.appendChild(r);const s=document.createElement("span");return s.className="notectl-font-picker__label",s.textContent=t,e&&l(s,"fontFamily",e),i.appendChild(s),i.addEventListener("mousedown",t=>{t.preventDefault(),t.stopPropagation()}),i.addEventListener("click",o),i}};export{f as n,h as r,g as t};
|
|
2
|
-
//# sourceMappingURL=FontPlugin-BySgRcF3.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FontPlugin-BySgRcF3.mjs","names":[],"sources":["../../src/editor/styles/font-select.ts","../../src/plugins/font/FontLocale.ts","../../src/plugins/font/FontPlugin.ts"],"sourcesContent":["/** Font picker toolbar combobox + popup styles. */\nexport const FONT_SELECT_CSS = `\n/* Font Select — Width overrides for combobox button */\n.notectl-toolbar-btn--font {\n\tmin-width: 100px;\n\tmax-width: 160px;\n}\n\n/* Font Picker Popup */\n.notectl-font-picker {\n\tmin-width: 200px;\n\tmax-height: 320px;\n\toverflow-y: auto;\n}\n\n.notectl-font-picker__list {\n\tpadding: 4px 0;\n}\n\n.notectl-font-picker__item {\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 8px;\n\twidth: 100%;\n\tpadding: 7px 12px;\n\tborder: none;\n\tbackground: none;\n\tcursor: pointer;\n\tfont-size: 14px;\n\tcolor: var(--notectl-fg);\n\tline-height: 1.4;\n\ttext-align: start;\n\twhite-space: nowrap;\n\tfont-family: inherit;\n\ttransition: background 0.1s;\n}\n\n@media (hover: hover) {\n\t.notectl-font-picker__item:hover {\n\t\tbackground: var(--notectl-hover-bg);\n\t}\n}\n\n.notectl-font-picker__item--active {\n\tbackground: var(--notectl-active-bg);\n\tcolor: var(--notectl-accent-fg);\n}\n\n@media (hover: hover) {\n\t.notectl-font-picker__item--active:hover {\n\t\tbackground: var(--notectl-active-bg);\n\t}\n}\n\n.notectl-font-picker__check {\n\tdisplay: inline-flex;\n\talign-items: center;\n\tjustify-content: center;\n\twidth: 16px;\n\tflex-shrink: 0;\n\tfont-size: 13px;\n\tfont-weight: 600;\n\tcolor: var(--notectl-accent-fg);\n}\n\n.notectl-font-picker__label {\n\tflex: 1;\n}\n\n.notectl-font-picker__separator {\n\theight: 1px;\n\tbackground: var(--notectl-border);\n\tmargin: 4px 8px;\n}\n`;\n","/** Locale interface and default English locale for the FontPlugin. */\n\nimport { type LocaleModuleMap, loadLocaleModule } from '../shared/LocaleLoader.js';\n\n// --- Locale Interface ---\n\nexport interface FontLocale {\n\treadonly label: string;\n\treadonly tooltip: string;\n}\n\n// --- Default English Locale ---\n\nexport const FONT_LOCALE_EN: FontLocale = {\n\tlabel: 'Font',\n\ttooltip: 'Font Family',\n};\n\n// --- Lazy Locale Loader ---\n\nconst localeModules: LocaleModuleMap<FontLocale> = import.meta.glob<{\n\tdefault: FontLocale;\n}>('./locales/*.ts', { eager: false });\n\nexport async function loadFontLocale(lang: string): Promise<FontLocale> {\n\treturn loadLocaleModule(localeModules, lang, FONT_LOCALE_EN);\n}\n","/**\n * FontPlugin: registers a font-family mark, a combobox-style toolbar selector\n * for font selection, and a developer-friendly API for registering custom fonts\n * (WOFF2, TTF, OTF).\n */\n\nimport {\n\tapplyAttributedMark,\n\tgetMarkAttrAtSelection,\n\tisAttributedMarkActive,\n\tremoveAttributedMark,\n} from '../../commands/AttributedMarkCommands.js';\nimport { FONT_SELECT_CSS } from '../../editor/styles/font-select.js';\nimport { markType } from '../../model/TypeBrands.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport { getStyleNonceForNode, setStyleProperty } from '../../style/StyleRuntime.js';\nimport type { Plugin, PluginContext } from '../Plugin.js';\nimport { isValidCSSFontFamily } from '../shared/ColorValidation.js';\nimport { createInlineStyleMarkSpec } from '../shared/InlineStyleMarkSpec.js';\nimport { dispatchIfPresent, resolveLocale } from '../shared/PluginHelpers.js';\nimport type { PopupCloseOptions } from '../shared/PopupManager.js';\nimport { FONT_LOCALE_EN, type FontLocale, loadFontLocale } from './FontLocale.js';\n\n// --- Attribute Registry Augmentation ---\n\ndeclare module '../../model/AttrRegistry.js' {\n\tinterface MarkAttrRegistry {\n\t\tfont: { family: string };\n\t}\n}\n\n// --- Public Types ---\n\n/** Describes a single @font-face source. */\nexport interface FontFaceDescriptor {\n\t/** CSS `src` value, e.g. `\"url('/fonts/My.woff2') format('woff2')\"`. */\n\treadonly src: string;\n\t/** Font weight, e.g. `'400'` or `'300 700'` for variable fonts. */\n\treadonly weight?: string;\n\t/** Font style, e.g. `'normal'` or `'italic'`. */\n\treadonly style?: string;\n\t/** Font display strategy. Defaults to `'swap'`. */\n\treadonly display?: string;\n}\n\n/** Defines a font available in the editor. */\nexport interface FontDefinition {\n\t/** Display name shown in the toolbar dropdown. */\n\treadonly name: string;\n\t/** CSS `font-family` value, e.g. `\"'Fira Code', monospace\"`. */\n\treadonly family: string;\n\t/** Font category for grouping in the UI. */\n\treadonly category?: 'serif' | 'sans-serif' | 'monospace' | 'display' | 'handwriting';\n\t/**\n\t * Optional `@font-face` descriptors. When provided, the plugin\n\t * auto-injects the corresponding CSS rules into the document.\n\t */\n\treadonly fontFaces?: readonly FontFaceDescriptor[];\n}\n\n// --- Configuration ---\n\nexport interface FontConfig {\n\t/**\n\t * Fonts available in the editor. System fonts require no `fontFaces`.\n\t * Custom fonts with `fontFaces` get their `@font-face` rules auto-injected.\n\t *\n\t * Use `STARTER_FONTS` for a pre-configured set of fonts:\n\t * ```ts\n\t * new FontPlugin({ fonts: [...STARTER_FONTS] })\n\t * ```\n\t */\n\treadonly fonts: readonly FontDefinition[];\n\t/**\n\t * Name of the font that acts as the editor's default.\n\t * Selecting this font removes the mark (since the editor already uses it).\n\t * Defaults to the first font in the list.\n\t */\n\treadonly defaultFont?: string;\n\treadonly locale?: FontLocale;\n}\n\n// --- Plugin ---\n\nexport class FontPlugin implements Plugin {\n\treadonly id = 'font';\n\treadonly name = 'Font';\n\treadonly priority = 22;\n\n\tprivate readonly config: FontConfig;\n\tprivate locale!: FontLocale;\n\tprivate injectedStyleElement: HTMLStyleElement | null = null;\n\tprivate context: PluginContext | null = null;\n\n\tconstructor(config: FontConfig) {\n\t\tthis.config = config;\n\t}\n\n\tasync init(context: PluginContext): Promise<void> {\n\t\tthis.locale = await resolveLocale(context, this.config.locale, FONT_LOCALE_EN, loadFontLocale);\n\n\t\tcontext.registerStyleSheet(FONT_SELECT_CSS);\n\t\tthis.context = context;\n\t\tthis.registerMarkSpec(context);\n\t\tthis.registerCommands(context);\n\t\tif (this.config.fonts.length > 0) {\n\t\t\tthis.registerToolbarItem(context);\n\t\t}\n\t\tthis.injectFontFaces();\n\t}\n\n\tdestroy(): void {\n\t\tthis.injectedStyleElement?.remove();\n\t\tthis.injectedStyleElement = null;\n\t\tthis.context = null;\n\t}\n\n\t// --- Schema ---\n\n\tprivate registerMarkSpec(context: PluginContext): void {\n\t\tcontext.registerMarkSpec(\n\t\t\tcreateInlineStyleMarkSpec({\n\t\t\t\ttype: 'font',\n\t\t\t\trank: 6,\n\t\t\t\tvalueAttr: 'family',\n\t\t\t\tdomStyleProperty: 'fontFamily',\n\t\t\t\tcssProperty: 'font-family',\n\t\t\t\tvalidate: isValidCSSFontFamily,\n\t\t\t\t// Browsers normalize CSS quotes to double-quotes; our internal\n\t\t\t\t// convention uses single-quotes.\n\t\t\t\ttransformParsed: (family) => family.replace(/\"/g, \"'\"),\n\t\t\t}),\n\t\t);\n\t}\n\n\t// --- Commands ---\n\n\tprivate registerCommands(context: PluginContext): void {\n\t\tcontext.registerCommand('removeFont', () => {\n\t\t\tconst state: EditorState = context.getState();\n\t\t\treturn this.removeFont(context, state);\n\t\t});\n\n\t\tcontext.registerCommand('setFont', () => {\n\t\t\treturn false;\n\t\t});\n\t}\n\n\t// --- Toolbar ---\n\n\tprivate get defaultFont(): FontDefinition | undefined {\n\t\tif (this.config.defaultFont) {\n\t\t\tconst found: FontDefinition | undefined = this.config.fonts.find(\n\t\t\t\t(f) => f.name === this.config.defaultFont,\n\t\t\t);\n\t\t\tif (found) return found;\n\t\t}\n\t\treturn this.config.fonts[0];\n\t}\n\n\tprivate registerToolbarItem(context: PluginContext): void {\n\t\tcontext.registerToolbarItem({\n\t\t\tid: 'font',\n\t\t\tgroup: 'format',\n\t\t\tlabel: this.locale.label,\n\t\t\ttooltip: this.locale.tooltip,\n\t\t\tcommand: 'removeFont',\n\t\t\tpopupType: 'combobox',\n\t\t\tgetLabel: (state: EditorState): string => this.resolveFontName(this.getActiveFont(state)),\n\t\t\trenderPopup: (container, ctx, onClose) => {\n\t\t\t\tthis.renderFontPopup(container, ctx, onClose);\n\t\t\t},\n\t\t\tisActive: (state) => this.isFontActive(state),\n\t\t});\n\t}\n\n\tprivate resolveFontName(family: string | null): string {\n\t\tif (!family) return this.defaultFont?.name ?? this.locale.label;\n\t\tconst match: FontDefinition | undefined = this.config.fonts.find((f) => f.family === family);\n\t\treturn match?.name ?? (family.split(',')[0] ?? '').trim().replace(/['\"]/g, '');\n\t}\n\n\t// --- State Queries ---\n\n\tprivate isFontActive(state: EditorState): boolean {\n\t\treturn isAttributedMarkActive(state, 'font');\n\t}\n\n\tgetActiveFont(state: EditorState): string | null {\n\t\treturn getMarkAttrAtSelection(state, 'font', (m) => m.attrs.family ?? null);\n\t}\n\n\t// --- Font Application ---\n\n\tapplyFont(context: PluginContext, state: EditorState, family: string): boolean {\n\t\tconst mark = { type: markType('font'), attrs: { family } };\n\t\treturn dispatchIfPresent(context, applyAttributedMark(state, mark));\n\t}\n\n\tprivate removeFont(context: PluginContext, state: EditorState): boolean {\n\t\treturn dispatchIfPresent(context, removeAttributedMark(state, markType('font')));\n\t}\n\n\t// --- @font-face Injection ---\n\n\tprivate injectFontFaces(): void {\n\t\tconst rules: string[] = [];\n\n\t\tfor (const font of this.config.fonts) {\n\t\t\tif (!font.fontFaces?.length) continue;\n\n\t\t\tfor (const face of font.fontFaces) {\n\t\t\t\tconst familyName: string = (font.family.split(',')[0] ?? '').trim().replace(/['\"]/g, '');\n\t\t\t\tconst declarations: string[] = [`font-family: '${familyName}'`, `src: ${face.src}`];\n\t\t\t\tif (face.weight) {\n\t\t\t\t\tdeclarations.push(`font-weight: ${face.weight}`);\n\t\t\t\t}\n\t\t\t\tif (face.style) {\n\t\t\t\t\tdeclarations.push(`font-style: ${face.style}`);\n\t\t\t\t}\n\t\t\t\tdeclarations.push(`font-display: ${face.display ?? 'swap'}`);\n\n\t\t\t\trules.push(`@font-face {\\n\\t${declarations.join(';\\n\\t')};\\n}`);\n\t\t\t}\n\t\t}\n\n\t\tif (rules.length === 0) return;\n\n\t\tconst style: HTMLStyleElement = document.createElement('style');\n\t\tstyle.setAttribute('data-notectl-fonts', '');\n\t\tconst nonce = this.context ? getStyleNonceForNode(this.context.getContainer()) : undefined;\n\t\tif (nonce) {\n\t\t\tstyle.setAttribute('nonce', nonce);\n\t\t}\n\t\tstyle.textContent = rules.join('\\n\\n');\n\t\tdocument.head.appendChild(style);\n\t\tthis.injectedStyleElement = style;\n\t}\n\n\t// --- Popup Rendering ---\n\n\tprivate renderFontPopup(\n\t\tcontainer: HTMLElement,\n\t\tcontext: PluginContext,\n\t\tonClose: (options?: PopupCloseOptions) => void,\n\t): void {\n\t\tcontainer.classList.add('notectl-font-picker');\n\n\t\tconst state: EditorState = context.getState();\n\t\tconst activeFont: string | null = this.getActiveFont(state);\n\t\tconst defaultFamily: string | undefined = this.defaultFont?.family;\n\t\tconst contentElement: HTMLElement = context.getContainer();\n\n\t\tconst list: HTMLDivElement = document.createElement('div');\n\t\tlist.className = 'notectl-font-picker__list';\n\t\tlist.setAttribute('role', 'listbox');\n\t\tlist.setAttribute('aria-label', this.locale.label);\n\n\t\tfor (const font of this.config.fonts) {\n\t\t\tconst isDefault: boolean = defaultFamily !== undefined && font.family === defaultFamily;\n\t\t\tconst isActive: boolean = isDefault\n\t\t\t\t? !activeFont || activeFont === font.family\n\t\t\t\t: activeFont === font.family;\n\n\t\t\tconst item: HTMLButtonElement = this.createFontItem(font.name, font.family, isActive, () => {\n\t\t\t\tif (isDefault) {\n\t\t\t\t\tcontext.executeCommand('removeFont');\n\t\t\t\t} else {\n\t\t\t\t\tthis.applyFont(context, context.getState(), font.family);\n\t\t\t\t}\n\t\t\t\tonClose({ restoreFocusTo: contentElement });\n\t\t\t});\n\n\t\t\tif (font.category) {\n\t\t\t\titem.setAttribute('data-category', font.category);\n\t\t\t}\n\n\t\t\tlist.appendChild(item);\n\t\t}\n\n\t\tcontainer.appendChild(list);\n\t}\n\n\tprivate createFontItem(\n\t\tname: string,\n\t\tfamily: string,\n\t\tisActive: boolean,\n\t\tonActivate: () => void,\n\t): HTMLButtonElement {\n\t\tconst item: HTMLButtonElement = document.createElement('button');\n\t\titem.type = 'button';\n\t\titem.className = 'notectl-font-picker__item';\n\t\titem.setAttribute('role', 'option');\n\t\titem.setAttribute('aria-selected', String(isActive));\n\n\t\tif (isActive) {\n\t\t\titem.classList.add('notectl-font-picker__item--active');\n\t\t}\n\n\t\t// Checkmark indicator\n\t\tconst check: HTMLSpanElement = document.createElement('span');\n\t\tcheck.className = 'notectl-font-picker__check';\n\t\tcheck.textContent = isActive ? '\\u2713' : '';\n\t\titem.appendChild(check);\n\n\t\t// Font name label (rendered in the font itself for preview)\n\t\tconst label: HTMLSpanElement = document.createElement('span');\n\t\tlabel.className = 'notectl-font-picker__label';\n\t\tlabel.textContent = name;\n\t\tif (family) {\n\t\t\tsetStyleProperty(label, 'fontFamily', family);\n\t\t}\n\t\titem.appendChild(label);\n\n\t\titem.addEventListener('mousedown', (e: MouseEvent) => {\n\t\t\te.preventDefault();\n\t\t\te.stopPropagation();\n\t\t});\n\t\titem.addEventListener('click', onActivate);\n\t\treturn item;\n\t}\n}\n"],"mappings":"wVACA,ICYa,EAA6B,CACzC,MAAO,OACP,QAAS,eAKJ,iBAA6C,OAAA,OAAA,CAAA,kBAAA,WAAA,qBAAA,kBAAA,WAAA,qBAAA,kBAAA,WAAA,qBAAA,kBAAA,WAAA,qBAAA,kBAAA,WAAA,qBAAA,kBAAA,WAAA,qBAAA,kBAAA,WAAA,qBAAA,kBAAA,WAAA,uBAInD,eAAsB,EAAe,GACpC,OAAO,EAAiB,EAAe,EAAM,EAC9C,CC0DA,IAAa,EAAb,MACC,GAAc,OACd,KAAgB,OAChB,SAAoB,GAEpB,OACA,OACA,qBAAwD,KACxD,QAAwC,KAExC,WAAA,CAAY,GACX,KAAK,OAAS,CACf,CAEA,UAAM,CAAK,GACV,KAAK,aAAe,EAAc,EAAS,KAAK,OAAO,OAAQ,EAAgB,GAE/E,EAAQ,mBFpGqB,u4CEqG7B,KAAK,QAAU,EACf,KAAK,iBAAiB,GACtB,KAAK,iBAAiB,GAClB,KAAK,OAAO,MAAM,OAAS,GAC9B,KAAK,oBAAoB,GAE1B,KAAK,iBACN,CAEA,OAAA,GACC,KAAK,sBAAsB,SAC3B,KAAK,qBAAuB,KAC5B,KAAK,QAAU,IAChB,CAIA,gBAAA,CAAyB,GACxB,EAAQ,iBACP,EAA0B,CACzB,KAAM,OACN,KAAM,EACN,UAAW,SACX,iBAAkB,aAClB,YAAa,cACb,SAAU,EAGV,gBAAkB,GAAW,EAAO,QAAQ,KAAM,OAGrD,CAIA,gBAAA,CAAyB,GACxB,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AA0B,SAAS,cAAc,UACvD,EAAK,KAAO,SACZ,EAAK,UAAY,4BACjB,EAAK,aAAa,OAAQ,UAC1B,EAAK,aAAa,gBAAiB,OAAO,IAEtC,GACH,EAAK,UAAU,IAAI,qCAIpB,MAAM,EAAyB,SAAS,cAAc,QACtD,EAAM,UAAY,6BAClB,EAAM,YAAc,EAAW,IAAW,GAC1C,EAAK,YAAY,GAGjB,MAAM,EAAyB,SAAS,cAAc,QAatD,OAZA,EAAM,UAAY,6BAClB,EAAM,YAAc,EAChB,GACH,EAAiB,EAAO,aAAc,GAEvC,EAAK,YAAY,GAEjB,EAAK,iBAAiB,YAAc,IACnC,EAAE,iBACF,EAAE,oBAEH,EAAK,iBAAiB,QAAS,GACxB,CACR"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{J as t,P as e,V as n,k as o,z as i}from"./Document-D_2cIBJG.mjs";import{c as r,d as s,f as c,p as a}from"./Selection-DC6AOGgF.mjs";import{i as l}from"./TypeBrands-Ch9856Gb.mjs";import{i as f,n as u,r as d,t as p}from"./AttributedMarkCommands-B3MQdob_.mjs";import{c as m,n as h,o as k}from"./PluginHelpers-WG1Lzzh3.mjs";import{c as z}from"./StyleRuntime-C0RSqKzG.mjs";import{r as g}from"./ColorValidation-B9d_umnf.mjs";import{t as b}from"./InlineStyleMarkSpec-Cx3goc3W.mjs";var S={label:"Font Size",tooltip:"Font Size",customFontSizeAria:"Custom font size",fontSizesAria:"Font sizes"},v=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar-BzqAYGER.mjs"),"./locales/de.ts":()=>import("./de-C-Yf378-.mjs"),"./locales/es.ts":()=>import("./es-CUKJujcb.mjs"),"./locales/fr.ts":()=>import("./fr-D0MDdoir.mjs"),"./locales/hi.ts":()=>import("./hi-B2uhiPCN.mjs"),"./locales/pt.ts":()=>import("./pt-BCXgUDiU.mjs"),"./locales/ru.ts":()=>import("./ru-DV-lgEtM.mjs"),"./locales/zh.ts":()=>import("./zh-oZl1P_p0.mjs")});async function x(t){return m(v,t,S)}function y(t){return void 0!==t?.attrs?.fontSize}function _(n){const o=n.selection;if(s(o)){const t=n.getBlock(o.nodeId);return t&&y(n.schema.getNodeSpec?.(t.type))?{kind:"block",path:n.getNodePath(o.nodeId)??[o.nodeId],attrs:t.attrs??{}}:null}const a=function(n){const o=n.selection;if(!c(o)||r(o))return null;if(o.anchor.blockId!==o.head.blockId)return null;const s=Math.min(o.anchor.offset,o.head.offset);if(Math.max(o.anchor.offset,o.head.offset)-s!==1)return null;const a=n.getBlock(o.anchor.blockId);if(!a)return null;for(const{child:r,from:c}of t(e(a)))if(c===s&&i(r))return{node:r,blockId:o.anchor.blockId,offset:s};return null}(n);return a&&y(n.schema.getInlineNodeSpec?.(a.node.inlineType))?{kind:"inline",blockId:a.blockId,offset:a.offset,attrs:a.node.attrs}:null}function I(t){const e=t?.fontSize;return"string"==typeof e&&e.length>0?e:null}function w(t,e){return{...t??{},fontSize:e}}function N(t){return I(t.attrs)}function C(t,e,n,o){const i=e.transaction("command");return"block"===n.kind?i.setNodeAttr(n.path,w(n.attrs,o)):i.setInlineNodeAttr(n.blockId,n.offset,w(n.attrs,o)),t.dispatch(i.build()),!0}var A=l("fontSize");function E(t){const e=t.selection;if(!c(e))return[];const n=t.getBlockOrder(),i=a(e,n),r=n.indexOf(i.from.blockId),s=n.indexOf(i.to.blockId),l=[];for(let c=r;c<=s;c++){const e=n[c];if(!e)continue;const a=t.getBlock(e);if(!a)continue;const f=c===r?i.from.offset:0,u=c===s?i.to.offset:o(a);y(t.schema.getNodeSpec?.(a.type))?l.push({kind:"blockNode",path:t.getNodePath(e)??[e],attrs:a.attrs??{}}):f!==u&&F(t,a,e,f,u,l)}return l}function F(t,o,i,r,s,c){let a,l=0,f=!1;for(const u of e(o))if(n(u)){const t=l+u.text.length;u.text.length>0&&t>r&&l<s&&(f=!0,a||(a=u.marks.find(t=>t.type===A))),l=t}else l>=r&&l<s&&y(t.schema.getInlineNodeSpec?.(u.inlineType))&&c.push({kind:"inlineNode",blockId:i,offset:l,attrs:u.attrs}),l+=1;f&&c.push({kind:"text",blockId:i,from:r,to:s,mark:a})}function j(t,e,n){const o=E(e);if(0===o.length)return!1;const i=e.transaction("command");let r=!1;for(const s of o){if("text"===s.kind){""===n?s.mark&&(i.removeMark(s.blockId,s.from,s.to,s.mark),r=!0):(s.mark&&i.removeMark(s.blockId,s.from,s.to,s.mark),i.addMark(s.blockId,s.from,s.to,{type:A,attrs:{size:n}}),r=!0);continue}const t=I(s.attrs);n===t||""===n&&null===t||("blockNode"===s.kind?i.setNodeAttr(s.path,w(s.attrs,n)):i.setInlineNodeAttr(s.blockId,s.offset,w(s.attrs,n)),r=!0)}return!!r&&(i.setSelection(e.selection),t.dispatch(i.build()),!0)}function T(t){const e=E(t).filter(t=>"text"!==t.kind).map(t=>t.attrs);return 0===e.length?null:new Set(e.map(t=>I(t)??""))}function M(t,e){const n=function(t){const e=_(t);if(e)return N(e);const n=T(t);if(n&&1===n.size){const[t]=n;if(t)return t}return u(t,"fontSize",t=>t.attrs.size??null)}(t);if(!n)return e;const o=Number.parseInt(n,10);return Number.isNaN(o)?e:o}function P(t,e,n){const o=_(e);if(o)return C(t,e,o,n);const i=e.selection;if(!c(i))return!1;if(r(i)){const o={type:l("fontSize"),attrs:{size:n}};return h(t,p(e,o))}return j(t,e,n)}function L(t,e){const n=_(e);if(n)return null!==N(n)&&C(t,e,n,"");const o=e.selection;return!!c(o)&&(r(o)?h(t,f(e,l("fontSize"))):j(t,e,""))}function D(t,e,n,o,i){const r=function(t,e,n){if("up"===e){for(const e of n)if(e>t)return e;return null}for(let o=n.length-1;o>=0;o--){const e=n[o];if(void 0!==e&&e<t)return e}return null}(M(e,i),n,o);return null!==r&&(r===i?L(t,e):P(t,e,`${r}px`))}function B(t,e,n){e===n?t.executeCommand("removeFontSize"):P(t,t.getState(),`${e}px`)}function O(t,e){const n=document.createElement("button");n.type="button",n.id=`notectl-font-size-option-${t}`,n.className="notectl-font-size-picker__item",n.setAttribute("role","option"),n.setAttribute("aria-selected",String(e)),e&&n.classList.add("notectl-font-size-picker__item--active");const o=document.createElement("span");o.className="notectl-font-size-picker__check",o.textContent=e?"✓":"",n.appendChild(o);const i=document.createElement("span");return i.className="notectl-font-size-picker__label",i.textContent=String(t),n.appendChild(i),n}var V=[8,9,10,11,12,14,16,18,20,24,28,32,36,48,64,72,96],$=class{id="fontSize";name="Font Size";priority=21;config;sizes;defaultSize;locale;constructor(t){var e;this.config={...t},this.sizes=function(t){if(!t||0===t.length)return V;const e=[...new Set(t)].filter(t=>Number.isInteger(t)&&t>0);return e.sort((t,e)=>t-e),e.length>0?e:V}(t?.sizes),this.defaultSize=(e=t?.defaultSize,void 0===e?16:Number.isInteger(e)&&e>0?e:16)}async init(t){this.locale=await k(t,this.config.locale,S,x),t.registerStyleSheet("\n/* Font Size Select — Width overrides for combobox button */\n.notectl-toolbar-btn--fontSize {\n\tmin-width: 60px;\n\tmax-width: 80px;\n}\n\n/* Font Size Picker Popup */\n.notectl-font-size-picker {\n\tmin-width: 140px;\n\tdisplay: flex;\n\tflex-direction: column;\n}\n\n.notectl-font-size-picker__input-wrapper {\n\tpadding: 8px 8px 4px;\n}\n\n.notectl-font-size-picker__input {\n\twidth: 100%;\n\tpadding: 6px 8px;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 4px;\n\tfont-size: 13px;\n\tfont-family: inherit;\n\tcolor: var(--notectl-fg);\n\tbackground: var(--notectl-surface-overlay);\n\toutline: none;\n\tbox-sizing: border-box;\n\t-moz-appearance: textfield;\n}\n\n.notectl-font-size-picker__input::-webkit-inner-spin-button,\n.notectl-font-size-picker__input::-webkit-outer-spin-button {\n\t-webkit-appearance: none;\n\tmargin: 0;\n}\n\n.notectl-font-size-picker__input:focus {\n\tborder-color: var(--notectl-border-focus);\n\tbox-shadow: 0 0 0 2px var(--notectl-focus-ring);\n}\n\n.notectl-font-size-picker__list {\n\tmax-height: 280px;\n\toverflow-y: auto;\n\tpadding: 4px 0;\n}\n\n.notectl-font-size-picker__item {\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 8px;\n\twidth: 100%;\n\tpadding: 7px 12px;\n\tborder: none;\n\tbackground: none;\n\tcursor: pointer;\n\tfont-size: 14px;\n\tcolor: var(--notectl-fg);\n\tline-height: 1.4;\n\ttext-align: start;\n\twhite-space: nowrap;\n\tfont-family: inherit;\n\ttransition: background 0.1s;\n\toutline: none;\n}\n\n@media (hover: hover) {\n\t.notectl-font-size-picker__item:hover {\n\t\tbackground: var(--notectl-hover-bg);\n\t}\n}\n\n.notectl-font-size-picker__item--active {\n\tbackground: var(--notectl-active-bg);\n\tcolor: var(--notectl-accent-fg);\n}\n\n@media (hover: hover) {\n\t.notectl-font-size-picker__item--active:hover {\n\t\tbackground: var(--notectl-active-bg);\n\t}\n}\n\n.notectl-font-size-picker__item--focused {\n\toutline: 2px solid var(--notectl-primary);\n\toutline-offset: -2px;\n}\n\n.notectl-font-size-picker__check {\n\tdisplay: inline-flex;\n\talign-items: center;\n\tjustify-content: center;\n\twidth: 16px;\n\tflex-shrink: 0;\n\tfont-size: 13px;\n\tfont-weight: 600;\n\tcolor: var(--notectl-accent-fg);\n}\n\n.notectl-font-size-picker__label {\n\tflex: 1;\n}\n"),this.registerMarkSpec(t),this.registerCommands(t),this.registerKeymaps(t),this.registerToolbarItem(t),this.applyDefaultSizeToContainer(t)}destroy(){}registerMarkSpec(t){t.registerMarkSpec(b({type:"fontSize",rank:4,valueAttr:"size",domStyleProperty:"fontSize",cssProperty:"font-size",validate:g}))}registerCommands(t){t.registerCommand("removeFontSize",()=>L(t,t.getState())),t.registerCommand("setFontSize",()=>!1),t.registerCommand("increaseFontSize",()=>D(t,t.getState(),"up",this.sizes,this.defaultSize)),t.registerCommand("decreaseFontSize",()=>D(t,t.getState(),"down",this.sizes,this.defaultSize))}registerKeymaps(t){t.registerKeymap({"Mod-Shift-+":()=>D(t,t.getState(),"up",this.sizes,this.defaultSize),"Mod-Shift-_":()=>D(t,t.getState(),"down",this.sizes,this.defaultSize)})}registerToolbarItem(t){t.registerToolbarItem({id:"fontSize",group:"format",label:this.locale.label,tooltip:this.locale.tooltip,command:"removeFontSize",popupType:"combobox",getLabel:t=>String(M(t,this.defaultSize)),renderPopup:(t,e,n)=>{!function(t,e,n){t.classList.add("notectl-font-size-picker");const o=M(e.getState(),n.defaultSize),i=function(t,e){const n=document.createElement("input");return n.type="number",n.className="notectl-font-size-picker__input",n.min=String(1),n.max=String(400),n.value=String(t),n.setAttribute("aria-label",e.locale.customFontSizeAria),n}(o,n);!function(t,e){const n=document.createElement("div");n.className="notectl-font-size-picker__input-wrapper",n.appendChild(e),t.appendChild(n)}(t,i);const{list:r,items:s}=function(t,e,n,o){const i=document.createElement("div");i.className="notectl-font-size-picker__list",i.setAttribute("role","listbox"),i.setAttribute("aria-label",o.locale.fontSizesAria);const r=[];for(const s of t){const t=O(s,s===e);t.addEventListener("mousedown",t=>{t.preventDefault(),t.stopPropagation()}),t.addEventListener("click",()=>{B(n,s,o.defaultSize),o.onClose({restoreFocusTo:o.contentElement})}),r.push(t),i.appendChild(t)}return{list:i,items:r}}(n.sizes,o,e,n);t.appendChild(r),function(t,e,n,o){const i=e.indexOf(n);if(i<0)return;const r=t[i];r&&(requestAnimationFrame(()=>{r.scrollIntoView({block:"nearest"})}),o.setAttribute("aria-activedescendant",r.id))}(s,n.sizes,o,r),function(t,e,n,o,i){let r=-1;const s=t=>{r>=0&&r<n.length&&n[r]?.classList.remove("notectl-font-size-picker__item--focused"),r=t;const o=n[r];r>=0&&r<n.length&&o&&(o.classList.add("notectl-font-size-picker__item--focused"),o.scrollIntoView({block:"nearest"}),e.setAttribute("aria-activedescendant",o.id))},c=t=>{t.preventDefault(),t.stopPropagation()};t.addEventListener("keydown",e=>{if("Enter"===e.key){c(e);const n=Number.parseInt(t.value,10);!Number.isNaN(n)&&n>=1&&n<=400&&(B(o,n,i.defaultSize),i.onClose({restoreFocusTo:i.contentElement}))}else"ArrowDown"===e.key?(c(e),s(0),n[0]?.focus()):"Escape"===e.key&&(c(e),i.onClose({restoreFocusTo:i.contentElement}))}),e.addEventListener("keydown",e=>{"ArrowDown"===e.key?(c(e),r<n.length-1&&(s(r+1),n[r]?.focus())):"ArrowUp"===e.key?(c(e),r>0?(s(r-1),n[r]?.focus()):(s(-1),t.focus())):"Enter"===e.key?(c(e),n[r]?.click()):"Escape"===e.key&&(c(e),i.onClose({restoreFocusTo:i.contentElement}))})}(i,r,s,e,n)}(t,e,{sizes:this.sizes,defaultSize:this.defaultSize,onClose:n,contentElement:e.getContainer(),locale:this.locale})},isActive:t=>function(t){const e=_(t);if(e)return null!==N(e);const n=T(t);return!(!n||![...n].some(t=>t.length>0))||d(t,"fontSize")}(t)})}applyDefaultSizeToContainer(t){const e=t.getContainer();z(e,"fontSize",`${this.defaultSize}px`)}};export{S as n,x as r,$ as t};
|
|
2
|
-
//# sourceMappingURL=FontSizePlugin-zJDiyhUv.mjs.map
|