@notectl/core 1.7.3 → 2.0.0
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/LICENSE +21 -0
- package/README.md +56 -31
- package/custom-elements.json +350 -6
- package/dist/chunks/AttrRegistry-B2AGfTE0.mjs +2 -0
- package/dist/chunks/AttrRegistry-B2AGfTE0.mjs.map +1 -0
- package/dist/chunks/AttributedMarkCommands-BB7lzFct.mjs +2 -0
- package/dist/chunks/{AttributedMarkCommands-BtLea72z.mjs.map → AttributedMarkCommands-BB7lzFct.mjs.map} +1 -1
- package/dist/chunks/BlockTypePickerRegistry-DcSE6IXB.mjs +2 -0
- package/dist/chunks/BlockTypePickerRegistry-DcSE6IXB.mjs.map +1 -0
- package/dist/chunks/ColorGrid-CpkbKfXg.mjs +2 -0
- package/dist/chunks/ColorGrid-CpkbKfXg.mjs.map +1 -0
- package/dist/chunks/ColorPickerPopup-DRzFvt7o.mjs +2 -0
- package/dist/chunks/ColorPickerPopup-DRzFvt7o.mjs.map +1 -0
- package/dist/chunks/ColorValidation-DCSKq9B2.mjs +2 -0
- package/dist/chunks/{ColorValidation-CV4f1wu6.mjs.map → ColorValidation-DCSKq9B2.mjs.map} +1 -1
- package/dist/chunks/Commands-P9wS8qtN.mjs +2 -0
- package/dist/chunks/Commands-P9wS8qtN.mjs.map +1 -0
- package/dist/chunks/Decoration-D49mFXrH.mjs +2 -0
- package/dist/chunks/Decoration-D49mFXrH.mjs.map +1 -0
- package/dist/chunks/Document-BFYAonMF.mjs +2 -0
- package/dist/chunks/{Document-Brtw2jL1.mjs.map → Document-BFYAonMF.mjs.map} +1 -1
- package/dist/chunks/DocumentParser-DFcvVMGY.mjs +2 -0
- package/dist/chunks/DocumentParser-DFcvVMGY.mjs.map +1 -0
- package/dist/chunks/DomUtils-Cdz1eDKM.mjs +2 -0
- package/dist/chunks/DomUtils-Cdz1eDKM.mjs.map +1 -0
- package/dist/chunks/HTMLUtils-CCvQ5f83.mjs +2 -0
- package/dist/chunks/HTMLUtils-CCvQ5f83.mjs.map +1 -0
- package/dist/chunks/HeadingPlugin-DYy3IoT_.mjs +2 -0
- package/dist/chunks/HeadingPlugin-DYy3IoT_.mjs.map +1 -0
- package/dist/chunks/KeyboardNav-DsYhKKuV.mjs +2 -0
- package/dist/chunks/KeyboardNav-DsYhKKuV.mjs.map +1 -0
- package/dist/chunks/LocaleService-B6Z-wyAF.mjs +2 -0
- package/dist/chunks/LocaleService-B6Z-wyAF.mjs.map +1 -0
- package/dist/chunks/MarkCommands-B_erV7zz.mjs +2 -0
- package/dist/chunks/{MarkCommands-6RUJ4L3r.mjs.map → MarkCommands-B_erV7zz.mjs.map} +1 -1
- package/dist/chunks/NavigationQueries-ogQuObz7.mjs +2 -0
- package/dist/chunks/NavigationQueries-ogQuObz7.mjs.map +1 -0
- package/dist/chunks/NotectlEditor-4NFnXLyD.mjs +2 -0
- package/dist/chunks/NotectlEditor-4NFnXLyD.mjs.map +1 -0
- package/dist/chunks/Platform-CU6itXZo.mjs +2 -0
- package/dist/chunks/Platform-CU6itXZo.mjs.map +1 -0
- package/dist/chunks/Plugin-OzM8Oxm_.mjs +2 -0
- package/dist/chunks/Plugin-OzM8Oxm_.mjs.map +1 -0
- package/dist/chunks/PluginHelpers-DjZt0pQi.mjs +2 -0
- package/dist/chunks/PluginHelpers-DjZt0pQi.mjs.map +1 -0
- package/dist/chunks/PopupManager-BM8IT6M7.mjs +2 -0
- package/dist/chunks/PopupManager-BM8IT6M7.mjs.map +1 -0
- package/dist/chunks/PopupPositioning-DtvqMSop.mjs +2 -0
- package/dist/chunks/PopupPositioning-DtvqMSop.mjs.map +1 -0
- package/dist/chunks/PrintTypes-ehbL7ipA.mjs +2 -0
- package/dist/chunks/PrintTypes-ehbL7ipA.mjs.map +1 -0
- package/dist/chunks/RangeIterator-CNI6smOg.mjs +2 -0
- package/dist/chunks/{RangeIterator-Bh4Vl_6D.mjs.map → RangeIterator-CNI6smOg.mjs.map} +1 -1
- package/dist/chunks/Selection-6-W6Flxc.mjs +2 -0
- package/dist/chunks/{Selection-BRTab5hO.mjs.map → Selection-6-W6Flxc.mjs.map} +1 -1
- package/dist/chunks/SelectionTransactions-q71GEzgE.mjs +2 -0
- package/dist/chunks/SelectionTransactions-q71GEzgE.mjs.map +1 -0
- package/dist/chunks/ShortcutFormatting-BLKS0Gys.mjs +2 -0
- package/dist/chunks/ShortcutFormatting-BLKS0Gys.mjs.map +1 -0
- package/dist/chunks/StyleRuntime-BmsLoEa8.mjs +2 -0
- package/dist/chunks/{StyleRuntime-CP4NCwKT.mjs.map → StyleRuntime-BmsLoEa8.mjs.map} +1 -1
- package/dist/chunks/TextDirectionLocale-DB_aqrMg.mjs +2 -0
- package/dist/chunks/TextDirectionLocale-DB_aqrMg.mjs.map +1 -0
- package/dist/chunks/TypeBrands-Bp_Z_o5Y.mjs +2 -0
- package/dist/chunks/{TypeBrands-C09nE2qO.mjs.map → TypeBrands-Bp_Z_o5Y.mjs.map} +1 -1
- package/dist/chunks/ar-B93SPJT7.mjs +2 -0
- package/dist/chunks/ar-B93SPJT7.mjs.map +1 -0
- package/dist/chunks/ar-BAmGa08u.mjs +2 -0
- package/dist/chunks/ar-BAmGa08u.mjs.map +1 -0
- package/dist/chunks/ar-BYNFEVLc.mjs +2 -0
- package/dist/chunks/ar-BYNFEVLc.mjs.map +1 -0
- package/dist/chunks/ar-Bnc7y8BP.mjs +2 -0
- package/dist/chunks/ar-Bnc7y8BP.mjs.map +1 -0
- package/dist/chunks/ar-Bp3rDZky.mjs +2 -0
- package/dist/chunks/ar-Bp3rDZky.mjs.map +1 -0
- package/dist/chunks/ar-BtOQ7lro.mjs +2 -0
- package/dist/chunks/ar-BtOQ7lro.mjs.map +1 -0
- package/dist/chunks/ar-C5JEHhw9.mjs +2 -0
- package/dist/chunks/ar-C5JEHhw9.mjs.map +1 -0
- package/dist/chunks/ar-CL3QL0tw.mjs +2 -0
- package/dist/chunks/ar-CL3QL0tw.mjs.map +1 -0
- package/dist/chunks/ar-CYtG-XlN.mjs +2 -0
- package/dist/chunks/ar-CYtG-XlN.mjs.map +1 -0
- package/dist/chunks/ar-CzVj8p__.mjs +2 -0
- package/dist/chunks/ar-CzVj8p__.mjs.map +1 -0
- package/dist/chunks/ar-D7PS3e2g.mjs +2 -0
- package/dist/chunks/ar-D7PS3e2g.mjs.map +1 -0
- package/dist/chunks/ar-D8adM2Uy.mjs +2 -0
- package/dist/chunks/ar-D8adM2Uy.mjs.map +1 -0
- package/dist/chunks/ar-D9jyShaB.mjs +2 -0
- package/dist/chunks/ar-D9jyShaB.mjs.map +1 -0
- package/dist/chunks/ar-DR6OA3ZO.mjs +2 -0
- package/dist/chunks/ar-DR6OA3ZO.mjs.map +1 -0
- package/dist/chunks/ar-Deibepjm.mjs +2 -0
- package/dist/chunks/ar-Deibepjm.mjs.map +1 -0
- package/dist/chunks/ar-Dlb5riUN.mjs +2 -0
- package/dist/chunks/ar-Dlb5riUN.mjs.map +1 -0
- package/dist/chunks/ar-DmmxE2W7.mjs +2 -0
- package/dist/chunks/ar-DmmxE2W7.mjs.map +1 -0
- package/dist/chunks/ar-Ds6Z2Gzf.mjs +2 -0
- package/dist/chunks/ar-Ds6Z2Gzf.mjs.map +1 -0
- package/dist/chunks/ar-DtIHQ8nU.mjs +2 -0
- package/dist/chunks/ar-DtIHQ8nU.mjs.map +1 -0
- package/dist/chunks/ar-J8B-on-0.mjs +2 -0
- package/dist/chunks/ar-J8B-on-0.mjs.map +1 -0
- package/dist/chunks/ar-iU02mRe5.mjs +2 -0
- package/dist/chunks/ar-iU02mRe5.mjs.map +1 -0
- package/dist/chunks/ar-mSCYQYnL.mjs +2 -0
- package/dist/chunks/ar-mSCYQYnL.mjs.map +1 -0
- package/dist/chunks/color-picker-Byjl_xr9.mjs +2 -0
- package/dist/chunks/color-picker-Byjl_xr9.mjs.map +1 -0
- package/dist/chunks/de-8aCC5jBM.mjs +2 -0
- package/dist/chunks/de-8aCC5jBM.mjs.map +1 -0
- package/dist/chunks/de-B4y4ndUw.mjs +2 -0
- package/dist/chunks/de-B4y4ndUw.mjs.map +1 -0
- package/dist/chunks/de-B5fcZ0FQ.mjs +2 -0
- package/dist/chunks/de-B5fcZ0FQ.mjs.map +1 -0
- package/dist/chunks/de-BT9VmwoJ.mjs +2 -0
- package/dist/chunks/de-BT9VmwoJ.mjs.map +1 -0
- package/dist/chunks/de-BZWSyJTG.mjs +2 -0
- package/dist/chunks/de-BZWSyJTG.mjs.map +1 -0
- package/dist/chunks/de-CFD_Wgik.mjs +2 -0
- package/dist/chunks/de-CFD_Wgik.mjs.map +1 -0
- package/dist/chunks/de-CLYtb6kD.mjs +2 -0
- package/dist/chunks/de-CLYtb6kD.mjs.map +1 -0
- package/dist/chunks/de-CP5v-98M.mjs +2 -0
- package/dist/chunks/de-CP5v-98M.mjs.map +1 -0
- package/dist/chunks/de-CYJ6uWno.mjs +2 -0
- package/dist/chunks/de-CYJ6uWno.mjs.map +1 -0
- package/dist/chunks/de-ChcKkF7A.mjs +2 -0
- package/dist/chunks/de-ChcKkF7A.mjs.map +1 -0
- package/dist/chunks/de-CicoU066.mjs +2 -0
- package/dist/chunks/de-CicoU066.mjs.map +1 -0
- package/dist/chunks/de-CjLAdBt2.mjs +2 -0
- package/dist/chunks/de-CjLAdBt2.mjs.map +1 -0
- package/dist/chunks/de-CtFvAXwF.mjs +2 -0
- package/dist/chunks/de-CtFvAXwF.mjs.map +1 -0
- package/dist/chunks/de-D1OAXtxJ.mjs +2 -0
- package/dist/chunks/de-D1OAXtxJ.mjs.map +1 -0
- package/dist/chunks/de-DBbzCQrm.mjs +2 -0
- package/dist/chunks/de-DBbzCQrm.mjs.map +1 -0
- package/dist/chunks/de-DOLwx_M7.mjs +2 -0
- package/dist/chunks/de-DOLwx_M7.mjs.map +1 -0
- package/dist/chunks/de-De2miMxo.mjs +2 -0
- package/dist/chunks/de-De2miMxo.mjs.map +1 -0
- package/dist/chunks/de-OTfhhinm.mjs +2 -0
- package/dist/chunks/de-OTfhhinm.mjs.map +1 -0
- package/dist/chunks/de-PZ9-LlBp.mjs +2 -0
- package/dist/chunks/de-PZ9-LlBp.mjs.map +1 -0
- package/dist/chunks/de-UREymH-5.mjs +2 -0
- package/dist/chunks/de-UREymH-5.mjs.map +1 -0
- package/dist/chunks/de-chYdoK9q.mjs +2 -0
- package/dist/chunks/de-chYdoK9q.mjs.map +1 -0
- package/dist/chunks/de-xJh5C_pk.mjs +2 -0
- package/dist/chunks/de-xJh5C_pk.mjs.map +1 -0
- package/dist/chunks/es-B9UhsaEI.mjs +2 -0
- package/dist/chunks/es-B9UhsaEI.mjs.map +1 -0
- package/dist/chunks/es-BHGwPgrP.mjs +2 -0
- package/dist/chunks/es-BHGwPgrP.mjs.map +1 -0
- package/dist/chunks/es-BbGOZGS_.mjs +2 -0
- package/dist/chunks/es-BbGOZGS_.mjs.map +1 -0
- package/dist/chunks/es-BjPsub0k.mjs +2 -0
- package/dist/chunks/es-BjPsub0k.mjs.map +1 -0
- package/dist/chunks/es-Bk0bRDFE.mjs +2 -0
- package/dist/chunks/es-Bk0bRDFE.mjs.map +1 -0
- package/dist/chunks/es-BkS6DsrM.mjs +2 -0
- package/dist/chunks/es-BkS6DsrM.mjs.map +1 -0
- package/dist/chunks/es-BzEpr4Bk.mjs +2 -0
- package/dist/chunks/es-BzEpr4Bk.mjs.map +1 -0
- package/dist/chunks/es-C2lnWyA0.mjs +2 -0
- package/dist/chunks/es-C2lnWyA0.mjs.map +1 -0
- package/dist/chunks/es-C7e35Muh.mjs +2 -0
- package/dist/chunks/es-C7e35Muh.mjs.map +1 -0
- package/dist/chunks/es-CBk43isB.mjs +2 -0
- package/dist/chunks/es-CBk43isB.mjs.map +1 -0
- package/dist/chunks/es-CE8t9fuM.mjs +2 -0
- package/dist/chunks/es-CE8t9fuM.mjs.map +1 -0
- package/dist/chunks/es-CFjzqIbS.mjs +2 -0
- package/dist/chunks/es-CFjzqIbS.mjs.map +1 -0
- package/dist/chunks/es-Ce-AEYxc.mjs +2 -0
- package/dist/chunks/es-Ce-AEYxc.mjs.map +1 -0
- package/dist/chunks/es-Co4AJr8Y.mjs +2 -0
- package/dist/chunks/es-Co4AJr8Y.mjs.map +1 -0
- package/dist/chunks/es-Cu5_OA4X.mjs +2 -0
- package/dist/chunks/es-Cu5_OA4X.mjs.map +1 -0
- package/dist/chunks/es-Cud6JXHf.mjs +2 -0
- package/dist/chunks/es-Cud6JXHf.mjs.map +1 -0
- package/dist/chunks/es-D-II7LZC.mjs +2 -0
- package/dist/chunks/es-D-II7LZC.mjs.map +1 -0
- package/dist/chunks/es-DBBSeOaD.mjs +2 -0
- package/dist/chunks/es-DBBSeOaD.mjs.map +1 -0
- package/dist/chunks/es-DCwjeUUu.mjs +2 -0
- package/dist/chunks/es-DCwjeUUu.mjs.map +1 -0
- package/dist/chunks/es-DvgH3-WZ.mjs +2 -0
- package/dist/chunks/es-DvgH3-WZ.mjs.map +1 -0
- package/dist/chunks/es-MgguVgIs.mjs +2 -0
- package/dist/chunks/es-MgguVgIs.mjs.map +1 -0
- package/dist/chunks/es-yXjjcxgb.mjs +2 -0
- package/dist/chunks/es-yXjjcxgb.mjs.map +1 -0
- package/dist/chunks/fr-B-_yKIAY.mjs +2 -0
- package/dist/chunks/fr-B-_yKIAY.mjs.map +1 -0
- package/dist/chunks/fr-BGyF2ym0.mjs +2 -0
- package/dist/chunks/fr-BGyF2ym0.mjs.map +1 -0
- package/dist/chunks/fr-BoRJ3B2-.mjs +2 -0
- package/dist/chunks/fr-BoRJ3B2-.mjs.map +1 -0
- package/dist/chunks/fr-BrKk4SPg.mjs +2 -0
- package/dist/chunks/fr-BrKk4SPg.mjs.map +1 -0
- package/dist/chunks/fr-C-y09LKg.mjs +2 -0
- package/dist/chunks/fr-C-y09LKg.mjs.map +1 -0
- package/dist/chunks/fr-C1W7jyd6.mjs +2 -0
- package/dist/chunks/fr-C1W7jyd6.mjs.map +1 -0
- package/dist/chunks/fr-C8CtmWBj.mjs +2 -0
- package/dist/chunks/fr-C8CtmWBj.mjs.map +1 -0
- package/dist/chunks/fr-C9oiPW0k.mjs +2 -0
- package/dist/chunks/fr-C9oiPW0k.mjs.map +1 -0
- package/dist/chunks/fr-CEkk4UyZ.mjs +2 -0
- package/dist/chunks/fr-CEkk4UyZ.mjs.map +1 -0
- package/dist/chunks/fr-Ccaetiwi.mjs +2 -0
- package/dist/chunks/fr-Ccaetiwi.mjs.map +1 -0
- package/dist/chunks/fr-Ccku5KzA.mjs +2 -0
- package/dist/chunks/fr-Ccku5KzA.mjs.map +1 -0
- package/dist/chunks/fr-CfUg1FxU.mjs +2 -0
- package/dist/chunks/fr-CfUg1FxU.mjs.map +1 -0
- package/dist/chunks/fr-DDkBcjmO.mjs +2 -0
- package/dist/chunks/fr-DDkBcjmO.mjs.map +1 -0
- package/dist/chunks/fr-DNwLChcm.mjs +2 -0
- package/dist/chunks/fr-DNwLChcm.mjs.map +1 -0
- package/dist/chunks/fr-DvneSjCf.mjs +2 -0
- package/dist/chunks/fr-DvneSjCf.mjs.map +1 -0
- package/dist/chunks/fr-Dx4Qqimj.mjs +2 -0
- package/dist/chunks/fr-Dx4Qqimj.mjs.map +1 -0
- package/dist/chunks/fr-RHXmueoO.mjs +2 -0
- package/dist/chunks/fr-RHXmueoO.mjs.map +1 -0
- package/dist/chunks/fr-Wiobfk5s.mjs +2 -0
- package/dist/chunks/fr-Wiobfk5s.mjs.map +1 -0
- package/dist/chunks/fr-YMiDtWuG.mjs +2 -0
- package/dist/chunks/fr-YMiDtWuG.mjs.map +1 -0
- package/dist/chunks/fr-_Oxf0k66.mjs +2 -0
- package/dist/chunks/fr-_Oxf0k66.mjs.map +1 -0
- package/dist/chunks/fr-gurfH-7T.mjs +2 -0
- package/dist/chunks/fr-gurfH-7T.mjs.map +1 -0
- package/dist/chunks/fr-zP7EjxDL.mjs +2 -0
- package/dist/chunks/fr-zP7EjxDL.mjs.map +1 -0
- package/dist/chunks/hi-B2W8pFqK.mjs +2 -0
- package/dist/chunks/hi-B2W8pFqK.mjs.map +1 -0
- package/dist/chunks/hi-B2m69ZCq.mjs +2 -0
- package/dist/chunks/hi-B2m69ZCq.mjs.map +1 -0
- package/dist/chunks/hi-BMIt3y_-.mjs +2 -0
- package/dist/chunks/hi-BMIt3y_-.mjs.map +1 -0
- package/dist/chunks/hi-BmkfaZpg.mjs +2 -0
- package/dist/chunks/hi-BmkfaZpg.mjs.map +1 -0
- package/dist/chunks/hi-C-l_R2SO.mjs +2 -0
- package/dist/chunks/hi-C-l_R2SO.mjs.map +1 -0
- package/dist/chunks/hi-C1LhM-oY.mjs +2 -0
- package/dist/chunks/hi-C1LhM-oY.mjs.map +1 -0
- package/dist/chunks/hi-CGEbGI1l.mjs +2 -0
- package/dist/chunks/hi-CGEbGI1l.mjs.map +1 -0
- package/dist/chunks/hi-CPuhj7IA.mjs +2 -0
- package/dist/chunks/hi-CPuhj7IA.mjs.map +1 -0
- package/dist/chunks/hi-CT5WERqi.mjs +2 -0
- package/dist/chunks/hi-CT5WERqi.mjs.map +1 -0
- package/dist/chunks/hi-CbLPPQ0b.mjs +2 -0
- package/dist/chunks/hi-CbLPPQ0b.mjs.map +1 -0
- package/dist/chunks/hi-ClvEtEKe.mjs +2 -0
- package/dist/chunks/hi-ClvEtEKe.mjs.map +1 -0
- package/dist/chunks/hi-CpBWHmYH.mjs +2 -0
- package/dist/chunks/hi-CpBWHmYH.mjs.map +1 -0
- package/dist/chunks/hi-DAfl8nU_.mjs +2 -0
- package/dist/chunks/hi-DAfl8nU_.mjs.map +1 -0
- package/dist/chunks/hi-DVof3w0y.mjs +2 -0
- package/dist/chunks/hi-DVof3w0y.mjs.map +1 -0
- package/dist/chunks/hi-DtlvSQkD.mjs +2 -0
- package/dist/chunks/hi-DtlvSQkD.mjs.map +1 -0
- package/dist/chunks/hi-FH3CAJuR.mjs +2 -0
- package/dist/chunks/hi-FH3CAJuR.mjs.map +1 -0
- package/dist/chunks/hi-Ga9h9a_1.mjs +2 -0
- package/dist/chunks/hi-Ga9h9a_1.mjs.map +1 -0
- package/dist/chunks/hi-Zc17M1T-.mjs +2 -0
- package/dist/chunks/hi-Zc17M1T-.mjs.map +1 -0
- package/dist/chunks/hi-g7i0bmig.mjs +2 -0
- package/dist/chunks/hi-g7i0bmig.mjs.map +1 -0
- package/dist/chunks/hi-js2P6byR.mjs +2 -0
- package/dist/chunks/hi-js2P6byR.mjs.map +1 -0
- package/dist/chunks/hi-ntUsOspQ.mjs +2 -0
- package/dist/chunks/hi-ntUsOspQ.mjs.map +1 -0
- package/dist/chunks/hi-yxAcR3w6.mjs +2 -0
- package/dist/chunks/hi-yxAcR3w6.mjs.map +1 -0
- package/dist/chunks/index-C8xtb3SM.mjs +2 -0
- package/dist/chunks/index-C8xtb3SM.mjs.map +1 -0
- package/dist/chunks/index-DAoSt12h.mjs +2 -0
- package/dist/chunks/index-DAoSt12h.mjs.map +1 -0
- package/dist/chunks/pt--IiroJQw.mjs +2 -0
- package/dist/chunks/pt--IiroJQw.mjs.map +1 -0
- package/dist/chunks/pt-BF72W8M5.mjs +2 -0
- package/dist/chunks/pt-BF72W8M5.mjs.map +1 -0
- package/dist/chunks/pt-BX_t4luI.mjs +2 -0
- package/dist/chunks/pt-BX_t4luI.mjs.map +1 -0
- package/dist/chunks/pt-B_XJ2s9X.mjs +2 -0
- package/dist/chunks/pt-B_XJ2s9X.mjs.map +1 -0
- package/dist/chunks/pt-C-Vp7Rxj.mjs +2 -0
- package/dist/chunks/pt-C-Vp7Rxj.mjs.map +1 -0
- package/dist/chunks/pt-CD2aCZXf.mjs +2 -0
- package/dist/chunks/pt-CD2aCZXf.mjs.map +1 -0
- package/dist/chunks/pt-CFjzqIbS.mjs +2 -0
- package/dist/chunks/pt-CFjzqIbS.mjs.map +1 -0
- package/dist/chunks/pt-CHjmBegF.mjs +2 -0
- package/dist/chunks/pt-CHjmBegF.mjs.map +1 -0
- package/dist/chunks/pt-CQRzEocL.mjs +2 -0
- package/dist/chunks/pt-CQRzEocL.mjs.map +1 -0
- package/dist/chunks/pt-Cem2WxUk.mjs +2 -0
- package/dist/chunks/pt-Cem2WxUk.mjs.map +1 -0
- package/dist/chunks/pt-D6kdF3fH.mjs +2 -0
- package/dist/chunks/pt-D6kdF3fH.mjs.map +1 -0
- package/dist/chunks/pt-DJfJVeY8.mjs +2 -0
- package/dist/chunks/pt-DJfJVeY8.mjs.map +1 -0
- package/dist/chunks/pt-DfB-IaYi.mjs +2 -0
- package/dist/chunks/pt-DfB-IaYi.mjs.map +1 -0
- package/dist/chunks/pt-DlNdH9pu.mjs +2 -0
- package/dist/chunks/pt-DlNdH9pu.mjs.map +1 -0
- package/dist/chunks/pt-DrJ0-8Yo.mjs +2 -0
- package/dist/chunks/pt-DrJ0-8Yo.mjs.map +1 -0
- package/dist/chunks/pt-DsBJpgpe.mjs +2 -0
- package/dist/chunks/pt-DsBJpgpe.mjs.map +1 -0
- package/dist/chunks/pt-DwdSYJzC.mjs +2 -0
- package/dist/chunks/pt-DwdSYJzC.mjs.map +1 -0
- package/dist/chunks/pt-Dx9UkZ3j.mjs +2 -0
- package/dist/chunks/pt-Dx9UkZ3j.mjs.map +1 -0
- package/dist/chunks/pt-TuA3_GDM.mjs +2 -0
- package/dist/chunks/pt-TuA3_GDM.mjs.map +1 -0
- package/dist/chunks/pt-cN6r-f7f.mjs +2 -0
- package/dist/chunks/pt-cN6r-f7f.mjs.map +1 -0
- package/dist/chunks/pt-uNGpVM3D.mjs +2 -0
- package/dist/chunks/pt-uNGpVM3D.mjs.map +1 -0
- package/dist/chunks/pt-v1E9u-Jx.mjs +2 -0
- package/dist/chunks/pt-v1E9u-Jx.mjs.map +1 -0
- package/dist/chunks/ru-0h51zrqE.mjs +2 -0
- package/dist/chunks/ru-0h51zrqE.mjs.map +1 -0
- package/dist/chunks/ru-4S8w6UN_.mjs +2 -0
- package/dist/chunks/ru-4S8w6UN_.mjs.map +1 -0
- package/dist/chunks/ru-B0cRw90L.mjs +2 -0
- package/dist/chunks/ru-B0cRw90L.mjs.map +1 -0
- package/dist/chunks/ru-B3O7WXNM.mjs +2 -0
- package/dist/chunks/ru-B3O7WXNM.mjs.map +1 -0
- package/dist/chunks/ru-B6zVAzvI.mjs +2 -0
- package/dist/chunks/ru-B6zVAzvI.mjs.map +1 -0
- package/dist/chunks/ru-B8teJin_.mjs +2 -0
- package/dist/chunks/ru-B8teJin_.mjs.map +1 -0
- package/dist/chunks/ru-BCriPw-8.mjs +2 -0
- package/dist/chunks/ru-BCriPw-8.mjs.map +1 -0
- package/dist/chunks/ru-BNOU16E5.mjs +2 -0
- package/dist/chunks/ru-BNOU16E5.mjs.map +1 -0
- package/dist/chunks/ru-BO6BIS5W.mjs +2 -0
- package/dist/chunks/ru-BO6BIS5W.mjs.map +1 -0
- package/dist/chunks/ru-Bdy1lLuc.mjs +2 -0
- package/dist/chunks/ru-Bdy1lLuc.mjs.map +1 -0
- package/dist/chunks/ru-BgBctNVm.mjs +2 -0
- package/dist/chunks/ru-BgBctNVm.mjs.map +1 -0
- package/dist/chunks/ru-CNLx7T3O.mjs +2 -0
- package/dist/chunks/ru-CNLx7T3O.mjs.map +1 -0
- package/dist/chunks/ru-CVSCT776.mjs +2 -0
- package/dist/chunks/ru-CVSCT776.mjs.map +1 -0
- package/dist/chunks/ru-CZvkdGnf.mjs +2 -0
- package/dist/chunks/ru-CZvkdGnf.mjs.map +1 -0
- package/dist/chunks/ru-CegMPuML.mjs +2 -0
- package/dist/chunks/ru-CegMPuML.mjs.map +1 -0
- package/dist/chunks/ru-CiLrD2Nz.mjs +2 -0
- package/dist/chunks/ru-CiLrD2Nz.mjs.map +1 -0
- package/dist/chunks/ru-ClEM6OKY.mjs +2 -0
- package/dist/chunks/ru-ClEM6OKY.mjs.map +1 -0
- package/dist/chunks/ru-CrbxCeQf.mjs +2 -0
- package/dist/chunks/ru-CrbxCeQf.mjs.map +1 -0
- package/dist/chunks/ru-D3j2x2xu.mjs +2 -0
- package/dist/chunks/ru-D3j2x2xu.mjs.map +1 -0
- package/dist/chunks/ru-DdHqb4Mh.mjs +2 -0
- package/dist/chunks/ru-DdHqb4Mh.mjs.map +1 -0
- package/dist/chunks/ru-DjgNdOdJ.mjs +2 -0
- package/dist/chunks/ru-DjgNdOdJ.mjs.map +1 -0
- package/dist/chunks/ru-XKNCzkR2.mjs +2 -0
- package/dist/chunks/ru-XKNCzkR2.mjs.map +1 -0
- package/dist/chunks/zh--oNSMazK.mjs +2 -0
- package/dist/chunks/zh--oNSMazK.mjs.map +1 -0
- package/dist/chunks/zh-BfeWdPIz.mjs +2 -0
- package/dist/chunks/zh-BfeWdPIz.mjs.map +1 -0
- package/dist/chunks/zh-BnOxGKxF.mjs +2 -0
- package/dist/chunks/zh-BnOxGKxF.mjs.map +1 -0
- package/dist/chunks/zh-BqMtE-jN.mjs +2 -0
- package/dist/chunks/zh-BqMtE-jN.mjs.map +1 -0
- package/dist/chunks/zh-C3aI7A2o.mjs +2 -0
- package/dist/chunks/zh-C3aI7A2o.mjs.map +1 -0
- package/dist/chunks/zh-C6YALJZt.mjs +2 -0
- package/dist/chunks/zh-C6YALJZt.mjs.map +1 -0
- package/dist/chunks/zh-CWdTbUOP.mjs +2 -0
- package/dist/chunks/zh-CWdTbUOP.mjs.map +1 -0
- package/dist/chunks/zh-CY01pMD4.mjs +2 -0
- package/dist/chunks/zh-CY01pMD4.mjs.map +1 -0
- package/dist/chunks/zh-Cmt7n9FY.mjs +2 -0
- package/dist/chunks/zh-Cmt7n9FY.mjs.map +1 -0
- package/dist/chunks/zh-CpP2kee3.mjs +2 -0
- package/dist/chunks/zh-CpP2kee3.mjs.map +1 -0
- package/dist/chunks/zh-Cpbg4evx.mjs +2 -0
- package/dist/chunks/zh-Cpbg4evx.mjs.map +1 -0
- package/dist/chunks/zh-Cqb55JWa.mjs +2 -0
- package/dist/chunks/zh-Cqb55JWa.mjs.map +1 -0
- package/dist/chunks/zh-DCQZ6gss.mjs +2 -0
- package/dist/chunks/zh-DCQZ6gss.mjs.map +1 -0
- package/dist/chunks/zh-DG2CNTUU.mjs +2 -0
- package/dist/chunks/zh-DG2CNTUU.mjs.map +1 -0
- package/dist/chunks/zh-DTiTJbzz.mjs +2 -0
- package/dist/chunks/zh-DTiTJbzz.mjs.map +1 -0
- package/dist/chunks/zh-Da1z6qbB.mjs +2 -0
- package/dist/chunks/zh-Da1z6qbB.mjs.map +1 -0
- package/dist/chunks/zh-DlBt06Pr.mjs +2 -0
- package/dist/chunks/zh-DlBt06Pr.mjs.map +1 -0
- package/dist/chunks/zh-Dt-wVrNr.mjs +2 -0
- package/dist/chunks/zh-Dt-wVrNr.mjs.map +1 -0
- package/dist/chunks/zh-ND6vW2M-.mjs +2 -0
- package/dist/chunks/zh-ND6vW2M-.mjs.map +1 -0
- package/dist/chunks/zh-Yd3GNsa0.mjs +2 -0
- package/dist/chunks/zh-Yd3GNsa0.mjs.map +1 -0
- package/dist/chunks/zh-lhynyH6Q.mjs +2 -0
- package/dist/chunks/zh-lhynyH6Q.mjs.map +1 -0
- package/dist/chunks/zh-v9NmlEIN.mjs +2 -0
- package/dist/chunks/zh-v9NmlEIN.mjs.map +1 -0
- package/dist/commands/Commands.d.ts +9 -3
- package/dist/commands/Commands.d.ts.map +1 -1
- package/dist/commands/GapCursorCommands.d.ts.map +1 -1
- package/dist/commands/MovementCommands.d.ts +1 -4
- package/dist/commands/MovementCommands.d.ts.map +1 -1
- package/dist/commands/NodeSelectionCommands.d.ts +3 -1
- package/dist/commands/NodeSelectionCommands.d.ts.map +1 -1
- package/dist/commands/WordBoundary.d.ts +4 -9
- package/dist/commands/WordBoundary.d.ts.map +1 -1
- package/dist/editor/Announcer.d.ts +1 -2
- package/dist/editor/Announcer.d.ts.map +1 -1
- package/dist/{model → editor}/BuiltinSpecs.d.ts +1 -1
- package/dist/editor/BuiltinSpecs.d.ts.map +1 -0
- package/dist/editor/ContentSerializer.d.ts +24 -0
- package/dist/editor/ContentSerializer.d.ts.map +1 -0
- package/dist/editor/EditorConfigController.d.ts +38 -0
- package/dist/editor/EditorConfigController.d.ts.map +1 -0
- package/dist/editor/EditorDOM.d.ts +3 -4
- package/dist/editor/EditorDOM.d.ts.map +1 -1
- package/dist/editor/EditorEventEmitter.d.ts +30 -0
- package/dist/editor/EditorEventEmitter.d.ts.map +1 -0
- package/dist/editor/EditorLifecycleCoordinator.d.ts +24 -0
- package/dist/editor/EditorLifecycleCoordinator.d.ts.map +1 -0
- package/dist/editor/EditorLocale.d.ts +9 -0
- package/dist/editor/EditorLocale.d.ts.map +1 -0
- package/dist/editor/EditorStyleCoordinator.d.ts +9 -0
- package/dist/editor/EditorStyleCoordinator.d.ts.map +1 -0
- package/dist/editor/NotectlEditor.d.ts +20 -54
- package/dist/editor/NotectlEditor.d.ts.map +1 -1
- package/dist/editor/PaperLayoutController.d.ts +1 -1
- package/dist/editor/PaperLayoutController.d.ts.map +1 -1
- package/dist/editor/PluginBootstrapper.d.ts +18 -0
- package/dist/editor/PluginBootstrapper.d.ts.map +1 -0
- package/dist/editor/locales/ar.d.ts +4 -0
- package/dist/editor/locales/ar.d.ts.map +1 -0
- package/dist/editor/locales/de.d.ts +4 -0
- package/dist/editor/locales/de.d.ts.map +1 -0
- package/dist/editor/locales/es.d.ts +4 -0
- package/dist/editor/locales/es.d.ts.map +1 -0
- package/dist/editor/locales/fr.d.ts +4 -0
- package/dist/editor/locales/fr.d.ts.map +1 -0
- package/dist/editor/locales/hi.d.ts +4 -0
- package/dist/editor/locales/hi.d.ts.map +1 -0
- package/dist/editor/locales/pt.d.ts +4 -0
- package/dist/editor/locales/pt.d.ts.map +1 -0
- package/dist/editor/locales/ru.d.ts +4 -0
- package/dist/editor/locales/ru.d.ts.map +1 -0
- package/dist/editor/locales/zh.d.ts +4 -0
- package/dist/editor/locales/zh.d.ts.map +1 -0
- package/dist/editor/styles/base.d.ts +1 -1
- package/dist/editor/styles/base.d.ts.map +1 -1
- package/dist/editor/styles/code-block.d.ts +1 -1
- package/dist/editor/styles/code-block.d.ts.map +1 -1
- package/dist/editor/styles/font-select.d.ts +1 -1
- package/dist/editor/styles/font-select.d.ts.map +1 -1
- package/dist/editor/styles/font-size-select.d.ts +1 -1
- package/dist/editor/styles/font-size-select.d.ts.map +1 -1
- package/dist/editor/styles/heading-select.d.ts +1 -1
- package/dist/editor/styles/heading-select.d.ts.map +1 -1
- package/dist/editor/styles/image.d.ts +1 -1
- package/dist/editor/styles/image.d.ts.map +1 -1
- package/dist/editor/styles/list.d.ts +1 -1
- package/dist/editor/styles/list.d.ts.map +1 -1
- package/dist/editor/styles/table.d.ts +1 -1
- package/dist/editor/styles/table.d.ts.map +1 -1
- package/dist/editor/styles/toolbar.d.ts +1 -1
- package/dist/editor/styles/toolbar.d.ts.map +1 -1
- package/dist/fonts.mjs +1 -6
- package/dist/fonts.mjs.map +1 -1
- package/dist/full.d.ts +45 -0
- package/dist/full.d.ts.map +1 -0
- package/dist/full.mjs +2 -0
- package/dist/full.mjs.map +1 -0
- package/dist/html.d.ts +16 -0
- package/dist/html.d.ts.map +1 -0
- package/dist/html.mjs +2 -0
- package/dist/html.mjs.map +1 -0
- package/dist/i18n/Locale.d.ts +1 -0
- package/dist/i18n/Locale.d.ts.map +1 -1
- package/dist/i18n/index.d.ts +0 -1
- package/dist/i18n/index.d.ts.map +1 -1
- package/dist/index.d.ts +29 -93
- package/dist/index.d.ts.map +1 -1
- package/dist/input/BlockInsertion.d.ts +51 -0
- package/dist/input/BlockInsertion.d.ts.map +1 -0
- package/dist/input/ClipboardHandler.d.ts +22 -0
- package/dist/input/ClipboardHandler.d.ts.map +1 -1
- package/dist/input/CompositionTracker.d.ts +2 -1
- package/dist/input/CompositionTracker.d.ts.map +1 -1
- package/dist/{model → input}/HTMLParser.d.ts +3 -3
- package/dist/input/HTMLParser.d.ts.map +1 -0
- package/dist/input/InputHandler.d.ts +1 -1
- package/dist/input/InputHandler.d.ts.map +1 -1
- package/dist/input/InputManager.d.ts +35 -0
- package/dist/input/InputManager.d.ts.map +1 -0
- package/dist/input/InternalClipboard.d.ts +11 -1
- package/dist/input/InternalClipboard.d.ts.map +1 -1
- package/dist/input/KeyboardHandler.d.ts +12 -1
- package/dist/input/KeyboardHandler.d.ts.map +1 -1
- package/dist/input/PasteHandler.d.ts +21 -17
- package/dist/input/PasteHandler.d.ts.map +1 -1
- package/dist/model/AttrRegistry.d.ts +1 -1
- package/dist/model/AttrRegistry.d.ts.map +1 -1
- package/dist/model/BlockAlignment.d.ts +8 -0
- package/dist/model/BlockAlignment.d.ts.map +1 -0
- package/dist/model/BlockTypeLabels.d.ts +7 -0
- package/dist/model/BlockTypeLabels.d.ts.map +1 -0
- package/dist/model/CompositionState.d.ts +8 -0
- package/dist/model/CompositionState.d.ts.map +1 -0
- package/dist/{input → model}/FileHandlerRegistry.d.ts +1 -1
- package/dist/{input → model}/FileHandlerRegistry.d.ts.map +1 -1
- package/dist/model/HTMLUtils.d.ts +6 -0
- package/dist/model/HTMLUtils.d.ts.map +1 -1
- package/dist/{input → model}/InputRule.d.ts.map +1 -1
- package/dist/{input → model}/InputRuleRegistry.d.ts.map +1 -1
- package/dist/{input → model}/Keymap.d.ts.map +1 -1
- package/dist/{input → model}/KeymapRegistry.d.ts.map +1 -1
- package/dist/model/MarkSpec.d.ts +2 -2
- package/dist/model/MarkSpec.d.ts.map +1 -1
- package/dist/model/NodeSpec.d.ts +0 -3
- package/dist/model/NodeSpec.d.ts.map +1 -1
- package/dist/model/PaperSize.d.ts.map +1 -0
- package/dist/model/WordBoundary.d.ts +12 -0
- package/dist/model/WordBoundary.d.ts.map +1 -0
- package/dist/notectl-core.mjs +1 -3888
- package/dist/notectl-core.mjs.map +1 -1
- package/dist/notectl-core.umd.js +1 -9523
- package/dist/notectl-core.umd.js.map +1 -1
- package/dist/{view → platform}/Platform.d.ts +2 -0
- package/dist/platform/Platform.d.ts.map +1 -0
- package/dist/plugins/Plugin.d.ts +5 -5
- package/dist/plugins/Plugin.d.ts.map +1 -1
- package/dist/plugins/PluginManager.d.ts +3 -3
- package/dist/plugins/alignment/AlignmentLocale.d.ts +3 -10
- package/dist/plugins/alignment/AlignmentLocale.d.ts.map +1 -1
- package/dist/plugins/alignment/AlignmentPlugin.d.ts +3 -13
- package/dist/plugins/alignment/AlignmentPlugin.d.ts.map +1 -1
- package/dist/plugins/alignment/index.d.ts +3 -1
- package/dist/plugins/alignment/index.d.ts.map +1 -1
- package/dist/plugins/alignment/locales/ar.d.ts +4 -0
- package/dist/plugins/alignment/locales/ar.d.ts.map +1 -0
- package/dist/plugins/alignment/locales/de.d.ts +4 -0
- package/dist/plugins/alignment/locales/de.d.ts.map +1 -0
- package/dist/plugins/alignment/locales/es.d.ts +4 -0
- package/dist/plugins/alignment/locales/es.d.ts.map +1 -0
- package/dist/plugins/alignment/locales/fr.d.ts +4 -0
- package/dist/plugins/alignment/locales/fr.d.ts.map +1 -0
- package/dist/plugins/alignment/locales/hi.d.ts +4 -0
- package/dist/plugins/alignment/locales/hi.d.ts.map +1 -0
- package/dist/plugins/alignment/locales/pt.d.ts +4 -0
- package/dist/plugins/alignment/locales/pt.d.ts.map +1 -0
- package/dist/plugins/alignment/locales/ru.d.ts +4 -0
- package/dist/plugins/alignment/locales/ru.d.ts.map +1 -0
- package/dist/plugins/alignment/locales/zh.d.ts +4 -0
- package/dist/plugins/alignment/locales/zh.d.ts.map +1 -0
- package/dist/plugins/alignment.mjs +1 -5
- package/dist/plugins/alignment.mjs.map +1 -1
- package/dist/plugins/blockquote/BlockquoteKeyboardHandlers.d.ts +4 -0
- package/dist/plugins/blockquote/BlockquoteKeyboardHandlers.d.ts.map +1 -0
- package/dist/plugins/blockquote/BlockquoteLocale.d.ts +1 -8
- package/dist/plugins/blockquote/BlockquoteLocale.d.ts.map +1 -1
- package/dist/plugins/blockquote/BlockquotePlugin.d.ts +1 -3
- package/dist/plugins/blockquote/BlockquotePlugin.d.ts.map +1 -1
- package/dist/plugins/blockquote/BlockquoteStyles.d.ts +3 -0
- package/dist/plugins/blockquote/BlockquoteStyles.d.ts.map +1 -0
- package/dist/plugins/blockquote/index.d.ts +2 -0
- package/dist/plugins/blockquote/index.d.ts.map +1 -1
- package/dist/plugins/blockquote/locales/ar.d.ts +4 -0
- package/dist/plugins/blockquote/locales/ar.d.ts.map +1 -0
- package/dist/plugins/blockquote/locales/de.d.ts +4 -0
- package/dist/plugins/blockquote/locales/de.d.ts.map +1 -0
- package/dist/plugins/blockquote/locales/es.d.ts +4 -0
- package/dist/plugins/blockquote/locales/es.d.ts.map +1 -0
- package/dist/plugins/blockquote/locales/fr.d.ts +4 -0
- package/dist/plugins/blockquote/locales/fr.d.ts.map +1 -0
- package/dist/plugins/blockquote/locales/hi.d.ts +4 -0
- package/dist/plugins/blockquote/locales/hi.d.ts.map +1 -0
- package/dist/plugins/blockquote/locales/pt.d.ts +4 -0
- package/dist/plugins/blockquote/locales/pt.d.ts.map +1 -0
- package/dist/plugins/blockquote/locales/ru.d.ts +4 -0
- package/dist/plugins/blockquote/locales/ru.d.ts.map +1 -0
- package/dist/plugins/blockquote/locales/zh.d.ts +4 -0
- package/dist/plugins/blockquote/locales/zh.d.ts.map +1 -0
- package/dist/plugins/blockquote.mjs +1 -4
- package/dist/plugins/blockquote.mjs.map +1 -1
- package/dist/plugins/caret-navigation/CaretNavigationLocale.d.ts +21 -0
- package/dist/plugins/caret-navigation/CaretNavigationLocale.d.ts.map +1 -0
- package/dist/plugins/caret-navigation/CaretNavigationPlugin.d.ts +2 -1
- package/dist/plugins/caret-navigation/CaretNavigationPlugin.d.ts.map +1 -1
- package/dist/plugins/caret-navigation/index.d.ts +2 -0
- package/dist/plugins/caret-navigation/index.d.ts.map +1 -1
- package/dist/plugins/caret-navigation/locales/ar.d.ts +4 -0
- package/dist/plugins/caret-navigation/locales/ar.d.ts.map +1 -0
- package/dist/plugins/caret-navigation/locales/de.d.ts +4 -0
- package/dist/plugins/caret-navigation/locales/de.d.ts.map +1 -0
- package/dist/plugins/caret-navigation/locales/es.d.ts +4 -0
- package/dist/plugins/caret-navigation/locales/es.d.ts.map +1 -0
- package/dist/plugins/caret-navigation/locales/fr.d.ts +4 -0
- package/dist/plugins/caret-navigation/locales/fr.d.ts.map +1 -0
- package/dist/plugins/caret-navigation/locales/hi.d.ts +4 -0
- package/dist/plugins/caret-navigation/locales/hi.d.ts.map +1 -0
- package/dist/plugins/caret-navigation/locales/pt.d.ts +4 -0
- package/dist/plugins/caret-navigation/locales/pt.d.ts.map +1 -0
- package/dist/plugins/caret-navigation/locales/ru.d.ts +4 -0
- package/dist/plugins/caret-navigation/locales/ru.d.ts.map +1 -0
- package/dist/plugins/caret-navigation/locales/zh.d.ts +4 -0
- package/dist/plugins/caret-navigation/locales/zh.d.ts.map +1 -0
- package/dist/plugins/caret-navigation.mjs +1 -4
- package/dist/plugins/caret-navigation.mjs.map +1 -1
- package/dist/plugins/code-block/CodeBlockLocale.d.ts +5 -8
- package/dist/plugins/code-block/CodeBlockLocale.d.ts.map +1 -1
- package/dist/plugins/code-block/CodeBlockNodeView.d.ts +2 -1
- package/dist/plugins/code-block/CodeBlockNodeView.d.ts.map +1 -1
- package/dist/plugins/code-block/CodeBlockPlugin.d.ts +2 -2
- package/dist/plugins/code-block/CodeBlockPlugin.d.ts.map +1 -1
- package/dist/plugins/code-block/CodeBlockService.d.ts.map +1 -1
- package/dist/plugins/code-block/CodeBlockTypes.d.ts +0 -1
- package/dist/plugins/code-block/CodeBlockTypes.d.ts.map +1 -1
- package/dist/plugins/code-block/index.d.ts +2 -0
- package/dist/plugins/code-block/index.d.ts.map +1 -1
- package/dist/plugins/code-block/locales/ar.d.ts +4 -0
- package/dist/plugins/code-block/locales/ar.d.ts.map +1 -0
- package/dist/plugins/code-block/locales/de.d.ts +4 -0
- package/dist/plugins/code-block/locales/de.d.ts.map +1 -0
- package/dist/plugins/code-block/locales/es.d.ts +4 -0
- package/dist/plugins/code-block/locales/es.d.ts.map +1 -0
- package/dist/plugins/code-block/locales/fr.d.ts +4 -0
- package/dist/plugins/code-block/locales/fr.d.ts.map +1 -0
- package/dist/plugins/code-block/locales/hi.d.ts +4 -0
- package/dist/plugins/code-block/locales/hi.d.ts.map +1 -0
- package/dist/plugins/code-block/locales/pt.d.ts +4 -0
- package/dist/plugins/code-block/locales/pt.d.ts.map +1 -0
- package/dist/plugins/code-block/locales/ru.d.ts +4 -0
- package/dist/plugins/code-block/locales/ru.d.ts.map +1 -0
- package/dist/plugins/code-block/locales/zh.d.ts +4 -0
- package/dist/plugins/code-block/locales/zh.d.ts.map +1 -0
- package/dist/plugins/code-block.mjs +1 -5
- package/dist/plugins/code-block.mjs.map +1 -1
- package/dist/plugins/font/FontLocale.d.ts +1 -8
- package/dist/plugins/font/FontLocale.d.ts.map +1 -1
- package/dist/plugins/font/FontPlugin.d.ts +1 -3
- package/dist/plugins/font/FontPlugin.d.ts.map +1 -1
- package/dist/plugins/font/index.d.ts +2 -0
- package/dist/plugins/font/index.d.ts.map +1 -1
- package/dist/plugins/font/locales/ar.d.ts +4 -0
- package/dist/plugins/font/locales/ar.d.ts.map +1 -0
- package/dist/plugins/font/locales/de.d.ts +4 -0
- package/dist/plugins/font/locales/de.d.ts.map +1 -0
- package/dist/plugins/font/locales/es.d.ts +4 -0
- package/dist/plugins/font/locales/es.d.ts.map +1 -0
- package/dist/plugins/font/locales/fr.d.ts +4 -0
- package/dist/plugins/font/locales/fr.d.ts.map +1 -0
- package/dist/plugins/font/locales/hi.d.ts +4 -0
- package/dist/plugins/font/locales/hi.d.ts.map +1 -0
- package/dist/plugins/font/locales/pt.d.ts +4 -0
- package/dist/plugins/font/locales/pt.d.ts.map +1 -0
- package/dist/plugins/font/locales/ru.d.ts +4 -0
- package/dist/plugins/font/locales/ru.d.ts.map +1 -0
- package/dist/plugins/font/locales/zh.d.ts +4 -0
- package/dist/plugins/font/locales/zh.d.ts.map +1 -0
- package/dist/plugins/font-size/FontSizeLocale.d.ts +1 -8
- package/dist/plugins/font-size/FontSizeLocale.d.ts.map +1 -1
- package/dist/plugins/font-size/FontSizePlugin.d.ts +1 -3
- package/dist/plugins/font-size/FontSizePlugin.d.ts.map +1 -1
- package/dist/plugins/font-size/FontSizePopup.d.ts +1 -1
- package/dist/plugins/font-size/FontSizePopup.d.ts.map +1 -1
- package/dist/plugins/font-size/index.d.ts +2 -0
- package/dist/plugins/font-size/index.d.ts.map +1 -1
- package/dist/plugins/font-size/locales/ar.d.ts +4 -0
- package/dist/plugins/font-size/locales/ar.d.ts.map +1 -0
- package/dist/plugins/font-size/locales/de.d.ts +4 -0
- package/dist/plugins/font-size/locales/de.d.ts.map +1 -0
- package/dist/plugins/font-size/locales/es.d.ts +4 -0
- package/dist/plugins/font-size/locales/es.d.ts.map +1 -0
- package/dist/plugins/font-size/locales/fr.d.ts +4 -0
- package/dist/plugins/font-size/locales/fr.d.ts.map +1 -0
- package/dist/plugins/font-size/locales/hi.d.ts +4 -0
- package/dist/plugins/font-size/locales/hi.d.ts.map +1 -0
- package/dist/plugins/font-size/locales/pt.d.ts +4 -0
- package/dist/plugins/font-size/locales/pt.d.ts.map +1 -0
- package/dist/plugins/font-size/locales/ru.d.ts +4 -0
- package/dist/plugins/font-size/locales/ru.d.ts.map +1 -0
- package/dist/plugins/font-size/locales/zh.d.ts +4 -0
- package/dist/plugins/font-size/locales/zh.d.ts.map +1 -0
- package/dist/plugins/font-size.mjs +1 -4
- package/dist/plugins/font-size.mjs.map +1 -1
- package/dist/plugins/font.mjs +1 -4
- package/dist/plugins/font.mjs.map +1 -1
- package/dist/plugins/gap-cursor/GapCursorLocale.d.ts +7 -0
- package/dist/plugins/gap-cursor/GapCursorLocale.d.ts.map +1 -0
- package/dist/plugins/gap-cursor/GapCursorPlugin.d.ts +7 -3
- package/dist/plugins/gap-cursor/GapCursorPlugin.d.ts.map +1 -1
- package/dist/plugins/gap-cursor/locales/ar.d.ts +4 -0
- package/dist/plugins/gap-cursor/locales/ar.d.ts.map +1 -0
- package/dist/plugins/gap-cursor/locales/de.d.ts +4 -0
- package/dist/plugins/gap-cursor/locales/de.d.ts.map +1 -0
- package/dist/plugins/gap-cursor/locales/es.d.ts +4 -0
- package/dist/plugins/gap-cursor/locales/es.d.ts.map +1 -0
- package/dist/plugins/gap-cursor/locales/fr.d.ts +4 -0
- package/dist/plugins/gap-cursor/locales/fr.d.ts.map +1 -0
- package/dist/plugins/gap-cursor/locales/hi.d.ts +4 -0
- package/dist/plugins/gap-cursor/locales/hi.d.ts.map +1 -0
- package/dist/plugins/gap-cursor/locales/pt.d.ts +4 -0
- package/dist/plugins/gap-cursor/locales/pt.d.ts.map +1 -0
- package/dist/plugins/gap-cursor/locales/ru.d.ts +4 -0
- package/dist/plugins/gap-cursor/locales/ru.d.ts.map +1 -0
- package/dist/plugins/gap-cursor/locales/zh.d.ts +4 -0
- package/dist/plugins/gap-cursor/locales/zh.d.ts.map +1 -0
- package/dist/plugins/gap-cursor.mjs +1 -64
- package/dist/plugins/gap-cursor.mjs.map +1 -1
- package/dist/plugins/hard-break.mjs +1 -4
- package/dist/plugins/hard-break.mjs.map +1 -1
- package/dist/plugins/heading/HeadingBlockTypePicker.d.ts +1 -1
- package/dist/plugins/heading/HeadingBlockTypePicker.d.ts.map +1 -1
- package/dist/plugins/heading/HeadingLocale.d.ts +1 -8
- package/dist/plugins/heading/HeadingLocale.d.ts.map +1 -1
- package/dist/plugins/heading/HeadingPlugin.d.ts +2 -4
- package/dist/plugins/heading/HeadingPlugin.d.ts.map +1 -1
- package/dist/plugins/heading/index.d.ts +3 -0
- package/dist/plugins/heading/index.d.ts.map +1 -1
- package/dist/plugins/heading/locales/ar.d.ts +4 -0
- package/dist/plugins/heading/locales/ar.d.ts.map +1 -0
- package/dist/plugins/heading/locales/de.d.ts +4 -0
- package/dist/plugins/heading/locales/de.d.ts.map +1 -0
- package/dist/plugins/heading/locales/es.d.ts +4 -0
- package/dist/plugins/heading/locales/es.d.ts.map +1 -0
- package/dist/plugins/heading/locales/fr.d.ts +4 -0
- package/dist/plugins/heading/locales/fr.d.ts.map +1 -0
- package/dist/plugins/heading/locales/hi.d.ts +4 -0
- package/dist/plugins/heading/locales/hi.d.ts.map +1 -0
- package/dist/plugins/heading/locales/pt.d.ts +4 -0
- package/dist/plugins/heading/locales/pt.d.ts.map +1 -0
- package/dist/plugins/heading/locales/ru.d.ts +4 -0
- package/dist/plugins/heading/locales/ru.d.ts.map +1 -0
- package/dist/plugins/heading/locales/zh.d.ts +4 -0
- package/dist/plugins/heading/locales/zh.d.ts.map +1 -0
- package/dist/plugins/heading.mjs +1 -4
- package/dist/plugins/heading.mjs.map +1 -1
- package/dist/plugins/highlight/HighlightLocale.d.ts +1 -8
- package/dist/plugins/highlight/HighlightLocale.d.ts.map +1 -1
- package/dist/plugins/highlight/HighlightPlugin.d.ts +1 -3
- package/dist/plugins/highlight/HighlightPlugin.d.ts.map +1 -1
- package/dist/plugins/highlight/index.d.ts +2 -0
- package/dist/plugins/highlight/index.d.ts.map +1 -1
- package/dist/plugins/highlight/locales/ar.d.ts +4 -0
- package/dist/plugins/highlight/locales/ar.d.ts.map +1 -0
- package/dist/plugins/highlight/locales/de.d.ts +4 -0
- package/dist/plugins/highlight/locales/de.d.ts.map +1 -0
- package/dist/plugins/highlight/locales/es.d.ts +4 -0
- package/dist/plugins/highlight/locales/es.d.ts.map +1 -0
- package/dist/plugins/highlight/locales/fr.d.ts +4 -0
- package/dist/plugins/highlight/locales/fr.d.ts.map +1 -0
- package/dist/plugins/highlight/locales/hi.d.ts +4 -0
- package/dist/plugins/highlight/locales/hi.d.ts.map +1 -0
- package/dist/plugins/highlight/locales/pt.d.ts +4 -0
- package/dist/plugins/highlight/locales/pt.d.ts.map +1 -0
- package/dist/plugins/highlight/locales/ru.d.ts +4 -0
- package/dist/plugins/highlight/locales/ru.d.ts.map +1 -0
- package/dist/plugins/highlight/locales/zh.d.ts +4 -0
- package/dist/plugins/highlight/locales/zh.d.ts.map +1 -0
- package/dist/plugins/highlight.mjs +1 -4
- package/dist/plugins/highlight.mjs.map +1 -1
- package/dist/plugins/horizontal-rule/HorizontalRuleLocale.d.ts +1 -8
- package/dist/plugins/horizontal-rule/HorizontalRuleLocale.d.ts.map +1 -1
- package/dist/plugins/horizontal-rule/HorizontalRulePlugin.d.ts +1 -3
- package/dist/plugins/horizontal-rule/HorizontalRulePlugin.d.ts.map +1 -1
- package/dist/plugins/horizontal-rule/index.d.ts +2 -0
- package/dist/plugins/horizontal-rule/index.d.ts.map +1 -1
- package/dist/plugins/horizontal-rule/locales/ar.d.ts +4 -0
- package/dist/plugins/horizontal-rule/locales/ar.d.ts.map +1 -0
- package/dist/plugins/horizontal-rule/locales/de.d.ts +4 -0
- package/dist/plugins/horizontal-rule/locales/de.d.ts.map +1 -0
- package/dist/plugins/horizontal-rule/locales/es.d.ts +4 -0
- package/dist/plugins/horizontal-rule/locales/es.d.ts.map +1 -0
- package/dist/plugins/horizontal-rule/locales/fr.d.ts +4 -0
- package/dist/plugins/horizontal-rule/locales/fr.d.ts.map +1 -0
- package/dist/plugins/horizontal-rule/locales/hi.d.ts +4 -0
- package/dist/plugins/horizontal-rule/locales/hi.d.ts.map +1 -0
- package/dist/plugins/horizontal-rule/locales/pt.d.ts +4 -0
- package/dist/plugins/horizontal-rule/locales/pt.d.ts.map +1 -0
- package/dist/plugins/horizontal-rule/locales/ru.d.ts +4 -0
- package/dist/plugins/horizontal-rule/locales/ru.d.ts.map +1 -0
- package/dist/plugins/horizontal-rule/locales/zh.d.ts +4 -0
- package/dist/plugins/horizontal-rule/locales/zh.d.ts.map +1 -0
- package/dist/plugins/horizontal-rule.mjs +1 -4
- package/dist/plugins/horizontal-rule.mjs.map +1 -1
- package/dist/plugins/image/ImageLocale.d.ts +9 -8
- package/dist/plugins/image/ImageLocale.d.ts.map +1 -1
- package/dist/plugins/image/ImageNodeView.d.ts +8 -1
- package/dist/plugins/image/ImageNodeView.d.ts.map +1 -1
- package/dist/plugins/image/ImagePlugin.d.ts +2 -2
- package/dist/plugins/image/ImagePlugin.d.ts.map +1 -1
- package/dist/plugins/image/ImageUpload.d.ts +1 -2
- package/dist/plugins/image/ImageUpload.d.ts.map +1 -1
- package/dist/plugins/image/index.d.ts +2 -0
- package/dist/plugins/image/index.d.ts.map +1 -1
- package/dist/plugins/image/locales/ar.d.ts +4 -0
- package/dist/plugins/image/locales/ar.d.ts.map +1 -0
- package/dist/plugins/image/locales/de.d.ts +4 -0
- package/dist/plugins/image/locales/de.d.ts.map +1 -0
- package/dist/plugins/image/locales/es.d.ts +4 -0
- package/dist/plugins/image/locales/es.d.ts.map +1 -0
- package/dist/plugins/image/locales/fr.d.ts +4 -0
- package/dist/plugins/image/locales/fr.d.ts.map +1 -0
- package/dist/plugins/image/locales/hi.d.ts +4 -0
- package/dist/plugins/image/locales/hi.d.ts.map +1 -0
- package/dist/plugins/image/locales/pt.d.ts +4 -0
- package/dist/plugins/image/locales/pt.d.ts.map +1 -0
- package/dist/plugins/image/locales/ru.d.ts +4 -0
- package/dist/plugins/image/locales/ru.d.ts.map +1 -0
- package/dist/plugins/image/locales/zh.d.ts +4 -0
- package/dist/plugins/image/locales/zh.d.ts.map +1 -0
- package/dist/plugins/image.mjs +1 -6
- package/dist/plugins/image.mjs.map +1 -1
- package/dist/plugins/link/LinkLocale.d.ts +1 -8
- package/dist/plugins/link/LinkLocale.d.ts.map +1 -1
- package/dist/plugins/link/LinkPlugin.d.ts +1 -3
- package/dist/plugins/link/LinkPlugin.d.ts.map +1 -1
- package/dist/plugins/link/index.d.ts +2 -0
- package/dist/plugins/link/index.d.ts.map +1 -1
- package/dist/plugins/link/locales/ar.d.ts +4 -0
- package/dist/plugins/link/locales/ar.d.ts.map +1 -0
- package/dist/plugins/link/locales/de.d.ts +4 -0
- package/dist/plugins/link/locales/de.d.ts.map +1 -0
- package/dist/plugins/link/locales/es.d.ts +4 -0
- package/dist/plugins/link/locales/es.d.ts.map +1 -0
- package/dist/plugins/link/locales/fr.d.ts +4 -0
- package/dist/plugins/link/locales/fr.d.ts.map +1 -0
- package/dist/plugins/link/locales/hi.d.ts +4 -0
- package/dist/plugins/link/locales/hi.d.ts.map +1 -0
- package/dist/plugins/link/locales/pt.d.ts +4 -0
- package/dist/plugins/link/locales/pt.d.ts.map +1 -0
- package/dist/plugins/link/locales/ru.d.ts +4 -0
- package/dist/plugins/link/locales/ru.d.ts.map +1 -0
- package/dist/plugins/link/locales/zh.d.ts +4 -0
- package/dist/plugins/link/locales/zh.d.ts.map +1 -0
- package/dist/plugins/link.mjs +1 -4
- package/dist/plugins/link.mjs.map +1 -1
- package/dist/plugins/list/ListLocale.d.ts +1 -8
- package/dist/plugins/list/ListLocale.d.ts.map +1 -1
- package/dist/plugins/list/ListPlugin.d.ts +1 -3
- package/dist/plugins/list/ListPlugin.d.ts.map +1 -1
- package/dist/plugins/list/index.d.ts +2 -0
- package/dist/plugins/list/index.d.ts.map +1 -1
- package/dist/plugins/list/locales/ar.d.ts +4 -0
- package/dist/plugins/list/locales/ar.d.ts.map +1 -0
- package/dist/plugins/list/locales/de.d.ts +4 -0
- package/dist/plugins/list/locales/de.d.ts.map +1 -0
- package/dist/plugins/list/locales/es.d.ts +4 -0
- package/dist/plugins/list/locales/es.d.ts.map +1 -0
- package/dist/plugins/list/locales/fr.d.ts +4 -0
- package/dist/plugins/list/locales/fr.d.ts.map +1 -0
- package/dist/plugins/list/locales/hi.d.ts +4 -0
- package/dist/plugins/list/locales/hi.d.ts.map +1 -0
- package/dist/plugins/list/locales/pt.d.ts +4 -0
- package/dist/plugins/list/locales/pt.d.ts.map +1 -0
- package/dist/plugins/list/locales/ru.d.ts +4 -0
- package/dist/plugins/list/locales/ru.d.ts.map +1 -0
- package/dist/plugins/list/locales/zh.d.ts +4 -0
- package/dist/plugins/list/locales/zh.d.ts.map +1 -0
- package/dist/plugins/list.mjs +1 -4
- package/dist/plugins/list.mjs.map +1 -1
- package/dist/plugins/print/PrintLocale.d.ts +1 -8
- package/dist/plugins/print/PrintLocale.d.ts.map +1 -1
- package/dist/plugins/print/PrintPlugin.d.ts +1 -1
- package/dist/plugins/print/PrintPlugin.d.ts.map +1 -1
- package/dist/plugins/print/PrintServiceImpl.d.ts.map +1 -1
- package/dist/plugins/print/PrintStyleCollector.d.ts.map +1 -1
- package/dist/plugins/print/PrintTypes.d.ts +1 -1
- package/dist/plugins/print/PrintTypes.d.ts.map +1 -1
- package/dist/plugins/print/index.d.ts +5 -0
- package/dist/plugins/print/index.d.ts.map +1 -0
- package/dist/plugins/print/locales/ar.d.ts +4 -0
- package/dist/plugins/print/locales/ar.d.ts.map +1 -0
- package/dist/plugins/print/locales/de.d.ts +4 -0
- package/dist/plugins/print/locales/de.d.ts.map +1 -0
- package/dist/plugins/print/locales/es.d.ts +4 -0
- package/dist/plugins/print/locales/es.d.ts.map +1 -0
- package/dist/plugins/print/locales/fr.d.ts +4 -0
- package/dist/plugins/print/locales/fr.d.ts.map +1 -0
- package/dist/plugins/print/locales/hi.d.ts +4 -0
- package/dist/plugins/print/locales/hi.d.ts.map +1 -0
- package/dist/plugins/print/locales/pt.d.ts +4 -0
- package/dist/plugins/print/locales/pt.d.ts.map +1 -0
- package/dist/plugins/print/locales/ru.d.ts +4 -0
- package/dist/plugins/print/locales/ru.d.ts.map +1 -0
- package/dist/plugins/print/locales/zh.d.ts +4 -0
- package/dist/plugins/print/locales/zh.d.ts.map +1 -0
- package/dist/plugins/print.mjs +2 -0
- package/dist/plugins/print.mjs.map +1 -0
- package/dist/plugins/shared/ColorGrid.d.ts.map +1 -1
- package/dist/plugins/shared/KeyboardNav.d.ts +17 -0
- package/dist/plugins/shared/KeyboardNav.d.ts.map +1 -0
- package/dist/plugins/shared/PluginHelpers.d.ts +10 -0
- package/dist/plugins/shared/PluginHelpers.d.ts.map +1 -0
- package/dist/plugins/shared/PopupKeyboardPatterns.d.ts +1 -1
- package/dist/plugins/shared/PopupKeyboardPatterns.d.ts.map +1 -1
- package/dist/plugins/shared/PopupManager.d.ts +2 -0
- package/dist/plugins/shared/PopupManager.d.ts.map +1 -1
- package/dist/plugins/shared/PopupPositioning.d.ts +1 -0
- package/dist/plugins/shared/PopupPositioning.d.ts.map +1 -1
- package/dist/plugins/shared/ShortcutFormatting.d.ts +9 -0
- package/dist/plugins/shared/ShortcutFormatting.d.ts.map +1 -0
- package/dist/plugins/shared/index.d.ts +12 -0
- package/dist/plugins/shared/index.d.ts.map +1 -0
- package/dist/plugins/shared.mjs +2 -0
- package/dist/plugins/shared.mjs.map +1 -0
- package/dist/plugins/strikethrough/StrikethroughLocale.d.ts +1 -8
- package/dist/plugins/strikethrough/StrikethroughLocale.d.ts.map +1 -1
- package/dist/plugins/strikethrough/StrikethroughPlugin.d.ts +1 -3
- package/dist/plugins/strikethrough/StrikethroughPlugin.d.ts.map +1 -1
- package/dist/plugins/strikethrough/index.d.ts +2 -0
- package/dist/plugins/strikethrough/index.d.ts.map +1 -1
- package/dist/plugins/strikethrough/locales/ar.d.ts +4 -0
- package/dist/plugins/strikethrough/locales/ar.d.ts.map +1 -0
- package/dist/plugins/strikethrough/locales/de.d.ts +4 -0
- package/dist/plugins/strikethrough/locales/de.d.ts.map +1 -0
- package/dist/plugins/strikethrough/locales/es.d.ts +4 -0
- package/dist/plugins/strikethrough/locales/es.d.ts.map +1 -0
- package/dist/plugins/strikethrough/locales/fr.d.ts +4 -0
- package/dist/plugins/strikethrough/locales/fr.d.ts.map +1 -0
- package/dist/plugins/strikethrough/locales/hi.d.ts +4 -0
- package/dist/plugins/strikethrough/locales/hi.d.ts.map +1 -0
- package/dist/plugins/strikethrough/locales/pt.d.ts +4 -0
- package/dist/plugins/strikethrough/locales/pt.d.ts.map +1 -0
- package/dist/plugins/strikethrough/locales/ru.d.ts +4 -0
- package/dist/plugins/strikethrough/locales/ru.d.ts.map +1 -0
- package/dist/plugins/strikethrough/locales/zh.d.ts +4 -0
- package/dist/plugins/strikethrough/locales/zh.d.ts.map +1 -0
- package/dist/plugins/strikethrough.mjs +1 -4
- package/dist/plugins/strikethrough.mjs.map +1 -1
- package/dist/plugins/super-sub/SuperSubLocale.d.ts +1 -8
- package/dist/plugins/super-sub/SuperSubLocale.d.ts.map +1 -1
- package/dist/plugins/super-sub/SuperSubPlugin.d.ts +1 -3
- package/dist/plugins/super-sub/SuperSubPlugin.d.ts.map +1 -1
- package/dist/plugins/super-sub/index.d.ts +2 -0
- package/dist/plugins/super-sub/index.d.ts.map +1 -1
- package/dist/plugins/super-sub/locales/ar.d.ts +4 -0
- package/dist/plugins/super-sub/locales/ar.d.ts.map +1 -0
- package/dist/plugins/super-sub/locales/de.d.ts +4 -0
- package/dist/plugins/super-sub/locales/de.d.ts.map +1 -0
- package/dist/plugins/super-sub/locales/es.d.ts +4 -0
- package/dist/plugins/super-sub/locales/es.d.ts.map +1 -0
- package/dist/plugins/super-sub/locales/fr.d.ts +4 -0
- package/dist/plugins/super-sub/locales/fr.d.ts.map +1 -0
- package/dist/plugins/super-sub/locales/hi.d.ts +4 -0
- package/dist/plugins/super-sub/locales/hi.d.ts.map +1 -0
- package/dist/plugins/super-sub/locales/pt.d.ts +4 -0
- package/dist/plugins/super-sub/locales/pt.d.ts.map +1 -0
- package/dist/plugins/super-sub/locales/ru.d.ts +4 -0
- package/dist/plugins/super-sub/locales/ru.d.ts.map +1 -0
- package/dist/plugins/super-sub/locales/zh.d.ts +4 -0
- package/dist/plugins/super-sub/locales/zh.d.ts.map +1 -0
- package/dist/plugins/super-sub.mjs +1 -4
- package/dist/plugins/super-sub.mjs.map +1 -1
- package/dist/plugins/table/TableCommands.d.ts +8 -8
- package/dist/plugins/table/TableCommands.d.ts.map +1 -1
- package/dist/plugins/table/TableContextMenu.d.ts.map +1 -1
- package/dist/plugins/table/TableControlsDOM.d.ts +4 -4
- package/dist/plugins/table/TableControlsDOM.d.ts.map +1 -1
- package/dist/plugins/table/TableLocale.d.ts +1 -8
- package/dist/plugins/table/TableLocale.d.ts.map +1 -1
- package/dist/plugins/table/TableNavigation.d.ts +1 -1
- package/dist/plugins/table/TableNavigation.d.ts.map +1 -1
- package/dist/plugins/table/TablePlugin.d.ts +3 -5
- package/dist/plugins/table/TablePlugin.d.ts.map +1 -1
- package/dist/plugins/table/TableSelection.d.ts +2 -0
- package/dist/plugins/table/TableSelection.d.ts.map +1 -1
- package/dist/plugins/table/index.d.ts +0 -5
- package/dist/plugins/table/index.d.ts.map +1 -1
- package/dist/plugins/table/locales/ar.d.ts +4 -0
- package/dist/plugins/table/locales/ar.d.ts.map +1 -0
- package/dist/plugins/table/locales/de.d.ts +4 -0
- package/dist/plugins/table/locales/de.d.ts.map +1 -0
- package/dist/plugins/table/locales/es.d.ts +4 -0
- package/dist/plugins/table/locales/es.d.ts.map +1 -0
- package/dist/plugins/table/locales/fr.d.ts +4 -0
- package/dist/plugins/table/locales/fr.d.ts.map +1 -0
- package/dist/plugins/table/locales/hi.d.ts +4 -0
- package/dist/plugins/table/locales/hi.d.ts.map +1 -0
- package/dist/plugins/table/locales/pt.d.ts +4 -0
- package/dist/plugins/table/locales/pt.d.ts.map +1 -0
- package/dist/plugins/table/locales/ru.d.ts +4 -0
- package/dist/plugins/table/locales/ru.d.ts.map +1 -0
- package/dist/plugins/table/locales/zh.d.ts +4 -0
- package/dist/plugins/table/locales/zh.d.ts.map +1 -0
- package/dist/plugins/table.mjs +1 -20
- package/dist/plugins/table.mjs.map +1 -1
- package/dist/plugins/text-color/TextColorLocale.d.ts +1 -8
- package/dist/plugins/text-color/TextColorLocale.d.ts.map +1 -1
- package/dist/plugins/text-color/TextColorPlugin.d.ts +1 -3
- package/dist/plugins/text-color/TextColorPlugin.d.ts.map +1 -1
- package/dist/plugins/text-color/index.d.ts +2 -0
- package/dist/plugins/text-color/index.d.ts.map +1 -1
- package/dist/plugins/text-color/locales/ar.d.ts +4 -0
- package/dist/plugins/text-color/locales/ar.d.ts.map +1 -0
- package/dist/plugins/text-color/locales/de.d.ts +4 -0
- package/dist/plugins/text-color/locales/de.d.ts.map +1 -0
- package/dist/plugins/text-color/locales/es.d.ts +4 -0
- package/dist/plugins/text-color/locales/es.d.ts.map +1 -0
- package/dist/plugins/text-color/locales/fr.d.ts +4 -0
- package/dist/plugins/text-color/locales/fr.d.ts.map +1 -0
- package/dist/plugins/text-color/locales/hi.d.ts +4 -0
- package/dist/plugins/text-color/locales/hi.d.ts.map +1 -0
- package/dist/plugins/text-color/locales/pt.d.ts +4 -0
- package/dist/plugins/text-color/locales/pt.d.ts.map +1 -0
- package/dist/plugins/text-color/locales/ru.d.ts +4 -0
- package/dist/plugins/text-color/locales/ru.d.ts.map +1 -0
- package/dist/plugins/text-color/locales/zh.d.ts +4 -0
- package/dist/plugins/text-color/locales/zh.d.ts.map +1 -0
- package/dist/plugins/text-color.mjs +1 -4
- package/dist/plugins/text-color.mjs.map +1 -1
- package/dist/plugins/text-direction/DirectionDetection.d.ts +17 -0
- package/dist/plugins/text-direction/DirectionDetection.d.ts.map +1 -0
- package/dist/plugins/text-direction/ShiftDirectionHandler.d.ts +12 -0
- package/dist/plugins/text-direction/ShiftDirectionHandler.d.ts.map +1 -0
- package/dist/plugins/text-direction/TextDirectionCorePlugin.d.ts +35 -0
- package/dist/plugins/text-direction/TextDirectionCorePlugin.d.ts.map +1 -0
- package/dist/plugins/text-direction/TextDirectionLocale.d.ts +20 -0
- package/dist/plugins/text-direction/TextDirectionLocale.d.ts.map +1 -0
- package/dist/plugins/text-direction/TextDirectionMiddleware.d.ts +18 -0
- package/dist/plugins/text-direction/TextDirectionMiddleware.d.ts.map +1 -0
- package/dist/plugins/text-direction/TextDirectionPlugin.d.ts +59 -0
- package/dist/plugins/text-direction/TextDirectionPlugin.d.ts.map +1 -0
- package/dist/plugins/text-direction/index.d.ts +5 -0
- package/dist/plugins/text-direction/index.d.ts.map +1 -0
- package/dist/plugins/text-direction/locales/ar.d.ts +4 -0
- package/dist/plugins/text-direction/locales/ar.d.ts.map +1 -0
- package/dist/plugins/text-direction/locales/de.d.ts +4 -0
- package/dist/plugins/text-direction/locales/de.d.ts.map +1 -0
- package/dist/plugins/text-direction/locales/es.d.ts +4 -0
- package/dist/plugins/text-direction/locales/es.d.ts.map +1 -0
- package/dist/plugins/text-direction/locales/fr.d.ts +4 -0
- package/dist/plugins/text-direction/locales/fr.d.ts.map +1 -0
- package/dist/plugins/text-direction/locales/hi.d.ts +4 -0
- package/dist/plugins/text-direction/locales/hi.d.ts.map +1 -0
- package/dist/plugins/text-direction/locales/pt.d.ts +4 -0
- package/dist/plugins/text-direction/locales/pt.d.ts.map +1 -0
- package/dist/plugins/text-direction/locales/ru.d.ts +4 -0
- package/dist/plugins/text-direction/locales/ru.d.ts.map +1 -0
- package/dist/plugins/text-direction/locales/zh.d.ts +4 -0
- package/dist/plugins/text-direction/locales/zh.d.ts.map +1 -0
- package/dist/plugins/text-direction-advanced/index.d.ts +5 -0
- package/dist/plugins/text-direction-advanced/index.d.ts.map +1 -0
- package/dist/plugins/text-direction-advanced.mjs +2 -0
- package/dist/plugins/text-direction-advanced.mjs.map +1 -0
- package/dist/plugins/text-direction.mjs +2 -0
- package/dist/plugins/text-direction.mjs.map +1 -0
- package/dist/plugins/text-formatting/TextFormattingLocale.d.ts +1 -8
- package/dist/plugins/text-formatting/TextFormattingLocale.d.ts.map +1 -1
- package/dist/plugins/text-formatting/TextFormattingPlugin.d.ts +1 -3
- package/dist/plugins/text-formatting/TextFormattingPlugin.d.ts.map +1 -1
- package/dist/plugins/text-formatting/index.d.ts +2 -0
- package/dist/plugins/text-formatting/index.d.ts.map +1 -1
- package/dist/plugins/text-formatting/locales/ar.d.ts +4 -0
- package/dist/plugins/text-formatting/locales/ar.d.ts.map +1 -0
- package/dist/plugins/text-formatting/locales/de.d.ts +4 -0
- package/dist/plugins/text-formatting/locales/de.d.ts.map +1 -0
- package/dist/plugins/text-formatting/locales/es.d.ts +4 -0
- package/dist/plugins/text-formatting/locales/es.d.ts.map +1 -0
- package/dist/plugins/text-formatting/locales/fr.d.ts +4 -0
- package/dist/plugins/text-formatting/locales/fr.d.ts.map +1 -0
- package/dist/plugins/text-formatting/locales/hi.d.ts +4 -0
- package/dist/plugins/text-formatting/locales/hi.d.ts.map +1 -0
- package/dist/plugins/text-formatting/locales/pt.d.ts +4 -0
- package/dist/plugins/text-formatting/locales/pt.d.ts.map +1 -0
- package/dist/plugins/text-formatting/locales/ru.d.ts +4 -0
- package/dist/plugins/text-formatting/locales/ru.d.ts.map +1 -0
- package/dist/plugins/text-formatting/locales/zh.d.ts +4 -0
- package/dist/plugins/text-formatting/locales/zh.d.ts.map +1 -0
- package/dist/plugins/text-formatting.mjs +1 -4
- package/dist/plugins/text-formatting.mjs.map +1 -1
- package/dist/plugins/toolbar/ToolbarItem.d.ts +2 -18
- package/dist/plugins/toolbar/ToolbarItem.d.ts.map +1 -1
- package/dist/plugins/toolbar/ToolbarKeyboardNav.d.ts +5 -11
- package/dist/plugins/toolbar/ToolbarKeyboardNav.d.ts.map +1 -1
- package/dist/plugins/toolbar/ToolbarLocale.d.ts +2 -8
- package/dist/plugins/toolbar/ToolbarLocale.d.ts.map +1 -1
- package/dist/plugins/toolbar/ToolbarOverflowController.d.ts.map +1 -1
- package/dist/plugins/toolbar/ToolbarPlugin.d.ts +2 -2
- package/dist/plugins/toolbar/ToolbarPlugin.d.ts.map +1 -1
- package/dist/plugins/toolbar/ToolbarPopupController.d.ts +3 -1
- package/dist/plugins/toolbar/ToolbarPopupController.d.ts.map +1 -1
- package/dist/plugins/toolbar/ToolbarRenderers.d.ts +2 -1
- package/dist/plugins/toolbar/ToolbarRenderers.d.ts.map +1 -1
- package/dist/plugins/toolbar/index.d.ts +4 -1
- package/dist/plugins/toolbar/index.d.ts.map +1 -1
- package/dist/plugins/toolbar/locales/ar.d.ts +4 -0
- package/dist/plugins/toolbar/locales/ar.d.ts.map +1 -0
- package/dist/plugins/toolbar/locales/de.d.ts +4 -0
- package/dist/plugins/toolbar/locales/de.d.ts.map +1 -0
- package/dist/plugins/toolbar/locales/es.d.ts +4 -0
- package/dist/plugins/toolbar/locales/es.d.ts.map +1 -0
- package/dist/plugins/toolbar/locales/fr.d.ts +4 -0
- package/dist/plugins/toolbar/locales/fr.d.ts.map +1 -0
- package/dist/plugins/toolbar/locales/hi.d.ts +4 -0
- package/dist/plugins/toolbar/locales/hi.d.ts.map +1 -0
- package/dist/plugins/toolbar/locales/pt.d.ts +4 -0
- package/dist/plugins/toolbar/locales/pt.d.ts.map +1 -0
- package/dist/plugins/toolbar/locales/ru.d.ts +4 -0
- package/dist/plugins/toolbar/locales/ru.d.ts.map +1 -0
- package/dist/plugins/toolbar/locales/zh.d.ts +4 -0
- package/dist/plugins/toolbar/locales/zh.d.ts.map +1 -0
- package/dist/plugins/toolbar.mjs +1 -7
- package/dist/plugins/toolbar.mjs.map +1 -1
- package/dist/presets/FullPreset.d.ts +4 -1
- package/dist/presets/FullPreset.d.ts.map +1 -1
- package/dist/presets/MinimalPreset.d.ts +3 -0
- package/dist/presets/MinimalPreset.d.ts.map +1 -1
- package/dist/presets/PresetTypes.d.ts +2 -0
- package/dist/presets/PresetTypes.d.ts.map +1 -1
- package/dist/presets/full.d.ts +17 -0
- package/dist/presets/full.d.ts.map +1 -0
- package/dist/presets/full.mjs +2 -0
- package/dist/presets/full.mjs.map +1 -0
- package/dist/presets/minimal.d.ts +17 -0
- package/dist/presets/minimal.d.ts.map +1 -0
- package/dist/presets/minimal.mjs +2 -0
- package/dist/presets/minimal.mjs.map +1 -0
- package/dist/presets.d.ts +20 -0
- package/dist/presets.d.ts.map +1 -0
- package/dist/presets.mjs +2 -0
- package/dist/presets.mjs.map +1 -0
- package/dist/serialization/CSSClassCollector.d.ts.map +1 -0
- package/dist/serialization/ContentHTMLTypes.d.ts.map +1 -0
- package/dist/serialization/DocumentParser.d.ts.map +1 -0
- package/dist/{editor → serialization}/DocumentSerializer.d.ts +2 -0
- package/dist/serialization/DocumentSerializer.d.ts.map +1 -0
- package/dist/{editor → serialization}/MarkSerializer.d.ts +3 -2
- package/dist/serialization/MarkSerializer.d.ts.map +1 -0
- package/dist/serialization/index.d.ts +12 -0
- package/dist/serialization/index.d.ts.map +1 -0
- package/dist/state/BlockBoundaryMovement.d.ts +7 -0
- package/dist/state/BlockBoundaryMovement.d.ts.map +1 -0
- package/dist/{model/NavigationUtils.d.ts → state/NavigationQueries.d.ts} +3 -3
- package/dist/state/NavigationQueries.d.ts.map +1 -0
- package/dist/test/PluginTestUtils.d.ts +0 -2
- package/dist/test/PluginTestUtils.d.ts.map +1 -1
- package/dist/test/TestUtils.d.ts +2 -2
- package/dist/test/TestUtils.d.ts.map +1 -1
- package/dist/view/BlockRendering.d.ts +10 -0
- package/dist/view/BlockRendering.d.ts.map +1 -0
- package/dist/view/BlockWrapperManagement.d.ts +27 -0
- package/dist/view/BlockWrapperManagement.d.ts.map +1 -0
- package/dist/view/CaretNavigation.d.ts +1 -8
- package/dist/view/CaretNavigation.d.ts.map +1 -1
- package/dist/view/CursorWrapper.d.ts.map +1 -1
- package/dist/view/DecorationRendering.d.ts +17 -0
- package/dist/view/DecorationRendering.d.ts.map +1 -0
- package/dist/view/DomUtils.d.ts +4 -0
- package/dist/view/DomUtils.d.ts.map +1 -0
- package/dist/view/EditorView.d.ts +7 -10
- package/dist/view/EditorView.d.ts.map +1 -1
- package/dist/view/GapCursorNavigation.d.ts +12 -0
- package/dist/view/GapCursorNavigation.d.ts.map +1 -0
- package/dist/view/InlineRendering.d.ts +11 -0
- package/dist/view/InlineRendering.d.ts.map +1 -0
- package/dist/view/MarkRendering.d.ts +5 -0
- package/dist/view/MarkRendering.d.ts.map +1 -1
- package/dist/view/Reconciler.d.ts +2 -6
- package/dist/view/Reconciler.d.ts.map +1 -1
- package/dist/view/SelectionSync.d.ts +41 -2
- package/dist/view/SelectionSync.d.ts.map +1 -1
- package/dist/view/ViewMovementCommands.d.ts.map +1 -1
- package/package.json +208 -8
- package/dist/chunks/AttrRegistry-D9Jx_RVb.mjs +0 -16
- package/dist/chunks/AttrRegistry-D9Jx_RVb.mjs.map +0 -1
- package/dist/chunks/AttributedMarkCommands-BtLea72z.mjs +0 -80
- package/dist/chunks/CaretNavigation-7JYpIKbs.mjs +0 -311
- package/dist/chunks/CaretNavigation-7JYpIKbs.mjs.map +0 -1
- package/dist/chunks/ColorGrid--lBQ7jCK.mjs +0 -81
- package/dist/chunks/ColorGrid--lBQ7jCK.mjs.map +0 -1
- package/dist/chunks/ColorPickerPopup-TpIRlXc8.mjs +0 -37
- package/dist/chunks/ColorPickerPopup-TpIRlXc8.mjs.map +0 -1
- package/dist/chunks/ColorValidation-CV4f1wu6.mjs +0 -39
- package/dist/chunks/Document-Brtw2jL1.mjs +0 -190
- package/dist/chunks/HTMLUtils-DTqQzcKR.mjs +0 -35
- package/dist/chunks/HTMLUtils-DTqQzcKR.mjs.map +0 -1
- package/dist/chunks/MarkCommands-6RUJ4L3r.mjs +0 -94
- package/dist/chunks/NavigationUtils-Cspt2ZrK.mjs +0 -47
- package/dist/chunks/NavigationUtils-Cspt2ZrK.mjs.map +0 -1
- package/dist/chunks/NodeResolver-C2XYkeOi.mjs +0 -81
- package/dist/chunks/NodeResolver-C2XYkeOi.mjs.map +0 -1
- package/dist/chunks/NodeSpec-NZVvcCuH.mjs +0 -8
- package/dist/chunks/NodeSpec-NZVvcCuH.mjs.map +0 -1
- package/dist/chunks/Platform-S_xqIqcM.mjs +0 -26
- package/dist/chunks/Platform-S_xqIqcM.mjs.map +0 -1
- package/dist/chunks/PopupPositioning-CgjgAKjp.mjs +0 -34
- package/dist/chunks/PopupPositioning-CgjgAKjp.mjs.map +0 -1
- package/dist/chunks/RangeIterator-Bh4Vl_6D.mjs +0 -16
- package/dist/chunks/Selection-BRTab5hO.mjs +0 -52
- package/dist/chunks/StyleRuntime-CP4NCwKT.mjs +0 -235
- package/dist/chunks/ToolbarItem-BpZggUGo.mjs +0 -8
- package/dist/chunks/ToolbarItem-BpZggUGo.mjs.map +0 -1
- package/dist/chunks/ToolbarKeyboardNav-DhpL8zNV.mjs +0 -46
- package/dist/chunks/ToolbarKeyboardNav-DhpL8zNV.mjs.map +0 -1
- package/dist/chunks/TypeBrands-C09nE2qO.mjs +0 -27
- package/dist/chunks/index--7pBhSF4.mjs +0 -542
- package/dist/chunks/index--7pBhSF4.mjs.map +0 -1
- package/dist/chunks/index-BXCkjDax.mjs +0 -161
- package/dist/chunks/index-BXCkjDax.mjs.map +0 -1
- package/dist/chunks/index-BXtw5PNN.mjs +0 -39
- package/dist/chunks/index-BXtw5PNN.mjs.map +0 -1
- package/dist/chunks/index-BcDRT4K2.mjs +0 -1019
- package/dist/chunks/index-BcDRT4K2.mjs.map +0 -1
- package/dist/chunks/index-BjFBWBOC.mjs +0 -168
- package/dist/chunks/index-BjFBWBOC.mjs.map +0 -1
- package/dist/chunks/index-C1opJocO.mjs +0 -92
- package/dist/chunks/index-C1opJocO.mjs.map +0 -1
- package/dist/chunks/index-CCyqQ0Dz.mjs +0 -228
- package/dist/chunks/index-CCyqQ0Dz.mjs.map +0 -1
- package/dist/chunks/index-Cd3uJLP3.mjs +0 -73
- package/dist/chunks/index-Cd3uJLP3.mjs.map +0 -1
- package/dist/chunks/index-DSAuGP4n.mjs +0 -410
- package/dist/chunks/index-DSAuGP4n.mjs.map +0 -1
- package/dist/chunks/index-DtRfqsq5.mjs +0 -924
- package/dist/chunks/index-DtRfqsq5.mjs.map +0 -1
- package/dist/chunks/index-Dum8yE_t.mjs +0 -62
- package/dist/chunks/index-Dum8yE_t.mjs.map +0 -1
- package/dist/chunks/index-DxbQirny.mjs +0 -63
- package/dist/chunks/index-DxbQirny.mjs.map +0 -1
- package/dist/chunks/index-ErZ5_a1o.mjs +0 -296
- package/dist/chunks/index-ErZ5_a1o.mjs.map +0 -1
- package/dist/chunks/index-WpbK_s_H.mjs +0 -119
- package/dist/chunks/index-WpbK_s_H.mjs.map +0 -1
- package/dist/chunks/index-WrqH1wG8.mjs +0 -50
- package/dist/chunks/index-WrqH1wG8.mjs.map +0 -1
- package/dist/chunks/index-fsVJLutn.mjs +0 -118
- package/dist/chunks/index-fsVJLutn.mjs.map +0 -1
- package/dist/chunks/index-fx3KIap3.mjs +0 -50
- package/dist/chunks/index-fx3KIap3.mjs.map +0 -1
- package/dist/chunks/index-oOJo-ywB.mjs +0 -467
- package/dist/chunks/index-oOJo-ywB.mjs.map +0 -1
- package/dist/chunks/index-toj88jtL.mjs +0 -101
- package/dist/chunks/index-toj88jtL.mjs.map +0 -1
- package/dist/chunks/resolvePluginLocale-B4w1OkPy.mjs +0 -34
- package/dist/chunks/resolvePluginLocale-B4w1OkPy.mjs.map +0 -1
- package/dist/editor/CSSClassCollector.d.ts.map +0 -1
- package/dist/editor/ContentHTMLTypes.d.ts.map +0 -1
- package/dist/editor/DocumentParser.d.ts.map +0 -1
- package/dist/editor/DocumentSerializer.d.ts.map +0 -1
- package/dist/editor/MarkSerializer.d.ts.map +0 -1
- package/dist/editor/PaperSize.d.ts.map +0 -1
- package/dist/i18n/resolvePluginLocale.d.ts +0 -3
- package/dist/i18n/resolvePluginLocale.d.ts.map +0 -1
- package/dist/model/BuiltinSpecs.d.ts.map +0 -1
- package/dist/model/HTMLParser.d.ts.map +0 -1
- package/dist/model/NavigationUtils.d.ts.map +0 -1
- package/dist/view/Platform.d.ts.map +0 -1
- /package/dist/{input → model}/InputRule.d.ts +0 -0
- /package/dist/{input → model}/InputRuleRegistry.d.ts +0 -0
- /package/dist/{input → model}/Keymap.d.ts +0 -0
- /package/dist/{input → model}/KeymapRegistry.d.ts +0 -0
- /package/dist/{editor → model}/PaperSize.d.ts +0 -0
- /package/dist/{editor → serialization}/CSSClassCollector.d.ts +0 -0
- /package/dist/{editor → serialization}/ContentHTMLTypes.d.ts +0 -0
- /package/dist/{editor → serialization}/DocumentParser.d.ts +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AttributedMarkCommands-BtLea72z.mjs","sources":["../../src/commands/AttributedMarkCommands.ts"],"sourcesContent":["/**\n * Generic helpers for attributed marks (marks with key/value attrs).\n *\n * Unlike boolean marks (`bold`, `italic`) that toggle on/off, attributed\n * marks (`font`, `fontSize`, `textColor`, `highlight`) carry data and use\n * **replace** semantics: applying a new value removes the old one first.\n *\n * These helpers extract the duplicated collapsed-vs-range branching that\n * was previously copy-pasted across ColorMarkOperations, FontSizeOperations,\n * and FontPlugin.\n */\n\nimport { isMarkOfType } from '../model/AttrRegistry.js';\nimport type { MarkAttrRegistry } from '../model/AttrRegistry.js';\nimport type { BlockNode, Mark, TextNode } from '../model/Document.js';\nimport {\n\tgetBlockMarksAtOffset,\n\tgetInlineChildren,\n\thasMark,\n\tisTextNode,\n} from '../model/Document.js';\nimport type { InlineNode } from '../model/Document.js';\nimport { isCollapsed, isGapCursor, isNodeSelection, selectionRange } from '../model/Selection.js';\nimport { markType } from '../model/TypeBrands.js';\nimport type { MarkTypeName } 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/**\n * Applies an attributed mark to the current selection.\n *\n * - **Collapsed cursor**: replaces stored marks (filters out old mark of the\n * same type, appends the new one).\n * - **Range selection**: removes then re-adds the mark in every block span.\n *\n * Returns the built `Transaction`, or `null` when the selection is\n * unsupported (node-selection / gap-cursor) or the anchor block is missing.\n */\nexport function applyAttributedMark(state: EditorState, mark: Mark): Transaction | null {\n\tconst sel = state.selection;\n\tif (isNodeSelection(sel) || isGapCursor(sel)) return null;\n\n\tconst typeName: MarkTypeName = markType(mark.type as string);\n\n\tif (isCollapsed(sel)) {\n\t\tconst anchorBlock = state.getBlock(sel.anchor.blockId);\n\t\tif (!anchorBlock) return null;\n\t\tconst currentMarks: readonly Mark[] =\n\t\t\tstate.storedMarks ?? getBlockMarksAtOffset(anchorBlock, sel.anchor.offset);\n\t\tconst withoutMark: readonly Mark[] = currentMarks.filter((m) => m.type !== typeName);\n\t\tconst newMarks: readonly Mark[] = [...withoutMark, 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\tconst range = selectionRange(sel, state.getBlockOrder());\n\tconst builder = state.transaction('command');\n\n\tforEachBlockInRange(state, range, (blockId, from, to) => {\n\t\tconst block: BlockNode | undefined = state.getBlock(blockId);\n\t\tif (block) {\n\t\t\tconst existing: Mark | undefined = findMarkInRange(block, typeName, from, to);\n\t\t\tif (existing) {\n\t\t\t\tbuilder.removeMark(blockId, from, to, existing);\n\t\t\t}\n\t\t}\n\t\tbuilder.addMark(blockId, from, to, mark);\n\t});\n\n\tbuilder.setSelection(sel);\n\treturn builder.build();\n}\n\n/**\n * Removes an attributed mark from the current selection.\n *\n * - **Collapsed cursor**: filters the mark out of stored marks.\n * Returns `null` when the mark was not present.\n * - **Range selection**: removes the mark across all block spans.\n *\n * Returns the built `Transaction`, or `null` when the selection is\n * unsupported or the mark is absent at a collapsed cursor.\n */\nexport function removeAttributedMark(\n\tstate: EditorState,\n\tmarkTypeName: MarkTypeName,\n): Transaction | null {\n\tconst sel = state.selection;\n\tif (isNodeSelection(sel) || isGapCursor(sel)) return null;\n\n\tif (isCollapsed(sel)) {\n\t\tconst anchorBlock = state.getBlock(sel.anchor.blockId);\n\t\tif (!anchorBlock) return null;\n\t\tconst currentMarks: readonly Mark[] =\n\t\t\tstate.storedMarks ?? getBlockMarksAtOffset(anchorBlock, sel.anchor.offset);\n\t\tif (!hasMark(currentMarks, markTypeName)) return null;\n\n\t\tconst newMarks: readonly Mark[] = currentMarks.filter((m) => m.type !== markTypeName);\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\tconst range = selectionRange(sel, state.getBlockOrder());\n\tconst builder = state.transaction('command');\n\n\tforEachBlockInRange(state, range, (blockId, from, to) => {\n\t\tconst block: BlockNode | undefined = state.getBlock(blockId);\n\t\tconst existing: Mark | undefined = block\n\t\t\t? findMarkInRange(block, markTypeName, from, to)\n\t\t\t: undefined;\n\t\tbuilder.removeMark(blockId, from, to, existing ?? { type: markTypeName });\n\t});\n\n\tbuilder.setSelection(sel);\n\treturn builder.build();\n}\n\n/**\n * Extracts a typed attribute value from the mark at the current selection.\n *\n * Looks at stored marks (collapsed w/ stored), block marks at cursor offset\n * (collapsed w/o stored), or anchor-block marks (range).\n *\n * @param extractFn — Narrows the found mark and returns the desired value,\n * or `null` when the mark's attrs don't match expectations.\n */\nexport function getMarkAttrAtSelection<K extends keyof MarkAttrRegistry, V>(\n\tstate: EditorState,\n\tmarkTypeName: K,\n\textractFn: (mark: Mark & { readonly type: K; readonly attrs: MarkAttrRegistry[K] }) => V | null,\n): V | null {\n\tconst sel = state.selection;\n\tif (isNodeSelection(sel) || isGapCursor(sel)) return null;\n\n\tif (isCollapsed(sel) && state.storedMarks) {\n\t\tconst found = state.storedMarks.find((m) => (m.type as string) === markTypeName);\n\t\treturn found && isMarkOfType(found, markTypeName) ? extractFn(found) : null;\n\t}\n\n\tconst block = state.getBlock(sel.anchor.blockId);\n\tif (!block) return null;\n\tconst marks: readonly Mark[] = getBlockMarksAtOffset(block, sel.anchor.offset);\n\tconst found = marks.find((m) => (m.type as string) === markTypeName);\n\treturn found && isMarkOfType(found, markTypeName) ? extractFn(found) : null;\n}\n\n/**\n * Returns `true` when the given attributed mark type is present at the\n * current selection (collapsed or range).\n */\nexport function isAttributedMarkActive<K extends keyof MarkAttrRegistry>(\n\tstate: EditorState,\n\tmarkTypeName: K,\n): boolean {\n\treturn getMarkAttrAtSelection(state, markTypeName, () => true as const) !== null;\n}\n\n/**\n * Finds the first mark of the given type within an offset range of a block.\n *\n * Returns the full mark (including attrs) so callers can pass it to\n * `removeMark` for correct undo inversion, or `undefined` when absent.\n */\nfunction findMarkInRange(\n\tblock: BlockNode,\n\ttypeName: MarkTypeName,\n\tfrom: number,\n\tto: number,\n): Mark | undefined {\n\tconst children: readonly (TextNode | InlineNode)[] = getInlineChildren(block);\n\tlet pos = 0;\n\n\tfor (const child of children) {\n\t\tif (!isTextNode(child)) {\n\t\t\tpos += 1;\n\t\t\tcontinue;\n\t\t}\n\t\tconst nodeEnd: number = pos + child.text.length;\n\t\tif (nodeEnd > from && pos < to) {\n\t\t\tconst found: Mark | undefined = child.marks.find((m) => m.type === typeName);\n\t\t\tif (found) return found;\n\t\t}\n\t\tpos = nodeEnd;\n\t}\n\treturn undefined;\n}\n"],"names":["applyAttributedMark","state","mark","sel","selection","isNodeSelection","isGapCursor","typeName","markType","type","isCollapsed","anchorBlock","getBlock","anchor","blockId","newMarks","storedMarks","getBlockMarksAtOffset","offset","filter","m","transaction","setStoredMarks","setSelection","build","range","selectionRange","getBlockOrder","builder","forEachBlockInRange","from","to","block","existing","findMarkInRange","removeMark","addMark","removeAttributedMark","markTypeName","currentMarks","hasMark","getMarkAttrAtSelection","extractFn","found","find","isMarkOfType","isAttributedMarkActive","children","getInlineChildren","pos","child","isTextNode","nodeEnd","text","length","marks"],"mappings":";;;;;AAuCO,SAASA,EAAoBC,IAAoBC,IAAAA;AACvD,QAAMC,KAAMF,GAAMG;AAClB,MAAIC,EAAgBF,OAAQG,EAAYH,EAAAA,EAAM,QAAO;AAErD,QAAMI,KAAyBC,EAASN,GAAKO;AAE7C,MAAIC,EAAYP,KAAM;AACrB,UAAMQ,KAAcV,GAAMW,SAAST,GAAIU,OAAOC,OAAAA;AAC9C,SAAKH,GAAa,QAAO;AACzB,UAGMI,KAA4B,KAFjCd,GAAMe,eAAeC,EAAsBN,IAAaR,GAAIU,OAAOK,MAAAA,GAClBC,OAAQC,CAAAA,OAAMA,GAAEX,SAASF,KACxBL,EAAAA;AAEnD,WAAOD,GACLoB,YAAY,SAAA,EACZC,eAAeP,IAAUd,GAAMe,aAC/BO,aAAapB,EAAAA,EACbqB;EACH;AAEA,QAAMC,KAAQC,EAAevB,IAAKF,GAAM0B,cAAAA,CAAAA,GAClCC,KAAU3B,GAAMoB,YAAY,SAAA;AAclC,SAZAQ,EAAoB5B,IAAOwB,IAAO,CAACX,IAASgB,IAAMC;AACjD,UAAMC,KAA+B/B,GAAMW,SAASE,EAAAA;AACpD,QA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O,SAASiB,EACfxC,IACAqC,IACAI;AAEA,QAAMvC,KAAMF,GAAMG;AAClB,MAAIC,EAAgBF,EAAAA,KAAQG,EAAYH,IAAM,QAAO;AAErD,MAAIO,EAAYP,EAAAA,KAAQF,GAAMe,aAAa;AAC1C,UAAM2B,KAAQ1C,GAAMe,YAAY4B,KAAMxB,CAAAA,OAAOA,GAAEX,SAAoB6B,EAAAA;AACnE,WAAOK,MAASE,EAAaF,IAAOL,EAAAA,IAAgBI,GAAUC,MAAS;AAAA,EACxE;AAEA,QAAMX,KAAQ/B,GAAMW,SAAST,GAAIU,OAAOC,OAAAA;AACxC,OAAKkB,GAAO,QAAO;AACnB,QACMW,KADyB1B,EAAsBe,IAAO7B,GAAIU,OAAOK,MAAAA,EACnD0B,KAAMxB,CAAAA,OAAOA,GAAEX,SAAoB6B;AACvD,SAAOK,MAASE,EAAaF,IAAOL,EAAAA,IAAgBI,GAAUC,EAAAA,IAAS;AACxE;AAMO,SAASG,EACf7C,IACAqC,IAAAA;AAEA,SAA4E,SAArEG,EAAuBxC,IAAOqC,IAAc,MAAA,IAAM;AAC1D;AAQA,SAASJ,EACRF,IACAzB,IACAuB,IACAC;AAEA,QAAMgB,KAA+CC,EAAkBhB,EAAAA;AACvE,MAAIiB,KAAM;AAEV,aAAWC,MAASH,IAAU;AAC7B,QAAA,CAAKI,EAAWD,KAAQ;AACvBD,MAAAA,MAAO;AACP;AAAA,IACD;AACA,UAAMG,KAAkBH,KAAMC,GAAMG,KAAKC;AACzC,QAAIF,KAAUtB,MAAQmB,KAAMlB,IAAI;AAC/B,YAAMY,KAA0BO,GAAMK,MAAMX,KAAMxB,CAAAA,OAAMA,GAAEX,SAASF,EAAAA;AACnE,UAAIoC,GAAO,QAAOA;AAAAA,IACnB;AACAM,IAAAA,KAAMG;AAAAA,EACP;AAED;"}
|
|
1
|
+
{"version":3,"file":"AttributedMarkCommands-BB7lzFct.mjs","sources":["../../src/commands/AttributedMarkCommands.ts"],"sourcesContent":["/**\n * Generic helpers for attributed marks (marks with key/value attrs).\n *\n * Unlike boolean marks (`bold`, `italic`) that toggle on/off, attributed\n * marks (`font`, `fontSize`, `textColor`, `highlight`) carry data and use\n * **replace** semantics: applying a new value removes the old one first.\n *\n * These helpers extract the duplicated collapsed-vs-range branching that\n * was previously copy-pasted across ColorMarkOperations, FontSizeOperations,\n * and FontPlugin.\n */\n\nimport { isMarkOfType } from '../model/AttrRegistry.js';\nimport type { MarkAttrRegistry } from '../model/AttrRegistry.js';\nimport type { BlockNode, Mark, TextNode } from '../model/Document.js';\nimport {\n\tgetBlockMarksAtOffset,\n\tgetInlineChildren,\n\thasMark,\n\tisTextNode,\n} from '../model/Document.js';\nimport type { InlineNode } from '../model/Document.js';\nimport { isCollapsed, isGapCursor, isNodeSelection, selectionRange } from '../model/Selection.js';\nimport { markType } from '../model/TypeBrands.js';\nimport type { MarkTypeName } 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/**\n * Applies an attributed mark to the current selection.\n *\n * - **Collapsed cursor**: replaces stored marks (filters out old mark of the\n * same type, appends the new one).\n * - **Range selection**: removes then re-adds the mark in every block span.\n *\n * Returns the built `Transaction`, or `null` when the selection is\n * unsupported (node-selection / gap-cursor) or the anchor block is missing.\n */\nexport function applyAttributedMark(state: EditorState, mark: Mark): Transaction | null {\n\tconst sel = state.selection;\n\tif (isNodeSelection(sel) || isGapCursor(sel)) return null;\n\n\tconst typeName: MarkTypeName = markType(mark.type as string);\n\n\tif (isCollapsed(sel)) {\n\t\tconst anchorBlock = state.getBlock(sel.anchor.blockId);\n\t\tif (!anchorBlock) return null;\n\t\tconst currentMarks: readonly Mark[] =\n\t\t\tstate.storedMarks ?? getBlockMarksAtOffset(anchorBlock, sel.anchor.offset);\n\t\tconst withoutMark: readonly Mark[] = currentMarks.filter((m) => m.type !== typeName);\n\t\tconst newMarks: readonly Mark[] = [...withoutMark, 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\tconst range = selectionRange(sel, state.getBlockOrder());\n\tconst builder = state.transaction('command');\n\n\tforEachBlockInRange(state, range, (blockId, from, to) => {\n\t\tconst block: BlockNode | undefined = state.getBlock(blockId);\n\t\tif (block) {\n\t\t\tconst existing: Mark | undefined = findMarkInRange(block, typeName, from, to);\n\t\t\tif (existing) {\n\t\t\t\tbuilder.removeMark(blockId, from, to, existing);\n\t\t\t}\n\t\t}\n\t\tbuilder.addMark(blockId, from, to, mark);\n\t});\n\n\tbuilder.setSelection(sel);\n\treturn builder.build();\n}\n\n/**\n * Removes an attributed mark from the current selection.\n *\n * - **Collapsed cursor**: filters the mark out of stored marks.\n * Returns `null` when the mark was not present.\n * - **Range selection**: removes the mark across all block spans.\n *\n * Returns the built `Transaction`, or `null` when the selection is\n * unsupported or the mark is absent at a collapsed cursor.\n */\nexport function removeAttributedMark(\n\tstate: EditorState,\n\tmarkTypeName: MarkTypeName,\n): Transaction | null {\n\tconst sel = state.selection;\n\tif (isNodeSelection(sel) || isGapCursor(sel)) return null;\n\n\tif (isCollapsed(sel)) {\n\t\tconst anchorBlock = state.getBlock(sel.anchor.blockId);\n\t\tif (!anchorBlock) return null;\n\t\tconst currentMarks: readonly Mark[] =\n\t\t\tstate.storedMarks ?? getBlockMarksAtOffset(anchorBlock, sel.anchor.offset);\n\t\tif (!hasMark(currentMarks, markTypeName)) return null;\n\n\t\tconst newMarks: readonly Mark[] = currentMarks.filter((m) => m.type !== markTypeName);\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\tconst range = selectionRange(sel, state.getBlockOrder());\n\tconst builder = state.transaction('command');\n\n\tforEachBlockInRange(state, range, (blockId, from, to) => {\n\t\tconst block: BlockNode | undefined = state.getBlock(blockId);\n\t\tconst existing: Mark | undefined = block\n\t\t\t? findMarkInRange(block, markTypeName, from, to)\n\t\t\t: undefined;\n\t\tbuilder.removeMark(blockId, from, to, existing ?? { type: markTypeName });\n\t});\n\n\tbuilder.setSelection(sel);\n\treturn builder.build();\n}\n\n/**\n * Extracts a typed attribute value from the mark at the current selection.\n *\n * Looks at stored marks (collapsed w/ stored), block marks at cursor offset\n * (collapsed w/o stored), or anchor-block marks (range).\n *\n * @param extractFn — Narrows the found mark and returns the desired value,\n * or `null` when the mark's attrs don't match expectations.\n */\nexport function getMarkAttrAtSelection<K extends keyof MarkAttrRegistry, V>(\n\tstate: EditorState,\n\tmarkTypeName: K,\n\textractFn: (mark: Mark & { readonly type: K; readonly attrs: MarkAttrRegistry[K] }) => V | null,\n): V | null {\n\tconst sel = state.selection;\n\tif (isNodeSelection(sel) || isGapCursor(sel)) return null;\n\n\tif (isCollapsed(sel) && state.storedMarks) {\n\t\tconst found = state.storedMarks.find((m) => (m.type as string) === markTypeName);\n\t\treturn found && isMarkOfType(found, markTypeName) ? extractFn(found) : null;\n\t}\n\n\tconst block = state.getBlock(sel.anchor.blockId);\n\tif (!block) return null;\n\tconst marks: readonly Mark[] = getBlockMarksAtOffset(block, sel.anchor.offset);\n\tconst found = marks.find((m) => (m.type as string) === markTypeName);\n\treturn found && isMarkOfType(found, markTypeName) ? extractFn(found) : null;\n}\n\n/**\n * Returns `true` when the given attributed mark type is present at the\n * current selection (collapsed or range).\n */\nexport function isAttributedMarkActive<K extends keyof MarkAttrRegistry>(\n\tstate: EditorState,\n\tmarkTypeName: K,\n): boolean {\n\treturn getMarkAttrAtSelection(state, markTypeName, () => true as const) !== null;\n}\n\n/**\n * Finds the first mark of the given type within an offset range of a block.\n *\n * Returns the full mark (including attrs) so callers can pass it to\n * `removeMark` for correct undo inversion, or `undefined` when absent.\n */\nfunction findMarkInRange(\n\tblock: BlockNode,\n\ttypeName: MarkTypeName,\n\tfrom: number,\n\tto: number,\n): Mark | undefined {\n\tconst children: readonly (TextNode | InlineNode)[] = getInlineChildren(block);\n\tlet pos = 0;\n\n\tfor (const child of children) {\n\t\tif (!isTextNode(child)) {\n\t\t\tpos += 1;\n\t\t\tcontinue;\n\t\t}\n\t\tconst nodeEnd: number = pos + child.text.length;\n\t\tif (nodeEnd > from && pos < to) {\n\t\t\tconst found: Mark | undefined = child.marks.find((m) => m.type === typeName);\n\t\t\tif (found) return found;\n\t\t}\n\t\tpos = nodeEnd;\n\t}\n\treturn undefined;\n}\n"],"names":["applyAttributedMark","state","mark","sel","selection","isNodeSelection","isGapCursor","typeName","markType","type","isCollapsed","anchorBlock","getBlock","anchor","blockId","newMarks","storedMarks","getBlockMarksAtOffset","offset","filter","m","transaction","setStoredMarks","setSelection","build","range","selectionRange","getBlockOrder","builder","forEachBlockInRange","from","to","block","existing","findMarkInRange","removeMark","addMark","removeAttributedMark","markTypeName","currentMarks","hasMark","getMarkAttrAtSelection","extractFn","found","find","isMarkOfType","isAttributedMarkActive","children","getInlineChildren","pos","child","isTextNode","nodeEnd","text","length","marks"],"mappings":"6QAuCO,SAASA,EAAoBC,EAAoBC,GACvD,MAAMC,EAAMF,EAAMG,UAClB,GAAIC,EAAgBF,IAAQG,EAAYH,GAAM,OAAO,KAErD,MAAMI,EAAyBC,EAASN,EAAKO,MAE7C,GAAIC,EAAYP,GAAM,CACrB,MAAMQ,EAAcV,EAAMW,SAAST,EAAIU,OAAOC,SAC9C,IAAKH,EAAa,OAAO,KACzB,MAGMI,EAA4B,KAFjCd,EAAMe,aAAeC,EAAsBN,EAAaR,EAAIU,OAAOK,SAClBC,OAAQC,GAAMA,EAAEX,OAASF,GACxBL,GAEnD,OAAOD,EACLoB,YAAY,WACZC,eAAeP,EAAUd,EAAMe,aAC/BO,aAAapB,GACbqB,OACH,CAEA,MAAMC,EAAQC,EAAevB,EAAKF,EAAM0B,iBAClCC,EAAU3B,EAAMoB,YAAY,WAclC,OAZAQ,EAAoB5B,EAAOw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YAAa,CAC1C,MAAM2B,EAAQ1C,EAAMe,YAAY4B,KAAMxB,GAAOA,EAAEX,OAAoB6B,GACnE,OAAOK,GAASE,EAAaF,EAAOL,GAAgBI,EAAUC,GAAS,IACxE,CAEA,MAAMX,EAAQ/B,EAAMW,SAAST,EAAIU,OAAOC,SACxC,IAAKkB,EAAO,OAAO,KACnB,MACMW,EADyB1B,EAAsBe,EAAO7B,EAAIU,OAAOK,QACnD0B,KAAMxB,GAAOA,EAAEX,OAAoB6B,GACvD,OAAOK,GAASE,EAAaF,EAAOL,GAAgBI,EAAUC,GAAS,IACxE,CAMO,SAASG,EACf7C,EACAqC,GAEA,OAA4E,OAArEG,EAAuBxC,EAAOqC,EAAc,KAAM,EAC1D,CAQA,SAASJ,EACRF,EACAzB,EACAuB,EACAC,GAEA,MAAMgB,EAA+CC,EAAkBhB,GACvE,IAAIiB,EAAM,EAEV,IAAA,MAAWC,KAASH,EAAU,CAC7B,IAAKI,EAAWD,GAAQ,CACvBD,GAAO,EACP,QACD,CACA,MAAMG,EAAkBH,EAAMC,EAAMG,KAAKC,OACzC,GAAIF,EAAUtB,GAAQmB,EAAMlB,EAAI,CAC/B,MAAMY,EAA0BO,EAAMK,MAAMX,KAAMxB,GAAMA,EAAEX,OAASF,GACnE,GAAIoC,EAAO,OAAOA,CACnB,CACAM,EAAMG,CACP,CAED"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
class e{_entries=/* @__PURE__ */new Map;registerBlockTypePickerEntry(e){if(this._entries.has(e.id))throw new Error(`BlockTypePickerEntry with id "${e.id}" is already registered.`);this._entries.set(e.id,e)}getBlockTypePickerEntries(){return[...this._entries.values()].sort((e,r)=>e.priority-r.priority)}removeBlockTypePickerEntry(e){this._entries.delete(e)}clear(){this._entries.clear()}}export{e as B};
|
|
2
|
+
//# sourceMappingURL=BlockTypePickerRegistry-DcSE6IXB.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BlockTypePickerRegistry-DcSE6IXB.mjs","sources":["../../src/plugins/heading/BlockTypePickerRegistry.ts"],"sourcesContent":["/**\n * BlockTypePickerRegistry: manages plugin-registered block type picker entries\n * displayed in the heading/block type dropdown, sorted by priority.\n */\n\nimport type { BlockTypePickerEntry } from './BlockTypePickerEntry.js';\n\nexport class BlockTypePickerRegistry {\n\tprivate readonly _entries = new Map<string, BlockTypePickerEntry>();\n\n\tregisterBlockTypePickerEntry(entry: BlockTypePickerEntry): void {\n\t\tif (this._entries.has(entry.id)) {\n\t\t\tthrow new Error(`BlockTypePickerEntry with id \"${entry.id}\" is already registered.`);\n\t\t}\n\t\tthis._entries.set(entry.id, entry);\n\t}\n\n\tgetBlockTypePickerEntries(): readonly BlockTypePickerEntry[] {\n\t\treturn [...this._entries.values()].sort((a, b) => a.priority - b.priority);\n\t}\n\n\tremoveBlockTypePickerEntry(id: string): void {\n\t\tthis._entries.delete(id);\n\t}\n\n\tclear(): void {\n\t\tthis._entries.clear();\n\t}\n}\n"],"names":["BlockTypePickerRegistry","_entries","Map","registerBlockTypePickerEntry","entry","this","has","id","Error","set","getBlockTypePickerEntries","values","sort","a","b","priority","removeBlockTypePickerEntry","delete","clear"],"mappings":"AAOO,MAAMA,EACKC,4BAAeC,IAEhC,4BAAAC,CAA6BC,GAC5B,GAAIC,KAAKJ,SAASK,IAAIF,EAAMG,IAC3B,MAAM,IAAIC,MAAM,iCAAiCJ,EAAMG,8BAExDF,KAAKJ,SAASQ,IAAIL,EAAMG,GAAIH,EAC7B,CAEA,yBAAAM,GACC,MAAO,IAAIL,KAAKJ,SAASU,UAAUC,KAAK,CAACC,EAAGC,IAAMD,EAAEE,SAAWD,EAAEC,SAClE,CAEA,0BAAAC,CAA2BT,GAC1BF,KAAKJ,SAASgB,OAAOV,EACtB,CAEA,KAAAW,GACCb,KAAKJ,SAASiB,OACf"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{b as e}from"./Platform-CU6itXZo.mjs";import{a,s as r}from"./StyleRuntime-BmsLoEa8.mjs";import{a as t,n as f}from"./KeyboardNav-DsYhKKuV.mjs";const o=/* @__PURE__ */new Map([["#000000","Black"],["#434343","Dark Gray 4"],["#666666","Dark Gray 3"],["#999999","Dark Gray 2"],["#b7b7b7","Dark Gray 1"],["#cccccc","Light Gray 3"],["#d9d9d9","Light Gray 2"],["#efefef","Light Gray 1"],["#f3f3f3","Near White"],["#ffffff","White"],["#980000","Dark Red Berry"],["#ff0000","Red"],["#ff9900","Orange"],["#ffff00","Yellow"],["#00ff00","Green"],["#00ffff","Cyan"],["#4a86e8","Cornflower Blue"],["#0000ff","Blue"],["#9900ff","Purple"],["#ff00ff","Magenta"],["#e6b8af","Light Red Berry 3"],["#f4cccc","Light Red 3"],["#fce5cd","Light Orange 3"],["#fff2cc","Light Yellow 3"],["#d9ead3","Light Green 3"],["#d0e0e3","Light Cyan 3"],["#c9daf8","Light Cornflower Blue 3"],["#cfe2f3","Light Blue 3"],["#d9d2e9","Light Purple 3"],["#ead1dc","Light Magenta 3"],["#dd7e6b","Light Red Berry 2"],["#ea9999","Light Red 2"],["#f9cb9c","Light Orange 2"],["#ffe599","Light Yellow 2"],["#b6d7a8","Light Green 2"],["#a2c4c9","Light Cyan 2"],["#a4c2f4","Light Cornflower Blue 2"],["#9fc5e8","Light Blue 2"],["#b4a7d6","Light Purple 2"],["#d5a6bd","Light Magenta 2"],["#cc4125","Light Red Berry 1"],["#e06666","Light Red 1"],["#f6b26b","Light Orange 1"],["#ffd966","Light Yellow 1"],["#93c47d","Light Green 1"],["#76a5af","Light Cyan 1"],["#6d9eeb","Light Cornflower Blue 1"],["#6fa8dc","Light Blue 1"],["#8e7cc3","Light Purple 1"],["#c27ba0","Light Magenta 1"],["#a61c00","Dark Red Berry 1"],["#cc0000","Dark Red 1"],["#e69138","Dark Orange 1"],["#f1c232","Dark Yellow 1"],["#6aa84f","Dark Green 1"],["#45818e","Dark Cyan 1"],["#3c78d8","Dark Cornflower Blue 1"],["#3d85c6","Dark Blue 1"],["#674ea7","Dark Purple 1"],["#a64d79","Dark Magenta 1"],["#85200c","Dark Red Berry 2"],["#990000","Dark Red 2"],["#b45f06","Dark Orange 2"],["#bf9000","Dark Yellow 2"],["#38761d","Dark Green 2"],["#134f5c","Dark Cyan 2"],["#1155cc","Dark Cornflower Blue 2"],["#0b5394","Dark Blue 2"],["#351c75","Dark Purple 2"],["#741b47","Dark Magenta 2"],["#fff176","Bright Yellow"],["#aed581","Light Green"],["#4dd0e1","Bright Cyan"],["#64b5f6","Sky Blue"],["#ce93d8","Lavender"],["#f48fb1","Pink"],["#ffab91","Peach"],["#ff8a65","Coral"],["#e6ee9c","Lime"],["#80cbc4","Teal"],["#fff9c4","Pale Yellow"],["#dcedc8","Pale Green"],["#e0f7fa","Pale Cyan"],["#e3f2fd","Pale Blue"],["#f3e5f5","Pale Purple"],["#fce4ec","Pale Pink"],["#fff3e0","Pale Orange"],["#fbe9e7","Pale Red"],["#f9fbe7","Pale Lime"],["#e0f2f1","Pale Teal"],["#fff59d","Soft Yellow"],["#c5e1a5","Soft Green"],["#80deea","Soft Cyan"],["#90caf9","Soft Blue"],["#e1bee7","Soft Purple"],["#f8bbd0","Soft Pink"],["#ffcc80","Soft Orange"],["#a5d6a7","Mint"],["#ffee58","Vivid Yellow"],["#9ccc65","Vivid Green"],["#26c6da","Vivid Cyan"],["#42a5f5","Vivid Blue"],["#ab47bc","Vivid Purple"],["#ec407a","Vivid Pink"],["#ffa726","Vivid Orange"],["#ff7043","Red Orange"],["#d4e157","Vivid Lime"],["#66bb6a","Emerald"],["#fafafa","Almost White"],["#f5f5f5","Lightest Gray"],["#eeeeee","Very Light Gray"],["#e0e0e0","Silver"],["#bdbdbd","Medium Gray"],["#e8eaf6","Lavender Gray"],["#efebe9","Warm Gray"],["#eceff1","Cool Gray"]]);function n(e){return o.get(e.toLowerCase())||function(e){const a=l(e),r=Number.parseInt(a.slice(1,3),16)/255,t=Number.parseInt(a.slice(3,5),16)/255,f=Number.parseInt(a.slice(5,7),16)/255,o=Math.max(r,t,f),n=Math.min(r,t,f),i=(o+n)/2,c=o-n;if(c<.05)return i<.15?"Black":i<.35?"Dark Gray":i<.65?"Gray":i<.85?"Light Gray":"Near White";let s=0;s=o===r?60*((t-f)/c+(t<f?6:0)):o===t?60*((f-r)/c+2):60*((r-t)/c+4);let g="Red";for(const[l,u]of d)if(s<l){g=u;break}return i<.25?`Very Dark ${g}`:i<.4?`Dark ${g}`:i>.8?`Very Light ${g}`:i>.65?`Light ${g}`:g}(e)}function i(e){const a=function(e){const a=l(e);return.2126*c(Number.parseInt(a.slice(1,3),16)/255)+.7152*c(Number.parseInt(a.slice(3,5),16)/255)+.0722*c(Number.parseInt(a.slice(5,7),16)/255)}(e);return a>.3}function l(e){const a=e.toLowerCase();return 4===a.length?`#${a[1]}${a[1]}${a[2]}${a[2]}${a[3]}${a[3]}`:a}function c(e){return e<=.03928?e/12.92:((e+.055)/1.055)**2.4}const d=[[15,"Red"],[45,"Orange"],[65,"Yellow"],[150,"Green"],[190,"Cyan"],[250,"Blue"],[290,"Purple"],[330,"Pink"],[361,"Red"]],s=/* @__PURE__ */new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"]);function g(o,l){const c=l.columns,d=l.colors.length,g=Math.ceil(d/c),u=document.createElement("div");u.className="notectl-color-picker__grid",u.setAttribute("role","grid"),u.setAttribute("aria-label",l.ariaLabel);const h=[];let b=0;for(let e=0;e<g;e++){const t=document.createElement("div");t.setAttribute("role","row");for(let f=0;f<c;f++){const o=e*c+f;if(o>=d)break;const s=l.colors[o],g=n(s),u=!!l.activeColor&&l.activeColor.toLowerCase()===s.toLowerCase(),L=document.createElement("button");L.type="button",L.className="notectl-color-picker__swatch",L.setAttribute("role","gridcell");const k=l.swatchLabel?l.swatchLabel(g):`${l.ariaLabelPrefix} ${g}`;L.setAttribute("aria-label",k),L.setAttribute("aria-selected",String(u)),L.dataset.index=String(o),a(L,"backgroundColor",s),L.title=l.titleAsName?g:s,i(s)&&r(L,{border:"1px solid #d0d0d0"}),u&&(L.classList.add("notectl-color-picker__swatch--active"),b=o),L.addEventListener("mousedown",e=>{e.preventDefault(),e.stopPropagation(),l.onSelect(s)}),h.push(L),t.appendChild(L)}u.appendChild(t)}t(h,b),u.addEventListener("keydown",a=>{if("Escape"===a.key)return a.preventDefault(),a.stopPropagation(),void l.onClose();if("Enter"===a.key||" "===a.key){a.preventDefault(),a.stopPropagation();const e=a.target.dataset.index;if(void 0!==e){const a=l.colors[Number(e)];a&&l.onSelect(a)}return}if(s.has(a.key)){a.preventDefault(),a.stopPropagation();const r=Math.floor(b/c)+1,n=b%c+1,i=e(o),[l,s]=f(r,n,g,c,a.key,i);let u=(l-1)*c+(s-1);return u>=d&&(u=d-1),b=u,t(h,b),void h[b]?.focus()}if("Home"===a.key||"End"===a.key){a.preventDefault(),a.stopPropagation();const e=Math.floor(b/c)*c,r=Math.min(e+c-1,d-1);b="Home"===a.key?e:r,t(h,b),h[b]?.focus()}}),o.appendChild(u)}export{n as g,i,g as r};
|
|
2
|
+
//# sourceMappingURL=ColorGrid-CpkbKfXg.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColorGrid-CpkbKfXg.mjs","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"],"names":["COLOR_NAME_MAP","Map","getColorName","hex","get","toLowerCase","normalized","normalizeHex","rRaw","Number","parseInt","slice","gRaw","bRaw","max","Math","min","lightness","delta","hue","hueName","threshold","name","HUE_NAMES","describeColor","isLightColor","luminance","linearize","relativeLuminance","h","length","channel","GRID_NAV_KEYS","Set","renderColorGrid","container","config","columns","totalSwatches","colors","totalRows","ceil","grid","document","createElement","className","setAttribute","ariaLabel","swatches","focusedIndex","rowIdx","row","colIdx","swatchIdx","color","colorName","isActive","activeColor","swatch","type","label","swatchLabel","ariaLabelPrefix","String","dataset","index","setStyleProperty","title","titleAsName","setStyleProperties","border","classList","add","addEventListener","e","preventDefault","stopPropagation","onSelect","push","appendChild","applyRovingTabindex","key","onClose","idx","target","has","currentRow","floor","currentCol","rtl","isRtlContext","newRow","newCol","navigateGrid","newIdx","focus","rowStart","rowEnd"],"mappings":"oJAYA,MAAMA,qBAAkDC,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,CAAC,UAAW,SAGZ,CAAC,UAAW,kBACZ,CAAC,UAAW,OACZ,CAAC,UAAW,UACZ,CAAC,UAAW,UACZ,CAAC,UAAW,SACZ,CAAC,UAAW,QACZ,CAAC,UAAW,mBACZ,CAAC,UAAW,QACZ,CAAC,UAAW,UACZ,CAAC,UAAW,WAGZ,CAAC,UAAW,qBACZ,CAAC,UAAW,eACZ,CAAC,UAAW,kBACZ,CAAC,UAAW,kBACZ,CAAC,UAAW,iBACZ,CAAC,UAAW,gBACZ,CAAC,UAAW,2BACZ,CAAC,UAAW,gBACZ,CAAC,UAAW,kBACZ,CAAC,UAAW,mBAGZ,CAAC,UAAW,qBACZ,CAAC,UAAW,eACZ,CAAC,UAAW,kBACZ,CAAC,UAAW,kBACZ,CAAC,UAAW,iBACZ,CAAC,UAAW,gBACZ,CAAC,UAAW,2BACZ,CAAC,UAAW,gBACZ,CAAC,UAAW,kBACZ,CAAC,UAAW,mBAGZ,CAAC,UAAW,qBACZ,CAAC,UAAW,eACZ,CAAC,UAAW,kBACZ,CAAC,UAAW,kBACZ,CAAC,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EAAeZ,GAAW,EAC1DmD,EAAsBvC,EAAeZ,EAAW,EAEhDoD,EAAeC,EAAavD,IAC3BwD,EAAQC,GAAUC,EACxBP,EACAE,EACAhD,EACAH,EACAqC,EAAEO,IACFQ,GAGD,IAAIK,GAAkBH,EAAS,GAAKtD,GAAWuD,EAAS,GAQxD,OAPIE,GAAUxD,IACbwD,EAASxD,EAAgB,GAG1BW,EAAe6C,EACfd,EAAoBhC,EAA0CC,QAC9DD,EAASC,IAAe8C,OAEzB,CAEA,GAAc,SAAVrB,EAAEO,KAA4B,QAAVP,EAAEO,IAAe,CACxCP,EAAEC,iBACFD,EAAEE,kBACF,MACMoB,EADqBjF,KAAKwE,MAAMtC,EAAeZ,GACfA,EAChC4D,EAAiBlF,KAAKC,IAAIgF,EAAW3D,EAAU,EAAGC,EAAgB,GAExEW,EAAyB,SAAVyB,EAAEO,IAAiBe,EAAWC,EAC7CjB,EAAoBhC,EAA0CC,GAC9DD,EAASC,IAAe8C,OACzB,IAGD5D,EAAU4C,YAAYrC,EACvB"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as e}from"./ColorGrid-CpkbKfXg.mjs";import{a as o,g as t,r}from"./AttributedMarkCommands-BB7lzFct.mjs";import{m as a}from"./TypeBrands-Bp_Z_o5Y.mjs";import{i as n}from"./ColorValidation-DCSKq9B2.mjs";function s(e,o){return t(e,o,e=>e.attrs.color??null)}function l(e,o){return null!==s(e,o)}function i(e,t,r,s){if(!n(s))return!1;const l={type:a(r),attrs:{color:s}},i=o(t,l);return!!i&&(e.dispatch(i),!0)}function c(e,o,t){const n=r(o,a(t));return!!n&&(e.dispatch(n),!0)}function m(o,t,r){o.classList.add("notectl-color-picker");const a=s(t.getState(),r.markType),n=r.columns||10,l=t.getContainer(),c=document.createElement("button");c.type="button",c.className="notectl-color-picker__default",c.textContent=r.resetLabel,c.addEventListener("mousedown",e=>{e.preventDefault(),e.stopPropagation(),t.executeCommand(r.resetCommand),r.onClose({restoreFocusTo:l})}),c.addEventListener("keydown",e=>{"Escape"===e.key&&(e.preventDefault(),r.onClose())}),o.appendChild(c),e(o,{colors:r.colors,columns:n,ariaLabel:`${r.ariaLabelPrefix} color picker`,ariaLabelPrefix:r.ariaLabelPrefix,activeColor:a,onSelect:e=>{i(t,t.getState(),r.markType,e),r.onClose({restoreFocusTo:l})},onClose:r.onClose})}export{i as a,m as b,s as g,l as i,c as r};
|
|
2
|
+
//# sourceMappingURL=ColorPickerPopup-DRzFvt7o.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColorPickerPopup-DRzFvt7o.mjs","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. */\ntype 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 { MarkAttrRegistry } from '../../model/AttrRegistry.js';\nimport type { PluginContext } from '../Plugin.js';\nimport { renderColorGrid } from './ColorGrid.js';\nimport { applyColorMark, getActiveColor } from './ColorMarkOperations.js';\nimport type { PopupCloseOptions } from './PopupManager.js';\n\n/** Color mark type names that have `{ color: string }` attrs. */\ntype ColorMarkType = {\n\t[K in keyof MarkAttrRegistry]: MarkAttrRegistry[K] extends { color: string } ? K : never;\n}[keyof MarkAttrRegistry];\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"],"names":["getActiveColor","state","markTypeName","getMarkAttrAtSelection","m","attrs","color","isColorMarkActive","applyColorMark","context","isValidCSSColor","mark","type","markType","tr","applyAttributedMark","dispatch","removeColorMark","removeAttributedMark","renderColorPickerPopup","container","config","classList","add","activeColor","getState","columns","contentElement","getContainer","resetBtn","document","createElement","className","textContent","resetLabel","addEventListener","e","preventDefault","stopPropagation","executeCommand","resetCommand","onClose","restoreFocusTo","key","appendChild","renderColorGrid","colors","ariaLabel","ariaLabelPrefix","onSelect"],"mappings":"iNA6BO,SAASA,EAAeC,EAAoBC,GAClD,OAAOC,EAAuBF,EAAOC,EAAeE,GAAMA,EAAEC,MAAMC,OAAS,KAC5E,CAGO,SAASC,EAAkBN,EAAoBC,GACrD,OAA+C,OAAxCF,EAAeC,EAAOC,EAC9B,CAMO,SAASM,EACfC,EACAR,EACAC,EACAI,GAEA,IAAKI,EAAgBJ,GAAQ,OAAO,EAEpC,MAAMK,EAAO,CAAEC,KAAMC,EAASX,GAAeG,MAAO,CAAEC,UAChDQ,EAAKC,EAAoBd,EAAOU,GACtC,QAAKG,IAELL,EAAQO,SAASF,IACV,EACR,CAMO,SAASG,EACfR,EACAR,EACAC,GAEA,MAAMY,EAAKI,EAAqBjB,EAAOY,EAASX,IAChD,QAAKY,IAELL,EAAQO,SAASF,IACV,EACR,CChCO,SAASK,EACfC,EACAX,EACAY,GAEAD,EAAUE,UAAUC,IAAI,wBAExB,MACMC,EAA6BxB,EADrBS,EAAQgB,WACmCJ,EAAOR,UAC1Da,EAAkBL,EAAOK,SArBhB,GAsBTC,EAA8BlB,EAAQmB,eAGtCC,EAA8BC,SAASC,cAAc,UAC3DF,EAASjB,KAAO,SAChBiB,EAASG,UAAY,gCACrBH,EAASI,YAAcZ,EAAOa,WAC9BL,EAASM,iBAAiB,YAAcC,IACvCA,EAAEC,iBACFD,EAAEE,kBACF7B,EAAQ8B,eAAelB,EAAOmB,cAC9BnB,EAAOoB,QAAQ,CAAEC,eAAgBf,MAElCE,EAASM,iBAAiB,UAAYC,IACvB,WAAVA,EAAEO,MACLP,EAAEC,iBACFhB,EAAOoB,aAGTrB,EAAUwB,YAAYf,GAGtBgB,EAAgBzB,EAAW,CAC1B0B,OAAQzB,EAAOyB,OACfpB,UACAqB,UAAW,GAAG1B,EAAO2B,+BACrBA,gBAAiB3B,EAAO2B,gBACxBxB,cACAyB,SAAW3C,IACVE,EAAeC,EAASA,EAAQgB,WAAYJ,EAAOR,SAAUP,GAC7De,EAAOoB,QAAQ,CAAEC,eAAgBf,KAElCc,QAASpB,EAAOoB,SAElB"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i;function r(r){return e.test(r)}const 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=/* @__PURE__ */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}const o=/[{}<>;]|url\(|expression\(/i;function s(e){if(!e)return!1;const r=e.trim();return!!r&&!o.test(r)}const d=/^\d+(\.\d+)?(px|pt|em|rem|%)$/i;function u(e){return!!e&&d.test(e.trim())}export{s as a,u as b,r as c,n as i,i as r};
|
|
2
|
+
//# sourceMappingURL=ColorValidation-DCSKq9B2.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColorValidation-
|
|
1
|
+
{"version":3,"file":"ColorValidation-DCSKq9B2.mjs","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"],"names":["HEX_COLOR_PATTERN","isValidHexColor","value","test","RGB_PATTERN","HSL_PATTERN","CSS_NAMED_COLORS","Set","isValidCSSColor","trimmed","trim","toLowerCase","has","resolveColors","colors","fallbackPalette","pluginName","length","invalid","filter","c","Error","join","seen","unique","color","normalized","add","push","FONT_FAMILY_FORBIDDEN","isValidCSSFontFamily","FONT_SIZE_PATTERN","isValidCSSFontSize"],"mappings":"AAKA,MAAMA,EAA4B,gCAG3B,SAASC,EAAgBC,GAC/B,OAAOF,EAAkBG,KAAKD,EAC/B,CAKA,MAAME,EACL,yEAGKC,EACL,gFAMKC,qBAA4CC,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,gBASM,SAASC,EAAgBN,GAC/B,IAAKA,EAAO,OAAO,EACnB,MAAMO,EAAkBP,EAAMQ,OAAOC,cACrC,QAAKF,IAGJT,EAAkBG,KAAKM,IACvBL,EAAYD,KAAKM,IACjBJ,EAAYF,KAAKM,IACjBH,EAAiBM,IAAIH,GAEvB,CAQO,SAASI,EACfC,EACAC,EACAC,GAEA,IAAKF,GAA4B,IAAlBA,EAAOG,OAAc,OAAOF,EAE3C,MAAMG,EAAoBJ,EAAOK,OAAQC,IAAOnB,EAAgBmB,IAChE,GAAIF,EAAQD,OAAS,EACpB,MAAM,IAAII,MACT,GAAGL,4BAAqCE,EAAQI,KAAK,4CAIvD,MAAMC,qBAAwBhB,IACxBiB,EAAmB,GACzB,IAAA,MAAWC,KAASX,EAAQ,CAC3B,MAAMY,EAAqBD,EAAMd,cAC5BY,EAAKX,IAAIc,KACbH,EAAKI,IAAID,GACTF,EAAOI,KAAKF,GAEd,CACA,OAAOF,CACR,CAKA,MAAMK,EAAgC,8BAO/B,SAASC,EAAqB5B,GACpC,IAAKA,EAAO,OAAO,EACnB,MAAMO,EAAkBP,EAAMQ,OAC9B,QAAKD,IACGoB,EAAsB1B,KAAKM,EACpC,CAKA,MAAMsB,EAA4B,iCAM3B,SAASC,EAAmB9B,GAClC,QAAKA,GACE6B,EAAkB5B,KAAKD,EAAMQ,OACrC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{c as t,e as n,s as e,n as o,f as c,d as r,h as i,p as l}from"./Document-BFYAonMF.mjs";import{a as s,e as d,d as f,s as u,i as a}from"./NavigationQueries-ogQuObz7.mjs";import{i as b,s as k,c as I,h,g,a as m,b as p,e as S}from"./Selection-6-W6Flxc.mjs";import{n as B,i as x}from"./TypeBrands-Bp_Z_o5Y.mjs";function O(t,n){if(0===n.length)return t.doc.children;const e=t.getBlock(n[n.length-1]);return e?e.children:[]}function N(e){return t(B("paragraph"),[n("")],e)}function A(t,n){if(b(t))return{blockId:t.anchor.blockId,offset:t.anchor.offset};const e=k(t,n);return{blockId:e.from.blockId,offset:e.from.offset}}function T(t,n){const r=s(t.doc,n.nodeId);if(!r)return null;const i=r.length>1?r.slice(0,-1):[],l=O(t,i),d=l.findIndex(t=>"id"in t&&t.id===n.nodeId);if(d<0)return null;const f=t.transaction("input");if(1===l.length&&0===i.length){const t=e();return f.insertNode(i,0,N(t)),f.removeNode(i,1),f.setSelection(I(t,0)),f.build()}f.removeNode(i,d);const u=l[d-1];if(u&&o(u)){const n=M(u);if(n){const e=t.getBlock(n),o=e?c(e):0;f.setSelection(I(n,o))}}else{const t=l[d+1];if(t&&o(t)){const n=v(t);n&&f.setSelection(I(n,0))}}return f.build()}function j(t,n,e){const o=t.selection,r=t.getBlockOrder(),i=!e||"left"!==n&&"right"!==n?n:"left"===n?"right":"left";return h(o)?function(t,n,e,o){const r=o.indexOf(n.nodeId),i=s(t.doc,n.nodeId)??[];if("left"===e||"up"===e){if(r>0){const e=o[r-1];if(!e)return null;if(d(t,e))return t.transaction("input").setSelection(m(n.nodeId,"before",i)).build();const l=t.getBlock(e),s=l?c(l):0;return t.transaction("input").setSelection(I(e,s)).build()}return t.transaction("input").setSelection(m(n.nodeId,"before",i)).build()}if(r<o.length-1){const e=o[r+1];return e?d(t,e)?t.transaction("input").setSelection(m(n.nodeId,"after",i)).build():t.transaction("input").setSelection(I(e,0)).build():null}return t.transaction("input").setSelection(m(n.nodeId,"after",i)).build()}(t,o,i,r):g(o)?null:b(o)?function(t,n,e,o){const r=o.indexOf(n.anchor.blockId),i=t.getBlock(n.anchor.blockId);if(!i)return null;const l=c(i);if(("right"===e||"down"===e)&&n.anchor.offset===l&&r<o.length-1){const n=o[r+1];if(n&&d(t,n)){const e=s(t.doc,n)??[];return t.transaction("input").setSelection(p(n,e)).build()}}if(("left"===e||"up"===e)&&0===n.anchor.offset&&r>0){const n=o[r-1];if(n&&d(t,n)){const e=s(t.doc,n)??[];return t.transaction("input").setSelection(p(n,e)).build()}}return null}(t,o,i,r):null}function v(t){let n=t;for(;;){const t=n.children.find(t=>o(t));if(!t)return n.id;n=t}}function M(t){let n=t;for(;;){let t;for(let e=n.children.length-1;e>=0;e--){const c=n.children[e];if(c&&o(c)){t=c;break}}if(!t)return n.id;n=t}}function _(t,n){if("after"===n.side)return y(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(d(t,r)){const n=s(t.doc,r)??[];return t.transaction("input").setSelection(p(r,n)).build()}const i=t.getBlock(r);if(!i)return null;const l=c(i);return t.transaction("input").setSelection(I(r,l)).build()}function w(t,n){if("before"===n.side)return y(t,n);const e=t.getBlockOrder(),o=e.indexOf(n.blockId);if(o>=e.length-1)return null;const c=e[o+1];if(!c)return null;if(d(t,c)){const n=s(t.doc,c)??[];return t.transaction("input").setSelection(p(c,n)).build()}return t.transaction("input").setSelection(I(c,0)).build()}function y(t,n){const e=s(t.doc,n.blockId)??[];return T(t,p(n.blockId,e))}function D(t,n,o="input"){const c=t.selection;if(h(c))return function(t,n,o,c){const r=s(t.doc,n.nodeId),i=r&&r.length>1?r.slice(0,-1):[],l=O(t,i),d=l.findIndex(t=>"id"in t&&t.id===n.nodeId),f=e(),u=t.transaction(c),a=d>=0?d+1:l.length;return u.insertNode(i,a,N(f)),u.insertText(f,0,o,[]),u.setSelection(I(f,o.length)),u.build()}(t,c,n,o);if(g(c))return function(t,n,o,c){const r=s(t.doc,n.blockId),i=r&&r.length>1?r.slice(0,-1):[],l=O(t,i),d=l.findIndex(t=>"id"in t&&t.id===n.blockId),f="before"===n.side?Math.max(d,0):d>=0?d+1:l.length,u=e(),a=t.transaction(c);return a.insertNode(i,f,N(u)),a.insertText(u,0,o,[]),a.setSelection(I(u,o.length)),a.build()}(t,c,n,o);const r=t.transaction(o),l=function(t){if(t.storedMarks)return t.storedMarks;if(h(t.selection)||g(t.selection))return[];const n=t.getBlock(t.selection.anchor.blockId);return n?i(n,t.selection.anchor.offset):[]}(t);let d;b(c)||(d=G(t,r));const f=A(c,t.getBlockOrder()),u=d??f.blockId,a=d?0:f.offset;return r.insertText(u,a,n,l),r.setSelection(I(u,a+n.length)),r.build()}function Q(t){if(h(t.selection))return T(t,t.selection);if(g(t.selection))return null;if(b(t.selection))return null;const n=t.transaction("input"),e=G(t,n),o=k(t.selection,t.getBlockOrder()),c=e??o.from.blockId,r=e?0:o.from.offset;return n.setSelection(I(c,r)),n.build()}function q(t){const n=t.selection;if(h(n))return function(t,n){const o=s(t.doc,n.nodeId);if(!o)return null;const c=o.length>1?o.slice(0,-1):[],r=O(t,c).findIndex(t=>"id"in t&&t.id===n.nodeId);if(r<0)return null;const i=e(),l=t.transaction("input");return l.insertNode(c,r+1,N(i)),l.setSelection(I(i,0)),l.build()}(t,n);if(g(n))return function(t,n){const o=s(t.doc,n.blockId);if(!o)return null;const c=o.length>1?o.slice(0,-1):[],r=O(t,c).findIndex(t=>"id"in t&&t.id===n.blockId);if(r<0)return null;const i="before"===n.side?r:r+1,l=e(),d=t.transaction("input");return d.insertNode(c,i,N(l)),d.setSelection(I(l,0)),d.build()}(t,n);const o=t.transaction("input");let c;b(n)||(c=G(t,o));const r=A(n,t.getBlockOrder()),i=c??r.blockId,l=c?0:r.offset,d=e();return o.splitBlock(i,l,d),o.setSelection(I(d,0)),o.build()}function z(t){const n=t.selection;if(h(n)||g(n))return null;const e=t.transaction("input");let o;if(b(n)||(o=G(t,e)),o)e.insertInlineNode(o,0,r(x("hard_break"))),e.setSelection(I(o,1));else{const{blockId:o,offset:c}=A(n,t.getBlockOrder());e.insertInlineNode(o,c,r(x("hard_break"))),e.setSelection(I(o,c+1))}return e.build()}function C(t){const n=t.selection;if(h(n)||g(n))return null;const e=t.getBlockOrder(),o=e.indexOf(n.anchor.blockId);if(o<=0)return null;const r=e[o-1];if(!r)return null;if(f(t,n.anchor.blockId)||f(t,r))return null;if(!u(t,n.anchor.blockId,r)&&a(t,n.anchor.blockId))return null;if(d(t,r)){const n=s(t.doc,r)??[];return t.transaction("input").setSelection(p(r,n)).build()}const i=t.getBlock(r);if(!i)return null;const l=c(i);return t.transaction("input").mergeBlocksAt(r,n.anchor.blockId).setSelection(I(r,l)).build()}function E(t){const n=t.selection;if(h(n)||g(n))return null;const e=t.getBlockOrder(),o=e.indexOf(n.anchor.blockId);if(o>=e.length-1)return null;const c=e[o+1];if(!c)return null;if(f(t,n.anchor.blockId)||f(t,c))return null;if(!u(t,n.anchor.blockId,c)&&a(t,n.anchor.blockId))return null;if(d(t,c)){const n=s(t.doc,c)??[];return t.transaction("input").setSelection(p(c,n)).build()}return t.transaction("input").mergeBlocksAt(n.anchor.blockId,c).setSelection(I(n.anchor.blockId,n.anchor.offset)).build()}function F(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=v(e),i=M(o),l=t.getBlock(i),s=l?c(l):0;return t.transaction("command").setSelection(S({blockId:r,offset:0},{blockId:i,offset:s})).build()}function G(t,n){if(h(t.selection)||g(t.selection))return;const o=t.getBlockOrder(),r=k(t.selection,o),i=o.indexOf(r.from.blockId),s=o.indexOf(r.to.blockId);if(i===s)return void n.deleteTextAt(r.from.blockId,r.from.offset,r.to.offset);const d=H(t,r.from.blockId),f=H(t,r.to.blockId);if(!(d===f||d<0||f<0))return function(t,n,o,r,i){const s=t.doc.children[r],d=t.doc.children[i];if(!s||!d)return;const f=l(s),u=l(d);let a,b=0;if(f||(a=e(),n.insertNode([],r,N(a)),b=1),f){const e=t.getBlock(o.from.blockId);if(e){const t=c(e);o.from.offset<t&&n.deleteTextAt(o.from.blockId,o.from.offset,t)}}u&&o.to.offset>0&&n.deleteTextAt(o.to.blockId,0,o.to.offset);const k=f?r+1:r+b;for(let e=u?i-1+b:i+b;e>=k;e--)n.removeNode([],e);return f&&u&&n.mergeBlocksAt(o.from.blockId,o.to.blockId),a}(t,n,r,d,f);!function(t,n,e,o,r,i){const l=t.getBlock(o.from.blockId);if(!l)return;const s=c(l);o.from.offset<s&&n.deleteTextAt(o.from.blockId,o.from.offset,s),o.to.offset>0&&n.deleteTextAt(o.to.blockId,0,o.to.offset);for(let d=r+1;d<i;d++){const r=e[d];if(!r)continue;const i=t.getBlock(r);if(!i)continue;const l=c(i);l>0&&n.deleteTextAt(r,0,l),n.mergeBlocksAt(o.from.blockId,r)}n.mergeBlocksAt(o.from.blockId,o.to.blockId)}(t,n,o,r,i,s)}function H(t,n){const e=s(t.doc,n);if(!e||0===e.length)return-1;const o=e[0];return t.doc.children.findIndex(t=>t.id===o)}export{w as a,T as b,Q as c,_ as d,D as e,q as f,E as g,G as h,z as i,M as j,C as m,j as n,A as r,F as s};
|
|
2
|
+
//# sourceMappingURL=Commands-P9wS8qtN.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Commands-P9wS8qtN.mjs","sources":["../../src/commands/CommandHelpers.ts","../../src/commands/NodeSelectionCommands.ts","../../src/commands/GapCursorCommands.ts","../../src/commands/Commands.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 } from '../model/Document.js';\nimport { createBlockNode, createTextNode } from '../model/Document.js';\nimport { isCollapsed, selectionRange } from '../model/Selection.js';\nimport type { 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';\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 * Commands for NodeSelection: deleting void blocks, inserting paragraphs\n * after void blocks, and navigating arrow keys into/out of void blocks.\n */\n\nimport { type BlockNode, generateBlockId, getBlockLength, isBlockNode } from '../model/Document.js';\nimport { findNodePath } from '../model/NodeResolver.js';\nimport type { NodeSelection } from '../model/Selection.js';\nimport {\n\tcreateCollapsedSelection,\n\tcreateGapCursor,\n\tcreateNodeSelection,\n\tisCollapsed,\n\tisGapCursor,\n\tisNodeSelection,\n} 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 { createEmptyParagraph, getSiblings } from './CommandHelpers.js';\n\n/**\n * Deletes the void block targeted by a NodeSelection and places cursor\n * on the adjacent block. If it's the only block, replaces with empty paragraph.\n */\nexport function deleteNodeSelection(state: EditorState, sel: NodeSelection): Transaction | null {\n\tconst path = findNodePath(state.doc, sel.nodeId);\n\tif (!path) return null;\n\n\tconst parentPath: BlockId[] = path.length > 1 ? (path.slice(0, -1) as BlockId[]) : [];\n\tconst siblings = getSiblings(state, parentPath);\n\n\tconst index: number = siblings.findIndex((c) => 'id' in c && c.id === sel.nodeId);\n\tif (index < 0) return null;\n\n\tconst builder = state.transaction('input');\n\n\t// If this is the only block in the document, insert empty paragraph first\n\tif (siblings.length === 1 && parentPath.length === 0) {\n\t\tconst newId = generateBlockId();\n\t\tbuilder.insertNode(parentPath, 0, createEmptyParagraph(newId));\n\t\tbuilder.removeNode(parentPath, 1);\n\t\tbuilder.setSelection(createCollapsedSelection(newId, 0));\n\t\treturn builder.build();\n\t}\n\n\tbuilder.removeNode(parentPath, index);\n\n\t// Find where to place cursor: prefer previous sibling leaf, else next sibling leaf.\n\tconst prevSibling = siblings[index - 1];\n\tif (prevSibling && isBlockNode(prevSibling)) {\n\t\tconst prevLeafId = findLastLeafBlockId(prevSibling);\n\t\tif (prevLeafId) {\n\t\t\tconst prevLeaf = state.getBlock(prevLeafId);\n\t\t\tconst prevLen = prevLeaf ? getBlockLength(prevLeaf) : 0;\n\t\t\tbuilder.setSelection(createCollapsedSelection(prevLeafId, prevLen));\n\t\t}\n\t} else {\n\t\tconst nextSibling = siblings[index + 1];\n\t\tif (nextSibling && isBlockNode(nextSibling)) {\n\t\t\tconst nextLeafId = findFirstLeafBlockId(nextSibling);\n\t\t\tif (nextLeafId) {\n\t\t\t\tbuilder.setSelection(createCollapsedSelection(nextLeafId, 0));\n\t\t\t}\n\t\t}\n\t}\n\n\treturn builder.build();\n}\n\n/** Inserts a new paragraph after a NodeSelection-targeted void block. */\nexport function insertParagraphAfterNodeSelection(\n\tstate: EditorState,\n\tsel: NodeSelection,\n): Transaction | null {\n\tconst path = findNodePath(state.doc, sel.nodeId);\n\tif (!path) return null;\n\n\tconst parentPath: BlockId[] = path.length > 1 ? (path.slice(0, -1) as BlockId[]) : [];\n\tconst siblings = getSiblings(state, parentPath);\n\n\tconst index: number = siblings.findIndex((c) => 'id' in c && c.id === sel.nodeId);\n\tif (index < 0) return null;\n\n\tconst newId = generateBlockId();\n\tconst builder = state.transaction('input');\n\tbuilder.insertNode(parentPath, index + 1, createEmptyParagraph(newId));\n\tbuilder.setSelection(createCollapsedSelection(newId, 0));\n\treturn builder.build();\n}\n\n/** Inserts text in a new paragraph after a NodeSelection-targeted void block. */\nexport function insertTextAfterNodeSelection(\n\tstate: EditorState,\n\tsel: NodeSelection,\n\ttext: string,\n\torigin: 'input' | 'paste',\n): Transaction {\n\tconst path = findNodePath(state.doc, sel.nodeId);\n\tconst parentPath: BlockId[] = path && path.length > 1 ? (path.slice(0, -1) as BlockId[]) : [];\n\tconst siblings = getSiblings(state, parentPath);\n\n\tconst index: number = siblings.findIndex((c) => 'id' in c && c.id === sel.nodeId);\n\n\tconst newId = generateBlockId();\n\tconst builder = state.transaction(origin);\n\n\tconst insertIdx = index >= 0 ? index + 1 : siblings.length;\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/**\n * Navigates arrow keys into/out of void blocks.\n * Returns a transaction if navigation should create a NodeSelection, or null.\n *\n * @param isRtl — When true, flips left/right to account for RTL block direction.\n */\nexport function navigateArrowIntoVoid(\n\tstate: EditorState,\n\tdirection: 'left' | 'right' | 'up' | 'down',\n\tisRtl?: boolean,\n): Transaction | null {\n\tconst sel = state.selection;\n\tconst blockOrder = state.getBlockOrder();\n\tconst effectiveDir: 'left' | 'right' | 'up' | 'down' =\n\t\tisRtl && (direction === 'left' || direction === 'right')\n\t\t\t? direction === 'left'\n\t\t\t\t? 'right'\n\t\t\t\t: 'left'\n\t\t\t: direction;\n\n\t// If currently on a NodeSelection, navigate away from it\n\tif (isNodeSelection(sel)) {\n\t\treturn navigateAwayFromNodeSelection(state, sel, effectiveDir, blockOrder);\n\t}\n\n\t// GapCursor is handled by navigateFromGapCursor in CaretNavigation\n\tif (isGapCursor(sel)) return null;\n\n\t// Text selection: check if navigating into a void block\n\tif (!isCollapsed(sel)) return null;\n\n\treturn navigateIntoVoid(state, sel, effectiveDir, blockOrder);\n}\n\n/** Finds the first leaf (deepest-first-child) block ID in a subtree. */\nexport function findFirstLeafBlockId(node: BlockNode): BlockId {\n\tlet current: BlockNode = node;\n\twhile (true) {\n\t\tconst firstBlockChild = current.children.find((child): child is BlockNode =>\n\t\t\tisBlockNode(child),\n\t\t);\n\t\tif (!firstBlockChild) return current.id;\n\t\tcurrent = firstBlockChild;\n\t}\n}\n\n/** Finds the last leaf (deepest-last-child) block ID in a subtree. */\nexport function findLastLeafBlockId(node: BlockNode): BlockId {\n\tlet current: BlockNode = node;\n\twhile (true) {\n\t\tlet lastBlockChild: BlockNode | undefined;\n\t\tfor (let i = current.children.length - 1; i >= 0; i--) {\n\t\t\tconst child = current.children[i];\n\t\t\tif (child && isBlockNode(child)) {\n\t\t\t\tlastBlockChild = child;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (!lastBlockChild) return current.id;\n\t\tcurrent = lastBlockChild;\n\t}\n}\n\n// ---------------------------------------------------------------------------\n// Internal helpers\n// ---------------------------------------------------------------------------\n\n/** Handles navigation away from a NodeSelection (arrow keys while void is selected). */\nfunction navigateAwayFromNodeSelection(\n\tstate: EditorState,\n\tsel: NodeSelection,\n\tdirection: 'left' | 'right' | 'up' | 'down',\n\tblockOrder: readonly BlockId[],\n): Transaction | null {\n\tconst nodeIdx = blockOrder.indexOf(sel.nodeId);\n\tconst nodePath = (findNodePath(state.doc, sel.nodeId) ?? []) as BlockId[];\n\n\tif (direction === 'left' || direction === 'up') {\n\t\tif (nodeIdx > 0) {\n\t\t\tconst prevId = blockOrder[nodeIdx - 1];\n\t\t\tif (!prevId) return null;\n\t\t\tif (isVoidBlock(state, prevId)) {\n\t\t\t\treturn state\n\t\t\t\t\t.transaction('input')\n\t\t\t\t\t.setSelection(createGapCursor(sel.nodeId, 'before', nodePath))\n\t\t\t\t\t.build();\n\t\t\t}\n\t\t\tconst prevBlock = state.getBlock(prevId);\n\t\t\tconst prevLen = prevBlock ? getBlockLength(prevBlock) : 0;\n\t\t\treturn state\n\t\t\t\t.transaction('input')\n\t\t\t\t.setSelection(createCollapsedSelection(prevId, prevLen))\n\t\t\t\t.build();\n\t\t}\n\t\treturn state\n\t\t\t.transaction('input')\n\t\t\t.setSelection(createGapCursor(sel.nodeId, 'before', nodePath))\n\t\t\t.build();\n\t}\n\n\t// right or down\n\tif (nodeIdx < blockOrder.length - 1) {\n\t\tconst nextId = blockOrder[nodeIdx + 1];\n\t\tif (!nextId) return null;\n\t\tif (isVoidBlock(state, nextId)) {\n\t\t\treturn state\n\t\t\t\t.transaction('input')\n\t\t\t\t.setSelection(createGapCursor(sel.nodeId, 'after', nodePath))\n\t\t\t\t.build();\n\t\t}\n\t\treturn state.transaction('input').setSelection(createCollapsedSelection(nextId, 0)).build();\n\t}\n\treturn state\n\t\t.transaction('input')\n\t\t.setSelection(createGapCursor(sel.nodeId, 'after', nodePath))\n\t\t.build();\n}\n\n/** Handles text selection navigating into an adjacent void block. */\nfunction navigateIntoVoid(\n\tstate: EditorState,\n\tsel: { readonly anchor: { readonly blockId: BlockId; readonly offset: number } },\n\tdirection: 'left' | 'right' | 'up' | 'down',\n\tblockOrder: readonly BlockId[],\n): Transaction | null {\n\tconst blockIdx = blockOrder.indexOf(sel.anchor.blockId);\n\tconst block = state.getBlock(sel.anchor.blockId);\n\tif (!block) return null;\n\tconst blockLen = getBlockLength(block);\n\n\tif (direction === 'right' || direction === 'down') {\n\t\tif (sel.anchor.offset === blockLen && blockIdx < blockOrder.length - 1) {\n\t\t\tconst nextId = blockOrder[blockIdx + 1];\n\t\t\tif (nextId && isVoidBlock(state, nextId)) {\n\t\t\t\tconst path = findNodePath(state.doc, nextId) ?? [];\n\t\t\t\treturn state\n\t\t\t\t\t.transaction('input')\n\t\t\t\t\t.setSelection(createNodeSelection(nextId, path as BlockId[]))\n\t\t\t\t\t.build();\n\t\t\t}\n\t\t}\n\t}\n\n\tif (direction === 'left' || direction === 'up') {\n\t\tif (sel.anchor.offset === 0 && blockIdx > 0) {\n\t\t\tconst prevId = blockOrder[blockIdx - 1];\n\t\t\tif (prevId && isVoidBlock(state, prevId)) {\n\t\t\t\tconst path = findNodePath(state.doc, prevId) ?? [];\n\t\t\t\treturn state\n\t\t\t\t\t.transaction('input')\n\t\t\t\t\t.setSelection(createNodeSelection(prevId, path as BlockId[]))\n\t\t\t\t\t.build();\n\t\t\t}\n\t\t}\n\t}\n\n\treturn null;\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 { createEmptyParagraph, getSiblings } 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[] = path.length > 1 ? (path.slice(0, -1) as BlockId[]) : [];\n\tconst siblings = getSiblings(state, parentPath);\n\n\tconst index: number = siblings.findIndex((c) => 'id' in c && c.id === 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[] = path && path.length > 1 ? (path.slice(0, -1) as BlockId[]) : [];\n\tconst siblings = getSiblings(state, parentPath);\n\n\tconst index: number = siblings.findIndex((c) => 'id' in c && c.id === 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 * 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\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 (isNodeSelection(sel) || isGapCursor(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\tconst sel = state.selection;\n\tif (isNodeSelection(sel) || isGapCursor(sel)) return null;\n\tconst blockOrder = state.getBlockOrder();\n\tconst blockIdx = blockOrder.indexOf(sel.anchor.blockId);\n\n\tif (blockIdx <= 0) return null;\n\n\tconst prevBlockId = blockOrder[blockIdx - 1];\n\tif (!prevBlockId) return null;\n\n\t// Never merge isolating blocks directly (e.g. table cells).\n\tif (isIsolatingBlock(state, sel.anchor.blockId) || isIsolatingBlock(state, prevBlockId)) {\n\t\treturn null;\n\t}\n\n\t// Prevent merge across isolating boundaries\n\tif (!sharesParent(state, sel.anchor.blockId, prevBlockId)) {\n\t\tif (isInsideIsolating(state, sel.anchor.blockId)) return null;\n\t}\n\n\t// If previous block is void, select it instead of merging\n\tif (isVoidBlock(state, prevBlockId)) {\n\t\tconst path = findNodePath(state.doc, prevBlockId) ?? [];\n\t\treturn state\n\t\t\t.transaction('input')\n\t\t\t.setSelection(createNodeSelection(prevBlockId, path as BlockId[]))\n\t\t\t.build();\n\t}\n\n\tconst prevBlock = state.getBlock(prevBlockId);\n\tif (!prevBlock) return null;\n\tconst prevLen = getBlockLength(prevBlock);\n\n\treturn state\n\t\t.transaction('input')\n\t\t.mergeBlocksAt(prevBlockId, sel.anchor.blockId)\n\t\t.setSelection(createCollapsedSelection(prevBlockId, prevLen))\n\t\t.build();\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\tconst sel = state.selection;\n\tif (isNodeSelection(sel) || isGapCursor(sel)) return null;\n\tconst blockOrder = state.getBlockOrder();\n\tconst blockIdx = blockOrder.indexOf(sel.anchor.blockId);\n\n\tif (blockIdx >= blockOrder.length - 1) return null;\n\n\tconst nextBlockId = blockOrder[blockIdx + 1];\n\tif (!nextBlockId) return null;\n\n\t// Never merge isolating blocks directly (e.g. table cells).\n\tif (isIsolatingBlock(state, sel.anchor.blockId) || isIsolatingBlock(state, nextBlockId)) {\n\t\treturn null;\n\t}\n\n\t// Prevent merge across isolating boundaries\n\tif (!sharesParent(state, sel.anchor.blockId, nextBlockId)) {\n\t\tif (isInsideIsolating(state, sel.anchor.blockId)) return null;\n\t}\n\n\t// If next block is void, select it instead of merging\n\tif (isVoidBlock(state, nextBlockId)) {\n\t\tconst path = findNodePath(state.doc, nextBlockId) ?? [];\n\t\treturn state\n\t\t\t.transaction('input')\n\t\t\t.setSelection(createNodeSelection(nextBlockId, path as BlockId[]))\n\t\t\t.build();\n\t}\n\n\treturn state\n\t\t.transaction('input')\n\t\t.mergeBlocksAt(sel.anchor.blockId, nextBlockId)\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 (isNodeSelection(state.selection) || isGapCursor(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 (isNodeSelection(state.selection) || isGapCursor(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"],"names":["getSiblings","state","parentPath","length","doc","children","parent","getBlock","createEmptyParagraph","id","createBlockNode","nodeType","createTextNode","resolveInsertPoint","sel","blockOrder","isCollapsed","blockId","anchor","offset","range","selectionRange","from","deleteNodeSelection","path","findNodePath","nodeId","slice","siblings","index","findIndex","c","builder","transaction","newId","generateBlockId","insertNode","removeNode","setSelection","createCollapsedSelection","build","prevSibling","isBlockNode","prevLeafId","findLastLeafBlockId","prevLeaf","prevLen","getBlockLength","nextSibling","nextLeafId","findFirstLeafBlockId","navigateArrowIntoVoid","direction","isRtl","selection","getBlockOrder","effectiveDir","isNodeSelection","nodeIdx","indexOf","nodePath","prevId","isVoidBlock","createGapCursor","prevBlock","nextId","navigateAwayFromNodeSelection","isGapCursor","blockIdx","block","blockLen","createNodeSelection","navigateIntoVoid","node","current","firstBlockChild","find","child","lastBlockChild","i","deleteBackwardAtGap","side","deleteVoidAtGap","deleteForwardAtGap","insertTextCommand","text","origin","insertIdx","insertText","insertTextAfterNodeSelection","Math","max","insertTextAtGap","marks","storedMarks","getBlockMarksAtOffset","resolveActiveMarks","landingId","addDeleteSelectionSteps","resolved","insertBlockId","insertOffset","deleteSelectionCommand","cursorBlockId","cursorOffset","splitBlockCommand","insertParagraphAfterNodeSelection","insertParagraphAtGap","newBlockId","splitBlock","insertHardBreakCommand","insertInlineNode","createInlineNode","inlineType","mergeBlockBackward","prevBlockId","isIsolatingBlock","sharesParent","isInsideIsolating","mergeBlocksAt","mergeBlockForward","nextBlockId","selectAll","blocks","firstBlock","lastBlock","firstLeafId","lastLeafId","lastLeaf","lastLeafLen","createSelection","fromIdx","toIdx","to","deleteTextAt","fromRootIdx","getRootBlockIndex","toRootIdx","fromRoot","toRoot","fromIsLeaf","isLeafBlock","toIsLeaf","indexShift","fromBlock","fromLen","removeStart","deleteCrossRootRange","firstLen","midBlockId","midBlock","midLen","deleteLeafRange","rootId"],"mappings":"uTAuBO,SAASA,EACfC,EACAC,GAEA,GAA0B,IAAtBA,EAAWC,OAAc,OAAOF,EAAMG,IAAIC,SAC9C,MAAMC,EAAgCL,EAAMM,SAC3CL,EAAWA,EAAWC,OAAS,IAEhC,OAAOG,EAASA,EAAOD,SAAW,EACnC,CAGO,SAASG,EAAqBC,GACpC,OAAOC,EAAgBC,EAAS,aAAc,CAACC,EAAe,KAAMH,EACrE,CAQO,SAASI,EAAmBC,EAAgBC,GAClD,GAAIC,EAAYF,GACf,MAAO,CAAEG,QAASH,EAAII,OAAOD,QAASE,OAAQL,EAAII,OAAOC,QAE1D,MAAMC,EAAQC,EAAeP,EAAKC,GAClC,MAAO,CAAEE,QAASG,EAAME,KAAKL,QAASE,OAA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AAME,KAAKL,QAASoI,EAC3C,CAEArH,EAAQuF,cAAcnG,EAAME,KAAKL,QAASG,EAAMiH,GAAGpH,QACpD,CApDEuI,CAAgBvJ,EAAO+B,EAASjB,EAAYK,EAAO+G,EAASC,EAK9D,CAGA,SAASI,EAAkBvI,EAAoBgB,GAC9C,MAAMO,EAAOC,EAAaxB,EAAMG,IAAKa,GACrC,IAAKO,GAAwB,IAAhBA,EAAKrB,OAAc,OAAO,EACvC,MAAMsJ,EAAiBjI,EAAK,GAC5B,OAAOvB,EAAMG,IAAIC,SAASyB,UAAWC,GAAMA,EAAEtB,KAAOgJ,EACrD"}
|
|
@@ -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),f=o(t.to,e.from,e.to,r);return n>=f?null:n===t.from&&f===t.to?t:{...t,from:n,to:f}}(t,r);case"splitBlock":return function(t,e){if(t.blockId!==e.blockId)return t;if(t.to<=e.offset)return t;if(t.from>=e.offset)return{...t,blockId:e.newBlockId,from:t.from-e.offset,to:t.to-e.offset};return[{...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 f(t,e,o,r){return{type:"widget",blockId:t,offset:e,toDOM:o,side:r?.side??-1,key:r?.key}}class s{constructor(t){this.byBlock=t}static empty=new s(/* @__PURE__ */new Map);static create(t){if(0===t.length)return s.empty;const e=/* @__PURE__ */new Map;for(const o of t){const t=e.get(o.blockId);t?t.push(o):e.set(o.blockId,[o])}return new s(e)}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 s.create(t);const e=/* @__PURE__ */new Map;for(const[o,r]of this.byBlock)e.set(o,[...r]);for(const o of t){const t=e.get(o.blockId);t?t.push(o):e.set(o.blockId,[o])}return new s(e)}remove(t){const e=/* @__PURE__ */new Map;let o=!1;for(const[r,n]of this.byBlock){const f=n.filter(e=>!t(e));f.length!==n.length&&(o=!0),f.length>0&&e.set(r,f)}return o?0===e.size?s.empty:new s(e):this}merge(t){if(t.isEmpty)return this;if(this.isEmpty)return t;const e=/* @__PURE__ */new Map;for(const[o,r]of this.byBlock)e.set(o,[...r]);for(const[o,r]of t.byBlock){const t=e.get(o);t?t.push(...r):e.set(o,[...r])}return new s(e)}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(e){if(this.isEmpty||0===e.steps.length)return this;let o=[];for(const t of this.byBlock.values())for(const e of t)o.push(e);for(const r of e.steps){const e=[];for(const n of o){const o=t(n,r);if(null!==o)if(Array.isArray(o))for(const t of o)e.push(t);else e.push(o)}o=e}return 0===o.length?s.empty:s.create(o)}}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 D,c as d,r as i,n,f as w};
|
|
2
|
+
//# sourceMappingURL=Decoration-D49mFXrH.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Decoration-D49mFXrH.mjs","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"],"names":["mapDecorationThroughStep","deco","step","type","blockId","len","text","length","newFrom","from","offset","newTo","to","mapInlineInsert","delLen","clampAndShift","mapInlineDelete","newBlockId","mapInlineSplit","sourceBlockId","targetBlockId","targetLengthBefore","mapInlineMerge","removeIfBlockDeleted","mapInline","side","mapWidgetInsert","mapWidgetDelete","mapWidgetSplit","mapWidgetMerge","mapWidget","mapNodeMerge","mapNode","removedNode","id","pos","delFrom","delTo","inline","attrs","node","widget","toDOM","options","key","DecorationSet","constructor","byBlock","this","static","Map","create","decorations","empty","map","existing","get","push","set","find","findInline","decos","filter","d","findNode","findWidget","add","isEmpty","bid","remove","predicate","changed","filtered","size","merge","other","equals","otherDecos","decorationArraysEqual","tr","steps","mapped","values","next","result","Array","isArray","r","a","b","i","ai","bi","decorationsEqual","attrsEqual","bn","bw","aKeys","Object","keys","bKeys"],"mappings":"AA0BO,SAASA,EACfC,EACAC,GAEA,OAAQD,EAAKE,MACZ,IAAK,SACJ,OAQH,SACCF,EACAC,GAEA,OAAQA,EAAKC,MACZ,IAAK,aACJ,OA4CH,SAAyBF,EAAwBC,GAChD,GAAID,EAAKG,UAAYF,EAAKE,QAAS,OAAOH,EAE1C,MAAMI,EAAcH,EAAKI,KAAKC,OAExBC,EAAkBP,EAAKQ,KAAOP,EAAKQ,OAAST,EAAKQ,KAAOJ,EAAMJ,EAAKQ,KAEnEE,EAAgBV,EAAKW,IAAMV,EAAKQ,OAAST,EAAKW,GAAKP,EAAMJ,EAAKW,GAEpE,OAAIJ,IAAYP,EAAKQ,MAAQE,IAAUV,EAAKW,GAAWX,EAChD,IAAKA,EAAMQ,KAAMD,EAASI,GAAID,EACtC,CAvDUE,CAAgBZ,EAAMC,GAC9B,IAAK,aACJ,OAuEH,SAAyBD,EAAwBC,GAChD,GAAID,EAAKG,UAAYF,EAAKE,QAAS,OAAOH,EAE1C,MAAMa,EAAiBZ,EAAKU,GAAKV,EAAKO,KAChCD,EAAkBO,EAAcd,EAAKQ,KAAMP,EAAKO,KAAMP,EAAKU,GAAIE,GAC/DH,EAAgBI,EAAcd,EAAKW,GAAIV,EAA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jF,OAAQmF,IAAK,CAClC,MAAMC,EAAKH,EAAEE,GACPE,EAAKH,EAAEC,GACb,IAAKC,IAAOC,IAAOC,EAAiBF,EAAIC,GAAK,OAAO,CACrD,CACA,OAAO,CACR,CAGA,SAASC,EAAiBL,EAAeC,GACxC,GAAID,EAAErF,OAASsF,EAAEtF,KAAM,OAAO,EAC9B,GAAIqF,EAAEpF,UAAYqF,EAAErF,QAAS,OAAO,EAEpC,OAAQoF,EAAErF,MACT,IAAK,SAAU,CACd,MAAMyF,EAAKH,EACX,OAAOD,EAAE/E,OAASmF,EAAGnF,MAAQ+E,EAAE5E,KAAOgF,EAAGhF,IAAMkF,EAAWN,EAAEjD,MAAOqD,EAAGrD,MACvE,CACA,IAAK,OAAQ,CACZ,MAAMwD,EAAKN,EACX,OAAOK,EAAWN,EAAEjD,MAAOwD,EAAGxD,MAC/B,CACA,IAAK,SAAU,CACd,MAAMyD,EAAKP,EACX,OACCD,EAAE9E,SAAWsF,EAAGtF,QAAU8E,EAAE/D,OAASuE,EAAGvE,MAAQ+D,EAAE5C,MAAQoD,EAAGpD,KAAO4C,EAAE9C,QAAUsD,EAAGtD,KAErF,EAEF,CAGA,SAASoD,EAAWN,EAAoBC,GACvC,GAAID,IAAMC,EAAG,OAAO,EACpB,MAAMQ,EAAQC,OAAOC,KAAKX,GACpBY,EAAQF,OAAOC,KAAKV,GAC1B,GAAIQ,EAAM1F,SAAW6F,EAAM7F,OAAQ,OAAO,EAC1C,IAAA,MAAWqC,KAAOqD,EACjB,GAAIT,EAAE5C,KAAS6C,EAAE7C,GAAM,OAAO,EAE/B,OAAO,CACR"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function t(t,n,r){const o=s(t),i=[];let f=0;for(const s of o){const t=f+(e(s)?1:s.text.length);if(t<=n||f>=r){f=t;continue}if(e(s)){f=t;continue}const o=Math.max(0,n-f),u=Math.min(s.text.length,r-f),c=s.text.slice(o,u);c.length>0&&i.push({text:c,marks:s.marks}),f=t}return i}function n(t){return"object"==typeof t&&null!==t&&"text"===t.type&&"string"==typeof t.text}function e(t){return"object"==typeof t&&null!==t&&"inline"===t.type&&"string"==typeof t.inlineType}function r(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 o(t){return t.children.every(t=>n(t)||e(t))}function i(t){return t.children.filter(t=>n(t))}function s(t){return t.children.filter(t=>n(t)||e(t))}function f(t){return t.children.filter(t=>r(t))}function u(){return`block-${crypto.randomUUID()}`}function c(t){return{children:t??[l("paragraph")]}}function l(t,n,e,r){return{id:e??u(),type:t,...r?{attrs:r}:{},children:n??[a("")]}}function a(t,n){return{type:"text",text:t,marks:n??[]}}function h(t,n){return{type:"inline",inlineType:t,attrs:n??{}}}function g(t){const e=s(t);let r="";for(const o of e)n(o)&&(r+=o.text);return r}function y(t){const n=s(t);let r=0;for(const o of n)r+=e(o)?1:o.text.length;return r}function p(t,r){const o=s(t);let i=0;for(const n of o){if(e(n)){if(r===i)return[];i+=1;continue}const t=i+n.text.length;if(r>=i&&r<t)return n.marks;if(r===i&&0===n.text.length)return n.marks;i=t}for(let e=o.length-1;e>=0;e--){const t=o[e];if(t&&n(t))return t.marks}return[]}function x(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 m(t,n){return t.some(t=>t.type===n)}function k(t,n){return m(t,n.type)?t:[...t,n]}function d(t,n){return t.filter(t=>t.type!==n)}function b(t){if(0===t.length)return[a("")];if(t.every(t=>n(t)))return function(t){if(0===t.length)return[a("")];const n=[];for(const e of t){const t=n[n.length-1];t&&x(t.marks,e.marks)?n[n.length-1]=a(t.text+e.text,t.marks):(e.text.length>0||0===n.length)&&n.push(e)}return 0===n.length?[a("")]:n}(t);const r=[];for(const i of t){if(e(i)){r.push(i);continue}const t=r[r.length-1];t&&n(t)&&x(t.marks,i.marks)?r[r.length-1]=a(t.text+i.text,t.marks):(i.text.length>0||0===r.length)&&r.push(i)}const o=r.filter((t,n)=>{if(e(t))return!0;if(t.text.length>0)return!0;if(1===r.length)return!0;const o=r[n-1],i=r[n+1];return!(o&&e(o)||i&&e(i))});return 0===o.length?[a("")]:o.some(t=>n(t))?o:[a(""),...o]}function j(t,n){const r=s(t);let o=0,i=0;for(const s of r)if(e(s)){if(o>=n)return i;o+=1}else{if(o+s.text.length>=n)return i+(n-o);o+=s.text.length,i+=s.text.length}return i}function v(t,n){const r=s(t);for(const{child:o,from:i}of function*(t){let n=0;for(const r of t){const t=e(r)?1:r.text.length;yield{child:r,from:n,to:n+t},n+=t}}(r)){if(e(o)){if(n===i)return{kind:"inline",node:o};continue}const t=n-i;if(t>=0&&t<o.text.length)return{kind:"text",char:o.text[t]??"",marks:o.marks}}return null}export{c as a,j as b,l as c,h as d,a as e,y as f,f as g,p as h,g as i,v as j,s as k,i as l,m,r as n,e as o,o as p,n as q,x as r,u as s,k as t,d as u,b as v,t as w};
|
|
2
|
+
//# sourceMappingURL=Document-BFYAonMF.mjs.map
|