@notectl/core 2.3.7 → 2.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/chunks/AlignmentPlugin-Cp7HYGaH.mjs +2 -0
- package/dist/chunks/AlignmentPlugin-Cp7HYGaH.mjs.map +1 -0
- package/dist/chunks/{AttrRegistry-CtNhf2EF.mjs → AttrRegistry-Di936wMv.mjs} +2 -2
- package/dist/chunks/AttrRegistry-Di936wMv.mjs.map +1 -0
- package/dist/chunks/{AttributedMarkCommands-B3MQdob_.mjs → AttributedMarkCommands-DKHuhZA7.mjs} +2 -2
- package/dist/chunks/AttributedMarkCommands-DKHuhZA7.mjs.map +1 -0
- package/dist/chunks/BidiIsolationPlugin-GWukKdgJ.mjs +2 -0
- package/dist/chunks/BidiIsolationPlugin-GWukKdgJ.mjs.map +1 -0
- package/dist/chunks/BlockAlignment-BqyBQ4uV.mjs +2 -0
- package/dist/chunks/BlockAlignment-BqyBQ4uV.mjs.map +1 -0
- package/dist/chunks/BlockInsertion-CXfXqUZl.mjs +2 -0
- package/dist/chunks/BlockInsertion-CXfXqUZl.mjs.map +1 -0
- package/dist/chunks/BlockTypePickerRegistry-BTET9jM-.mjs.map +1 -1
- package/dist/chunks/BlockquotePlugin-CSL_7Yit.mjs +2 -0
- package/dist/chunks/BlockquotePlugin-CSL_7Yit.mjs.map +1 -0
- package/dist/chunks/CSSValueEquivalence-DeyUKPQ7.mjs +2 -0
- package/dist/chunks/CSSValueEquivalence-DeyUKPQ7.mjs.map +1 -0
- package/dist/chunks/{CaretNavigationPlugin-DEZU09LJ.mjs → CaretNavigationPlugin-BQPqqK4n.mjs} +2 -2
- package/dist/chunks/CaretNavigationPlugin-BQPqqK4n.mjs.map +1 -0
- package/dist/chunks/CodeBlockPlugin-B4AcDJRK.mjs +2 -0
- package/dist/chunks/CodeBlockPlugin-B4AcDJRK.mjs.map +1 -0
- package/dist/chunks/ColorGrid-DAs0--ty.mjs.map +1 -1
- package/dist/chunks/ColorPickerPopup-B6340f3p.mjs +2 -0
- package/dist/chunks/ColorPickerPopup-B6340f3p.mjs.map +1 -0
- package/dist/chunks/{ColorValidation-B9d_umnf.mjs → ColorValidation-ZBKZ_gTr.mjs} +2 -2
- package/dist/chunks/ColorValidation-ZBKZ_gTr.mjs.map +1 -0
- package/dist/chunks/Commands-Bk7Cl1nH.mjs +2 -0
- package/dist/chunks/Commands-Bk7Cl1nH.mjs.map +1 -0
- package/dist/chunks/ContentModel-dkGOh3N7.mjs +2 -0
- package/dist/chunks/ContentModel-dkGOh3N7.mjs.map +1 -0
- package/dist/chunks/{CursorMarks-dx51OGBf.mjs → CursorMarks-CqHLzGNI.mjs} +2 -2
- package/dist/chunks/CursorMarks-CqHLzGNI.mjs.map +1 -0
- package/dist/chunks/{Decoration-BwhoA4MU.mjs → Decoration-BoFcdSXk.mjs} +2 -2
- package/dist/chunks/Decoration-BoFcdSXk.mjs.map +1 -0
- package/dist/chunks/{DirectionDetection-ZrkMhyaL.mjs → DirectionDetection-a-1iksmh.mjs} +2 -2
- package/dist/chunks/DirectionDetection-a-1iksmh.mjs.map +1 -0
- package/dist/chunks/DirectionIcons-Bbawl9ei.mjs.map +1 -1
- package/dist/chunks/{Document-D_2cIBJG.mjs → Document-ssR6hBzG.mjs} +2 -2
- package/dist/chunks/Document-ssR6hBzG.mjs.map +1 -0
- package/dist/chunks/DocumentParser-C99N0MWF.mjs +2 -0
- package/dist/chunks/DocumentParser-C99N0MWF.mjs.map +1 -0
- package/dist/chunks/DomUtils-Bf7JLFlx.mjs.map +1 -1
- package/dist/chunks/EditorEventBoundary-zpYRxryo.mjs.map +1 -1
- package/dist/chunks/FontPlugin-BcXNFqqO.mjs +2 -0
- package/dist/chunks/FontPlugin-BcXNFqqO.mjs.map +1 -0
- package/dist/chunks/FontSizePlugin-Dswra3oU.mjs +2 -0
- package/dist/chunks/FontSizePlugin-Dswra3oU.mjs.map +1 -0
- package/dist/chunks/FormulaPlugin-DVpLaKi5.mjs +2 -0
- package/dist/chunks/FormulaPlugin-DVpLaKi5.mjs.map +1 -0
- package/dist/chunks/GapCursorPlugin-QDGwnaRR.mjs +2 -0
- package/dist/chunks/GapCursorPlugin-QDGwnaRR.mjs.map +1 -0
- package/dist/chunks/HTMLSanitization-Ce9dVT1q.mjs.map +1 -1
- package/dist/chunks/HTMLUtils-DTpsjZyK.mjs +2 -0
- package/dist/chunks/HTMLUtils-DTpsjZyK.mjs.map +1 -0
- package/dist/chunks/{HardBreakPlugin-CC4rntSX.mjs → HardBreakPlugin-gjCq8prD.mjs} +2 -2
- package/dist/chunks/HardBreakPlugin-gjCq8prD.mjs.map +1 -0
- package/dist/chunks/HeadingPlugin-B7EfynaH.mjs +2 -0
- package/dist/chunks/HeadingPlugin-B7EfynaH.mjs.map +1 -0
- package/dist/chunks/HighlightPlugin-LdO0INtJ.mjs +2 -0
- package/dist/chunks/HighlightPlugin-LdO0INtJ.mjs.map +1 -0
- package/dist/chunks/HorizontalRulePlugin-YywXVZYr.mjs +2 -0
- package/dist/chunks/HorizontalRulePlugin-YywXVZYr.mjs.map +1 -0
- package/dist/chunks/ImagePlugin-BAhZuVdE.mjs +2 -0
- package/dist/chunks/ImagePlugin-BAhZuVdE.mjs.map +1 -0
- package/dist/chunks/InlineCodePlugin-Bu9-rE4B.mjs +2 -0
- package/dist/chunks/InlineCodePlugin-Bu9-rE4B.mjs.map +1 -0
- package/dist/chunks/InlineStyleMarkSpec-BhfGgfH9.mjs +2 -0
- package/dist/chunks/InlineStyleMarkSpec-BhfGgfH9.mjs.map +1 -0
- package/dist/chunks/KeyboardNav-D0my3wuy.mjs.map +1 -1
- package/dist/chunks/LinkPlugin-CAUaWW5-.mjs +2 -0
- package/dist/chunks/LinkPlugin-CAUaWW5-.mjs.map +1 -0
- package/dist/chunks/{ListPlugin--dqEctgn.mjs → ListPlugin-U1r4p_fE.mjs} +2 -2
- package/dist/chunks/ListPlugin-U1r4p_fE.mjs.map +1 -0
- package/dist/chunks/MarkCommands-C0ps9h0z.mjs +2 -0
- package/dist/chunks/MarkCommands-C0ps9h0z.mjs.map +1 -0
- package/dist/chunks/MarkInputRule-DNneF2gp.mjs.map +1 -1
- package/dist/chunks/MarkdownHTMLRegistry-BunUDiza.mjs +2 -0
- package/dist/chunks/MarkdownHTMLRegistry-BunUDiza.mjs.map +1 -0
- package/dist/chunks/{MarkdownParser-D1d9zB0R.mjs → MarkdownParser-uX1p_GQk.mjs} +2 -2
- package/dist/chunks/MarkdownParser-uX1p_GQk.mjs.map +1 -0
- package/dist/chunks/MarkdownSerializer--MrgJTdJ.mjs +2 -0
- package/dist/chunks/MarkdownSerializer--MrgJTdJ.mjs.map +1 -0
- package/dist/chunks/MathFont-BS8IwYh2.mjs.map +1 -1
- package/dist/chunks/NavigationQueries-CaKfccu7.mjs +2 -0
- package/dist/chunks/NavigationQueries-CaKfccu7.mjs.map +1 -0
- package/dist/chunks/NodeResolver-F4RtpoEd.mjs +2 -0
- package/dist/chunks/NodeResolver-F4RtpoEd.mjs.map +1 -0
- package/dist/chunks/{NodeSelectionCommands-DK3iEh18.mjs → NodeSelectionCommands-CAqIHW_6.mjs} +2 -2
- package/dist/chunks/NodeSelectionCommands-CAqIHW_6.mjs.map +1 -0
- package/dist/chunks/NodeSpecPatching-BrjPAbqe.mjs.map +1 -1
- package/dist/chunks/Platform-ByobkiCc.mjs.map +1 -1
- package/dist/chunks/PluginHelpers-B3gk3VB3.mjs +2 -0
- package/dist/chunks/PluginHelpers-B3gk3VB3.mjs.map +1 -0
- package/dist/chunks/PopupKeyboardPatterns-BcwdDxRq.mjs.map +1 -1
- package/dist/chunks/PopupManager-Dxv0OVMo.mjs +2 -0
- package/dist/chunks/PopupManager-Dxv0OVMo.mjs.map +1 -0
- package/dist/chunks/PopupPositioning-CIqgpqlW.mjs.map +1 -1
- package/dist/chunks/{PrintPlugin-BQ7LWbEB.mjs → PrintPlugin-DAEiEyKQ.mjs} +2 -2
- package/dist/chunks/PrintPlugin-DAEiEyKQ.mjs.map +1 -0
- package/dist/chunks/{RangeIterator-DDOxTQIf.mjs → RangeIterator-sJ_c9MNr.mjs} +2 -2
- package/dist/chunks/RangeIterator-sJ_c9MNr.mjs.map +1 -0
- package/dist/chunks/Schema-BSM4YLNT.mjs +2 -0
- package/dist/chunks/Schema-BSM4YLNT.mjs.map +1 -0
- package/dist/chunks/SchemaRegistry-Cs7rxafF.mjs +2 -0
- package/dist/chunks/SchemaRegistry-Cs7rxafF.mjs.map +1 -0
- package/dist/chunks/Selection-DC6AOGgF.mjs.map +1 -1
- package/dist/chunks/SelectionReplacement-vC1xhFS0.mjs +2 -0
- package/dist/chunks/SelectionReplacement-vC1xhFS0.mjs.map +1 -0
- package/dist/chunks/SelectionSync-BkjCwGp-.mjs +2 -0
- package/dist/chunks/SelectionSync-BkjCwGp-.mjs.map +1 -0
- package/dist/chunks/{SelectionTransactions-DNCzsl_b.mjs → SelectionTransactions-mQ1NfMEg.mjs} +2 -2
- package/dist/chunks/SelectionTransactions-mQ1NfMEg.mjs.map +1 -0
- package/dist/chunks/ShortcutFormatting-TwiufqeV.mjs.map +1 -1
- package/dist/chunks/SimpleMark-D6vz3Nfd.mjs +2 -0
- package/dist/chunks/SimpleMark-D6vz3Nfd.mjs.map +1 -0
- package/dist/chunks/SmartPastePlugin-BHsYKbgd.mjs +2 -0
- package/dist/chunks/SmartPastePlugin-BHsYKbgd.mjs.map +1 -0
- package/dist/chunks/StarterFonts-BDQPg-cu.mjs.map +1 -1
- package/dist/chunks/{StrikethroughPlugin-d-EW2YYx.mjs → StrikethroughPlugin-v-VJZzUZ.mjs} +2 -2
- package/dist/chunks/StrikethroughPlugin-v-VJZzUZ.mjs.map +1 -0
- package/dist/chunks/StyleClassNames-BsAx7k5T.mjs +2 -0
- package/dist/chunks/StyleClassNames-BsAx7k5T.mjs.map +1 -0
- package/dist/chunks/StyleRuntime-C0RSqKzG.mjs.map +1 -1
- package/dist/chunks/{SuperSubPlugin-C-kvFQyx.mjs → SuperSubPlugin-x1iPnZyt.mjs} +2 -2
- package/dist/chunks/SuperSubPlugin-x1iPnZyt.mjs.map +1 -0
- package/dist/chunks/SyntaxTokenTypes-BUCOMtL8.mjs.map +1 -1
- package/dist/chunks/TableDimensions-BSEOEox2.mjs +2 -0
- package/dist/chunks/TableDimensions-BSEOEox2.mjs.map +1 -0
- package/dist/chunks/TablePlugin-CjKThPug.mjs +2 -0
- package/dist/chunks/TablePlugin-CjKThPug.mjs.map +1 -0
- package/dist/chunks/TextColorPlugin-Bnl9of9E.mjs +2 -0
- package/dist/chunks/TextColorPlugin-Bnl9of9E.mjs.map +1 -0
- package/dist/chunks/{TextDirectionAutoPlugin-LVDkKdDX.mjs → TextDirectionAutoPlugin-DOH5cfyy.mjs} +2 -2
- package/dist/chunks/TextDirectionAutoPlugin-DOH5cfyy.mjs.map +1 -0
- package/dist/chunks/{TextDirectionPlugin-CtGwof7i.mjs → TextDirectionPlugin-JwlR-R-b.mjs} +2 -2
- package/dist/chunks/TextDirectionPlugin-JwlR-R-b.mjs.map +1 -0
- package/dist/chunks/TextDirectionService-BcX07mw2.mjs +2 -0
- package/dist/chunks/TextDirectionService-BcX07mw2.mjs.map +1 -0
- package/dist/chunks/{TextFormattingPlugin-DlS0SeW7.mjs → TextFormattingPlugin-Kc_UNoOz.mjs} +2 -2
- package/dist/chunks/TextFormattingPlugin-Kc_UNoOz.mjs.map +1 -0
- package/dist/chunks/ThemeEngine-kIXtSRkI.mjs.map +1 -1
- package/dist/chunks/ToolbarPlugin-CgZA2hz8.mjs +2 -0
- package/dist/chunks/ToolbarPlugin-CgZA2hz8.mjs.map +1 -0
- package/dist/chunks/TypeBrands-Ch9856Gb.mjs.map +1 -1
- package/dist/chunks/TypedKeys-CA4bfw9O.mjs.map +1 -1
- package/dist/chunks/VideoPlugin-DJXfuNA9.mjs +2 -0
- package/dist/chunks/VideoPlugin-DJXfuNA9.mjs.map +1 -0
- package/dist/chunks/XmlPatterns-RN32-0ob.mjs.map +1 -1
- package/dist/chunks/XmlSupport-3Za6SIqF.mjs.map +1 -1
- package/dist/chunks/ar--Isa9OHJ.mjs.map +1 -1
- package/dist/chunks/ar--O0A9OTR.mjs.map +1 -1
- package/dist/chunks/ar-0g2bmXTn.mjs.map +1 -1
- package/dist/chunks/ar-4b8e2YSc.mjs.map +1 -1
- package/dist/chunks/ar-B03uY4xr.mjs.map +1 -1
- package/dist/chunks/ar-BAfInw85.mjs.map +1 -1
- package/dist/chunks/ar-BRX5E_Pw.mjs.map +1 -1
- package/dist/chunks/ar-BWOue6jG.mjs.map +1 -1
- package/dist/chunks/ar-Bdmunk5h.mjs.map +1 -1
- package/dist/chunks/ar-BwaoCUVN.mjs.map +1 -1
- package/dist/chunks/ar-BzqAYGER.mjs.map +1 -1
- package/dist/chunks/ar-C9lO1jsY.mjs.map +1 -1
- package/dist/chunks/ar-CMXjVzFx.mjs.map +1 -1
- package/dist/chunks/ar-CR6UdFL9.mjs.map +1 -1
- package/dist/chunks/ar-CrOb0jL2.mjs.map +1 -1
- package/dist/chunks/ar-Cy_77yRf.mjs.map +1 -1
- package/dist/chunks/ar-D1jFXqLJ.mjs.map +1 -1
- package/dist/chunks/ar-DahJwMI9.mjs.map +1 -1
- package/dist/chunks/ar-Dcl3kgtd.mjs.map +1 -1
- package/dist/chunks/ar-Dg9PdDet.mjs.map +1 -1
- package/dist/chunks/ar-DhwCFHql.mjs +2 -0
- package/dist/chunks/ar-DhwCFHql.mjs.map +1 -0
- package/dist/chunks/ar-Dx2lO0Nm.mjs.map +1 -1
- package/dist/chunks/ar-NV_puwI2.mjs.map +1 -1
- package/dist/chunks/ar-Uzo1Azdw.mjs.map +1 -1
- package/dist/chunks/ar-XmSFrtmd.mjs.map +1 -1
- package/dist/chunks/ar-eOA3UmiE.mjs.map +1 -1
- package/dist/chunks/ar-sGZ-oZqB.mjs.map +1 -1
- package/dist/chunks/color-picker-D6HrTsDM.mjs +2 -0
- package/dist/chunks/color-picker-D6HrTsDM.mjs.map +1 -0
- package/dist/chunks/de-B8-w9gPi.mjs.map +1 -1
- package/dist/chunks/de-B9zSHWqY.mjs.map +1 -1
- package/dist/chunks/de-BX4y4PlH.mjs.map +1 -1
- package/dist/chunks/de-BXQBXxFJ.mjs.map +1 -1
- package/dist/chunks/de-BcPntcnr.mjs.map +1 -1
- package/dist/chunks/de-BdD3DpUB.mjs.map +1 -1
- package/dist/chunks/de-Bwxlcuee.mjs.map +1 -1
- package/dist/chunks/de-BxQIt_1Y.mjs.map +1 -1
- package/dist/chunks/de-C-Yf378-.mjs.map +1 -1
- package/dist/chunks/de-C7uehgMu.mjs.map +1 -1
- package/dist/chunks/de-C9ZhDqPi.mjs.map +1 -1
- package/dist/chunks/de-CHcv_Vmf.mjs.map +1 -1
- package/dist/chunks/de-CTzAMkXC.mjs.map +1 -1
- package/dist/chunks/de-CaeEIyzV.mjs.map +1 -1
- package/dist/chunks/de-CjLUbQmg.mjs +2 -0
- package/dist/chunks/de-CjLUbQmg.mjs.map +1 -0
- package/dist/chunks/de-DHs9i4af.mjs.map +1 -1
- package/dist/chunks/de-DJ5EkXQo.mjs.map +1 -1
- package/dist/chunks/de-DRbhnS4T.mjs.map +1 -1
- package/dist/chunks/de-DViI26lG.mjs.map +1 -1
- package/dist/chunks/de-DY3obIAF.mjs.map +1 -1
- package/dist/chunks/de-DcMhfRBu.mjs.map +1 -1
- package/dist/chunks/de-DiPz7abS.mjs.map +1 -1
- package/dist/chunks/de-Dl4QFHMa.mjs.map +1 -1
- package/dist/chunks/de-XCCpWyg0.mjs.map +1 -1
- package/dist/chunks/de-e6J6nvAD.mjs.map +1 -1
- package/dist/chunks/de-i95F9SDy.mjs.map +1 -1
- package/dist/chunks/de-uKR7koQe.mjs.map +1 -1
- package/dist/chunks/es-B0Za939C.mjs.map +1 -1
- package/dist/chunks/es-B8K3Yvf3.mjs.map +1 -1
- package/dist/chunks/es-BIXm2Coj.mjs.map +1 -1
- package/dist/chunks/es-BJHF95J_.mjs.map +1 -1
- package/dist/chunks/es-BMm9kqjC.mjs.map +1 -1
- package/dist/chunks/es-BQ9dox_E.mjs.map +1 -1
- package/dist/chunks/es-BQweZX6P.mjs.map +1 -1
- package/dist/chunks/es-BdpTTRuX.mjs.map +1 -1
- package/dist/chunks/es-C7uVqFYr.mjs.map +1 -1
- package/dist/chunks/es-CCQFu1t1.mjs.map +1 -1
- package/dist/chunks/es-CEAJj7aB.mjs.map +1 -1
- package/dist/chunks/es-CMSzvjOT.mjs +2 -0
- package/dist/chunks/es-CMSzvjOT.mjs.map +1 -0
- package/dist/chunks/es-CUKJujcb.mjs.map +1 -1
- package/dist/chunks/es-CXuMz87y.mjs.map +1 -1
- package/dist/chunks/es-CgMfhkJJ.mjs.map +1 -1
- package/dist/chunks/es-CtOtKQCP.mjs.map +1 -1
- package/dist/chunks/es-DD01rZ6N.mjs.map +1 -1
- package/dist/chunks/es-DDoqchUq.mjs.map +1 -1
- package/dist/chunks/es-DFokqQst.mjs.map +1 -1
- package/dist/chunks/es-DHxdoEzR.mjs.map +1 -1
- package/dist/chunks/es-DehVGwQ8.mjs.map +1 -1
- package/dist/chunks/es-DrJyl38L.mjs.map +1 -1
- package/dist/chunks/es-fTW0TkYV.mjs.map +1 -1
- package/dist/chunks/es-kfKiqpyD.mjs.map +1 -1
- package/dist/chunks/es-nRLq7bgP.mjs.map +1 -1
- package/dist/chunks/es-paXY7HFt.mjs.map +1 -1
- package/dist/chunks/es-xuahrvJN.mjs.map +1 -1
- package/dist/chunks/fr-0qEo3bRP.mjs.map +1 -1
- package/dist/chunks/fr-5HkMazAf.mjs.map +1 -1
- package/dist/chunks/fr-B9pBLaVx.mjs.map +1 -1
- package/dist/chunks/fr-BRXUnq3R.mjs.map +1 -1
- package/dist/chunks/fr-BSUKEtTk.mjs.map +1 -1
- package/dist/chunks/fr-BeRlON1t.mjs.map +1 -1
- package/dist/chunks/fr-Bg937iAy.mjs.map +1 -1
- package/dist/chunks/fr-BwWrFThE.mjs.map +1 -1
- package/dist/chunks/fr-C3EKRThN.mjs.map +1 -1
- package/dist/chunks/fr-CKjH6tJI.mjs.map +1 -1
- package/dist/chunks/fr-CQs0-pNX.mjs.map +1 -1
- package/dist/chunks/fr-CfhyYN-t.mjs.map +1 -1
- package/dist/chunks/fr-D0MDdoir.mjs.map +1 -1
- package/dist/chunks/fr-D5ulA3Z6.mjs.map +1 -1
- package/dist/chunks/fr-DB_OvHWH.mjs +2 -0
- package/dist/chunks/fr-DB_OvHWH.mjs.map +1 -0
- package/dist/chunks/fr-DEZ_oxzS.mjs.map +1 -1
- package/dist/chunks/fr-DciSEykY.mjs.map +1 -1
- package/dist/chunks/fr-DhWQzZy3.mjs.map +1 -1
- package/dist/chunks/fr-DiDhVhyV.mjs.map +1 -1
- package/dist/chunks/fr-DjMZ-3K5.mjs.map +1 -1
- package/dist/chunks/fr-F2ZrfVaF.mjs.map +1 -1
- package/dist/chunks/fr-KXmbys88.mjs.map +1 -1
- package/dist/chunks/fr-NVOinLyF.mjs.map +1 -1
- package/dist/chunks/fr-SbpHNrQ-.mjs.map +1 -1
- package/dist/chunks/fr-ZsRdLuys.mjs.map +1 -1
- package/dist/chunks/fr-eC0UdAPu.mjs.map +1 -1
- package/dist/chunks/fr-fshsDD66.mjs.map +1 -1
- package/dist/chunks/full-BsWAZr1w.mjs +2 -0
- package/dist/chunks/full-BsWAZr1w.mjs.map +1 -0
- package/dist/chunks/hi-4CiAKVjT.mjs.map +1 -1
- package/dist/chunks/hi-B-ZuX4aN.mjs.map +1 -1
- package/dist/chunks/hi-B2YB3Bo4.mjs.map +1 -1
- package/dist/chunks/hi-B2uhiPCN.mjs.map +1 -1
- package/dist/chunks/hi-B5cl8TWK.mjs.map +1 -1
- package/dist/chunks/hi-BNJIGWQQ.mjs.map +1 -1
- package/dist/chunks/hi-BOMkDPqC.mjs.map +1 -1
- package/dist/chunks/hi-Bl-yeeOI.mjs.map +1 -1
- package/dist/chunks/hi-BsZzSMfL.mjs.map +1 -1
- package/dist/chunks/hi-By8YwVIX.mjs.map +1 -1
- package/dist/chunks/hi-BzbMD_cP.mjs.map +1 -1
- package/dist/chunks/hi-C2jEsf8v.mjs.map +1 -1
- package/dist/chunks/hi-CTWubxLY.mjs.map +1 -1
- package/dist/chunks/hi-ChNQZZ1z.mjs +2 -0
- package/dist/chunks/hi-ChNQZZ1z.mjs.map +1 -0
- package/dist/chunks/hi-CoclKAUM.mjs.map +1 -1
- package/dist/chunks/hi-CrmakMVj.mjs.map +1 -1
- package/dist/chunks/hi-DWX6k5ZD.mjs.map +1 -1
- package/dist/chunks/hi-DY55FuDK.mjs.map +1 -1
- package/dist/chunks/hi-DrC2H81d.mjs.map +1 -1
- package/dist/chunks/hi-DsdXcOB6.mjs.map +1 -1
- package/dist/chunks/hi-Dt89SxNy.mjs.map +1 -1
- package/dist/chunks/hi-J8ErB5nB.mjs.map +1 -1
- package/dist/chunks/hi-L6pJxZam.mjs.map +1 -1
- package/dist/chunks/hi-SECtQQzq.mjs.map +1 -1
- package/dist/chunks/hi-j3TDLMYd.mjs.map +1 -1
- package/dist/chunks/hi-l6DA-aOw.mjs.map +1 -1
- package/dist/chunks/hi-uACJUw53.mjs.map +1 -1
- package/dist/chunks/minimal-DO7LiFTa.mjs +2 -0
- package/dist/chunks/minimal-DO7LiFTa.mjs.map +1 -0
- package/dist/chunks/pt-5VeuNDd2.mjs.map +1 -1
- package/dist/chunks/pt-BCXgUDiU.mjs.map +1 -1
- package/dist/chunks/pt-BDam9cDu.mjs.map +1 -1
- package/dist/chunks/pt-Bb908r0n.mjs.map +1 -1
- package/dist/chunks/pt-BkpVtod-.mjs.map +1 -1
- package/dist/chunks/pt-BlFAJZo7.mjs.map +1 -1
- package/dist/chunks/pt-Bu7Mbz67.mjs.map +1 -1
- package/dist/chunks/pt-BuZ7acHF.mjs.map +1 -1
- package/dist/chunks/pt-C8sOyw0V.mjs.map +1 -1
- package/dist/chunks/pt-CEUgbrii.mjs.map +1 -1
- package/dist/chunks/pt-CFrcl1v_.mjs.map +1 -1
- package/dist/chunks/pt-CI8t6oul.mjs +2 -0
- package/dist/chunks/pt-CI8t6oul.mjs.map +1 -0
- package/dist/chunks/pt-CMrFpUWS.mjs.map +1 -1
- package/dist/chunks/pt-CMx2wPPY.mjs.map +1 -1
- package/dist/chunks/pt-CR4j8gtE.mjs.map +1 -1
- package/dist/chunks/pt-Cc4zysaT.mjs.map +1 -1
- package/dist/chunks/pt-Cv6q7x5x.mjs.map +1 -1
- package/dist/chunks/pt-DFKJVh7k.mjs.map +1 -1
- package/dist/chunks/pt-DYMyMgKQ.mjs.map +1 -1
- package/dist/chunks/pt-D__tcM2T.mjs.map +1 -1
- package/dist/chunks/pt-Dg2ctkug.mjs.map +1 -1
- package/dist/chunks/pt-DgfMoLWR.mjs.map +1 -1
- package/dist/chunks/pt-OXa_IR4Q.mjs.map +1 -1
- package/dist/chunks/pt-UPF7DBlz.mjs.map +1 -1
- package/dist/chunks/pt-_qxIe7zX.mjs.map +1 -1
- package/dist/chunks/pt-paXY7HFt.mjs.map +1 -1
- package/dist/chunks/pt-zMHcNGPk.mjs.map +1 -1
- package/dist/chunks/register-DXLu8Njp.mjs +3 -0
- package/dist/chunks/register-DXLu8Njp.mjs.map +1 -0
- package/dist/chunks/ru-9WtNGZtl.mjs +2 -0
- package/dist/chunks/ru-9WtNGZtl.mjs.map +1 -0
- package/dist/chunks/ru-B1m8J9dl.mjs.map +1 -1
- package/dist/chunks/ru-BNPUT-3S.mjs.map +1 -1
- package/dist/chunks/ru-BotG0MFT.mjs.map +1 -1
- package/dist/chunks/ru-C-APN_dm.mjs.map +1 -1
- package/dist/chunks/ru-C9yFslEG.mjs.map +1 -1
- package/dist/chunks/ru-CkG_bpfo.mjs.map +1 -1
- package/dist/chunks/ru-Cs8KCNyq.mjs.map +1 -1
- package/dist/chunks/ru-CsP6mLxp.mjs.map +1 -1
- package/dist/chunks/ru-CvDl-yEd.mjs.map +1 -1
- package/dist/chunks/ru-CwyPz2Va.mjs.map +1 -1
- package/dist/chunks/ru-D53d-_UB.mjs.map +1 -1
- package/dist/chunks/ru-DJMpeuey.mjs.map +1 -1
- package/dist/chunks/ru-DSRv3_Rg.mjs.map +1 -1
- package/dist/chunks/ru-DV-lgEtM.mjs.map +1 -1
- package/dist/chunks/ru-DiwQV30V.mjs.map +1 -1
- package/dist/chunks/ru-DkW9XZFy.mjs.map +1 -1
- package/dist/chunks/ru-DyCTlhjg.mjs.map +1 -1
- package/dist/chunks/ru-QGX8lOTs.mjs.map +1 -1
- package/dist/chunks/ru-QcTo2yoL.mjs.map +1 -1
- package/dist/chunks/ru-Y11wuxOB.mjs.map +1 -1
- package/dist/chunks/ru-Yngw7nFP.mjs.map +1 -1
- package/dist/chunks/ru-d68SZpEe.mjs.map +1 -1
- package/dist/chunks/ru-gxbzqLL8.mjs.map +1 -1
- package/dist/chunks/ru-k7o3Qks3.mjs.map +1 -1
- package/dist/chunks/ru-l73diFXn.mjs.map +1 -1
- package/dist/chunks/ru-q8kz-237.mjs.map +1 -1
- package/dist/chunks/src-5GKFQ2mQ.mjs.map +1 -1
- package/dist/chunks/xml-BsV44TrJ.mjs.map +1 -1
- package/dist/chunks/zh-BFZOM3lF.mjs.map +1 -1
- package/dist/chunks/zh-BGYJXxVl.mjs.map +1 -1
- package/dist/chunks/zh-BP97XjlS.mjs.map +1 -1
- package/dist/chunks/zh-BQ73oqxc.mjs.map +1 -1
- package/dist/chunks/zh-BQqf3wJZ.mjs.map +1 -1
- package/dist/chunks/zh-Baxh6v0j.mjs.map +1 -1
- package/dist/chunks/zh-BrqJ4ywP.mjs +2 -0
- package/dist/chunks/zh-BrqJ4ywP.mjs.map +1 -0
- package/dist/chunks/zh-BvuAbM2S.mjs.map +1 -1
- package/dist/chunks/zh-C-wHnDo5.mjs.map +1 -1
- package/dist/chunks/zh-C7iCgCRP.mjs.map +1 -1
- package/dist/chunks/zh-CRsDvfPR.mjs.map +1 -1
- package/dist/chunks/zh-CWGAPVei.mjs.map +1 -1
- package/dist/chunks/zh-CWIzJcXi.mjs.map +1 -1
- package/dist/chunks/zh-CYV-db-K.mjs.map +1 -1
- package/dist/chunks/zh-CiIyOm6U.mjs.map +1 -1
- package/dist/chunks/zh-CnW44JEw.mjs.map +1 -1
- package/dist/chunks/zh-D1HSmSOf.mjs.map +1 -1
- package/dist/chunks/zh-DWN1Jqn3.mjs.map +1 -1
- package/dist/chunks/zh-DYD476c5.mjs.map +1 -1
- package/dist/chunks/zh-DdzgYD7k.mjs.map +1 -1
- package/dist/chunks/zh-DgSmvLyw.mjs.map +1 -1
- package/dist/chunks/zh-DlVfQn4z.mjs.map +1 -1
- package/dist/chunks/zh-Oj-qSUEp.mjs.map +1 -1
- package/dist/chunks/zh-YfuE_m2y.mjs.map +1 -1
- package/dist/chunks/zh-dGSDBBzb.mjs.map +1 -1
- package/dist/chunks/zh-ikm3rSTR.mjs.map +1 -1
- package/dist/chunks/zh-oZl1P_p0.mjs.map +1 -1
- package/dist/commands/BlockInsertion.d.ts +15 -19
- package/dist/commands/BlockInsertion.d.ts.map +1 -1
- package/dist/commands/Commands.d.ts.map +1 -1
- package/dist/commands/CompositionCommands.d.ts +47 -0
- package/dist/commands/CompositionCommands.d.ts.map +1 -0
- package/dist/commands/CompositionRebase.d.ts +24 -0
- package/dist/commands/CompositionRebase.d.ts.map +1 -0
- package/dist/commands/PasteCommand.d.ts.map +1 -1
- package/dist/commands/SelectionDeletion.d.ts +20 -8
- package/dist/commands/SelectionDeletion.d.ts.map +1 -1
- package/dist/commands/SelectionReplacement.d.ts +42 -0
- package/dist/commands/SelectionReplacement.d.ts.map +1 -0
- package/dist/editor/BlockIdentity.d.ts +16 -0
- package/dist/editor/BlockIdentity.d.ts.map +1 -0
- package/dist/editor/ContentSerializer.d.ts +13 -11
- package/dist/editor/ContentSerializer.d.ts.map +1 -1
- package/dist/editor/NotectlEditor.d.ts +6 -5
- package/dist/editor/NotectlEditor.d.ts.map +1 -1
- package/dist/editor/styles/link.d.ts +3 -0
- package/dist/editor/styles/link.d.ts.map +1 -0
- package/dist/fonts.mjs +1 -1
- package/dist/full.mjs +1 -1
- package/dist/html.mjs +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/input/CompositionController.d.ts +78 -0
- package/dist/input/CompositionController.d.ts.map +1 -0
- package/dist/input/HTMLParser.d.ts +15 -2
- package/dist/input/HTMLParser.d.ts.map +1 -1
- package/dist/input/InputHandler.d.ts +34 -1
- package/dist/input/InputHandler.d.ts.map +1 -1
- package/dist/input/InputManager.d.ts +3 -0
- package/dist/input/InputManager.d.ts.map +1 -1
- package/dist/input/PasteHTMLHandler.d.ts.map +1 -1
- package/dist/input/PasteHandler.d.ts.map +1 -1
- package/dist/input/PasteRichBlockHandler.d.ts +10 -17
- package/dist/input/PasteRichBlockHandler.d.ts.map +1 -1
- package/dist/markdown.mjs +1 -1
- package/dist/model/BlockAlignment.d.ts +6 -0
- package/dist/model/BlockAlignment.d.ts.map +1 -1
- package/dist/model/BlockOffsetText.d.ts +11 -0
- package/dist/model/BlockOffsetText.d.ts.map +1 -0
- package/dist/model/CompositionState.d.ts +14 -0
- package/dist/model/CompositionState.d.ts.map +1 -1
- package/dist/model/ContentModel.d.ts +6 -1
- package/dist/model/ContentModel.d.ts.map +1 -1
- package/dist/model/FileHandlerDispatcher.d.ts +3 -1
- package/dist/model/FileHandlerDispatcher.d.ts.map +1 -1
- package/dist/model/FileHandlerRegistry.d.ts +11 -2
- package/dist/model/FileHandlerRegistry.d.ts.map +1 -1
- package/dist/model/HTMLUtils.d.ts +16 -3
- package/dist/model/HTMLUtils.d.ts.map +1 -1
- package/dist/model/MarkSpec.d.ts +5 -3
- package/dist/model/MarkSpec.d.ts.map +1 -1
- package/dist/model/NodeResolver.d.ts +2 -0
- package/dist/model/NodeResolver.d.ts.map +1 -1
- package/dist/model/NodeSpec.d.ts +2 -1
- package/dist/model/NodeSpec.d.ts.map +1 -1
- package/dist/model/Schema.d.ts +2 -0
- package/dist/model/Schema.d.ts.map +1 -1
- package/dist/model/SchemaRegistry.d.ts +26 -1
- package/dist/model/SchemaRegistry.d.ts.map +1 -1
- package/dist/model/StyleClass.d.ts +45 -0
- package/dist/model/StyleClass.d.ts.map +1 -0
- package/dist/model/StyleClassRegistry.d.ts +28 -0
- package/dist/model/StyleClassRegistry.d.ts.map +1 -0
- package/dist/model/TextChange.d.ts +40 -0
- package/dist/model/TextChange.d.ts.map +1 -0
- package/dist/notectl-core.mjs +1 -1
- package/dist/notectl-core.umd.js +1 -1
- package/dist/notectl-core.umd.js.map +1 -1
- package/dist/plugins/Plugin.d.ts +11 -0
- package/dist/plugins/Plugin.d.ts.map +1 -1
- package/dist/plugins/PluginContextFactory.d.ts +2 -0
- package/dist/plugins/PluginContextFactory.d.ts.map +1 -1
- package/dist/plugins/RegistrationTracker.d.ts.map +1 -1
- package/dist/plugins/alignment/AlignmentPlugin.d.ts +17 -0
- package/dist/plugins/alignment/AlignmentPlugin.d.ts.map +1 -1
- package/dist/plugins/alignment.mjs +1 -1
- package/dist/plugins/bidi-isolation.mjs +1 -1
- package/dist/plugins/blockquote.mjs +1 -1
- package/dist/plugins/caret-navigation.mjs +1 -1
- package/dist/plugins/code-block/CodeBlockSchema.d.ts.map +1 -1
- package/dist/plugins/code-block.mjs +1 -1
- package/dist/plugins/font/FontPlugin.d.ts +13 -0
- package/dist/plugins/font/FontPlugin.d.ts.map +1 -1
- package/dist/plugins/font-size/FontSizeOperations.d.ts +2 -0
- package/dist/plugins/font-size/FontSizeOperations.d.ts.map +1 -1
- package/dist/plugins/font-size/FontSizePlugin.d.ts +11 -0
- package/dist/plugins/font-size/FontSizePlugin.d.ts.map +1 -1
- package/dist/plugins/font-size.mjs +1 -1
- package/dist/plugins/font.mjs +1 -1
- package/dist/plugins/formula/FormulaCommands.d.ts +6 -4
- package/dist/plugins/formula/FormulaCommands.d.ts.map +1 -1
- package/dist/plugins/formula/FormulaPlugin.d.ts.map +1 -1
- package/dist/plugins/formula/latex/LatexParser.d.ts.map +1 -1
- package/dist/plugins/formula/latex/LatexSymbols.d.ts.map +1 -1
- package/dist/plugins/formula/latex/LookupOwn.d.ts +6 -0
- package/dist/plugins/formula/latex/LookupOwn.d.ts.map +1 -0
- package/dist/plugins/formula/latex/handlers/Accents.d.ts.map +1 -1
- package/dist/plugins/formula/latex/handlers/Delimiters.d.ts.map +1 -1
- package/dist/plugins/formula/latex/handlers/Environments.d.ts.map +1 -1
- package/dist/plugins/formula/latex/handlers/Fonts.d.ts.map +1 -1
- package/dist/plugins/formula/latex/handlers/Spacing.d.ts.map +1 -1
- package/dist/plugins/formula.mjs +1 -1
- package/dist/plugins/gap-cursor/GapCursorPlugin.d.ts.map +1 -1
- package/dist/plugins/gap-cursor.mjs +1 -1
- package/dist/plugins/hard-break.mjs +1 -1
- package/dist/plugins/heading.mjs +1 -1
- package/dist/plugins/highlight/HighlightPlugin.d.ts +11 -0
- package/dist/plugins/highlight/HighlightPlugin.d.ts.map +1 -1
- package/dist/plugins/highlight.mjs +1 -1
- package/dist/plugins/horizontal-rule.mjs +1 -1
- package/dist/plugins/image/ImageCommands.d.ts +15 -3
- package/dist/plugins/image/ImageCommands.d.ts.map +1 -1
- package/dist/plugins/image/ImagePlugin.d.ts.map +1 -1
- package/dist/plugins/image.mjs +1 -1
- package/dist/plugins/inline-code/InlineCodePlugin.d.ts.map +1 -1
- package/dist/plugins/inline-code.mjs +1 -1
- package/dist/plugins/link/LinkInteractionController.d.ts +26 -0
- package/dist/plugins/link/LinkInteractionController.d.ts.map +1 -0
- package/dist/plugins/link/LinkLocale.d.ts +7 -1
- package/dist/plugins/link/LinkLocale.d.ts.map +1 -1
- package/dist/plugins/link/LinkNavigation.d.ts +12 -0
- package/dist/plugins/link/LinkNavigation.d.ts.map +1 -0
- package/dist/plugins/link/LinkPlugin.d.ts +4 -4
- package/dist/plugins/link/LinkPlugin.d.ts.map +1 -1
- package/dist/plugins/link/LinkPreview.d.ts +28 -0
- package/dist/plugins/link/LinkPreview.d.ts.map +1 -0
- package/dist/plugins/link/locales/ar.d.ts.map +1 -1
- package/dist/plugins/link/locales/de.d.ts.map +1 -1
- package/dist/plugins/link/locales/es.d.ts.map +1 -1
- package/dist/plugins/link/locales/fr.d.ts.map +1 -1
- package/dist/plugins/link/locales/hi.d.ts.map +1 -1
- package/dist/plugins/link/locales/pt.d.ts.map +1 -1
- package/dist/plugins/link/locales/ru.d.ts.map +1 -1
- package/dist/plugins/link/locales/zh.d.ts.map +1 -1
- package/dist/plugins/link.mjs +1 -1
- package/dist/plugins/list.mjs +1 -1
- package/dist/plugins/print.mjs +1 -1
- package/dist/plugins/shared/ColorValidation.d.ts +12 -4
- package/dist/plugins/shared/ColorValidation.d.ts.map +1 -1
- package/dist/plugins/shared/InlineStyleMarkSpec.d.ts +10 -0
- package/dist/plugins/shared/InlineStyleMarkSpec.d.ts.map +1 -1
- package/dist/plugins/shared/PopupManager.d.ts +5 -0
- package/dist/plugins/shared/PopupManager.d.ts.map +1 -1
- package/dist/plugins/shared/StyleClassNames.d.ts +10 -0
- package/dist/plugins/shared/StyleClassNames.d.ts.map +1 -0
- package/dist/plugins/shared.mjs +1 -1
- package/dist/plugins/smart-paste/SmartPastePlugin.d.ts +0 -1
- package/dist/plugins/smart-paste/SmartPastePlugin.d.ts.map +1 -1
- package/dist/plugins/smart-paste.mjs +1 -1
- package/dist/plugins/strikethrough.mjs +1 -1
- package/dist/plugins/super-sub.mjs +1 -1
- package/dist/plugins/table.mjs +1 -1
- package/dist/plugins/text-color/TextColorPlugin.d.ts +11 -0
- package/dist/plugins/text-color/TextColorPlugin.d.ts.map +1 -1
- package/dist/plugins/text-color.mjs +1 -1
- package/dist/plugins/text-direction-auto.mjs +1 -1
- package/dist/plugins/text-direction.mjs +1 -1
- package/dist/plugins/text-formatting.mjs +1 -1
- package/dist/plugins/toolbar.mjs +1 -1
- package/dist/plugins/video.mjs +1 -1
- package/dist/presets/full.mjs +1 -1
- package/dist/presets/minimal.mjs +1 -1
- package/dist/presets.mjs +1 -1
- package/dist/register.mjs +1 -1
- package/dist/serialization/AlignmentHTML.d.ts +43 -0
- package/dist/serialization/AlignmentHTML.d.ts.map +1 -0
- package/dist/serialization/CSSClassCollector.d.ts +20 -17
- package/dist/serialization/CSSClassCollector.d.ts.map +1 -1
- package/dist/serialization/CSSValueEquivalence.d.ts +24 -0
- package/dist/serialization/CSSValueEquivalence.d.ts.map +1 -0
- package/dist/serialization/DocumentParser.d.ts +2 -1
- package/dist/serialization/DocumentParser.d.ts.map +1 -1
- package/dist/serialization/DocumentSerializer.d.ts +0 -4
- package/dist/serialization/DocumentSerializer.d.ts.map +1 -1
- package/dist/serialization/FirstTagAttributes.d.ts +16 -0
- package/dist/serialization/FirstTagAttributes.d.ts.map +1 -0
- package/dist/serialization/HTMLParseRules.d.ts +32 -0
- package/dist/serialization/HTMLParseRules.d.ts.map +1 -0
- package/dist/serialization/HTMLParseSession.d.ts +21 -0
- package/dist/serialization/HTMLParseSession.d.ts.map +1 -0
- package/dist/serialization/MarkSerializer.d.ts.map +1 -1
- package/dist/serialization/StyleClassHTML.d.ts +37 -0
- package/dist/serialization/StyleClassHTML.d.ts.map +1 -0
- package/dist/serialization/StyleRehydration.d.ts +16 -0
- package/dist/serialization/StyleRehydration.d.ts.map +1 -0
- package/dist/serialization/TableDimensions.d.ts.map +1 -1
- package/dist/serialization/index.d.ts +2 -1
- package/dist/serialization/index.d.ts.map +1 -1
- package/dist/serialization/markdown/InlineSerializers.d.ts.map +1 -1
- package/dist/state/EditorState.d.ts.map +1 -1
- package/dist/state/History.d.ts +2 -1
- package/dist/state/History.d.ts.map +1 -1
- package/dist/state/NavigationQueries.d.ts.map +1 -1
- package/dist/state/SelectionValidation.d.ts +12 -0
- package/dist/state/SelectionValidation.d.ts.map +1 -0
- package/dist/state/StepApplication.d.ts.map +1 -1
- package/dist/state/StepMapping.d.ts.map +1 -1
- package/dist/state/Steps.d.ts +3 -0
- package/dist/state/Steps.d.ts.map +1 -1
- package/dist/state/StructuralPositions.d.ts +15 -0
- package/dist/state/StructuralPositions.d.ts.map +1 -0
- package/dist/state/TransactionBuilder.d.ts +13 -15
- package/dist/state/TransactionBuilder.d.ts.map +1 -1
- package/dist/test/TestUtils.d.ts.map +1 -1
- package/dist/view/CursorWrapper.d.ts.map +1 -1
- package/dist/view/EditorView.d.ts +25 -1
- package/dist/view/EditorView.d.ts.map +1 -1
- package/dist/view/EditorViewEvents.d.ts.map +1 -1
- package/dist/view/InlineContentDOM.d.ts +44 -0
- package/dist/view/InlineContentDOM.d.ts.map +1 -0
- package/dist/view/Reconciler.d.ts +20 -1
- package/dist/view/Reconciler.d.ts.map +1 -1
- package/dist/view/RenderedBlockText.d.ts +27 -0
- package/dist/view/RenderedBlockText.d.ts.map +1 -0
- package/dist/view/SelectionSync.d.ts.map +1 -1
- package/package.json +9 -8
- package/dist/chunks/AlignmentPlugin-DIwrRsHd.mjs +0 -2
- package/dist/chunks/AlignmentPlugin-DIwrRsHd.mjs.map +0 -1
- package/dist/chunks/AttrRegistry-CtNhf2EF.mjs.map +0 -1
- package/dist/chunks/AttributedMarkCommands-B3MQdob_.mjs.map +0 -1
- package/dist/chunks/BidiIsolationPlugin-cOLlL3Y9.mjs +0 -2
- package/dist/chunks/BidiIsolationPlugin-cOLlL3Y9.mjs.map +0 -1
- package/dist/chunks/BlockInsertion-O5pAFKid.mjs +0 -2
- package/dist/chunks/BlockInsertion-O5pAFKid.mjs.map +0 -1
- package/dist/chunks/BlockquotePlugin-D-jRWLQB.mjs +0 -2
- package/dist/chunks/BlockquotePlugin-D-jRWLQB.mjs.map +0 -1
- package/dist/chunks/CaretNavigationPlugin-DEZU09LJ.mjs.map +0 -1
- package/dist/chunks/CodeBlockPlugin-BandNM3t.mjs +0 -2
- package/dist/chunks/CodeBlockPlugin-BandNM3t.mjs.map +0 -1
- package/dist/chunks/ColorPickerPopup-CFYCCN7m.mjs +0 -2
- package/dist/chunks/ColorPickerPopup-CFYCCN7m.mjs.map +0 -1
- package/dist/chunks/ColorValidation-B9d_umnf.mjs.map +0 -1
- package/dist/chunks/Commands-D-0UXYvo.mjs +0 -2
- package/dist/chunks/Commands-D-0UXYvo.mjs.map +0 -1
- package/dist/chunks/ContentModel-Bzmzeqwg.mjs +0 -2
- package/dist/chunks/ContentModel-Bzmzeqwg.mjs.map +0 -1
- package/dist/chunks/CursorMarks-dx51OGBf.mjs.map +0 -1
- package/dist/chunks/Decoration-BwhoA4MU.mjs.map +0 -1
- package/dist/chunks/DirectionDetection-ZrkMhyaL.mjs.map +0 -1
- package/dist/chunks/Document-D_2cIBJG.mjs.map +0 -1
- package/dist/chunks/DocumentParser-i-CreJ48.mjs +0 -2
- package/dist/chunks/DocumentParser-i-CreJ48.mjs.map +0 -1
- package/dist/chunks/FontPlugin-BySgRcF3.mjs +0 -2
- package/dist/chunks/FontPlugin-BySgRcF3.mjs.map +0 -1
- package/dist/chunks/FontSizePlugin-zJDiyhUv.mjs +0 -2
- package/dist/chunks/FontSizePlugin-zJDiyhUv.mjs.map +0 -1
- package/dist/chunks/FormulaPlugin-CI0r4X1o.mjs +0 -2
- package/dist/chunks/FormulaPlugin-CI0r4X1o.mjs.map +0 -1
- package/dist/chunks/GapCursorPlugin-NozsEK9J.mjs +0 -2
- package/dist/chunks/GapCursorPlugin-NozsEK9J.mjs.map +0 -1
- package/dist/chunks/HTMLUtils-B0nGyFLb.mjs +0 -2
- package/dist/chunks/HTMLUtils-B0nGyFLb.mjs.map +0 -1
- package/dist/chunks/HardBreakPlugin-CC4rntSX.mjs.map +0 -1
- package/dist/chunks/HeadingPlugin-BCh12hFT.mjs +0 -2
- package/dist/chunks/HeadingPlugin-BCh12hFT.mjs.map +0 -1
- package/dist/chunks/HighlightPlugin-By7CWUss.mjs +0 -2
- package/dist/chunks/HighlightPlugin-By7CWUss.mjs.map +0 -1
- package/dist/chunks/HorizontalRulePlugin-CxmUMM34.mjs +0 -2
- package/dist/chunks/HorizontalRulePlugin-CxmUMM34.mjs.map +0 -1
- package/dist/chunks/ImagePlugin-C_MuvfYo.mjs +0 -2
- package/dist/chunks/ImagePlugin-C_MuvfYo.mjs.map +0 -1
- package/dist/chunks/InlineCodePlugin-C1SqGfv5.mjs +0 -2
- package/dist/chunks/InlineCodePlugin-C1SqGfv5.mjs.map +0 -1
- package/dist/chunks/InlineStyleMarkSpec-Cx3goc3W.mjs +0 -2
- package/dist/chunks/InlineStyleMarkSpec-Cx3goc3W.mjs.map +0 -1
- package/dist/chunks/LinkPlugin-Bsmt97Kw.mjs +0 -2
- package/dist/chunks/LinkPlugin-Bsmt97Kw.mjs.map +0 -1
- package/dist/chunks/ListPlugin--dqEctgn.mjs.map +0 -1
- package/dist/chunks/MarkCommands-CJvLGL5G.mjs +0 -2
- package/dist/chunks/MarkCommands-CJvLGL5G.mjs.map +0 -1
- package/dist/chunks/MarkdownHTMLRegistry-CISsC0lH.mjs +0 -2
- package/dist/chunks/MarkdownHTMLRegistry-CISsC0lH.mjs.map +0 -1
- package/dist/chunks/MarkdownParser-D1d9zB0R.mjs.map +0 -1
- package/dist/chunks/MarkdownSerializer-Oex2RzNw.mjs +0 -2
- package/dist/chunks/MarkdownSerializer-Oex2RzNw.mjs.map +0 -1
- package/dist/chunks/NavigationQueries-Bt4zZ17v.mjs +0 -2
- package/dist/chunks/NavigationQueries-Bt4zZ17v.mjs.map +0 -1
- package/dist/chunks/NodeResolver-BtIknXqD.mjs +0 -2
- package/dist/chunks/NodeResolver-BtIknXqD.mjs.map +0 -1
- package/dist/chunks/NodeSelectionCommands-DK3iEh18.mjs.map +0 -1
- package/dist/chunks/PluginHelpers-WG1Lzzh3.mjs +0 -2
- package/dist/chunks/PluginHelpers-WG1Lzzh3.mjs.map +0 -1
- package/dist/chunks/PopupManager-Jz5JrUdC.mjs +0 -2
- package/dist/chunks/PopupManager-Jz5JrUdC.mjs.map +0 -1
- package/dist/chunks/PrintPlugin-BQ7LWbEB.mjs.map +0 -1
- package/dist/chunks/RangeIterator-DDOxTQIf.mjs.map +0 -1
- package/dist/chunks/SchemaRegistry-acc6q_5x.mjs +0 -2
- package/dist/chunks/SchemaRegistry-acc6q_5x.mjs.map +0 -1
- package/dist/chunks/SelectionSync-CwOHMMfI.mjs +0 -2
- package/dist/chunks/SelectionSync-CwOHMMfI.mjs.map +0 -1
- package/dist/chunks/SelectionTransactions-DNCzsl_b.mjs.map +0 -1
- package/dist/chunks/SimpleMark-CTDtEIMV.mjs +0 -2
- package/dist/chunks/SimpleMark-CTDtEIMV.mjs.map +0 -1
- package/dist/chunks/SmartPastePlugin-CjExbE9Q.mjs +0 -2
- package/dist/chunks/SmartPastePlugin-CjExbE9Q.mjs.map +0 -1
- package/dist/chunks/StrikethroughPlugin-d-EW2YYx.mjs.map +0 -1
- package/dist/chunks/SuperSubPlugin-C-kvFQyx.mjs.map +0 -1
- package/dist/chunks/TableDimensions-BcARMxQB.mjs +0 -2
- package/dist/chunks/TableDimensions-BcARMxQB.mjs.map +0 -1
- package/dist/chunks/TablePlugin-CdXY0Px5.mjs +0 -2
- package/dist/chunks/TablePlugin-CdXY0Px5.mjs.map +0 -1
- package/dist/chunks/TextColorPlugin-BLTKft_Z.mjs +0 -2
- package/dist/chunks/TextColorPlugin-BLTKft_Z.mjs.map +0 -1
- package/dist/chunks/TextDirectionAutoPlugin-LVDkKdDX.mjs.map +0 -1
- package/dist/chunks/TextDirectionPlugin-CtGwof7i.mjs.map +0 -1
- package/dist/chunks/TextDirectionService-OFOU6r_s.mjs +0 -2
- package/dist/chunks/TextDirectionService-OFOU6r_s.mjs.map +0 -1
- package/dist/chunks/TextFormattingPlugin-DlS0SeW7.mjs.map +0 -1
- package/dist/chunks/ToolbarPlugin-CMHJCdYY.mjs +0 -2
- package/dist/chunks/ToolbarPlugin-CMHJCdYY.mjs.map +0 -1
- package/dist/chunks/VideoPlugin-C9z4JfP_.mjs +0 -2
- package/dist/chunks/VideoPlugin-C9z4JfP_.mjs.map +0 -1
- package/dist/chunks/ar-Ctrv6cIi.mjs +0 -2
- package/dist/chunks/ar-Ctrv6cIi.mjs.map +0 -1
- package/dist/chunks/color-picker-DJ05ey9o.mjs +0 -2
- package/dist/chunks/color-picker-DJ05ey9o.mjs.map +0 -1
- package/dist/chunks/de-JhGflzS5.mjs +0 -2
- package/dist/chunks/de-JhGflzS5.mjs.map +0 -1
- package/dist/chunks/es-Bv7bDbMp.mjs +0 -2
- package/dist/chunks/es-Bv7bDbMp.mjs.map +0 -1
- package/dist/chunks/fr-DtzIu6tU.mjs +0 -2
- package/dist/chunks/fr-DtzIu6tU.mjs.map +0 -1
- package/dist/chunks/full-9sO5JbWG.mjs +0 -2
- package/dist/chunks/full-9sO5JbWG.mjs.map +0 -1
- package/dist/chunks/hi-Bu799xIO.mjs +0 -2
- package/dist/chunks/hi-Bu799xIO.mjs.map +0 -1
- package/dist/chunks/minimal-C07d5reO.mjs +0 -2
- package/dist/chunks/minimal-C07d5reO.mjs.map +0 -1
- package/dist/chunks/pt-DmN9u3NX.mjs +0 -2
- package/dist/chunks/pt-DmN9u3NX.mjs.map +0 -1
- package/dist/chunks/register-DMdtiQ_Z.mjs +0 -3
- package/dist/chunks/register-DMdtiQ_Z.mjs.map +0 -1
- package/dist/chunks/ru-BxySx7an.mjs +0 -2
- package/dist/chunks/ru-BxySx7an.mjs.map +0 -1
- package/dist/chunks/zh-DuucmOns.mjs +0 -2
- package/dist/chunks/zh-DuucmOns.mjs.map +0 -1
- package/dist/editor/styles/base.d.ts +0 -3
- package/dist/editor/styles/base.d.ts.map +0 -1
- package/dist/editor/styles/color-picker.d.ts +0 -3
- package/dist/editor/styles/color-picker.d.ts.map +0 -1
- package/dist/editor/styles/font-select.d.ts +0 -3
- package/dist/editor/styles/font-select.d.ts.map +0 -1
- package/dist/editor/styles/font-size-select.d.ts +0 -3
- package/dist/editor/styles/font-size-select.d.ts.map +0 -1
- package/dist/editor/styles/heading-select.d.ts +0 -3
- package/dist/editor/styles/heading-select.d.ts.map +0 -1
- package/dist/editor/styles/image.d.ts +0 -3
- package/dist/editor/styles/image.d.ts.map +0 -1
- package/dist/editor/styles/reduced-motion.d.ts +0 -3
- package/dist/editor/styles/reduced-motion.d.ts.map +0 -1
- package/dist/editor/styles/table.d.ts +0 -3
- package/dist/editor/styles/table.d.ts.map +0 -1
- package/dist/editor/styles/toolbar.d.ts +0 -3
- package/dist/editor/styles/toolbar.d.ts.map +0 -1
- package/dist/plugins/blockquote/BlockquoteStyles.d.ts +0 -3
- package/dist/plugins/blockquote/BlockquoteStyles.d.ts.map +0 -1
- package/dist/plugins/formula/FormulaStyles.d.ts +0 -12
- package/dist/plugins/formula/FormulaStyles.d.ts.map +0 -1
- package/dist/plugins/image/ImagePopupStyles.d.ts +0 -3
- package/dist/plugins/image/ImagePopupStyles.d.ts.map +0 -1
- package/dist/plugins/video/VideoPopupStyles.d.ts +0 -3
- package/dist/plugins/video/VideoPopupStyles.d.ts.map +0 -1
- package/dist/plugins/video/VideoStyles.d.ts +0 -3
- package/dist/plugins/video/VideoStyles.d.ts.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Document-ssR6hBzG.mjs","names":["normalizeHTMLId","textSegment","text","marks","kind","inlineSegment","node","getBlockContentSegmentsInRange","block","from","to","segments","forEachInlineChildInRange","onText","push","onInline","visitor","child","childFrom","childEnd","walkInlineContent","getInlineChildren","isInlineNode","sliceFrom","Math","max","sliceTo","min","length","slice","isTextNode","type","inlineType","isBlockNode","id","Array","isArray","children","isLeafBlock","every","c","getTextChildren","filter","getBlockChildren","generateBlockId","crypto","randomUUID","createDocument","createBlockNode","attrs","htmlId","normalizedHTMLId","cloneBlockAttrs","createTextNode","cloneMarks","createInlineNode","createEmptyParagraph","VERIFIED_DOCUMENTS","WeakSet","VERIFIED_BLOCKS","VERIFIED_BLOCK_ATTRS","VERIFIED_MARKS","VERIFIED_MARK_LISTS","VERIFIED_INLINE_NODES","VERIFIED_TEXT_NODES","VERIFIED_SEGMENT_LISTS","cloneDocument","doc","map","cloneBlockNode","cloneChildNode","cloneMark","mark","cloneInlineNode","cloneContentSegment","segment","cloneContentSegments","freezeDocument","has","freezeBlockNode","Object","isFrozen","freeze","add","copy","key","value","entries","freezeBlockAttrs","freezeInlineChild","values","freezeMark","freezeMarks","freezeInlineNode","freezeContentSegments","getBlockText","inlineChildren","getBlockLength","len","getBlockMarksAtOffset","offset","i","getCursorMarks","isMarkInclusive","after","getMarksAfterOffset","some","a","marksEqual","b","aAttrs","bAttrs","aKeys","keys","bKeys","blockAttrValuesEqual","index","blockAttrsEqual","markSetsEqual","markA","markB","hasMark","markType","m","addMarkToSet","removeMarkFromSet","normalizeInlineContent","nodes","n","result","prev","normalizeTextNodes","cleaned","next","contentSegmentToInlineNode","segmentsToInlineChildren","pos","width","blockOffsetToTextOffset","blockOffset","textPos","getContentAtOffset","localOffset","char"],"sources":["../../src/model/Document.ts"],"sourcesContent":["/**\n * Core document model types for the Notectl editor.\n * All types are deeply readonly — mutations create new instances.\n */\n\nimport { normalizeHTMLId } from './HTMLUtils.js';\nimport type { BlockId, InlineTypeName, MarkTypeName, NodeTypeName } from './TypeBrands.js';\n\n// --- Mark Types ---\n\nexport interface Mark {\n\treadonly type: MarkTypeName;\n\treadonly attrs?: Readonly<Record<string, string | number | boolean>>;\n}\n\nexport interface BoldMark extends Mark {\n\treadonly type: MarkTypeName & 'bold';\n}\n\nexport interface ItalicMark extends Mark {\n\treadonly type: MarkTypeName & 'italic';\n}\n\nexport interface UnderlineMark extends Mark {\n\treadonly type: MarkTypeName & 'underline';\n}\n\n// --- Node Types ---\n\n/** JSON-compatible primitive stored in a block attribute. */\nexport type BlockAttrPrimitive = string | number | boolean | null;\n\n/** Scalar member permitted inside a structured block-attribute array. */\nexport type BlockAttrArrayValue = BlockAttrPrimitive;\n\n/**\n * Immutable JSON-compatible block attribute value.\n *\n * Marks and inline nodes intentionally retain their scalar-only attributes.\n * Block nodes may additionally own structured state (for example a table's\n * logical column-width vector) without encoding it in delimiter strings.\n */\nexport type BlockAttrValue = Exclude<BlockAttrPrimitive, null> | readonly BlockAttrArrayValue[];\n\nexport interface BlockAttrs {\n\treadonly [key: string]: BlockAttrValue;\n}\n\nexport interface TextNode {\n\treadonly type: 'text';\n\treadonly text: string;\n\treadonly marks: readonly Mark[];\n}\n\n/** Atomic inline element (width 1 in offset space). */\nexport interface InlineNode {\n\treadonly type: 'inline';\n\treadonly inlineType: InlineTypeName;\n\treadonly attrs: Readonly<Record<string, string | number | boolean>>;\n\t/**\n\t * Marks applied to this atomic node (e.g. a `link` on an inline image). Inline\n\t * nodes carry marks just like text nodes do, so a linked inline image survives\n\t * import, export, and rendering without the link being dropped.\n\t */\n\treadonly marks: readonly Mark[];\n}\n\n/** A child of a BlockNode: text, inline element, or nested block. */\nexport type ChildNode = TextNode | InlineNode | BlockNode;\n\nexport interface BlockNode {\n\t/** Internal editor identity, serialized to HTML as `data-block-id`. */\n\treadonly id: BlockId;\n\t/** Optional document-local HTML target, serialized to the block element's `id` attribute. */\n\treadonly htmlId?: string;\n\treadonly type: NodeTypeName;\n\treadonly attrs?: BlockAttrs;\n\treadonly children: readonly ChildNode[];\n}\n\nexport interface Document {\n\treadonly children: readonly BlockNode[];\n}\n\n// --- Text Segment (for mark-preserving undo) ---\n\nexport interface TextSegment {\n\treadonly text: string;\n\treadonly marks: readonly Mark[];\n}\n\n/** A content segment: either text (with marks) or an inline node. */\nexport type ContentSegment =\n\t| { readonly kind: 'text'; readonly text: string; readonly marks: readonly Mark[] }\n\t| { readonly kind: 'inline'; readonly node: InlineNode };\n\n/** Creates a text {@link ContentSegment}. */\nexport function textSegment(text: string, marks: readonly Mark[] = []): ContentSegment {\n\treturn { kind: 'text', text, marks };\n}\n\n/** Creates an inline {@link ContentSegment} wrapping an {@link InlineNode}. */\nexport function inlineSegment(node: InlineNode): ContentSegment {\n\treturn { kind: 'inline', node };\n}\n\n/** Returns content segments (text and inline) for a block range. */\nexport function getBlockContentSegmentsInRange(\n\tblock: BlockNode,\n\tfrom: number,\n\tto: number,\n): readonly ContentSegment[] {\n\tconst segments: ContentSegment[] = [];\n\tforEachInlineChildInRange(block, from, to, {\n\t\tonText(text: string, marks: readonly Mark[]): void {\n\t\t\tsegments.push({ kind: 'text', text, marks });\n\t\t},\n\t\tonInline(node: InlineNode): void {\n\t\t\tsegments.push({ kind: 'inline', node });\n\t\t},\n\t});\n\treturn segments;\n}\n\n/** Visitor callbacks invoked by {@link forEachInlineChildInRange} for each in-range child. */\nexport interface BlockRangeVisitor {\n\t/** Called with the clipped text and its marks for each text node overlapping the range. */\n\treadonly onText: (text: string, marks: readonly Mark[]) => void;\n\t/** Called for each inline node falling within the range. */\n\treadonly onInline?: (node: InlineNode) => void;\n}\n\n/**\n * Walks the inline children of `block` overlapping `[from, to)` and invokes the\n * matching visitor callback for each. Text nodes are clipped to the range before\n * `onText` fires; empty slices are skipped. This is the single read-only walker\n * for range-based inline serialization (segments, HTML, clipboard).\n */\nexport function forEachInlineChildInRange(\n\tblock: BlockNode,\n\tfrom: number,\n\tto: number,\n\tvisitor: BlockRangeVisitor,\n): void {\n\tfor (const { child, from: childFrom, to: childEnd } of walkInlineContent(\n\t\tgetInlineChildren(block),\n\t)) {\n\t\tif (childEnd <= from || childFrom >= to) continue;\n\n\t\tif (isInlineNode(child)) {\n\t\t\tvisitor.onInline?.(child);\n\t\t} else {\n\t\t\tconst sliceFrom: number = Math.max(0, from - childFrom);\n\t\t\tconst sliceTo: number = Math.min(child.text.length, to - childFrom);\n\t\t\tconst text: string = child.text.slice(sliceFrom, sliceTo);\n\t\t\tif (text.length > 0) {\n\t\t\t\tvisitor.onText(text, child.marks);\n\t\t\t}\n\t\t}\n\t}\n}\n\n// --- Type Guards ---\n\n/** Checks whether a value is a {@link TextNode}. */\nexport function isTextNode(node: unknown): node is TextNode {\n\treturn (\n\t\ttypeof node === 'object' &&\n\t\tnode !== null &&\n\t\t(node as TextNode).type === 'text' &&\n\t\ttypeof (node as TextNode).text === 'string'\n\t);\n}\n\n/** Checks whether a value is an {@link InlineNode}. */\nexport function isInlineNode(node: unknown): node is InlineNode {\n\treturn (\n\t\ttypeof node === 'object' &&\n\t\tnode !== null &&\n\t\t(node as InlineNode).type === 'inline' &&\n\t\ttypeof (node as InlineNode).inlineType === 'string'\n\t);\n}\n\n/** Checks whether a value is a {@link BlockNode}. */\nexport function isBlockNode(node: unknown): node is BlockNode {\n\treturn (\n\t\ttypeof node === 'object' &&\n\t\tnode !== null &&\n\t\ttypeof (node as BlockNode).id === 'string' &&\n\t\ttypeof (node as BlockNode).type === 'string' &&\n\t\t(node as BlockNode).type !== ('text' as string) &&\n\t\t(node as BlockNode).type !== ('inline' as string) &&\n\t\tArray.isArray((node as BlockNode).children)\n\t);\n}\n\n// --- Child Node Helpers ---\n\n/** Returns true if a block has only inline content (TextNodes and InlineNodes). */\nexport function isLeafBlock(node: BlockNode): boolean {\n\treturn node.children.every((c) => isTextNode(c) || isInlineNode(c));\n}\n\n/** Returns only the TextNode children of a block. */\nexport function getTextChildren(node: BlockNode): readonly TextNode[] {\n\treturn node.children.filter((c): c is TextNode => isTextNode(c));\n}\n\n/** Returns the inline content children (TextNode | InlineNode) of a block. */\nexport function getInlineChildren(node: BlockNode): readonly (TextNode | InlineNode)[] {\n\treturn node.children.filter((c): c is TextNode | InlineNode => isTextNode(c) || isInlineNode(c));\n}\n\n/** Returns only the BlockNode children of a block. */\nexport function getBlockChildren(node: BlockNode): readonly BlockNode[] {\n\treturn node.children.filter((c): c is BlockNode => isBlockNode(c));\n}\n\n// --- Factory Functions ---\n\n/** Generates a unique block ID using crypto.randomUUID(). */\nexport function generateBlockId(): BlockId {\n\treturn `block-${crypto.randomUUID()}` as BlockId;\n}\n\n/** Creates a new empty {@link Document} with a single empty paragraph. */\nexport function createDocument(children?: readonly BlockNode[]): Document {\n\treturn {\n\t\tchildren: children ? [...children] : [createBlockNode('paragraph' as NodeTypeName)],\n\t};\n}\n\n/** Creates a new {@link BlockNode}. */\nexport function createBlockNode(\n\ttype: NodeTypeName,\n\tchildren?: readonly ChildNode[],\n\tid?: BlockId,\n\tattrs?: BlockAttrs,\n\thtmlId?: string,\n): BlockNode {\n\tconst normalizedHTMLId: string | undefined = normalizeHTMLId(htmlId);\n\treturn {\n\t\tid: id ?? generateBlockId(),\n\t\t...(normalizedHTMLId ? { htmlId: normalizedHTMLId } : {}),\n\t\ttype,\n\t\t...(attrs ? { attrs: cloneBlockAttrs(attrs) } : {}),\n\t\tchildren: children ? [...children] : [createTextNode('')],\n\t};\n}\n\n/** Creates a new {@link TextNode}. */\nexport function createTextNode(text: string, marks?: readonly Mark[]): TextNode {\n\treturn {\n\t\ttype: 'text',\n\t\ttext,\n\t\tmarks: cloneMarks(marks ?? []),\n\t};\n}\n\n/** Creates a new {@link InlineNode}. */\nexport function createInlineNode(\n\tinlineType: InlineTypeName,\n\tattrs?: Readonly<Record<string, string | number | boolean>>,\n\tmarks?: readonly Mark[],\n): InlineNode {\n\treturn {\n\t\ttype: 'inline',\n\t\tinlineType,\n\t\tattrs: attrs ? { ...attrs } : {},\n\t\tmarks: cloneMarks(marks ?? []),\n\t};\n}\n\n/** Creates an empty paragraph block node with the given ID. */\nexport function createEmptyParagraph(id?: BlockId): BlockNode {\n\treturn createBlockNode('paragraph' as NodeTypeName, [createTextNode('')], id);\n}\n\n// --- Snapshot Ownership -------------------------------------------------\n\n// `Object.isFrozen` is shallow and therefore cannot prove our deep-immutability\n// invariant for external values. These private brands are added only after a\n// complete traversal, allowing persistent state to skip verified shared\n// subtrees without trusting caller-applied shallow freezes.\nconst VERIFIED_DOCUMENTS = new WeakSet<Document>();\nconst VERIFIED_BLOCKS = new WeakSet<BlockNode>();\nconst VERIFIED_BLOCK_ATTRS = new WeakSet<BlockAttrs>();\nconst VERIFIED_MARKS = new WeakSet<Mark>();\nconst VERIFIED_MARK_LISTS = new WeakSet<readonly Mark[]>();\nconst VERIFIED_INLINE_NODES = new WeakSet<InlineNode>();\nconst VERIFIED_TEXT_NODES = new WeakSet<TextNode>();\nconst VERIFIED_SEGMENT_LISTS = new WeakSet<readonly ContentSegment[]>();\n\n/**\n * Creates a fully detached document snapshot.\n *\n * Public JSON boundaries use this instead of exposing the structurally shared\n * objects owned by an {@link EditorState}. Besides child arrays, attribute\n * records, structured block attributes, marks, and mark attributes are copied.\n */\nexport function cloneDocument(doc: Document): Document {\n\treturn { ...doc, children: doc.children.map(cloneBlockNode) };\n}\n\n/** Creates a fully detached block snapshot, preserving its stable block ID. */\nexport function cloneBlockNode(block: BlockNode): BlockNode {\n\tconst attrs: BlockAttrs | undefined = block.attrs ? cloneBlockAttrs(block.attrs) : undefined;\n\treturn {\n\t\t...block,\n\t\t...(attrs ? { attrs } : {}),\n\t\tchildren: block.children.map(cloneChildNode),\n\t};\n}\n\n/** Creates a detached mark set, including each mark's attribute record. */\nexport function cloneMarks(marks: readonly Mark[]): Mark[] {\n\treturn marks.map(cloneMark);\n}\n\n/** Creates a detached mark, including its attribute record. */\nexport function cloneMark(mark: Mark): Mark {\n\treturn {\n\t\t...mark,\n\t\t...(mark.attrs ? { attrs: { ...mark.attrs } } : {}),\n\t};\n}\n\n/** Creates a detached inline node, including attrs, marks, and mark attrs. */\nexport function cloneInlineNode(node: InlineNode): InlineNode {\n\treturn {\n\t\t...node,\n\t\tattrs: { ...node.attrs },\n\t\tmarks: cloneMarks(node.marks),\n\t};\n}\n\n/** Creates a detached content-segment payload for transaction/history ownership. */\nexport function cloneContentSegment(segment: ContentSegment): ContentSegment {\n\treturn segment.kind === 'text'\n\t\t? { ...segment, marks: cloneMarks(segment.marks) }\n\t\t: { ...segment, node: cloneInlineNode(segment.node) };\n}\n\n/** Creates a detached list of content-segment payloads. */\nexport function cloneContentSegments(segments: readonly ContentSegment[]): ContentSegment[] {\n\treturn segments.map(cloneContentSegment);\n}\n\n/**\n * Freezes a document and every mutable collection reachable from it.\n *\n * Already-frozen nodes are skipped. This keeps transaction application\n * proportional to the changed branch because unchanged subtrees are\n * structurally shared between states.\n */\nexport function freezeDocument(doc: Document): Document {\n\tif (VERIFIED_DOCUMENTS.has(doc)) return doc;\n\tfor (const block of doc.children) freezeBlockNode(block);\n\tif (!Object.isFrozen(doc.children)) Object.freeze(doc.children);\n\tif (!Object.isFrozen(doc)) Object.freeze(doc);\n\tVERIFIED_DOCUMENTS.add(doc);\n\treturn doc;\n}\n\nfunction cloneChildNode(child: ChildNode): ChildNode {\n\tif (isTextNode(child)) {\n\t\tconst marks: readonly Mark[] | undefined = Array.isArray(child.marks)\n\t\t\t? cloneMarks(child.marks)\n\t\t\t: undefined;\n\t\treturn {\n\t\t\t...child,\n\t\t\t...(marks ? { marks } : {}),\n\t\t};\n\t}\n\tif (isInlineNode(child)) {\n\t\treturn cloneInlineNode(child);\n\t}\n\treturn cloneBlockNode(child);\n}\n\n/** Creates a detached block-attribute record, including structured array values. */\nexport function cloneBlockAttrs(attrs: BlockAttrs): BlockAttrs {\n\tconst copy: Record<string, BlockAttrValue> = {};\n\tfor (const [key, value] of Object.entries(attrs)) {\n\t\tcopy[key] = Array.isArray(value) ? [...value] : value;\n\t}\n\treturn copy;\n}\n\n/** Deep-freezes one detached block snapshot in place. */\nexport function freezeBlockNode(block: BlockNode): void {\n\tif (VERIFIED_BLOCKS.has(block)) return;\n\tif (block.attrs) freezeBlockAttrs(block.attrs);\n\tfor (const child of block.children) {\n\t\tif (isTextNode(child) || isInlineNode(child)) {\n\t\t\tfreezeInlineChild(child);\n\t\t} else {\n\t\t\tfreezeBlockNode(child);\n\t\t}\n\t}\n\tif (!Object.isFrozen(block.children)) Object.freeze(block.children);\n\tif (!Object.isFrozen(block)) Object.freeze(block);\n\tVERIFIED_BLOCKS.add(block);\n}\n\n/** Deep-freezes a block-attribute record in place. */\nexport function freezeBlockAttrs(attrs: BlockAttrs): void {\n\tif (VERIFIED_BLOCK_ATTRS.has(attrs)) return;\n\tfor (const value of Object.values(attrs)) {\n\t\tif (Array.isArray(value) && !Object.isFrozen(value)) Object.freeze(value);\n\t}\n\tif (!Object.isFrozen(attrs)) Object.freeze(attrs);\n\tVERIFIED_BLOCK_ATTRS.add(attrs);\n}\n\n/** Deep-freezes a mark and its attrs in place. */\nexport function freezeMark(mark: Mark): void {\n\tif (VERIFIED_MARKS.has(mark)) return;\n\tif (mark.attrs && !Object.isFrozen(mark.attrs)) Object.freeze(mark.attrs);\n\tif (!Object.isFrozen(mark)) Object.freeze(mark);\n\tVERIFIED_MARKS.add(mark);\n}\n\n/** Deep-freezes a mark list in place. */\nexport function freezeMarks(marks: readonly Mark[]): void {\n\tif (VERIFIED_MARK_LISTS.has(marks)) return;\n\tfor (const mark of marks) freezeMark(mark);\n\tif (!Object.isFrozen(marks)) Object.freeze(marks);\n\tVERIFIED_MARK_LISTS.add(marks);\n}\n\n/** Deep-freezes an inline node and all of its payload records in place. */\nexport function freezeInlineNode(node: InlineNode): void {\n\tif (VERIFIED_INLINE_NODES.has(node)) return;\n\tif (!Object.isFrozen(node.attrs)) Object.freeze(node.attrs);\n\tfreezeMarks(node.marks);\n\tif (!Object.isFrozen(node)) Object.freeze(node);\n\tVERIFIED_INLINE_NODES.add(node);\n}\n\n/** Deep-freezes transaction/history content-segment payloads in place. */\nexport function freezeContentSegments(segments: readonly ContentSegment[]): void {\n\tif (VERIFIED_SEGMENT_LISTS.has(segments)) return;\n\tfor (const segment of segments) {\n\t\tif (segment.kind === 'text') freezeMarks(segment.marks);\n\t\telse freezeInlineNode(segment.node);\n\t\tif (!Object.isFrozen(segment)) Object.freeze(segment);\n\t}\n\tif (!Object.isFrozen(segments)) Object.freeze(segments);\n\tVERIFIED_SEGMENT_LISTS.add(segments);\n}\n\nfunction freezeInlineChild(child: TextNode | InlineNode): void {\n\tif (isInlineNode(child)) {\n\t\tfreezeInlineNode(child);\n\t\treturn;\n\t}\n\tif (VERIFIED_TEXT_NODES.has(child)) return;\n\tfreezeMarks(child.marks);\n\tif (!Object.isFrozen(child)) Object.freeze(child);\n\tVERIFIED_TEXT_NODES.add(child);\n}\n\n// --- Utility Functions ---\n\n/** Extracts plain text from a block (InlineNodes are skipped). */\nexport function getBlockText(block: BlockNode): string {\n\tconst inlineChildren: readonly (TextNode | InlineNode)[] = getInlineChildren(block);\n\tlet text = '';\n\tfor (const child of inlineChildren) {\n\t\tif (isTextNode(child)) {\n\t\t\ttext += child.text;\n\t\t}\n\t}\n\treturn text;\n}\n\n/** Returns the length of a block's inline content (InlineNodes count as 1). */\nexport function getBlockLength(block: BlockNode): number {\n\tlet len = 0;\n\tfor (const { to } of walkInlineContent(getInlineChildren(block))) {\n\t\tlen = to;\n\t}\n\treturn len;\n}\n\n/** Returns the marks active at the given offset (empty for InlineNode offsets). */\nexport function getBlockMarksAtOffset(block: BlockNode, offset: number): readonly Mark[] {\n\tconst inlineChildren: readonly (TextNode | InlineNode)[] = getInlineChildren(block);\n\n\tfor (const { child, from, to } of walkInlineContent(inlineChildren)) {\n\t\tif (isInlineNode(child)) {\n\t\t\tif (offset === from) return [];\n\t\t\tcontinue;\n\t\t}\n\t\tif (offset >= from && offset < to) {\n\t\t\treturn child.marks;\n\t\t}\n\t\t// Empty text node (from === to): match exactly at its position.\n\t\tif (offset === from && child.text.length === 0) {\n\t\t\treturn child.marks;\n\t\t}\n\t}\n\n\t// Fall back to last text child's marks\n\tfor (let i: number = inlineChildren.length - 1; i >= 0; i--) {\n\t\tconst child: TextNode | InlineNode | undefined = inlineChildren[i];\n\t\tif (child && isTextNode(child)) {\n\t\t\treturn child.marks;\n\t\t}\n\t}\n\treturn [];\n}\n\n/** Returns the marks of the text content immediately to the right of `offset`. */\nfunction getMarksAfterOffset(block: BlockNode, offset: number): readonly Mark[] {\n\tfor (const { child, from, to } of walkInlineContent(getInlineChildren(block))) {\n\t\tif (isInlineNode(child)) {\n\t\t\tif (offset === from) return [];\n\t\t\tcontinue;\n\t\t}\n\t\tif (offset >= from && offset < to) return child.marks;\n\t}\n\treturn [];\n}\n\n/**\n * Returns the marks that text typed at a collapsed cursor should carry.\n *\n * Marks are derived from the content around `offset` (via\n * {@link getBlockMarksAtOffset}). A mark whose spec is non-inclusive\n * (`isMarkInclusive` returns `false`) is only kept when it also covers the\n * content to the right of the cursor, so it never bleeds past its right\n * boundary onto newly typed text. Inclusive marks (the default) are unaffected.\n */\nexport function getCursorMarks(\n\tblock: BlockNode,\n\toffset: number,\n\tisMarkInclusive: (type: MarkTypeName) => boolean,\n): readonly Mark[] {\n\tconst marks: readonly Mark[] = getBlockMarksAtOffset(block, offset);\n\tif (marks.length === 0) return marks;\n\n\tconst after: readonly Mark[] = getMarksAfterOffset(block, offset);\n\treturn marks.filter(\n\t\t(mark) => isMarkInclusive(mark.type) || after.some((a) => marksEqual(a, mark)),\n\t);\n}\n\n/** Checks whether two marks are equal by type and attrs. */\nexport function marksEqual(a: Mark, b: Mark): boolean {\n\tif (a.type !== b.type) return false;\n\tconst aAttrs = a.attrs;\n\tconst bAttrs = b.attrs;\n\tif (!aAttrs && !bAttrs) return true;\n\tif (!aAttrs || !bAttrs) return false;\n\tconst aKeys = Object.keys(aAttrs);\n\tconst bKeys = Object.keys(bAttrs);\n\tif (aKeys.length !== bKeys.length) return false;\n\treturn aKeys.every((key) => aAttrs[key] === bAttrs[key]);\n}\n\n/** Deep equality for immutable, JSON-compatible block attribute values. */\nexport function blockAttrValuesEqual(\n\ta: BlockAttrValue | undefined,\n\tb: BlockAttrValue | undefined,\n): boolean {\n\tif (a === b) return true;\n\tif (a === undefined || b === undefined || a === null || b === null) return false;\n\tif (Array.isArray(a) || Array.isArray(b)) {\n\t\tif (!Array.isArray(a) || !Array.isArray(b) || a.length !== b.length) return false;\n\t\treturn a.every((value, index) => value === b[index]);\n\t}\n\treturn false;\n}\n\n/** Deep equality for block attribute records. */\nexport function blockAttrsEqual(a: BlockAttrs | undefined, b: BlockAttrs | undefined): boolean {\n\tif (a === b) return true;\n\tif (!a || !b) return false;\n\tconst aKeys: readonly string[] = Object.keys(a);\n\tconst bKeys: readonly string[] = Object.keys(b);\n\tif (aKeys.length !== bKeys.length) return false;\n\treturn aKeys.every((key) => blockAttrValuesEqual(a[key], b[key]));\n}\n\n/** Checks whether two mark arrays contain the same marks (order-independent). */\nexport function markSetsEqual(a: readonly Mark[], b: readonly Mark[]): boolean {\n\tif (a.length !== b.length) return false;\n\treturn a.every((markA) => b.some((markB) => marksEqual(markA, markB)));\n}\n\n/** Returns true if the mark set contains a mark of the given type. */\nexport function hasMark(marks: readonly Mark[], markType: MarkTypeName): boolean {\n\treturn marks.some((m) => m.type === markType);\n}\n\n/** Adds a mark to a mark set (no duplicates). */\nexport function addMarkToSet(marks: readonly Mark[], mark: Mark): readonly Mark[] {\n\tif (hasMark(marks, mark.type)) return marks;\n\treturn [...marks, mark];\n}\n\n/** Removes a mark type from a mark set. */\nexport function removeMarkFromSet(marks: readonly Mark[], markType: MarkTypeName): readonly Mark[] {\n\treturn marks.filter((m) => m.type !== markType);\n}\n\n/**\n * Normalizes text nodes within a block: merges adjacent nodes with identical marks,\n * removes empty text nodes (keeping at least one).\n */\nexport function normalizeTextNodes(nodes: readonly TextNode[]): readonly TextNode[] {\n\tif (nodes.length === 0) return [createTextNode('')];\n\n\tconst result: TextNode[] = [];\n\tfor (const node of nodes) {\n\t\tconst prev: TextNode | undefined = result[result.length - 1];\n\t\tif (prev && markSetsEqual(prev.marks, node.marks)) {\n\t\t\tresult[result.length - 1] = createTextNode(prev.text + node.text, prev.marks);\n\t\t} else if (node.text.length > 0 || result.length === 0) {\n\t\t\tresult.push(node);\n\t\t}\n\t}\n\n\treturn result.length === 0 ? [createTextNode('')] : result;\n}\n\n/**\n * Normalizes mixed inline content: merges adjacent TextNodes with same marks,\n * removes empty TextNodes adjacent to InlineNodes, preserves InlineNodes as-is.\n * Guarantees at least one TextNode exists if all text is empty.\n */\nexport function normalizeInlineContent(\n\tnodes: readonly (TextNode | InlineNode)[],\n): readonly (TextNode | InlineNode)[] {\n\tif (nodes.length === 0) return [createTextNode('')];\n\n\t// Fast path: no InlineNodes, delegate to normalizeTextNodes\n\tif (nodes.every((n): n is TextNode => isTextNode(n))) {\n\t\treturn normalizeTextNodes(nodes);\n\t}\n\n\tconst result: (TextNode | InlineNode)[] = [];\n\n\tfor (const node of nodes) {\n\t\tif (isInlineNode(node)) {\n\t\t\tresult.push(node);\n\t\t\tcontinue;\n\t\t}\n\t\t// TextNode: try to merge with previous TextNode\n\t\tconst prev: TextNode | InlineNode | undefined = result[result.length - 1];\n\t\tif (prev && isTextNode(prev) && markSetsEqual(prev.marks, node.marks)) {\n\t\t\tresult[result.length - 1] = createTextNode(prev.text + node.text, prev.marks);\n\t\t} else if (node.text.length > 0 || result.length === 0) {\n\t\t\tresult.push(node);\n\t\t}\n\t}\n\n\t// Remove empty TextNodes that are adjacent to InlineNodes\n\tconst cleaned: (TextNode | InlineNode)[] = result.filter((node, i) => {\n\t\tif (isInlineNode(node)) return true;\n\t\tif (node.text.length > 0) return true;\n\t\t// Keep if it's the only node\n\t\tif (result.length === 1) return true;\n\t\t// Remove empty TextNode if adjacent to InlineNode\n\t\tconst prev: TextNode | InlineNode | undefined = result[i - 1];\n\t\tconst next: TextNode | InlineNode | undefined = result[i + 1];\n\t\tif ((prev && isInlineNode(prev)) || (next && isInlineNode(next))) {\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t});\n\n\t// Ensure at least one TextNode exists\n\tif (cleaned.length === 0) return [createTextNode('')];\n\tif (!cleaned.some((n) => isTextNode(n))) {\n\t\treturn [createTextNode(''), ...cleaned];\n\t}\n\n\treturn cleaned;\n}\n\n/** Materializes a single {@link ContentSegment} into its inline child node. */\nexport function contentSegmentToInlineNode(segment: ContentSegment): TextNode | InlineNode {\n\treturn segment.kind === 'inline' ? segment.node : createTextNode(segment.text, segment.marks);\n}\n\n/**\n * Materializes content segments (text + inline) into normalized inline children.\n * Inverse of {@link getBlockContentSegmentsInRange}: used when turning a range of\n * segments back into a block's children (paste insertion, slice extraction).\n */\nexport function segmentsToInlineChildren(\n\tsegments: readonly ContentSegment[],\n): readonly (TextNode | InlineNode)[] {\n\treturn normalizeInlineContent(segments.map(contentSegmentToInlineNode));\n}\n\n/** Yields each inline child with its offset range. InlineNodes have width 1. */\nexport function* walkInlineContent(children: readonly (TextNode | InlineNode)[]): Generator<{\n\treadonly child: TextNode | InlineNode;\n\treadonly from: number;\n\treadonly to: number;\n}> {\n\tlet pos = 0;\n\tfor (const child of children) {\n\t\tconst width: number = isInlineNode(child) ? 1 : child.text.length;\n\t\tyield { child, from: pos, to: pos + width };\n\t\tpos += width;\n\t}\n}\n\n/**\n * Converts a block-space offset to a text-space offset.\n *\n * Block-space counts InlineNodes as width 1, but `getBlockText()` skips them.\n * This function maps a block offset to the equivalent position in the\n * text-only string returned by `getBlockText()`.\n */\nexport function blockOffsetToTextOffset(block: BlockNode, blockOffset: number): number {\n\tlet textPos = 0;\n\n\tfor (const { child, from, to } of walkInlineContent(getInlineChildren(block))) {\n\t\tif (isInlineNode(child)) {\n\t\t\tif (from >= blockOffset) return textPos;\n\t\t} else {\n\t\t\tif (to >= blockOffset) return textPos + (blockOffset - from);\n\t\t\ttextPos += child.text.length;\n\t\t}\n\t}\n\n\treturn textPos;\n}\n\n/** Returns the content at a specific offset: text char, inline node, or null. */\nexport function getContentAtOffset(\n\tblock: BlockNode,\n\toffset: number,\n):\n\t| { readonly kind: 'text'; readonly char: string; readonly marks: readonly Mark[] }\n\t| { readonly kind: 'inline'; readonly node: InlineNode }\n\t| null {\n\tconst inlineChildren: readonly (TextNode | InlineNode)[] = getInlineChildren(block);\n\n\tfor (const { child, from } of walkInlineContent(inlineChildren)) {\n\t\tif (isInlineNode(child)) {\n\t\t\tif (offset === from) return { kind: 'inline', node: child };\n\t\t\tcontinue;\n\t\t}\n\t\tconst localOffset: number = offset - from;\n\t\tif (localOffset >= 0 && localOffset < child.text.length) {\n\t\t\treturn {\n\t\t\t\tkind: 'text',\n\t\t\t\tchar: child.text[localOffset] ?? '',\n\t\t\t\tmarks: child.marks,\n\t\t\t};\n\t\t}\n\t}\n\n\treturn null;\n}\n"],"mappings":"Y,iCAiGA,SAAgBC,EAAYC,EAAcC,EAAy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mjs";import{P as n,_ as o,g as r,m as s,p as a,z as i}from"./Document-ssR6hBzG.mjs";import{a as c,i as l,r as u}from"./TypeBrands-Ch9856Gb.mjs";import{n as f}from"./ContentModel-dkGOh3N7.mjs";import{C as d,S as p,T as h,c as g,f as m,g as y,h as N,n as T,o as E,r as A,s as b,t as L}from"./TableDimensions-BSEOEox2.mjs";import{n as k,t as w}from"./HTMLSanitization-Ce9dVT1q.mjs";var O=/* @__PURE__ */new Set(["p","div","ul","ol","table","blockquote"]);function D(t,e){const n=t.tagName.toLowerCase();for(const{rule:o,type:r}of e){if(o.tag!==n)continue;const e=o.getAttrs?.(t);if(!1!==e)return{type:r,...e?{attrs:e}:{}}}return null}function v(t,e,n){const o=t.tagName.toLowerCase(),r=[...e];for(const{rule:s,type:a}of n){if(s.tag!==o||r.some(t=>t.type===a))continue;const e=s.getAttrs?.(t);!1!==e&&r.push({type:l(a),...e&&Object.keys(e).length>0?{attrs:e}:{}})}return r}function C(t,e,n,o=O){return!D(t,n)&&(o.has(t.tagName.toLowerCase())||null!==D(t,e))}function _(t,e,n,o=O){return R(e,n,o)(t)}function R(t,e,n=O){const o=/* @__PURE__ */new WeakMap,r=s=>{const a=o.get(s);if(void 0!==a)return a;const i=!D(s,e)&&Array.from(s.children).some(o=>{const s=o;return C(s,t,e,n)||r(s)});return o.set(s,i),i};return r}var M=/[ \t\n\r\f]+/g,I=/* @__PURE__ */new Set(["P","DIV","H1","H2","H3","H4","H5","H6","BLOCKQUOTE","UL","OL","LI","TABLE","THEAD","TBODY","TFOOT","TR","TD","TH","HR","FIGURE","FIGCAPTION","SECTION","ARTICLE","HEADER","FOOTER","MAIN","ASIDE","NAV","DL","DT","DD"]),x=/* @__PURE__ */new Set(["PRE","TEXTAREA"]),S=/* @__PURE__ */new Set(["pre","pre-wrap","pre-line","break-spaces"]);function H(t){P(t)}function P(t){const e={lastTextNode:null,collapsePending:!0};for(const n of Array.from(t.childNodes))j(n,e);B(e.lastTextNode)}function j(t,e){if(t.nodeType===Node.TEXT_NODE)return void function(t,e){let n=t.data.replace(M," ");e.collapsePending&&n.startsWith(" ")&&(n=n.slice(1)),t.data=n,0!==n.length&&(e.collapsePending=n.endsWith(" "),e.lastTextNode=t)}(t,e);if(t.nodeType!==Node.ELEMENT_NODE)return;const n=t;if(function(t){if(x.has(t.tagName))return!0;const e=(t.style?.whiteSpace??"").toLowerCase();return S.has(e)}(n))W(e);else{if(function(t){return I.has(t.tagName)}(n))return W(e),void P(n);for(const t of Array.from(n.childNodes))j(t,e)}}function W(t){B(t.lastTextNode),t.lastTextNode=null,t.collapsePending=!0}function B(t){t?.data.endsWith(" ")&&(t.data=t.data.slice(0,-1))}function X(t,e){!function(t){for(const e of Array.from(t.querySelectorAll("[style]"))){const t=q(e);if(!t||t.length>0)continue;const n=e.getAttribute("style")??"";p(n).length>256||(t.cssText=n)}}(t),y(t,e,256)}function q(t){return t.style}function F(t,n,o){const r=n?n.getAllowedTags():["p","br","div","span"],a=n?n.getAllowedAttrs():["style","dir","id"];a.includes("data-block-id")||a.push("data-block-id"),o?.styleMap&&!a.includes("class")&&a.push("class");const i=document.createElement("template");i.innerHTML=k(t,{ALLOWED_TAGS:r,ALLOWED_ATTR:a,ALLOWED_URI_REGEXP:e,...w()},n);const c=i.content;X(c,N(n,o?.styleMap)),H(c);const l=function(t){const e=t?.getBlockParseRules()??[],n=t?.getInlineParseRules()??[],o=t?.getMarkParseRules()??[],r=/* @__PURE__ */new WeakMap,s=t=>{const e=r.get(t);if(e)return e;const n=t.parentElement,a=v(t,n?s(n):[],o);return r.set(t,a),a};return{registry:t,blockRules:e,inlineRules:n,markRules:o,adoptedIds:/* @__PURE__ */new Set,hasBlockDescendants:R(e,n),ancestorMarks:t=>t.parentElement?s(t.parentElement):[]}}(n),u=[];for(const e of Array.from(c.childNodes))U(e,u,l);if(0===u.length)return s();const d=s(u);return n?f(d,n):d}function U(t,e,n){const{adoptedIds:r,registry:s}=n;if(t.nodeType===Node.ELEMENT_NODE){const i=t,l=i.tagName.toLowerCase();if("ul"===l||"ol"===l){const t="ol"===l?"ordered":"bullet",o=i.getAttribute("dir");return void G(i,t,0,e,n,o&&m.has(o)?o:void 0)}if("table"===l)return void function(t,e,n){const{adoptedIds:o,registry:r}=n,s=[],i=function(t){const e=[];for(const n of Array.from(t.children)){const t=n.tagName.toLowerCase();if("col"===t){z(n,void 0,e);continue}if("colgroup"!==t)continue;const o=n,r=Q(o),s=Array.from(o.children).filter(t=>"col"===t.tagName.toLowerCase());if(0!==s.length)for(const n of s)z(n,r,e);else K(r,b(o.getAttribute("span")),e)}return E(e)}(t),l=!r||!!r.getNodeSpec("table_cell")?.attrs?.align,u=function(t){const e=[];for(const n of Array.from(t.children)){const t=n.tagName.toLowerCase();if("tr"===t)e.push(n);else if("thead"===t||"tbody"===t||"tfoot"===t)for(const o of Array.from(n.children))"tr"===o.tagName.toLowerCase()&&e.push(o)}return e}(t);for(const f of u){const t=[];for(const r of Array.from(f.children)){const e=r.tagName.toLowerCase();if("td"!==e&&"th"!==e)continue;const s=r,i=$(s,n),u={};Z(s,u),l&&ct(s,u);const f=a(c("table_cell"),i,d(s,o),Object.keys(u).length>0?u:void 0,it(s));t.push(f)}const e={};Y(f,e),s.push(a(c("table_row"),t,d(f,o),Object.keys(e).length>0?e:void 0,it(f)))}if(s.length>0){const n={};!function(t,e){const n=t.getAttribute("style")??"",o=J.exec(n);o?.[1]&&(e.borderColor="transparent"===o[1]?"none":o[1])}(t,n),i&&(n.columnWidthsPx=i),e.push(a(c("table"),s,d(t,o),Object.keys(n).length>0?n:void 0,it(t)))}}(i,e,n);if("blockquote"===l)return void function(t,e,n){const r=tt(t,n);0===r.length&&r.push(a(c("paragraph"),[o("")]));const s={};ct(t,s),at(t,s),e.push(a(c("blockquote"),r,d(t,n.adoptedIds),Object.keys(s).length>0?s:void 0,it(t)))}(i,e,n);const u=D(i,n.blockRules);if("paragraph"===(u?.type??"paragraph")&&n.hasBlockDescendants(i))return void function(t,e,n){const o={};ct(t,o),at(t,o);const r=tt(t,n);for(const s of r)e.push(nt(s,o,n.registry))}(i,e,n);const f=u?s?.getNodeSpec(u.type):void 0,p=f?.isVoid?[o("")]:ot(i,n),h={...u?.attrs};u&&!f?.attrs?.align||ct(i,h),u&&!f?.attrs?.dir||at(i,h),e.push(a(c(u?.type??"paragraph"),p,d(i,r),Object.keys(h).length>0?h:void 0,it(i)))}else t.nodeType===Node.TEXT_NODE&&t.textContent?.trim()&&e.push(a(c("paragraph"),[o(t.textContent.trim())]))}function G(t,e,n,o,r,s){for(const a of Array.from(t.children)){const t=a.tagName.toLowerCase();if("li"===t){const t=a,i=t.querySelector(':scope > input[type="checkbox"]'),c={listType:null!==i?"checklist":e,indent:n,checked:i?.hasAttribute("checked")??!1},l=t.getAttribute("dir"),u=l&&m.has(l)?l:s;u&&(c.dir=u),o.push(V(t,c,i,r));for(const e of Array.from(t.children)){const t=e.tagName.toLowerCase();if("ul"===t||"ol"===t){const s="ol"===t?"ordered":"bullet",a=e.getAttribute("dir");G(e,s,n+1,o,r,a&&m.has(a)?a:u)}}}else if("ul"===t||"ol"===t){const e="ol"===t?"ordered":"bullet",i=a.getAttribute("dir");G(a,e,n+1,o,r,i&&m.has(i)?i:s)}}}function V(t,e,r,s){const{adoptedIds:i}=s,l=it(t),u=t=>{if(t.nodeType!==Node.ELEMENT_NODE)return!1;const e=t.tagName.toLowerCase();return"ul"===e||"ol"===e};if(!Array.from(t.childNodes).some(t=>!u(t)&&et(t,s))){const n=ot(t,s,!0);return a(c("list_item"),n,d(t,i),e,l)}const f=tt(t,s,t=>u(t)||t===r),p=1===f.length?f[0]:void 0;return!p||"paragraph"!==p.type||p.attrs||p.htmlId?0===f.length?a(c("list_item"),[o("")],d(t,i),e,l):a(c("list_item"),f,d(t,i),e,l):a(c("list_item"),n(p),d(t,i),e,l)}function z(t,e,n){K(Q(t)??e,b(t.getAttribute("span")),n)}function K(t,e,n){const o=L-n.length,r=Math.min(e,Math.max(0,o));for(let s=0;s<r;s++)n.push(t??null)}function Q(t){return g(t,T,["width"],"width")}function Y(t,e){const n=g(t,A,["min-height","height"],"height");void 0!==n&&(e.minHeightPx=n)}var J=/--ntbl-bc:\s*(#[0-9a-fA-F]{3,8}|transparent)/;function Z(t,e){const n=t.getAttribute("colspan");if(n){const t=b(n);t>1&&(e.colspan=t)}const o=t.getAttribute("rowspan");if(o){const t=b(o);t>1&&(e.rowspan=t)}}function $(t,e){const n=tt(t,e);return 0===n.length&&n.push(a(c("paragraph"),[o("")])),n}function tt(t,e,n){const o=[];let r=[];const s=()=>{(function(t){for(const e of t){if(e.nodeType===Node.ELEMENT_NODE)return!0;if(e.nodeType===Node.TEXT_NODE&&e.textContent?.trim())return!0}return!1})(r)&&o.push(a(c("paragraph"),rt(r,e))),r=[]};for(const a of Array.from(t.childNodes))n?.(a)||(et(a,e)?(s(),U(a,o,e)):r.push(a));return s(),o}function et(t,e){if(t.nodeType!==Node.ELEMENT_NODE)return!1;const n=t;return C(n,e.blockRules,e.inlineRules)||e.hasBlockDescendants(n)}function nt(t,e,n){const o=n?.getNodeSpec(t.type),r={...t.attrs};let s=!1;for(const[a,i]of Object.entries(e))void 0===r[a]&&(n&&!o?.attrs?.[a]||(r[a]=i,s=!0));return s?a(t.type,t.children,t.id,r,t.htmlId):t}function ot(t,e,n){return rt([t],e,n)}function rt(t,e,n){const r=[];for(const o of t)st(o,e.ancestorMarks(o),r,e.markRules,e.inlineRules,n);return 1===r.length&&i(r[0])&&"hard_break"===r[0].inlineType?[o("")]:r.length>0?r:[o("")]}function st(t,e,n,s,a,i){if(t.nodeType===Node.TEXT_NODE){const r=t.textContent??"";return void(r&&n.push(o(r,[...e])))}if(t.nodeType!==Node.ELEMENT_NODE)return;const c=t,l=c.tagName.toLowerCase();if(i&&("ul"===l||"ol"===l))return;if(i&&"input"===l&&"checkbox"===c.getAttribute("type"))return;const f=D(c,a);if(f)return void n.push(r(u(f.type),f.attrs,e));const d=v(c,e,s);for(const o of Array.from(c.childNodes))st(o,d,n,s,a,i)}function at(t,e){const n=t.getAttribute("dir");if(n&&m.has(n))return void(e.dir=n);const o=t.style?.direction??"";o&&m.has(o)&&(e.dir=o)}function it(e){return t(e.getAttribute("id"))}function ct(t,e){const n=h(t);n&&(e.align=n)}export{_ as a,v as c,R as i,X as n,C as o,H as r,D as s,F as t};
|
|
2
|
+
//# sourceMappingURL=DocumentParser-C99N0MWF.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DocumentParser-C99N0MWF.mjs","names":["normalizeHTMLId","SAFE_URI_REGEXP","getInlineChildren","createTextNode","createInlineNode","createDocument","createBlockNode","isInlineNode","nodeType","markType","inlineType","hoistDisallowedBlocks","adoptBlockId","splitDeclarations","readElementAlignment","readTableDimensionPx","VALID_DIRECTIONS","rehydrateStyleClasses","createClassDeclarationResolver","TABLE_COLUMN_WIDTH_DATA_ATTRIBUTE","normalizeTableColumnWidthsPx","TABLE_ROW_MIN_HEIGHT_DATA_ATTRIBUTE","parseTableColumnSpan","MAX_SERIALIZED_TABLE_COLUMNS","sanitizeHTML","preserveHTMLIdSanitizeConfig","BLOCK_TAGS","Set","matchHTMLParseRule","element","rules","tag","tagName","toLowerCase","rule","type","attrs","getAttrs","parseHTMLMarks","el","currentMarks","markRules","marks","some","mark","push","Object","keys","length","isHTMLBlockElement","blockRules","inlineRules","blockTags","has","hasHTMLBlockDescendants","createBlockDescendantCheck","known","WeakMap","check","cached","get","result","Array","from","children","child","set","COLLAPSIBLE_WHITESPACE","FLOW_BLOCK_TAGS","PRESERVE_TAGS","PRESERVE_WHITESPACE_VALUES","normalizeHTMLWhitespace","root","normalizeContext","container","state","lastTextNode","collapsePending","childNodes","processNode","trimTrailingSpace","node","Node","TEXT_NODE","text","data","replace","startsWith","slice","endsWith","collapseTextNode","ELEMENT_NODE","whiteSpace","style","isPreserveElement","endInlineRun","isFlowBlockElement","rehydrateStyles","resolveClass","querySelectorAll","inlineStyleOf","getAttribute","cssText","restoreInlineStyles","parseHTMLToDocument","html","registry","options","allowedTags","getAllowedTags","allowedAttrs","getAllowedAttrs","includes","styleMap","template","document","createElement","innerHTML","ALLOWED_TAGS","ALLOWED_ATTR","ALLOWED_URI_REGEXP","content","session","getBlockParseRules","getInlineParseRules","getMarkParseRules","ownMarks","marksOf","parent","parentElement","adoptedIds","hasBlockDescendants","ancestorMarks","createHTMLParseSession","blocks","parseChildNode","doc","listType","listDir","parseListElement","tableEl","rows","columnWidthsPx","widths","appendColumnElementWidths","groupEl","groupWidth","readTableColumnWidthPx","columns","filter","column","appendRepeatedWidth","extractTableColumnWidthsPx","cellsAlign","getNodeSpec","align","rowElements","nested","collectTableRows","trEl","cells","cellChild","cellTag","cellEl","cellContent","parseTableCellContent","cellAttrs","extractCellSpanAttrs","extractAlignment","cellBlock","extractHTMLId","rowAttrs","extractTableRowMinHeight","tableAttrs","match","BORDER_COLOR_RE","exec","borderColor","extractTableBorderColor","parseTableElement","innerBlocks","parseBlockContainerChildren","extractDirection","parseBlockquoteElement","inherited","block","inheritBlockAttrs","parseWrapperElement","spec","isVoid","parseElementToInlineContent","dir","textContent","trim","listEl","depth","parentDir","li","checkbox","querySelector","indent","checked","hasAttribute","liDir","effectiveDir","parseListItemBlock","liChild","liChildTag","nestedType","nestedDir","htmlId","isHoistedList","isBlockLevelChild","inlineContent","only","inheritedWidth","width","span","remaining","count","Math","min","max","index","row","minHeightPx","colspan","value","rowspan","cellBlocks","skip","inlineRun","flushInlineRun","nodes","inlineRunHasContent","parseNodesToInlineContent","changed","name","entries","id","skipNestedLists","walkElement","inlineMatch","styleDir","direction"],"sources":["../../src/serialization/HTMLParseRules.ts","../../src/serialization/HTMLParseSession.ts","../../src/serialization/HTMLWhitespace.ts","../../src/serialization/StyleRehydration.ts","../../src/serialization/DocumentParser.ts"],"sourcesContent":["import type { Mark } from '../model/Document.js';\nimport type { ParseRule } from '../model/ParseRule.js';\nimport { markType } from '../model/TypeBrands.js';\n\n/** Parse rules with the node, mark or inline type they produce, in priority order. */\nexport type ParseRules = readonly { readonly rule: ParseRule; readonly type: string }[];\n\n/** Structural tags handled by the document parser independently of schema rules. */\nconst BLOCK_TAGS: ReadonlySet<string> = new Set(['p', 'div', 'ul', 'ol', 'table', 'blockquote']);\n\n/** Returns the first accepting rule in priority order, including its parsed attributes. */\nexport function matchHTMLParseRule(\n\telement: HTMLElement,\n\trules: ParseRules,\n): { readonly type: string; readonly attrs?: Record<string, unknown> } | null {\n\tconst tag: string = element.tagName.toLowerCase();\n\tfor (const { rule, type } of rules) {\n\t\tif (rule.tag !== tag) continue;\n\t\tconst attrs = rule.getAttrs?.(element);\n\t\tif (attrs !== false) return { type, ...(attrs ? { attrs } : {}) };\n\t}\n\treturn null;\n}\n\n/** Reads the element's own marks, shared by the inline walker and wrappers. */\nexport function parseHTMLMarks(\n\tel: HTMLElement,\n\tcurrentMarks: readonly Mark[],\n\tmarkRules: readonly { readonly rule: ParseRule; readonly type: string }[],\n): Mark[] {\n\tconst tag: string = el.tagName.toLowerCase();\n\tconst marks: Mark[] = [...currentMarks];\n\n\tfor (const { rule, type } of markRules) {\n\t\tif (rule.tag !== tag || marks.some((mark) => mark.type === type)) continue;\n\t\tconst attrs = rule.getAttrs?.(el);\n\t\tif (attrs === false) continue;\n\t\tmarks.push({\n\t\t\ttype: markType(type),\n\t\t\t...(attrs && Object.keys(attrs).length > 0 ? { attrs } : {}),\n\t\t} as Mark);\n\t}\n\n\treturn marks;\n}\n\n/** Inline node rules take precedence, just as they do when parsing inline content. */\nexport function isHTMLBlockElement(\n\telement: HTMLElement,\n\tblockRules: ParseRules,\n\tinlineRules: ParseRules,\n\tblockTags: ReadonlySet<string> = BLOCK_TAGS,\n): boolean {\n\tif (matchHTMLParseRule(element, inlineRules)) return false;\n\treturn (\n\t\tblockTags.has(element.tagName.toLowerCase()) || matchHTMLParseRule(element, blockRules) !== null\n\t);\n}\n\n/**\n * Looks through transparent intermediate wrappers for block content. Atomic\n * inline nodes own their markup, so their descendants must never be unwrapped.\n */\nexport function hasHTMLBlockDescendants(\n\telement: HTMLElement,\n\tblockRules: ParseRules,\n\tinlineRules: ParseRules,\n\tblockTags: ReadonlySet<string> = BLOCK_TAGS,\n): boolean {\n\treturn createBlockDescendantCheck(blockRules, inlineRules, blockTags)(element);\n}\n\n/**\n * Creates a {@link hasHTMLBlockDescendants} check that remembers every\n * element's answer. Parsers ask it for each level of nested wrappers, so\n * without the memo a deep wrapper chain rescans the same subtree at every\n * level (#263). Use one check per parse, while the DOM does not change.\n */\nexport function createBlockDescendantCheck(\n\tblockRules: ParseRules,\n\tinlineRules: ParseRules,\n\tblockTags: ReadonlySet<string> = BLOCK_TAGS,\n): (element: HTMLElement) => boolean {\n\tconst known = new WeakMap<Element, boolean>();\n\tconst check = (element: HTMLElement): boolean => {\n\t\tconst cached: boolean | undefined = known.get(element);\n\t\tif (cached !== undefined) return cached;\n\t\tconst result: boolean =\n\t\t\t!matchHTMLParseRule(element, inlineRules) &&\n\t\t\tArray.from(element.children).some((child) => {\n\t\t\t\tconst el = child as HTMLElement;\n\t\t\t\treturn isHTMLBlockElement(el, blockRules, inlineRules, blockTags) || check(el);\n\t\t\t});\n\t\tknown.set(element, result);\n\t\treturn result;\n\t};\n\treturn check;\n}\n","/**\n * State shared by one HTML import: the registry's parse rules, read once, the\n * block ids adopted so far, and per-element answers the parser needs again and\n * again. Transparent wrappers (#223) make the parser ask about the same\n * elements at every nesting level, so each answer is computed once per element\n * instead of once per level (#263).\n */\n\nimport type { Mark } from '../model/Document.js';\nimport type { SchemaRegistry } from '../model/SchemaRegistry.js';\nimport { type ParseRules, createBlockDescendantCheck, parseHTMLMarks } from './HTMLParseRules.js';\n\nexport interface HTMLParseSession {\n\treadonly registry?: SchemaRegistry;\n\treadonly blockRules: ParseRules;\n\treadonly inlineRules: ParseRules;\n\treadonly markRules: ParseRules;\n\t/** HTML block ids adopted so far, so a repeated id gets a fresh one. */\n\treadonly adoptedIds: Set<string>;\n\t/** Whether `element` wraps block-level content, looking through transparent wrappers. */\n\thasBlockDescendants(element: HTMLElement): boolean;\n\t/** The marks the ancestors of `node` apply to it, such as a wrapper's link or color. */\n\tancestorMarks(node: Node): readonly Mark[];\n}\n\n/**\n * Creates the session for one parse. The DOM must not change while it is in\n * use, because answers are remembered per element.\n */\nexport function createHTMLParseSession(registry?: SchemaRegistry): HTMLParseSession {\n\tconst blockRules: ParseRules = registry?.getBlockParseRules() ?? [];\n\tconst inlineRules: ParseRules = registry?.getInlineParseRules() ?? [];\n\tconst markRules: ParseRules = registry?.getMarkParseRules() ?? [];\n\tconst ownMarks = new WeakMap<Element, readonly Mark[]>();\n\n\tconst marksOf = (element: HTMLElement): readonly Mark[] => {\n\t\tconst cached: readonly Mark[] | undefined = ownMarks.get(element);\n\t\tif (cached) return cached;\n\t\tconst parent: HTMLElement | null = element.parentElement;\n\t\tconst marks: readonly Mark[] = parseHTMLMarks(\n\t\t\telement,\n\t\t\tparent ? marksOf(parent) : [],\n\t\t\tmarkRules,\n\t\t);\n\t\townMarks.set(element, marks);\n\t\treturn marks;\n\t};\n\n\treturn {\n\t\tregistry,\n\t\tblockRules,\n\t\tinlineRules,\n\t\tmarkRules,\n\t\tadoptedIds: new Set<string>(),\n\t\thasBlockDescendants: createBlockDescendantCheck(blockRules, inlineRules),\n\t\tancestorMarks: (node: Node): readonly Mark[] =>\n\t\t\tnode.parentElement ? marksOf(node.parentElement) : [],\n\t};\n}\n","/**\n * HTML whitespace normalization, shared by the paste parser (`HTMLParser`) and the\n * `setContentHTML` parser (`DocumentParser`).\n *\n * Per the CSS Text / HTML whitespace processing model for `white-space: normal`,\n * whitespace in normal flow content is *insignificant*: runs of ASCII whitespace\n * (space, tab, line feed, carriage return, form feed) collapse to a single space,\n * and whitespace at the edges of a block collapses away entirely. Only `<br>` is a\n * real line break. Source-formatted HTML (server-rendered, hand-indented, or\n * hard-wrapped by a browser's clipboard serializer) therefore carries newlines and\n * indentation that must NOT survive parsing.\n *\n * This pass rewrites text-node data in place so both parsers can walk a tree whose\n * whitespace already matches what a browser would render. It only touches\n * `Text.data`; marks, block ids, and attributes are left untouched.\n */\n\n/**\n * ASCII whitespace per the HTML spec. Deliberately NOT `\\s`: `\\s` also matches\n * non-breaking space (` `) and other Unicode spaces, which are significant\n * content and must be preserved verbatim.\n */\nconst COLLAPSIBLE_WHITESPACE: RegExp = /[ \\t\\n\\r\\f]+/g;\n\n/**\n * Tags that establish a block formatting context in normal flow. Each starts a\n * fresh inline run whose leading/trailing whitespace is trimmed independently.\n * Self-contained (not coupled to the parsers' tag sets); unknown tags are treated\n * as inline.\n */\nconst FLOW_BLOCK_TAGS: ReadonlySet<string> = new Set([\n\t'P',\n\t'DIV',\n\t'H1',\n\t'H2',\n\t'H3',\n\t'H4',\n\t'H5',\n\t'H6',\n\t'BLOCKQUOTE',\n\t'UL',\n\t'OL',\n\t'LI',\n\t'TABLE',\n\t'THEAD',\n\t'TBODY',\n\t'TFOOT',\n\t'TR',\n\t'TD',\n\t'TH',\n\t'HR',\n\t'FIGURE',\n\t'FIGCAPTION',\n\t'SECTION',\n\t'ARTICLE',\n\t'HEADER',\n\t'FOOTER',\n\t'MAIN',\n\t'ASIDE',\n\t'NAV',\n\t'DL',\n\t'DT',\n\t'DD',\n]);\n\n/** Tags whose descendant whitespace is significant and must be preserved verbatim. */\nconst PRESERVE_TAGS: ReadonlySet<string> = new Set(['PRE', 'TEXTAREA']);\n\n/** `white-space` values that preserve whitespace (the `pre*` family). */\nconst PRESERVE_WHITESPACE_VALUES: ReadonlySet<string> = new Set([\n\t'pre',\n\t'pre-wrap',\n\t'pre-line',\n\t'break-spaces',\n]);\n\n/** Mutable state threaded through a single inline formatting context. */\ninterface CollapseState {\n\t/** Most recent non-empty text node in this context, for trailing-space trimming. */\n\tlastTextNode: Text | null;\n\t/**\n\t * Whether a leading space on the next text node should be dropped. True at the\n\t * start of a context and after any text node that ended with a space.\n\t */\n\tcollapsePending: boolean;\n}\n\n/**\n * Collapses insignificant HTML whitespace throughout `root`, mutating text-node\n * data in place. Call once on a (disposable) parsed fragment before walking it.\n */\nexport function normalizeHTMLWhitespace(root: DocumentFragment | HTMLElement): void {\n\tnormalizeContext(root);\n}\n\n/** Processes one inline formatting context, then trims its trailing whitespace. */\nfunction normalizeContext(container: DocumentFragment | HTMLElement): void {\n\tconst state: CollapseState = { lastTextNode: null, collapsePending: true };\n\tfor (const child of Array.from(container.childNodes)) {\n\t\tprocessNode(child, state);\n\t}\n\ttrimTrailingSpace(state.lastTextNode);\n}\n\nfunction processNode(node: ChildNode, state: CollapseState): void {\n\tif (node.nodeType === Node.TEXT_NODE) {\n\t\tcollapseTextNode(node as Text, state);\n\t\treturn;\n\t}\n\tif (node.nodeType !== Node.ELEMENT_NODE) return;\n\n\tconst el = node as HTMLElement;\n\n\t// Whitespace-preserving subtree (code blocks etc.): end the current inline run\n\t// and leave the subtree untouched.\n\tif (isPreserveElement(el)) {\n\t\tendInlineRun(state);\n\t\treturn;\n\t}\n\n\t// Block element: the current inline run ends here; recurse as a fresh context.\n\tif (isFlowBlockElement(el)) {\n\t\tendInlineRun(state);\n\t\tnormalizeContext(el);\n\t\treturn;\n\t}\n\n\t// Inline element: keep collapsing within the same context.\n\tfor (const child of Array.from(el.childNodes)) {\n\t\tprocessNode(child, state);\n\t}\n}\n\n/** Collapses whitespace runs in a text node and drops a leading space when pending. */\nfunction collapseTextNode(text: Text, state: CollapseState): void {\n\tlet data: string = text.data.replace(COLLAPSIBLE_WHITESPACE, ' ');\n\tif (state.collapsePending && data.startsWith(' ')) {\n\t\tdata = data.slice(1);\n\t}\n\ttext.data = data;\n\n\t// Fully collapsed away (e.g. a whitespace-only node): leave `collapsePending` as\n\t// is so a later node still drops its leading space.\n\tif (data.length === 0) return;\n\n\tstate.collapsePending = data.endsWith(' ');\n\tstate.lastTextNode = text;\n}\n\n/** Ends the current inline run at a block/preserve boundary and resets state. */\nfunction endInlineRun(state: CollapseState): void {\n\ttrimTrailingSpace(state.lastTextNode);\n\tstate.lastTextNode = null;\n\tstate.collapsePending = true;\n}\n\n/** Removes the single (already-collapsed) trailing space from a text node, if any. */\nfunction trimTrailingSpace(node: Text | null): void {\n\tif (node?.data.endsWith(' ')) {\n\t\tnode.data = node.data.slice(0, -1);\n\t}\n}\n\nfunction isFlowBlockElement(el: HTMLElement): boolean {\n\treturn FLOW_BLOCK_TAGS.has(el.tagName);\n}\n\nfunction isPreserveElement(el: HTMLElement): boolean {\n\tif (PRESERVE_TAGS.has(el.tagName)) return true;\n\tconst whiteSpace: string = (el.style?.whiteSpace ?? '').toLowerCase();\n\treturn PRESERVE_WHITESPACE_VALUES.has(whiteSpace);\n}\n","/**\n * Style rehydration for HTML import and paste: before the parse rules run,\n * every style the HTML gives an element becomes readable through the CSSOM\n * (`el.style`), which is where the rules read it. Import and both paste routes\n * share this one step, so they read styles alike on every page.\n */\n\nimport { splitDeclarations } from '../model/StyleClass.js';\nimport { type ClassDeclarationResolver, rehydrateStyleClasses } from './StyleClassHTML.js';\n\n/**\n * The most declarations rehydrated on one element, from its `style` attribute\n * and from its classes each. Formatting needs far fewer. Input with more is not\n * formatting, and Chromium applies many distinct custom properties through the\n * CSSOM in superlinear time, so such an element keeps those styles unapplied\n * (#274).\n */\nexport const MAX_REHYDRATED_DECLARATIONS = 256;\n\n/**\n * Rehydrates the styles of parsed content HTML in cascade order: first each\n * element's own `style` attribute, then the declarations its classes stand for,\n * which only fill properties the element does not set inline (#269).\n */\nexport function rehydrateStyles(root: ParentNode, resolveClass: ClassDeclarationResolver): void {\n\trestoreInlineStyles(root);\n\trehydrateStyleClasses(root, resolveClass, MAX_REHYDRATED_DECLARATIONS);\n}\n\n/**\n * Applies `style` attributes the browser kept out of the CSSOM. Under a strict\n * CSP (`style-src-attr 'none'`) Chromium keeps the attribute text but leaves\n * `el.style` empty, even in inert template content (#272), while CSSOM writes\n * stay allowed. Without such a policy the CSSOM already holds the declarations,\n * so only an attribute the browser rejected entirely is parsed again, which\n * yields no declarations either. Afterwards the attribute holds the browser's\n * serialization, so code that needs the raw text reads it before this step.\n */\nfunction restoreInlineStyles(root: ParentNode): void {\n\tfor (const element of Array.from(root.querySelectorAll('[style]'))) {\n\t\tconst style: CSSStyleDeclaration | undefined = inlineStyleOf(element);\n\t\tif (!style || style.length > 0) continue;\n\t\tconst text: string = element.getAttribute('style') ?? '';\n\t\tif (splitDeclarations(text).length > MAX_REHYDRATED_DECLARATIONS) continue;\n\t\t// One write through the browser's own CSS parser, which reads priorities,\n\t\t// shorthands and comments as it reads the attribute on a page without a CSP.\n\t\tstyle.cssText = text;\n\t}\n}\n\n/** The CSSOM declaration of an element, unless its namespace has none. */\nfunction inlineStyleOf(element: Element): CSSStyleDeclaration | undefined {\n\treturn (element as Partial<ElementCSSInlineStyle>).style;\n}\n","/**\n * DocumentParser: converts sanitized HTML strings into immutable Document instances.\n * Pure functions — no class state, no DOM mutation beyond a temporary `<template>`.\n */\n\nimport type { BlockAlignment } from '../model/BlockAlignment.js';\nimport { hoistDisallowedBlocks } from '../model/ContentModel.js';\nimport type {\n\tBlockAttrValue,\n\tBlockNode,\n\tDocument,\n\tInlineNode,\n\tMark,\n\tTextNode,\n} from '../model/Document.js';\nimport {\n\tcreateBlockNode,\n\tcreateDocument,\n\tcreateInlineNode,\n\tcreateTextNode,\n\tgetInlineChildren,\n\tisInlineNode,\n} from '../model/Document.js';\nimport { SAFE_URI_REGEXP, normalizeHTMLId } from '../model/HTMLUtils.js';\nimport type { ParseRule } from '../model/ParseRule.js';\nimport type { SchemaRegistry } from '../model/SchemaRegistry.js';\nimport { type InlineTypeName, inlineType, nodeType } from '../model/TypeBrands.js';\nimport { readElementAlignment } from './AlignmentHTML.js';\nimport { adoptBlockId } from './BlockIdHTML.js';\nimport { VALID_DIRECTIONS } from './DocumentSerializer.js';\nimport { isHTMLBlockElement, matchHTMLParseRule, parseHTMLMarks } from './HTMLParseRules.js';\nimport { type HTMLParseSession, createHTMLParseSession } from './HTMLParseSession.js';\nimport { preserveHTMLIdSanitizeConfig, sanitizeHTML } from './HTMLSanitization.js';\nimport { normalizeHTMLWhitespace } from './HTMLWhitespace.js';\nimport { createClassDeclarationResolver } from './StyleClassHTML.js';\nimport { rehydrateStyles } from './StyleRehydration.js';\nimport {\n\tMAX_SERIALIZED_TABLE_COLUMNS,\n\tTABLE_COLUMN_WIDTH_DATA_ATTRIBUTE,\n\tTABLE_ROW_MIN_HEIGHT_DATA_ATTRIBUTE,\n\tnormalizeTableColumnWidthsPx,\n\tparseTableColumnSpan,\n\treadTableDimensionPx,\n} from './TableDimensions.js';\n\n/** Options for `parseHTMLToDocument` when importing class-based HTML. */\nexport interface ParseHTMLOptions {\n\t/**\n\t * Style map from a previous `getContentHTML({ cssMode: 'classes' })` call.\n\t * Used to rehydrate class-based HTML back into styled content. Registered\n\t * style classes and notectl's alignment classes need no style map.\n\t */\n\treadonly styleMap?: ReadonlyMap<string, string>;\n}\n\n/** Parses an HTML string into a Document, applying sanitization and schema parse rules. */\nexport function parseHTMLToDocument(\n\thtml: string,\n\tregistry?: SchemaRegistry,\n\toptions?: ParseHTMLOptions,\n): Document {\n\tconst allowedTags: string[] = registry ? registry.getAllowedTags() : ['p', 'br', 'div', 'span'];\n\tconst allowedAttrs: string[] = registry ? registry.getAllowedAttrs() : ['style', 'dir', 'id'];\n\n\t// `data-block-id` carries block identity across `setContentHTML(getContentHTML())`.\n\t// Whitelist it through DOMPurify so the adoption logic below sees it.\n\tif (!allowedAttrs.includes('data-block-id')) {\n\t\tallowedAttrs.push('data-block-id');\n\t}\n\n\t// When a styleMap is provided, also allow `class` through DOMPurify\n\t// so we can read class names and rehydrate styles before parsing.\n\tif (options?.styleMap && !allowedAttrs.includes('class')) {\n\t\tallowedAttrs.push('class');\n\t}\n\n\tconst template = document.createElement('template');\n\ttemplate.innerHTML = sanitizeHTML(\n\t\thtml,\n\t\t{\n\t\t\tALLOWED_TAGS: allowedTags,\n\t\t\tALLOWED_ATTR: allowedAttrs,\n\t\t\tALLOWED_URI_REGEXP: SAFE_URI_REGEXP,\n\t\t\t...preserveHTMLIdSanitizeConfig(),\n\t\t},\n\t\tregistry,\n\t);\n\tconst root: DocumentFragment = template.content;\n\n\t// Make inline styles and classes readable through the CSSOM, where parse rules read them.\n\trehydrateStyles(root, createClassDeclarationResolver(registry, options?.styleMap));\n\n\t// Collapse insignificant HTML whitespace so source-formatted/indented input does\n\t// not leave stray newlines and indentation inside block text content.\n\tnormalizeHTMLWhitespace(root);\n\n\tconst session: HTMLParseSession = createHTMLParseSession(registry);\n\tconst blocks: BlockNode[] = [];\n\n\tfor (const child of Array.from(root.childNodes)) {\n\t\tparseChildNode(child, blocks, session);\n\t}\n\n\tif (blocks.length === 0) return createDocument();\n\tconst doc: Document = createDocument(blocks);\n\t// Repair schema-invalid nesting an importer may have produced (e.g. a `<table>`\n\t// inside an `<li>` builds `list_item > table`, which the flat-with-indent item\n\t// model forbids): the disallowed block is hoisted to a valid ancestor (#194).\n\treturn registry ? hoistDisallowedBlocks(doc, registry) : doc;\n}\n\n/**\n * Parses a single child node into block(s), handling all supported block types:\n * lists, tables, block parse rules (headings, blockquotes, code blocks, images, hr),\n * and fallback paragraphs. Used by both top-level parsing and table cell content parsing.\n */\nfunction parseChildNode(child: ChildNode, blocks: BlockNode[], session: HTMLParseSession): void {\n\tconst { adoptedIds, registry } = session;\n\tif (child.nodeType === Node.ELEMENT_NODE) {\n\t\tconst el = child as HTMLElement;\n\t\tconst tag: string = el.tagName.toLowerCase();\n\n\t\t// Lists need cross-element logic — handle before parse rules\n\t\tif (tag === 'ul' || tag === 'ol') {\n\t\t\tconst listType: string = tag === 'ol' ? 'ordered' : 'bullet';\n\t\t\tconst listDir: string | null = el.getAttribute('dir');\n\t\t\tconst parentDir: string | undefined =\n\t\t\t\tlistDir && VALID_DIRECTIONS.has(listDir) ? listDir : undefined;\n\t\t\tparseListElement(el, listType, 0, blocks, session, parentDir);\n\t\t\treturn;\n\t\t}\n\n\t\t// Tables produce nested block structure: table > table_row > table_cell > paragraph\n\t\tif (tag === 'table') {\n\t\t\tparseTableElement(el, blocks, session);\n\t\t\treturn;\n\t\t}\n\n\t\t// Blockquotes are container blocks (issue #136): parse their children\n\t\t// recursively into block nodes instead of flattening to inline content.\n\t\tif (tag === 'blockquote') {\n\t\t\tparseBlockquoteElement(el, blocks, session);\n\t\t\treturn;\n\t\t}\n\n\t\t// Try block parse rules\n\t\tconst match = matchHTMLParseRule(el, session.blockRules);\n\n\t\t// A paragraph cannot hold blocks. An element that resolves to `paragraph`\n\t\t// (the generic `<div>` rule or the fallback below) but wraps block-level\n\t\t// children is a transparent wrapper, the shape web pages, Google Docs and\n\t\t// Word put around their content: its children become sibling blocks\n\t\t// instead of being flattened into one inline run (#223).\n\t\tif ((match?.type ?? 'paragraph') === 'paragraph' && session.hasBlockDescendants(el)) {\n\t\t\tparseWrapperElement(el, blocks, session);\n\t\t\treturn;\n\t\t}\n\n\t\tconst spec = match ? registry?.getNodeSpec(match.type) : undefined;\n\t\tconst children: (TextNode | InlineNode)[] = spec?.isVoid\n\t\t\t? [createTextNode('')]\n\t\t\t: parseElementToInlineContent(el, session);\n\t\tconst attrs: Record<string, string | number | boolean> = {\n\t\t\t...(match?.attrs as Record<string, string | number | boolean> | undefined),\n\t\t};\n\t\t// Known block types only accept declared attributes. The paragraph\n\t\t// fallback retains the permissive behavior of registry-free import.\n\t\tif (!match || spec?.attrs?.align) extractAlignment(el, attrs);\n\t\tif (!match || spec?.attrs?.dir) extractDirection(el, attrs);\n\t\tblocks.push(\n\t\t\tcreateBlockNode(\n\t\t\t\tnodeType(match?.type ?? 'paragraph'),\n\t\t\t\tchildren,\n\t\t\t\tadoptBlockId(el, adoptedIds),\n\t\t\t\tObject.keys(attrs).length > 0 ? attrs : undefined,\n\t\t\t\textractHTMLId(el),\n\t\t\t),\n\t\t);\n\t} else if (child.nodeType === Node.TEXT_NODE && child.textContent?.trim()) {\n\t\tblocks.push(createBlockNode(nodeType('paragraph'), [createTextNode(child.textContent.trim())]));\n\t}\n}\n\n/**\n * Recursively parses a list element (`<ul>` or `<ol>`), creating list_item blocks\n * with correct indent depth. Handles nested lists inside `<li>` elements.\n */\nfunction parseListElement(\n\tlistEl: Element,\n\tlistType: string,\n\tdepth: number,\n\tblocks: BlockNode[],\n\tsession: HTMLParseSession,\n\tparentDir?: string,\n): void {\n\tfor (const child of Array.from(listEl.children)) {\n\t\tconst tag: string = child.tagName.toLowerCase();\n\n\t\tif (tag === 'li') {\n\t\t\tconst li: HTMLElement = child as HTMLElement;\n\n\t\t\t// Check for checklist: <input type=\"checkbox\">\n\t\t\tconst checkbox: HTMLInputElement | null = li.querySelector(':scope > input[type=\"checkbox\"]');\n\t\t\tconst isChecklist: boolean = checkbox !== null;\n\t\t\tconst checked: boolean = checkbox?.hasAttribute('checked') ?? false;\n\n\t\t\tconst resolvedType: string = isChecklist ? 'checklist' : listType;\n\n\t\t\tconst attrs: Record<string, string | number | boolean> = {\n\t\t\t\tlistType: resolvedType,\n\t\t\t\tindent: depth,\n\t\t\t\tchecked,\n\t\t\t};\n\n\t\t\t// Propagate direction: item's own dir > parent list dir\n\t\t\tconst liDir: string | null = li.getAttribute('dir');\n\t\t\tconst effectiveDir: string | undefined =\n\t\t\t\tliDir && VALID_DIRECTIONS.has(liDir) ? liDir : parentDir;\n\t\t\tif (effectiveDir) {\n\t\t\t\tattrs.dir = effectiveDir;\n\t\t\t}\n\n\t\t\tblocks.push(parseListItemBlock(li, attrs, checkbox, session));\n\n\t\t\t// Check for nested lists inside this <li>\n\t\t\tfor (const liChild of Array.from(li.children)) {\n\t\t\t\tconst liChildTag: string = liChild.tagName.toLowerCase();\n\t\t\t\tif (liChildTag === 'ul' || liChildTag === 'ol') {\n\t\t\t\t\tconst nestedType: string = liChildTag === 'ol' ? 'ordered' : 'bullet';\n\t\t\t\t\tconst nestedDir: string | null = liChild.getAttribute('dir');\n\t\t\t\t\tconst nestedEffectiveDir: string | undefined =\n\t\t\t\t\t\tnestedDir && VALID_DIRECTIONS.has(nestedDir) ? nestedDir : effectiveDir;\n\t\t\t\t\tparseListElement(liChild, nestedType, depth + 1, blocks, session, nestedEffectiveDir);\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (tag === 'ul' || tag === 'ol') {\n\t\t\t// Direct nested list without wrapping <li> — increment depth\n\t\t\tconst nestedType: string = tag === 'ol' ? 'ordered' : 'bullet';\n\t\t\tconst nestedDir: string | null = child.getAttribute('dir');\n\t\t\tconst nestedEffectiveDir: string | undefined =\n\t\t\t\tnestedDir && VALID_DIRECTIONS.has(nestedDir) ? nestedDir : parentDir;\n\t\t\tparseListElement(child, nestedType, depth + 1, blocks, session, nestedEffectiveDir);\n\t\t}\n\t}\n}\n\n/**\n * Parses one `<li>` into its `list_item` block (#194). An item whose children\n * are inline-only stays a leaf; block-level children other than nested lists\n * (a second paragraph, code, a quote, a heading) make it a container with\n * block children. Nested `<ul>`/`<ol>` are excluded here — the caller hoists\n * them into flat siblings one indent deeper. A lone plain paragraph unwraps\n * back to a leaf so the common tight/loose single-paragraph item keeps its\n * inline shape.\n */\nfunction parseListItemBlock(\n\tli: HTMLElement,\n\tattrs: Record<string, string | number | boolean>,\n\tcheckbox: HTMLInputElement | null,\n\tsession: HTMLParseSession,\n): BlockNode {\n\tconst { adoptedIds } = session;\n\tconst htmlId: string | undefined = extractHTMLId(li);\n\tconst isHoistedList = (node: ChildNode): boolean => {\n\t\tif (node.nodeType !== Node.ELEMENT_NODE) return false;\n\t\tconst tag: string = (node as Element).tagName.toLowerCase();\n\t\treturn tag === 'ul' || tag === 'ol';\n\t};\n\tconst hasBlockContent: boolean = Array.from(li.childNodes).some(\n\t\t(node) => !isHoistedList(node) && isBlockLevelChild(node, session),\n\t);\n\n\tif (!hasBlockContent) {\n\t\tconst inlineContent = parseElementToInlineContent(li, session, true);\n\t\treturn createBlockNode(\n\t\t\tnodeType('list_item'),\n\t\t\tinlineContent,\n\t\t\tadoptBlockId(li, adoptedIds),\n\t\t\tattrs,\n\t\t\thtmlId,\n\t\t);\n\t}\n\n\tconst skip = (node: ChildNode): boolean => isHoistedList(node) || node === checkbox;\n\tconst innerBlocks: BlockNode[] = parseBlockContainerChildren(li, session, skip);\n\n\t// A lone attribute-less paragraph is the leaf shape in disguise.\n\tconst only: BlockNode | undefined = innerBlocks.length === 1 ? innerBlocks[0] : undefined;\n\tif (only && only.type === 'paragraph' && !only.attrs && !only.htmlId) {\n\t\treturn createBlockNode(\n\t\t\tnodeType('list_item'),\n\t\t\tgetInlineChildren(only),\n\t\t\tadoptBlockId(li, adoptedIds),\n\t\t\tattrs,\n\t\t\thtmlId,\n\t\t);\n\t}\n\n\tif (innerBlocks.length === 0) {\n\t\treturn createBlockNode(\n\t\t\tnodeType('list_item'),\n\t\t\t[createTextNode('')],\n\t\t\tadoptBlockId(li, adoptedIds),\n\t\t\tattrs,\n\t\t\thtmlId,\n\t\t);\n\t}\n\n\treturn createBlockNode(\n\t\tnodeType('list_item'),\n\t\tinnerBlocks,\n\t\tadoptBlockId(li, adoptedIds),\n\t\tattrs,\n\t\thtmlId,\n\t);\n}\n\n/**\n * Parses a `<table>` element into nested block structure:\n * table > table_row > table_cell > paragraph.\n * Handles `<thead>`, `<tbody>`, `<tfoot>` transparently.\n */\nfunction parseTableElement(tableEl: Element, blocks: BlockNode[], session: HTMLParseSession): void {\n\tconst { adoptedIds, registry } = session;\n\tconst rows: BlockNode[] = [];\n\tconst columnWidthsPx: readonly (number | null)[] | undefined =\n\t\textractTableColumnWidthsPx(tableEl);\n\t// Like every other block, a cell takes alignment only when its spec declares it.\n\tconst cellsAlign: boolean = !registry || !!registry.getNodeSpec('table_cell')?.attrs?.align;\n\n\t// Collect <tr> elements, handling <thead>/<tbody>/<tfoot> wrappers\n\tconst rowElements: Element[] = collectTableRows(tableEl);\n\n\tfor (const trEl of rowElements) {\n\t\tconst cells: BlockNode[] = [];\n\n\t\tfor (const cellChild of Array.from(trEl.children)) {\n\t\t\tconst cellTag: string = cellChild.tagName.toLowerCase();\n\t\t\tif (cellTag !== 'td' && cellTag !== 'th') continue;\n\n\t\t\tconst cellEl: HTMLElement = cellChild as HTMLElement;\n\t\t\tconst cellContent: BlockNode[] = parseTableCellContent(cellEl, session);\n\t\t\tconst cellAttrs: Record<string, string | number | boolean> = {};\n\t\t\textractCellSpanAttrs(cellEl, cellAttrs);\n\t\t\tif (cellsAlign) extractAlignment(cellEl, cellAttrs);\n\t\t\tconst cellBlock: BlockNode = createBlockNode(\n\t\t\t\tnodeType('table_cell'),\n\t\t\t\tcellContent,\n\t\t\t\tadoptBlockId(cellEl, adoptedIds),\n\t\t\t\tObject.keys(cellAttrs).length > 0 ? cellAttrs : undefined,\n\t\t\t\textractHTMLId(cellEl),\n\t\t\t);\n\t\t\tcells.push(cellBlock);\n\t\t}\n\n\t\tconst rowAttrs: Record<string, string | number | boolean> = {};\n\t\textractTableRowMinHeight(trEl as HTMLElement, rowAttrs);\n\t\t// Preserve empty rows. Besides retaining authored table structure, an empty\n\t\t// `<tr>` may carry the canonical minimum-height metadata by itself.\n\t\trows.push(\n\t\t\tcreateBlockNode(\n\t\t\t\tnodeType('table_row'),\n\t\t\t\tcells,\n\t\t\t\tadoptBlockId(trEl, adoptedIds),\n\t\t\t\tObject.keys(rowAttrs).length > 0 ? rowAttrs : undefined,\n\t\t\t\textractHTMLId(trEl as HTMLElement),\n\t\t\t),\n\t\t);\n\t}\n\n\tif (rows.length > 0) {\n\t\tconst tableAttrs: Record<string, BlockAttrValue> = {};\n\t\textractTableBorderColor(tableEl as HTMLElement, tableAttrs);\n\t\tif (columnWidthsPx) tableAttrs.columnWidthsPx = columnWidthsPx;\n\t\tblocks.push(\n\t\t\tcreateBlockNode(\n\t\t\t\tnodeType('table'),\n\t\t\t\trows,\n\t\t\t\tadoptBlockId(tableEl, adoptedIds),\n\t\t\t\tObject.keys(tableAttrs).length > 0 ? tableAttrs : undefined,\n\t\t\t\textractHTMLId(tableEl as HTMLElement),\n\t\t\t),\n\t\t);\n\t}\n}\n\n/** Collects canonical logical column widths from direct `<colgroup>/<col>` children. */\nfunction extractTableColumnWidthsPx(tableEl: Element): readonly (number | null)[] | undefined {\n\tconst widths: (number | null)[] = [];\n\n\tfor (const child of Array.from(tableEl.children)) {\n\t\tconst tag: string = child.tagName.toLowerCase();\n\t\tif (tag === 'col') {\n\t\t\tappendColumnElementWidths(child as HTMLElement, undefined, widths);\n\t\t\tcontinue;\n\t\t}\n\t\tif (tag !== 'colgroup') continue;\n\n\t\tconst groupEl: HTMLElement = child as HTMLElement;\n\t\tconst groupWidth: number | undefined = readTableColumnWidthPx(groupEl);\n\t\tconst columns: HTMLElement[] = Array.from(groupEl.children).filter(\n\t\t\t(element): element is HTMLElement => element.tagName.toLowerCase() === 'col',\n\t\t);\n\t\tif (columns.length === 0) {\n\t\t\tappendRepeatedWidth(groupWidth, parseTableColumnSpan(groupEl.getAttribute('span')), widths);\n\t\t\tcontinue;\n\t\t}\n\n\t\tfor (const column of columns) appendColumnElementWidths(column, groupWidth, widths);\n\t}\n\n\treturn normalizeTableColumnWidthsPx(widths);\n}\n\nfunction appendColumnElementWidths(\n\tcolumn: HTMLElement,\n\tinheritedWidth: number | undefined,\n\twidths: (number | null)[],\n): void {\n\tconst width: number | undefined = readTableColumnWidthPx(column) ?? inheritedWidth;\n\tappendRepeatedWidth(width, parseTableColumnSpan(column.getAttribute('span')), widths);\n}\n\nfunction appendRepeatedWidth(\n\twidth: number | undefined,\n\tspan: number,\n\twidths: (number | null)[],\n): void {\n\tconst remaining: number = MAX_SERIALIZED_TABLE_COLUMNS - widths.length;\n\tconst count: number = Math.min(span, Math.max(0, remaining));\n\tfor (let index = 0; index < count; index++) widths.push(width ?? null);\n}\n\nfunction readTableColumnWidthPx(element: HTMLElement): number | undefined {\n\treturn readTableDimensionPx(element, TABLE_COLUMN_WIDTH_DATA_ATTRIBUTE, ['width'], 'width');\n}\n\n/** Extracts one row's validated minimum height from canonical or conventional HTML. */\nfunction extractTableRowMinHeight(\n\trow: HTMLElement,\n\tattrs: Record<string, string | number | boolean>,\n): void {\n\tconst minHeightPx: number | undefined = readTableDimensionPx(\n\t\trow,\n\t\tTABLE_ROW_MIN_HEIGHT_DATA_ATTRIBUTE,\n\t\t['min-height', 'height'],\n\t\t'height',\n\t);\n\tif (minHeightPx !== undefined) attrs.minHeightPx = minHeightPx;\n}\n\n/** Collects `<tr>` elements from a table, traversing through `<thead>`/`<tbody>`/`<tfoot>`. */\nfunction collectTableRows(tableEl: Element): Element[] {\n\tconst rows: Element[] = [];\n\tfor (const child of Array.from(tableEl.children)) {\n\t\tconst tag: string = child.tagName.toLowerCase();\n\t\tif (tag === 'tr') {\n\t\t\trows.push(child);\n\t\t} else if (tag === 'thead' || tag === 'tbody' || tag === 'tfoot') {\n\t\t\tfor (const nested of Array.from(child.children)) {\n\t\t\t\tif (nested.tagName.toLowerCase() === 'tr') {\n\t\t\t\t\trows.push(nested);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn rows;\n}\n\n/** Regex to extract the `--ntbl-bc` CSS custom property from inline styles. */\nconst BORDER_COLOR_RE = /--ntbl-bc:\\s*(#[0-9a-fA-F]{3,8}|transparent)/;\n\n/** Extracts `borderColor` from a table element's inline style (`--ntbl-bc` CSS variable). */\nfunction extractTableBorderColor(el: HTMLElement, attrs: Record<string, BlockAttrValue>): void {\n\tconst style: string = el.getAttribute('style') ?? '';\n\tconst match: RegExpMatchArray | null = BORDER_COLOR_RE.exec(style);\n\tif (!match?.[1]) return;\n\tattrs.borderColor = match[1] === 'transparent' ? 'none' : match[1];\n}\n\n/** Extracts `colspan` and `rowspan` attributes from a table cell element. */\nfunction extractCellSpanAttrs(\n\tel: HTMLElement,\n\tattrs: Record<string, string | number | boolean>,\n): void {\n\tconst colspan: string | null = el.getAttribute('colspan');\n\tif (colspan) {\n\t\tconst value: number = parseTableColumnSpan(colspan);\n\t\tif (value > 1) attrs.colspan = value;\n\t}\n\tconst rowspan: string | null = el.getAttribute('rowspan');\n\tif (rowspan) {\n\t\tconst value: number = parseTableColumnSpan(rowspan);\n\t\tif (value > 1) attrs.rowspan = value;\n\t}\n}\n\n/**\n * Parses a `<blockquote>` into a container block whose children are block nodes\n * (issue #136). Block-level children (lists, paragraphs, headings, nested quotes)\n * are parsed recursively; a quote holding only inline content becomes a single\n * paragraph child so the container invariant (block children only) always holds.\n */\nfunction parseBlockquoteElement(\n\tel: HTMLElement,\n\tblocks: BlockNode[],\n\tsession: HTMLParseSession,\n): void {\n\tconst innerBlocks: BlockNode[] = parseBlockContainerChildren(el, session);\n\n\t// Empty or whitespace-only blockquote: keep a single empty paragraph so the\n\t// container always holds editable content.\n\tif (innerBlocks.length === 0) {\n\t\tinnerBlocks.push(createBlockNode(nodeType('paragraph'), [createTextNode('')]));\n\t}\n\n\t// Preserve direction/alignment on the container so the HTML round-trip is stable.\n\tconst attrs: Record<string, string | number | boolean> = {};\n\textractAlignment(el, attrs);\n\textractDirection(el, attrs);\n\n\tblocks.push(\n\t\tcreateBlockNode(\n\t\t\tnodeType('blockquote'),\n\t\t\tinnerBlocks,\n\t\t\tadoptBlockId(el, session.adoptedIds),\n\t\t\tObject.keys(attrs).length > 0 ? attrs : undefined,\n\t\t\textractHTMLId(el),\n\t\t),\n\t);\n}\n\n/** Parses a table cell's content into blocks, supporting all block types (lists, quotes, etc.). */\nfunction parseTableCellContent(cellEl: HTMLElement, session: HTMLParseSession): BlockNode[] {\n\tconst cellBlocks: BlockNode[] = parseBlockContainerChildren(cellEl, session);\n\n\t// No blocks produced: treat the cell as one empty paragraph.\n\tif (cellBlocks.length === 0) {\n\t\tcellBlocks.push(createBlockNode(nodeType('paragraph'), [createTextNode('')]));\n\t}\n\n\treturn cellBlocks;\n}\n\n/**\n * Parses the children of a block container (blockquote, table cell, multi-block\n * list item, transparent wrapper) into block nodes. Consecutive inline content\n * (text nodes and inline elements such as\n * `<em>`, `<strong>`, `<a>`) is coalesced into a single paragraph with its marks\n * intact, while genuine block children (paragraphs, headings, lists, tables,\n * nested blockquotes) are parsed recursively. This preserves the common quote\n * shape that mixes text with inline marks as one paragraph (issue #141).\n */\nfunction parseBlockContainerChildren(\n\tel: HTMLElement,\n\tsession: HTMLParseSession,\n\tskip?: (node: ChildNode) => boolean,\n): BlockNode[] {\n\tconst blocks: BlockNode[] = [];\n\tlet inlineRun: ChildNode[] = [];\n\n\tconst flushInlineRun = (): void => {\n\t\tif (inlineRunHasContent(inlineRun)) {\n\t\t\tblocks.push(\n\t\t\t\tcreateBlockNode(nodeType('paragraph'), parseNodesToInlineContent(inlineRun, session)),\n\t\t\t);\n\t\t}\n\t\tinlineRun = [];\n\t};\n\n\tfor (const child of Array.from(el.childNodes)) {\n\t\tif (skip?.(child)) continue;\n\t\tif (isBlockLevelChild(child, session)) {\n\t\t\tflushInlineRun();\n\t\t\tparseChildNode(child, blocks, session);\n\t\t} else {\n\t\t\tinlineRun.push(child);\n\t\t}\n\t}\n\tflushInlineRun();\n\n\treturn blocks;\n}\n\n/**\n * Both blocks and transparent wrappers around blocks end an inline run.\n * Ordinary inline elements and atomic inline nodes stay inside that run.\n */\nfunction isBlockLevelChild(node: ChildNode, session: HTMLParseSession): boolean {\n\tif (node.nodeType !== Node.ELEMENT_NODE) return false;\n\tconst el = node as HTMLElement;\n\treturn (\n\t\tisHTMLBlockElement(el, session.blockRules, session.inlineRules) ||\n\t\tsession.hasBlockDescendants(el)\n\t);\n}\n\n/**\n * Parses a transparent wrapper (a `<div>` or an unknown element around\n * block-level children) into the blocks it wraps (#223). The wrapper itself\n * yields no block, so its `id` is not adopted as an `htmlId` (wrapper-only\n * elements never own one). Its `dir` and `text-align`, which CSS inherits into\n * every child, are carried onto child blocks that accept the attribute but do\n * not set their own.\n */\nfunction parseWrapperElement(\n\tel: HTMLElement,\n\tblocks: BlockNode[],\n\tsession: HTMLParseSession,\n): void {\n\tconst inherited: Record<string, string | number | boolean> = {};\n\textractAlignment(el, inherited);\n\textractDirection(el, inherited);\n\n\tconst innerBlocks: BlockNode[] = parseBlockContainerChildren(el, session);\n\tfor (const block of innerBlocks) {\n\t\tblocks.push(inheritBlockAttrs(block, inherited, session.registry));\n\t}\n}\n\n/**\n * Returns the block extended with every inherited attribute it accepts but does\n * not set itself. With a registry, a block accepts an attribute only when its\n * NodeSpec declares it (mirroring the block parse rule path); without one, all\n * attributes are accepted (mirroring the paragraph fallback path).\n */\nfunction inheritBlockAttrs(\n\tblock: BlockNode,\n\tinherited: Record<string, string | number | boolean>,\n\tregistry?: SchemaRegistry,\n): BlockNode {\n\tconst spec = registry?.getNodeSpec(block.type);\n\tconst attrs: Record<string, BlockAttrValue> = { ...block.attrs };\n\tlet changed = false;\n\tfor (const [name, value] of Object.entries(inherited)) {\n\t\tif (attrs[name] !== undefined) continue;\n\t\tif (registry && !spec?.attrs?.[name]) continue;\n\t\tattrs[name] = value;\n\t\tchanged = true;\n\t}\n\tif (!changed) return block;\n\treturn createBlockNode(block.type, block.children, block.id, attrs, block.htmlId);\n}\n\n/** Whether an inline run carries meaningful content (non-whitespace text or any element). */\nfunction inlineRunHasContent(nodes: readonly ChildNode[]): boolean {\n\tfor (const node of nodes) {\n\t\tif (node.nodeType === Node.ELEMENT_NODE) return true;\n\t\tif (node.nodeType === Node.TEXT_NODE && node.textContent?.trim()) return true;\n\t}\n\treturn false;\n}\n\n/**\n * Parses an HTML element's inline children into (TextNode | InlineNode)[].\n * Applies mark parse rules and inline node parse rules.\n */\nfunction parseElementToInlineContent(\n\tel: HTMLElement,\n\tsession: HTMLParseSession,\n\tskipNestedLists?: boolean,\n): (TextNode | InlineNode)[] {\n\treturn parseNodesToInlineContent([el], session, skipNestedLists);\n}\n\n/**\n * Walks a list of sibling DOM nodes into inline content, applying mark and\n * inline-node parse rules. DOM ancestors retain the formatting of transparent\n * wrappers even after those wrappers cease to be model blocks. Mixed text and\n * inline elements still coalesce into one sequence with their own marks intact.\n */\nfunction parseNodesToInlineContent(\n\tnodes: readonly ChildNode[],\n\tsession: HTMLParseSession,\n\tskipNestedLists?: boolean,\n): (TextNode | InlineNode)[] {\n\tconst result: (TextNode | InlineNode)[] = [];\n\tfor (const node of nodes) {\n\t\twalkElement(\n\t\t\tnode,\n\t\t\tsession.ancestorMarks(node),\n\t\t\tresult,\n\t\t\tsession.markRules,\n\t\t\tsession.inlineRules,\n\t\t\tskipNestedLists,\n\t\t);\n\t}\n\n\t// A lone <br> as the only content of a block is a placeholder for an empty\n\t// paragraph (e.g. `<p><br></p>`), not a real hard break. Normalize to empty text.\n\tif (result.length === 1 && isInlineNode(result[0]) && result[0].inlineType === 'hard_break') {\n\t\treturn [createTextNode('')];\n\t}\n\n\treturn result.length > 0 ? result : [createTextNode('')];\n}\n\n/**\n * Recursively walks DOM nodes, collecting marks from parse rules,\n * matching inline node parse rules, and producing TextNodes/InlineNodes.\n */\nfunction walkElement(\n\tnode: Node,\n\tcurrentMarks: readonly Mark[],\n\tresult: (TextNode | InlineNode)[],\n\tmarkRules: readonly { readonly rule: ParseRule; readonly type: string }[],\n\tinlineRules: readonly { readonly rule: ParseRule; readonly type: string }[],\n\tskipNestedLists?: boolean,\n): void {\n\tif (node.nodeType === Node.TEXT_NODE) {\n\t\tconst text: string = node.textContent ?? '';\n\t\tif (text) {\n\t\t\tresult.push(createTextNode(text, [...currentMarks]));\n\t\t}\n\t\treturn;\n\t}\n\n\tif (node.nodeType !== Node.ELEMENT_NODE) return;\n\n\tconst el = node as HTMLElement;\n\tconst tag: string = el.tagName.toLowerCase();\n\n\t// Skip nested lists inside <li> (handled by parseListElement)\n\tif (skipNestedLists && (tag === 'ul' || tag === 'ol')) return;\n\n\t// Skip checkbox inputs inside list items (already handled by parseListElement)\n\tif (skipNestedLists && tag === 'input' && el.getAttribute('type') === 'checkbox') return;\n\n\t// Inline nodes are atomic and take precedence over descendant markup.\n\tconst inlineMatch = matchHTMLParseRule(el, inlineRules);\n\tif (inlineMatch) {\n\t\tresult.push(\n\t\t\tcreateInlineNode(\n\t\t\t\tinlineType(inlineMatch.type) as InlineTypeName,\n\t\t\t\tinlineMatch.attrs as Readonly<Record<string, string | number | boolean>> | undefined,\n\t\t\t\tcurrentMarks,\n\t\t\t),\n\t\t);\n\t\treturn;\n\t}\n\n\tconst marks: Mark[] = parseHTMLMarks(el, currentMarks, markRules);\n\tfor (const child of Array.from(el.childNodes)) {\n\t\twalkElement(child, marks, result, markRules, inlineRules, skipNestedLists);\n\t}\n}\n\n/** Extracts a validated `dir` attribute or inline `direction` style from an element. */\nfunction extractDirection(el: HTMLElement, attrs: Record<string, string | number | boolean>): void {\n\tconst dir: string | null = el.getAttribute('dir');\n\tif (dir && VALID_DIRECTIONS.has(dir)) {\n\t\tattrs.dir = dir;\n\t\treturn;\n\t}\n\n\t// Fallback: check inline style `direction: rtl/ltr` (common in paste from Word/Docs)\n\tconst styleDir: string = el.style?.direction ?? '';\n\tif (styleDir && VALID_DIRECTIONS.has(styleDir)) {\n\t\tattrs.dir = styleDir;\n\t}\n}\n\n/** Reads a conforming document-local HTML target from a block element. */\nfunction extractHTMLId(el: HTMLElement): string | undefined {\n\treturn normalizeHTMLId(el.getAttribute('id'));\n}\n\n/**\n * Adds the element's validated alignment to attrs: its inline `text-align`,\n * which rehydration also derives from alignment classes.\n */\nfunction extractAlignment(el: HTMLElement, attrs: Record<string, string | number | boolean>): void {\n\tconst align: BlockAlignment | undefined = readElementAlignment(el);\n\tif (align) attrs.align = align;\n}\n"],"mappings":"Y,8ZAQA,IAAM0B,iBAAkC,IAAIC,IAAI,CAAC,IAAK,MAAO,KAAM,KAAM,QAAS,eAGlF,SAAgBC,EACfC,EACAC,GAEA,MAAMC,EAAcF,EAAQG,QAAQC,cACpC,IAAK,MAAMC,KAAEA,EAAAC,KAAMA,KAAUL,EAAO,CACnC,GAAII,EAAKH,MAAQA,EAAK,SACtB,MAAMK,EAAQF,EAAKG,WAAWR,GAC9B,IAAc,IAAVO,EAAiB,MAAO,CAAED,UAAUC,EAAQ,CAAEA,SAAU,CAAC,EAC9D,CACA,OAAO,IACR,CAGA,SAAgBE,EACfC,EACAC,EACAC,GAEA,MAAMV,EAAcQ,EAAGP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AC3C,GAAI+L,EAQH,YAPArL,EAAOhB,KACNzC,EACCM,EAAWwO,EAAY/M,MACvB+M,EAAY9M,MACZI,IAMH,MAAME,EAAgBJ,EAAeC,EAAIC,EAAcC,GACvD,IAAK,MAAMwB,KAASH,MAAMC,KAAKxB,EAAGuC,YACjCmK,GAAYhL,EAAOvB,EAAOmB,EAAQpB,EAAWU,EAAa6L,EAE5D,CAGA,SAAS1D,GAAiB/I,EAAiBH,GAC1C,MAAM2J,EAAqBxJ,EAAG8D,aAAa,OAC3C,GAAI0F,GAAO/K,EAAiBqC,IAAI0I,GAE/B,YADA3J,EAAM2J,IAAMA,GAKb,MAAMoD,EAAmB5M,EAAGsD,OAAOuJ,WAAa,GAC5CD,GAAYnO,EAAiBqC,IAAI8L,KACpC/M,EAAM2J,IAAMoD,EAEd,CAGA,SAASzE,GAAcnI,GACtB,OAAOvC,EAAgBuC,EAAG8D,aAAa,MACxC,CAMA,SAASmE,GAAiBjI,EAAiBH,GAC1C,MAAMuH,EAAoC7I,EAAqByB,GAC3DoH,IAAOvH,EAAMuH,MAAQA,EAC1B,Q"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DomUtils-Bf7JLFlx.mjs","names":[],"sources":["../../src/view/DomUtils.ts"],"sourcesContent":["/**\n * DOM utility functions for the view layer.\n * Keeps DOM operations out of the model layer.\n */\n\nimport type { BlockId } from '../model/TypeBrands.js';\nimport { blockId as toBlockId } from '../model/TypeBrands.js';\n\n/**\n * Creates an HTMLElement with the required `data-block-id` attribute.\n *\n * Intentionally used by plugins in `NodeSpec.toDOM()` callbacks —\n * this is an accepted targeted import per ARCHITECTURE.md.\n */\nexport function createBlockElement(tag: string, blockId: BlockId): HTMLElement {\n\tconst el = document.createElement(tag);\n\tel.setAttribute('data-block-id', blockId);\n\treturn el;\n}\n\n/** Builds the block path from a leaf element up to the container. */\nexport function buildBlockPath(container: HTMLElement, leafBlockEl: HTMLElement): BlockId[] {\n\tconst path: BlockId[] = [];\n\tlet current: HTMLElement | null = leafBlockEl;\n\twhile (current && current !== container) {\n\t\tif (current.hasAttribute('data-block-id')) {\n\t\t\tpath.unshift(toBlockId(current.getAttribute('data-block-id') ?? ''));\n\t\t}\n\t\tcurrent = current.parentElement;\n\t}\n\treturn path;\n}\n\n/** Finds the nearest ancestor element with a `data-block-id` attribute. */\nexport function findBlockAncestor(container: HTMLElement, node: Node): HTMLElement | null {\n\tlet current: Node | null = node;\n\twhile (current && current !== container) {\n\t\tif (current instanceof HTMLElement && current.hasAttribute('data-block-id')) {\n\t\t\treturn current;\n\t\t}\n\t\tcurrent = current.parentNode;\n\t}\n\treturn null;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"DomUtils-Bf7JLFlx.mjs","names":["toBlockId","blockId","createBlockElement","tag","el","document","createElement","setAttribute","buildBlockPath","container","leafBlockEl","path","current","hasAttribute","unshift","getAttribute","parentElement","findBlockAncestor","node","HTMLElement","parentNode"],"sources":["../../src/view/DomUtils.ts"],"sourcesContent":["/**\n * DOM utility functions for the view layer.\n * Keeps DOM operations out of the model layer.\n */\n\nimport type { BlockId } from '../model/TypeBrands.js';\nimport { blockId as toBlockId } from '../model/TypeBrands.js';\n\n/**\n * Creates an HTMLElement with the required `data-block-id` attribute.\n *\n * Intentionally used by plugins in `NodeSpec.toDOM()` callbacks —\n * this is an accepted targeted import per ARCHITECTURE.md.\n */\nexport function createBlockElement(tag: string, blockId: BlockId): HTMLElement {\n\tconst el = document.createElement(tag);\n\tel.setAttribute('data-block-id', blockId);\n\treturn el;\n}\n\n/** Builds the block path from a leaf element up to the container. */\nexport function buildBlockPath(container: HTMLElement, leafBlockEl: HTMLElement): BlockId[] {\n\tconst path: BlockId[] = [];\n\tlet current: HTMLElement | null = leafBlockEl;\n\twhile (current && current !== container) {\n\t\tif (current.hasAttribute('data-block-id')) {\n\t\t\tpath.unshift(toBlockId(current.getAttribute('data-block-id') ?? ''));\n\t\t}\n\t\tcurrent = current.parentElement;\n\t}\n\treturn path;\n}\n\n/** Finds the nearest ancestor element with a `data-block-id` attribute. */\nexport function findBlockAncestor(container: HTMLElement, node: Node): HTMLElement | null {\n\tlet current: Node | null = node;\n\twhile (current && current !== container) {\n\t\tif (current instanceof HTMLElement && current.hasAttribute('data-block-id')) {\n\t\t\treturn current;\n\t\t}\n\t\tcurrent = current.parentNode;\n\t}\n\treturn null;\n}\n"],"mappings":"O,kCAcA,SAAgBE,EAAmBC,EAAaF,GAC/C,MAAMG,EAAKC,SAASC,cAAcH,GAElC,OADAC,EAAGG,aAAa,gBAAiBN,GAC1BG,CACR,CAGA,SAAgBI,EAAeC,EAAwBC,GACtD,MAAMC,EAAkB,GACxB,IAAIC,EAA8BF,EAClC,KAAOE,GAAWA,IAAYH,GACzBG,EAAQC,aAAa,kBACxBF,EAAKG,QAAQd,EAAUY,EAAQG,aAAa,kBAAoB,KAEjEH,EAAUA,EAAQI,cAEnB,OAAOL,CACR,CAGA,SAAgBM,EAAkBR,EAAwBS,GACzD,IAAIN,EAAuBM,EAC3B,KAAON,GAAWA,IAAYH,GAAW,CACxC,GAAIG,aAAmBO,aAAeP,EAAQC,aAAa,iBAC1D,OAAOD,EAERA,EAAUA,EAAQQ,UACnB,CACA,OAAO,IACR,Q"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditorEventBoundary-zpYRxryo.mjs","names":[],"sources":["../../src/platform/EditorEventBoundary.ts"],"sourcesContent":["/**\n * Returns whether a node belongs to the editor's document surface.\n *\n * Plugin controls may live inside the content element so they inherit the\n * editor's styles and positioning context. Form controls and descendants of a\n * `contenteditable=\"false\"` boundary retain native behavior and must never be\n * interpreted as document input or selection.\n */\nexport function isNodeFromEditorContent(target: Node | null, contentElement: HTMLElement): boolean {\n\tif (!target || !contentElement.contains(target)) return false;\n\n\tconst targetElement: Element | null = target instanceof Element ? target : target.parentElement;\n\tif (!targetElement || targetElement === contentElement) return true;\n\n\tif (targetElement.closest('input, textarea, select')) return false;\n\n\tconst nonEditableBoundary: Element | null = targetElement.closest('[contenteditable=\"false\"]');\n\treturn !nonEditableBoundary || nonEditableBoundary === contentElement;\n}\n\n/** Event wrapper around {@link isNodeFromEditorContent}. */\nexport function isEventFromEditorContent(event: Event, contentElement: HTMLElement): boolean {\n\treturn isNodeFromEditorContent(event.target as Node | null, contentElement);\n}\n"],"mappings":"AAQA,
|
|
1
|
+
{"version":3,"file":"EditorEventBoundary-zpYRxryo.mjs","names":["isNodeFromEditorContent","target","contentElement","contains","targetElement","Element","parentElement","closest","nonEditableBoundary","isEventFromEditorContent","event"],"sources":["../../src/platform/EditorEventBoundary.ts"],"sourcesContent":["/**\n * Returns whether a node belongs to the editor's document surface.\n *\n * Plugin controls may live inside the content element so they inherit the\n * editor's styles and positioning context. Form controls and descendants of a\n * `contenteditable=\"false\"` boundary retain native behavior and must never be\n * interpreted as document input or selection.\n */\nexport function isNodeFromEditorContent(target: Node | null, contentElement: HTMLElement): boolean {\n\tif (!target || !contentElement.contains(target)) return false;\n\n\tconst targetElement: Element | null = target instanceof Element ? target : target.parentElement;\n\tif (!targetElement || targetElement === contentElement) return true;\n\n\tif (targetElement.closest('input, textarea, select')) return false;\n\n\tconst nonEditableBoundary: Element | null = targetElement.closest('[contenteditable=\"false\"]');\n\treturn !nonEditableBoundary || nonEditableBoundary === contentElement;\n}\n\n/** Event wrapper around {@link isNodeFromEditorContent}. */\nexport function isEventFromEditorContent(event: Event, contentElement: HTMLElement): boolean {\n\treturn isNodeFromEditorContent(event.target as Node | null, contentElement);\n}\n"],"mappings":"AAQA,SAAgBA,EAAwBC,EAAqBC,GAC5D,IAAKD,IAAWC,EAAeC,SAASF,GAAS,OAAO,EAExD,MAAMG,EAAgCH,aAAkBI,QAAUJ,EAASA,EAAOK,cAClF,IAAKF,GAAiBA,IAAkBF,EAAgB,OAAO,EAE/D,GAAIE,EAAcG,QAAQ,2BAA4B,OAAO,EAE7D,MAAMC,EAAsCJ,EAAcG,QAAQ,6BAClE,OAAQC,GAAuBA,IAAwBN,CACxD,CAGA,SAAgBO,EAAyBC,EAAcR,GACtD,OAAOF,EAAwBU,EAAMT,OAAuBC,EAC7D,Q"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{i as t}from"./TypeBrands-Ch9856Gb.mjs";import{i as e,n as o,r as n,t as i}from"./AttributedMarkCommands-DKHuhZA7.mjs";import{c as s,n as r,o as a}from"./PluginHelpers-B3gk3VB3.mjs";import{c as l,n as c}from"./StyleRuntime-C0RSqKzG.mjs";import{r as m}from"./ColorValidation-ZBKZ_gTr.mjs";import{n as f,t as p}from"./InlineStyleMarkSpec-BhfGgfH9.mjs";import{t as d}from"./StyleClassNames-BsAx7k5T.mjs";var h={label:"Font",tooltip:"Font Family"},g=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar-DahJwMI9.mjs"),"./locales/de.ts":()=>import("./de-DiPz7abS.mjs"),"./locales/es.ts":()=>import("./es-CCQFu1t1.mjs"),"./locales/fr.ts":()=>import("./fr-BwWrFThE.mjs"),"./locales/hi.ts":()=>import("./hi-B-ZuX4aN.mjs"),"./locales/pt.ts":()=>import("./pt-Dg2ctkug.mjs"),"./locales/ru.ts":()=>import("./ru-DJMpeuey.mjs"),"./locales/zh.ts":()=>import("./zh-CRsDvfPR.mjs")});async function u(t){return s(g,t,h)}var y={type:"font",rank:6,valueAttr:"family",domStyleProperty:"fontFamily",cssProperty:"font-family",validate:m,transformParsed:t=>t.replace(/"/g,"'")},v=class{id="font";name="Font";priority=22;config;locale;injectedStyleElement=null;context=null;constructor(t){this.config=t}async init(t){this.locale=await a(t,this.config.locale,h,u),t.registerStyleSheet(".notectl-toolbar-btn--font{min-width:100px;max-width:160px}.notectl-font-picker{min-width:200px;max-height:320px;overflow-y:auto}.notectl-font-picker__list{padding:4px 0}.notectl-font-picker__item{cursor:pointer;width:100%;color:var(--notectl-fg);text-align:start;white-space:nowrap;background:0 0;border:none;align-items:center;gap:8px;padding:7px 12px;font-family:inherit;font-size:14px;line-height:1.4;transition:background .1s;display:flex}@media (hover:hover){.notectl-font-picker__item:hover{background:var(--notectl-hover-bg)}}.notectl-font-picker__item--active{background:var(--notectl-active-bg);color:var(--notectl-accent-fg)}@media (hover:hover){.notectl-font-picker__item--active:hover{background:var(--notectl-active-bg)}}.notectl-font-picker__check{width:16px;color:var(--notectl-accent-fg);flex-shrink:0;justify-content:center;align-items:center;font-size:13px;font-weight:600;display:inline-flex}.notectl-font-picker__label{flex:1}.notectl-font-picker__separator{background:var(--notectl-border);height:1px;margin:4px 8px}"),this.context=t,this.registerMarkSpec(t),this.registerStyleClasses(t),this.registerCommands(t),this.config.fonts.length>0&&this.registerToolbarItem(t),this.injectFontFaces()}destroy(){this.injectedStyleElement?.remove(),this.injectedStyleElement=null,this.context=null}registerMarkSpec(t){const e=this.config.fonts.map(t=>t.family);t.registerMarkSpec(p({...y,knownValues:e}))}registerStyleClasses(t){d(t,"FontPlugin",this.config.styleClasses,t=>f(y.cssProperty,this.familyOf(t)))}familyOf(t){const e=this.config.fonts.find(e=>e.name===t);if(e)return e.family;const o=this.config.fonts.map(t=>`"${t.name}"`).join(", ")||"none";throw new TypeError(`"${t}" is not the name of a configured font; configured: ${o}.`)}registerCommands(t){t.registerCommand("removeFont",()=>{const e=t.getState();return this.removeFont(t,e)}),t.registerCommand("setFont",()=>!1)}get defaultFont(){if(this.config.defaultFont){const t=this.config.fonts.find(t=>t.name===this.config.defaultFont);if(t)return t}return this.config.fonts[0]}registerToolbarItem(t){t.registerToolbarItem({id:"font",group:"format",label:this.locale.label,tooltip:this.locale.tooltip,command:"removeFont",popupType:"combobox",getLabel:t=>this.resolveFontName(this.getActiveFont(t)),renderPopup:(t,e,o)=>{this.renderFontPopup(t,e,o)},isActive:t=>this.isFontActive(t)})}resolveFontName(t){return t?this.config.fonts.find(e=>e.family===t)?.name??(t.split(",")[0]??"").trim().replace(/['"]/g,""):this.defaultFont?.name??this.locale.label}isFontActive(t){return n(t,"font")}getActiveFont(t){return o(t,"font",t=>t.attrs.family??null)}applyFont(e,o,n){const s={type:t("font"),attrs:{family:n}};return r(e,i(o,s))}removeFont(o,n){return r(o,e(n,t("font")))}injectFontFaces(){const t=[];for(const n of this.config.fonts)if(n.fontFaces?.length)for(const e of n.fontFaces){const o=[`font-family: '${(n.family.split(",")[0]??"").trim().replace(/['"]/g,"")}'`,`src: ${e.src}`];e.weight&&o.push(`font-weight: ${e.weight}`),e.style&&o.push(`font-style: ${e.style}`),o.push(`font-display: ${e.display??"swap"}`),t.push(`@font-face {\n\t${o.join(";\n\t")};\n}`)}if(0===t.length)return;const e=document.createElement("style");e.setAttribute("data-notectl-fonts","");const o=this.context?c(this.context.getContainer()):void 0;o&&e.setAttribute("nonce",o),e.textContent=t.join("\n\n"),document.head.appendChild(e),this.injectedStyleElement=e}renderFontPopup(t,e,o){t.classList.add("notectl-font-picker");const n=e.getState(),i=this.getActiveFont(n),s=this.defaultFont?.family,r=e.getContainer(),a=document.createElement("div");a.className="notectl-font-picker__list",a.setAttribute("role","listbox"),a.setAttribute("aria-label",this.locale.label);for(const l of this.config.fonts){const t=void 0!==s&&l.family===s,n=t&&!i||i===l.family,c=this.createFontItem(l.name,l.family,n,()=>{t?e.executeCommand("removeFont"):this.applyFont(e,e.getState(),l.family),o({restoreFocusTo:r})});l.category&&c.setAttribute("data-category",l.category),a.appendChild(c)}t.appendChild(a)}createFontItem(t,e,o,n){const i=document.createElement("button");i.type="button",i.className="notectl-font-picker__item",i.setAttribute("role","option"),i.setAttribute("aria-selected",String(o)),o&&i.classList.add("notectl-font-picker__item--active");const s=document.createElement("span");s.className="notectl-font-picker__check",s.textContent=o?"✓":"",i.appendChild(s);const r=document.createElement("span");return r.className="notectl-font-picker__label",r.textContent=t,e&&l(r,"fontFamily",e),i.appendChild(r),i.addEventListener("mousedown",t=>{t.preventDefault(),t.stopPropagation()}),i.addEventListener("click",n),i}};export{h as n,u as r,v as t};
|
|
2
|
+
//# sourceMappingURL=FontPlugin-BcXNFqqO.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FontPlugin-BcXNFqqO.mjs","names":["FONT_SELECT_CSS","markType","removeAttributedMark","getMarkAttrAtSelection","isAttributedMarkActive","applyAttributedMark","loadLocaleModule","dispatchIfPresent","resolveLocale","setStyleProperty","getStyleNonceForNode","isValidCSSFontFamily","styleDeclaration","createInlineStyleMarkSpec","registerStyleClassNames","FONT_LOCALE_EN","label","tooltip","localeModules","Object","assign","async","loadFontLocale","lang","FONT_MARK","type","rank","valueAttr","domStyleProperty","cssProperty","validate","transformParsed","family","replace","FontPlugin","id","name","priority","config","locale","injectedStyleElement","context","constructor","this","init","registerStyleSheet","registerMarkSpec","registerStyleClasses","registerCommands","fonts","length","registerToolbarItem","injectFontFaces","destroy","remove","knownValues","map","font","styleClasses","key","familyOf","find","f","names","join","TypeError","registerCommand","state","getState","removeFont","defaultFont","found","group","command","popupType","getLabel","resolveFontName","getActiveFont","renderPopup","container","ctx","onClose","renderFontPopup","isActive","isFontActive","split","trim","m","attrs","applyFont","mark","rules","fontFaces","face","declarations","src","weight","push","style","display","document","createElement","setAttribute","nonce","getContainer","textContent","head","appendChild","classList","add","activeFont","defaultFamily","contentElement","list","className","isDefault","item","createFontItem","executeCommand","restoreFocusTo","category","onActivate","String","check","addEventListener","e","preventDefault","stopPropagation"],"sources":["../../src/editor/styles/font-select.css?inline","../../src/plugins/font/FontLocale.ts","../../src/plugins/font/FontPlugin.ts"],"sourcesContent":["/** Font picker toolbar combobox + popup styles. */\n/* Font Select — Width overrides for combobox button */\n.notectl-toolbar-btn--font {\n\tmin-width: 100px;\n\tmax-width: 160px;\n}\n\n/* Font Picker Popup */\n.notectl-font-picker {\n\tmin-width: 200px;\n\tmax-height: 320px;\n\toverflow-y: auto;\n}\n\n.notectl-font-picker__list {\n\tpadding: 4px 0;\n}\n\n.notectl-font-picker__item {\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 8px;\n\twidth: 100%;\n\tpadding: 7px 12px;\n\tborder: none;\n\tbackground: none;\n\tcursor: pointer;\n\tfont-size: 14px;\n\tcolor: var(--notectl-fg);\n\tline-height: 1.4;\n\ttext-align: start;\n\twhite-space: nowrap;\n\tfont-family: inherit;\n\ttransition: background 0.1s;\n}\n\n@media (hover: hover) {\n\t.notectl-font-picker__item:hover {\n\t\tbackground: var(--notectl-hover-bg);\n\t}\n}\n\n.notectl-font-picker__item--active {\n\tbackground: var(--notectl-active-bg);\n\tcolor: var(--notectl-accent-fg);\n}\n\n@media (hover: hover) {\n\t.notectl-font-picker__item--active:hover {\n\t\tbackground: var(--notectl-active-bg);\n\t}\n}\n\n.notectl-font-picker__check {\n\tdisplay: inline-flex;\n\talign-items: center;\n\tjustify-content: center;\n\twidth: 16px;\n\tflex-shrink: 0;\n\tfont-size: 13px;\n\tfont-weight: 600;\n\tcolor: var(--notectl-accent-fg);\n}\n\n.notectl-font-picker__label {\n\tflex: 1;\n}\n\n.notectl-font-picker__separator {\n\theight: 1px;\n\tbackground: var(--notectl-border);\n\tmargin: 4px 8px;\n}\n","/** Locale interface and default English locale for the FontPlugin. */\n\nimport { type LocaleModuleMap, loadLocaleModule } from '../shared/LocaleLoader.js';\n\n// --- Locale Interface ---\n\nexport interface FontLocale {\n\treadonly label: string;\n\treadonly tooltip: string;\n}\n\n// --- Default English Locale ---\n\nexport const FONT_LOCALE_EN: FontLocale = {\n\tlabel: 'Font',\n\ttooltip: 'Font Family',\n};\n\n// --- Lazy Locale Loader ---\n\nconst localeModules: LocaleModuleMap<FontLocale> = import.meta.glob<{\n\tdefault: FontLocale;\n}>('./locales/*.ts', { eager: false });\n\nexport async function loadFontLocale(lang: string): Promise<FontLocale> {\n\treturn loadLocaleModule(localeModules, lang, FONT_LOCALE_EN);\n}\n","/**\n * FontPlugin: registers a font-family mark, a combobox-style toolbar selector\n * for font selection, and a developer-friendly API for registering custom fonts\n * (WOFF2, TTF, OTF).\n */\n\nimport {\n\tapplyAttributedMark,\n\tgetMarkAttrAtSelection,\n\tisAttributedMarkActive,\n\tremoveAttributedMark,\n} from '../../commands/AttributedMarkCommands.js';\nimport FONT_SELECT_CSS from '../../editor/styles/font-select.css?inline';\nimport type { StyleClassNames } from '../../model/StyleClass.js';\nimport { markType } from '../../model/TypeBrands.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport { getStyleNonceForNode, setStyleProperty } from '../../style/StyleRuntime.js';\nimport type { Plugin, PluginContext } from '../Plugin.js';\nimport { isValidCSSFontFamily } from '../shared/ColorValidation.js';\nimport {\n\ttype InlineStyleMarkConfig,\n\tcreateInlineStyleMarkSpec,\n\tstyleDeclaration,\n} from '../shared/InlineStyleMarkSpec.js';\nimport { dispatchIfPresent, resolveLocale } from '../shared/PluginHelpers.js';\nimport type { PopupCloseOptions } from '../shared/PopupManager.js';\nimport { registerStyleClassNames } from '../shared/StyleClassNames.js';\nimport { FONT_LOCALE_EN, type FontLocale, loadFontLocale } from './FontLocale.js';\n\n// --- Attribute Registry Augmentation ---\n\ndeclare module '../../model/AttrRegistry.js' {\n\tinterface MarkAttrRegistry {\n\t\tfont: { family: string };\n\t}\n}\n\n// --- Public Types ---\n\n/** Describes a single @font-face source. */\nexport interface FontFaceDescriptor {\n\t/** CSS `src` value, e.g. `\"url('/fonts/My.woff2') format('woff2')\"`. */\n\treadonly src: string;\n\t/** Font weight, e.g. `'400'` or `'300 700'` for variable fonts. */\n\treadonly weight?: string;\n\t/** Font style, e.g. `'normal'` or `'italic'`. */\n\treadonly style?: string;\n\t/** Font display strategy. Defaults to `'swap'`. */\n\treadonly display?: string;\n}\n\n/** Defines a font available in the editor. */\nexport interface FontDefinition {\n\t/** Display name shown in the toolbar dropdown. */\n\treadonly name: string;\n\t/** CSS `font-family` value, e.g. `\"'Fira Code', monospace\"`. */\n\treadonly family: string;\n\t/** Font category for grouping in the UI. */\n\treadonly category?: 'serif' | 'sans-serif' | 'monospace' | 'display' | 'handwriting';\n\t/**\n\t * Optional `@font-face` descriptors. When provided, the plugin\n\t * auto-injects the corresponding CSS rules into the document.\n\t */\n\treadonly fontFaces?: readonly FontFaceDescriptor[];\n}\n\n// --- Configuration ---\n\nexport interface FontConfig {\n\t/**\n\t * Fonts available in the editor. System fonts require no `fontFaces`.\n\t * Custom fonts with `fontFaces` get their `@font-face` rules auto-injected.\n\t *\n\t * Use `STARTER_FONTS` for a pre-configured set of fonts:\n\t * ```ts\n\t * new FontPlugin({ fonts: [...STARTER_FONTS] })\n\t * ```\n\t */\n\treadonly fonts: readonly FontDefinition[];\n\t/**\n\t * Name of the font that acts as the editor's default.\n\t * Selecting this font removes the mark (since the editor already uses it).\n\t * Defaults to the first font in the list.\n\t */\n\treadonly defaultFont?: string;\n\t/**\n\t * Your own CSS class per font in HTML content, keyed by font name, e.g.\n\t * `{ 'Fira Code': 'font-mono' }`. Class-based export (`getContentHTML({ cssMode: 'classes' })`)\n\t * writes these classes instead of generated `notectl-s-*` names, and HTML import\n\t * and paste recognize them, so content round-trips with your stylesheet. Keys must\n\t * name fonts in `fonts`. Invalid keys or class names make editor initialization\n\t * fail with a `TypeError` that explains the fix.\n\t */\n\treadonly styleClasses?: StyleClassNames<string>;\n\treadonly locale?: FontLocale;\n}\n\n/** The font mark: one `font-family` declaration per text run. */\nconst FONT_MARK: InlineStyleMarkConfig = {\n\ttype: 'font',\n\trank: 6,\n\tvalueAttr: 'family',\n\tdomStyleProperty: 'fontFamily',\n\tcssProperty: 'font-family',\n\tvalidate: isValidCSSFontFamily,\n\t// Browsers normalize CSS quotes to double-quotes; our internal\n\t// convention uses single-quotes.\n\ttransformParsed: (family: string) => family.replace(/\"/g, \"'\"),\n};\n\n// --- Plugin ---\n\nexport class FontPlugin implements Plugin {\n\treadonly id = 'font';\n\treadonly name = 'Font';\n\treadonly priority = 22;\n\n\tprivate readonly config: FontConfig;\n\tprivate locale!: FontLocale;\n\tprivate injectedStyleElement: HTMLStyleElement | null = null;\n\tprivate context: PluginContext | null = null;\n\n\tconstructor(config: FontConfig) {\n\t\tthis.config = config;\n\t}\n\n\tasync init(context: PluginContext): Promise<void> {\n\t\tthis.locale = await resolveLocale(context, this.config.locale, FONT_LOCALE_EN, loadFontLocale);\n\n\t\tcontext.registerStyleSheet(FONT_SELECT_CSS);\n\t\tthis.context = context;\n\t\tthis.registerMarkSpec(context);\n\t\tthis.registerStyleClasses(context);\n\t\tthis.registerCommands(context);\n\t\tif (this.config.fonts.length > 0) {\n\t\t\tthis.registerToolbarItem(context);\n\t\t}\n\t\tthis.injectFontFaces();\n\t}\n\n\tdestroy(): void {\n\t\tthis.injectedStyleElement?.remove();\n\t\tthis.injectedStyleElement = null;\n\t\tthis.context = null;\n\t}\n\n\t// --- Schema ---\n\n\tprivate registerMarkSpec(context: PluginContext): void {\n\t\tconst knownValues: readonly string[] = this.config.fonts.map((font) => font.family);\n\t\tcontext.registerMarkSpec(createInlineStyleMarkSpec({ ...FONT_MARK, knownValues }));\n\t}\n\n\tprivate registerStyleClasses(context: PluginContext): void {\n\t\tregisterStyleClassNames(context, 'FontPlugin', this.config.styleClasses, (key: string) =>\n\t\t\tstyleDeclaration(FONT_MARK.cssProperty, this.familyOf(key)),\n\t\t);\n\t}\n\n\t/** The family of a configured font name. Throws a `TypeError` for an unknown name. */\n\tprivate familyOf(name: string): string {\n\t\tconst font: FontDefinition | undefined = this.config.fonts.find((f) => f.name === name);\n\t\tif (font) return font.family;\n\t\tconst names: string = this.config.fonts.map((f) => `\"${f.name}\"`).join(', ') || 'none';\n\t\tthrow new TypeError(`\"${name}\" is not the name of a configured font; configured: ${names}.`);\n\t}\n\n\t// --- Commands ---\n\n\tprivate registerCommands(context: PluginContext): void {\n\t\tcontext.registerCommand('removeFont', () => {\n\t\t\tconst state: EditorState = context.getState();\n\t\t\treturn this.removeFont(context, state);\n\t\t});\n\n\t\tcontext.registerCommand('setFont', () => {\n\t\t\treturn false;\n\t\t});\n\t}\n\n\t// --- Toolbar ---\n\n\tprivate get defaultFont(): FontDefinition | undefined {\n\t\tif (this.config.defaultFont) {\n\t\t\tconst found: FontDefinition | undefined = this.config.fonts.find(\n\t\t\t\t(f) => f.name === this.config.defaultFont,\n\t\t\t);\n\t\t\tif (found) return found;\n\t\t}\n\t\treturn this.config.fonts[0];\n\t}\n\n\tprivate registerToolbarItem(context: PluginContext): void {\n\t\tcontext.registerToolbarItem({\n\t\t\tid: 'font',\n\t\t\tgroup: 'format',\n\t\t\tlabel: this.locale.label,\n\t\t\ttooltip: this.locale.tooltip,\n\t\t\tcommand: 'removeFont',\n\t\t\tpopupType: 'combobox',\n\t\t\tgetLabel: (state: EditorState): string => this.resolveFontName(this.getActiveFont(state)),\n\t\t\trenderPopup: (container, ctx, onClose) => {\n\t\t\t\tthis.renderFontPopup(container, ctx, onClose);\n\t\t\t},\n\t\t\tisActive: (state) => this.isFontActive(state),\n\t\t});\n\t}\n\n\tprivate resolveFontName(family: string | null): string {\n\t\tif (!family) return this.defaultFont?.name ?? this.locale.label;\n\t\tconst match: FontDefinition | undefined = this.config.fonts.find((f) => f.family === family);\n\t\treturn match?.name ?? (family.split(',')[0] ?? '').trim().replace(/['\"]/g, '');\n\t}\n\n\t// --- State Queries ---\n\n\tprivate isFontActive(state: EditorState): boolean {\n\t\treturn isAttributedMarkActive(state, 'font');\n\t}\n\n\tgetActiveFont(state: EditorState): string | null {\n\t\treturn getMarkAttrAtSelection(state, 'font', (m) => m.attrs.family ?? null);\n\t}\n\n\t// --- Font Application ---\n\n\tapplyFont(context: PluginContext, state: EditorState, family: string): boolean {\n\t\tconst mark = { type: markType('font'), attrs: { family } };\n\t\treturn dispatchIfPresent(context, applyAttributedMark(state, mark));\n\t}\n\n\tprivate removeFont(context: PluginContext, state: EditorState): boolean {\n\t\treturn dispatchIfPresent(context, removeAttributedMark(state, markType('font')));\n\t}\n\n\t// --- @font-face Injection ---\n\n\tprivate injectFontFaces(): void {\n\t\tconst rules: string[] = [];\n\n\t\tfor (const font of this.config.fonts) {\n\t\t\tif (!font.fontFaces?.length) continue;\n\n\t\t\tfor (const face of font.fontFaces) {\n\t\t\t\tconst familyName: string = (font.family.split(',')[0] ?? '').trim().replace(/['\"]/g, '');\n\t\t\t\tconst declarations: string[] = [`font-family: '${familyName}'`, `src: ${face.src}`];\n\t\t\t\tif (face.weight) {\n\t\t\t\t\tdeclarations.push(`font-weight: ${face.weight}`);\n\t\t\t\t}\n\t\t\t\tif (face.style) {\n\t\t\t\t\tdeclarations.push(`font-style: ${face.style}`);\n\t\t\t\t}\n\t\t\t\tdeclarations.push(`font-display: ${face.display ?? 'swap'}`);\n\n\t\t\t\trules.push(`@font-face {\\n\\t${declarations.join(';\\n\\t')};\\n}`);\n\t\t\t}\n\t\t}\n\n\t\tif (rules.length === 0) return;\n\n\t\tconst style: HTMLStyleElement = document.createElement('style');\n\t\tstyle.setAttribute('data-notectl-fonts', '');\n\t\tconst nonce = this.context ? getStyleNonceForNode(this.context.getContainer()) : undefined;\n\t\tif (nonce) {\n\t\t\tstyle.setAttribute('nonce', nonce);\n\t\t}\n\t\tstyle.textContent = rules.join('\\n\\n');\n\t\tdocument.head.appendChild(style);\n\t\tthis.injectedStyleElement = style;\n\t}\n\n\t// --- Popup Rendering ---\n\n\tprivate renderFontPopup(\n\t\tcontainer: HTMLElement,\n\t\tcontext: PluginContext,\n\t\tonClose: (options?: PopupCloseOptions) => void,\n\t): void {\n\t\tcontainer.classList.add('notectl-font-picker');\n\n\t\tconst state: EditorState = context.getState();\n\t\tconst activeFont: string | null = this.getActiveFont(state);\n\t\tconst defaultFamily: string | undefined = this.defaultFont?.family;\n\t\tconst contentElement: HTMLElement = context.getContainer();\n\n\t\tconst list: HTMLDivElement = document.createElement('div');\n\t\tlist.className = 'notectl-font-picker__list';\n\t\tlist.setAttribute('role', 'listbox');\n\t\tlist.setAttribute('aria-label', this.locale.label);\n\n\t\tfor (const font of this.config.fonts) {\n\t\t\tconst isDefault: boolean = defaultFamily !== undefined && font.family === defaultFamily;\n\t\t\tconst isActive: boolean = isDefault\n\t\t\t\t? !activeFont || activeFont === font.family\n\t\t\t\t: activeFont === font.family;\n\n\t\t\tconst item: HTMLButtonElement = this.createFontItem(font.name, font.family, isActive, () => {\n\t\t\t\tif (isDefault) {\n\t\t\t\t\tcontext.executeCommand('removeFont');\n\t\t\t\t} else {\n\t\t\t\t\tthis.applyFont(context, context.getState(), font.family);\n\t\t\t\t}\n\t\t\t\tonClose({ restoreFocusTo: contentElement });\n\t\t\t});\n\n\t\t\tif (font.category) {\n\t\t\t\titem.setAttribute('data-category', font.category);\n\t\t\t}\n\n\t\t\tlist.appendChild(item);\n\t\t}\n\n\t\tcontainer.appendChild(list);\n\t}\n\n\tprivate createFontItem(\n\t\tname: string,\n\t\tfamily: string,\n\t\tisActive: boolean,\n\t\tonActivate: () => void,\n\t): HTMLButtonElement {\n\t\tconst item: HTMLButtonElement = document.createElement('button');\n\t\titem.type = 'button';\n\t\titem.className = 'notectl-font-picker__item';\n\t\titem.setAttribute('role', 'option');\n\t\titem.setAttribute('aria-selected', String(isActive));\n\n\t\tif (isActive) {\n\t\t\titem.classList.add('notectl-font-picker__item--active');\n\t\t}\n\n\t\t// Checkmark indicator\n\t\tconst check: HTMLSpanElement = document.createElement('span');\n\t\tcheck.className = 'notectl-font-picker__check';\n\t\tcheck.textContent = isActive ? '\\u2713' : '';\n\t\titem.appendChild(check);\n\n\t\t// Font name label (rendered in the font itself for preview)\n\t\tconst label: HTMLSpanElement = document.createElement('span');\n\t\tlabel.className = 'notectl-font-picker__label';\n\t\tlabel.textContent = name;\n\t\tif (family) {\n\t\t\tsetStyleProperty(label, 'fontFamily', family);\n\t\t}\n\t\titem.appendChild(label);\n\n\t\titem.addEventListener('mousedown', (e: MouseEvent) => {\n\t\t\te.preventDefault();\n\t\t\te.stopPropagation();\n\t\t});\n\t\titem.addEventListener('click', onActivate);\n\t\treturn item;\n\t}\n}\n"],"mappings":"Y,+YCaae,EAA6B,CACzCC,MAAO,OACPC,QAAS,eAKJC,iBAA6CC,OAAAC,OAAA,CAAA,kBAAA,WAAA,qBAAA,kBAAA,WAAA,q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B,QAASH,GACxBL,CACR,U"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{J as t,P as e,V as n,k as o,z as i}from"./Document-ssR6hBzG.mjs";import{c as r,d as s,f as c,p as a}from"./Selection-DC6AOGgF.mjs";import{i as l}from"./TypeBrands-Ch9856Gb.mjs";import{i as f,n as u,r as d,t as p}from"./AttributedMarkCommands-DKHuhZA7.mjs";import{c as m,n as h,o as k}from"./PluginHelpers-B3gk3VB3.mjs";import{c as g}from"./StyleRuntime-C0RSqKzG.mjs";import{i as z}from"./ColorValidation-ZBKZ_gTr.mjs";import{n as b,t as S}from"./InlineStyleMarkSpec-BhfGgfH9.mjs";import{t as v}from"./StyleClassNames-BsAx7k5T.mjs";var x={label:"Font Size",tooltip:"Font Size",customFontSizeAria:"Custom font size",fontSizesAria:"Font sizes"},y=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar-BzqAYGER.mjs"),"./locales/de.ts":()=>import("./de-C-Yf378-.mjs"),"./locales/es.ts":()=>import("./es-CUKJujcb.mjs"),"./locales/fr.ts":()=>import("./fr-D0MDdoir.mjs"),"./locales/hi.ts":()=>import("./hi-B2uhiPCN.mjs"),"./locales/pt.ts":()=>import("./pt-BCXgUDiU.mjs"),"./locales/ru.ts":()=>import("./ru-DV-lgEtM.mjs"),"./locales/zh.ts":()=>import("./zh-oZl1P_p0.mjs")});async function _(t){return m(y,t,x)}function w(t){return void 0!==t?.attrs?.fontSize}function I(n){const o=n.selection;if(s(o)){const t=n.getBlock(o.nodeId);return t&&w(n.schema.getNodeSpec?.(t.type))?{kind:"block",path:n.getNodePath(o.nodeId)??[o.nodeId],attrs:t.attrs??{}}:null}const a=function(n){const o=n.selection;if(!c(o)||r(o))return null;if(o.anchor.blockId!==o.head.blockId)return null;const s=Math.min(o.anchor.offset,o.head.offset);if(Math.max(o.anchor.offset,o.head.offset)-s!==1)return null;const a=n.getBlock(o.anchor.blockId);if(!a)return null;for(const{child:r,from:c}of t(e(a)))if(c===s&&i(r))return{node:r,blockId:o.anchor.blockId,offset:s};return null}(n);return a&&w(n.schema.getInlineNodeSpec?.(a.node.inlineType))?{kind:"inline",blockId:a.blockId,offset:a.offset,attrs:a.node.attrs}:null}function N(t){const e=t?.fontSize;return"string"==typeof e&&e.length>0?e:null}function C(t,e){return{...t??{},fontSize:e}}function A(t){return N(t.attrs)}function j(t,e,n,o){const i=e.transaction("command");return"block"===n.kind?i.setNodeAttr(n.path,C(n.attrs,o)):i.setInlineNodeAttr(n.blockId,n.offset,C(n.attrs,o)),t.dispatch(i.build()),!0}var E=l("fontSize");function F(t){const e=t.selection;if(!c(e))return[];const n=t.getBlockOrder(),i=a(e,n),r=n.indexOf(i.from.blockId),s=n.indexOf(i.to.blockId),l=[];for(let c=r;c<=s;c++){const e=n[c];if(!e)continue;const a=t.getBlock(e);if(!a)continue;const f=c===r?i.from.offset:0,u=c===s?i.to.offset:o(a);w(t.schema.getNodeSpec?.(a.type))?l.push({kind:"blockNode",path:t.getNodePath(e)??[e],attrs:a.attrs??{}}):f!==u&&T(t,a,e,f,u,l)}return l}function T(t,o,i,r,s,c){let a,l=0,f=!1;for(const u of e(o))if(n(u)){const t=l+u.text.length;u.text.length>0&&t>r&&l<s&&(f=!0,a||(a=u.marks.find(t=>t.type===E))),l=t}else l>=r&&l<s&&w(t.schema.getInlineNodeSpec?.(u.inlineType))&&c.push({kind:"inlineNode",blockId:i,offset:l,attrs:u.attrs}),l+=1;f&&c.push({kind:"text",blockId:i,from:r,to:s,mark:a})}function M(t,e,n){const o=F(e);if(0===o.length)return!1;const i=e.transaction("command");let r=!1;for(const s of o){if("text"===s.kind){""===n?s.mark&&(i.removeMark(s.blockId,s.from,s.to,s.mark),r=!0):(s.mark&&i.removeMark(s.blockId,s.from,s.to,s.mark),i.addMark(s.blockId,s.from,s.to,{type:E,attrs:{size:n}}),r=!0);continue}const t=N(s.attrs);n===t||""===n&&null===t||("blockNode"===s.kind?i.setNodeAttr(s.path,C(s.attrs,n)):i.setInlineNodeAttr(s.blockId,s.offset,C(s.attrs,n)),r=!0)}return!!r&&(i.setSelection(e.selection),t.dispatch(i.build()),!0)}function P(t){const e=F(t).filter(t=>"text"!==t.kind).map(t=>t.attrs);return 0===e.length?null:new Set(e.map(t=>N(t)??""))}function L(t){return`${t}px`}function D(t,e){const n=function(t){const e=I(t);if(e)return A(e);const n=P(t);if(n&&1===n.size){const[t]=n;if(t)return t}return u(t,"fontSize",t=>t.attrs.size??null)}(t);if(!n)return e;const o=Number.parseInt(n,10);return Number.isNaN(o)?e:o}function O(t,e,n){const o=I(e);if(o)return j(t,e,o,n);const i=e.selection;if(!c(i))return!1;if(r(i)){const o={type:l("fontSize"),attrs:{size:n}};return h(t,p(e,o))}return M(t,e,n)}function B(t,e){const n=I(e);if(n)return null!==A(n)&&j(t,e,n,"");const o=e.selection;return!!c(o)&&(r(o)?h(t,f(e,l("fontSize"))):M(t,e,""))}function $(t,e,n,o,i){const r=function(t,e,n){if("up"===e){for(const e of n)if(e>t)return e;return null}for(let o=n.length-1;o>=0;o--){const e=n[o];if(void 0!==e&&e<t)return e}return null}(D(e,i),n,o);return null!==r&&(r===i?B(t,e):O(t,e,L(r)))}function V(t,e,n){e===n?t.executeCommand("removeFontSize"):O(t,t.getState(),L(e))}function K(t,e){const n=document.createElement("button");n.type="button",n.id=`notectl-font-size-option-${t}`,n.className="notectl-font-size-picker__item",n.setAttribute("role","option"),n.setAttribute("aria-selected",String(e)),e&&n.classList.add("notectl-font-size-picker__item--active");const o=document.createElement("span");o.className="notectl-font-size-picker__check",o.textContent=e?"✓":"",n.appendChild(o);const i=document.createElement("span");return i.className="notectl-font-size-picker__label",i.textContent=String(t),n.appendChild(i),n}var q=[8,9,10,11,12,14,16,18,20,24,28,32,36,48,64,72,96],H={type:"fontSize",rank:4,valueAttr:"size",domStyleProperty:"fontSize",cssProperty:"font-size",validate:z},J=/^[1-9]\d*$/,R=class{id="fontSize";name="Font Size";priority=21;config;sizes;defaultSize;locale;constructor(t){var e;this.config={...t},this.sizes=function(t){if(!t||0===t.length)return q;const e=[...new Set(t)].filter(t=>Number.isInteger(t)&&t>0);return e.sort((t,e)=>t-e),e.length>0?e:q}(t?.sizes),this.defaultSize=(e=t?.defaultSize,void 0===e?16:Number.isInteger(e)&&e>0?e:16)}async init(t){this.locale=await k(t,this.config.locale,x,_),t.registerStyleSheet(".notectl-toolbar-btn--fontSize{min-width:60px;max-width:80px}.notectl-font-size-picker{flex-direction:column;min-width:140px;display:flex}.notectl-font-size-picker__input-wrapper{padding:8px 8px 4px}.notectl-font-size-picker__input{border:1px solid var(--notectl-border);width:100%;color:var(--notectl-fg);background:var(--notectl-surface-overlay);box-sizing:border-box;-moz-appearance:textfield;border-radius:4px;outline:none;padding:6px 8px;font-family:inherit;font-size:13px}.notectl-font-size-picker__input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.notectl-font-size-picker__input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.notectl-font-size-picker__input:focus{border-color:var(--notectl-border-focus);box-shadow:0 0 0 2px var(--notectl-focus-ring)}.notectl-font-size-picker__list{max-height:280px;padding:4px 0;overflow-y:auto}.notectl-font-size-picker__item{cursor:pointer;width:100%;color:var(--notectl-fg);text-align:start;white-space:nowrap;background:0 0;border:none;outline:none;align-items:center;gap:8px;padding:7px 12px;font-family:inherit;font-size:14px;line-height:1.4;transition:background .1s;display:flex}@media (hover:hover){.notectl-font-size-picker__item:hover{background:var(--notectl-hover-bg)}}.notectl-font-size-picker__item--active{background:var(--notectl-active-bg);color:var(--notectl-accent-fg)}@media (hover:hover){.notectl-font-size-picker__item--active:hover{background:var(--notectl-active-bg)}}.notectl-font-size-picker__item--focused{outline:2px solid var(--notectl-primary);outline-offset:-2px}.notectl-font-size-picker__check{width:16px;color:var(--notectl-accent-fg);flex-shrink:0;justify-content:center;align-items:center;font-size:13px;font-weight:600;display:inline-flex}.notectl-font-size-picker__label{flex:1}"),this.registerMarkSpec(t),this.registerStyleClasses(t),this.registerCommands(t),this.registerKeymaps(t),this.registerToolbarItem(t),this.applyDefaultSizeToContainer(t)}destroy(){}registerMarkSpec(t){t.registerMarkSpec(S(H))}registerStyleClasses(t){v(t,"FontSizePlugin",this.config.styleClasses,t=>b(H.cssProperty,L(function(t){if(!J.test(t))throw new TypeError(`"${t}" is not a font size; use whole pixel numbers such as 18.`);return Number(t)}(t))))}registerCommands(t){t.registerCommand("removeFontSize",()=>B(t,t.getState())),t.registerCommand("setFontSize",()=>!1),t.registerCommand("increaseFontSize",()=>$(t,t.getState(),"up",this.sizes,this.defaultSize)),t.registerCommand("decreaseFontSize",()=>$(t,t.getState(),"down",this.sizes,this.defaultSize))}registerKeymaps(t){t.registerKeymap({"Mod-Shift-+":()=>$(t,t.getState(),"up",this.sizes,this.defaultSize),"Mod-Shift-_":()=>$(t,t.getState(),"down",this.sizes,this.defaultSize)})}registerToolbarItem(t){t.registerToolbarItem({id:"fontSize",group:"format",label:this.locale.label,tooltip:this.locale.tooltip,command:"removeFontSize",popupType:"combobox",getLabel:t=>String(D(t,this.defaultSize)),renderPopup:(t,e,n)=>{!function(t,e,n){t.classList.add("notectl-font-size-picker");const o=D(e.getState(),n.defaultSize),i=function(t,e){const n=document.createElement("input");return n.type="number",n.className="notectl-font-size-picker__input",n.min=String(1),n.max=String(400),n.value=String(t),n.setAttribute("aria-label",e.locale.customFontSizeAria),n}(o,n);!function(t,e){const n=document.createElement("div");n.className="notectl-font-size-picker__input-wrapper",n.appendChild(e),t.appendChild(n)}(t,i);const{list:r,items:s}=function(t,e,n,o){const i=document.createElement("div");i.className="notectl-font-size-picker__list",i.setAttribute("role","listbox"),i.setAttribute("aria-label",o.locale.fontSizesAria);const r=[];for(const s of t){const t=K(s,s===e);t.addEventListener("mousedown",t=>{t.preventDefault(),t.stopPropagation()}),t.addEventListener("click",()=>{V(n,s,o.defaultSize),o.onClose({restoreFocusTo:o.contentElement})}),r.push(t),i.appendChild(t)}return{list:i,items:r}}(n.sizes,o,e,n);t.appendChild(r),function(t,e,n,o){const i=e.indexOf(n);if(i<0)return;const r=t[i];r&&(requestAnimationFrame(()=>{r.scrollIntoView({block:"nearest"})}),o.setAttribute("aria-activedescendant",r.id))}(s,n.sizes,o,r),function(t,e,n,o,i){let r=-1;const s=t=>{r>=0&&r<n.length&&n[r]?.classList.remove("notectl-font-size-picker__item--focused"),r=t;const o=n[r];r>=0&&r<n.length&&o&&(o.classList.add("notectl-font-size-picker__item--focused"),o.scrollIntoView({block:"nearest"}),e.setAttribute("aria-activedescendant",o.id))},c=t=>{t.preventDefault(),t.stopPropagation()};t.addEventListener("keydown",e=>{if("Enter"===e.key){c(e);const n=Number.parseInt(t.value,10);!Number.isNaN(n)&&n>=1&&n<=400&&(V(o,n,i.defaultSize),i.onClose({restoreFocusTo:i.contentElement}))}else"ArrowDown"===e.key?(c(e),s(0),n[0]?.focus()):"Escape"===e.key&&(c(e),i.onClose({restoreFocusTo:i.contentElement}))}),e.addEventListener("keydown",e=>{"ArrowDown"===e.key?(c(e),r<n.length-1&&(s(r+1),n[r]?.focus())):"ArrowUp"===e.key?(c(e),r>0?(s(r-1),n[r]?.focus()):(s(-1),t.focus())):"Enter"===e.key?(c(e),n[r]?.click()):"Escape"===e.key&&(c(e),i.onClose({restoreFocusTo:i.contentElement}))})}(i,r,s,e,n)}(t,e,{sizes:this.sizes,defaultSize:this.defaultSize,onClose:n,contentElement:e.getContainer(),locale:this.locale})},isActive:t=>function(t){const e=I(t);if(e)return null!==A(e);const n=P(t);return!(!n||![...n].some(t=>t.length>0))||d(t,"fontSize")}(t)})}applyDefaultSizeToContainer(t){const e=t.getContainer();g(e,"fontSize",`${this.defaultSize}px`)}};export{x as n,_ as r,R as t};
|
|
2
|
+
//# sourceMappingURL=FontSizePlugin-Dswra3oU.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FontSizePlugin-Dswra3oU.mjs","names":["FONT_SIZE_SELECT_CSS","walkInlineContent","getInlineChildren","isTextNode","getBlockLength","isInlineNode","isCollapsed","isNodeSelection","isTextSelection","selectionRange","markType","removeAttributedMark","getMarkAttrAtSelection","isAttributedMarkActive","applyAttributedMark","loadLocaleModule","dispatchIfPresent","resolveLocale","setStyleProperty","isValidCSSFontSize","styleDeclaration","createInlineStyleMarkSpec","registerStyleClassNames","FONT_SIZE_LOCALE_EN","label","tooltip","customFontSizeAria","fontSizesAria","localeModules","Object","assign","async","loadFontSizeLocale","lang","specDeclaresFontSize","spec","attrs","fontSize","nodeFontSizeTarget","state","sel","selection","block","getBlock","nodeId","schema","getNodeSpec","type","kind","path","getNodePath","inline","anchor","blockId","head","from","Math","min","offset","max","child","childFrom","node","singleSelectedInlineNode","getInlineNodeSpec","inlineType","readFontSize","length","mergeFontSize","size","nodeFontSizeValue","target","dispatchNodeFontSize","context","builder","transaction","setNodeAttr","setInlineNodeAttr","dispatch","build","FONT_SIZE_TYPE","rangeCarriers","blockOrder","getBlockOrder","range","fromIdx","indexOf","toIdx","to","carriers","i","push","collectInlineCarriers","textMark","pos","hasText","end","text","marks","find","m","mark","dispatchRangeFontSize","changed","carrier","removeMark","addMark","current","setSelection","rangeNodeSizes","nodeAttrs","filter","map","Set","pixelFontSize","getActiveSizeNumeric","defaultSize","raw","sizes","only","getActiveSize","parsed","Number","parseInt","isNaN","applyFontSize","removeFontSize","stepFontSize","direction","next","getNextPresetSize","selectSize","executeCommand","getState","buildSizeItem","isActive","item","document","createElement","id","className","setAttribute","String","classList","add","check","textContent","appendChild","DEFAULT_FONT_SIZES","FONT_SIZE_MARK","rank","valueAttr","domStyleProperty","cssProperty","validate","PIXEL_SIZE_KEY","FontSizePlugin","name","priority","config","locale","constructor","this","unique","n","isInteger","sort","a","b","resolveSizes","init","registerStyleSheet","registerMarkSpec","registerStyleClasses","registerCommands","registerKeymaps","registerToolbarItem","applyDefaultSizeToContainer","destroy","styleClasses","key","test","TypeError","pixelSizeKey","registerCommand","registerKeymap","group","command","popupType","getLabel","renderPopup","container","ctx","onClose","currentSize","input","value","buildCustomInput","wrapper","appendInputWrapper","list","items","addEventListener","e","preventDefault","stopPropagation","restoreFocusTo","contentElement","buildSizeList","activeIdx","activeItem","requestAnimationFrame","scrollIntoView","scrollActiveIntoView","focusedIndex","setFocused","idx","remove","el","consume","val","focus","click","attachKeyboardNavigation","renderFontSizePopup","getContainer","some","isFontSizeActive"],"sources":["../../src/editor/styles/font-size-select.css?inline","../../src/plugins/font-size/FontSizeLocale.ts","../../src/plugins/font-size/FontSizeOperations.ts","../../src/plugins/font-size/FontSizePopup.ts","../../src/plugins/font-size/FontSizePlugin.ts"],"sourcesContent":["/** Font size picker toolbar combobox + popup styles. */\n/* Font Size Select — Width overrides for combobox button */\n.notectl-toolbar-btn--fontSize {\n\tmin-width: 60px;\n\tmax-width: 80px;\n}\n\n/* Font Size Picker Popup */\n.notectl-font-size-picker {\n\tmin-width: 140px;\n\tdisplay: flex;\n\tflex-direction: column;\n}\n\n.notectl-font-size-picker__input-wrapper {\n\tpadding: 8px 8px 4px;\n}\n\n.notectl-font-size-picker__input {\n\twidth: 100%;\n\tpadding: 6px 8px;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 4px;\n\tfont-size: 13px;\n\tfont-family: inherit;\n\tcolor: var(--notectl-fg);\n\tbackground: var(--notectl-surface-overlay);\n\toutline: none;\n\tbox-sizing: border-box;\n\t-moz-appearance: textfield;\n}\n\n.notectl-font-size-picker__input::-webkit-inner-spin-button,\n.notectl-font-size-picker__input::-webkit-outer-spin-button {\n\t-webkit-appearance: none;\n\tmargin: 0;\n}\n\n.notectl-font-size-picker__input:focus {\n\tborder-color: var(--notectl-border-focus);\n\tbox-shadow: 0 0 0 2px var(--notectl-focus-ring);\n}\n\n.notectl-font-size-picker__list {\n\tmax-height: 280px;\n\toverflow-y: auto;\n\tpadding: 4px 0;\n}\n\n.notectl-font-size-picker__item {\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 8px;\n\twidth: 100%;\n\tpadding: 7px 12px;\n\tborder: none;\n\tbackground: none;\n\tcursor: pointer;\n\tfont-size: 14px;\n\tcolor: var(--notectl-fg);\n\tline-height: 1.4;\n\ttext-align: start;\n\twhite-space: nowrap;\n\tfont-family: inherit;\n\ttransition: background 0.1s;\n\toutline: none;\n}\n\n@media (hover: hover) {\n\t.notectl-font-size-picker__item:hover {\n\t\tbackground: var(--notectl-hover-bg);\n\t}\n}\n\n.notectl-font-size-picker__item--active {\n\tbackground: var(--notectl-active-bg);\n\tcolor: var(--notectl-accent-fg);\n}\n\n@media (hover: hover) {\n\t.notectl-font-size-picker__item--active:hover {\n\t\tbackground: var(--notectl-active-bg);\n\t}\n}\n\n.notectl-font-size-picker__item--focused {\n\toutline: 2px solid var(--notectl-primary);\n\toutline-offset: -2px;\n}\n\n.notectl-font-size-picker__check {\n\tdisplay: inline-flex;\n\talign-items: center;\n\tjustify-content: center;\n\twidth: 16px;\n\tflex-shrink: 0;\n\tfont-size: 13px;\n\tfont-weight: 600;\n\tcolor: var(--notectl-accent-fg);\n}\n\n.notectl-font-size-picker__label {\n\tflex: 1;\n}\n","/** Locale interface and default English locale for the FontSizePlugin. */\n\nimport { type LocaleModuleMap, loadLocaleModule } from '../shared/LocaleLoader.js';\n\n// --- Locale Interface ---\n\nexport interface FontSizeLocale {\n\treadonly label: string;\n\treadonly tooltip: string;\n\treadonly customFontSizeAria: string;\n\treadonly fontSizesAria: string;\n}\n\n// --- Default English Locale ---\n\nexport const FONT_SIZE_LOCALE_EN: FontSizeLocale = {\n\tlabel: 'Font Size',\n\ttooltip: 'Font Size',\n\tcustomFontSizeAria: 'Custom font size',\n\tfontSizesAria: 'Font sizes',\n};\n\n// --- Lazy Locale Loader ---\n\nconst localeModules: LocaleModuleMap<FontSizeLocale> = import.meta.glob<{\n\tdefault: FontSizeLocale;\n}>('./locales/*.ts', { eager: false });\n\nexport async function loadFontSizeLocale(lang: string): Promise<FontSizeLocale> {\n\treturn loadLocaleModule(localeModules, lang, FONT_SIZE_LOCALE_EN);\n}\n","/**\n * Pure business logic for font-size state queries and transaction builders.\n * All functions are DOM-free and operate on EditorState / PluginContext.\n *\n * Delegates to the generic AttributedMarkCommands helpers for the\n * collapsed-vs-range branching logic.\n */\n\nimport {\n\tapplyAttributedMark,\n\tgetMarkAttrAtSelection,\n\tisAttributedMarkActive,\n\tremoveAttributedMark,\n} from '../../commands/AttributedMarkCommands.js';\nimport type { BlockAttrs, BlockNode, InlineNode, Mark } from '../../model/Document.js';\nimport {\n\tgetBlockLength,\n\tgetInlineChildren,\n\tisInlineNode,\n\tisTextNode,\n\twalkInlineContent,\n} from '../../model/Document.js';\nimport {\n\tisCollapsed,\n\tisNodeSelection,\n\tisTextSelection,\n\tselectionRange,\n} from '../../model/Selection.js';\nimport { type BlockId, type MarkTypeName, markType } from '../../model/TypeBrands.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { PluginContext } from '../Plugin.js';\nimport { dispatchIfPresent } from '../shared/PluginHelpers.js';\n\n// --- Node-level font sizing ---\n//\n// Marks only apply to text, so they cannot size atomic nodes such as a formula\n// (an inline node carries no marks; a display formula is a void block). Instead,\n// a node opts into font sizing by declaring a `fontSize` attribute in its schema\n// spec; the font-size controls then read/write that attribute. This stays generic\n// (no formula-specific coupling) — any node or inline node can opt in the same way.\n\ntype InlineNodeAttrs = Readonly<Record<string, string | number | boolean>>;\n\ntype NodeFontSizeTarget =\n\t| { readonly kind: 'block'; readonly path: readonly BlockId[]; readonly attrs: BlockAttrs }\n\t| {\n\t\t\treadonly kind: 'inline';\n\t\t\treadonly blockId: BlockId;\n\t\t\treadonly offset: number;\n\t\t\treadonly attrs: InlineNodeAttrs;\n\t };\n\nfunction specDeclaresFontSize(\n\tspec: { readonly attrs?: Readonly<Record<string, unknown>> } | undefined,\n): boolean {\n\treturn spec?.attrs?.fontSize !== undefined;\n}\n\n/**\n * Resolves the node the current selection targets for font sizing, when that\n * node's schema spec declares a `fontSize` attribute: a void/selectable block\n * under a NodeSelection, or a single atomic inline node under a width-1 text\n * selection. Returns null for ordinary text (which uses the fontSize mark).\n */\nfunction nodeFontSizeTarget(state: EditorState): NodeFontSizeTarget | null {\n\tconst sel = state.selection;\n\tif (isNodeSelection(sel)) {\n\t\tconst block = state.getBlock(sel.nodeId);\n\t\tif (!block || !specDeclaresFontSize(state.schema.getNodeSpec?.(block.type))) return null;\n\t\tconst path: readonly BlockId[] = state.getNodePath(sel.nodeId) ?? [sel.nodeId];\n\t\treturn { kind: 'block', path, attrs: block.attrs ?? {} };\n\t}\n\tconst inline = singleSelectedInlineNode(state);\n\tif (inline && specDeclaresFontSize(state.schema.getInlineNodeSpec?.(inline.node.inlineType))) {\n\t\treturn {\n\t\t\tkind: 'inline',\n\t\t\tblockId: inline.blockId,\n\t\t\toffset: inline.offset,\n\t\t\tattrs: inline.node.attrs,\n\t\t};\n\t}\n\treturn null;\n}\n\n/** Returns the single inline node a width-1 text selection covers, if any. */\nfunction singleSelectedInlineNode(\n\tstate: EditorState,\n): { readonly node: InlineNode; readonly blockId: BlockId; readonly offset: number } | null {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel) || isCollapsed(sel)) return null;\n\tif (sel.anchor.blockId !== sel.head.blockId) return null;\n\tconst from: number = Math.min(sel.anchor.offset, sel.head.offset);\n\tconst to: number = Math.max(sel.anchor.offset, sel.head.offset);\n\tif (to - from !== 1) return null;\n\n\tconst block = state.getBlock(sel.anchor.blockId);\n\tif (!block) return null;\n\tfor (const { child, from: childFrom } of walkInlineContent(getInlineChildren(block))) {\n\t\tif (childFrom === from && isInlineNode(child)) {\n\t\t\treturn { node: child, blockId: sel.anchor.blockId, offset: from };\n\t\t}\n\t}\n\treturn null;\n}\n\n/** Reads a fontSize attr value from raw attrs, or null when unset. */\nfunction readFontSize(attrs: BlockAttrs | InlineNodeAttrs | undefined): string | null {\n\tconst fontSize = attrs?.fontSize;\n\treturn typeof fontSize === 'string' && fontSize.length > 0 ? fontSize : null;\n}\n\n/** Merges a fontSize value ('' clears it) into existing attrs, preserving the rest. */\nfunction mergeFontSize(\n\tattrs: InlineNodeAttrs | undefined,\n\tsize: string,\n): Record<string, string | number | boolean>;\nfunction mergeFontSize(attrs: BlockAttrs | undefined, size: string): BlockAttrs;\nfunction mergeFontSize(attrs: BlockAttrs | InlineNodeAttrs | undefined, size: string): BlockAttrs {\n\treturn { ...(attrs ?? {}), fontSize: size };\n}\n\n/** The node's current fontSize value, or null when unset. */\nfunction nodeFontSizeValue(target: NodeFontSizeTarget): string | null {\n\treturn readFontSize(target.attrs);\n}\n\n/** Writes `size` (or '' to clear) onto a single target node's fontSize attr. */\nfunction dispatchNodeFontSize(\n\tcontext: PluginContext,\n\tstate: EditorState,\n\ttarget: NodeFontSizeTarget,\n\tsize: string,\n): boolean {\n\tconst builder = state.transaction('command');\n\tif (target.kind === 'block') {\n\t\tbuilder.setNodeAttr(target.path, mergeFontSize(target.attrs, size));\n\t} else {\n\t\tbuilder.setInlineNodeAttr(target.blockId, target.offset, mergeFontSize(target.attrs, size));\n\t}\n\tcontext.dispatch(builder.build());\n\treturn true;\n}\n\n// --- Range carriers (text marks + font-size-aware nodes) ---\n//\n// A font-size operation over a selection range touches every \"carrier\" it spans:\n// text runs (which take the fontSize mark) and atomic font-size-aware nodes such\n// as formulas (which take the fontSize attr). This is what lets a select-all that\n// includes a formula resize the formula alongside the surrounding text.\n\nconst FONT_SIZE_TYPE: MarkTypeName = markType('fontSize');\n\ntype FontSizeCarrier =\n\t| {\n\t\t\treadonly kind: 'text';\n\t\t\treadonly blockId: BlockId;\n\t\t\treadonly from: number;\n\t\t\treadonly to: number;\n\t\t\treadonly mark: Mark | undefined;\n\t }\n\t| { readonly kind: 'blockNode'; readonly path: readonly BlockId[]; readonly attrs: BlockAttrs }\n\t| {\n\t\t\treadonly kind: 'inlineNode';\n\t\t\treadonly blockId: BlockId;\n\t\t\treadonly offset: number;\n\t\t\treadonly attrs: InlineNodeAttrs;\n\t };\n\n/** Enumerates the font-size carriers within the current (non-collapsed) text range. */\nfunction rangeCarriers(state: EditorState): FontSizeCarrier[] {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return [];\n\tconst blockOrder: readonly BlockId[] = state.getBlockOrder();\n\tconst range = selectionRange(sel, blockOrder);\n\tconst fromIdx: number = blockOrder.indexOf(range.from.blockId);\n\tconst toIdx: number = blockOrder.indexOf(range.to.blockId);\n\tconst carriers: FontSizeCarrier[] = [];\n\n\tfor (let i = fromIdx; i <= toIdx; i++) {\n\t\tconst blockId = blockOrder[i];\n\t\tif (!blockId) continue;\n\t\tconst block = state.getBlock(blockId);\n\t\tif (!block) continue;\n\t\tconst from: number = i === fromIdx ? range.from.offset : 0;\n\t\tconst to: number = i === toIdx ? range.to.offset : getBlockLength(block);\n\n\t\t// Atomic, font-size-aware block (e.g. a display formula): size the whole node.\n\t\tif (specDeclaresFontSize(state.schema.getNodeSpec?.(block.type))) {\n\t\t\tcarriers.push({\n\t\t\t\tkind: 'blockNode',\n\t\t\t\tpath: state.getNodePath(blockId) ?? [blockId],\n\t\t\t\tattrs: block.attrs ?? {},\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tif (from === to) continue;\n\t\tcollectInlineCarriers(state, block, blockId, from, to, carriers);\n\t}\n\treturn carriers;\n}\n\n/** Adds a text carrier (when the slice holds text) plus any font-size-aware inline nodes. */\nfunction collectInlineCarriers(\n\tstate: EditorState,\n\tblock: BlockNode,\n\tblockId: BlockId,\n\tfrom: number,\n\tto: number,\n\tcarriers: FontSizeCarrier[],\n): void {\n\tlet pos = 0;\n\tlet hasText = false;\n\tlet textMark: Mark | undefined;\n\tfor (const child of getInlineChildren(block)) {\n\t\tif (isTextNode(child)) {\n\t\t\tconst end: number = pos + child.text.length;\n\t\t\tif (child.text.length > 0 && end > from && pos < to) {\n\t\t\t\thasText = true;\n\t\t\t\tif (!textMark) textMark = child.marks.find((m) => m.type === FONT_SIZE_TYPE);\n\t\t\t}\n\t\t\tpos = end;\n\t\t} else {\n\t\t\tif (\n\t\t\t\tpos >= from &&\n\t\t\t\tpos < to &&\n\t\t\t\tspecDeclaresFontSize(state.schema.getInlineNodeSpec?.(child.inlineType))\n\t\t\t) {\n\t\t\t\tcarriers.push({ kind: 'inlineNode', blockId, offset: pos, attrs: child.attrs });\n\t\t\t}\n\t\t\tpos += 1;\n\t\t}\n\t}\n\tif (hasText) carriers.push({ kind: 'text', blockId, from, to, mark: textMark });\n}\n\n/** Sizes every carrier in the range ('' clears). Returns false when nothing changed. */\nfunction dispatchRangeFontSize(context: PluginContext, state: EditorState, size: string): boolean {\n\tconst carriers: FontSizeCarrier[] = rangeCarriers(state);\n\tif (carriers.length === 0) return false;\n\tconst builder = state.transaction('command');\n\tlet changed = false;\n\n\tfor (const carrier of carriers) {\n\t\tif (carrier.kind === 'text') {\n\t\t\tif (size === '') {\n\t\t\t\tif (carrier.mark) {\n\t\t\t\t\tbuilder.removeMark(carrier.blockId, carrier.from, carrier.to, carrier.mark);\n\t\t\t\t\tchanged = true;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (carrier.mark)\n\t\t\t\t\tbuilder.removeMark(carrier.blockId, carrier.from, carrier.to, carrier.mark);\n\t\t\t\tbuilder.addMark(carrier.blockId, carrier.from, carrier.to, {\n\t\t\t\t\ttype: FONT_SIZE_TYPE,\n\t\t\t\t\tattrs: { size },\n\t\t\t\t});\n\t\t\t\tchanged = true;\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\t\tconst current: string | null = readFontSize(carrier.attrs);\n\t\tif (size === current || (size === '' && current === null)) continue;\n\t\tif (carrier.kind === 'blockNode') {\n\t\t\tbuilder.setNodeAttr(carrier.path, mergeFontSize(carrier.attrs, size));\n\t\t} else {\n\t\t\tbuilder.setInlineNodeAttr(\n\t\t\t\tcarrier.blockId,\n\t\t\t\tcarrier.offset,\n\t\t\t\tmergeFontSize(carrier.attrs, size),\n\t\t\t);\n\t\t}\n\t\tchanged = true;\n\t}\n\n\tif (!changed) return false;\n\tbuilder.setSelection(state.selection);\n\tcontext.dispatch(builder.build());\n\treturn true;\n}\n\n/** The set of fontSize values carried by font-size-aware nodes in the range, or null when none. */\nfunction rangeNodeSizes(state: EditorState): Set<string> | null {\n\tconst nodeAttrs: (BlockAttrs | InlineNodeAttrs)[] = rangeCarriers(state)\n\t\t.filter((carrier) => carrier.kind !== 'text')\n\t\t.map((carrier) => carrier.attrs);\n\tif (nodeAttrs.length === 0) return null;\n\treturn new Set(nodeAttrs.map((attrs) => readFontSize(attrs) ?? ''));\n}\n\n// --- State Queries ---\n\n/** The `fontSize` mark value of a pixel size, e.g. `18px`. */\nexport function pixelFontSize(size: number): string {\n\treturn `${size}px`;\n}\n\n/** Returns the raw fontSize CSS value at the current selection, or null. */\nexport function getActiveSize(state: EditorState): string | null {\n\tconst target = nodeFontSizeTarget(state);\n\tif (target) return nodeFontSizeValue(target);\n\t// Additive: when a range spans font-size-aware nodes (e.g. a formula) that all\n\t// share one explicit size, report it; otherwise read the text mark as before.\n\tconst sizes = rangeNodeSizes(state);\n\tif (sizes && sizes.size === 1) {\n\t\tconst [only] = sizes;\n\t\tif (only) return only;\n\t}\n\treturn getMarkAttrAtSelection(state, 'fontSize', (m) => m.attrs.size ?? null);\n}\n\n/** Returns the active font size as a number, falling back to defaultSize. */\nexport function getActiveSizeNumeric(state: EditorState, defaultSize: number): number {\n\tconst raw: string | null = getActiveSize(state);\n\tif (!raw) return defaultSize;\n\tconst parsed: number = Number.parseInt(raw, 10);\n\treturn Number.isNaN(parsed) ? defaultSize : parsed;\n}\n\n/** Returns true when the selection carries a fontSize (mark or node attribute). */\nexport function isFontSizeActive(state: EditorState): boolean {\n\tconst target = nodeFontSizeTarget(state);\n\tif (target) return nodeFontSizeValue(target) !== null;\n\tconst sizes = rangeNodeSizes(state);\n\tif (sizes && [...sizes].some((size) => size.length > 0)) return true;\n\treturn isAttributedMarkActive(state, 'fontSize');\n}\n\n// --- Commands ---\n\n/**\n * Applies the given CSS size to the selection: as a node `fontSize` attribute\n * when a font-size-aware node is selected (e.g. a formula), otherwise as a\n * fontSize mark on the selected text.\n */\nexport function applyFontSize(context: PluginContext, state: EditorState, size: string): boolean {\n\tconst target = nodeFontSizeTarget(state);\n\tif (target) return dispatchNodeFontSize(context, state, target, size);\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return false;\n\tif (isCollapsed(sel)) {\n\t\tconst mark = { type: markType('fontSize'), attrs: { size } };\n\t\treturn dispatchIfPresent(context, applyAttributedMark(state, mark));\n\t}\n\treturn dispatchRangeFontSize(context, state, size);\n}\n\n/** Removes the fontSize (node attribute or mark) from the current selection. */\nexport function removeFontSize(context: PluginContext, state: EditorState): boolean {\n\tconst target = nodeFontSizeTarget(state);\n\tif (target) {\n\t\tif (nodeFontSizeValue(target) === null) return false;\n\t\treturn dispatchNodeFontSize(context, state, target, '');\n\t}\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return false;\n\tif (isCollapsed(sel)) {\n\t\treturn dispatchIfPresent(context, removeAttributedMark(state, markType('fontSize')));\n\t}\n\treturn dispatchRangeFontSize(context, state, '');\n}\n\n/** Steps the font size up or down through the preset list. */\nexport function stepFontSize(\n\tcontext: PluginContext,\n\tstate: EditorState,\n\tdirection: 'up' | 'down',\n\tsizes: readonly number[],\n\tdefaultSize: number,\n): boolean {\n\tconst current: number = getActiveSizeNumeric(state, defaultSize);\n\tconst next: number | null = getNextPresetSize(current, direction, sizes);\n\tif (next === null) return false;\n\n\tif (next === defaultSize) {\n\t\treturn removeFontSize(context, state);\n\t}\n\treturn applyFontSize(context, state, pixelFontSize(next));\n}\n\n/**\n * Selects a specific font size: removes the mark when size equals the\n * default, otherwise applies the new size.\n */\nexport function selectSize(context: PluginContext, size: number, defaultSize: number): void {\n\tif (size === defaultSize) {\n\t\tcontext.executeCommand('removeFontSize');\n\t} else {\n\t\tapplyFontSize(context, context.getState(), pixelFontSize(size));\n\t}\n}\n\n// --- Helpers ---\n\n/** Finds the next preset size in the given direction, or null at boundaries. */\nexport function getNextPresetSize(\n\tcurrent: number,\n\tdirection: 'up' | 'down',\n\tsizes: readonly number[],\n): number | null {\n\tif (direction === 'up') {\n\t\tfor (const size of sizes) {\n\t\t\tif (size > current) return size;\n\t\t}\n\t\treturn null;\n\t}\n\tfor (let i: number = sizes.length - 1; i >= 0; i--) {\n\t\tconst size: number | undefined = sizes[i];\n\t\tif (size !== undefined && size < current) return size;\n\t}\n\treturn null;\n}\n","/**\n * Renders the font-size picker popup with a custom numeric input\n * and an accessible preset list with keyboard navigation.\n */\n\nimport type { PluginContext } from '../Plugin.js';\nimport type { PopupCloseOptions } from '../shared/PopupManager.js';\nimport type { FontSizeLocale } from './FontSizeLocale.js';\nimport { getActiveSizeNumeric, selectSize } from './FontSizeOperations.js';\n\n// --- Constants ---\n\nconst MIN_CUSTOM_SIZE = 1;\nconst MAX_CUSTOM_SIZE = 400;\n\n// --- Config ---\n\nexport interface FontSizePopupConfig {\n\treadonly sizes: readonly number[];\n\treadonly defaultSize: number;\n\treadonly onClose: (options?: PopupCloseOptions) => void;\n\treadonly contentElement: HTMLElement;\n\treadonly locale: FontSizeLocale;\n}\n\n// --- Public Entry Point ---\n\n/** Builds the font-size picker DOM inside the given container. */\nexport function renderFontSizePopup(\n\tcontainer: HTMLElement,\n\tcontext: PluginContext,\n\tconfig: FontSizePopupConfig,\n): void {\n\tcontainer.classList.add('notectl-font-size-picker');\n\n\tconst currentSize: number = getActiveSizeNumeric(context.getState(), config.defaultSize);\n\n\tconst input: HTMLInputElement = buildCustomInput(currentSize, config);\n\tappendInputWrapper(container, input);\n\n\tconst { list, items } = buildSizeList(config.sizes, currentSize, context, config);\n\tcontainer.appendChild(list);\n\n\tscrollActiveIntoView(items, config.sizes, currentSize, list);\n\tattachKeyboardNavigation(input, list, items, context, config);\n}\n\n// --- Custom Input ---\n\nfunction buildCustomInput(currentSize: number, config: FontSizePopupConfig): HTMLInputElement {\n\tconst input: HTMLInputElement = document.createElement('input');\n\tinput.type = 'number';\n\tinput.className = 'notectl-font-size-picker__input';\n\tinput.min = String(MIN_CUSTOM_SIZE);\n\tinput.max = String(MAX_CUSTOM_SIZE);\n\tinput.value = String(currentSize);\n\tinput.setAttribute('aria-label', config.locale.customFontSizeAria);\n\treturn input;\n}\n\nfunction appendInputWrapper(container: HTMLElement, input: HTMLInputElement): void {\n\tconst wrapper: HTMLDivElement = document.createElement('div');\n\twrapper.className = 'notectl-font-size-picker__input-wrapper';\n\twrapper.appendChild(input);\n\tcontainer.appendChild(wrapper);\n}\n\n// --- Size List ---\n\ninterface SizeListResult {\n\treadonly list: HTMLDivElement;\n\treadonly items: HTMLButtonElement[];\n}\n\nfunction buildSizeList(\n\tsizes: readonly number[],\n\tcurrentSize: number,\n\tcontext: PluginContext,\n\tconfig: FontSizePopupConfig,\n): SizeListResult {\n\tconst list: HTMLDivElement = document.createElement('div');\n\tlist.className = 'notectl-font-size-picker__list';\n\tlist.setAttribute('role', 'listbox');\n\tlist.setAttribute('aria-label', config.locale.fontSizesAria);\n\n\tconst items: HTMLButtonElement[] = [];\n\n\tfor (const size of sizes) {\n\t\tconst isActive: boolean = size === currentSize;\n\t\tconst item: HTMLButtonElement = buildSizeItem(size, isActive);\n\n\t\titem.addEventListener('mousedown', (e: MouseEvent) => {\n\t\t\te.preventDefault();\n\t\t\te.stopPropagation();\n\t\t});\n\t\titem.addEventListener('click', () => {\n\t\t\tselectSize(context, size, config.defaultSize);\n\t\t\tconfig.onClose({ restoreFocusTo: config.contentElement });\n\t\t});\n\n\t\titems.push(item);\n\t\tlist.appendChild(item);\n\t}\n\n\treturn { list, items };\n}\n\nfunction buildSizeItem(size: number, isActive: boolean): HTMLButtonElement {\n\tconst item: HTMLButtonElement = document.createElement('button');\n\titem.type = 'button';\n\titem.id = `notectl-font-size-option-${size}`;\n\titem.className = 'notectl-font-size-picker__item';\n\titem.setAttribute('role', 'option');\n\titem.setAttribute('aria-selected', String(isActive));\n\n\tif (isActive) {\n\t\titem.classList.add('notectl-font-size-picker__item--active');\n\t}\n\n\tconst check: HTMLSpanElement = document.createElement('span');\n\tcheck.className = 'notectl-font-size-picker__check';\n\tcheck.textContent = isActive ? '\\u2713' : '';\n\titem.appendChild(check);\n\n\tconst label: HTMLSpanElement = document.createElement('span');\n\tlabel.className = 'notectl-font-size-picker__label';\n\tlabel.textContent = String(size);\n\titem.appendChild(label);\n\n\treturn item;\n}\n\n// --- Scroll ---\n\nfunction scrollActiveIntoView(\n\titems: HTMLButtonElement[],\n\tsizes: readonly number[],\n\tcurrentSize: number,\n\tlist: HTMLDivElement,\n): void {\n\tconst activeIdx: number = sizes.indexOf(currentSize);\n\tif (activeIdx < 0) return;\n\n\tconst activeItem: HTMLButtonElement | undefined = items[activeIdx];\n\tif (!activeItem) return;\n\n\trequestAnimationFrame(() => {\n\t\tactiveItem.scrollIntoView({ block: 'nearest' });\n\t});\n\tlist.setAttribute('aria-activedescendant', activeItem.id);\n}\n\n// --- Keyboard Navigation ---\n\nfunction attachKeyboardNavigation(\n\tinput: HTMLInputElement,\n\tlist: HTMLDivElement,\n\titems: HTMLButtonElement[],\n\tcontext: PluginContext,\n\tconfig: FontSizePopupConfig,\n): void {\n\tlet focusedIndex = -1;\n\n\tconst setFocused = (idx: number): void => {\n\t\tif (focusedIndex >= 0 && focusedIndex < items.length) {\n\t\t\titems[focusedIndex]?.classList.remove('notectl-font-size-picker__item--focused');\n\t\t}\n\t\tfocusedIndex = idx;\n\t\tconst el: HTMLButtonElement | undefined = items[focusedIndex];\n\t\tif (focusedIndex >= 0 && focusedIndex < items.length && el) {\n\t\t\tel.classList.add('notectl-font-size-picker__item--focused');\n\t\t\tel.scrollIntoView({ block: 'nearest' });\n\t\t\tlist.setAttribute('aria-activedescendant', el.id);\n\t\t}\n\t};\n\n\t// As an editable combobox (input + listbox), this popup owns its keyboard\n\t// model. `consume` claims a handled key so the toolbar's generic popup\n\t// handler does not also act on it and advance focus a second time (#144).\n\tconst consume = (e: KeyboardEvent): void => {\n\t\te.preventDefault();\n\t\te.stopPropagation();\n\t};\n\n\tinput.addEventListener('keydown', (e: KeyboardEvent) => {\n\t\tif (e.key === 'Enter') {\n\t\t\tconsume(e);\n\t\t\tconst val: number = Number.parseInt(input.value, 10);\n\t\t\tif (!Number.isNaN(val) && val >= MIN_CUSTOM_SIZE && val <= MAX_CUSTOM_SIZE) {\n\t\t\t\tselectSize(context, val, config.defaultSize);\n\t\t\t\tconfig.onClose({ restoreFocusTo: config.contentElement });\n\t\t\t}\n\t\t} else if (e.key === 'ArrowDown') {\n\t\t\tconsume(e);\n\t\t\tsetFocused(0);\n\t\t\titems[0]?.focus();\n\t\t} else if (e.key === 'Escape') {\n\t\t\tconsume(e);\n\t\t\tconfig.onClose({ restoreFocusTo: config.contentElement });\n\t\t}\n\t});\n\n\tlist.addEventListener('keydown', (e: KeyboardEvent) => {\n\t\tif (e.key === 'ArrowDown') {\n\t\t\tconsume(e);\n\t\t\tif (focusedIndex < items.length - 1) {\n\t\t\t\tsetFocused(focusedIndex + 1);\n\t\t\t\titems[focusedIndex]?.focus();\n\t\t\t}\n\t\t} else if (e.key === 'ArrowUp') {\n\t\t\tconsume(e);\n\t\t\tif (focusedIndex > 0) {\n\t\t\t\tsetFocused(focusedIndex - 1);\n\t\t\t\titems[focusedIndex]?.focus();\n\t\t\t} else {\n\t\t\t\tsetFocused(-1);\n\t\t\t\tinput.focus();\n\t\t\t}\n\t\t} else if (e.key === 'Enter') {\n\t\t\tconsume(e);\n\t\t\titems[focusedIndex]?.click();\n\t\t} else if (e.key === 'Escape') {\n\t\t\tconsume(e);\n\t\t\tconfig.onClose({ restoreFocusTo: config.contentElement });\n\t\t}\n\t});\n}\n","/**\n * FontSizePlugin: registers a fontSize mark with attrs, a combobox-style\n * toolbar selector with WCAG-accessible popup, and commands for\n * increasing / decreasing font size.\n */\n\nimport FONT_SIZE_SELECT_CSS from '../../editor/styles/font-size-select.css?inline';\nimport type { StyleClassNames } from '../../model/StyleClass.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport { setStyleProperty } from '../../style/StyleRuntime.js';\nimport type { Plugin, PluginContext } from '../Plugin.js';\nimport { isValidCSSFontSize } from '../shared/ColorValidation.js';\nimport {\n\ttype InlineStyleMarkConfig,\n\tcreateInlineStyleMarkSpec,\n\tstyleDeclaration,\n} from '../shared/InlineStyleMarkSpec.js';\nimport { resolveLocale } from '../shared/PluginHelpers.js';\nimport { registerStyleClassNames } from '../shared/StyleClassNames.js';\nimport { FONT_SIZE_LOCALE_EN, type FontSizeLocale, loadFontSizeLocale } from './FontSizeLocale.js';\nimport {\n\tgetActiveSizeNumeric,\n\tisFontSizeActive,\n\tpixelFontSize,\n\tremoveFontSize,\n\tstepFontSize,\n} from './FontSizeOperations.js';\nimport { renderFontSizePopup } from './FontSizePopup.js';\n\n// --- Attribute Registry Augmentation ---\n\ndeclare module '../../model/AttrRegistry.js' {\n\tinterface MarkAttrRegistry {\n\t\tfontSize: { size: string };\n\t}\n}\n\n// --- Constants ---\n\n/** Default preset sizes shown in the font size dropdown. */\nexport const DEFAULT_FONT_SIZES: readonly number[] = [\n\t8, 9, 10, 11, 12, 14, 16, 18, 20, 24, 28, 32, 36, 48, 64, 72, 96,\n];\n\nconst DEFAULT_FONT_SIZE = 16;\n\n// --- Configuration ---\n\nexport interface FontSizeConfig {\n\t/**\n\t * Preset sizes shown in the font size dropdown.\n\t * Must contain positive integers. Values are sorted and deduplicated automatically.\n\t * Defaults to {@link DEFAULT_FONT_SIZES} when omitted or empty.\n\t */\n\treadonly sizes?: readonly number[];\n\t/**\n\t * The base font size that text has when no fontSize mark is applied.\n\t * Shown as the initial value in the toolbar combo and used as the\n\t * \"neutral\" size — selecting it removes the mark instead of applying one.\n\t * Defaults to 16.\n\t */\n\treadonly defaultSize?: number;\n\t/**\n\t * Your own CSS class per font size in HTML content, keyed by pixel size, e.g.\n\t * `{ 14: 'text-sm', 18: 'text-lg' }`. Class-based export (`getContentHTML({ cssMode: 'classes' })`)\n\t * writes these classes instead of generated `notectl-s-*` names, and HTML import\n\t * and paste recognize them, so content round-trips with your stylesheet. Sizes\n\t * outside `sizes` may have a class too. Invalid keys or class names make editor\n\t * initialization fail with a `TypeError` that explains the fix.\n\t */\n\treadonly styleClasses?: StyleClassNames<number>;\n\treadonly locale?: FontSizeLocale;\n}\n\n/** The font size mark: one `font-size` declaration per text run. */\nconst FONT_SIZE_MARK: InlineStyleMarkConfig = {\n\ttype: 'fontSize',\n\trank: 4,\n\tvalueAttr: 'size',\n\tdomStyleProperty: 'fontSize',\n\tcssProperty: 'font-size',\n\tvalidate: isValidCSSFontSize,\n};\n\n/** A whole number of pixels without unit, as `styleClasses` keys are written. */\nconst PIXEL_SIZE_KEY: RegExp = /^[1-9]\\d*$/;\n\n// --- Plugin ---\n\nexport class FontSizePlugin implements Plugin {\n\treadonly id = 'fontSize';\n\treadonly name = 'Font Size';\n\treadonly priority = 21;\n\n\tprivate readonly config: FontSizeConfig;\n\tprivate readonly sizes: readonly number[];\n\tprivate readonly defaultSize: number;\n\tprivate locale!: FontSizeLocale;\n\n\tconstructor(config?: Partial<FontSizeConfig>) {\n\t\tthis.config = { ...config };\n\t\tthis.sizes = resolveSizes(config?.sizes);\n\t\tthis.defaultSize = resolveDefaultSize(config?.defaultSize);\n\t}\n\n\tasync init(context: PluginContext): Promise<void> {\n\t\tthis.locale = await resolveLocale(\n\t\t\tcontext,\n\t\t\tthis.config.locale,\n\t\t\tFONT_SIZE_LOCALE_EN,\n\t\t\tloadFontSizeLocale,\n\t\t);\n\n\t\tcontext.registerStyleSheet(FONT_SIZE_SELECT_CSS);\n\t\tthis.registerMarkSpec(context);\n\t\tthis.registerStyleClasses(context);\n\t\tthis.registerCommands(context);\n\t\tthis.registerKeymaps(context);\n\t\tthis.registerToolbarItem(context);\n\t\tthis.applyDefaultSizeToContainer(context);\n\t}\n\n\tdestroy(): void {\n\t\t// no-op: nothing to clean up\n\t}\n\n\t// --- Schema ---\n\n\tprivate registerMarkSpec(context: PluginContext): void {\n\t\tcontext.registerMarkSpec(createInlineStyleMarkSpec(FONT_SIZE_MARK));\n\t}\n\n\tprivate registerStyleClasses(context: PluginContext): void {\n\t\tregisterStyleClassNames(context, 'FontSizePlugin', this.config.styleClasses, (key: string) =>\n\t\t\tstyleDeclaration(FONT_SIZE_MARK.cssProperty, pixelFontSize(pixelSizeKey(key))),\n\t\t);\n\t}\n\n\t// --- Commands ---\n\n\tprivate registerCommands(context: PluginContext): void {\n\t\tcontext.registerCommand('removeFontSize', () => {\n\t\t\treturn removeFontSize(context, context.getState());\n\t\t});\n\n\t\tcontext.registerCommand('setFontSize', () => {\n\t\t\treturn false;\n\t\t});\n\n\t\tcontext.registerCommand('increaseFontSize', () => {\n\t\t\treturn stepFontSize(context, context.getState(), 'up', this.sizes, this.defaultSize);\n\t\t});\n\n\t\tcontext.registerCommand('decreaseFontSize', () => {\n\t\t\treturn stepFontSize(context, context.getState(), 'down', this.sizes, this.defaultSize);\n\t\t});\n\t}\n\n\t// --- Keymaps ---\n\n\tprivate registerKeymaps(context: PluginContext): void {\n\t\tcontext.registerKeymap({\n\t\t\t'Mod-Shift-+': () => {\n\t\t\t\treturn stepFontSize(context, context.getState(), 'up', this.sizes, this.defaultSize);\n\t\t\t},\n\t\t\t'Mod-Shift-_': () => {\n\t\t\t\treturn stepFontSize(context, context.getState(), 'down', this.sizes, this.defaultSize);\n\t\t\t},\n\t\t});\n\t}\n\n\t// --- Toolbar ---\n\n\tprivate registerToolbarItem(context: PluginContext): void {\n\t\tcontext.registerToolbarItem({\n\t\t\tid: 'fontSize',\n\t\t\tgroup: 'format',\n\t\t\tlabel: this.locale.label,\n\t\t\ttooltip: this.locale.tooltip,\n\t\t\tcommand: 'removeFontSize',\n\t\t\tpopupType: 'combobox',\n\t\t\tgetLabel: (state: EditorState): string =>\n\t\t\t\tString(getActiveSizeNumeric(state, this.defaultSize)),\n\t\t\trenderPopup: (container, ctx, onClose) => {\n\t\t\t\trenderFontSizePopup(container, ctx, {\n\t\t\t\t\tsizes: this.sizes,\n\t\t\t\t\tdefaultSize: this.defaultSize,\n\t\t\t\t\tonClose,\n\t\t\t\t\tcontentElement: ctx.getContainer(),\n\t\t\t\t\tlocale: this.locale,\n\t\t\t\t});\n\t\t\t},\n\t\t\tisActive: (state) => isFontSizeActive(state),\n\t\t});\n\t}\n\n\t/**\n\t * Sets the configured default font size on the editor content container\n\t * so that unformatted text renders at the correct size instead of the\n\t * browser default (16px).\n\t */\n\tprivate applyDefaultSizeToContainer(context: PluginContext): void {\n\t\tconst container: HTMLElement = context.getContainer();\n\t\tsetStyleProperty(container, 'fontSize', `${this.defaultSize}px`);\n\t}\n}\n\n// --- Helpers ---\n\nfunction resolveSizes(sizes: readonly number[] | undefined): readonly number[] {\n\tif (!sizes || sizes.length === 0) return DEFAULT_FONT_SIZES;\n\tconst unique: number[] = [...new Set(sizes)].filter((n) => Number.isInteger(n) && n > 0);\n\tunique.sort((a, b) => a - b);\n\treturn unique.length > 0 ? unique : DEFAULT_FONT_SIZES;\n}\n\nfunction resolveDefaultSize(size: number | undefined): number {\n\tif (size === undefined) return DEFAULT_FONT_SIZE;\n\treturn Number.isInteger(size) && size > 0 ? size : DEFAULT_FONT_SIZE;\n}\n\n/** Reads a `styleClasses` key as a pixel size. Throws a `TypeError` for anything else. */\nfunction pixelSizeKey(key: string): number {\n\tif (!PIXEL_SIZE_KEY.test(key)) {\n\t\tthrow new TypeError(`\"${key}\" is not a font size; use whole pixel numbers such as 18.`);\n\t}\n\treturn Number(key);\n}\n"],"mappings":"Y,khBCeauB,EAAsC,CAClDC,MAAO,YACPC,QAAS,YACTC,mBAAoB,mBACpBC,cAAe,cAKVC,iBAAiDC,OAAAC,OAAA,CAAA,kBAAA,WAAA,qBAAA,kBAAA,WAAA,qBAAA,kBAAA,WAAA,qBAAA,kBAAA,WAAA,qBAAA,kBAAA,WAAA,qBAAA,kBAAA,WAAA,qBAAA,kBAAA,WAAA,qBAAA,kBAAA,WAAA,uBAIvDC,eAAsBC,EAAmBC,GACxC,OAAOlB,EAAiBa,EAAeK,EAAMV,EAC9C,CCsBA,SAASW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