@notectl/core 2.0.2 → 2.0.3
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 +258 -123
- package/dist/chunks/AlignmentPlugin-CIkPaP2h.mjs +2 -0
- package/dist/chunks/AlignmentPlugin-CIkPaP2h.mjs.map +1 -0
- package/dist/chunks/AttrRegistry-B1iBFcKO.mjs +2 -0
- package/dist/chunks/AttrRegistry-B1iBFcKO.mjs.map +1 -0
- package/dist/chunks/AttributedMarkCommands-Cmet1IuC.mjs +2 -0
- package/dist/chunks/AttributedMarkCommands-Cmet1IuC.mjs.map +1 -0
- package/dist/chunks/BlockInsertion-DTIE2BiH.mjs +2 -0
- package/dist/chunks/BlockInsertion-DTIE2BiH.mjs.map +1 -0
- package/dist/chunks/BlockTypePickerRegistry-U4uY7-lN.mjs +2 -0
- package/dist/chunks/BlockTypePickerRegistry-U4uY7-lN.mjs.map +1 -0
- package/dist/chunks/BlockquotePlugin-DmbnFmNj.mjs +2 -0
- package/dist/chunks/BlockquotePlugin-DmbnFmNj.mjs.map +1 -0
- package/dist/chunks/CaretNavigationPlugin-4EaHvYXR.mjs +2 -0
- package/dist/chunks/CaretNavigationPlugin-4EaHvYXR.mjs.map +1 -0
- package/dist/chunks/CodeBlockPlugin-BP3XaOGj.mjs +2 -0
- package/dist/chunks/CodeBlockPlugin-BP3XaOGj.mjs.map +1 -0
- package/dist/chunks/ColorGrid-taTKtdsm.mjs +2 -0
- package/dist/chunks/ColorGrid-taTKtdsm.mjs.map +1 -0
- package/dist/chunks/ColorPickerPopup-JJQ-gMBN.mjs +2 -0
- package/dist/chunks/ColorPickerPopup-JJQ-gMBN.mjs.map +1 -0
- package/dist/chunks/ColorValidation-3viVw_tK.mjs +2 -0
- package/dist/chunks/ColorValidation-3viVw_tK.mjs.map +1 -0
- package/dist/chunks/CommandHelpers-D0LIFM4O.mjs +2 -0
- package/dist/chunks/CommandHelpers-D0LIFM4O.mjs.map +1 -0
- package/dist/chunks/Commands-DJSVqp7b.mjs +2 -0
- package/dist/chunks/Commands-DJSVqp7b.mjs.map +1 -0
- package/dist/chunks/Decoration-6dhb8k3b.mjs +2 -0
- package/dist/chunks/Decoration-6dhb8k3b.mjs.map +1 -0
- package/dist/chunks/Document-CkQLx84k.mjs +2 -0
- package/dist/chunks/Document-CkQLx84k.mjs.map +1 -0
- package/dist/chunks/DocumentParser-QJUmtPp9.mjs +2 -0
- package/dist/chunks/DocumentParser-QJUmtPp9.mjs.map +1 -0
- package/dist/chunks/DocumentSerializer-bwcxM9WV.mjs +2 -0
- package/dist/chunks/DocumentSerializer-bwcxM9WV.mjs.map +1 -0
- package/dist/chunks/DomUtils-BkyCg-OO.mjs +2 -0
- package/dist/chunks/DomUtils-BkyCg-OO.mjs.map +1 -0
- package/dist/chunks/FontPlugin-Cz4qEYGh.mjs +2 -0
- package/dist/chunks/FontPlugin-Cz4qEYGh.mjs.map +1 -0
- package/dist/chunks/FontSizePlugin-D1WtDqrH.mjs +2 -0
- package/dist/chunks/FontSizePlugin-D1WtDqrH.mjs.map +1 -0
- package/dist/chunks/GapCursorNavigation-CKKq42kA.mjs +2 -0
- package/dist/chunks/GapCursorNavigation-CKKq42kA.mjs.map +1 -0
- package/dist/chunks/GapCursorPlugin-0CyOaciK.mjs +2 -0
- package/dist/chunks/GapCursorPlugin-0CyOaciK.mjs.map +1 -0
- package/dist/chunks/HTMLUtils-BLwp5G4f.mjs +2 -0
- package/dist/chunks/HTMLUtils-BLwp5G4f.mjs.map +1 -0
- package/dist/chunks/HardBreakPlugin-BOz-L53p.mjs +2 -0
- package/dist/chunks/HardBreakPlugin-BOz-L53p.mjs.map +1 -0
- package/dist/chunks/HeadingPlugin-C1F-5Ail.mjs +2 -0
- package/dist/chunks/HeadingPlugin-C1F-5Ail.mjs.map +1 -0
- package/dist/chunks/HighlightPlugin-LYARYuDC.mjs +2 -0
- package/dist/chunks/HighlightPlugin-LYARYuDC.mjs.map +1 -0
- package/dist/chunks/HorizontalRulePlugin-fmdbzWDQ.mjs +2 -0
- package/dist/chunks/HorizontalRulePlugin-fmdbzWDQ.mjs.map +1 -0
- package/dist/chunks/ImagePlugin-CrfnT1sD.mjs +2 -0
- package/dist/chunks/ImagePlugin-CrfnT1sD.mjs.map +1 -0
- package/dist/chunks/KeyboardNav-BZIHDPDV.mjs +2 -0
- package/dist/chunks/KeyboardNav-BZIHDPDV.mjs.map +1 -0
- package/dist/chunks/LinkPlugin-DzFJLnfQ.mjs +2 -0
- package/dist/chunks/LinkPlugin-DzFJLnfQ.mjs.map +1 -0
- package/dist/chunks/ListPlugin-C_Rcz3bV.mjs +2 -0
- package/dist/chunks/ListPlugin-C_Rcz3bV.mjs.map +1 -0
- package/dist/chunks/NavigationQueries-CgYPG6oY.mjs +2 -0
- package/dist/chunks/NavigationQueries-CgYPG6oY.mjs.map +1 -0
- package/dist/chunks/NodeResolver-CCA8UVRr.mjs +2 -0
- package/dist/chunks/NodeResolver-CCA8UVRr.mjs.map +1 -0
- package/dist/chunks/NodeSelectionCommands-CE_73CxF.mjs +2 -0
- package/dist/chunks/NodeSelectionCommands-CE_73CxF.mjs.map +1 -0
- package/dist/chunks/Platform-D9TRT4Mn.mjs +2 -0
- package/dist/chunks/Platform-D9TRT4Mn.mjs.map +1 -0
- package/dist/chunks/PluginHelpers-DLKHJWJn.mjs +2 -0
- package/dist/chunks/PluginHelpers-DLKHJWJn.mjs.map +1 -0
- package/dist/chunks/PopupManager-RWOaksC0.mjs +2 -0
- package/dist/chunks/PopupManager-RWOaksC0.mjs.map +1 -0
- package/dist/chunks/PopupPositioning-a1ADYSmx.mjs +2 -0
- package/dist/chunks/PopupPositioning-a1ADYSmx.mjs.map +1 -0
- package/dist/chunks/PrintPlugin-CwbEz3eP.mjs +2 -0
- package/dist/chunks/PrintPlugin-CwbEz3eP.mjs.map +1 -0
- package/dist/chunks/PrintTypes-B2DXeAEG.mjs +2 -0
- package/dist/chunks/PrintTypes-B2DXeAEG.mjs.map +1 -0
- package/dist/chunks/Selection-B14e7gd0.mjs +2 -0
- package/dist/chunks/Selection-B14e7gd0.mjs.map +1 -0
- package/dist/chunks/ShortcutFormatting-DQPMvupx.mjs +2 -0
- package/dist/chunks/ShortcutFormatting-DQPMvupx.mjs.map +1 -0
- package/dist/chunks/SmartPastePlugin-CXqJ0CPO.mjs +2 -0
- package/dist/chunks/SmartPastePlugin-CXqJ0CPO.mjs.map +1 -0
- package/dist/chunks/StrikethroughPlugin-CRl69jm3.mjs +2 -0
- package/dist/chunks/StrikethroughPlugin-CRl69jm3.mjs.map +1 -0
- package/dist/chunks/StyleRuntime-0yPPJK9H.mjs +2 -0
- package/dist/chunks/StyleRuntime-0yPPJK9H.mjs.map +1 -0
- package/dist/chunks/SuperSubPlugin-CAnaTJVm.mjs +2 -0
- package/dist/chunks/SuperSubPlugin-CAnaTJVm.mjs.map +1 -0
- package/dist/chunks/TablePlugin-D_7bgrqm.mjs +2 -0
- package/dist/chunks/TablePlugin-D_7bgrqm.mjs.map +1 -0
- package/dist/chunks/TextColorPlugin-Dfhvl1qG.mjs +2 -0
- package/dist/chunks/TextColorPlugin-Dfhvl1qG.mjs.map +1 -0
- package/dist/chunks/TextDirectionCorePlugin-CyKw-C8X.mjs +2 -0
- package/dist/chunks/TextDirectionCorePlugin-CyKw-C8X.mjs.map +1 -0
- package/dist/chunks/TextDirectionLocale-rlU1yNly.mjs +2 -0
- package/dist/chunks/TextDirectionLocale-rlU1yNly.mjs.map +1 -0
- package/dist/chunks/TextFormattingPlugin-xtQczzCs.mjs +2 -0
- package/dist/chunks/TextFormattingPlugin-xtQczzCs.mjs.map +1 -0
- package/dist/chunks/ToolbarPlugin-BFEniyH-.mjs +2 -0
- package/dist/chunks/ToolbarPlugin-BFEniyH-.mjs.map +1 -0
- package/dist/chunks/TypeBrands-BQR8dEYU.mjs +2 -0
- package/dist/chunks/TypeBrands-BQR8dEYU.mjs.map +1 -0
- package/dist/chunks/WordBoundary-iZXLMFyk.mjs +2 -0
- package/dist/chunks/WordBoundary-iZXLMFyk.mjs.map +1 -0
- package/dist/chunks/XmlPatterns-Ub8I1jdE.mjs +2 -0
- package/dist/chunks/XmlPatterns-Ub8I1jdE.mjs.map +1 -0
- package/dist/chunks/ar-3-z4mZhh.mjs +2 -0
- package/dist/chunks/ar-3-z4mZhh.mjs.map +1 -0
- package/dist/chunks/ar-B-l6wR4D.mjs +2 -0
- package/dist/chunks/ar-B-l6wR4D.mjs.map +1 -0
- package/dist/chunks/ar-B3NByR5H.mjs +2 -0
- package/dist/chunks/ar-B3NByR5H.mjs.map +1 -0
- package/dist/chunks/ar-BRvm4F78.mjs +2 -0
- package/dist/chunks/ar-BRvm4F78.mjs.map +1 -0
- package/dist/chunks/ar-BUMXujtS.mjs +2 -0
- package/dist/chunks/ar-BUMXujtS.mjs.map +1 -0
- package/dist/chunks/ar-BhVHv8Lx.mjs +2 -0
- package/dist/chunks/ar-BhVHv8Lx.mjs.map +1 -0
- package/dist/chunks/ar-BhwRD9Cg.mjs +2 -0
- package/dist/chunks/ar-BhwRD9Cg.mjs.map +1 -0
- package/dist/chunks/ar-Bm8ORJ3H.mjs +2 -0
- package/dist/chunks/ar-Bm8ORJ3H.mjs.map +1 -0
- package/dist/chunks/ar-BpxuRQB2.mjs +2 -0
- package/dist/chunks/ar-BpxuRQB2.mjs.map +1 -0
- package/dist/chunks/ar-CA0-ysCj.mjs +2 -0
- package/dist/chunks/ar-CA0-ysCj.mjs.map +1 -0
- package/dist/chunks/ar-CAkFpIju.mjs +2 -0
- package/dist/chunks/ar-CAkFpIju.mjs.map +1 -0
- package/dist/chunks/ar-CU6qxyFp.mjs +2 -0
- package/dist/chunks/ar-CU6qxyFp.mjs.map +1 -0
- package/dist/chunks/ar-CXcTrZVc.mjs +2 -0
- package/dist/chunks/ar-CXcTrZVc.mjs.map +1 -0
- package/dist/chunks/ar-CeO_osWz.mjs +2 -0
- package/dist/chunks/ar-CeO_osWz.mjs.map +1 -0
- package/dist/chunks/ar-CxRSPJDE.mjs +2 -0
- package/dist/chunks/ar-CxRSPJDE.mjs.map +1 -0
- package/dist/chunks/ar-DHes6Igy.mjs +2 -0
- package/dist/chunks/ar-DHes6Igy.mjs.map +1 -0
- package/dist/chunks/ar-DN1aHdqb.mjs +2 -0
- package/dist/chunks/ar-DN1aHdqb.mjs.map +1 -0
- package/dist/chunks/ar-DNzmHN3q.mjs +2 -0
- package/dist/chunks/ar-DNzmHN3q.mjs.map +1 -0
- package/dist/chunks/ar-DVdWier2.mjs +2 -0
- package/dist/chunks/ar-DVdWier2.mjs.map +1 -0
- package/dist/chunks/ar-G_ADWoCx.mjs +2 -0
- package/dist/chunks/ar-G_ADWoCx.mjs.map +1 -0
- package/dist/chunks/ar-KAaQxKMo.mjs +2 -0
- package/dist/chunks/ar-KAaQxKMo.mjs.map +1 -0
- package/dist/chunks/ar-MHdV5PAO.mjs +2 -0
- package/dist/chunks/ar-MHdV5PAO.mjs.map +1 -0
- package/dist/chunks/ar-S2VfgLMv.mjs +2 -0
- package/dist/chunks/ar-S2VfgLMv.mjs.map +1 -0
- package/dist/chunks/color-picker-DumtHdqh.mjs +2 -0
- package/dist/chunks/color-picker-DumtHdqh.mjs.map +1 -0
- package/dist/chunks/de-0x8V-vch.mjs +2 -0
- package/dist/chunks/de-0x8V-vch.mjs.map +1 -0
- package/dist/chunks/de-B5xIP9en.mjs +2 -0
- package/dist/chunks/de-B5xIP9en.mjs.map +1 -0
- package/dist/chunks/de-BBohFIqw.mjs +2 -0
- package/dist/chunks/de-BBohFIqw.mjs.map +1 -0
- package/dist/chunks/de-BWPmC-2S.mjs +2 -0
- package/dist/chunks/de-BWPmC-2S.mjs.map +1 -0
- package/dist/chunks/de-Bo1kM9rb.mjs +2 -0
- package/dist/chunks/de-Bo1kM9rb.mjs.map +1 -0
- package/dist/chunks/de-BqzR2XMP.mjs +2 -0
- package/dist/chunks/de-BqzR2XMP.mjs.map +1 -0
- package/dist/chunks/de-CIZibvOC.mjs +2 -0
- package/dist/chunks/de-CIZibvOC.mjs.map +1 -0
- package/dist/chunks/de-CLToQn0o.mjs +2 -0
- package/dist/chunks/de-CLToQn0o.mjs.map +1 -0
- package/dist/chunks/de-CNoAAJul.mjs +2 -0
- package/dist/chunks/de-CNoAAJul.mjs.map +1 -0
- package/dist/chunks/de-CPb7rgkk.mjs +2 -0
- package/dist/chunks/de-CPb7rgkk.mjs.map +1 -0
- package/dist/chunks/de-CdmBKVDW.mjs +2 -0
- package/dist/chunks/de-CdmBKVDW.mjs.map +1 -0
- package/dist/chunks/de-DDgeyWgp.mjs +2 -0
- package/dist/chunks/de-DDgeyWgp.mjs.map +1 -0
- package/dist/chunks/de-DGXQ4OiR.mjs +2 -0
- package/dist/chunks/de-DGXQ4OiR.mjs.map +1 -0
- package/dist/chunks/de-DJbvKl4E.mjs +2 -0
- package/dist/chunks/de-DJbvKl4E.mjs.map +1 -0
- package/dist/chunks/de-DKNvYM_G.mjs +2 -0
- package/dist/chunks/de-DKNvYM_G.mjs.map +1 -0
- package/dist/chunks/de-DOHm_P4A.mjs +2 -0
- package/dist/chunks/de-DOHm_P4A.mjs.map +1 -0
- package/dist/chunks/de-DTMX75rn.mjs +2 -0
- package/dist/chunks/de-DTMX75rn.mjs.map +1 -0
- package/dist/chunks/de-DfkQds5F.mjs +2 -0
- package/dist/chunks/de-DfkQds5F.mjs.map +1 -0
- package/dist/chunks/de-TEQW-F4t.mjs +2 -0
- package/dist/chunks/de-TEQW-F4t.mjs.map +1 -0
- package/dist/chunks/de-WzdZ_NJ6.mjs +2 -0
- package/dist/chunks/de-WzdZ_NJ6.mjs.map +1 -0
- package/dist/chunks/de-_vqVfXeo.mjs +2 -0
- package/dist/chunks/de-_vqVfXeo.mjs.map +1 -0
- package/dist/chunks/de-gR6jt-sS.mjs +2 -0
- package/dist/chunks/de-gR6jt-sS.mjs.map +1 -0
- package/dist/chunks/de-qOBFRCGL.mjs +2 -0
- package/dist/chunks/de-qOBFRCGL.mjs.map +1 -0
- package/dist/chunks/es-1udUsTJd.mjs +2 -0
- package/dist/chunks/es-1udUsTJd.mjs.map +1 -0
- package/dist/chunks/es-3H7h0_G5.mjs +2 -0
- package/dist/chunks/es-3H7h0_G5.mjs.map +1 -0
- package/dist/chunks/es-4-5iRK0M.mjs +2 -0
- package/dist/chunks/es-4-5iRK0M.mjs.map +1 -0
- package/dist/chunks/es-89LD3TlT.mjs +2 -0
- package/dist/chunks/es-89LD3TlT.mjs.map +1 -0
- package/dist/chunks/es-B2KFVoHa.mjs +2 -0
- package/dist/chunks/es-B2KFVoHa.mjs.map +1 -0
- package/dist/chunks/es-BUP1scLX.mjs +2 -0
- package/dist/chunks/es-BUP1scLX.mjs.map +1 -0
- package/dist/chunks/es-Bhhj-yh0.mjs +2 -0
- package/dist/chunks/es-Bhhj-yh0.mjs.map +1 -0
- package/dist/chunks/es-Bo0NTtQH.mjs +2 -0
- package/dist/chunks/es-Bo0NTtQH.mjs.map +1 -0
- package/dist/chunks/es-Bovw7l2W.mjs +2 -0
- package/dist/chunks/es-Bovw7l2W.mjs.map +1 -0
- package/dist/chunks/es-C7xAs1yn.mjs +2 -0
- package/dist/chunks/es-C7xAs1yn.mjs.map +1 -0
- package/dist/chunks/es-CIdF7MzV.mjs +2 -0
- package/dist/chunks/es-CIdF7MzV.mjs.map +1 -0
- package/dist/chunks/es-CPit7Z6w.mjs +2 -0
- package/dist/chunks/es-CPit7Z6w.mjs.map +1 -0
- package/dist/chunks/es-CQzgvQI6.mjs +2 -0
- package/dist/chunks/es-CQzgvQI6.mjs.map +1 -0
- package/dist/chunks/es-CSteuqi5.mjs +2 -0
- package/dist/chunks/es-CSteuqi5.mjs.map +1 -0
- package/dist/chunks/es-ClJxqhu_.mjs +2 -0
- package/dist/chunks/es-ClJxqhu_.mjs.map +1 -0
- package/dist/chunks/es-CrmqYoVh.mjs +2 -0
- package/dist/chunks/es-CrmqYoVh.mjs.map +1 -0
- package/dist/chunks/es-CwRwLkfr.mjs +2 -0
- package/dist/chunks/es-CwRwLkfr.mjs.map +1 -0
- package/dist/chunks/es-D7DRGnkZ.mjs +2 -0
- package/dist/chunks/es-D7DRGnkZ.mjs.map +1 -0
- package/dist/chunks/es-DET1uMu-.mjs +2 -0
- package/dist/chunks/es-DET1uMu-.mjs.map +1 -0
- package/dist/chunks/es-Dj83hJxy.mjs +2 -0
- package/dist/chunks/es-Dj83hJxy.mjs.map +1 -0
- package/dist/chunks/es-DwYWucI6.mjs +2 -0
- package/dist/chunks/es-DwYWucI6.mjs.map +1 -0
- package/dist/chunks/es-DwrcpThR.mjs +2 -0
- package/dist/chunks/es-DwrcpThR.mjs.map +1 -0
- package/dist/chunks/es-z7xjgDdk.mjs +2 -0
- package/dist/chunks/es-z7xjgDdk.mjs.map +1 -0
- package/dist/chunks/fonts-CG5ZnGux.mjs +2 -0
- package/dist/chunks/fonts-CG5ZnGux.mjs.map +1 -0
- package/dist/chunks/fr-B73tOEzO.mjs +2 -0
- package/dist/chunks/fr-B73tOEzO.mjs.map +1 -0
- package/dist/chunks/fr-BEbsFEkX.mjs +2 -0
- package/dist/chunks/fr-BEbsFEkX.mjs.map +1 -0
- package/dist/chunks/fr-BFCaEBSV.mjs +2 -0
- package/dist/chunks/fr-BFCaEBSV.mjs.map +1 -0
- package/dist/chunks/fr-BJ69XrDO.mjs +2 -0
- package/dist/chunks/fr-BJ69XrDO.mjs.map +1 -0
- package/dist/chunks/fr-BdQ_-Iwg.mjs +2 -0
- package/dist/chunks/fr-BdQ_-Iwg.mjs.map +1 -0
- package/dist/chunks/fr-BhnuBA0i.mjs +2 -0
- package/dist/chunks/fr-BhnuBA0i.mjs.map +1 -0
- package/dist/chunks/fr-BiLmpXZ9.mjs +2 -0
- package/dist/chunks/fr-BiLmpXZ9.mjs.map +1 -0
- package/dist/chunks/fr-C1Pak7kS.mjs +2 -0
- package/dist/chunks/fr-C1Pak7kS.mjs.map +1 -0
- package/dist/chunks/fr-CFDoFELm.mjs +2 -0
- package/dist/chunks/fr-CFDoFELm.mjs.map +1 -0
- package/dist/chunks/fr-CmsH8BnY.mjs +2 -0
- package/dist/chunks/fr-CmsH8BnY.mjs.map +1 -0
- package/dist/chunks/fr-Cz2qWiuV.mjs +2 -0
- package/dist/chunks/fr-Cz2qWiuV.mjs.map +1 -0
- package/dist/chunks/fr-CzTPuD1P.mjs +2 -0
- package/dist/chunks/fr-CzTPuD1P.mjs.map +1 -0
- package/dist/chunks/fr-D1LQMsjB.mjs +2 -0
- package/dist/chunks/fr-D1LQMsjB.mjs.map +1 -0
- package/dist/chunks/fr-D84mXQrZ.mjs +2 -0
- package/dist/chunks/fr-D84mXQrZ.mjs.map +1 -0
- package/dist/chunks/fr-DX7z_ld0.mjs +2 -0
- package/dist/chunks/fr-DX7z_ld0.mjs.map +1 -0
- package/dist/chunks/fr-DXkQUerf.mjs +2 -0
- package/dist/chunks/fr-DXkQUerf.mjs.map +1 -0
- package/dist/chunks/fr-Di5gv5P8.mjs +2 -0
- package/dist/chunks/fr-Di5gv5P8.mjs.map +1 -0
- package/dist/chunks/fr-Dq5MrVWd.mjs +2 -0
- package/dist/chunks/fr-Dq5MrVWd.mjs.map +1 -0
- package/dist/chunks/fr-DtfEjLSL.mjs +2 -0
- package/dist/chunks/fr-DtfEjLSL.mjs.map +1 -0
- package/dist/chunks/fr-DvW-dpp3.mjs +2 -0
- package/dist/chunks/fr-DvW-dpp3.mjs.map +1 -0
- package/dist/chunks/fr-UJFNrn-V.mjs +2 -0
- package/dist/chunks/fr-UJFNrn-V.mjs.map +1 -0
- package/dist/chunks/fr-hK8X-sM6.mjs +2 -0
- package/dist/chunks/fr-hK8X-sM6.mjs.map +1 -0
- package/dist/chunks/fr-uuOSXj4L.mjs +2 -0
- package/dist/chunks/fr-uuOSXj4L.mjs.map +1 -0
- package/dist/chunks/full-216JgIG1.mjs +2 -0
- package/dist/chunks/full-216JgIG1.mjs.map +1 -0
- package/dist/chunks/hi-B2kXjElO.mjs +2 -0
- package/dist/chunks/hi-B2kXjElO.mjs.map +1 -0
- package/dist/chunks/hi-B2mEQ5gX.mjs +2 -0
- package/dist/chunks/hi-B2mEQ5gX.mjs.map +1 -0
- package/dist/chunks/hi-B61lTO2W.mjs +2 -0
- package/dist/chunks/hi-B61lTO2W.mjs.map +1 -0
- package/dist/chunks/hi-BD5HrbxU.mjs +2 -0
- package/dist/chunks/hi-BD5HrbxU.mjs.map +1 -0
- package/dist/chunks/hi-BHTvSWXw.mjs +2 -0
- package/dist/chunks/hi-BHTvSWXw.mjs.map +1 -0
- package/dist/chunks/hi-BYyaOBqY.mjs +2 -0
- package/dist/chunks/hi-BYyaOBqY.mjs.map +1 -0
- package/dist/chunks/hi-Bhlbz5gX.mjs +2 -0
- package/dist/chunks/hi-Bhlbz5gX.mjs.map +1 -0
- package/dist/chunks/hi-BniuSk3L.mjs +2 -0
- package/dist/chunks/hi-BniuSk3L.mjs.map +1 -0
- package/dist/chunks/hi-CBODdhOq.mjs +2 -0
- package/dist/chunks/hi-CBODdhOq.mjs.map +1 -0
- package/dist/chunks/hi-CKWQCooT.mjs +2 -0
- package/dist/chunks/hi-CKWQCooT.mjs.map +1 -0
- package/dist/chunks/hi-CkoruGVs.mjs +2 -0
- package/dist/chunks/hi-CkoruGVs.mjs.map +1 -0
- package/dist/chunks/hi-D6Ge3Lp5.mjs +2 -0
- package/dist/chunks/hi-D6Ge3Lp5.mjs.map +1 -0
- package/dist/chunks/hi-DEreeBFj.mjs +2 -0
- package/dist/chunks/hi-DEreeBFj.mjs.map +1 -0
- package/dist/chunks/hi-Dj4JW-9k.mjs +2 -0
- package/dist/chunks/hi-Dj4JW-9k.mjs.map +1 -0
- package/dist/chunks/hi-DkP4pHSX.mjs +2 -0
- package/dist/chunks/hi-DkP4pHSX.mjs.map +1 -0
- package/dist/chunks/hi-DknCX8Nx.mjs +2 -0
- package/dist/chunks/hi-DknCX8Nx.mjs.map +1 -0
- package/dist/chunks/hi-Dm1KJQQ5.mjs +2 -0
- package/dist/chunks/hi-Dm1KJQQ5.mjs.map +1 -0
- package/dist/chunks/hi-Dx-LTWg-.mjs +2 -0
- package/dist/chunks/hi-Dx-LTWg-.mjs.map +1 -0
- package/dist/chunks/hi-RDoZtwMm.mjs +2 -0
- package/dist/chunks/hi-RDoZtwMm.mjs.map +1 -0
- package/dist/chunks/hi-Tq9eDRk7.mjs +2 -0
- package/dist/chunks/hi-Tq9eDRk7.mjs.map +1 -0
- package/dist/chunks/hi-_vJ_Eo4p.mjs +2 -0
- package/dist/chunks/hi-_vJ_Eo4p.mjs.map +1 -0
- package/dist/chunks/hi-l8E-czFm.mjs +2 -0
- package/dist/chunks/hi-l8E-czFm.mjs.map +1 -0
- package/dist/chunks/hi-ydmPh3HB.mjs +2 -0
- package/dist/chunks/hi-ydmPh3HB.mjs.map +1 -0
- package/dist/chunks/minimal-D-QxXO1C.mjs +2 -0
- package/dist/chunks/minimal-D-QxXO1C.mjs.map +1 -0
- package/dist/chunks/pt-B4NUSLW8.mjs +2 -0
- package/dist/chunks/pt-B4NUSLW8.mjs.map +1 -0
- package/dist/chunks/pt-B8VKEboV.mjs +2 -0
- package/dist/chunks/pt-B8VKEboV.mjs.map +1 -0
- package/dist/chunks/pt-BMDKykEi.mjs +2 -0
- package/dist/chunks/pt-BMDKykEi.mjs.map +1 -0
- package/dist/chunks/pt-BmWE3xXF.mjs +2 -0
- package/dist/chunks/pt-BmWE3xXF.mjs.map +1 -0
- package/dist/chunks/pt-CJWKE1SW.mjs +2 -0
- package/dist/chunks/pt-CJWKE1SW.mjs.map +1 -0
- package/dist/chunks/pt-CKETXoPa.mjs +2 -0
- package/dist/chunks/pt-CKETXoPa.mjs.map +1 -0
- package/dist/chunks/pt-CKRs16QH.mjs +2 -0
- package/dist/chunks/pt-CKRs16QH.mjs.map +1 -0
- package/dist/chunks/pt-Cb-1GHq4.mjs +2 -0
- package/dist/chunks/pt-Cb-1GHq4.mjs.map +1 -0
- package/dist/chunks/pt-CgpU74p4.mjs +2 -0
- package/dist/chunks/pt-CgpU74p4.mjs.map +1 -0
- package/dist/chunks/pt-CtOdAphq.mjs +2 -0
- package/dist/chunks/pt-CtOdAphq.mjs.map +1 -0
- package/dist/chunks/pt-CzaPFMSx.mjs +2 -0
- package/dist/chunks/pt-CzaPFMSx.mjs.map +1 -0
- package/dist/chunks/pt-DGuLcW0m.mjs +2 -0
- package/dist/chunks/pt-DGuLcW0m.mjs.map +1 -0
- package/dist/chunks/pt-DHzSXzlf.mjs +2 -0
- package/dist/chunks/pt-DHzSXzlf.mjs.map +1 -0
- package/dist/chunks/pt-DWDdBfLk.mjs +2 -0
- package/dist/chunks/pt-DWDdBfLk.mjs.map +1 -0
- package/dist/chunks/pt-DZ6Liq_x.mjs +2 -0
- package/dist/chunks/pt-DZ6Liq_x.mjs.map +1 -0
- package/dist/chunks/pt-D_MD7MJu.mjs +2 -0
- package/dist/chunks/pt-D_MD7MJu.mjs.map +1 -0
- package/dist/chunks/pt-DgaY_yNG.mjs +2 -0
- package/dist/chunks/pt-DgaY_yNG.mjs.map +1 -0
- package/dist/chunks/pt-DgzgCxdH.mjs +2 -0
- package/dist/chunks/pt-DgzgCxdH.mjs.map +1 -0
- package/dist/chunks/pt-Dh7nUcAM.mjs +2 -0
- package/dist/chunks/pt-Dh7nUcAM.mjs.map +1 -0
- package/dist/chunks/pt-P914L5AX.mjs +2 -0
- package/dist/chunks/pt-P914L5AX.mjs.map +1 -0
- package/dist/chunks/pt-XT1vsWZj.mjs +2 -0
- package/dist/chunks/pt-XT1vsWZj.mjs.map +1 -0
- package/dist/chunks/pt-jJ0XXSVz.mjs +2 -0
- package/dist/chunks/pt-jJ0XXSVz.mjs.map +1 -0
- package/dist/chunks/pt-tuOLwYkM.mjs +2 -0
- package/dist/chunks/pt-tuOLwYkM.mjs.map +1 -0
- package/dist/chunks/rolldown-runtime-B8Ku5yk6.mjs +1 -0
- package/dist/chunks/ru-7m8CMM17.mjs +2 -0
- package/dist/chunks/ru-7m8CMM17.mjs.map +1 -0
- package/dist/chunks/ru-9Qh1fR-K.mjs +2 -0
- package/dist/chunks/ru-9Qh1fR-K.mjs.map +1 -0
- package/dist/chunks/ru-B5gK8OLp.mjs +2 -0
- package/dist/chunks/ru-B5gK8OLp.mjs.map +1 -0
- package/dist/chunks/ru-BRNN6ldH.mjs +2 -0
- package/dist/chunks/ru-BRNN6ldH.mjs.map +1 -0
- package/dist/chunks/ru-BiyE9o-D.mjs +2 -0
- package/dist/chunks/ru-BiyE9o-D.mjs.map +1 -0
- package/dist/chunks/ru-BpGTIPbv.mjs +2 -0
- package/dist/chunks/ru-BpGTIPbv.mjs.map +1 -0
- package/dist/chunks/ru-CAzMaI4y.mjs +2 -0
- package/dist/chunks/ru-CAzMaI4y.mjs.map +1 -0
- package/dist/chunks/ru-COo6HpcD.mjs +2 -0
- package/dist/chunks/ru-COo6HpcD.mjs.map +1 -0
- package/dist/chunks/ru-CgEOZsUs.mjs +2 -0
- package/dist/chunks/ru-CgEOZsUs.mjs.map +1 -0
- package/dist/chunks/ru-CptzezhV.mjs +2 -0
- package/dist/chunks/ru-CptzezhV.mjs.map +1 -0
- package/dist/chunks/ru-Ct0qNMLS.mjs +2 -0
- package/dist/chunks/ru-Ct0qNMLS.mjs.map +1 -0
- package/dist/chunks/ru-Ct2IrzbA.mjs +2 -0
- package/dist/chunks/ru-Ct2IrzbA.mjs.map +1 -0
- package/dist/chunks/ru-CyHnlWLN.mjs +2 -0
- package/dist/chunks/ru-CyHnlWLN.mjs.map +1 -0
- package/dist/chunks/ru-DF0vhzeC.mjs +2 -0
- package/dist/chunks/ru-DF0vhzeC.mjs.map +1 -0
- package/dist/chunks/ru-DH6rsOWL.mjs +2 -0
- package/dist/chunks/ru-DH6rsOWL.mjs.map +1 -0
- package/dist/chunks/ru-DHH8k6G8.mjs +2 -0
- package/dist/chunks/ru-DHH8k6G8.mjs.map +1 -0
- package/dist/chunks/ru-GVReqjM4.mjs +2 -0
- package/dist/chunks/ru-GVReqjM4.mjs.map +1 -0
- package/dist/chunks/ru-IzloX5CY.mjs +2 -0
- package/dist/chunks/ru-IzloX5CY.mjs.map +1 -0
- package/dist/chunks/ru-ZrzXB0f6.mjs +2 -0
- package/dist/chunks/ru-ZrzXB0f6.mjs.map +1 -0
- package/dist/chunks/ru-asRKygvE.mjs +2 -0
- package/dist/chunks/ru-asRKygvE.mjs.map +1 -0
- package/dist/chunks/ru-m19l8nRA.mjs +2 -0
- package/dist/chunks/ru-m19l8nRA.mjs.map +1 -0
- package/dist/chunks/ru-vfQ5Xaz4.mjs +2 -0
- package/dist/chunks/ru-vfQ5Xaz4.mjs.map +1 -0
- package/dist/chunks/ru-wVOlNily.mjs +2 -0
- package/dist/chunks/ru-wVOlNily.mjs.map +1 -0
- package/dist/chunks/shared-DxmfXZH7.mjs +2 -0
- package/dist/chunks/shared-DxmfXZH7.mjs.map +1 -0
- package/dist/chunks/src-DFXIsulM.mjs +2 -0
- package/dist/chunks/src-DFXIsulM.mjs.map +1 -0
- package/dist/chunks/text-direction-advanced-B5JuIs0P.mjs +2 -0
- package/dist/chunks/text-direction-advanced-B5JuIs0P.mjs.map +1 -0
- package/dist/chunks/zh-0uhsRxfq.mjs +2 -0
- package/dist/chunks/zh-0uhsRxfq.mjs.map +1 -0
- package/dist/chunks/zh-1BrLr5Wk.mjs +2 -0
- package/dist/chunks/zh-1BrLr5Wk.mjs.map +1 -0
- package/dist/chunks/zh-BNHeXa_M.mjs +2 -0
- package/dist/chunks/zh-BNHeXa_M.mjs.map +1 -0
- package/dist/chunks/zh-BOpBzSX3.mjs +2 -0
- package/dist/chunks/zh-BOpBzSX3.mjs.map +1 -0
- package/dist/chunks/zh-BV2uDDGf.mjs +2 -0
- package/dist/chunks/zh-BV2uDDGf.mjs.map +1 -0
- package/dist/chunks/zh-BkoPteNb.mjs +2 -0
- package/dist/chunks/zh-BkoPteNb.mjs.map +1 -0
- package/dist/chunks/zh-C2z0g7OC.mjs +2 -0
- package/dist/chunks/zh-C2z0g7OC.mjs.map +1 -0
- package/dist/chunks/zh-CeJw45yo.mjs +2 -0
- package/dist/chunks/zh-CeJw45yo.mjs.map +1 -0
- package/dist/chunks/zh-CwVkxL4q.mjs +2 -0
- package/dist/chunks/zh-CwVkxL4q.mjs.map +1 -0
- package/dist/chunks/zh-Cy7mujpx.mjs +2 -0
- package/dist/chunks/zh-Cy7mujpx.mjs.map +1 -0
- package/dist/chunks/zh-D-P00ENX.mjs +2 -0
- package/dist/chunks/zh-D-P00ENX.mjs.map +1 -0
- package/dist/chunks/zh-D5d-NAuv.mjs +2 -0
- package/dist/chunks/zh-D5d-NAuv.mjs.map +1 -0
- package/dist/chunks/zh-D6gTQA2W.mjs +2 -0
- package/dist/chunks/zh-D6gTQA2W.mjs.map +1 -0
- package/dist/chunks/zh-DLwq4e4-.mjs +2 -0
- package/dist/chunks/zh-DLwq4e4-.mjs.map +1 -0
- package/dist/chunks/zh-D_Yb8Eg6.mjs +2 -0
- package/dist/chunks/zh-D_Yb8Eg6.mjs.map +1 -0
- package/dist/chunks/zh-DaNHqNDY.mjs +2 -0
- package/dist/chunks/zh-DaNHqNDY.mjs.map +1 -0
- package/dist/chunks/zh-De7-Y4O5.mjs +2 -0
- package/dist/chunks/zh-De7-Y4O5.mjs.map +1 -0
- package/dist/chunks/zh-Dj7kHEcp.mjs +2 -0
- package/dist/chunks/zh-Dj7kHEcp.mjs.map +1 -0
- package/dist/chunks/zh-Dl0oVWiK.mjs +2 -0
- package/dist/chunks/zh-Dl0oVWiK.mjs.map +1 -0
- package/dist/chunks/zh-Do0plBjM.mjs +2 -0
- package/dist/chunks/zh-Do0plBjM.mjs.map +1 -0
- package/dist/chunks/zh-Q0aDk5UA.mjs +2 -0
- package/dist/chunks/zh-Q0aDk5UA.mjs.map +1 -0
- package/dist/chunks/zh-eSgs8mzc.mjs +2 -0
- package/dist/chunks/zh-eSgs8mzc.mjs.map +1 -0
- package/dist/chunks/zh-giWyGMSZ.mjs +2 -0
- package/dist/chunks/zh-giWyGMSZ.mjs.map +1 -0
- package/dist/fonts.mjs +1 -2
- package/dist/full.mjs +1 -2
- package/dist/html.mjs +1 -2
- package/dist/notectl-core.mjs +1 -2
- package/dist/notectl-core.umd.js +2 -2
- package/dist/notectl-core.umd.js.map +1 -1
- package/dist/plugins/alignment.mjs +1 -2
- package/dist/plugins/blockquote.mjs +1 -2
- package/dist/plugins/caret-navigation.mjs +1 -2
- package/dist/plugins/code-block.mjs +1 -2
- package/dist/plugins/font-size.mjs +1 -2
- package/dist/plugins/font.mjs +1 -2
- package/dist/plugins/gap-cursor.mjs +1 -2
- package/dist/plugins/hard-break.mjs +1 -2
- package/dist/plugins/heading.mjs +1 -2
- package/dist/plugins/highlight.mjs +1 -2
- package/dist/plugins/horizontal-rule.mjs +1 -2
- package/dist/plugins/image.mjs +1 -2
- package/dist/plugins/link.mjs +1 -2
- package/dist/plugins/list.mjs +1 -2
- package/dist/plugins/print/PrintContentPreparer.d.ts.map +1 -1
- package/dist/plugins/print.mjs +1 -2
- package/dist/plugins/shared.mjs +1 -2
- package/dist/plugins/smart-paste.mjs +1 -2
- package/dist/plugins/strikethrough.mjs +1 -2
- package/dist/plugins/super-sub.mjs +1 -2
- package/dist/plugins/table.mjs +1 -2
- package/dist/plugins/text-color.mjs +1 -2
- package/dist/plugins/text-direction-advanced.mjs +1 -2
- package/dist/plugins/text-direction.mjs +1 -2
- package/dist/plugins/text-formatting.mjs +1 -2
- package/dist/plugins/toolbar.mjs +1 -2
- package/dist/presets/full.mjs +1 -2
- package/dist/presets/minimal.mjs +1 -2
- package/dist/presets.mjs +1 -2
- package/package.json +4 -4
- package/dist/chunks/AttrRegistry-iNpjvcSG.mjs +0 -2
- package/dist/chunks/AttrRegistry-iNpjvcSG.mjs.map +0 -1
- package/dist/chunks/AttributedMarkCommands-BY1BSYWM.mjs +0 -2
- package/dist/chunks/AttributedMarkCommands-BY1BSYWM.mjs.map +0 -1
- package/dist/chunks/BlockInsertion-BJFhE0jA.mjs +0 -2
- package/dist/chunks/BlockInsertion-BJFhE0jA.mjs.map +0 -1
- package/dist/chunks/BlockTypePickerRegistry-DcSE6IXB.mjs +0 -2
- package/dist/chunks/BlockTypePickerRegistry-DcSE6IXB.mjs.map +0 -1
- package/dist/chunks/ColorGrid-CpkbKfXg.mjs +0 -2
- package/dist/chunks/ColorGrid-CpkbKfXg.mjs.map +0 -1
- package/dist/chunks/ColorPickerPopup-D6XjShhv.mjs +0 -2
- package/dist/chunks/ColorPickerPopup-D6XjShhv.mjs.map +0 -1
- package/dist/chunks/ColorValidation-DCSKq9B2.mjs +0 -2
- package/dist/chunks/ColorValidation-DCSKq9B2.mjs.map +0 -1
- package/dist/chunks/CommandHelpers-M6mPS6Ww.mjs +0 -2
- package/dist/chunks/CommandHelpers-M6mPS6Ww.mjs.map +0 -1
- package/dist/chunks/Commands-D_gMCnVa.mjs +0 -2
- package/dist/chunks/Commands-D_gMCnVa.mjs.map +0 -1
- package/dist/chunks/Decoration-D49mFXrH.mjs +0 -2
- package/dist/chunks/Decoration-D49mFXrH.mjs.map +0 -1
- package/dist/chunks/Document-3pNX7ear.mjs +0 -2
- package/dist/chunks/Document-3pNX7ear.mjs.map +0 -1
- package/dist/chunks/DocumentParser-LvzDQOd1.mjs +0 -2
- package/dist/chunks/DocumentParser-LvzDQOd1.mjs.map +0 -1
- package/dist/chunks/DomUtils-CznMAZZg.mjs +0 -2
- package/dist/chunks/DomUtils-CznMAZZg.mjs.map +0 -1
- package/dist/chunks/HTMLUtils-Cxy99Ak2.mjs +0 -2
- package/dist/chunks/HTMLUtils-Cxy99Ak2.mjs.map +0 -1
- package/dist/chunks/HeadingPlugin-BmkeUXj8.mjs +0 -2
- package/dist/chunks/HeadingPlugin-BmkeUXj8.mjs.map +0 -1
- package/dist/chunks/KeyboardNav-DsYhKKuV.mjs +0 -2
- package/dist/chunks/KeyboardNav-DsYhKKuV.mjs.map +0 -1
- package/dist/chunks/MarkCommands-CeCa4WSC.mjs +0 -2
- package/dist/chunks/MarkCommands-CeCa4WSC.mjs.map +0 -1
- package/dist/chunks/NavigationQueries-11qe4j9x.mjs +0 -2
- package/dist/chunks/NavigationQueries-11qe4j9x.mjs.map +0 -1
- package/dist/chunks/NodeResolver-z0ReCR34.mjs +0 -2
- package/dist/chunks/NodeResolver-z0ReCR34.mjs.map +0 -1
- package/dist/chunks/NodeSelectionCommands-CXrOcPtG.mjs +0 -2
- package/dist/chunks/NodeSelectionCommands-CXrOcPtG.mjs.map +0 -1
- package/dist/chunks/NotectlEditor-BJD7-FFx.mjs +0 -4
- package/dist/chunks/NotectlEditor-BJD7-FFx.mjs.map +0 -1
- package/dist/chunks/Platform-CU6itXZo.mjs +0 -2
- package/dist/chunks/Platform-CU6itXZo.mjs.map +0 -1
- package/dist/chunks/PluginHelpers-CdPR0MuT.mjs +0 -2
- package/dist/chunks/PluginHelpers-CdPR0MuT.mjs.map +0 -1
- package/dist/chunks/PopupManager-0b_Q0m7K.mjs +0 -2
- package/dist/chunks/PopupManager-0b_Q0m7K.mjs.map +0 -1
- package/dist/chunks/PopupPositioning-DtvqMSop.mjs +0 -2
- package/dist/chunks/PopupPositioning-DtvqMSop.mjs.map +0 -1
- package/dist/chunks/PrintTypes-DukwDSWS.mjs +0 -2
- package/dist/chunks/PrintTypes-DukwDSWS.mjs.map +0 -1
- package/dist/chunks/RangeIterator-XFN5FaYf.mjs +0 -2
- package/dist/chunks/RangeIterator-XFN5FaYf.mjs.map +0 -1
- package/dist/chunks/Selection-DhbizDM4.mjs +0 -2
- package/dist/chunks/Selection-DhbizDM4.mjs.map +0 -1
- package/dist/chunks/SelectionTransactions-DzIZxcuN.mjs +0 -2
- package/dist/chunks/SelectionTransactions-DzIZxcuN.mjs.map +0 -1
- package/dist/chunks/ShortcutFormatting-BLKS0Gys.mjs +0 -2
- package/dist/chunks/ShortcutFormatting-BLKS0Gys.mjs.map +0 -1
- package/dist/chunks/StyleRuntime-BmsLoEa8.mjs +0 -2
- package/dist/chunks/StyleRuntime-BmsLoEa8.mjs.map +0 -1
- package/dist/chunks/TextDirectionLocale-CKz0ZrH_.mjs +0 -2
- package/dist/chunks/TextDirectionLocale-CKz0ZrH_.mjs.map +0 -1
- package/dist/chunks/TypeBrands-Bp_Z_o5Y.mjs +0 -2
- package/dist/chunks/TypeBrands-Bp_Z_o5Y.mjs.map +0 -1
- package/dist/chunks/XmlPatterns-DxQXGjP8.mjs +0 -2
- package/dist/chunks/XmlPatterns-DxQXGjP8.mjs.map +0 -1
- package/dist/chunks/ar-B93SPJT7.mjs +0 -2
- package/dist/chunks/ar-B93SPJT7.mjs.map +0 -1
- package/dist/chunks/ar-BAmGa08u.mjs +0 -2
- package/dist/chunks/ar-BAmGa08u.mjs.map +0 -1
- package/dist/chunks/ar-BYNFEVLc.mjs +0 -2
- package/dist/chunks/ar-BYNFEVLc.mjs.map +0 -1
- package/dist/chunks/ar-Bnc7y8BP.mjs +0 -2
- package/dist/chunks/ar-Bnc7y8BP.mjs.map +0 -1
- package/dist/chunks/ar-Bp3rDZky.mjs +0 -2
- package/dist/chunks/ar-Bp3rDZky.mjs.map +0 -1
- package/dist/chunks/ar-BtOQ7lro.mjs +0 -2
- package/dist/chunks/ar-BtOQ7lro.mjs.map +0 -1
- package/dist/chunks/ar-C5JEHhw9.mjs +0 -2
- package/dist/chunks/ar-C5JEHhw9.mjs.map +0 -1
- package/dist/chunks/ar-CL3QL0tw.mjs +0 -2
- package/dist/chunks/ar-CL3QL0tw.mjs.map +0 -1
- package/dist/chunks/ar-CYtG-XlN.mjs +0 -2
- package/dist/chunks/ar-CYtG-XlN.mjs.map +0 -1
- package/dist/chunks/ar-CzVj8p__.mjs +0 -2
- package/dist/chunks/ar-CzVj8p__.mjs.map +0 -1
- package/dist/chunks/ar-D7PS3e2g.mjs +0 -2
- package/dist/chunks/ar-D7PS3e2g.mjs.map +0 -1
- package/dist/chunks/ar-D8adM2Uy.mjs +0 -2
- package/dist/chunks/ar-D8adM2Uy.mjs.map +0 -1
- package/dist/chunks/ar-D9jyShaB.mjs +0 -2
- package/dist/chunks/ar-D9jyShaB.mjs.map +0 -1
- package/dist/chunks/ar-DR6OA3ZO.mjs +0 -2
- package/dist/chunks/ar-DR6OA3ZO.mjs.map +0 -1
- package/dist/chunks/ar-Deibepjm.mjs +0 -2
- package/dist/chunks/ar-Deibepjm.mjs.map +0 -1
- package/dist/chunks/ar-Dlb5riUN.mjs +0 -2
- package/dist/chunks/ar-Dlb5riUN.mjs.map +0 -1
- package/dist/chunks/ar-DmmxE2W7.mjs +0 -2
- package/dist/chunks/ar-DmmxE2W7.mjs.map +0 -1
- package/dist/chunks/ar-Ds6Z2Gzf.mjs +0 -2
- package/dist/chunks/ar-Ds6Z2Gzf.mjs.map +0 -1
- package/dist/chunks/ar-DtIHQ8nU.mjs +0 -2
- package/dist/chunks/ar-DtIHQ8nU.mjs.map +0 -1
- package/dist/chunks/ar-J8B-on-0.mjs +0 -2
- package/dist/chunks/ar-J8B-on-0.mjs.map +0 -1
- package/dist/chunks/ar-b6VdnxAs.mjs +0 -2
- package/dist/chunks/ar-b6VdnxAs.mjs.map +0 -1
- package/dist/chunks/ar-iU02mRe5.mjs +0 -2
- package/dist/chunks/ar-iU02mRe5.mjs.map +0 -1
- package/dist/chunks/ar-mSCYQYnL.mjs +0 -2
- package/dist/chunks/ar-mSCYQYnL.mjs.map +0 -1
- package/dist/chunks/color-picker-Byjl_xr9.mjs +0 -2
- package/dist/chunks/color-picker-Byjl_xr9.mjs.map +0 -1
- package/dist/chunks/de-8aCC5jBM.mjs +0 -2
- package/dist/chunks/de-8aCC5jBM.mjs.map +0 -1
- package/dist/chunks/de-B4y4ndUw.mjs +0 -2
- package/dist/chunks/de-B4y4ndUw.mjs.map +0 -1
- package/dist/chunks/de-B5fcZ0FQ.mjs +0 -2
- package/dist/chunks/de-B5fcZ0FQ.mjs.map +0 -1
- package/dist/chunks/de-BT9VmwoJ.mjs +0 -2
- package/dist/chunks/de-BT9VmwoJ.mjs.map +0 -1
- package/dist/chunks/de-BZWSyJTG.mjs +0 -2
- package/dist/chunks/de-BZWSyJTG.mjs.map +0 -1
- package/dist/chunks/de-CFD_Wgik.mjs +0 -2
- package/dist/chunks/de-CFD_Wgik.mjs.map +0 -1
- package/dist/chunks/de-CLYtb6kD.mjs +0 -2
- package/dist/chunks/de-CLYtb6kD.mjs.map +0 -1
- package/dist/chunks/de-CP5v-98M.mjs +0 -2
- package/dist/chunks/de-CP5v-98M.mjs.map +0 -1
- package/dist/chunks/de-CYJ6uWno.mjs +0 -2
- package/dist/chunks/de-CYJ6uWno.mjs.map +0 -1
- package/dist/chunks/de-ChcKkF7A.mjs +0 -2
- package/dist/chunks/de-ChcKkF7A.mjs.map +0 -1
- package/dist/chunks/de-CicoU066.mjs +0 -2
- package/dist/chunks/de-CicoU066.mjs.map +0 -1
- package/dist/chunks/de-CjLAdBt2.mjs +0 -2
- package/dist/chunks/de-CjLAdBt2.mjs.map +0 -1
- package/dist/chunks/de-CtFvAXwF.mjs +0 -2
- package/dist/chunks/de-CtFvAXwF.mjs.map +0 -1
- package/dist/chunks/de-D1OAXtxJ.mjs +0 -2
- package/dist/chunks/de-D1OAXtxJ.mjs.map +0 -1
- package/dist/chunks/de-DBbzCQrm.mjs +0 -2
- package/dist/chunks/de-DBbzCQrm.mjs.map +0 -1
- package/dist/chunks/de-DOLwx_M7.mjs +0 -2
- package/dist/chunks/de-DOLwx_M7.mjs.map +0 -1
- package/dist/chunks/de-De2miMxo.mjs +0 -2
- package/dist/chunks/de-De2miMxo.mjs.map +0 -1
- package/dist/chunks/de-OTfhhinm.mjs +0 -2
- package/dist/chunks/de-OTfhhinm.mjs.map +0 -1
- package/dist/chunks/de-PZ9-LlBp.mjs +0 -2
- package/dist/chunks/de-PZ9-LlBp.mjs.map +0 -1
- package/dist/chunks/de-UREymH-5.mjs +0 -2
- package/dist/chunks/de-UREymH-5.mjs.map +0 -1
- package/dist/chunks/de-chYdoK9q.mjs +0 -2
- package/dist/chunks/de-chYdoK9q.mjs.map +0 -1
- package/dist/chunks/de-fXvs5vQT.mjs +0 -2
- package/dist/chunks/de-fXvs5vQT.mjs.map +0 -1
- package/dist/chunks/de-xJh5C_pk.mjs +0 -2
- package/dist/chunks/de-xJh5C_pk.mjs.map +0 -1
- package/dist/chunks/es-B9UhsaEI.mjs +0 -2
- package/dist/chunks/es-B9UhsaEI.mjs.map +0 -1
- package/dist/chunks/es-BHGwPgrP.mjs +0 -2
- package/dist/chunks/es-BHGwPgrP.mjs.map +0 -1
- package/dist/chunks/es-BTqy_aQ4.mjs +0 -2
- package/dist/chunks/es-BTqy_aQ4.mjs.map +0 -1
- package/dist/chunks/es-BbGOZGS_.mjs +0 -2
- package/dist/chunks/es-BbGOZGS_.mjs.map +0 -1
- package/dist/chunks/es-BjPsub0k.mjs +0 -2
- package/dist/chunks/es-BjPsub0k.mjs.map +0 -1
- package/dist/chunks/es-Bk0bRDFE.mjs +0 -2
- package/dist/chunks/es-Bk0bRDFE.mjs.map +0 -1
- package/dist/chunks/es-BkS6DsrM.mjs +0 -2
- package/dist/chunks/es-BkS6DsrM.mjs.map +0 -1
- package/dist/chunks/es-BzEpr4Bk.mjs +0 -2
- package/dist/chunks/es-BzEpr4Bk.mjs.map +0 -1
- package/dist/chunks/es-C2lnWyA0.mjs +0 -2
- package/dist/chunks/es-C2lnWyA0.mjs.map +0 -1
- package/dist/chunks/es-C7e35Muh.mjs +0 -2
- package/dist/chunks/es-C7e35Muh.mjs.map +0 -1
- package/dist/chunks/es-CBk43isB.mjs +0 -2
- package/dist/chunks/es-CBk43isB.mjs.map +0 -1
- package/dist/chunks/es-CE8t9fuM.mjs +0 -2
- package/dist/chunks/es-CE8t9fuM.mjs.map +0 -1
- package/dist/chunks/es-CFjzqIbS.mjs +0 -2
- package/dist/chunks/es-CFjzqIbS.mjs.map +0 -1
- package/dist/chunks/es-Ce-AEYxc.mjs +0 -2
- package/dist/chunks/es-Ce-AEYxc.mjs.map +0 -1
- package/dist/chunks/es-Co4AJr8Y.mjs +0 -2
- package/dist/chunks/es-Co4AJr8Y.mjs.map +0 -1
- package/dist/chunks/es-Cu5_OA4X.mjs +0 -2
- package/dist/chunks/es-Cu5_OA4X.mjs.map +0 -1
- package/dist/chunks/es-Cud6JXHf.mjs +0 -2
- package/dist/chunks/es-Cud6JXHf.mjs.map +0 -1
- package/dist/chunks/es-D-II7LZC.mjs +0 -2
- package/dist/chunks/es-D-II7LZC.mjs.map +0 -1
- package/dist/chunks/es-DBBSeOaD.mjs +0 -2
- package/dist/chunks/es-DBBSeOaD.mjs.map +0 -1
- package/dist/chunks/es-DCwjeUUu.mjs +0 -2
- package/dist/chunks/es-DCwjeUUu.mjs.map +0 -1
- package/dist/chunks/es-DvgH3-WZ.mjs +0 -2
- package/dist/chunks/es-DvgH3-WZ.mjs.map +0 -1
- package/dist/chunks/es-MgguVgIs.mjs +0 -2
- package/dist/chunks/es-MgguVgIs.mjs.map +0 -1
- package/dist/chunks/es-yXjjcxgb.mjs +0 -2
- package/dist/chunks/es-yXjjcxgb.mjs.map +0 -1
- package/dist/chunks/fr-B-_yKIAY.mjs +0 -2
- package/dist/chunks/fr-B-_yKIAY.mjs.map +0 -1
- package/dist/chunks/fr-BGyF2ym0.mjs +0 -2
- package/dist/chunks/fr-BGyF2ym0.mjs.map +0 -1
- package/dist/chunks/fr-BoRJ3B2-.mjs +0 -2
- package/dist/chunks/fr-BoRJ3B2-.mjs.map +0 -1
- package/dist/chunks/fr-BrKk4SPg.mjs +0 -2
- package/dist/chunks/fr-BrKk4SPg.mjs.map +0 -1
- package/dist/chunks/fr-C-y09LKg.mjs +0 -2
- package/dist/chunks/fr-C-y09LKg.mjs.map +0 -1
- package/dist/chunks/fr-C1W7jyd6.mjs +0 -2
- package/dist/chunks/fr-C1W7jyd6.mjs.map +0 -1
- package/dist/chunks/fr-C8CtmWBj.mjs +0 -2
- package/dist/chunks/fr-C8CtmWBj.mjs.map +0 -1
- package/dist/chunks/fr-C9oiPW0k.mjs +0 -2
- package/dist/chunks/fr-C9oiPW0k.mjs.map +0 -1
- package/dist/chunks/fr-CEkk4UyZ.mjs +0 -2
- package/dist/chunks/fr-CEkk4UyZ.mjs.map +0 -1
- package/dist/chunks/fr-Ccaetiwi.mjs +0 -2
- package/dist/chunks/fr-Ccaetiwi.mjs.map +0 -1
- package/dist/chunks/fr-Ccku5KzA.mjs +0 -2
- package/dist/chunks/fr-Ccku5KzA.mjs.map +0 -1
- package/dist/chunks/fr-CfUg1FxU.mjs +0 -2
- package/dist/chunks/fr-CfUg1FxU.mjs.map +0 -1
- package/dist/chunks/fr-DDkBcjmO.mjs +0 -2
- package/dist/chunks/fr-DDkBcjmO.mjs.map +0 -1
- package/dist/chunks/fr-DNwLChcm.mjs +0 -2
- package/dist/chunks/fr-DNwLChcm.mjs.map +0 -1
- package/dist/chunks/fr-DvneSjCf.mjs +0 -2
- package/dist/chunks/fr-DvneSjCf.mjs.map +0 -1
- package/dist/chunks/fr-Dx4Qqimj.mjs +0 -2
- package/dist/chunks/fr-Dx4Qqimj.mjs.map +0 -1
- package/dist/chunks/fr-RHXmueoO.mjs +0 -2
- package/dist/chunks/fr-RHXmueoO.mjs.map +0 -1
- package/dist/chunks/fr-VdiCNF4J.mjs +0 -2
- package/dist/chunks/fr-VdiCNF4J.mjs.map +0 -1
- package/dist/chunks/fr-Wiobfk5s.mjs +0 -2
- package/dist/chunks/fr-Wiobfk5s.mjs.map +0 -1
- package/dist/chunks/fr-YMiDtWuG.mjs +0 -2
- package/dist/chunks/fr-YMiDtWuG.mjs.map +0 -1
- package/dist/chunks/fr-_Oxf0k66.mjs +0 -2
- package/dist/chunks/fr-_Oxf0k66.mjs.map +0 -1
- package/dist/chunks/fr-gurfH-7T.mjs +0 -2
- package/dist/chunks/fr-gurfH-7T.mjs.map +0 -1
- package/dist/chunks/fr-zP7EjxDL.mjs +0 -2
- package/dist/chunks/fr-zP7EjxDL.mjs.map +0 -1
- package/dist/chunks/hi-B2W8pFqK.mjs +0 -2
- package/dist/chunks/hi-B2W8pFqK.mjs.map +0 -1
- package/dist/chunks/hi-B2m69ZCq.mjs +0 -2
- package/dist/chunks/hi-B2m69ZCq.mjs.map +0 -1
- package/dist/chunks/hi-BMIt3y_-.mjs +0 -2
- package/dist/chunks/hi-BMIt3y_-.mjs.map +0 -1
- package/dist/chunks/hi-BdtVhAzs.mjs +0 -2
- package/dist/chunks/hi-BdtVhAzs.mjs.map +0 -1
- package/dist/chunks/hi-BmkfaZpg.mjs +0 -2
- package/dist/chunks/hi-BmkfaZpg.mjs.map +0 -1
- package/dist/chunks/hi-C-l_R2SO.mjs +0 -2
- package/dist/chunks/hi-C-l_R2SO.mjs.map +0 -1
- package/dist/chunks/hi-C1LhM-oY.mjs +0 -2
- package/dist/chunks/hi-C1LhM-oY.mjs.map +0 -1
- package/dist/chunks/hi-CGEbGI1l.mjs +0 -2
- package/dist/chunks/hi-CGEbGI1l.mjs.map +0 -1
- package/dist/chunks/hi-CPuhj7IA.mjs +0 -2
- package/dist/chunks/hi-CPuhj7IA.mjs.map +0 -1
- package/dist/chunks/hi-CT5WERqi.mjs +0 -2
- package/dist/chunks/hi-CT5WERqi.mjs.map +0 -1
- package/dist/chunks/hi-CbLPPQ0b.mjs +0 -2
- package/dist/chunks/hi-CbLPPQ0b.mjs.map +0 -1
- package/dist/chunks/hi-ClvEtEKe.mjs +0 -2
- package/dist/chunks/hi-ClvEtEKe.mjs.map +0 -1
- package/dist/chunks/hi-CpBWHmYH.mjs +0 -2
- package/dist/chunks/hi-CpBWHmYH.mjs.map +0 -1
- package/dist/chunks/hi-DAfl8nU_.mjs +0 -2
- package/dist/chunks/hi-DAfl8nU_.mjs.map +0 -1
- package/dist/chunks/hi-DVof3w0y.mjs +0 -2
- package/dist/chunks/hi-DVof3w0y.mjs.map +0 -1
- package/dist/chunks/hi-DtlvSQkD.mjs +0 -2
- package/dist/chunks/hi-DtlvSQkD.mjs.map +0 -1
- package/dist/chunks/hi-FH3CAJuR.mjs +0 -2
- package/dist/chunks/hi-FH3CAJuR.mjs.map +0 -1
- package/dist/chunks/hi-Ga9h9a_1.mjs +0 -2
- package/dist/chunks/hi-Ga9h9a_1.mjs.map +0 -1
- package/dist/chunks/hi-Zc17M1T-.mjs +0 -2
- package/dist/chunks/hi-Zc17M1T-.mjs.map +0 -1
- package/dist/chunks/hi-g7i0bmig.mjs +0 -2
- package/dist/chunks/hi-g7i0bmig.mjs.map +0 -1
- package/dist/chunks/hi-js2P6byR.mjs +0 -2
- package/dist/chunks/hi-js2P6byR.mjs.map +0 -1
- package/dist/chunks/hi-ntUsOspQ.mjs +0 -2
- package/dist/chunks/hi-ntUsOspQ.mjs.map +0 -1
- package/dist/chunks/hi-yxAcR3w6.mjs +0 -2
- package/dist/chunks/hi-yxAcR3w6.mjs.map +0 -1
- package/dist/chunks/index-C-L4awHz.mjs +0 -2
- package/dist/chunks/index-C-L4awHz.mjs.map +0 -1
- package/dist/chunks/index-Cs9iqxhF.mjs +0 -2
- package/dist/chunks/index-Cs9iqxhF.mjs.map +0 -1
- package/dist/chunks/pt--IiroJQw.mjs +0 -2
- package/dist/chunks/pt--IiroJQw.mjs.map +0 -1
- package/dist/chunks/pt-BF72W8M5.mjs +0 -2
- package/dist/chunks/pt-BF72W8M5.mjs.map +0 -1
- package/dist/chunks/pt-BX_t4luI.mjs +0 -2
- package/dist/chunks/pt-BX_t4luI.mjs.map +0 -1
- package/dist/chunks/pt-B_XJ2s9X.mjs +0 -2
- package/dist/chunks/pt-B_XJ2s9X.mjs.map +0 -1
- package/dist/chunks/pt-C-Vp7Rxj.mjs +0 -2
- package/dist/chunks/pt-C-Vp7Rxj.mjs.map +0 -1
- package/dist/chunks/pt-CD2aCZXf.mjs +0 -2
- package/dist/chunks/pt-CD2aCZXf.mjs.map +0 -1
- package/dist/chunks/pt-CFjzqIbS.mjs +0 -2
- package/dist/chunks/pt-CFjzqIbS.mjs.map +0 -1
- package/dist/chunks/pt-CHjmBegF.mjs +0 -2
- package/dist/chunks/pt-CHjmBegF.mjs.map +0 -1
- package/dist/chunks/pt-CQRzEocL.mjs +0 -2
- package/dist/chunks/pt-CQRzEocL.mjs.map +0 -1
- package/dist/chunks/pt-Cem2WxUk.mjs +0 -2
- package/dist/chunks/pt-Cem2WxUk.mjs.map +0 -1
- package/dist/chunks/pt-D6kdF3fH.mjs +0 -2
- package/dist/chunks/pt-D6kdF3fH.mjs.map +0 -1
- package/dist/chunks/pt-DJfJVeY8.mjs +0 -2
- package/dist/chunks/pt-DJfJVeY8.mjs.map +0 -1
- package/dist/chunks/pt-DfB-IaYi.mjs +0 -2
- package/dist/chunks/pt-DfB-IaYi.mjs.map +0 -1
- package/dist/chunks/pt-DlNdH9pu.mjs +0 -2
- package/dist/chunks/pt-DlNdH9pu.mjs.map +0 -1
- package/dist/chunks/pt-DrJ0-8Yo.mjs +0 -2
- package/dist/chunks/pt-DrJ0-8Yo.mjs.map +0 -1
- package/dist/chunks/pt-DsBJpgpe.mjs +0 -2
- package/dist/chunks/pt-DsBJpgpe.mjs.map +0 -1
- package/dist/chunks/pt-DwdSYJzC.mjs +0 -2
- package/dist/chunks/pt-DwdSYJzC.mjs.map +0 -1
- package/dist/chunks/pt-Dx9UkZ3j.mjs +0 -2
- package/dist/chunks/pt-Dx9UkZ3j.mjs.map +0 -1
- package/dist/chunks/pt-K0BUlM9X.mjs +0 -2
- package/dist/chunks/pt-K0BUlM9X.mjs.map +0 -1
- package/dist/chunks/pt-TuA3_GDM.mjs +0 -2
- package/dist/chunks/pt-TuA3_GDM.mjs.map +0 -1
- package/dist/chunks/pt-cN6r-f7f.mjs +0 -2
- package/dist/chunks/pt-cN6r-f7f.mjs.map +0 -1
- package/dist/chunks/pt-uNGpVM3D.mjs +0 -2
- package/dist/chunks/pt-uNGpVM3D.mjs.map +0 -1
- package/dist/chunks/pt-v1E9u-Jx.mjs +0 -2
- package/dist/chunks/pt-v1E9u-Jx.mjs.map +0 -1
- package/dist/chunks/ru-0h51zrqE.mjs +0 -2
- package/dist/chunks/ru-0h51zrqE.mjs.map +0 -1
- package/dist/chunks/ru-4S8w6UN_.mjs +0 -2
- package/dist/chunks/ru-4S8w6UN_.mjs.map +0 -1
- package/dist/chunks/ru-B0cRw90L.mjs +0 -2
- package/dist/chunks/ru-B0cRw90L.mjs.map +0 -1
- package/dist/chunks/ru-B3O7WXNM.mjs +0 -2
- package/dist/chunks/ru-B3O7WXNM.mjs.map +0 -1
- package/dist/chunks/ru-B6zVAzvI.mjs +0 -2
- package/dist/chunks/ru-B6zVAzvI.mjs.map +0 -1
- package/dist/chunks/ru-B8teJin_.mjs +0 -2
- package/dist/chunks/ru-B8teJin_.mjs.map +0 -1
- package/dist/chunks/ru-BCriPw-8.mjs +0 -2
- package/dist/chunks/ru-BCriPw-8.mjs.map +0 -1
- package/dist/chunks/ru-BNOU16E5.mjs +0 -2
- package/dist/chunks/ru-BNOU16E5.mjs.map +0 -1
- package/dist/chunks/ru-BO6BIS5W.mjs +0 -2
- package/dist/chunks/ru-BO6BIS5W.mjs.map +0 -1
- package/dist/chunks/ru-Bdy1lLuc.mjs +0 -2
- package/dist/chunks/ru-Bdy1lLuc.mjs.map +0 -1
- package/dist/chunks/ru-BgBctNVm.mjs +0 -2
- package/dist/chunks/ru-BgBctNVm.mjs.map +0 -1
- package/dist/chunks/ru-CNLx7T3O.mjs +0 -2
- package/dist/chunks/ru-CNLx7T3O.mjs.map +0 -1
- package/dist/chunks/ru-CVSCT776.mjs +0 -2
- package/dist/chunks/ru-CVSCT776.mjs.map +0 -1
- package/dist/chunks/ru-CZvkdGnf.mjs +0 -2
- package/dist/chunks/ru-CZvkdGnf.mjs.map +0 -1
- package/dist/chunks/ru-CegMPuML.mjs +0 -2
- package/dist/chunks/ru-CegMPuML.mjs.map +0 -1
- package/dist/chunks/ru-CiLrD2Nz.mjs +0 -2
- package/dist/chunks/ru-CiLrD2Nz.mjs.map +0 -1
- package/dist/chunks/ru-ClEM6OKY.mjs +0 -2
- package/dist/chunks/ru-ClEM6OKY.mjs.map +0 -1
- package/dist/chunks/ru-CrbxCeQf.mjs +0 -2
- package/dist/chunks/ru-CrbxCeQf.mjs.map +0 -1
- package/dist/chunks/ru-D3j2x2xu.mjs +0 -2
- package/dist/chunks/ru-D3j2x2xu.mjs.map +0 -1
- package/dist/chunks/ru-DdHqb4Mh.mjs +0 -2
- package/dist/chunks/ru-DdHqb4Mh.mjs.map +0 -1
- package/dist/chunks/ru-DjgNdOdJ.mjs +0 -2
- package/dist/chunks/ru-DjgNdOdJ.mjs.map +0 -1
- package/dist/chunks/ru-Tzd5N37W.mjs +0 -2
- package/dist/chunks/ru-Tzd5N37W.mjs.map +0 -1
- package/dist/chunks/ru-XKNCzkR2.mjs +0 -2
- package/dist/chunks/ru-XKNCzkR2.mjs.map +0 -1
- package/dist/chunks/zh--oNSMazK.mjs +0 -2
- package/dist/chunks/zh--oNSMazK.mjs.map +0 -1
- package/dist/chunks/zh-BfeWdPIz.mjs +0 -2
- package/dist/chunks/zh-BfeWdPIz.mjs.map +0 -1
- package/dist/chunks/zh-BnOxGKxF.mjs +0 -2
- package/dist/chunks/zh-BnOxGKxF.mjs.map +0 -1
- package/dist/chunks/zh-BqMtE-jN.mjs +0 -2
- package/dist/chunks/zh-BqMtE-jN.mjs.map +0 -1
- package/dist/chunks/zh-C3aI7A2o.mjs +0 -2
- package/dist/chunks/zh-C3aI7A2o.mjs.map +0 -1
- package/dist/chunks/zh-C6YALJZt.mjs +0 -2
- package/dist/chunks/zh-C6YALJZt.mjs.map +0 -1
- package/dist/chunks/zh-CWdTbUOP.mjs +0 -2
- package/dist/chunks/zh-CWdTbUOP.mjs.map +0 -1
- package/dist/chunks/zh-CY01pMD4.mjs +0 -2
- package/dist/chunks/zh-CY01pMD4.mjs.map +0 -1
- package/dist/chunks/zh-Cmt7n9FY.mjs +0 -2
- package/dist/chunks/zh-Cmt7n9FY.mjs.map +0 -1
- package/dist/chunks/zh-CpP2kee3.mjs +0 -2
- package/dist/chunks/zh-CpP2kee3.mjs.map +0 -1
- package/dist/chunks/zh-Cpbg4evx.mjs +0 -2
- package/dist/chunks/zh-Cpbg4evx.mjs.map +0 -1
- package/dist/chunks/zh-Cqb55JWa.mjs +0 -2
- package/dist/chunks/zh-Cqb55JWa.mjs.map +0 -1
- package/dist/chunks/zh-DCQZ6gss.mjs +0 -2
- package/dist/chunks/zh-DCQZ6gss.mjs.map +0 -1
- package/dist/chunks/zh-DG2CNTUU.mjs +0 -2
- package/dist/chunks/zh-DG2CNTUU.mjs.map +0 -1
- package/dist/chunks/zh-DTiTJbzz.mjs +0 -2
- package/dist/chunks/zh-DTiTJbzz.mjs.map +0 -1
- package/dist/chunks/zh-Da1z6qbB.mjs +0 -2
- package/dist/chunks/zh-Da1z6qbB.mjs.map +0 -1
- package/dist/chunks/zh-Di3WqY4_.mjs +0 -2
- package/dist/chunks/zh-Di3WqY4_.mjs.map +0 -1
- package/dist/chunks/zh-DlBt06Pr.mjs +0 -2
- package/dist/chunks/zh-DlBt06Pr.mjs.map +0 -1
- package/dist/chunks/zh-Dt-wVrNr.mjs +0 -2
- package/dist/chunks/zh-Dt-wVrNr.mjs.map +0 -1
- package/dist/chunks/zh-ND6vW2M-.mjs +0 -2
- package/dist/chunks/zh-ND6vW2M-.mjs.map +0 -1
- package/dist/chunks/zh-Yd3GNsa0.mjs +0 -2
- package/dist/chunks/zh-Yd3GNsa0.mjs.map +0 -1
- package/dist/chunks/zh-lhynyH6Q.mjs +0 -2
- package/dist/chunks/zh-lhynyH6Q.mjs.map +0 -1
- package/dist/chunks/zh-v9NmlEIN.mjs +0 -2
- package/dist/chunks/zh-v9NmlEIN.mjs.map +0 -1
- package/dist/fonts.mjs.map +0 -1
- package/dist/full.mjs.map +0 -1
- package/dist/html.mjs.map +0 -1
- package/dist/notectl-core.mjs.map +0 -1
- package/dist/plugins/alignment.mjs.map +0 -1
- package/dist/plugins/blockquote.mjs.map +0 -1
- package/dist/plugins/caret-navigation.mjs.map +0 -1
- package/dist/plugins/code-block.mjs.map +0 -1
- package/dist/plugins/font-size.mjs.map +0 -1
- package/dist/plugins/font.mjs.map +0 -1
- package/dist/plugins/gap-cursor.mjs.map +0 -1
- package/dist/plugins/hard-break.mjs.map +0 -1
- package/dist/plugins/heading.mjs.map +0 -1
- package/dist/plugins/highlight.mjs.map +0 -1
- package/dist/plugins/horizontal-rule.mjs.map +0 -1
- package/dist/plugins/image.mjs.map +0 -1
- package/dist/plugins/link.mjs.map +0 -1
- package/dist/plugins/list.mjs.map +0 -1
- package/dist/plugins/print.mjs.map +0 -1
- package/dist/plugins/shared.mjs.map +0 -1
- package/dist/plugins/smart-paste.mjs.map +0 -1
- package/dist/plugins/strikethrough.mjs.map +0 -1
- package/dist/plugins/super-sub.mjs.map +0 -1
- package/dist/plugins/table.mjs.map +0 -1
- package/dist/plugins/text-color.mjs.map +0 -1
- package/dist/plugins/text-direction-advanced.mjs.map +0 -1
- package/dist/plugins/text-direction.mjs.map +0 -1
- package/dist/plugins/text-formatting.mjs.map +0 -1
- package/dist/plugins/toolbar.mjs.map +0 -1
- package/dist/presets/full.mjs.map +0 -1
- package/dist/presets/minimal.mjs.map +0 -1
- package/dist/presets.mjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColorGrid-taTKtdsm.mjs","names":[],"sources":["../../src/plugins/shared/ColorNames.ts","../../src/plugins/shared/ColorGrid.ts"],"sourcesContent":["/**\n * Human-readable color name lookup for accessibility.\n *\n * Provides descriptive names for color swatches so screen readers\n * announce \"Red\" instead of \"#ff0000\". Covers all default palette\n * colors with a fallback algorithm for custom hex values.\n */\n\n// ---------------------------------------------------------------------------\n// Static name map — covers every default palette color\n// ---------------------------------------------------------------------------\n\nconst COLOR_NAME_MAP: ReadonlyMap<string, string> = new Map([\n\t// ── TextColor palette (70 colors) ──────────────────────────────────────\n\n\t// Row 1 — Grays\n\t['#000000', 'Black'],\n\t['#434343', 'Dark Gray 4'],\n\t['#666666', 'Dark Gray 3'],\n\t['#999999', 'Dark Gray 2'],\n\t['#b7b7b7', 'Dark Gray 1'],\n\t['#cccccc', 'Light Gray 3'],\n\t['#d9d9d9', 'Light Gray 2'],\n\t['#efefef', 'Light Gray 1'],\n\t['#f3f3f3', 'Near White'],\n\t['#ffffff', 'White'],\n\n\t// Row 2 — Vivid\n\t['#980000', 'Dark Red Berry'],\n\t['#ff0000', 'Red'],\n\t['#ff9900', 'Orange'],\n\t['#ffff00', 'Yellow'],\n\t['#00ff00', 'Green'],\n\t['#00ffff', 'Cyan'],\n\t['#4a86e8', 'Cornflower Blue'],\n\t['#0000ff', 'Blue'],\n\t['#9900ff', 'Purple'],\n\t['#ff00ff', 'Magenta'],\n\n\t// Row 3 — Light 3 (lightest tint)\n\t['#e6b8af', 'Light Red Berry 3'],\n\t['#f4cccc', 'Light Red 3'],\n\t['#fce5cd', 'Light Orange 3'],\n\t['#fff2cc', 'Light Yellow 3'],\n\t['#d9ead3', 'Light Green 3'],\n\t['#d0e0e3', 'Light Cyan 3'],\n\t['#c9daf8', 'Light Cornflower Blue 3'],\n\t['#cfe2f3', 'Light Blue 3'],\n\t['#d9d2e9', 'Light Purple 3'],\n\t['#ead1dc', 'Light Magenta 3'],\n\n\t// Row 4 — Light 2\n\t['#dd7e6b', 'Light Red Berry 2'],\n\t['#ea9999', 'Light Red 2'],\n\t['#f9cb9c', 'Light Orange 2'],\n\t['#ffe599', 'Light Yellow 2'],\n\t['#b6d7a8', 'Light Green 2'],\n\t['#a2c4c9', 'Light Cyan 2'],\n\t['#a4c2f4', 'Light Cornflower Blue 2'],\n\t['#9fc5e8', 'Light Blue 2'],\n\t['#b4a7d6', 'Light Purple 2'],\n\t['#d5a6bd', 'Light Magenta 2'],\n\n\t// Row 5 — Light 1\n\t['#cc4125', 'Light Red Berry 1'],\n\t['#e06666', 'Light Red 1'],\n\t['#f6b26b', 'Light Orange 1'],\n\t['#ffd966', 'Light Yellow 1'],\n\t['#93c47d', 'Light Green 1'],\n\t['#76a5af', 'Light Cyan 1'],\n\t['#6d9eeb', 'Light Cornflower Blue 1'],\n\t['#6fa8dc', 'Light Blue 1'],\n\t['#8e7cc3', 'Light Purple 1'],\n\t['#c27ba0', 'Light Magenta 1'],\n\n\t// Row 6 — Dark 1\n\t['#a61c00', 'Dark Red Berry 1'],\n\t['#cc0000', 'Dark Red 1'],\n\t['#e69138', 'Dark Orange 1'],\n\t['#f1c232', 'Dark Yellow 1'],\n\t['#6aa84f', 'Dark Green 1'],\n\t['#45818e', 'Dark Cyan 1'],\n\t['#3c78d8', 'Dark Cornflower Blue 1'],\n\t['#3d85c6', 'Dark Blue 1'],\n\t['#674ea7', 'Dark Purple 1'],\n\t['#a64d79', 'Dark Magenta 1'],\n\n\t// Row 7 — Dark 2\n\t['#85200c', 'Dark Red Berry 2'],\n\t['#990000', 'Dark Red 2'],\n\t['#b45f06', 'Dark Orange 2'],\n\t['#bf9000', 'Dark Yellow 2'],\n\t['#38761d', 'Dark Green 2'],\n\t['#134f5c', 'Dark Cyan 2'],\n\t['#1155cc', 'Dark Cornflower Blue 2'],\n\t['#0b5394', 'Dark Blue 2'],\n\t['#351c75', 'Dark Purple 2'],\n\t['#741b47', 'Dark Magenta 2'],\n\n\t// ── Highlight palette (50 colors, minus duplicates) ────────────────────\n\n\t// Row 1 — Classic highlighter (bright, vivid)\n\t['#fff176', 'Bright Yellow'],\n\t['#aed581', 'Light Green'],\n\t['#4dd0e1', 'Bright Cyan'],\n\t['#64b5f6', 'Sky Blue'],\n\t['#ce93d8', 'Lavender'],\n\t['#f48fb1', 'Pink'],\n\t['#ffab91', 'Peach'],\n\t['#ff8a65', 'Coral'],\n\t['#e6ee9c', 'Lime'],\n\t['#80cbc4', 'Teal'],\n\n\t// Row 2 — Light pastels\n\t['#fff9c4', 'Pale Yellow'],\n\t['#dcedc8', 'Pale Green'],\n\t['#e0f7fa', 'Pale Cyan'],\n\t['#e3f2fd', 'Pale Blue'],\n\t['#f3e5f5', 'Pale Purple'],\n\t['#fce4ec', 'Pale Pink'],\n\t['#fff3e0', 'Pale Orange'],\n\t['#fbe9e7', 'Pale Red'],\n\t['#f9fbe7', 'Pale Lime'],\n\t['#e0f2f1', 'Pale Teal'],\n\n\t// Row 3 — Medium pastels\n\t['#fff59d', 'Soft Yellow'],\n\t['#c5e1a5', 'Soft Green'],\n\t['#80deea', 'Soft Cyan'],\n\t['#90caf9', 'Soft Blue'],\n\t['#e1bee7', 'Soft Purple'],\n\t['#f8bbd0', 'Soft Pink'],\n\t['#ffcc80', 'Soft Orange'],\n\t// #ffab91 duplicate → Peach (already mapped)\n\t// #e6ee9c duplicate → Lime (already mapped)\n\t['#a5d6a7', 'Mint'],\n\n\t// Row 4 — Bold pastels\n\t['#ffee58', 'Vivid Yellow'],\n\t['#9ccc65', 'Vivid Green'],\n\t['#26c6da', 'Vivid Cyan'],\n\t['#42a5f5', 'Vivid Blue'],\n\t['#ab47bc', 'Vivid Purple'],\n\t['#ec407a', 'Vivid Pink'],\n\t['#ffa726', 'Vivid Orange'],\n\t['#ff7043', 'Red Orange'],\n\t['#d4e157', 'Vivid Lime'],\n\t['#66bb6a', 'Emerald'],\n\n\t// Row 5 — Grays and neutral highlights\n\t// #ffffff duplicate → White (already mapped)\n\t['#fafafa', 'Almost White'],\n\t['#f5f5f5', 'Lightest Gray'],\n\t['#eeeeee', 'Very Light Gray'],\n\t['#e0e0e0', 'Silver'],\n\t['#bdbdbd', 'Medium Gray'],\n\t['#e8eaf6', 'Lavender Gray'],\n\t['#efebe9', 'Warm Gray'],\n\t['#eceff1', 'Cool Gray'],\n\t// #fafafa duplicate → Almost White (already mapped)\n]);\n\n// ---------------------------------------------------------------------------\n// Public API\n// ---------------------------------------------------------------------------\n\n/**\n * Returns a human-readable name for a hex color.\n *\n * Checks the static map first, then falls back to a computed\n * description based on hue, saturation, and lightness.\n */\nexport function getColorName(hex: string): string {\n\tconst name: string | undefined = COLOR_NAME_MAP.get(hex.toLowerCase());\n\tif (name) return name;\n\treturn describeColor(hex);\n}\n\n/**\n * Determines whether a color is light enough to need a visible\n * border when rendered on a white background (WCAG 1.4.11).\n *\n * Uses a contrast-ratio threshold of 3:1 against white.\n */\nexport function isLightColor(hex: string): boolean {\n\tconst luminance: number = relativeLuminance(hex);\n\t// Contrast ratio against white: (1.05) / (L + 0.05) < 3\n\t// ⟹ L > 1.05/3 − 0.05 = 0.3\n\tconst LIGHT_THRESHOLD = 0.3;\n\treturn luminance > LIGHT_THRESHOLD;\n}\n\n// ---------------------------------------------------------------------------\n// Internal helpers\n// ---------------------------------------------------------------------------\n\n/** Expands `#RGB` to `#RRGGBB` and lowercases. */\nfunction normalizeHex(hex: string): string {\n\tconst h: string = hex.toLowerCase();\n\tif (h.length === 4) {\n\t\treturn `#${h[1]}${h[1]}${h[2]}${h[2]}${h[3]}${h[3]}`;\n\t}\n\treturn h;\n}\n\n/** Applies sRGB linearization to a single channel value (0–1). */\nfunction linearize(channel: number): number {\n\treturn channel <= 0.03928 ? channel / 12.92 : ((channel + 0.055) / 1.055) ** 2.4;\n}\n\n/** Computes WCAG relative luminance from a hex color. */\nfunction relativeLuminance(hex: string): number {\n\tconst normalized: string = normalizeHex(hex);\n\tconst r: number = linearize(Number.parseInt(normalized.slice(1, 3), 16) / 255);\n\tconst g: number = linearize(Number.parseInt(normalized.slice(3, 5), 16) / 255);\n\tconst b: number = linearize(Number.parseInt(normalized.slice(5, 7), 16) / 255);\n\treturn 0.2126 * r + 0.7152 * g + 0.0722 * b;\n}\n\n/** Hue boundary table: upper bound (degrees) → name. */\nconst HUE_NAMES: readonly (readonly [number, string])[] = [\n\t[15, 'Red'],\n\t[45, 'Orange'],\n\t[65, 'Yellow'],\n\t[150, 'Green'],\n\t[190, 'Cyan'],\n\t[250, 'Blue'],\n\t[290, 'Purple'],\n\t[330, 'Pink'],\n\t[361, 'Red'],\n];\n\n/**\n * Generates a descriptive name from a hex color using HSL analysis.\n * Produces names like \"Dark Blue\", \"Light Green\", or \"Gray\".\n */\nfunction describeColor(hex: string): string {\n\tconst normalized: string = normalizeHex(hex);\n\tconst rRaw: number = Number.parseInt(normalized.slice(1, 3), 16) / 255;\n\tconst gRaw: number = Number.parseInt(normalized.slice(3, 5), 16) / 255;\n\tconst bRaw: number = Number.parseInt(normalized.slice(5, 7), 16) / 255;\n\n\tconst max: number = Math.max(rRaw, gRaw, bRaw);\n\tconst min: number = Math.min(rRaw, gRaw, bRaw);\n\tconst lightness: number = (max + min) / 2;\n\tconst delta: number = max - min;\n\n\t// Achromatic\n\tif (delta < 0.05) {\n\t\tif (lightness < 0.15) return 'Black';\n\t\tif (lightness < 0.35) return 'Dark Gray';\n\t\tif (lightness < 0.65) return 'Gray';\n\t\tif (lightness < 0.85) return 'Light Gray';\n\t\treturn 'Near White';\n\t}\n\n\t// Compute hue in degrees\n\tlet hue = 0;\n\tif (max === rRaw) {\n\t\thue = ((gRaw - bRaw) / delta + (gRaw < bRaw ? 6 : 0)) * 60;\n\t} else if (max === gRaw) {\n\t\thue = ((bRaw - rRaw) / delta + 2) * 60;\n\t} else {\n\t\thue = ((rRaw - gRaw) / delta + 4) * 60;\n\t}\n\n\t// Look up hue name\n\tlet hueName = 'Red';\n\tfor (const [threshold, name] of HUE_NAMES) {\n\t\tif (hue < threshold) {\n\t\t\thueName = name;\n\t\t\tbreak;\n\t\t}\n\t}\n\n\t// Lightness modifier\n\tif (lightness < 0.25) return `Very Dark ${hueName}`;\n\tif (lightness < 0.4) return `Dark ${hueName}`;\n\tif (lightness > 0.8) return `Very Light ${hueName}`;\n\tif (lightness > 0.65) return `Light ${hueName}`;\n\treturn hueName;\n}\n","/**\n * Shared color grid rendering with WAI-ARIA grid pattern and keyboard\n * navigation. Used by ColorPickerPopup (text-color, highlight) and\n * TableBorderColor.\n */\n\nimport { isRtlContext } from '../../platform/Platform.js';\nimport { setStyleProperties, setStyleProperty } from '../../style/StyleRuntime.js';\nimport { getColorName, isLightColor } from './ColorNames.js';\nimport { applyRovingTabindex, navigateGrid } from './KeyboardNav.js';\n\n// --- Types ---\n\nexport interface ColorGridConfig {\n\treadonly colors: readonly string[];\n\treadonly columns: number;\n\treadonly ariaLabel: string;\n\treadonly ariaLabelPrefix: string;\n\treadonly activeColor: string | null;\n\treadonly onSelect: (color: string) => void;\n\treadonly onClose: () => void;\n\t/** Optional custom label formatter for swatch aria-labels. Defaults to `${prefix} ${colorName}`. */\n\treadonly swatchLabel?: (colorName: string) => string;\n\t/** When true, swatch title shows human-readable color name instead of hex. */\n\treadonly titleAsName?: boolean;\n}\n\n// --- Constants ---\n\nconst GRID_NAV_KEYS: ReadonlySet<string> = new Set([\n\t'ArrowUp',\n\t'ArrowDown',\n\t'ArrowLeft',\n\t'ArrowRight',\n]);\nconst LIGHT_COLOR_BORDER = '1px solid #d0d0d0';\n\n// --- Rendering ---\n\n/**\n * Renders an accessible color grid into the given container.\n * Creates a `role=\"grid\"` with rows of `role=\"gridcell\"` swatch buttons.\n * Provides arrow key, Home/End, Enter/Space, and Escape keyboard navigation.\n */\nexport function renderColorGrid(container: HTMLElement, config: ColorGridConfig): void {\n\tconst columns: number = config.columns;\n\tconst totalSwatches: number = config.colors.length;\n\tconst totalRows: number = Math.ceil(totalSwatches / columns);\n\n\tconst grid: HTMLDivElement = document.createElement('div');\n\tgrid.className = 'notectl-color-picker__grid';\n\tgrid.setAttribute('role', 'grid');\n\tgrid.setAttribute('aria-label', config.ariaLabel);\n\n\tconst swatches: HTMLButtonElement[] = [];\n\tlet focusedIndex = 0;\n\n\tfor (let rowIdx = 0; rowIdx < totalRows; rowIdx++) {\n\t\tconst row: HTMLDivElement = document.createElement('div');\n\t\trow.setAttribute('role', 'row');\n\n\t\tfor (let colIdx = 0; colIdx < columns; colIdx++) {\n\t\t\tconst swatchIdx: number = rowIdx * columns + colIdx;\n\t\t\tif (swatchIdx >= totalSwatches) break;\n\n\t\t\tconst color: string = config.colors[swatchIdx] as string;\n\t\t\tconst colorName: string = getColorName(color);\n\t\t\tconst isActive: boolean =\n\t\t\t\t!!config.activeColor && config.activeColor.toLowerCase() === color.toLowerCase();\n\n\t\t\tconst swatch: HTMLButtonElement = document.createElement('button');\n\t\t\tswatch.type = 'button';\n\t\t\tswatch.className = 'notectl-color-picker__swatch';\n\t\t\tswatch.setAttribute('role', 'gridcell');\n\t\t\tconst label: string = config.swatchLabel\n\t\t\t\t? config.swatchLabel(colorName)\n\t\t\t\t: `${config.ariaLabelPrefix} ${colorName}`;\n\t\t\tswatch.setAttribute('aria-label', label);\n\t\t\tswatch.setAttribute('aria-selected', String(isActive));\n\t\t\tswatch.dataset.index = String(swatchIdx);\n\t\t\tsetStyleProperty(swatch, 'backgroundColor', color);\n\t\t\tswatch.title = config.titleAsName ? colorName : color;\n\n\t\t\tif (isLightColor(color)) {\n\t\t\t\tsetStyleProperties(swatch, {\n\t\t\t\t\tborder: LIGHT_COLOR_BORDER,\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tif (isActive) {\n\t\t\t\tswatch.classList.add('notectl-color-picker__swatch--active');\n\t\t\t\tfocusedIndex = swatchIdx;\n\t\t\t}\n\n\t\t\tswatch.addEventListener('mousedown', (e: MouseEvent) => {\n\t\t\t\te.preventDefault();\n\t\t\t\te.stopPropagation();\n\t\t\t\tconfig.onSelect(color);\n\t\t\t});\n\n\t\t\tswatches.push(swatch);\n\t\t\trow.appendChild(swatch);\n\t\t}\n\n\t\tgrid.appendChild(row);\n\t}\n\n\tapplyRovingTabindex(swatches as readonly HTMLButtonElement[], focusedIndex);\n\n\tgrid.addEventListener('keydown', (e: KeyboardEvent) => {\n\t\tif (e.key === 'Escape') {\n\t\t\te.preventDefault();\n\t\t\te.stopPropagation();\n\t\t\tconfig.onClose();\n\t\t\treturn;\n\t\t}\n\n\t\tif (e.key === 'Enter' || e.key === ' ') {\n\t\t\te.preventDefault();\n\t\t\te.stopPropagation();\n\t\t\tconst target = e.target as HTMLElement;\n\t\t\tconst idx: string | undefined = target.dataset.index;\n\t\t\tif (idx !== undefined) {\n\t\t\t\tconst color: string | undefined = config.colors[Number(idx)];\n\t\t\t\tif (color) {\n\t\t\t\t\tconfig.onSelect(color);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tif (GRID_NAV_KEYS.has(e.key)) {\n\t\t\te.preventDefault();\n\t\t\te.stopPropagation();\n\t\t\tconst currentRow: number = Math.floor(focusedIndex / columns) + 1;\n\t\t\tconst currentCol: number = (focusedIndex % columns) + 1;\n\n\t\t\tconst rtl: boolean = isRtlContext(container);\n\t\t\tconst [newRow, newCol] = navigateGrid(\n\t\t\t\tcurrentRow,\n\t\t\t\tcurrentCol,\n\t\t\t\ttotalRows,\n\t\t\t\tcolumns,\n\t\t\t\te.key as 'ArrowUp' | 'ArrowDown' | 'ArrowLeft' | 'ArrowRight',\n\t\t\t\trtl,\n\t\t\t);\n\n\t\t\tlet newIdx: number = (newRow - 1) * columns + (newCol - 1);\n\t\t\tif (newIdx >= totalSwatches) {\n\t\t\t\tnewIdx = totalSwatches - 1;\n\t\t\t}\n\n\t\t\tfocusedIndex = newIdx;\n\t\t\tapplyRovingTabindex(swatches as readonly HTMLButtonElement[], focusedIndex);\n\t\t\tswatches[focusedIndex]?.focus();\n\t\t\treturn;\n\t\t}\n\n\t\tif (e.key === 'Home' || e.key === 'End') {\n\t\t\te.preventDefault();\n\t\t\te.stopPropagation();\n\t\t\tconst currentRow: number = Math.floor(focusedIndex / columns);\n\t\t\tconst rowStart: number = currentRow * columns;\n\t\t\tconst rowEnd: number = Math.min(rowStart + columns - 1, totalSwatches - 1);\n\n\t\t\tfocusedIndex = e.key === 'Home' ? rowStart : rowEnd;\n\t\t\tapplyRovingTabindex(swatches as readonly HTMLButtonElement[], focusedIndex);\n\t\t\tswatches[focusedIndex]?.focus();\n\t\t}\n\t});\n\n\tcontainer.appendChild(grid);\n}\n"],"mappings":"yJAYA,IAAM,EAA8C,IAAI,IAAI,CAI3D,CAAC,UAAW,SACZ,CAAC,UAAW,eACZ,CAAC,UAAW,eACZ,CAAC,UAAW,eACZ,CAAC,UAAW,eACZ,CAAC,UAAW,gBACZ,CAAC,UAAW,gBACZ,CAAC,UAAW,gBACZ,CAAC,UAAW,cACZ,CAA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R,EAAmB,CACtB,MAAM,EAA4B,EAAO,OAAO,OAAO,IACnD,GACH,EAAO,SAAS,GAGlB,OAGD,GAAI,EAAc,IAAI,EAAE,KAAM,CAC7B,EAAE,iBACF,EAAE,kBACF,MAAM,EAAqB,KAAK,MAAM,EAAe,GAAW,EAC1D,EAAsB,EAAe,EAAW,EAEhD,EAAe,EAAa,IAC3B,EAAQ,GAAU,EACxB,EACA,EACA,EACA,EACA,EAAE,IACF,GAGD,IAAI,GAAkB,EAAS,GAAK,GAAW,EAAS,GAQxD,OAPI,GAAU,IACb,EAAS,EAAgB,GAG1B,EAAe,EACf,EAAoB,EAA0C,QAC9D,EAAS,IAAe,QAIzB,GAAc,SAAV,EAAE,KAA4B,QAAV,EAAE,IAAe,CACxC,EAAE,iBACF,EAAE,kBAEF,MAAM,EADqB,KAAK,MAAM,EAAe,GACf,EAChC,EAAiB,KAAK,IAAI,EAAW,EAAU,EAAG,EAAgB,GAExE,EAAyB,SAAV,EAAE,IAAiB,EAAW,EAC7C,EAAoB,EAA0C,GAC9D,EAAS,IAAe,WAI1B,EAAU,YAAY"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{i as e}from"./TypeBrands-BQR8dEYU.mjs";import{i as t,n as o,t as r}from"./AttributedMarkCommands-Cmet1IuC.mjs";import{t as a}from"./ColorValidation-3viVw_tK.mjs";import{t as n}from"./ColorGrid-taTKtdsm.mjs";function s(e,t){return o(e,t,e=>e.attrs.color??null)}function l(e,t){return null!==s(e,t)}function i(t,o,n,s){if(!a(s))return!1;const l=r(o,{type:e(n),attrs:{color:s}});return!!l&&(t.dispatch(l),!0)}function c(o,r,a){const n=t(r,e(a));return!!n&&(o.dispatch(n),!0)}function m(e,t,o){e.classList.add("notectl-color-picker");const r=s(t.getState(),o.markType),a=o.columns||10,l=t.getContainer(),c=document.createElement("button");c.type="button",c.className="notectl-color-picker__default",c.textContent=o.resetLabel,c.addEventListener("mousedown",e=>{e.preventDefault(),e.stopPropagation(),t.executeCommand(o.resetCommand),o.onClose({restoreFocusTo:l})}),c.addEventListener("keydown",e=>{"Escape"===e.key&&(e.preventDefault(),o.onClose())}),e.appendChild(c),n(e,{colors:o.colors,columns:a,ariaLabel:`${o.ariaLabelPrefix} color picker`,ariaLabelPrefix:o.ariaLabelPrefix,activeColor:r,onSelect:e=>{i(t,t.getState(),o.markType,e),o.onClose({restoreFocusTo:l})},onClose:o.onClose})}export{c as a,l as i,i as n,s as r,m as t};
|
|
2
|
+
//# sourceMappingURL=ColorPickerPopup-JJQ-gMBN.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColorPickerPopup-JJQ-gMBN.mjs","names":[],"sources":["../../src/plugins/shared/ColorMarkOperations.ts","../../src/plugins/shared/ColorPickerPopup.ts"],"sourcesContent":["/**\n * Shared color mark operations for color-based mark plugins.\n * All functions are parameterized by mark type name so they work\n * identically for TextColor, Highlight, or any future color mark.\n *\n * Delegates to the generic AttributedMarkCommands helpers for the\n * collapsed-vs-range branching logic.\n */\n\nimport {\n\tapplyAttributedMark,\n\tgetMarkAttrAtSelection,\n\tremoveAttributedMark,\n} from '../../commands/AttributedMarkCommands.js';\nimport type { MarkAttrRegistry } from '../../model/AttrRegistry.js';\nimport { markType } from '../../model/TypeBrands.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { PluginContext } from '../Plugin.js';\nimport { isValidCSSColor } from './ColorValidation.js';\n\n/** Color mark type names that have `{ color: string }` attrs. */\nexport type ColorMarkType = {\n\t[K in keyof MarkAttrRegistry]: MarkAttrRegistry[K] extends { color: string } ? K : never;\n}[keyof MarkAttrRegistry];\n\n/**\n * Returns the active color value for the given mark type at the current\n * selection, or `null` if the mark is not present.\n */\nexport function getActiveColor(state: EditorState, markTypeName: ColorMarkType): string | null {\n\treturn getMarkAttrAtSelection(state, markTypeName, (m) => m.attrs.color ?? null);\n}\n\n/** Returns `true` when the given color mark is active at the current selection. */\nexport function isColorMarkActive(state: EditorState, markTypeName: ColorMarkType): boolean {\n\treturn getActiveColor(state, markTypeName) !== null;\n}\n\n/**\n * Applies the given color to the selection. For collapsed selections,\n * sets stored marks. For range selections, removes then re-adds the mark.\n */\nexport function applyColorMark(\n\tcontext: PluginContext,\n\tstate: EditorState,\n\tmarkTypeName: ColorMarkType,\n\tcolor: string,\n): boolean {\n\tif (!isValidCSSColor(color)) return false;\n\n\tconst mark = { type: markType(markTypeName), attrs: { color } };\n\tconst tr = applyAttributedMark(state, mark);\n\tif (!tr) return false;\n\n\tcontext.dispatch(tr);\n\treturn true;\n}\n\n/**\n * Removes the given color mark from the selection.\n * Returns `false` when the mark was not present.\n */\nexport function removeColorMark(\n\tcontext: PluginContext,\n\tstate: EditorState,\n\tmarkTypeName: ColorMarkType,\n): boolean {\n\tconst tr = removeAttributedMark(state, markType(markTypeName));\n\tif (!tr) return false;\n\n\tcontext.dispatch(tr);\n\treturn true;\n}\n","/**\n * Shared color picker popup rendering with WAI-ARIA grid keyboard navigation.\n * Used by TextColorPlugin and HighlightPlugin.\n * Delegates grid rendering to the shared ColorGrid module.\n */\n\nimport type { PluginContext } from '../Plugin.js';\nimport { renderColorGrid } from './ColorGrid.js';\nimport type { ColorMarkType } from './ColorMarkOperations.js';\nimport { applyColorMark, getActiveColor } from './ColorMarkOperations.js';\nimport type { PopupCloseOptions } from './PopupManager.js';\n\n/** Configuration for `renderColorPickerPopup`. */\nexport interface ColorPickerConfig {\n\treadonly markType: ColorMarkType;\n\treadonly colors: readonly string[];\n\treadonly columns: number;\n\treadonly resetLabel: string;\n\treadonly resetCommand: string;\n\treadonly ariaLabelPrefix: string;\n\treadonly onClose: (options?: PopupCloseOptions) => void;\n}\n\nconst COLUMNS = 10;\n\n/**\n * Renders an accessible color picker popup into `container`.\n *\n * Features:\n * - WAI-ARIA `role=\"grid\"` with row/gridcell structure\n * - Arrow key navigation (wraps around, clamps on partial last row)\n * - Enter/Space selects color and closes popup\n * - Escape closes popup\n * - Roving tabindex on swatches\n */\nexport function renderColorPickerPopup(\n\tcontainer: HTMLElement,\n\tcontext: PluginContext,\n\tconfig: ColorPickerConfig,\n): void {\n\tcontainer.classList.add('notectl-color-picker');\n\n\tconst state = context.getState();\n\tconst activeColor: string | null = getActiveColor(state, config.markType);\n\tconst columns: number = config.columns || COLUMNS;\n\tconst contentElement: HTMLElement = context.getContainer();\n\n\t// --- Reset button ---\n\tconst resetBtn: HTMLButtonElement = document.createElement('button');\n\tresetBtn.type = 'button';\n\tresetBtn.className = 'notectl-color-picker__default';\n\tresetBtn.textContent = config.resetLabel;\n\tresetBtn.addEventListener('mousedown', (e: MouseEvent) => {\n\t\te.preventDefault();\n\t\te.stopPropagation();\n\t\tcontext.executeCommand(config.resetCommand);\n\t\tconfig.onClose({ restoreFocusTo: contentElement });\n\t});\n\tresetBtn.addEventListener('keydown', (e: KeyboardEvent) => {\n\t\tif (e.key === 'Escape') {\n\t\t\te.preventDefault();\n\t\t\tconfig.onClose();\n\t\t}\n\t});\n\tcontainer.appendChild(resetBtn);\n\n\t// --- Color grid (delegated to shared ColorGrid) ---\n\trenderColorGrid(container, {\n\t\tcolors: config.colors,\n\t\tcolumns,\n\t\tariaLabel: `${config.ariaLabelPrefix} color picker`,\n\t\tariaLabelPrefix: config.ariaLabelPrefix,\n\t\tactiveColor,\n\t\tonSelect: (color: string) => {\n\t\t\tapplyColorMark(context, context.getState(), config.markType, color);\n\t\t\tconfig.onClose({ restoreFocusTo: contentElement });\n\t\t},\n\t\tonClose: config.onClose,\n\t});\n}\n"],"mappings":"sNA6BA,SAAgB,EAAe,EAAoB,GAClD,OAAO,EAAuB,EAAO,EAAe,GAAM,EAAE,MAAM,OAAS,MAI5E,SAAgB,EAAkB,EAAoB,GACrD,OAA+C,OAAxC,EAAe,EAAO,GAO9B,SAAgB,EACf,EACA,EACA,EACA,GAEA,IAAK,EAAgB,GAAQ,OAAO,EAGpC,MAAM,EAAK,EAAoB,EADlB,CAAE,KAAM,EAAS,GAAe,MAAO,CAAE,WAEtD,QAAK,IAEL,EAAQ,SAAS,IACV,GAOR,SAAgB,EACf,EACA,EACA,GAEA,MAAM,EAAK,EAAqB,EAAO,EAAS,IAChD,QAAK,IAEL,EAAQ,SAAS,IACV,GCpCR,SAAgB,EACf,EACA,EACA,GAEA,EAAU,UAAU,IAAI,wBAGxB,MAAM,EAA6B,EADrB,EAAQ,WACmC,EAAO,UAC1D,EAAkB,EAAO,SArBhB,GAsBT,EAA8B,EAAQ,eAGtC,EAA8B,SAAS,cAAc,UAC3D,EAAS,KAAO,SAChB,EAAS,UAAY,gCACrB,EAAS,YAAc,EAAO,WAC9B,EAAS,iBAAiB,YAAc,IACvC,EAAE,iBACF,EAAE,kBACF,EAAQ,eAAe,EAAO,cAC9B,EAAO,QAAQ,CAAE,eAAgB,MAElC,EAAS,iBAAiB,UAAY,IACvB,WAAV,EAAE,MACL,EAAE,iBACF,EAAO,aAGT,EAAU,YAAY,GAGtB,EAAgB,EAAW,CAC1B,OAAQ,EAAO,OACf,UACA,UAAW,GAAG,EAAO,+BACrB,gBAAiB,EAAO,gBACxB,cACA,SAAW,IACV,EAAe,EAAS,EAAQ,WAAY,EAAO,SAAU,GAC7D,EAAO,QAAQ,CAAE,eAAgB,KAElC,QAAS,EAAO"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var e=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i;function r(r){return e.test(r)}var a=/^rgba?\(\s*(\d{1,3}%?\s*,\s*){2}\d{1,3}%?(\s*,\s*(0|1|0?\.\d+))?\s*\)$/,l=/^hsla?\(\s*\d{1,3}\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%(\s*,\s*(0|1|0?\.\d+))?\s*\)$/,t=new Set(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","transparent","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"]);function n(r){if(!r)return!1;const n=r.trim().toLowerCase();return!!n&&(e.test(n)||a.test(n)||l.test(n)||t.has(n))}function i(e,a,l){if(!e||0===e.length)return a;const t=e.filter(e=>!r(e));if(t.length>0)throw new Error(`${l}: invalid hex color(s): ${t.join(", ")}. Expected format: #RGB or #RRGGBB.`);const n=/* @__PURE__ */new Set,i=[];for(const r of e){const e=r.toLowerCase();n.has(e)||(n.add(e),i.push(e))}return i}var o=/[{}<>;]|url\(|expression\(/i;function s(e){if(!e)return!1;const r=e.trim();return!!r&&!o.test(r)}var d=/^\d+(\.\d+)?(px|pt|em|rem|%)$/i;function u(e){return!!e&&d.test(e.trim())}export{i as a,r as i,s as n,u as r,n as t};
|
|
2
|
+
//# sourceMappingURL=ColorValidation-3viVw_tK.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColorValidation-3viVw_tK.mjs","names":[],"sources":["../../src/plugins/shared/ColorValidation.ts"],"sourcesContent":["/**\n * Shared CSS validation and normalization utilities\n * for style-based mark plugins (TextColor, Highlight, Font, FontSize).\n */\n\nconst HEX_COLOR_PATTERN: RegExp = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i;\n\n/** Returns `true` when the value is a valid `#RGB` or `#RRGGBB` hex color. */\nexport function isValidHexColor(value: string): boolean {\n\treturn HEX_COLOR_PATTERN.test(value);\n}\n\n// --- CSS Color Validation (broad format support for paste / API input) ---\n\n/** Matches `rgb(r, g, b)` and `rgba(r, g, b, a)` with integer or percentage values. */\nconst RGB_PATTERN: RegExp =\n\t/^rgba?\\(\\s*(\\d{1,3}%?\\s*,\\s*){2}\\d{1,3}%?(\\s*,\\s*(0|1|0?\\.\\d+))?\\s*\\)$/;\n\n/** Matches `hsl(h, s%, l%)` and `hsla(h, s%, l%, a)`. */\nconst HSL_PATTERN: RegExp =\n\t/^hsla?\\(\\s*\\d{1,3}\\s*,\\s*\\d{1,3}%\\s*,\\s*\\d{1,3}%(\\s*,\\s*(0|1|0?\\.\\d+))?\\s*\\)$/;\n\n/**\n * Complete set of CSS Level 4 named colors (including `transparent`).\n * Used as an allowlist — unknown names are rejected.\n */\nconst CSS_NAMED_COLORS: ReadonlySet<string> = new Set([\n\t'aliceblue',\n\t'antiquewhite',\n\t'aqua',\n\t'aquamarine',\n\t'azure',\n\t'beige',\n\t'bisque',\n\t'black',\n\t'blanchedalmond',\n\t'blue',\n\t'blueviolet',\n\t'brown',\n\t'burlywood',\n\t'cadetblue',\n\t'chartreuse',\n\t'chocolate',\n\t'coral',\n\t'cornflowerblue',\n\t'cornsilk',\n\t'crimson',\n\t'cyan',\n\t'darkblue',\n\t'darkcyan',\n\t'darkgoldenrod',\n\t'darkgray',\n\t'darkgreen',\n\t'darkgrey',\n\t'darkkhaki',\n\t'darkmagenta',\n\t'darkolivegreen',\n\t'darkorange',\n\t'darkorchid',\n\t'darkred',\n\t'darksalmon',\n\t'darkseagreen',\n\t'darkslateblue',\n\t'darkslategray',\n\t'darkslategrey',\n\t'darkturquoise',\n\t'darkviolet',\n\t'deeppink',\n\t'deepskyblue',\n\t'dimgray',\n\t'dimgrey',\n\t'dodgerblue',\n\t'firebrick',\n\t'floralwhite',\n\t'forestgreen',\n\t'fuchsia',\n\t'gainsboro',\n\t'ghostwhite',\n\t'gold',\n\t'goldenrod',\n\t'gray',\n\t'green',\n\t'greenyellow',\n\t'grey',\n\t'honeydew',\n\t'hotpink',\n\t'indianred',\n\t'indigo',\n\t'ivory',\n\t'khaki',\n\t'lavender',\n\t'lavenderblush',\n\t'lawngreen',\n\t'lemonchiffon',\n\t'lightblue',\n\t'lightcoral',\n\t'lightcyan',\n\t'lightgoldenrodyellow',\n\t'lightgray',\n\t'lightgreen',\n\t'lightgrey',\n\t'lightpink',\n\t'lightsalmon',\n\t'lightseagreen',\n\t'lightskyblue',\n\t'lightslategray',\n\t'lightslategrey',\n\t'lightsteelblue',\n\t'lightyellow',\n\t'lime',\n\t'limegreen',\n\t'linen',\n\t'magenta',\n\t'maroon',\n\t'mediumaquamarine',\n\t'mediumblue',\n\t'mediumorchid',\n\t'mediumpurple',\n\t'mediumseagreen',\n\t'mediumslateblue',\n\t'mediumspringgreen',\n\t'mediumturquoise',\n\t'mediumvioletred',\n\t'midnightblue',\n\t'mintcream',\n\t'mistyrose',\n\t'moccasin',\n\t'navajowhite',\n\t'navy',\n\t'oldlace',\n\t'olive',\n\t'olivedrab',\n\t'orange',\n\t'orangered',\n\t'orchid',\n\t'palegoldenrod',\n\t'palegreen',\n\t'paleturquoise',\n\t'palevioletred',\n\t'papayawhip',\n\t'peachpuff',\n\t'peru',\n\t'pink',\n\t'plum',\n\t'powderblue',\n\t'purple',\n\t'rebeccapurple',\n\t'red',\n\t'rosybrown',\n\t'royalblue',\n\t'saddlebrown',\n\t'salmon',\n\t'sandybrown',\n\t'seagreen',\n\t'seashell',\n\t'sienna',\n\t'silver',\n\t'skyblue',\n\t'slateblue',\n\t'slategray',\n\t'slategrey',\n\t'snow',\n\t'springgreen',\n\t'steelblue',\n\t'tan',\n\t'teal',\n\t'thistle',\n\t'tomato',\n\t'transparent',\n\t'turquoise',\n\t'violet',\n\t'wheat',\n\t'white',\n\t'whitesmoke',\n\t'yellow',\n\t'yellowgreen',\n]);\n\n/**\n * Returns `true` when `value` is a safe CSS color value.\n * Accepts hex (`#RGB`, `#RRGGBB`), `rgb()`, `rgba()`, `hsl()`, `hsla()`,\n * and CSS named colors. Rejects anything else — defense against CSS injection\n * via manipulated color values in `style` attributes.\n */\nexport function isValidCSSColor(value: string): boolean {\n\tif (!value) return false;\n\tconst trimmed: string = value.trim().toLowerCase();\n\tif (!trimmed) return false;\n\n\treturn (\n\t\tHEX_COLOR_PATTERN.test(trimmed) ||\n\t\tRGB_PATTERN.test(trimmed) ||\n\t\tHSL_PATTERN.test(trimmed) ||\n\t\tCSS_NAMED_COLORS.has(trimmed)\n\t);\n}\n\n/**\n * Validates, deduplicates, and normalizes a user-supplied color list.\n * Returns `fallbackPalette` when no custom colors are provided.\n *\n * @throws {Error} if any value is not a valid hex color code.\n */\nexport function resolveColors(\n\tcolors: readonly string[] | undefined,\n\tfallbackPalette: readonly string[],\n\tpluginName: string,\n): readonly string[] {\n\tif (!colors || colors.length === 0) return fallbackPalette;\n\n\tconst invalid: string[] = colors.filter((c) => !isValidHexColor(c));\n\tif (invalid.length > 0) {\n\t\tthrow new Error(\n\t\t\t`${pluginName}: invalid hex color(s): ${invalid.join(', ')}. Expected format: #RGB or #RRGGBB.`,\n\t\t);\n\t}\n\n\tconst seen: Set<string> = new Set();\n\tconst unique: string[] = [];\n\tfor (const color of colors) {\n\t\tconst normalized: string = color.toLowerCase();\n\t\tif (!seen.has(normalized)) {\n\t\t\tseen.add(normalized);\n\t\t\tunique.push(normalized);\n\t\t}\n\t}\n\treturn unique;\n}\n\n// --- Font Family Validation ---\n\n/** Characters that are never valid in a CSS font-family value. */\nconst FONT_FAMILY_FORBIDDEN: RegExp = /[{}<>;]|url\\(|expression\\(/i;\n\n/**\n * Returns `true` when `value` is a safe CSS `font-family` value.\n * Rejects values containing `{`, `}`, `;`, `<`, `>`, `url(`, or `expression(`\n * to defend against CSS injection.\n */\nexport function isValidCSSFontFamily(value: string): boolean {\n\tif (!value) return false;\n\tconst trimmed: string = value.trim();\n\tif (!trimmed) return false;\n\treturn !FONT_FAMILY_FORBIDDEN.test(trimmed);\n}\n\n// --- Font Size Validation ---\n\n/** Matches valid CSS font-size values: number with unit (px, pt, em, rem, %). */\nconst FONT_SIZE_PATTERN: RegExp = /^\\d+(\\.\\d+)?(px|pt|em|rem|%)$/i;\n\n/**\n * Returns `true` when `value` is a safe CSS `font-size` value.\n * Accepts values like `16px`, `1.5em`, `12pt`, `100%`, `0.875rem`.\n */\nexport function isValidCSSFontSize(value: string): boolean {\n\tif (!value) return false;\n\treturn FONT_SIZE_PATTERN.test(value.trim());\n}\n"],"mappings":"AAKA,IAAM,EAA4B,gCAGlC,SAAgB,EAAgB,GAC/B,OAAO,EAAkB,KAAK,GAM/B,IAAM,EACL,yEAGK,EACL,gFAMK,EAAwC,IAAI,IAAI,CACrD,YACA,eACA,OACA,aACA,QACA,QACA,SACA,QACA,iBACA,OACA,aACA,QACA,YACA,YACA,aACA,YACA,QACA,iBACA,WACA,UACA,OACA,WACA,WACA,gBACA,WACA,YACA,WACA,YACA,cACA,iBACA,aACA,aACA,UACA,aACA,eACA,gBACA,gBACA,gBACA,gBACA,aACA,WACA,cACA,UACA,UACA,aACA,YACA,cACA,cACA,UACA,YACA,aACA,OACA,YACA,OACA,QACA,cACA,OACA,WACA,UACA,YACA,SACA,QACA,QACA,WACA,gBACA,YACA,eACA,YACA,aACA,YACA,uBACA,YACA,aACA,YACA,YACA,cACA,gBACA,eACA,iBACA,iBACA,iBACA,cACA,OACA,YACA,QACA,UACA,SACA,mBACA,aACA,eACA,eACA,iBACA,kBACA,oBACA,kBACA,kBACA,eACA,YACA,YACA,WACA,cACA,OACA,UACA,QACA,YACA,SACA,YACA,SACA,gBACA,YACA,gBACA,gBACA,aACA,YACA,OACA,OACA,OACA,aACA,SACA,gBACA,MACA,YACA,YACA,cACA,SACA,aACA,WACA,WACA,SACA,SACA,UACA,YACA,YACA,YACA,OACA,cACA,YACA,MACA,OACA,UACA,SACA,cACA,YACA,SACA,QACA,QACA,aACA,SACA,gBASD,SAAgB,EAAgB,GAC/B,IAAK,EAAO,OAAO,EACnB,MAAM,EAAkB,EAAM,OAAO,cACrC,QAAK,IAGJ,EAAkB,KAAK,IACvB,EAAY,KAAK,IACjB,EAAY,KAAK,IACjB,EAAiB,IAAI,IAUvB,SAAgB,EACf,EACA,EACA,GAEA,IAAK,GAA4B,IAAlB,EAAO,OAAc,OAAO,EAE3C,MAAM,EAAoB,EAAO,OAAQ,IAAO,EAAgB,IAChE,GAAI,EAAQ,OAAS,EACpB,MAAM,IAAI,MACT,GAAG,4BAAqC,EAAQ,KAAK,4CAIvD,MAAM,iBAAoB,IAAI,IACxB,EAAmB,GACzB,IAAK,MAAM,KAAS,EAAQ,CAC3B,MAAM,EAAqB,EAAM,cAC5B,EAAK,IAAI,KACb,EAAK,IAAI,GACT,EAAO,KAAK,IAGd,OAAO,EAMR,IAAM,EAAgC,8BAOtC,SAAgB,EAAqB,GACpC,IAAK,EAAO,OAAO,EACnB,MAAM,EAAkB,EAAM,OAC9B,QAAK,IACG,EAAsB,KAAK,GAMpC,IAAM,EAA4B,iCAMlC,SAAgB,EAAmB,GAClC,QAAK,GACE,EAAkB,KAAK,EAAM"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{b as r,o as n,r as t,u as o,v as e}from"./Document-CkQLx84k.mjs";import{d as s,o as i,r as c,t as f}from"./Selection-B14e7gd0.mjs";import{a}from"./TypeBrands-BQR8dEYU.mjs";import{i as u}from"./NavigationQueries-CgYPG6oY.mjs";function l(r,n){if(0===n.length)return r.doc.children;const t=r.getBlock(n[n.length-1]);return t?t.children:[]}function d(r){return t(a("paragraph"),[n("")],r)}function m(r,n){if(i(r))return{blockId:r.anchor.blockId,offset:r.anchor.offset};const t=s(r,n);return{blockId:t.from.blockId,offset:t.from.offset}}function h(r){return r&&r.length>1?r.slice(0,-1):[]}function g(r,n){return r.findIndex(r=>e(r)&&r.id===n)}function p(n){if(r(n))return n.id;for(const r of n.children)if(e(r))return p(r);return n.id}function k(n){if(r(n))return n.id;for(let r=n.children.length-1;r>=0;r--){const t=n.children[r];if(t&&e(t))return k(t)}return n.id}function b(r,n,t){const e=r.getBlock(n);if(!e)return null;if(u(r,n)){const t=r.getNodePath(n);return t?c(n,t):null}const s="start"===t?p(e):k(e),i=r.getBlock(s);return i?f(s,"start"===t?0:o(i)):null}export{k as a,m as c,p as i,b as n,g as o,h as r,l as s,d as t};
|
|
2
|
+
//# sourceMappingURL=CommandHelpers-D0LIFM4O.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommandHelpers-D0LIFM4O.mjs","names":[],"sources":["../../src/commands/CommandHelpers.ts"],"sourcesContent":["/**\n * Shared helpers used across multiple command modules.\n *\n * - {@link getSiblings} — resolves a parent path to its child list\n * - {@link createEmptyParagraph} — builds an empty paragraph BlockNode\n * - {@link resolveInsertPoint} — normalizes a text selection to a single insert position\n */\n\nimport type { BlockNode, ChildNode, Document } from '../model/Document.js';\nimport {\n\tcreateBlockNode,\n\tcreateTextNode,\n\tgetBlockLength,\n\tisBlockNode,\n\tisLeafBlock,\n} from '../model/Document.js';\nimport {\n\tcreateCollapsedSelection,\n\tcreateNodeSelection,\n\tisCollapsed,\n\tselectionRange,\n} from '../model/Selection.js';\nimport type { EditorSelection, Selection } from '../model/Selection.js';\nimport type { BlockId } from '../model/TypeBrands.js';\nimport { nodeType } from '../model/TypeBrands.js';\nimport type { EditorState } from '../state/EditorState.js';\nimport { isVoidBlock } from '../state/NavigationQueries.js';\n\n/** The resolved insert position within a single block. */\nexport interface InsertPoint {\n\treadonly blockId: BlockId;\n\treadonly offset: number;\n}\n\n/** Resolves the children of a parent path: doc root or a nested block. */\nexport function getSiblings(\n\tstate: EditorState,\n\tparentPath: readonly BlockId[],\n): readonly ChildNode[] {\n\tif (parentPath.length === 0) return state.doc.children;\n\tconst parent: BlockNode | undefined = state.getBlock(\n\t\tparentPath[parentPath.length - 1] as BlockId,\n\t);\n\treturn parent ? parent.children : [];\n}\n\n/** Creates an empty paragraph block node with the given ID. */\nexport function createEmptyParagraph(id: BlockId): BlockNode {\n\treturn createBlockNode(nodeType('paragraph'), [createTextNode('')], id);\n}\n\n/**\n * Normalizes a text selection to a single insert point.\n *\n * - Collapsed selection → anchor position.\n * - Range selection → normalized `from` position (document-order start).\n */\nexport function resolveInsertPoint(sel: Selection, blockOrder: readonly BlockId[]): InsertPoint {\n\tif (isCollapsed(sel)) {\n\t\treturn { blockId: sel.anchor.blockId, offset: sel.anchor.offset };\n\t}\n\tconst range = selectionRange(sel, blockOrder);\n\treturn { blockId: range.from.blockId, offset: range.from.offset };\n}\n\n/** Extracts the parent path from a full node path (all elements except the last). */\nexport function extractParentPath(path: readonly string[] | undefined): BlockId[] {\n\treturn path && path.length > 1 ? (path.slice(0, -1) as BlockId[]) : [];\n}\n\n/** Finds the index of a block by ID within a sibling list. */\nexport function findSiblingIndex(siblings: readonly ChildNode[], targetId: BlockId): number {\n\treturn siblings.findIndex((c) => isBlockNode(c) && c.id === targetId);\n}\n\n/** Finds the first leaf block ID in a subtree. */\nexport function findFirstLeafBlockId(node: BlockNode): BlockId {\n\tif (isLeafBlock(node)) return node.id;\n\n\tfor (const child of node.children) {\n\t\tif (!isBlockNode(child)) continue;\n\t\treturn findFirstLeafBlockId(child);\n\t}\n\n\treturn node.id;\n}\n\n/** Finds the last leaf block ID in a subtree. */\nexport function findLastLeafBlockId(node: BlockNode): BlockId {\n\tif (isLeafBlock(node)) return node.id;\n\n\tfor (let i = node.children.length - 1; i >= 0; i--) {\n\t\tconst child = node.children[i];\n\t\tif (child && isBlockNode(child)) {\n\t\t\treturn findLastLeafBlockId(child);\n\t\t}\n\t}\n\n\treturn node.id;\n}\n\n/**\n * Resolves a valid editor selection at the start or end of a block subtree.\n * Void blocks become NodeSelections; text-capable blocks resolve to leaf cursors.\n */\nexport function createSelectionForBlockBoundary(\n\tstate: EditorState,\n\tblockId: BlockId,\n\tboundary: 'start' | 'end',\n): EditorSelection | null {\n\tconst block = state.getBlock(blockId);\n\tif (!block) return null;\n\n\tif (isVoidBlock(state, blockId)) {\n\t\tconst path = state.getNodePath(blockId);\n\t\treturn path ? createNodeSelection(blockId, path) : null;\n\t}\n\n\tconst leafId: BlockId =\n\t\tboundary === 'start' ? findFirstLeafBlockId(block) : findLastLeafBlockId(block);\n\tconst leaf = state.getBlock(leafId);\n\tif (!leaf) return null;\n\n\tconst offset = boundary === 'start' ? 0 : getBlockLength(leaf);\n\treturn createCollapsedSelection(leafId, offset);\n}\n\n/** Returns the root-level block IDs in document order. */\nexport function getRootBlockIds(doc: Document): readonly BlockId[] {\n\treturn doc.children.map((child) => child.id);\n}\n"],"mappings":"wOAmCA,SAAgB,EACf,EACA,GAEA,GAA0B,IAAtB,EAAW,OAAc,OAAO,EAAM,IAAI,SAC9C,MAAM,EAAgC,EAAM,SAC3C,EAAW,EAAW,OAAS,IAEhC,OAAO,EAAS,EAAO,SAAW,GAInC,SAAgB,EAAqB,GACpC,OAAO,EAAgB,EAAS,aAAc,CAAC,EAAe,KAAM,GASrE,SAAgB,EAAmB,EAAgB,GAClD,GAAI,EAAY,GACf,MAAO,CAAE,QAAS,EAAI,OAAO,QAAS,OAAQ,EAAI,OAAO,QAE1D,MAAM,EAAQ,EAAe,EAAK,GAClC,MAAO,CAAE,QAAS,EAAM,KAAK,QAAS,OAAQ,EAAM,KAAK,QAI1D,SAAgB,EAAkB,GACjC,OAAO,GAAQ,EAAK,OAAS,EAAK,EAAK,MAAM,GAAG,GAAoB,GAIrE,SAAgB,EAAiB,EAAgC,GAChE,OAAO,EAAS,UAAW,GAAM,EAAY,IAAM,EAAE,KAAO,GAI7D,SAAgB,EAAqB,GACpC,GAAI,EAAY,GAAO,OAAO,EAAK,GAEnC,IAAK,MAAM,KAAS,EAAK,SACxB,GAAK,EAAY,GACjB,OAAO,EAAqB,GAG7B,OAAO,EAAK,GAIb,SAAgB,EAAoB,GACnC,GAAI,EAAY,GAAO,OAAO,EAAK,GAEnC,IAAK,IAAI,EAAI,EAAK,SAAS,OAAS,EAAG,GAAK,EAAG,IAAK,CACnD,MAAM,EAAQ,EAAK,SAAS,GAC5B,GAAI,GAAS,EAAY,GACxB,OAAO,EAAoB,GAI7B,OAAO,EAAK,GAOb,SAAgB,EACf,EACA,EACA,GAEA,MAAM,EAAQ,EAAM,SAAS,GAC7B,IAAK,EAAO,OAAO,KAEnB,GAAI,EAAY,EAAO,GAAU,CAChC,MAAM,EAAO,EAAM,YAAY,GAC/B,OAAO,EAAO,EAAoB,EAAS,GAAQ,KAGpD,MAAM,EACQ,UAAb,EAAuB,EAAqB,GAAS,EAAoB,GACpE,EAAO,EAAM,SAAS,GAC5B,OAAK,EAGE,EAAyB,EADJ,UAAb,EAAuB,EAAI,EAAe,IAFvC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{_ as t,a as n,b as e,d as o,h as r,s as c,u as s,x as i}from"./Document-CkQLx84k.mjs";import{a as l,c as u,d as f,l as a,o as d,r as k,t as m,u as b}from"./Selection-B14e7gd0.mjs";import{i as g,r as I}from"./TypeBrands-BQR8dEYU.mjs";import{n as p}from"./NodeResolver-CCA8UVRr.mjs";import{a as h,i as B,n as S,r as x}from"./NavigationQueries-CgYPG6oY.mjs";import{a as T,c as O,i as y,o as A,r as N,s as M,t as j}from"./CommandHelpers-D0LIFM4O.mjs";import{n as v,r as w,t as C}from"./NodeSelectionCommands-CE_73CxF.mjs";import{a as _}from"./AttributedMarkCommands-Cmet1IuC.mjs";import{n as D,t as H}from"./WordBoundary-iZXLMFyk.mjs";function Q(){return{nodeTypes:["paragraph"],markTypes:["bold","italic","underline"],getNodeSpec:()=>{}}}function R(t){return{nodeTypes:t.getNodeTypes(),markTypes:t.getMarkTypes(),getNodeSpec:n=>t.getNodeSpec(n)}}function W(t,n){return t.markTypes.includes(n)}function q(t,n){return t.nodeTypes.includes(n)}function z(t,n){if("after"===n.side)return F(t,n);const e=t.getBlockOrder(),o=e.indexOf(n.blockId);if(o<=0)return null;const r=e[o-1];if(!r)return null;if(B(t,r)){const n=p(t.doc,r)??[];return t.transaction("input").setSelection(k(r,n)).build()}const c=t.getBlock(r);if(!c)return null;const i=s(c);return t.transaction("input").setSelection(m(r,i)).build()}function E(t,n){if("before"===n.side)return F(t,n);const e=t.getBlockOrder(),o=e.indexOf(n.blockId);if(o>=e.length-1)return null;const r=e[o+1];if(!r)return null;if(B(t,r)){const n=p(t.doc,r)??[];return t.transaction("input").setSelection(k(r,n)).build()}return t.transaction("input").setSelection(m(r,0)).build()}function F(t,n){const e=p(t.doc,n.blockId)??[];return C(t,k(n.blockId,e))}var G={bold:!0,italic:!0,underline:!0};function J(n,e,r=G){if(function(t,n){const e=t;return"bold"===e?!n.bold:"italic"===e?!n.italic:"underline"===e&&!n.underline}(e,r))return null;if(!W(n.schema,e))return null;if(!b(n.selection))return null;const c={type:e},s=n.selection;if(d(s)){const r=n.getBlock(s.anchor.blockId);if(!r)return null;const i=n.storedMarks??o(r,s.anchor.offset),l=t(i,e)?i.filter(t=>t.type!==e):[...i,c];return n.transaction("command").setStoredMarks(l,n.storedMarks).setSelection(s).build()}const i=f(s,n.getBlockOrder()),l=n.transaction("command"),u=V(n,e);return _(n,i,(t,n,e)=>{u?l.removeMark(t,n,e,c):l.addMark(t,n,e,c)}),l.setSelection(s),l.build()}function K(t,n){return J(t,g("bold"),n)}function L(t,n){return J(t,g("italic"),n)}function P(t,n){return J(t,g("underline"),n)}function U(n,e){const r=n.selection;if(!b(r))return!1;if(d(r)){if(n.storedMarks)return t(n.storedMarks,e);const c=n.getBlock(r.anchor.blockId);return!!c&&t(o(c,r.anchor.offset),e)}return V(n,e)}function V(t,n){const e=t.selection;if(!b(e))return!1;const o=t.getBlockOrder(),r=f(e,o),c=o.indexOf(r.from.blockId),i=o.indexOf(r.to.blockId);for(let l=c;l<=i;l++){const e=o[l];if(!e)continue;const u=t.getBlock(e);if(!u)continue;const f=s(u);if(!X(u,l===c?r.from.offset:0,l===i?r.to.offset:f,n))return!1}return!0}function X(n,e,o,c){if(e===o)return!1;let s=0;for(const l of r(n))if(i(l)){const n=s+l.text.length;if(n>e&&s<o&&!t(l.marks,c))return!1;s=n}else s+=1;return!0}function Y(t,n){const e=t.selection;if(a(e))return C(t,e);if(u(e))return null;if(!d(e))return ct(t);const o=t.getBlock(e.anchor.blockId);if(!o)return null;const r=n.range(o,e.anchor.offset);if(!r)return n.merge(t);const[c,s]=r;return t.transaction("input").deleteTextAt(o.id,c,s).setSelection(m(o.id,c)).build()}function Z(t){return Y(t,{merge:lt,range:(t,n)=>n>0?[n-1,n]:null})}function $(t){return Y(t,{merge:ut,range:(t,n)=>n<s(t)?[n,n+1]:null})}function tt(t){return Y(t,{merge:lt,range:(t,n)=>n>0?[H(t,n),n]:null})}function nt(t){return Y(t,{merge:ut,range:(t,n)=>n<s(t)?[n,D(t,n)]:null})}function et(t){return Y(t,{merge:lt,range:(t,n)=>n>0?[0,n]:null})}function ot(t){return Y(t,{merge:ut,range:(t,n)=>{const e=s(t);return n<e?[n,e]:null}})}function rt(t,n,e="input"){const r=t.selection;if(a(r))return w(t,r,n,e);if(u(r))return function(t,n,e,o){const r=N(p(t.doc,n.blockId)),s=M(t,r),i=A(s,n.blockId),l="before"===n.side?Math.max(i,0):i>=0?i+1:s.length,u=c(),f=t.transaction(o);return f.insertNode(r,l,j(u)),f.insertText(u,0,e,[]),f.setSelection(m(u,e.length)),f.build()}(t,r,n,e);const s=t.transaction(e),i=function(t){if(t.storedMarks)return t.storedMarks;if(!b(t.selection))return[];const n=t.getBlock(t.selection.anchor.blockId);return n?o(n,t.selection.anchor.offset):[]}(t);let l;d(r)||(l=dt(t,s));const f=O(r,t.getBlockOrder()),k=l??f.blockId,g=l?0:f.offset;return s.insertText(k,g,n,i),s.setSelection(m(k,g+n.length)),s.build()}function ct(t){if(a(t.selection))return C(t,t.selection);if(u(t.selection))return null;if(d(t.selection))return null;const n=t.transaction("input"),e=dt(t,n),o=f(t.selection,t.getBlockOrder()),r=e??o.from.blockId,c=e?0:o.from.offset;return n.setSelection(m(r,c)),n.build()}function st(t){const n=t.selection;if(a(n))return v(t,n);if(u(n))return function(t,n){const e=p(t.doc,n.blockId);if(!e)return null;const o=N(e),r=A(M(t,o),n.blockId);if(r<0)return null;const s="before"===n.side?r:r+1,i=c(),l=t.transaction("input");return l.insertNode(o,s,j(i)),l.setSelection(m(i,0)),l.build()}(t,n);const e=t.transaction("input");let o;d(n)||(o=dt(t,e));const r=O(n,t.getBlockOrder()),s=o??r.blockId,i=o?0:r.offset,l=c();return e.splitBlock(s,i,l),e.setSelection(m(l,0)),e.build()}function it(t){const e=t.selection;if(!b(e))return null;const o=t.transaction("input");let r;if(d(e)||(r=dt(t,o)),r)o.insertInlineNode(r,0,n(I("hard_break"))),o.setSelection(m(r,1));else{const{blockId:r,offset:c}=O(e,t.getBlockOrder());o.insertInlineNode(r,c,n(I("hard_break"))),o.setSelection(m(r,c+1))}return o.build()}function lt(t){return ft(t,"backward")}function ut(t){return ft(t,"forward")}function ft(t,n){const e=t.selection;if(!b(e))return null;const o=t.getBlockOrder(),r=o.indexOf(e.anchor.blockId),c="backward"===n?r-1:r+1;if(c<0||c>=o.length)return null;const i=o[c];if(!i)return null;if(x(t,e.anchor.blockId)||x(t,i))return null;if(!h(t,e.anchor.blockId,i)&&S(t,e.anchor.blockId))return null;if(B(t,i)){const n=p(t.doc,i)??[];return t.transaction("input").setSelection(k(i,n)).build()}if("backward"===n){const n=t.getBlock(i);if(!n)return null;const o=s(n);return t.transaction("input").mergeBlocksAt(i,e.anchor.blockId).setSelection(m(i,o)).build()}return t.transaction("input").mergeBlocksAt(e.anchor.blockId,i).setSelection(m(e.anchor.blockId,e.anchor.offset)).build()}function at(t){const n=t.doc.children,e=n[0],o=n[n.length-1];if(!e||!o)return t.transaction("command").setSelection(t.selection).build();const r=y(e),c=T(o),i=t.getBlock(c),u=i?s(i):0;return t.transaction("command").setSelection(l({blockId:r,offset:0},{blockId:c,offset:u})).build()}function dt(t,n){if(!b(t.selection))return;const o=t.getBlockOrder(),r=f(t.selection,o),i=o.indexOf(r.from.blockId),l=o.indexOf(r.to.blockId);if(i===l)return void n.deleteTextAt(r.from.blockId,r.from.offset,r.to.offset);const u=kt(t,r.from.blockId),a=kt(t,r.to.blockId);if(!(u===a||u<0||a<0))return function(t,n,o,r,i){const l=t.doc.children[r],u=t.doc.children[i];if(!l||!u)return;const f=e(l),a=e(u);let d,k=0;if(f||(d=c(),n.insertNode([],r,j(d)),k=1),f){const e=t.getBlock(o.from.blockId);if(e){const t=s(e);o.from.offset<t&&n.deleteTextAt(o.from.blockId,o.from.offset,t)}}a&&o.to.offset>0&&n.deleteTextAt(o.to.blockId,0,o.to.offset);const m=f?r+1:r+k;for(let e=a?i-1+k:i+k;e>=m;e--)n.removeNode([],e);return f&&a&&n.mergeBlocksAt(o.from.blockId,o.to.blockId),d}(t,n,r,u,a);!function(t,n,e,o,r,c){const i=t.getBlock(o.from.blockId);if(!i)return;const l=s(i);o.from.offset<l&&n.deleteTextAt(o.from.blockId,o.from.offset,l),o.to.offset>0&&n.deleteTextAt(o.to.blockId,0,o.to.offset);for(let u=r+1;u<c;u++){const r=e[u];if(!r)continue;const c=t.getBlock(r);if(!c)continue;const i=s(c);i>0&&n.deleteTextAt(r,0,i),n.mergeBlocksAt(o.from.blockId,r)}n.mergeBlocksAt(o.from.blockId,o.to.blockId)}(t,n,o,r,i,l)}function kt(t,n){const e=p(t.doc,n);if(!e||0===e.length)return-1;const o=e[0];return t.doc.children.findIndex(t=>t.id===o)}export{q as C,W as S,J as _,lt as a,E as b,Z as c,ot as d,tt as f,L as g,K as h,rt as i,$ as l,U as m,ct as n,at as o,nt as p,it as r,st as s,dt as t,et as u,P as v,R as w,Q as x,z as y};
|
|
2
|
+
//# sourceMappingURL=Commands-DJSVqp7b.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Commands-DJSVqp7b.mjs","names":[],"sources":["../../src/model/Schema.ts","../../src/commands/GapCursorCommands.ts","../../src/commands/MarkCommands.ts","../../src/commands/DeleteCommands.ts","../../src/commands/Commands.ts"],"sourcesContent":["/**\n * Schema definition for the Notectl editor.\n * Defines which node types and marks are allowed.\n */\n\nimport type { NodeSpec } from './NodeSpec.js';\nimport type { SchemaRegistry } from './SchemaRegistry.js';\n\nexport interface Schema {\n\treadonly nodeTypes: readonly string[];\n\treadonly markTypes: readonly string[];\n\t/** Looks up the full NodeSpec for a given type. Available when created via schemaFromRegistry. */\n\treadonly getNodeSpec?: (type: string) => NodeSpec | undefined;\n}\n\n/** Creates the default schema with paragraph nodes and bold/italic/underline marks. */\nexport function defaultSchema(): Schema {\n\treturn {\n\t\tnodeTypes: ['paragraph'],\n\t\tmarkTypes: ['bold', 'italic', 'underline'],\n\t\tgetNodeSpec: () => undefined,\n\t};\n}\n\n/** Derives a Schema from a SchemaRegistry's registered specs. */\nexport function schemaFromRegistry(registry: SchemaRegistry): Schema {\n\treturn {\n\t\tnodeTypes: registry.getNodeTypes(),\n\t\tmarkTypes: registry.getMarkTypes(),\n\t\tgetNodeSpec: (type: string) => registry.getNodeSpec(type),\n\t};\n}\n\n/** Checks whether the given mark type is allowed by the schema. */\nexport function isMarkAllowed(schema: Schema, markType: string): boolean {\n\treturn schema.markTypes.includes(markType);\n}\n\n/** Checks whether the given node type is allowed by the schema. */\nexport function isNodeTypeAllowed(schema: Schema, nodeType: string): boolean {\n\treturn schema.nodeTypes.includes(nodeType);\n}\n","/**\n * Commands for GapCursor: deleting void blocks adjacent to gap cursors\n * and inserting paragraphs at gap positions.\n */\n\nimport { generateBlockId, getBlockLength } from '../model/Document.js';\nimport { findNodePath } from '../model/NodeResolver.js';\nimport type { GapCursorSelection, NodeSelection } from '../model/Selection.js';\nimport { createCollapsedSelection, createNodeSelection } from '../model/Selection.js';\nimport type { BlockId } from '../model/TypeBrands.js';\nimport type { EditorState } from '../state/EditorState.js';\nimport { isVoidBlock } from '../state/NavigationQueries.js';\nimport type { Transaction } from '../state/Transaction.js';\nimport {\n\tcreateEmptyParagraph,\n\textractParentPath,\n\tfindSiblingIndex,\n\tgetSiblings,\n} from './CommandHelpers.js';\nimport { deleteNodeSelection } from './NodeSelectionCommands.js';\n\n/**\n * Deletes the void block adjacent to a GapCursor when pressing Backspace.\n *\n * - `side === 'after'` → void block is behind the cursor → delete it.\n * - `side === 'before'` → void block is ahead → navigate backward (to previous block).\n * - At document start with `side === 'before'` → `null` (no-op).\n */\nexport function deleteBackwardAtGap(\n\tstate: EditorState,\n\tsel: GapCursorSelection,\n): Transaction | null {\n\tif (sel.side === 'after') {\n\t\treturn deleteVoidAtGap(state, sel);\n\t}\n\n\t// side === 'before': navigate to previous block\n\tconst blockOrder: readonly BlockId[] = state.getBlockOrder();\n\tconst blockIdx: number = blockOrder.indexOf(sel.blockId);\n\n\tif (blockIdx <= 0) return null;\n\n\tconst prevId: BlockId | undefined = blockOrder[blockIdx - 1];\n\tif (!prevId) return null;\n\n\tif (isVoidBlock(state, prevId)) {\n\t\tconst path = findNodePath(state.doc, prevId) ?? [];\n\t\treturn state\n\t\t\t.transaction('input')\n\t\t\t.setSelection(createNodeSelection(prevId, path as BlockId[]))\n\t\t\t.build();\n\t}\n\n\tconst prevBlock = state.getBlock(prevId);\n\tif (!prevBlock) return null;\n\tconst prevLen: number = getBlockLength(prevBlock);\n\treturn state.transaction('input').setSelection(createCollapsedSelection(prevId, prevLen)).build();\n}\n\n/**\n * Deletes the void block adjacent to a GapCursor when pressing Delete.\n *\n * - `side === 'before'` → void block is ahead of the cursor → delete it.\n * - `side === 'after'` → void block is behind → navigate forward (to next block).\n * - At document end with `side === 'after'` → `null` (no-op).\n */\nexport function deleteForwardAtGap(\n\tstate: EditorState,\n\tsel: GapCursorSelection,\n): Transaction | null {\n\tif (sel.side === 'before') {\n\t\treturn deleteVoidAtGap(state, sel);\n\t}\n\n\t// side === 'after': navigate to next block\n\tconst blockOrder: readonly BlockId[] = state.getBlockOrder();\n\tconst blockIdx: number = blockOrder.indexOf(sel.blockId);\n\n\tif (blockIdx >= blockOrder.length - 1) return null;\n\n\tconst nextId: BlockId | undefined = blockOrder[blockIdx + 1];\n\tif (!nextId) return null;\n\n\tif (isVoidBlock(state, nextId)) {\n\t\tconst path = findNodePath(state.doc, nextId) ?? [];\n\t\treturn state\n\t\t\t.transaction('input')\n\t\t\t.setSelection(createNodeSelection(nextId, path as BlockId[]))\n\t\t\t.build();\n\t}\n\n\treturn state.transaction('input').setSelection(createCollapsedSelection(nextId, 0)).build();\n}\n\n/** Deletes the void block that the GapCursor is adjacent to, delegating to deleteNodeSelection. */\nfunction deleteVoidAtGap(state: EditorState, sel: GapCursorSelection): Transaction | null {\n\tconst path = (findNodePath(state.doc, sel.blockId) ?? []) as BlockId[];\n\tconst nodeSel: NodeSelection = createNodeSelection(sel.blockId, path);\n\treturn deleteNodeSelection(state, nodeSel);\n}\n\n/** Inserts a new paragraph at a GapCursor position (before or after the void block). */\nexport function insertParagraphAtGap(\n\tstate: EditorState,\n\tsel: GapCursorSelection,\n): Transaction | null {\n\tconst path = findNodePath(state.doc, sel.blockId);\n\tif (!path) return null;\n\n\tconst parentPath: BlockId[] = extractParentPath(path);\n\tconst siblings = getSiblings(state, parentPath);\n\n\tconst index: number = findSiblingIndex(siblings, sel.blockId);\n\tif (index < 0) return null;\n\n\tconst insertIdx: number = sel.side === 'before' ? index : index + 1;\n\tconst newId = generateBlockId();\n\tconst builder = state.transaction('input');\n\tbuilder.insertNode(parentPath, insertIdx, createEmptyParagraph(newId));\n\tbuilder.setSelection(createCollapsedSelection(newId, 0));\n\treturn builder.build();\n}\n\n/** Inserts text in a new paragraph at a GapCursor position. */\nexport function insertTextAtGap(\n\tstate: EditorState,\n\tsel: GapCursorSelection,\n\ttext: string,\n\torigin: 'input' | 'paste',\n): Transaction {\n\tconst path = findNodePath(state.doc, sel.blockId);\n\tconst parentPath: BlockId[] = extractParentPath(path);\n\tconst siblings = getSiblings(state, parentPath);\n\n\tconst index: number = findSiblingIndex(siblings, sel.blockId);\n\tconst insertIdx: number =\n\t\tsel.side === 'before' ? Math.max(index, 0) : index >= 0 ? index + 1 : siblings.length;\n\n\tconst newId = generateBlockId();\n\tconst builder = state.transaction(origin);\n\tbuilder.insertNode(parentPath, insertIdx, createEmptyParagraph(newId));\n\tbuilder.insertText(newId, 0, text, []);\n\tbuilder.setSelection(createCollapsedSelection(newId, text.length));\n\treturn builder.build();\n}\n","/**\n * Mark-related commands: toggling bold/italic/underline and checking\n * whether a mark is active.\n */\n\nimport {\n\ttype BlockNode,\n\ttype Mark,\n\tgetBlockLength,\n\tgetBlockMarksAtOffset,\n\tgetInlineChildren,\n\thasMark,\n\tisTextNode,\n} from '../model/Document.js';\nimport { isMarkAllowed } from '../model/Schema.js';\nimport { isCollapsed, isTextSelection, selectionRange } from '../model/Selection.js';\nimport type { MarkTypeName } from '../model/TypeBrands.js';\nimport { markType as mkType } from '../model/TypeBrands.js';\nimport type { EditorState } from '../state/EditorState.js';\nimport type { Transaction } from '../state/Transaction.js';\nimport { forEachBlockInRange } from './RangeIterator.js';\n\n// --- Feature Configuration ---\n\nexport interface FeatureConfig {\n\treadonly bold: boolean;\n\treadonly italic: boolean;\n\treadonly underline: boolean;\n}\n\nconst defaultFeatures: FeatureConfig = { bold: true, italic: true, underline: true };\n\n/**\n * Toggles a mark on the current selection.\n * If collapsed, toggles stored marks. If range, applies/removes from text.\n */\nexport function toggleMark(\n\tstate: EditorState,\n\tmarkType: MarkTypeName,\n\tfeatures: FeatureConfig = defaultFeatures,\n): Transaction | null {\n\tif (isFeatureGated(markType, features)) return null;\n\tif (!isMarkAllowed(state.schema, markType)) return null;\n\tif (!isTextSelection(state.selection)) return null;\n\n\tconst mark: Mark = { type: markType };\n\tconst sel = state.selection;\n\n\tif (isCollapsed(sel)) {\n\t\t// Toggle stored marks\n\t\tconst anchorBlock = state.getBlock(sel.anchor.blockId);\n\t\tif (!anchorBlock) return null;\n\t\tconst currentMarks = state.storedMarks ?? getBlockMarksAtOffset(anchorBlock, sel.anchor.offset);\n\t\tconst hasIt = hasMark(currentMarks, markType);\n\t\tconst newMarks = hasIt\n\t\t\t? currentMarks.filter((m) => m.type !== markType)\n\t\t\t: [...currentMarks, mark];\n\n\t\treturn state\n\t\t\t.transaction('command')\n\t\t\t.setStoredMarks(newMarks, state.storedMarks)\n\t\t\t.setSelection(sel)\n\t\t\t.build();\n\t}\n\n\t// Range selection — apply/remove mark to all blocks in range\n\tconst range = selectionRange(sel, state.getBlockOrder());\n\tconst builder = state.transaction('command');\n\n\t// Determine if we should add or remove\n\tconst shouldRemove = isMarkActiveInRange(state, markType);\n\n\tforEachBlockInRange(state, range, (blockId, from, to) => {\n\t\tif (shouldRemove) {\n\t\t\tbuilder.removeMark(blockId, from, to, mark);\n\t\t} else {\n\t\t\tbuilder.addMark(blockId, from, to, mark);\n\t\t}\n\t});\n\n\tbuilder.setSelection(sel);\n\treturn builder.build();\n}\n\nexport function toggleBold(state: EditorState, features?: FeatureConfig): Transaction | null {\n\treturn toggleMark(state, mkType('bold'), features);\n}\n\nexport function toggleItalic(state: EditorState, features?: FeatureConfig): Transaction | null {\n\treturn toggleMark(state, mkType('italic'), features);\n}\n\nexport function toggleUnderline(state: EditorState, features?: FeatureConfig): Transaction | null {\n\treturn toggleMark(state, mkType('underline'), features);\n}\n\n/** Checks if a mark is active at the current selection. */\nexport function isMarkActive(state: EditorState, markType: MarkTypeName): boolean {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return false;\n\n\tif (isCollapsed(sel)) {\n\t\tif (state.storedMarks) {\n\t\t\treturn hasMark(state.storedMarks, markType);\n\t\t}\n\t\tconst block = state.getBlock(sel.anchor.blockId);\n\t\tif (!block) return false;\n\t\tconst marks = getBlockMarksAtOffset(block, sel.anchor.offset);\n\t\treturn hasMark(marks, markType);\n\t}\n\n\treturn isMarkActiveInRange(state, markType);\n}\n\n/** Checks if a mark is active across the entire selection range. */\nfunction isMarkActiveInRange(state: EditorState, markType: MarkTypeName): boolean {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return false;\n\tconst blockOrder = state.getBlockOrder();\n\tconst range = selectionRange(sel, blockOrder);\n\n\tconst fromIdx = blockOrder.indexOf(range.from.blockId);\n\tconst toIdx = blockOrder.indexOf(range.to.blockId);\n\n\tfor (let i = fromIdx; i <= toIdx; i++) {\n\t\tconst blockId = blockOrder[i];\n\t\tif (!blockId) continue;\n\t\tconst block = state.getBlock(blockId);\n\t\tif (!block) continue;\n\t\tconst blockLen = getBlockLength(block);\n\t\tconst from = i === fromIdx ? range.from.offset : 0;\n\t\tconst to = i === toIdx ? range.to.offset : blockLen;\n\n\t\tif (!isMarkActiveInBlock(block, from, to, markType)) return false;\n\t}\n\n\treturn true;\n}\n\nfunction isMarkActiveInBlock(\n\tblock: BlockNode,\n\tfrom: number,\n\tto: number,\n\tmarkType: MarkTypeName,\n): boolean {\n\tif (from === to) return false;\n\tlet pos = 0;\n\tfor (const child of getInlineChildren(block)) {\n\t\tif (isTextNode(child)) {\n\t\t\tconst childEnd = pos + child.text.length;\n\t\t\tif (childEnd > from && pos < to) {\n\t\t\t\tif (!hasMark(child.marks, markType)) return false;\n\t\t\t}\n\t\t\tpos = childEnd;\n\t\t} else {\n\t\t\t// InlineNode: skip (width 1, no marks)\n\t\t\tpos += 1;\n\t\t}\n\t}\n\treturn true;\n}\n\nfunction isFeatureGated(type: MarkTypeName, features: FeatureConfig): boolean {\n\tconst key = type as string;\n\tif (key === 'bold') return !features.bold;\n\tif (key === 'italic') return !features.italic;\n\tif (key === 'underline') return !features.underline;\n\treturn false;\n}\n","/**\n * Delete commands: character, word, and soft-line deletion in both directions.\n */\n\nimport { type BlockNode, getBlockLength } from '../model/Document.js';\nimport {\n\tcreateCollapsedSelection,\n\tisCollapsed,\n\tisGapCursor,\n\tisNodeSelection,\n} from '../model/Selection.js';\nimport type { EditorState } from '../state/EditorState.js';\nimport type { Transaction } from '../state/Transaction.js';\nimport { deleteSelectionCommand, mergeBlockBackward, mergeBlockForward } from './Commands.js';\nimport { deleteNodeSelection } from './NodeSelectionCommands.js';\nimport { findWordBoundaryBackward, findWordBoundaryForward } from './WordBoundary.js';\n\ninterface DeleteConfig {\n\treadonly merge: (state: EditorState) => Transaction | null;\n\treadonly range: (block: BlockNode, offset: number) => readonly [number, number] | null;\n}\n\nfunction deleteInDirection(state: EditorState, config: DeleteConfig): Transaction | null {\n\tconst sel = state.selection;\n\n\tif (isNodeSelection(sel)) return deleteNodeSelection(state, sel);\n\tif (isGapCursor(sel)) return null;\n\tif (!isCollapsed(sel)) return deleteSelectionCommand(state);\n\n\tconst block = state.getBlock(sel.anchor.blockId);\n\tif (!block) return null;\n\n\tconst range = config.range(block, sel.anchor.offset);\n\tif (!range) return config.merge(state);\n\n\tconst [from, to] = range;\n\treturn state\n\t\t.transaction('input')\n\t\t.deleteTextAt(block.id, from, to)\n\t\t.setSelection(createCollapsedSelection(block.id, from))\n\t\t.build();\n}\n\n/** Handles backspace key. */\nexport function deleteBackward(state: EditorState): Transaction | null {\n\treturn deleteInDirection(state, {\n\t\tmerge: mergeBlockBackward,\n\t\trange: (_block, offset) => (offset > 0 ? [offset - 1, offset] : null),\n\t});\n}\n\n/** Handles delete key. */\nexport function deleteForward(state: EditorState): Transaction | null {\n\treturn deleteInDirection(state, {\n\t\tmerge: mergeBlockForward,\n\t\trange: (block, offset) => {\n\t\t\tconst len = getBlockLength(block);\n\t\t\treturn offset < len ? [offset, offset + 1] : null;\n\t\t},\n\t});\n}\n\n/** Handles Ctrl+Backspace: delete word backward. */\nexport function deleteWordBackward(state: EditorState): Transaction | null {\n\treturn deleteInDirection(state, {\n\t\tmerge: mergeBlockBackward,\n\t\trange: (block, offset) =>\n\t\t\toffset > 0 ? [findWordBoundaryBackward(block, offset), offset] : null,\n\t});\n}\n\n/** Handles Ctrl+Delete: delete word forward. */\nexport function deleteWordForward(state: EditorState): Transaction | null {\n\treturn deleteInDirection(state, {\n\t\tmerge: mergeBlockForward,\n\t\trange: (block, offset) => {\n\t\t\tconst len = getBlockLength(block);\n\t\t\treturn offset < len ? [offset, findWordBoundaryForward(block, offset)] : null;\n\t\t},\n\t});\n}\n\n/** Handles Cmd+Backspace: delete to start of line/block. */\nexport function deleteSoftLineBackward(state: EditorState): Transaction | null {\n\treturn deleteInDirection(state, {\n\t\tmerge: mergeBlockBackward,\n\t\trange: (_block, offset) => (offset > 0 ? [0, offset] : null),\n\t});\n}\n\n/** Handles Cmd+Delete: delete to end of line/block. */\nexport function deleteSoftLineForward(state: EditorState): Transaction | null {\n\treturn deleteInDirection(state, {\n\t\tmerge: mergeBlockForward,\n\t\trange: (block, offset) => {\n\t\t\tconst len = getBlockLength(block);\n\t\t\treturn offset < len ? [offset, len] : null;\n\t\t},\n\t});\n}\n","/**\n * Core editor commands and barrel re-exports from submodules.\n *\n * This module contains text insertion, block splitting, block merging,\n * selection deletion, and select-all. Mark, delete, gap-cursor, node-selection,\n * and word-boundary commands are re-exported from their respective modules.\n */\n\nimport {\n\ttype Mark,\n\tcreateInlineNode,\n\tgenerateBlockId,\n\tgetBlockLength,\n\tgetBlockMarksAtOffset,\n\tisLeafBlock,\n} from '../model/Document.js';\nimport { findNodePath } from '../model/NodeResolver.js';\nimport {\n\tcreateCollapsedSelection,\n\tcreateNodeSelection,\n\tcreateSelection,\n\tisCollapsed,\n\tisGapCursor,\n\tisNodeSelection,\n\tisTextSelection,\n\tselectionRange,\n} from '../model/Selection.js';\nimport { type BlockId, inlineType } from '../model/TypeBrands.js';\nimport type { EditorState } from '../state/EditorState.js';\nimport {\n\tisInsideIsolating,\n\tisIsolatingBlock,\n\tisVoidBlock,\n\tsharesParent,\n} from '../state/NavigationQueries.js';\nimport type { Transaction } from '../state/Transaction.js';\nimport type { TransactionBuilder } from '../state/Transaction.js';\nimport { createEmptyParagraph, resolveInsertPoint } from './CommandHelpers.js';\nimport { insertParagraphAtGap, insertTextAtGap } from './GapCursorCommands.js';\nimport {\n\tdeleteNodeSelection,\n\tfindFirstLeafBlockId,\n\tfindLastLeafBlockId,\n\tinsertParagraphAfterNodeSelection,\n\tinsertTextAfterNodeSelection,\n} from './NodeSelectionCommands.js';\n\n// --- Re-exports from submodules ---\n\nexport {\n\tcanCrossBlockBoundary,\n\tisInsideIsolating,\n\tisIsolatingBlock,\n\tisVoidBlock,\n\tsharesParent,\n} from '../state/NavigationQueries.js';\n\nexport type { FeatureConfig } from './MarkCommands.js';\nexport {\n\tisMarkActive,\n\ttoggleBold,\n\ttoggleItalic,\n\ttoggleMark,\n\ttoggleUnderline,\n} from './MarkCommands.js';\n\nexport {\n\tdeleteBackward,\n\tdeleteForward,\n\tdeleteSoftLineBackward,\n\tdeleteSoftLineForward,\n\tdeleteWordBackward,\n\tdeleteWordForward,\n} from './DeleteCommands.js';\n\nexport {\n\tdeleteNodeSelection,\n\tfindFirstLeafBlockId,\n\tfindLastLeafBlockId,\n\tinsertParagraphAfterNodeSelection,\n\tinsertTextAfterNodeSelection,\n\tnavigateArrowIntoVoid,\n} from './NodeSelectionCommands.js';\n\nexport {\n\tdeleteBackwardAtGap,\n\tdeleteForwardAtGap,\n\tinsertParagraphAtGap,\n\tinsertTextAtGap,\n} from './GapCursorCommands.js';\n\nexport {\n\tfindWordBoundaryBackward,\n\tfindWordBoundaryForward,\n} from './WordBoundary.js';\n\nexport {\n\tapplyAttributedMark,\n\tgetMarkAttrAtSelection,\n\tisAttributedMarkActive,\n\tremoveAttributedMark,\n} from './AttributedMarkCommands.js';\n\nexport { forEachBlockInRange } from './RangeIterator.js';\n\n// --- Text Commands ---\n\n/** Inserts text at the current selection, replacing any selected range. */\nexport function insertTextCommand(\n\tstate: EditorState,\n\ttext: string,\n\torigin: 'input' | 'paste' = 'input',\n): Transaction {\n\tconst sel = state.selection;\n\n\t// NodeSelection: insert paragraph after void block with the text\n\tif (isNodeSelection(sel)) {\n\t\treturn insertTextAfterNodeSelection(state, sel, text, origin);\n\t}\n\n\t// GapCursor: insert paragraph at the gap position with the text\n\tif (isGapCursor(sel)) {\n\t\treturn insertTextAtGap(state, sel, text, origin);\n\t}\n\n\tconst builder = state.transaction(origin);\n\tconst marks = resolveActiveMarks(state);\n\n\tlet landingId: BlockId | undefined;\n\tif (!isCollapsed(sel)) {\n\t\tlandingId = addDeleteSelectionSteps(state, builder);\n\t}\n\n\tconst resolved = resolveInsertPoint(sel, state.getBlockOrder());\n\tconst insertBlockId: BlockId = landingId ?? resolved.blockId;\n\tconst insertOffset: number = landingId ? 0 : resolved.offset;\n\n\tbuilder.insertText(insertBlockId, insertOffset, text, marks);\n\tbuilder.setSelection(createCollapsedSelection(insertBlockId, insertOffset + text.length));\n\n\treturn builder.build();\n}\n\n/** Deletes the current selection. */\nexport function deleteSelectionCommand(state: EditorState): Transaction | null {\n\tif (isNodeSelection(state.selection)) {\n\t\treturn deleteNodeSelection(state, state.selection);\n\t}\n\tif (isGapCursor(state.selection)) return null;\n\tif (isCollapsed(state.selection)) return null;\n\n\tconst builder = state.transaction('input');\n\tconst landingId: BlockId | undefined = addDeleteSelectionSteps(state, builder);\n\n\tconst range = selectionRange(state.selection, state.getBlockOrder());\n\tconst cursorBlockId: BlockId = landingId ?? range.from.blockId;\n\tconst cursorOffset: number = landingId ? 0 : range.from.offset;\n\tbuilder.setSelection(createCollapsedSelection(cursorBlockId, cursorOffset));\n\n\treturn builder.build();\n}\n\n/** Splits the current block at the cursor position (Enter key). */\nexport function splitBlockCommand(state: EditorState): Transaction | null {\n\tconst sel = state.selection;\n\n\t// NodeSelection: insert empty paragraph after the void block\n\tif (isNodeSelection(sel)) {\n\t\treturn insertParagraphAfterNodeSelection(state, sel);\n\t}\n\n\t// GapCursor: insert empty paragraph at the gap position\n\tif (isGapCursor(sel)) {\n\t\treturn insertParagraphAtGap(state, sel);\n\t}\n\n\tconst builder = state.transaction('input');\n\n\tlet landingId: BlockId | undefined;\n\tif (!isCollapsed(sel)) {\n\t\tlandingId = addDeleteSelectionSteps(state, builder);\n\t}\n\n\tconst resolved = resolveInsertPoint(sel, state.getBlockOrder());\n\tconst blockId: BlockId = landingId ?? resolved.blockId;\n\tconst offset: number = landingId ? 0 : resolved.offset;\n\tconst newBlockId = generateBlockId();\n\n\t// splitBlock operates at the same level in the tree — the StepApplication\n\t// handles this correctly because it looks up the block by ID recursively.\n\tbuilder.splitBlock(blockId, offset, newBlockId);\n\tbuilder.setSelection(createCollapsedSelection(newBlockId, 0));\n\n\treturn builder.build();\n}\n\n/** Inserts a hard line break (InlineNode) at the current cursor position. */\nexport function insertHardBreakCommand(state: EditorState): Transaction | null {\n\tconst sel = state.selection;\n\n\tif (!isTextSelection(sel)) return null;\n\n\tconst builder = state.transaction('input');\n\n\tlet cursorBlockId: BlockId | undefined;\n\tif (!isCollapsed(sel)) {\n\t\tconst landingId: BlockId | undefined = addDeleteSelectionSteps(state, builder);\n\t\tcursorBlockId = landingId;\n\t}\n\n\tif (cursorBlockId) {\n\t\t// Cross-root deletion replaced from-block; insert hard break in landing block\n\t\tbuilder.insertInlineNode(cursorBlockId, 0, createInlineNode(inlineType('hard_break')));\n\t\tbuilder.setSelection(createCollapsedSelection(cursorBlockId, 1));\n\t} else {\n\t\tconst { blockId: insertBlockId, offset: insertOffset } = resolveInsertPoint(\n\t\t\tsel,\n\t\t\tstate.getBlockOrder(),\n\t\t);\n\t\tbuilder.insertInlineNode(\n\t\t\tinsertBlockId,\n\t\t\tinsertOffset,\n\t\t\tcreateInlineNode(inlineType('hard_break')),\n\t\t);\n\t\tbuilder.setSelection(createCollapsedSelection(insertBlockId, insertOffset + 1));\n\t}\n\n\treturn builder.build();\n}\n\n/**\n * Merges the current block with the previous block, respecting\n * isolating boundaries and void blocks.\n */\nexport function mergeBlockBackward(state: EditorState): Transaction | null {\n\treturn mergeAdjacentBlock(state, 'backward');\n}\n\n/**\n * Merges the next block into the current block, respecting\n * isolating boundaries and void blocks.\n */\nexport function mergeBlockForward(state: EditorState): Transaction | null {\n\treturn mergeAdjacentBlock(state, 'forward');\n}\n\n/**\n * Shared implementation for merging adjacent blocks in either direction.\n * Validates selection, isolating boundaries, and void blocks before merging.\n */\nfunction mergeAdjacentBlock(\n\tstate: EditorState,\n\tdirection: 'backward' | 'forward',\n): Transaction | null {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return null;\n\n\tconst blockOrder = state.getBlockOrder();\n\tconst blockIdx: number = blockOrder.indexOf(sel.anchor.blockId);\n\n\tconst adjacentIdx: number = direction === 'backward' ? blockIdx - 1 : blockIdx + 1;\n\tif (adjacentIdx < 0 || adjacentIdx >= blockOrder.length) return null;\n\n\tconst adjacentId: BlockId | undefined = blockOrder[adjacentIdx];\n\tif (!adjacentId) return null;\n\n\tif (isIsolatingBlock(state, sel.anchor.blockId) || isIsolatingBlock(state, adjacentId)) {\n\t\treturn null;\n\t}\n\tif (!sharesParent(state, sel.anchor.blockId, adjacentId)) {\n\t\tif (isInsideIsolating(state, sel.anchor.blockId)) return null;\n\t}\n\n\tif (isVoidBlock(state, adjacentId)) {\n\t\tconst path = findNodePath(state.doc, adjacentId) ?? [];\n\t\treturn state\n\t\t\t.transaction('input')\n\t\t\t.setSelection(createNodeSelection(adjacentId, path as BlockId[]))\n\t\t\t.build();\n\t}\n\n\tif (direction === 'backward') {\n\t\tconst prevBlock = state.getBlock(adjacentId);\n\t\tif (!prevBlock) return null;\n\t\tconst prevLen: number = getBlockLength(prevBlock);\n\t\treturn state\n\t\t\t.transaction('input')\n\t\t\t.mergeBlocksAt(adjacentId, sel.anchor.blockId)\n\t\t\t.setSelection(createCollapsedSelection(adjacentId, prevLen))\n\t\t\t.build();\n\t}\n\n\treturn state\n\t\t.transaction('input')\n\t\t.mergeBlocksAt(sel.anchor.blockId, adjacentId)\n\t\t.setSelection(createCollapsedSelection(sel.anchor.blockId, sel.anchor.offset))\n\t\t.build();\n}\n\n/** Selects all content in the editor, using leaf block endpoints. */\nexport function selectAll(state: EditorState): Transaction {\n\tconst blocks = state.doc.children;\n\tconst firstBlock = blocks[0];\n\tconst lastBlock = blocks[blocks.length - 1];\n\tif (!firstBlock || !lastBlock)\n\t\treturn state.transaction('command').setSelection(state.selection).build();\n\n\tconst firstLeafId: BlockId = findFirstLeafBlockId(firstBlock);\n\tconst lastLeafId: BlockId = findLastLeafBlockId(lastBlock);\n\tconst lastLeaf = state.getBlock(lastLeafId);\n\tconst lastLeafLen: number = lastLeaf ? getBlockLength(lastLeaf) : 0;\n\n\treturn state\n\t\t.transaction('command')\n\t\t.setSelection(\n\t\t\tcreateSelection(\n\t\t\t\t{ blockId: firstLeafId, offset: 0 },\n\t\t\t\t{ blockId: lastLeafId, offset: lastLeafLen },\n\t\t\t),\n\t\t)\n\t\t.build();\n}\n\n// --- Internal Helpers ---\n\nfunction resolveActiveMarks(state: EditorState): readonly Mark[] {\n\tif (state.storedMarks) return state.storedMarks;\n\tif (!isTextSelection(state.selection)) return [];\n\n\tconst block = state.getBlock(state.selection.anchor.blockId);\n\tif (!block) return [];\n\n\treturn getBlockMarksAtOffset(block, state.selection.anchor.offset);\n}\n\n/**\n * Adds steps to delete the current text selection.\n * Returns a replacement cursor block ID when the original from-block\n * was inside a composite root that got removed (undefined otherwise).\n */\nexport function addDeleteSelectionSteps(\n\tstate: EditorState,\n\tbuilder: TransactionBuilder,\n): BlockId | undefined {\n\tif (!isTextSelection(state.selection)) return undefined;\n\tconst blockOrder = state.getBlockOrder();\n\tconst range = selectionRange(state.selection, blockOrder);\n\tconst fromIdx = blockOrder.indexOf(range.from.blockId);\n\tconst toIdx = blockOrder.indexOf(range.to.blockId);\n\n\tif (fromIdx === toIdx) {\n\t\tbuilder.deleteTextAt(range.from.blockId, range.from.offset, range.to.offset);\n\t\treturn undefined;\n\t}\n\n\tconst fromRootIdx: number = getRootBlockIndex(state, range.from.blockId);\n\tconst toRootIdx: number = getRootBlockIndex(state, range.to.blockId);\n\n\tif (fromRootIdx === toRootIdx || fromRootIdx < 0 || toRootIdx < 0) {\n\t\tdeleteLeafRange(state, builder, blockOrder, range, fromIdx, toIdx);\n\t\treturn undefined;\n\t}\n\n\treturn deleteCrossRootRange(state, builder, range, fromRootIdx, toRootIdx);\n}\n\n/** Returns the root-level ancestor index in doc.children for a given block. */\nfunction getRootBlockIndex(state: EditorState, blockId: BlockId): number {\n\tconst path = findNodePath(state.doc, blockId);\n\tif (!path || path.length === 0) return -1;\n\tconst rootId: string = path[0] as string;\n\treturn state.doc.children.findIndex((c) => c.id === rootId);\n}\n\n/** Deletes a multi-block selection where all blocks share the same root ancestor. */\nfunction deleteLeafRange(\n\tstate: EditorState,\n\tbuilder: TransactionBuilder,\n\tblockOrder: readonly BlockId[],\n\trange: {\n\t\treadonly from: { readonly blockId: BlockId; readonly offset: number };\n\t\treadonly to: { readonly blockId: BlockId; readonly offset: number };\n\t},\n\tfromIdx: number,\n\ttoIdx: number,\n): void {\n\tconst firstBlock = state.getBlock(range.from.blockId);\n\tif (!firstBlock) return;\n\tconst firstLen = getBlockLength(firstBlock);\n\n\tif (range.from.offset < firstLen) {\n\t\tbuilder.deleteTextAt(range.from.blockId, range.from.offset, firstLen);\n\t}\n\n\tif (range.to.offset > 0) {\n\t\tbuilder.deleteTextAt(range.to.blockId, 0, range.to.offset);\n\t}\n\n\tfor (let i = fromIdx + 1; i < toIdx; i++) {\n\t\tconst midBlockId = blockOrder[i];\n\t\tif (!midBlockId) continue;\n\t\tconst midBlock = state.getBlock(midBlockId);\n\t\tif (!midBlock) continue;\n\t\tconst midLen = getBlockLength(midBlock);\n\t\tif (midLen > 0) {\n\t\t\tbuilder.deleteTextAt(midBlockId, 0, midLen);\n\t\t}\n\t\tbuilder.mergeBlocksAt(range.from.blockId, midBlockId);\n\t}\n\n\tbuilder.mergeBlocksAt(range.from.blockId, range.to.blockId);\n}\n\n/**\n * Deletes a selection spanning different root-level ancestors.\n * Removes intermediate and composite root blocks, merges leaf roots.\n * Returns a replacement cursor block ID if from was inside a removed composite.\n */\nfunction deleteCrossRootRange(\n\tstate: EditorState,\n\tbuilder: TransactionBuilder,\n\trange: {\n\t\treadonly from: { readonly blockId: BlockId; readonly offset: number };\n\t\treadonly to: { readonly blockId: BlockId; readonly offset: number };\n\t},\n\tfromRootIdx: number,\n\ttoRootIdx: number,\n): BlockId | undefined {\n\tconst fromRoot = state.doc.children[fromRootIdx];\n\tconst toRoot = state.doc.children[toRootIdx];\n\tif (!fromRoot || !toRoot) return undefined;\n\n\tconst fromIsLeaf: boolean = isLeafBlock(fromRoot);\n\tconst toIsLeaf: boolean = isLeafBlock(toRoot);\n\n\t// When from is inside a composite root, insert a landing paragraph\n\t// so callers can reference a surviving block for cursor/insert.\n\tlet landingId: BlockId | undefined;\n\tlet indexShift = 0;\n\n\tif (!fromIsLeaf) {\n\t\tlandingId = generateBlockId();\n\t\tbuilder.insertNode([], fromRootIdx, createEmptyParagraph(landingId));\n\t\tindexShift = 1;\n\t}\n\n\t// Delete text in from-leaf (only for leaf roots; composite roots are removed entirely)\n\tif (fromIsLeaf) {\n\t\tconst fromBlock = state.getBlock(range.from.blockId);\n\t\tif (fromBlock) {\n\t\t\tconst fromLen: number = getBlockLength(fromBlock);\n\t\t\tif (range.from.offset < fromLen) {\n\t\t\t\tbuilder.deleteTextAt(range.from.blockId, range.from.offset, fromLen);\n\t\t\t}\n\t\t}\n\t}\n\n\t// Delete text in to-leaf (only for leaf roots)\n\tif (toIsLeaf && range.to.offset > 0) {\n\t\tbuilder.deleteTextAt(range.to.blockId, 0, range.to.offset);\n\t}\n\n\t// Remove root-level blocks in descending index order.\n\t// Keep from-root if it's a leaf; remove if composite (shifted by indexShift).\n\t// Keep to-root if it's a leaf (will merge into from); remove if composite.\n\tconst removeEnd: number = toIsLeaf ? toRootIdx - 1 + indexShift : toRootIdx + indexShift;\n\tconst removeStart: number = fromIsLeaf ? fromRootIdx + 1 : fromRootIdx + indexShift;\n\n\tfor (let i = removeEnd; i >= removeStart; i--) {\n\t\tbuilder.removeNode([], i);\n\t}\n\n\t// Merge to-root into from if both are leaf roots\n\tif (fromIsLeaf && toIsLeaf) {\n\t\tbuilder.mergeBlocksAt(range.from.blockId, range.to.blockId);\n\t}\n\n\treturn landingId;\n}\n"],"mappings":"8nBAgBA,SAAgB,IACf,MAAO,CACN,UAAW,CAAC,aACZ,UAAW,CAAC,OAAQ,SAAU,aAC9B,YAAA,QAKF,SAAgB,EAAmB,GAClC,MAAO,CACN,UAAW,EAAS,eACpB,UAAW,EAAS,eACpB,YAAc,GAAiB,EAAS,YAAY,IAKtD,SAAgB,EAAc,EAAgB,GAC7C,OAAO,EAAO,UAAU,SAAS,GAIlC,SAAgB,EAAkB,EAAgB,GACjD,OAAO,EAAO,UAAU,SAAS,GCZlC,SAAgB,EACf,EACA,GAEA,GAAiB,UAAb,EAAI,KACP,OAAO,EAAgB,EAAO,GAI/B,MAAM,EAAiC,EAAM,gBACvC,EAAmB,EAAW,QAAQ,EAAI,SAEhD,GAAI,GAAY,EAAG,OAAO,KAE1B,MAAM,EAA8B,EAAW,EAAW,GAC1D,IAAK,EAAQ,OAAO,KAEpB,GAAI,EAAY,EAAO,GAAS,CAC/B,MAAM,EAAO,EAAa,EAAM,IAAK,IAAW,GAChD,OAAO,EACL,YAAY,SACZ,aAAa,EAAoB,EAAQ,IACzC,QAGH,MAAM,EAAY,EAAM,SAAS,GACjC,IAAK,EAAW,OAAO,KACvB,MAAM,EAAkB,EAAe,GACvC,OAAO,EAAM,YAAY,SAAS,aAAa,EAAyB,EAAQ,IAAU,QAU3F,SAAgB,EACf,EACA,GAEA,GAAiB,WAAb,EAAI,KACP,OAAO,EA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AiB,EAAK,GAC5B,OAAO,EAAM,IAAI,SAAS,UAAW,GAAM,EAAE,KAAO"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function t(t,r){switch(t.type){case"inline":return function(t,r){switch(r.type){case"insertText":return function(t,e){if(t.blockId!==e.blockId)return t;const o=e.text.length,r=t.from>e.offset?t.from+o:t.from,n=t.to>=e.offset?t.to+o:t.to;return r===t.from&&n===t.to?t:{...t,from:r,to:n}}(t,r);case"deleteText":return function(t,e){if(t.blockId!==e.blockId)return t;const r=e.to-e.from,n=o(t.from,e.from,e.to,r),s=o(t.to,e.from,e.to,r);return n>=s?null:n===t.from&&s===t.to?t:{...t,from:n,to:s}}(t,r);case"splitBlock":return function(t,e){return t.blockId!==e.blockId||t.to<=e.offset?t:t.from>=e.offset?{...t,blockId:e.newBlockId,from:t.from-e.offset,to:t.to-e.offset}:[{...t,to:e.offset},{...t,blockId:e.newBlockId,from:0,to:t.to-e.offset}]}(t,r);case"mergeBlocks":return function(t,e){return t.blockId!==e.sourceBlockId?t:{...t,blockId:e.targetBlockId,from:t.from+e.targetLengthBefore,to:t.to+e.targetLengthBefore}}(t,r);case"removeNode":return e(t,r);default:return t}}(t,r);case"widget":return function(t,o){switch(o.type){case"insertText":return function(t,e){if(t.blockId!==e.blockId)return t;const o=e.text.length;return t.offset>e.offset||t.offset===e.offset&&t.side>=1?{...t,offset:t.offset+o}:t}(t,o);case"deleteText":return function(t,e){if(t.blockId!==e.blockId)return t;if(t.offset>e.from&&t.offset<e.to)return null;const o=e.to-e.from;return t.offset>=e.to?{...t,offset:t.offset-o}:t}(t,o);case"splitBlock":return function(t,e){return t.blockId!==e.blockId||t.offset<e.offset?t:t.offset>e.offset?{...t,blockId:e.newBlockId,offset:t.offset-e.offset}:t.side>=1?{...t,blockId:e.newBlockId,offset:0}:t}(t,o);case"mergeBlocks":return function(t,e){return t.blockId!==e.sourceBlockId?t:{...t,blockId:e.targetBlockId,offset:t.offset+e.targetLengthBefore}}(t,o);case"removeNode":return e(t,o);default:return t}}(t,r);case"node":return function(t,o){switch(o.type){case"mergeBlocks":return function(t,e){return t.blockId===e.sourceBlockId?null:t}(t,o);case"removeNode":return e(t,o);default:return t}}(t,r)}}function e(t,e){return t.blockId===e.removedNode.id?null:t}function o(t,e,o,r){return t<=e?t:t>=o?t-r:e}function r(t,e,o,r){return{type:"inline",blockId:t,from:e,to:o,attrs:r}}function n(t,e){return{type:"node",blockId:t,attrs:e}}function s(t,e,o,r){return{type:"widget",blockId:t,offset:e,toDOM:o,side:r?.side??-1,key:r?.key}}var f=class e{static empty=new e(/* @__PURE__ */new Map);constructor(t){this.byBlock=t}static create(t){if(0===t.length)return e.empty;const o=/* @__PURE__ */new Map;for(const e of t){const t=o.get(e.blockId);t?t.push(e):o.set(e.blockId,[e])}return new e(o)}find(t){return this.byBlock.get(t)??[]}findInline(t){const e=this.byBlock.get(t);return e?e.filter(t=>"inline"===t.type):[]}findNode(t){const e=this.byBlock.get(t);return e?e.filter(t=>"node"===t.type):[]}findWidget(t){const e=this.byBlock.get(t);return e?e.filter(t=>"widget"===t.type):[]}add(t){if(0===t.length)return this;if(this.isEmpty)return e.create(t);const o=/* @__PURE__ */new Map;for(const[e,r]of this.byBlock)o.set(e,[...r]);for(const e of t){const t=o.get(e.blockId);t?t.push(e):o.set(e.blockId,[e])}return new e(o)}remove(t){const o=/* @__PURE__ */new Map;let r=!1;for(const[e,n]of this.byBlock){const s=n.filter(e=>!t(e));s.length!==n.length&&(r=!0),s.length>0&&o.set(e,s)}return r?0===o.size?e.empty:new e(o):this}merge(t){if(t.isEmpty)return this;if(this.isEmpty)return t;const o=/* @__PURE__ */new Map;for(const[e,r]of this.byBlock)o.set(e,[...r]);for(const[e,r]of t.byBlock){const t=o.get(e);t?t.push(...r):o.set(e,[...r])}return new e(o)}equals(t){if(this===t)return!0;if(this.byBlock.size!==t.byBlock.size)return!1;for(const[e,o]of this.byBlock){const r=t.byBlock.get(e);if(!r)return!1;if(!c(o,r))return!1}return!0}get isEmpty(){return 0===this.byBlock.size}map(o){if(this.isEmpty||0===o.steps.length)return this;let r=[];for(const t of this.byBlock.values())for(const e of t)r.push(e);for(const e of o.steps){const o=[];for(const n of r){const r=t(n,e);if(null!==r)if(Array.isArray(r))for(const t of r)o.push(t);else o.push(r)}r=o}return 0===r.length?e.empty:e.create(r)}};function c(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(let o=0;o<t.length;o++){const r=t[o],n=e[o];if(!r||!n||!i(r,n))return!1}return!0}function i(t,e){if(t.type!==e.type)return!1;if(t.blockId!==e.blockId)return!1;switch(t.type){case"inline":{const o=e;return t.from===o.from&&t.to===o.to&&u(t.attrs,o.attrs)}case"node":{const o=e;return u(t.attrs,o.attrs)}case"widget":{const o=e;return t.offset===o.offset&&t.side===o.side&&t.key===o.key&&t.toDOM===o.toDOM}}}function u(t,e){if(t===e)return!0;const o=Object.keys(t),r=Object.keys(e);if(o.length!==r.length)return!1;for(const n of o)if(t[n]!==e[n])return!1;return!0}export{s as a,n as i,c as n,r,f as t};
|
|
2
|
+
//# sourceMappingURL=Decoration-6dhb8k3b.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Decoration-6dhb8k3b.mjs","names":[],"sources":["../../src/decorations/PositionMapping.ts","../../src/decorations/Decoration.ts"],"sourcesContent":["/**\n * Pure functions for mapping decorations through transaction steps.\n * Handles position adjustments when the document changes — insertions,\n * deletions, splits, merges, and structural node removal.\n */\n\nimport type {\n\tDeleteTextStep,\n\tInsertTextStep,\n\tMergeBlocksStep,\n\tRemoveNodeStep,\n\tSplitBlockStep,\n\tStep,\n} from '../state/Transaction.js';\nimport type {\n\tDecoration,\n\tInlineDecoration,\n\tNodeDecoration,\n\tWidgetDecoration,\n} from './Decoration.js';\n\n/**\n * Maps a single decoration through a step.\n * Returns the mapped decoration, an array (when a split produces two),\n * or null if the decoration was deleted by the step.\n */\nexport function mapDecorationThroughStep(\n\tdeco: Decoration,\n\tstep: Step,\n): Decoration | readonly Decoration[] | null {\n\tswitch (deco.type) {\n\t\tcase 'inline':\n\t\t\treturn mapInline(deco, step);\n\t\tcase 'widget':\n\t\t\treturn mapWidget(deco, step);\n\t\tcase 'node':\n\t\t\treturn mapNode(deco, step);\n\t}\n}\n\nfunction mapInline(\n\tdeco: InlineDecoration,\n\tstep: Step,\n): InlineDecoration | readonly InlineDecoration[] | null {\n\tswitch (step.type) {\n\t\tcase 'insertText':\n\t\t\treturn mapInlineInsert(deco, step);\n\t\tcase 'deleteText':\n\t\t\treturn mapInlineDelete(deco, step);\n\t\tcase 'splitBlock':\n\t\t\treturn mapInlineSplit(deco, step);\n\t\tcase 'mergeBlocks':\n\t\t\treturn mapInlineMerge(deco, step);\n\t\tcase 'removeNode':\n\t\t\treturn removeIfBlockDeleted(deco, step);\n\t\tdefault:\n\t\t\treturn deco;\n\t}\n}\n\nfunction mapWidget(deco: WidgetDecoration, step: Step): WidgetDecoration | null {\n\tswitch (step.type) {\n\t\tcase 'insertText':\n\t\t\treturn mapWidgetInsert(deco, step);\n\t\tcase 'deleteText':\n\t\t\treturn mapWidgetDelete(deco, step);\n\t\tcase 'splitBlock':\n\t\t\treturn mapWidgetSplit(deco, step);\n\t\tcase 'mergeBlocks':\n\t\t\treturn mapWidgetMerge(deco, step);\n\t\tcase 'removeNode':\n\t\t\treturn removeIfBlockDeleted(deco, step);\n\t\tdefault:\n\t\t\treturn deco;\n\t}\n}\n\nfunction mapNode(deco: NodeDecoration, step: Step): NodeDecoration | null {\n\tswitch (step.type) {\n\t\tcase 'mergeBlocks':\n\t\t\treturn mapNodeMerge(deco, step);\n\t\tcase 'removeNode':\n\t\t\treturn removeIfBlockDeleted(deco, step);\n\t\tdefault:\n\t\t\treturn deco;\n\t}\n}\n\n// --- InsertText ---\n\nfunction mapInlineInsert(deco: InlineDecoration, step: InsertTextStep): InlineDecoration {\n\tif (deco.blockId !== step.blockId) return deco;\n\n\tconst len: number = step.text.length;\n\t// from: assoc=-1 (stays at boundary — only shifts if insertion is strictly before)\n\tconst newFrom: number = deco.from > step.offset ? deco.from + len : deco.from;\n\t// to: assoc=1 (moves past insertion — shifts if insertion is at or before)\n\tconst newTo: number = deco.to >= step.offset ? deco.to + len : deco.to;\n\n\tif (newFrom === deco.from && newTo === deco.to) return deco;\n\treturn { ...deco, from: newFrom, to: newTo };\n}\n\nfunction mapWidgetInsert(deco: WidgetDecoration, step: InsertTextStep): WidgetDecoration {\n\tif (deco.blockId !== step.blockId) return deco;\n\n\tconst len: number = step.text.length;\n\t// At boundary: side=-1 means \"before insertion\" (assoc=-1, stays), side=1 means \"after\" (moves)\n\tif (deco.offset > step.offset) {\n\t\treturn { ...deco, offset: deco.offset + len };\n\t}\n\tif (deco.offset === step.offset && deco.side >= 1) {\n\t\treturn { ...deco, offset: deco.offset + len };\n\t}\n\treturn deco;\n}\n\n// --- DeleteText ---\n\nfunction mapInlineDelete(deco: InlineDecoration, step: DeleteTextStep): InlineDecoration | null {\n\tif (deco.blockId !== step.blockId) return deco;\n\n\tconst delLen: number = step.to - step.from;\n\tconst newFrom: number = clampAndShift(deco.from, step.from, step.to, delLen);\n\tconst newTo: number = clampAndShift(deco.to, step.from, step.to, delLen);\n\n\tif (newFrom >= newTo) return null;\n\tif (newFrom === deco.from && newTo === deco.to) return deco;\n\treturn { ...deco, from: newFrom, to: newTo };\n}\n\nfunction mapWidgetDelete(deco: WidgetDecoration, step: DeleteTextStep): WidgetDecoration | null {\n\tif (deco.blockId !== step.blockId) return deco;\n\n\t// Widget strictly inside deleted range → deleted\n\tif (deco.offset > step.from && deco.offset < step.to) return null;\n\n\tconst delLen: number = step.to - step.from;\n\tif (deco.offset >= step.to) {\n\t\treturn { ...deco, offset: deco.offset - delLen };\n\t}\n\treturn deco;\n}\n\n// --- SplitBlock ---\n\nfunction mapInlineSplit(\n\tdeco: InlineDecoration,\n\tstep: SplitBlockStep,\n): InlineDecoration | readonly InlineDecoration[] {\n\tif (deco.blockId !== step.blockId) return deco;\n\n\t// Entirely before split point → unchanged\n\tif (deco.to <= step.offset) return deco;\n\n\t// Entirely after split point → move to new block, adjust offsets\n\tif (deco.from >= step.offset) {\n\t\treturn {\n\t\t\t...deco,\n\t\t\tblockId: step.newBlockId,\n\t\t\tfrom: deco.from - step.offset,\n\t\t\tto: deco.to - step.offset,\n\t\t};\n\t}\n\n\t// Spanning the split point → split into two decorations\n\tconst left: InlineDecoration = { ...deco, to: step.offset };\n\tconst right: InlineDecoration = {\n\t\t...deco,\n\t\tblockId: step.newBlockId,\n\t\tfrom: 0,\n\t\tto: deco.to - step.offset,\n\t};\n\treturn [left, right];\n}\n\nfunction mapWidgetSplit(deco: WidgetDecoration, step: SplitBlockStep): WidgetDecoration {\n\tif (deco.blockId !== step.blockId) return deco;\n\n\t// Before split → stays\n\tif (deco.offset < step.offset) return deco;\n\n\t// After split → new block\n\tif (deco.offset > step.offset) {\n\t\treturn {\n\t\t\t...deco,\n\t\t\tblockId: step.newBlockId,\n\t\t\toffset: deco.offset - step.offset,\n\t\t};\n\t}\n\n\t// At boundary: side determines which block\n\tif (deco.side >= 1) {\n\t\treturn {\n\t\t\t...deco,\n\t\t\tblockId: step.newBlockId,\n\t\t\toffset: 0,\n\t\t};\n\t}\n\treturn deco;\n}\n\n// --- MergeBlocks ---\n\nfunction mapInlineMerge(deco: InlineDecoration, step: MergeBlocksStep): InlineDecoration {\n\tif (deco.blockId !== step.sourceBlockId) return deco;\n\n\treturn {\n\t\t...deco,\n\t\tblockId: step.targetBlockId,\n\t\tfrom: deco.from + step.targetLengthBefore,\n\t\tto: deco.to + step.targetLengthBefore,\n\t};\n}\n\nfunction mapWidgetMerge(deco: WidgetDecoration, step: MergeBlocksStep): WidgetDecoration {\n\tif (deco.blockId !== step.sourceBlockId) return deco;\n\n\treturn {\n\t\t...deco,\n\t\tblockId: step.targetBlockId,\n\t\toffset: deco.offset + step.targetLengthBefore,\n\t};\n}\n\nfunction mapNodeMerge(deco: NodeDecoration, step: MergeBlocksStep): NodeDecoration | null {\n\t// Source block disappears → delete its node decoration\n\tif (deco.blockId === step.sourceBlockId) return null;\n\treturn deco;\n}\n\n// --- RemoveNode ---\n\nfunction removeIfBlockDeleted<T extends Decoration>(deco: T, step: RemoveNodeStep): T | null {\n\tif (deco.blockId === step.removedNode.id) return null;\n\treturn deco;\n}\n\n// --- Helpers ---\n\nfunction clampAndShift(pos: number, delFrom: number, delTo: number, delLen: number): number {\n\tif (pos <= delFrom) return pos;\n\tif (pos >= delTo) return pos - delLen;\n\treturn delFrom;\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 { BlockId } from '../model/TypeBrands.js';\nimport type { Transaction } from '../state/Transaction.js';\nimport { mapDecorationThroughStep } 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\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}\n\nexport type Decoration = InlineDecoration | NodeDecoration | WidgetDecoration;\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/** 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\tmap(tr: Transaction): DecorationSet {\n\t\tif (this.isEmpty || tr.steps.length === 0) 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 step of tr.steps) {\n\t\t\tconst next: Decoration[] = [];\n\t\t\tfor (const deco of mapped) {\n\t\t\t\tconst result = mapDecorationThroughStep(deco, step);\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\treturn (\n\t\t\t\ta.offset === bw.offset && a.side === bw.side && a.key === bw.key && a.toDOM === bw.toDOM\n\t\t\t);\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":"AA0BA,SAAgB,EACf,EACA,GAEA,OAAQ,EAAK,MACZ,IAAK,SACJ,OAQH,SACC,EACA,GAEA,OAAQ,EAAK,MACZ,IAAK,aACJ,OA4CH,SAAyB,EAAwB,GAChD,GAAI,EAAK,UAAY,EAAK,QAAS,OAAO,EAE1C,MAAM,EAAc,EAAK,KAAK,OAExB,EAAkB,EAAK,KAAO,EAAK,OAAS,EAAK,KAAO,EAAM,EAAK,KAEnE,EAAgB,EAAK,IAAM,EAAK,OAAS,EAAK,GAAK,EAAM,EAAK,GAEpE,OAAI,IAAY,EAAK,MAAQ,IAAU,EAAK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,IAAK,MAAM,KAAO,EACjB,GAAI,EAAE,KAAS,EAAE,GAAM,OAAO,EAE/B,OAAO"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function t(t,n,r){const o=[];return e(t,n,r,{onText(t,n){o.push({text:t,marks:n})}}),o}function n(t,n,r){const o=[];return e(t,n,r,{onText(t,n){o.push({kind:"text",text:t,marks:n})},onInline(t){o.push({kind:"inline",node:t})}}),o}function e(t,n,e,r){const i=f(t);let s=0;for(const u of i){const t=s+(o(u)?1:u.text.length);if(t<=n||s>=e)s=t;else{if(o(u))r.onInline?.(u);else{const t=Math.max(0,n-s),o=Math.min(u.text.length,e-s),i=u.text.slice(t,o);i.length>0&&r.onText(i,u.marks)}s=t}}}function r(t){return"object"==typeof t&&null!==t&&"text"===t.type&&"string"==typeof t.text}function o(t){return"object"==typeof t&&null!==t&&"inline"===t.type&&"string"==typeof t.inlineType}function i(t){return"object"==typeof t&&null!==t&&"string"==typeof t.id&&"string"==typeof t.type&&"text"!==t.type&&"inline"!==t.type&&Array.isArray(t.children)}function s(t){return t.children.every(t=>r(t)||o(t))}function u(t){return t.children.filter(t=>r(t))}function f(t){return t.children.filter(t=>r(t)||o(t))}function c(t){return t.children.filter(t=>i(t))}function l(){return`block-${crypto.randomUUID()}`}function a(t){return{children:t??[h("paragraph")]}}function h(t,n,e,r){return{id:e??l(),type:t,...r?{attrs:r}:{},children:n??[g("")]}}function g(t,n){return{type:"text",text:t,marks:n??[]}}function x(t,n){return{type:"inline",inlineType:t,attrs:n??{}}}function p(t){const n=f(t);let e="";for(const o of n)r(o)&&(e+=o.text);return e}function y(t){const n=f(t);let e=0;for(const r of n)e+=o(r)?1:r.text.length;return e}function m(t,n){const e=f(t);let i=0;for(const r of e){if(o(r)){if(n===i)return[];i+=1;continue}const t=i+r.text.length;if(n>=i&&n<t)return r.marks;if(n===i&&0===r.text.length)return r.marks;i=t}for(let o=e.length-1;o>=0;o--){const t=e[o];if(t&&r(t))return t.marks}return[]}function k(t,n){return t.length===n.length&&t.every(t=>n.some(n=>function(t,n){if(t.type!==n.type)return!1;const e=t.attrs,r=n.attrs;if(!e&&!r)return!0;if(!e||!r)return!1;const o=Object.keys(e),i=Object.keys(r);return o.length===i.length&&o.every(t=>e[t]===r[t])}(t,n)))}function d(t,n){return t.some(t=>t.type===n)}function b(t,n){return d(t,n.type)?t:[...t,n]}function j(t,n){return t.filter(t=>t.type!==n)}function v(t){if(0===t.length)return[g("")];if(t.every(t=>r(t)))return function(t){if(0===t.length)return[g("")];const n=[];for(const e of t){const t=n[n.length-1];t&&k(t.marks,e.marks)?n[n.length-1]=g(t.text+e.text,t.marks):(e.text.length>0||0===n.length)&&n.push(e)}return 0===n.length?[g("")]:n}(t);const n=[];for(const i of t){if(o(i)){n.push(i);continue}const t=n[n.length-1];t&&r(t)&&k(t.marks,i.marks)?n[n.length-1]=g(t.text+i.text,t.marks):(i.text.length>0||0===n.length)&&n.push(i)}const e=n.filter((t,e)=>{if(o(t))return!0;if(t.text.length>0)return!0;if(1===n.length)return!0;const r=n[e-1],i=n[e+1];return!(r&&o(r)||i&&o(i))});return 0===e.length?[g("")]:e.some(t=>r(t))?e:[g(""),...e]}function T(t,n){const e=f(t);let r=0,i=0;for(const s of e)if(o(s)){if(r>=n)return i;r+=1}else{if(r+s.text.length>=n)return i+(n-r);r+=s.text.length,i+=s.text.length}return i}function I(t,n){const e=f(t);for(const{child:r,from:i}of function*(t){let n=0;for(const e of t){const t=o(e)?1:e.text.length;yield{child:e,from:n,to:n+t},n+=t}}(e)){if(o(r)){if(n===i)return{kind:"inline",node:r};continue}const t=n-i;if(t>=0&&t<r.text.length)return{kind:"text",char:r.text[t]??"",marks:r.marks}}return null}export{v as C,k as S,d as _,x as a,s as b,c,m as d,t as f,u as g,f as h,a as i,n as l,I as m,T as n,g as o,p,h as r,l as s,b as t,y as u,i as v,j as w,r as x,o as y};
|
|
2
|
+
//# sourceMappingURL=Document-CkQLx84k.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Document-CkQLx84k.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 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\nexport interface BlockAttrs {\n\treadonly [key: string]: string | number | boolean;\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}\n\n/** A child of a BlockNode: text, inline element, or nested block. */\nexport type ChildNode = TextNode | InlineNode | BlockNode;\n\nexport interface BlockNode {\n\treadonly id: BlockId;\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/** Extracts TextNode segments within a block for the given offset range. */\nexport function getBlockSegmentsInRange(\n\tblock: BlockNode,\n\tfrom: number,\n\tto: number,\n): readonly TextSegment[] {\n\tconst segments: TextSegment[] = [];\n\twalkBlockRange(block, from, to, {\n\t\tonText(text: string, marks: readonly Mark[]): void {\n\t\t\tsegments.push({ text, marks });\n\t\t},\n\t});\n\treturn segments;\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\twalkBlockRange(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\ninterface BlockRangeVisitor {\n\treadonly onText: (text: string, marks: readonly Mark[]) => void;\n\treadonly onInline?: (node: InlineNode) => void;\n}\n\n/** Walks inline children within [from, to) and calls visitor callbacks for each relevant child. */\nfunction walkBlockRange(\n\tblock: BlockNode,\n\tfrom: number,\n\tto: number,\n\tvisitor: BlockRangeVisitor,\n): void {\n\tconst inlineChildren: readonly (TextNode | InlineNode)[] = getInlineChildren(block);\n\tlet pos = 0;\n\n\tfor (const child of inlineChildren) {\n\t\tconst childWidth: number = isInlineNode(child) ? 1 : child.text.length;\n\t\tconst childEnd: number = pos + childWidth;\n\n\t\tif (childEnd <= from || pos >= to) {\n\t\t\tpos = childEnd;\n\t\t\tcontinue;\n\t\t}\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 - pos);\n\t\t\tconst sliceTo: number = Math.min(child.text.length, to - pos);\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\n\t\tpos = childEnd;\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 ?? [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): BlockNode {\n\treturn {\n\t\tid: id ?? generateBlockId(),\n\t\ttype,\n\t\t...(attrs ? { attrs } : {}),\n\t\tchildren: 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: 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): InlineNode {\n\treturn {\n\t\ttype: 'inline',\n\t\tinlineType,\n\t\tattrs: attrs ?? {},\n\t};\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\tconst inlineChildren: readonly (TextNode | InlineNode)[] = getInlineChildren(block);\n\tlet len = 0;\n\tfor (const child of inlineChildren) {\n\t\tlen += isInlineNode(child) ? 1 : child.text.length;\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\tlet pos = 0;\n\n\tfor (const child of inlineChildren) {\n\t\tif (isInlineNode(child)) {\n\t\t\tif (offset === pos) return [];\n\t\t\tpos += 1;\n\t\t\tcontinue;\n\t\t}\n\t\tconst end: number = pos + child.text.length;\n\t\tif (offset >= pos && offset < end) {\n\t\t\treturn child.marks;\n\t\t}\n\t\tif (offset === pos && child.text.length === 0) {\n\t\t\treturn child.marks;\n\t\t}\n\t\tpos = end;\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/** 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/** 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/** 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\tconst inlineChildren: readonly (TextNode | InlineNode)[] = getInlineChildren(block);\n\tlet blockPos = 0;\n\tlet textPos = 0;\n\n\tfor (const child of inlineChildren) {\n\t\tif (isInlineNode(child)) {\n\t\t\tif (blockPos >= blockOffset) return textPos;\n\t\t\tblockPos += 1;\n\t\t} else {\n\t\t\tif (blockPos + child.text.length >= blockOffset) {\n\t\t\t\treturn textPos + (blockOffset - blockPos);\n\t\t\t}\n\t\t\tblockPos += child.text.length;\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\t};\n\t\t}\n\t}\n\n\treturn null;\n}\n"],"mappings":"AAwEA,SAAgB,EACf,EACA,EACA,GAEA,MAAM,EAA0B,GAMhC,OALA,EAAe,EAAO,EAAM,EAAI,CAC/B,MAAA,CAAO,EAAc,GACpB,EAAS,KAAK,CAAE,OAAM,aAGjB,EAIR,SAAgB,EACf,EACA,EACA,GAEA,MAAM,EAA6B,GASnC,OARA,EAAe,EAAO,EAAM,EAAI,CAC/B,MAAA,CAAO,EAAc,GACpB,EAAS,KAAK,CAAE,KAAM,OAAQ,OAAM,WAErC,QAAA,CAAS,GACR,EAAS,KAAK,CAAE,KAAM,SAAU,YAG3B,EASR,SAAS,EACR,EACA,EACA,EACA,GAEA,MAAM,EAAqD,EAAkB,GAC7E,IAAI,EAAM,EAEV,IAAK,MAAM,KAAS,EAAgB,CACnC,MACM,EAAmB,GADE,EAAa,GAAS,EAAI,EAAM,KAAK,QAGhE,GAAI,GAAY,GAAQ,GAAO,EAC9B,EAAM,MADP,CAKA,GAAI,EAAa,GAChB,EAAQ,WAAW,OACb,CACN,MAAM,EAAoB,KAAK,IAAI,EAAG,EAAO,GACvC,EAAkB,KAAK,IAAI,EAAM,KAAK,OAAQ,EAAK,GACnD,EAAe,EAAM,KAAK,MAAM,EAAW,GAC7C,EAAK,OAAS,GACjB,EAAQ,OAAO,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EAAW,EACX,EAAU,EAEd,IAAK,MAAM,KAAS,EACnB,GAAI,EAAa,GAAQ,CACxB,GAAI,GAAY,EAAa,OAAO,EACpC,GAAY,MACN,CACN,GAAI,EAAW,EAAM,KAAK,QAAU,EACnC,OAAO,GAAW,EAAc,GAEjC,GAAY,EAAM,KAAK,OACvB,GAAW,EAAM,KAAK,OAIxB,OAAO,EAIR,SAAgB,EACf,EACA,GAKA,MAAM,EAAqD,EAAkB,GAE7E,IAAK,MAAM,MAAE,EAAA,KAAO,KAnDrB,UAAmC,GAKlC,IAAI,EAAM,EACV,IAAK,MAAM,KAAS,EAAU,CAC7B,MAAM,EAAgB,EAAa,GAAS,EAAI,EAAM,KAAK,YACrD,CAAE,QAAO,KAAM,EAAK,GAAI,EAAM,GACpC,GAAO,GA0CsB,CAAkB,GAAiB,CAChE,GAAI,EAAa,GAAQ,CACxB,GAAI,IAAW,EAAM,MAAO,CAAE,KAAM,SAAU,KAAM,GACpD,SAED,MAAM,EAAsB,EAAS,EACrC,GAAI,GAAe,GAAK,EAAc,EAAM,KAAK,OAChD,MAAO,CACN,KAAM,OACN,KAAM,EAAM,KAAK,IAAgB,GACjC,MAAO,EAAM,OAKhB,OAAO"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{t}from"./rolldown-runtime-B8Ku5yk6.mjs";import{a as e,i as o,o as r,r as s}from"./Document-CkQLx84k.mjs";import{a as n,i,r as c}from"./TypeBrands-BQR8dEYU.mjs";import{t as a}from"./HTMLUtils-BLwp5G4f.mjs";import{n as l,r as u}from"./DocumentSerializer-bwcxM9WV.mjs";import f from"dompurify";var d=/* @__PURE__ */t({parseHTMLToDocument:()=>p});function p(t,e,r){const s=e?e.getAllowedTags():["p","br","div","span"],n=e?e.getAllowedAttrs():["style","dir"];r?.styleMap&&!n.includes("class")&&n.push("class");const i=document.createElement("template");i.innerHTML=f.sanitize(t,{ALLOWED_TAGS:s,ALLOWED_ATTR:n,ALLOWED_URI_REGEXP:a});const c=i.content;r?.styleMap&&function(t,e){const o=t.querySelectorAll("[class]");for(const r of Array.from(o)){const t=r,o=Array.from(t.classList),s=[];for(const r of o){const o=e.get(r);if(o){const e=t.getAttribute("style")??"",n=e&&!e.endsWith(";")?"; ":"";t.setAttribute("style",e+n+o),s.push(r)}}for(const e of s)t.classList.remove(e)}}(c,r.styleMap);const l=e?.getBlockParseRules()??[],u=[];for(const o of Array.from(c.childNodes))h(o,u,l,e);return 0===u.length?o():o(u)}function h(t,e,o,i){if(t.nodeType===Node.ELEMENT_NODE){const c=t,a=c.tagName.toLowerCase();if("ul"===a||"ol"===a){const t="ol"===a?"ordered":"bullet",o=c.getAttribute("dir");return void y(c,t,0,e,i,o&&u.has(o)?o:void 0)}if("table"===a)return void function(t,e,o){const r=[],i=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 r of Array.from(o.children))"tr"===r.tagName.toLowerCase()&&e.push(r)}return e}(t);for(const c of i){const t=[];for(const e of Array.from(c.children)){const r=e.tagName.toLowerCase();if("td"!==r&&"th"!==r)continue;const i=e,c=A(i,o),a={};m(i,a);const l=s(n("table_cell"),c,void 0,Object.keys(a).length>0?a:void 0);t.push(l)}t.length>0&&r.push(s(n("table_row"),t))}if(r.length>0){const o={};!function(t,e){const o=t.getAttribute("style")??"",r=g.exec(o);r?.[1]&&(e.borderColor="transparent"===r[1]?"none":r[1])}(t,o),e.push(s(n("table"),r,void 0,Object.keys(o).length>0?o:void 0))}}(c,e,i);const l=function(t,e){const o=t.tagName.toLowerCase();for(const r of e)if(r.rule.tag===o){if(r.rule.getAttrs){const e=r.rule.getAttrs(t);if(!1===e)continue;return{type:r.type,attrs:e}}return{type:r.type}}return null}(c,o);if(l){const t=i?.getNodeSpec(l.type),o=t?.isVoid?[r("")]:b(c,i),a={...l.attrs};return t?.attrs?.align&&T(c,a),t?.attrs?.dir&&v(c,a),void e.push(s(n(l.type),o,void 0,Object.keys(a).length>0?a:void 0))}const f=b(c,i),d={};T(c,d),v(c,d),e.push(s(n("paragraph"),f,void 0,Object.keys(d).length>0?d:void 0))}else t.nodeType===Node.TEXT_NODE&&t.textContent?.trim()&&e.push(s(n("paragraph"),[r(t.textContent.trim())]))}function y(t,e,o,r,i,c){for(const a of Array.from(t.children)){const t=a.tagName.toLowerCase();if("li"===t){const t=a,l=t.querySelector(':scope > input[type="checkbox"]'),f=null!==l,d=l?.hasAttribute("checked")??!1,p=f?"checklist":e,h=b(t,i,!0),g={listType:p,indent:o,checked:d},m=t.getAttribute("dir"),A=m&&u.has(m)?m:c;A&&(g.dir=A),r.push(s(n("list_item"),h,void 0,g));for(const e of Array.from(t.children)){const t=e.tagName.toLowerCase();if("ul"===t||"ol"===t){const s="ol"===t?"ordered":"bullet",n=e.getAttribute("dir");y(e,s,o+1,r,i,n&&u.has(n)?n:A)}}}else if("ul"===t||"ol"===t){const e="ol"===t?"ordered":"bullet",s=a.getAttribute("dir");y(a,e,o+1,r,i,s&&u.has(s)?s:c)}}}var g=/--ntbl-bc:\s*(#[0-9a-fA-F]{3,8}|transparent)/;function m(t,e){const o=t.getAttribute("colspan");if(o){const t=Number.parseInt(o,10);t>1&&(e.colspan=t)}const r=t.getAttribute("rowspan");if(r){const t=Number.parseInt(r,10);t>1&&(e.rowspan=t)}}function A(t,e){const o=e?.getBlockParseRules()??[],r=[];for(const s of Array.from(t.childNodes))h(s,r,o,e);if(0===r.length){const o=b(t,e);r.push(s(n("paragraph"),o))}return r}function b(t,e,o){const s=[];return N(t,[],s,e?.getMarkParseRules()??[],e?.getInlineParseRules()??[],o),s.length>0?s:[r("")]}function N(t,o,s,n,a,l){if(t.nodeType===Node.TEXT_NODE){const e=t.textContent??"";return void(e&&s.push(r(e,[...o])))}if(t.nodeType!==Node.ELEMENT_NODE)return;const u=t,f=u.tagName.toLowerCase();if(l&&("ul"===f||"ol"===f))return;if(l&&"input"===f&&"checkbox"===u.getAttribute("type"))return;for(const r of a)if(r.rule.tag===f){if(r.rule.getAttrs){const t=r.rule.getAttrs(u);if(!1===t)continue;return void s.push(e(c(r.type),t))}return void s.push(e(c(r.type)))}const d=[...o],p=/* @__PURE__ */new Set;for(const e of n)if(e.rule.tag===f&&!p.has(e.type))if(e.rule.getAttrs){const t=e.rule.getAttrs(u);if(!1===t)continue;d.some(t=>t.type===e.type)||(d.push({type:i(e.type),...Object.keys(t).length>0?{attrs:t}:{}}),p.add(e.type))}else d.some(t=>t.type===e.type)||(d.push({type:i(e.type)}),p.add(e.type));for(const e of Array.from(u.childNodes))N(e,d,s,n,a,l)}function v(t,e){const o=t.getAttribute("dir");if(o&&u.has(o))return void(e.dir=o);const r=t.style?.direction??"";r&&u.has(r)&&(e.dir=r)}var L={left:"start",right:"end"};function T(t,e){let o=t.style?.textAlign??"";const r=L[o];if(r&&(o=r),o&&l.has(o))e.align=o;else for(const s of Array.from(t.classList)){let t=s.match(/^notectl-align-(\w+)$/)?.[1];const o=L[t??""];if(o&&(t=o),t&&l.has(t))return void(e.align=t)}}export{p as n,d as t};
|
|
2
|
+
//# sourceMappingURL=DocumentParser-QJUmtPp9.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DocumentParser-QJUmtPp9.mjs","names":[],"sources":["../../src/serialization/DocumentParser.ts"],"sourcesContent":["/**\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 DOMPurify from 'dompurify';\nimport type { BlockNode, Document, InlineNode, Mark, TextNode } from '../model/Document.js';\nimport {\n\tcreateBlockNode,\n\tcreateDocument,\n\tcreateInlineNode,\n\tcreateTextNode,\n} from '../model/Document.js';\nimport { SAFE_URI_REGEXP } 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 { VALID_ALIGNMENTS, VALID_DIRECTIONS } from './DocumentSerializer.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'];\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 = DOMPurify.sanitize(html, {\n\t\tALLOWED_TAGS: allowedTags,\n\t\tALLOWED_ATTR: allowedAttrs,\n\t\tALLOWED_URI_REGEXP: SAFE_URI_REGEXP,\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\tconst blockRules = registry?.getBlockParseRules() ?? [];\n\tconst blocks: BlockNode[] = [];\n\n\tfor (const child of Array.from(root.childNodes)) {\n\t\tparseChildNode(child, blocks, blockRules, registry);\n\t}\n\n\tif (blocks.length === 0) return createDocument();\n\treturn createDocument(blocks);\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\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, 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, 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\tundefined,\n\t\t\t\t\tObject.keys(attrs).length > 0 ? attrs : undefined,\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\tundefined,\n\t\t\t\tObject.keys(attrs).length > 0 ? attrs : undefined,\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\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 inlineContent = parseElementToInlineContent(li, registry, true);\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(createBlockNode(nodeType('list_item'), inlineContent, undefined, attrs));\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(liChild, nestedType, depth + 1, blocks, registry, nestedEffectiveDir);\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(child, nestedType, depth + 1, blocks, registry, nestedEffectiveDir);\n\t\t}\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(tableEl: Element, blocks: BlockNode[], registry?: SchemaRegistry): void {\n\tconst rows: BlockNode[] = [];\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, 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\tundefined,\n\t\t\t\tObject.keys(cellAttrs).length > 0 ? cellAttrs : undefined,\n\t\t\t);\n\t\t\tcells.push(cellBlock);\n\t\t}\n\n\t\tif (cells.length > 0) {\n\t\t\trows.push(createBlockNode(nodeType('table_row'), cells));\n\t\t}\n\t}\n\n\tif (rows.length > 0) {\n\t\tconst tableAttrs: Record<string, string | number | boolean> = {};\n\t\textractTableBorderColor(tableEl as HTMLElement, tableAttrs);\n\t\tblocks.push(\n\t\t\tcreateBlockNode(\n\t\t\t\tnodeType('table'),\n\t\t\t\trows,\n\t\t\t\tundefined,\n\t\t\t\tObject.keys(tableAttrs).length > 0 ? tableAttrs : undefined,\n\t\t\t),\n\t\t);\n\t}\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(\n\tel: HTMLElement,\n\tattrs: Record<string, string | number | boolean>,\n): 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 = Number.parseInt(colspan, 10);\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 = Number.parseInt(rowspan, 10);\n\t\tif (value > 1) attrs.rowspan = value;\n\t}\n}\n\n/** Parses a table cell's content into blocks, supporting all block types (lists, quotes, etc.). */\nfunction parseTableCellContent(cellEl: HTMLElement, registry?: SchemaRegistry): BlockNode[] {\n\tconst blockRules = registry?.getBlockParseRules() ?? [];\n\tconst cellBlocks: BlockNode[] = [];\n\n\tfor (const child of Array.from(cellEl.childNodes)) {\n\t\tparseChildNode(child, cellBlocks, blockRules, registry);\n\t}\n\n\t// No blocks produced: treat entire cell content as one paragraph\n\tif (cellBlocks.length === 0) {\n\t\tconst inlineContent = parseElementToInlineContent(cellEl, registry);\n\t\tcellBlocks.push(createBlockNode(nodeType('paragraph'), inlineContent));\n\t}\n\n\treturn cellBlocks;\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\tconst result: (TextNode | InlineNode)[] = [];\n\tconst markRules = registry?.getMarkParseRules() ?? [];\n\tconst inlineRules = registry?.getInlineParseRules() ?? [];\n\twalkElement(el, [], result, markRules, inlineRules, skipNestedLists);\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),\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tresult.push(createInlineNode(inlineType(entry.type) as InlineTypeName));\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/** 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":"8VA6BA,SAAgB,EACf,EACA,EACA,GAEA,MAAM,EAAwB,EAAW,EAAS,iBAAmB,CAAC,IAAK,KAAM,MAAO,QAClF,EAAyB,EAAW,EAAS,kBAAoB,CAAC,QAAS,OAI7E,GAAS,WAAa,EAAa,SAAS,UAC/C,EAAa,KAAK,SAGnB,MAAM,EAAW,SAAS,cAAc,YACxC,EAAS,UAAY,EAAU,SAAS,EAAM,CAC7C,aAAc,EACd,aAAc,EACd,mBAAoB,IAErB,MAAM,EAAyB,EAAS,QAGpC,GAAS,UAgad,SAA0B,EAAwB,GACjD,MAAM,EAAgC,EAAK,iBAAiB,WAC5D,IAAK,MAAM,KAAM,MAAM,KAAK,GAAW,CACtC,MAAM,EAAS,EACT,EAAoB,MAAM,KAAK,EAAO,WACtC,EAAqB,GAE3B,IAAK,MAAM,KAAO,EAAS,CAC1B,MAAM,EAAmC,EAAS,IAAI,GACtD,GAAI,EAAc,CAEjB,MAAM,EAAmB,EAAO,aAAa,UAAY,GACnD,EAAoB,IAAa,EAAS,SAAS,KAAO,KAAO,GACvE,EAAO,aAAa,QAAS,EAAW,EAAY,GACpD,EAAS,KAAK,IAKhB,IAAK,MAAM,KAAO,EACjB,EAAO,UAAU,OAAO,IAnbzB,CAAiB,EAAM,EAAQ,UAGhC,MAAM,EAAa,GAAU,sBAAwB,GAC/C,EAAsB,GAE5B,IAAK,MAAM,KAAS,MAAM,KAAK,EAAK,YACnC,EAAe,EAAO,EAAQ,EAAY,GAG3C,OAAsB,IAAlB,EAAO,OAAqB,IACzB,EAAe,GAQvB,SAAS,EACR,EACA,EACA,EACA,GAEA,GAAI,EAAM,WAAa,KA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M,KAAM,GAAM,EAAE,OAAS,EAAM,QACvC,EAAM,KAAK,CAAE,KAAM,EAAS,EAAM,QAClC,EAAa,IAAI,EAAM,OAK1B,IAAK,MAAM,KAAS,MAAM,KAAK,EAAG,YACjC,EAAY,EAAO,EAAO,EAAQ,EAAW,EAAa,GAK5D,SAAS,EAAiB,EAAiB,GAC1C,MAAM,EAAqB,EAAG,aAAa,OAC3C,GAAI,GAAO,EAAiB,IAAI,GAE/B,YADA,EAAM,IAAM,GAKb,MAAM,EAAmB,EAAG,OAAO,WAAa,GAC5C,GAAY,EAAiB,IAAI,KACpC,EAAM,IAAM,GAKd,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"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{t}from"./rolldown-runtime-B8Ku5yk6.mjs";import{S as e,b as s,c as n,h as r,x as o,y as i}from"./Document-CkQLx84k.mjs";import{r as l}from"./AttrRegistry-B1iBFcKO.mjs";import{n as c,r as a,t as p}from"./HTMLUtils-BLwp5G4f.mjs";import f from"dompurify";function u(t){let e=2166136261;for(let s=0;s<t.length;s++)e^=t.charCodeAt(s),e=Math.imul(e,16777619);return(e>>>0).toString(36).padStart(6,"0")}var g=class{classMap=/* @__PURE__ */new Map;usedHashes=/* @__PURE__ */new Set;getClassName(t){const e=function(t){return t.split(";").map(t=>t.trim()).filter(t=>t.length>0).sort().join("; ")}(t),s=this.classMap.get(e);if(s)return s;let n=u(e),r=0;for(;this.usedHashes.has(n);)r++,n=u(e+String(r));const o=`notectl-s-${n}`;return this.usedHashes.add(n),this.classMap.set(e,o),o}getAlignmentClassName(t){const e=`text-align: ${t}`,s=this.classMap.get(e);if(s)return s;const n=`notectl-align-${t}`;return this.classMap.set(e,n),n}toCSS(){if(0===this.classMap.size)return"";const t=[];for(const[e,s]of this.classMap)t.push(`.${s} { ${e}; }`);return t.join("\n")}toStyleMap(){const t=/* @__PURE__ */new Map;for(const[e,s]of this.classMap)t.set(s,e);return t}};function h(t){const e=t.getMarkTypes(),s=/* @__PURE__ */new Map;for(const n of e){const e=t.getMarkSpec(n);e&&s.set(n,e.rank??99)}return s}function d(t,e,s,n,r){if(""===t)return"";let o=a(t);if(0===e.length)return o;const i=n??h(s),l=[...e].sort((t,e)=>(i.get(t.type)??99)-(i.get(e.type)??99)),c=[],p=[];for(const a of l){const t=s.getMarkSpec(a.type);if(t?.toHTMLStyle){const e=t.toHTMLStyle(a);e&&c.push(e)}else p.push(a)}if(c.length>0){const t=c.join("; "),e=r?r.styleAttr(t):` style="${t}"`;e&&(o=`<span${e}>${o}</span>`)}for(const a of p){const t=s.getMarkSpec(a.type);t?.toHTMLString&&(o=t.toHTMLString(a,o,r))}return o}function y(t,e,s,n,r,o){if(""===t)return"";let i=a(t);if(0===e.length)return i;const l=r??h(s),c=[...e].sort((t,e)=>(l.get(t.type)??99)-(l.get(e.type)??99)),p=[],f=[];for(const a of c){const t=s.getMarkSpec(a.type);if(t?.toHTMLStyle){const e=t.toHTMLStyle(a);e&&p.push(e)}else f.push(a)}if(p.length>0){const t=p.join("; ");i=`<span class="${n.getClassName(t)}">${i}</span>`}for(const a of f){const t=s.getMarkSpec(a.type);t?.toHTMLString&&(i=t.toHTMLString(a,i,o))}return i}var m=/* @__PURE__ */t({VALID_ALIGNMENTS:()=>M,VALID_DIRECTIONS:()=>$,serializeDocumentToCSS:()=>A,serializeDocumentToHTML:()=>x}),M=new Set(["start","center","end","justify"]),S={left:"start",right:"end"},$=new Set(["ltr","rtl"]);function L(t){return{styleAttr:e=>e?` class="${t.getClassName(e)}"`:""}}function T(t,e,s){const n=function(t){let e=t.indexOf("<");for(;e>=0;){const s=t[e+1];if(s&&/[A-Za-z]/.test(s)){let s;for(let n=e+2;n<t.length;n++){const r=t[n]??"";if(s)r===s&&(s=void 0);else if('"'!==r&&"'"!==r){if(">"===r)return{start:e,end:n}}else s=r}return}e=t.indexOf("<",e+1)}}(t);if(!n)return t;const r=t.slice(n.start,n.end+1),o=new RegExp(`\\s${e}\\s*=\\s*("([^"]*)"|'([^']*)')`),i=r.match(o);if(i){const l=i[2]??i[3]??"";if("style"===e&&/(?:^|;)\s*text-align\s*:/i.test(l))return t;const c=` ${e}="${l}${"style"===e?"; ":" "}${s}"`,a=r.replace(o,c);return`${t.slice(0,n.start)}${a}${t.slice(n.end+1)}`}const l=r.endsWith("/>")?`${r.slice(0,-2)} ${e}="${s}"/>`:`${r.slice(0,-1)} ${e}="${s}">`;return`${t.slice(0,n.start)}${l}${t.slice(n.end+1)}`}function x(t,e){const s={registry:e,exportCtx:{styleAttr:t=>t?` style="${t}"`:""}},n=k(t.children,s),r=e?e.getAllowedTags():["p","br","div","span"],o=e?e.getAllowedAttrs():["style","dir"];return f.sanitize(n,{ALLOWED_TAGS:r,ALLOWED_ATTR:o,ALLOWED_URI_REGEXP:p})}function A(t,e){const s=new g,n={registry:e,collector:s,exportCtx:L(s)},r=k(t.children,n),o=e?e.getAllowedTags():["p","br","div","span"],i=e?e.getAllowedAttrs():["style","class","dir"];i.includes("class")||i.push("class");const l=i.filter(t=>"style"!==t);return{html:f.sanitize(r,{ALLOWED_TAGS:o,ALLOWED_ATTR:l,ALLOWED_URI_REGEXP:p}),css:s.toCSS(),styleMap:s.toStyleMap()}}function k(t,e){const s=[];let n=0;for(;n<t.length;){const r=t[n];if(r)if(l(r,"list_item")){const r=[];for(;n<t.length;){const e=t[n];if(!e||!l(e,"list_item"))break;r.push(e),n++}s.push(H(r,e))}else s.push(w(r,e)),n++;else n++}return s.join("")}function H(t,e){const s=[],n=[];for(let r=0;r<t.length;r++){const o=t[r];if(!o)continue;const i=o.attrs?.listType??"bullet",l=o.attrs?.indent??0,c="ordered"===i?"ol":"ul";for(;n.length>0;){const t=n[n.length-1];if(!t)break;if(t.indent>l)s.push(`</${t.tag}></li>`),n.pop();else{if(t.indent!==l||t.tag===c)break;s.push(`</${t.tag}></li>`),n.pop()}}if(0===n.length)s.push(`<${c}>`),n.push({tag:c,indent:l});else{const t=n[n.length-1];t&&l>t.indent&&(s.push(`<${c}>`),n.push({tag:c,indent:l}))}const a=w(o,e),p=t[r+1],f=p?p.attrs?.indent??0:void 0;void 0!==f&&f>l?s.push(C(a)):s.push(a)}for(;n.length>0;){const t=n.pop();if(!t)break;s.push(`</${t.tag}>`),n.length>0&&s.push("</li>")}return s.join("")}function C(t){return t.endsWith("</li>")?t.slice(0,-5):t}function w(t,l){const p=s(t)?function(t,s){const n=function(t){if(t.length<=1)return t;const s=[];for(const n of t){if(i(n)){s.push(n);continue}const t=s[s.length-1];t&&o(t)&&e(t.marks,n.marks)?s[s.length-1]={type:"text",text:t.text+n.text,marks:t.marks}:s.push(n)}return s}(r(t)),l=[],c=s.registry?h(s.registry):void 0;for(const e of n)if(i(e)){const t=s.registry?.getInlineNodeSpec(e.inlineType);t?.toHTMLString&&l.push(t.toHTMLString(e))}else s.registry&&s.collector?l.push(y(e.text,e.marks,s.registry,s.collector,c,s.exportCtx)):s.registry?l.push(d(e.text,e.marks,s.registry,c,s.exportCtx)):""!==e.text&&l.push(a(e.text));return l.join("")}(t,l):k(n(t),l),f=l.registry?.getNodeSpec(t.type);let u;u=f?.toHTML?f.toHTML(t,p,l.exportCtx):`<p>${p||"<br>"}</p>`;const g=t.attrs?.align,m=g?S[g]??g:void 0;if(m&&"start"!==m&&M.has(m)){const t=c(m);if(l.collector){const t=l.collector.getAlignmentClassName(m);u=T(u,"class",c(t))}else u=T(u,"style",`text-align: ${t}`)}const L=t.attrs?.dir;if(L&&$.has(L)){const t=u.indexOf(">");u.slice(0,t+1).includes(" dir=")||(u=T(u,"dir",c(L)))}return u}export{x as a,A as i,M as n,h as o,$ as r,d as s,m as t};
|
|
2
|
+
//# sourceMappingURL=DocumentSerializer-bwcxM9WV.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DocumentSerializer-bwcxM9WV.mjs","names":[],"sources":["../../src/serialization/CSSClassCollector.ts","../../src/serialization/MarkSerializer.ts","../../src/serialization/DocumentSerializer.ts"],"sourcesContent":["/**\n * CSSClassCollector: maps CSS declarations to unique class names during serialization.\n * Deduplicates identical declaration sets and produces a minimal stylesheet.\n * Uses content-hash (FNV-1a) for deterministic, document-order-independent class names.\n */\n\n/** Prefix for generated style class names (avoids collisions with user classes). */\nconst CLASS_PREFIX = 'notectl-s-';\n\n/** Base for hash encoding output. */\nconst HASH_BASE = 36;\n/** Pad length for consistent 6-char hashes. */\nconst HASH_PAD_LENGTH = 6;\n\n/**\n * Normalizes a CSS declarations string by sorting individual declarations alphabetically.\n * This ensures `\"color: red; font-size: 14px\"` and `\"font-size: 14px; color: red\"` map\n * to the same class name.\n */\nfunction normalizeDeclarations(declarations: string): string {\n\treturn declarations\n\t\t.split(';')\n\t\t.map((d) => d.trim())\n\t\t.filter((d) => d.length > 0)\n\t\t.sort()\n\t\t.join('; ');\n}\n\n/** FNV-1a 32-bit offset basis. */\nconst FNV_OFFSET_BASIS = 0x811c9dc5;\n/** FNV-1a 32-bit prime. */\nconst FNV_PRIME = 0x01000193;\n\n/**\n * FNV-1a 32-bit hash function.\n * Fast, no crypto dependency, excellent distribution for short strings.\n */\nfunction fnv1aHash(input: string): string {\n\tlet hash: number = FNV_OFFSET_BASIS;\n\tfor (let i = 0; i < input.length; i++) {\n\t\thash ^= input.charCodeAt(i);\n\t\thash = Math.imul(hash, FNV_PRIME);\n\t}\n\t// Convert to unsigned 32-bit, then to base-36, padded to 6 chars\n\tconst unsigned: number = hash >>> 0;\n\treturn unsigned.toString(HASH_BASE).padStart(HASH_PAD_LENGTH, '0');\n}\n\n/**\n * Stateful collector that assigns CSS class names to unique declaration sets.\n * Used during a single serialization pass, then produces the collected stylesheet.\n *\n * Class names are deterministic: the same declarations always produce the same\n * class name, regardless of encounter order across documents.\n */\nexport class CSSClassCollector {\n\t/** Maps normalized declarations → class name. */\n\tprivate readonly classMap: Map<string, string> = new Map();\n\t/** Tracks used hashes to handle the (extremely rare) collision case. */\n\tprivate readonly usedHashes: Set<string> = new Set();\n\n\t/**\n\t * Returns the class name for the given CSS declarations.\n\t * If the same (normalized) declarations were seen before, returns the existing class.\n\t */\n\tgetClassName(declarations: string): string {\n\t\tconst normalized: string = normalizeDeclarations(declarations);\n\t\tconst existing: string | undefined = this.classMap.get(normalized);\n\t\tif (existing) return existing;\n\n\t\tlet hash: string = fnv1aHash(normalized);\n\t\tlet suffix = 0;\n\t\t// Collision handling: append suffix counter if the hash is already in use\n\t\t// for a different declarations string\n\t\twhile (this.usedHashes.has(hash)) {\n\t\t\tsuffix++;\n\t\t\thash = fnv1aHash(normalized + String(suffix));\n\t\t}\n\n\t\tconst className: string = `${CLASS_PREFIX}${hash}`;\n\t\tthis.usedHashes.add(hash);\n\t\tthis.classMap.set(normalized, className);\n\t\treturn className;\n\t}\n\n\t/**\n\t * Returns the semantic alignment class name for a given alignment value.\n\t * Unlike style classes, alignment classes use descriptive names.\n\t */\n\tgetAlignmentClassName(alignment: string): string {\n\t\tconst declarations: string = `text-align: ${alignment}`;\n\t\tconst existing: string | undefined = this.classMap.get(declarations);\n\t\tif (existing) return existing;\n\n\t\tconst className = `notectl-align-${alignment}`;\n\t\tthis.classMap.set(declarations, className);\n\t\treturn className;\n\t}\n\n\t/** Produces CSS rules for all collected classes. Returns empty string if none collected. */\n\ttoCSS(): string {\n\t\tif (this.classMap.size === 0) return '';\n\n\t\tconst rules: string[] = [];\n\t\tfor (const [declarations, className] of this.classMap) {\n\t\t\trules.push(`.${className} { ${declarations}; }`);\n\t\t}\n\t\treturn rules.join('\\n');\n\t}\n\n\t/**\n\t * Returns a map from class name → CSS declarations for round-trip support.\n\t * Used by `setContentHTML` to rehydrate class-based HTML.\n\t */\n\ttoStyleMap(): ReadonlyMap<string, string> {\n\t\tconst map = new Map<string, string>();\n\t\tfor (const [declarations, className] of this.classMap) {\n\t\t\tmap.set(className, declarations);\n\t\t}\n\t\treturn map;\n\t}\n}\n","/**\n * MarkSerializer: shared mark serialization logic for DocumentSerializer and ClipboardHandler.\n * Separates style-based marks (merged into a single `<span style>`) from tag-based marks\n * (nested wrappers in rank order).\n */\n\nimport type { Mark } from '../model/Document.js';\nimport { escapeHTML } from '../model/HTMLUtils.js';\nimport type { MarkSpec } from '../model/MarkSpec.js';\nimport type { HTMLExportContext } from '../model/NodeSpec.js';\nimport type { SchemaRegistry } from '../model/SchemaRegistry.js';\nimport type { CSSClassCollector } from './CSSClassCollector.js';\n\n/** Builds a map of mark type name to rank from the registry (compute once per pass). */\nexport function buildMarkOrder(registry: SchemaRegistry): Map<string, number> {\n\tconst types: readonly string[] = registry.getMarkTypes();\n\tconst order = new Map<string, number>();\n\tfor (const t of types) {\n\t\tconst spec: MarkSpec | undefined = registry.getMarkSpec(t);\n\t\tif (spec) order.set(t, spec.rank ?? 99);\n\t}\n\treturn order;\n}\n\n/**\n * Serializes text with marks to HTML.\n * Style-based marks (`toHTMLStyle`) are merged into a single `<span style=\"...\">`.\n * Tag-based marks (`toHTMLString`) wrap the content in rank order.\n */\nexport function serializeMarksToHTML(\n\ttext: string,\n\tmarks: readonly Mark[],\n\tregistry: SchemaRegistry,\n\tmarkOrder?: Map<string, number>,\n\texportCtx?: HTMLExportContext,\n): string {\n\tif (text === '') return '';\n\n\tlet html: string = escapeHTML(text);\n\n\tif (marks.length === 0) return html;\n\n\tconst order: Map<string, number> = markOrder ?? buildMarkOrder(registry);\n\tconst sortedMarks: Mark[] = [...marks].sort(\n\t\t(a, b) => (order.get(a.type) ?? 99) - (order.get(b.type) ?? 99),\n\t);\n\n\tconst styleParts: string[] = [];\n\tconst tagMarks: Mark[] = [];\n\n\tfor (const mark of sortedMarks) {\n\t\tconst markSpec: MarkSpec | undefined = registry.getMarkSpec(mark.type);\n\t\tif (markSpec?.toHTMLStyle) {\n\t\t\tconst style: string | null = markSpec.toHTMLStyle(mark);\n\t\t\tif (style) {\n\t\t\t\tstyleParts.push(style);\n\t\t\t}\n\t\t} else {\n\t\t\ttagMarks.push(mark);\n\t\t}\n\t}\n\n\t// Wrap with merged style span first (closest to text)\n\tif (styleParts.length > 0) {\n\t\tconst declarations: string = styleParts.join('; ');\n\t\tconst attr: string = exportCtx ? exportCtx.styleAttr(declarations) : ` style=\"${declarations}\"`;\n\t\tif (attr) {\n\t\t\thtml = `<span${attr}>${html}</span>`;\n\t\t}\n\t}\n\n\t// Then wrap with tag-based marks in rank order\n\tfor (const mark of tagMarks) {\n\t\tconst markSpec: MarkSpec | undefined = registry.getMarkSpec(mark.type);\n\t\tif (markSpec?.toHTMLString) {\n\t\t\thtml = markSpec.toHTMLString(mark, html, exportCtx);\n\t\t}\n\t}\n\n\treturn html;\n}\n\n/**\n * Serializes text with marks to HTML using CSS class names instead of inline styles.\n * Style-based marks (`toHTMLStyle`) are collected into a `CSSClassCollector` and emitted\n * as `<span class=\"...\">`. Tag-based marks (`toHTMLString`) wrap identically to the inline path.\n */\nexport function serializeMarksToClassHTML(\n\ttext: string,\n\tmarks: readonly Mark[],\n\tregistry: SchemaRegistry,\n\tcollector: CSSClassCollector,\n\tmarkOrder?: Map<string, number>,\n\texportCtx?: HTMLExportContext,\n): string {\n\tif (text === '') return '';\n\n\tlet html: string = escapeHTML(text);\n\n\tif (marks.length === 0) return html;\n\n\tconst order: Map<string, number> = markOrder ?? buildMarkOrder(registry);\n\tconst sortedMarks: Mark[] = [...marks].sort(\n\t\t(a, b) => (order.get(a.type) ?? 99) - (order.get(b.type) ?? 99),\n\t);\n\n\tconst styleParts: string[] = [];\n\tconst tagMarks: Mark[] = [];\n\n\tfor (const mark of sortedMarks) {\n\t\tconst markSpec: MarkSpec | undefined = registry.getMarkSpec(mark.type);\n\t\tif (markSpec?.toHTMLStyle) {\n\t\t\tconst style: string | null = markSpec.toHTMLStyle(mark);\n\t\t\tif (style) {\n\t\t\t\tstyleParts.push(style);\n\t\t\t}\n\t\t} else {\n\t\t\ttagMarks.push(mark);\n\t\t}\n\t}\n\n\t// Wrap with class-based span (closest to text)\n\tif (styleParts.length > 0) {\n\t\tconst declarations: string = styleParts.join('; ');\n\t\tconst className: string = collector.getClassName(declarations);\n\t\thtml = `<span class=\"${className}\">${html}</span>`;\n\t}\n\n\t// Then wrap with tag-based marks in rank order\n\tfor (const mark of tagMarks) {\n\t\tconst markSpec: MarkSpec | undefined = registry.getMarkSpec(mark.type);\n\t\tif (markSpec?.toHTMLString) {\n\t\t\thtml = markSpec.toHTMLString(mark, html, exportCtx);\n\t\t}\n\t}\n\n\treturn html;\n}\n","/**\n * DocumentSerializer: converts an immutable Document into sanitized HTML.\n * Pure functions — operates on Document/SchemaRegistry, no class state.\n */\n\nimport DOMPurify from 'dompurify';\nimport { isNodeOfType } from '../model/AttrRegistry.js';\nimport type { BlockNode, Document, InlineNode, TextNode } from '../model/Document.js';\nimport {\n\tgetBlockChildren,\n\tgetInlineChildren,\n\tisInlineNode,\n\tisLeafBlock,\n\tisTextNode,\n\tmarkSetsEqual,\n} from '../model/Document.js';\nimport { SAFE_URI_REGEXP, escapeAttr, escapeHTML } from '../model/HTMLUtils.js';\nimport type { HTMLExportContext } from '../model/NodeSpec.js';\nimport type { SchemaRegistry } from '../model/SchemaRegistry.js';\nimport { CSSClassCollector } from './CSSClassCollector.js';\nimport type { ContentCSSResult } from './ContentHTMLTypes.js';\nimport {\n\tbuildMarkOrder,\n\tserializeMarksToClassHTML,\n\tserializeMarksToHTML,\n} from './MarkSerializer.js';\n\n/** Internal context threaded through all serialization helpers. */\ninterface SerializerContext {\n\treadonly registry?: SchemaRegistry;\n\treadonly collector?: CSSClassCollector;\n\treadonly exportCtx?: HTMLExportContext;\n}\n\n/** Known-safe alignment values accepted by the serializer (defense-in-depth). */\nexport const VALID_ALIGNMENTS: ReadonlySet<string> = new Set(['start', 'center', 'end', 'justify']);\n\n/** Legacy physical → logical alignment mapping (mirrors DocumentParser). */\nconst LEGACY_ALIGNMENT_MAP: Readonly<Record<string, string>> = { left: 'start', right: 'end' };\n\n/** Known-safe direction values (defense-in-depth). `auto` is excluded — it's the default. */\nexport const VALID_DIRECTIONS: ReadonlySet<string> = new Set(['ltr', 'rtl']);\n\n/** Creates an HTMLExportContext for inline style mode. */\nfunction createInlineExportContext(): HTMLExportContext {\n\treturn {\n\t\tstyleAttr(declarations: string): string {\n\t\t\tif (!declarations) return '';\n\t\t\treturn ` style=\"${declarations}\"`;\n\t\t},\n\t};\n}\n\n/** Creates an HTMLExportContext for CSS class mode. */\nfunction createClassExportContext(collector: CSSClassCollector): HTMLExportContext {\n\treturn {\n\t\tstyleAttr(declarations: string): string {\n\t\t\tif (!declarations) return '';\n\t\t\tconst className: string = collector.getClassName(declarations);\n\t\t\treturn ` class=\"${className}\"`;\n\t\t},\n\t};\n}\n\n/**\n * Injects or merges an attribute into the first opening tag of an HTML fragment.\n * Values are expected to be pre-escaped by the caller.\n */\nfunction injectAttrIntoFirstTag(html: string, attr: string, value: string): string {\n\tconst firstTagRange: { start: number; end: number } | undefined = findFirstOpeningTagRange(html);\n\tif (!firstTagRange) return html;\n\tconst firstTag: string = html.slice(firstTagRange.start, firstTagRange.end + 1);\n\tconst pattern: RegExp = new RegExp(`\\\\s${attr}\\\\s*=\\\\s*(\\\"([^\\\"]*)\\\"|'([^']*)')`);\n\tconst existing: RegExpMatchArray | null = firstTag.match(pattern);\n\tif (existing) {\n\t\tconst existingValue: string = existing[2] ?? existing[3] ?? '';\n\t\tif (attr === 'style' && /(?:^|;)\\s*text-align\\s*:/i.test(existingValue)) {\n\t\t\treturn html;\n\t\t}\n\t\tconst sep: string = attr === 'style' ? '; ' : ' ';\n\t\tconst mergedAttr: string = ` ${attr}=\"${existingValue}${sep}${value}\"`;\n\t\tconst nextFirstTag: string = firstTag.replace(pattern, mergedAttr);\n\t\treturn `${html.slice(0, firstTagRange.start)}${nextFirstTag}${html.slice(firstTagRange.end + 1)}`;\n\t}\n\tconst isSelfClosing: boolean = firstTag.endsWith('/>');\n\tconst injectedFirstTag: string = isSelfClosing\n\t\t? `${firstTag.slice(0, -2)} ${attr}=\"${value}\"/>`\n\t\t: `${firstTag.slice(0, -1)} ${attr}=\"${value}\">`;\n\treturn `${html.slice(0, firstTagRange.start)}${injectedFirstTag}${html.slice(firstTagRange.end + 1)}`;\n}\n\n/** Finds the first opening tag range, treating `>` inside quotes as attribute text. */\nfunction findFirstOpeningTagRange(html: string): { start: number; end: number } | undefined {\n\tlet start: number = html.indexOf('<');\n\twhile (start >= 0) {\n\t\tconst nextChar: string | undefined = html[start + 1];\n\t\tif (nextChar && /[A-Za-z]/.test(nextChar)) {\n\t\t\tlet quote: '\"' | \"'\" | undefined;\n\t\t\tfor (let i = start + 2; i < html.length; i++) {\n\t\t\t\tconst char: string = html[i] ?? '';\n\t\t\t\tif (quote) {\n\t\t\t\t\tif (char === quote) quote = undefined;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (char === '\"' || char === \"'\") {\n\t\t\t\t\tquote = char;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (char === '>') {\n\t\t\t\t\treturn { start, end: i };\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn undefined;\n\t\t}\n\t\tstart = html.indexOf('<', start + 1);\n\t}\n\treturn undefined;\n}\n\n/** Serializes a full document to sanitized HTML, wrapping list items in `<ul>`/`<ol>`. */\nexport function serializeDocumentToHTML(doc: Document, registry?: SchemaRegistry): string {\n\tconst exportCtx: HTMLExportContext = createInlineExportContext();\n\tconst ctx: SerializerContext = { registry, exportCtx };\n\tconst html: string = serializeBlocks(doc.children, ctx);\n\n\tconst allowedTags: string[] = registry ? registry.getAllowedTags() : ['p', 'br', 'div', 'span'];\n\tconst allowedAttrs: string[] = registry ? registry.getAllowedAttrs() : ['style', 'dir'];\n\n\treturn DOMPurify.sanitize(html, {\n\t\tALLOWED_TAGS: allowedTags,\n\t\tALLOWED_ATTR: allowedAttrs,\n\t\tALLOWED_URI_REGEXP: SAFE_URI_REGEXP,\n\t});\n}\n\n/**\n * Serializes a document to HTML with CSS class names instead of inline styles.\n * Returns the HTML and a collected stylesheet with only the rules actually used.\n */\nexport function serializeDocumentToCSS(doc: Document, registry?: SchemaRegistry): ContentCSSResult {\n\tconst collector = new CSSClassCollector();\n\tconst exportCtx: HTMLExportContext = createClassExportContext(collector);\n\tconst ctx: SerializerContext = { registry, collector, exportCtx };\n\tconst html: string = serializeBlocks(doc.children, ctx);\n\n\tconst allowedTags: string[] = registry ? registry.getAllowedTags() : ['p', 'br', 'div', 'span'];\n\tconst allowedAttrs: string[] = registry ? registry.getAllowedAttrs() : ['style', 'class', 'dir'];\n\n\t// In class mode, allow `class` attribute through DOMPurify\n\tif (!allowedAttrs.includes('class')) {\n\t\tallowedAttrs.push('class');\n\t}\n\n\t// Defense-in-depth: strip `style` attribute in class mode to guarantee\n\t// zero inline styles — even from third-party plugins that forgot to use ctx.styleAttr().\n\tconst filteredAttrs: string[] = allowedAttrs.filter((a) => a !== 'style');\n\n\tconst sanitizedHTML: string = DOMPurify.sanitize(html, {\n\t\tALLOWED_TAGS: allowedTags,\n\t\tALLOWED_ATTR: filteredAttrs,\n\t\tALLOWED_URI_REGEXP: SAFE_URI_REGEXP,\n\t});\n\n\treturn { html: sanitizedHTML, css: collector.toCSS(), styleMap: collector.toStyleMap() };\n}\n\n/** Serializes a sequence of blocks to HTML, grouping consecutive list items into wrappers. */\nfunction serializeBlocks(blocks: readonly BlockNode[], ctx: SerializerContext): string {\n\tconst parts: string[] = [];\n\tlet i = 0;\n\n\twhile (i < blocks.length) {\n\t\tconst block: BlockNode | undefined = blocks[i];\n\t\tif (!block) {\n\t\t\ti++;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (isNodeOfType(block, 'list_item')) {\n\t\t\t// Collect consecutive list items\n\t\t\tconst listItems: BlockNode[] = [];\n\t\t\twhile (i < blocks.length) {\n\t\t\t\tconst item: BlockNode | undefined = blocks[i];\n\t\t\t\tif (!item || !isNodeOfType(item, 'list_item')) break;\n\t\t\t\tlistItems.push(item);\n\t\t\t\ti++;\n\t\t\t}\n\t\t\tparts.push(serializeListGroup(listItems, ctx));\n\t\t} else {\n\t\t\tparts.push(serializeBlock(block, ctx));\n\t\t\ti++;\n\t\t}\n\t}\n\n\treturn parts.join('');\n}\n\n/**\n * Serializes a group of consecutive list items into properly nested `<ul>`/`<ol>` wrappers.\n * Uses a stack-based algorithm to handle indent-based nesting.\n * Produces valid HTML5: nested lists open *inside* the parent `<li>`.\n */\nfunction serializeListGroup(items: readonly BlockNode[], ctx: SerializerContext): string {\n\tconst parts: string[] = [];\n\tconst stack: { tag: string; indent: number }[] = [];\n\n\tfor (let idx = 0; idx < items.length; idx++) {\n\t\tconst item: BlockNode | undefined = items[idx];\n\t\tif (!item) continue;\n\n\t\tconst listType: string = (item.attrs?.listType as string) ?? 'bullet';\n\t\tconst indent: number = (item.attrs?.indent as number) ?? 0;\n\t\tconst tag: string = listType === 'ordered' ? 'ol' : 'ul';\n\t\t// Pop wrapper levels that are deeper than current indent,\n\t\t// or at the same level when the tag type changes\n\t\twhile (stack.length > 0) {\n\t\t\tconst top = stack[stack.length - 1];\n\t\t\tif (!top) break;\n\n\t\t\tif (top.indent > indent) {\n\t\t\t\tparts.push(`</${top.tag}></li>`);\n\t\t\t\tstack.pop();\n\t\t\t} else if (top.indent === indent && top.tag !== tag) {\n\t\t\t\tparts.push(`</${top.tag}></li>`);\n\t\t\t\tstack.pop();\n\t\t\t} else {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif (stack.length === 0) {\n\t\t\tparts.push(`<${tag}>`);\n\t\t\tstack.push({ tag, indent });\n\t\t} else {\n\t\t\tconst top = stack[stack.length - 1];\n\t\t\tif (top && indent > top.indent) {\n\t\t\t\tparts.push(`<${tag}>`);\n\t\t\t\tstack.push({ tag, indent });\n\t\t\t}\n\t\t}\n\n\t\tconst content: string = serializeBlock(item, ctx);\n\n\t\t// Look ahead: if the next item is deeper, strip </li> so the nested\n\t\t// list opens inside this <li> (valid HTML5 nesting).\n\t\tconst nextItem: BlockNode | undefined = items[idx + 1];\n\t\tconst nextIndent: number | undefined = nextItem\n\t\t\t? ((nextItem.attrs?.indent as number) ?? 0)\n\t\t\t: undefined;\n\n\t\tif (nextIndent !== undefined && nextIndent > indent) {\n\t\t\tparts.push(stripTrailingLiClose(content));\n\t\t} else {\n\t\t\tparts.push(content);\n\t\t}\n\t}\n\n\t// Close all remaining open wrappers\n\twhile (stack.length > 0) {\n\t\tconst top = stack.pop();\n\t\tif (!top) break;\n\t\tparts.push(`</${top.tag}>`);\n\t\tif (stack.length > 0) {\n\t\t\tparts.push('</li>');\n\t\t}\n\t}\n\n\treturn parts.join('');\n}\n\n/** Removes the trailing `</li>` from serialized list item HTML. */\nfunction stripTrailingLiClose(html: string): string {\n\tconst suffix = '</li>';\n\tif (html.endsWith(suffix)) {\n\t\treturn html.slice(0, -suffix.length);\n\t}\n\treturn html;\n}\n\n/** Serializes a single block to HTML using its NodeSpec. */\nfunction serializeBlock(block: BlockNode, ctx: SerializerContext): string {\n\tconst content: string = isLeafBlock(block)\n\t\t? serializeInlineContent(block, ctx)\n\t\t: serializeBlocks(getBlockChildren(block), ctx);\n\tconst spec = ctx.registry?.getNodeSpec(block.type);\n\n\tlet html: string;\n\tif (spec?.toHTML) {\n\t\thtml = spec.toHTML(block, content, ctx.exportCtx);\n\t} else {\n\t\thtml = `<p>${content || '<br>'}</p>`;\n\t}\n\n\t// Inject alignment into the first opening tag (validated against allowlist).\n\tconst rawAlign: string | undefined = (block.attrs as Record<string, unknown>)?.align as\n\t\t| string\n\t\t| undefined;\n\tconst align: string | undefined = rawAlign\n\t\t? (LEGACY_ALIGNMENT_MAP[rawAlign] ?? rawAlign)\n\t\t: undefined;\n\tif (align && align !== 'start' && VALID_ALIGNMENTS.has(align)) {\n\t\tconst safeAlign: string = escapeAttr(align);\n\t\tif (ctx.collector) {\n\t\t\tconst className: string = ctx.collector.getAlignmentClassName(align);\n\t\t\thtml = injectAttrIntoFirstTag(html, 'class', escapeAttr(className));\n\t\t} else {\n\t\t\thtml = injectAttrIntoFirstTag(html, 'style', `text-align: ${safeAlign}`);\n\t\t}\n\t}\n\n\t// Defense-in-depth: inject dir into the first opening tag if not already present.\n\t// NodeSpec toHTML may already inject it; this ensures it survives even without a plugin.\n\tconst dir: string | undefined = (block.attrs as Record<string, unknown>)?.dir as\n\t\t| string\n\t\t| undefined;\n\tif (dir && VALID_DIRECTIONS.has(dir)) {\n\t\tconst firstTagEnd: number = html.indexOf('>');\n\t\tconst firstTag: string = html.slice(0, firstTagEnd + 1);\n\t\tif (!firstTag.includes(' dir=')) {\n\t\t\thtml = injectAttrIntoFirstTag(html, 'dir', escapeAttr(dir));\n\t\t}\n\t}\n\n\treturn html;\n}\n\n/** Serializes inline children (TextNode + InlineNode) of a block. */\nfunction serializeInlineContent(block: BlockNode, ctx: SerializerContext): string {\n\tconst children: readonly (TextNode | InlineNode)[] = getInlineChildren(block);\n\tconst merged: readonly (TextNode | InlineNode)[] = mergeAdjacentTextNodes(children);\n\tconst parts: string[] = [];\n\tconst markOrder: Map<string, number> | undefined = ctx.registry\n\t\t? buildMarkOrder(ctx.registry)\n\t\t: undefined;\n\n\tfor (const child of merged) {\n\t\tif (isInlineNode(child)) {\n\t\t\tconst inlineSpec = ctx.registry?.getInlineNodeSpec(child.inlineType);\n\t\t\tif (inlineSpec?.toHTMLString) {\n\t\t\t\tparts.push(inlineSpec.toHTMLString(child));\n\t\t\t}\n\t\t} else if (ctx.registry && ctx.collector) {\n\t\t\tparts.push(\n\t\t\t\tserializeMarksToClassHTML(\n\t\t\t\t\tchild.text,\n\t\t\t\t\tchild.marks,\n\t\t\t\t\tctx.registry,\n\t\t\t\t\tctx.collector,\n\t\t\t\t\tmarkOrder,\n\t\t\t\t\tctx.exportCtx,\n\t\t\t\t),\n\t\t\t);\n\t\t} else if (ctx.registry) {\n\t\t\tparts.push(\n\t\t\t\tserializeMarksToHTML(child.text, child.marks, ctx.registry, markOrder, ctx.exportCtx),\n\t\t\t);\n\t\t} else if (child.text !== '') {\n\t\t\tparts.push(escapeHTML(child.text));\n\t\t}\n\t}\n\n\treturn parts.join('');\n}\n\n/**\n * Merges adjacent TextNodes that share identical mark sets.\n * InlineNodes act as merge boundaries.\n */\nfunction mergeAdjacentTextNodes(\n\tchildren: readonly (TextNode | InlineNode)[],\n): readonly (TextNode | InlineNode)[] {\n\tif (children.length <= 1) return children;\n\n\tconst result: (TextNode | InlineNode)[] = [];\n\n\tfor (const child of children) {\n\t\tif (isInlineNode(child)) {\n\t\t\tresult.push(child);\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst prev: TextNode | InlineNode | undefined = result[result.length - 1];\n\t\tif (prev && isTextNode(prev) && markSetsEqual(prev.marks, child.marks)) {\n\t\t\tresult[result.length - 1] = {\n\t\t\t\ttype: 'text',\n\t\t\t\ttext: prev.text + child.text,\n\t\t\t\tmarks: prev.marks,\n\t\t\t};\n\t\t} else {\n\t\t\tresult.push(child);\n\t\t}\n\t}\n\n\treturn result;\n}\n"],"mappings":"kQAqCA,SAAS,EAAU,GAClB,IAAI,EAToB,WAUxB,IAAK,IAAI,EAAI,EAAG,EAAI,EAAM,OAAQ,IACjC,GAAQ,EAAM,WAAW,GACzB,EAAO,KAAK,KAAK,EAVD,UAcjB,OADyB,IAAS,GAClB,SAnCC,IAmCmB,SAjCb,EAiCuC,KAU/D,IAAa,EAAb,MAEC,wBAAiD,IAAI,IAErD,0BAA2C,IAAI,IAM/C,YAAA,CAAa,GACZ,MAAM,EA/CR,SAA+B,GAC9B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