@notectl/core 2.3.3 → 2.3.5

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.
Files changed (390) hide show
  1. package/custom-elements.json +4 -0
  2. package/dist/chunks/AlignmentPlugin-DIwrRsHd.mjs +2 -0
  3. package/dist/chunks/AlignmentPlugin-DIwrRsHd.mjs.map +1 -0
  4. package/dist/chunks/{AttrRegistry-B3zB02z9.mjs → AttrRegistry-CtNhf2EF.mjs} +2 -2
  5. package/dist/chunks/{AttrRegistry-B3zB02z9.mjs.map → AttrRegistry-CtNhf2EF.mjs.map} +1 -1
  6. package/dist/chunks/AttributedMarkCommands-B3MQdob_.mjs +2 -0
  7. package/dist/chunks/AttributedMarkCommands-B3MQdob_.mjs.map +1 -0
  8. package/dist/chunks/{BidiIsolationPlugin-Cw2KMk-H.mjs → BidiIsolationPlugin-cOLlL3Y9.mjs} +2 -2
  9. package/dist/chunks/{BidiIsolationPlugin-Cw2KMk-H.mjs.map → BidiIsolationPlugin-cOLlL3Y9.mjs.map} +1 -1
  10. package/dist/chunks/BlockInsertion-O5pAFKid.mjs +2 -0
  11. package/dist/chunks/{BlockInsertion-CYH2gRkY.mjs.map → BlockInsertion-O5pAFKid.mjs.map} +1 -1
  12. package/dist/chunks/BlockquotePlugin-D-jRWLQB.mjs +2 -0
  13. package/dist/chunks/{BlockquotePlugin-0bZSbkyo.mjs.map → BlockquotePlugin-D-jRWLQB.mjs.map} +1 -1
  14. package/dist/chunks/CaretNavigationPlugin-DEZU09LJ.mjs +2 -0
  15. package/dist/chunks/CaretNavigationPlugin-DEZU09LJ.mjs.map +1 -0
  16. package/dist/chunks/CodeBlockPlugin-BandNM3t.mjs +2 -0
  17. package/dist/chunks/{CodeBlockPlugin-BCJ3faXx.mjs.map → CodeBlockPlugin-BandNM3t.mjs.map} +1 -1
  18. package/dist/chunks/ColorGrid-D0vLHsG6.mjs +2 -0
  19. package/dist/chunks/{ColorGrid-DQEkJ-0y.mjs.map → ColorGrid-D0vLHsG6.mjs.map} +1 -1
  20. package/dist/chunks/ColorPickerPopup-_C5JZhki.mjs +2 -0
  21. package/dist/chunks/{ColorPickerPopup-CyF26zIU.mjs.map → ColorPickerPopup-_C5JZhki.mjs.map} +1 -1
  22. package/dist/chunks/ColorValidation-B9d_umnf.mjs +2 -0
  23. package/dist/chunks/{ColorValidation-DAijTjG9.mjs.map → ColorValidation-B9d_umnf.mjs.map} +1 -1
  24. package/dist/chunks/Commands-D-0UXYvo.mjs +2 -0
  25. package/dist/chunks/Commands-D-0UXYvo.mjs.map +1 -0
  26. package/dist/chunks/ContentModel-Bzmzeqwg.mjs +2 -0
  27. package/dist/chunks/{ContentModel-NpAj7vGW.mjs.map → ContentModel-Bzmzeqwg.mjs.map} +1 -1
  28. package/dist/chunks/CursorMarks-dx51OGBf.mjs +2 -0
  29. package/dist/chunks/CursorMarks-dx51OGBf.mjs.map +1 -0
  30. package/dist/chunks/Decoration-BwhoA4MU.mjs +3 -0
  31. package/dist/chunks/Decoration-BwhoA4MU.mjs.map +1 -0
  32. package/dist/chunks/{DirectionDetection-CDVSEWQ6.mjs → DirectionDetection-ZrkMhyaL.mjs} +2 -2
  33. package/dist/chunks/{DirectionDetection-CDVSEWQ6.mjs.map → DirectionDetection-ZrkMhyaL.mjs.map} +1 -1
  34. package/dist/chunks/Document-D_2cIBJG.mjs +2 -0
  35. package/dist/chunks/Document-D_2cIBJG.mjs.map +1 -0
  36. package/dist/chunks/DocumentParser-i-CreJ48.mjs +2 -0
  37. package/dist/chunks/DocumentParser-i-CreJ48.mjs.map +1 -0
  38. package/dist/chunks/FontPlugin-C_ScWZ0P.mjs +2 -0
  39. package/dist/chunks/FontPlugin-C_ScWZ0P.mjs.map +1 -0
  40. package/dist/chunks/FontSizePlugin-DB_0njtC.mjs +2 -0
  41. package/dist/chunks/FontSizePlugin-DB_0njtC.mjs.map +1 -0
  42. package/dist/chunks/FormulaPlugin-CI0r4X1o.mjs +2 -0
  43. package/dist/chunks/{FormulaPlugin-DJ39BtqV.mjs.map → FormulaPlugin-CI0r4X1o.mjs.map} +1 -1
  44. package/dist/chunks/GapCursorPlugin-NozsEK9J.mjs +2 -0
  45. package/dist/chunks/GapCursorPlugin-NozsEK9J.mjs.map +1 -0
  46. package/dist/chunks/HTMLSanitization-Ce9dVT1q.mjs +2 -0
  47. package/dist/chunks/HTMLSanitization-Ce9dVT1q.mjs.map +1 -0
  48. package/dist/chunks/HTMLUtils-B0nGyFLb.mjs +2 -0
  49. package/dist/chunks/{HTMLUtils-Bhg3_P8B.mjs.map → HTMLUtils-B0nGyFLb.mjs.map} +1 -1
  50. package/dist/chunks/HardBreakPlugin-CC4rntSX.mjs +2 -0
  51. package/dist/chunks/{HardBreakPlugin-vniSvTgq.mjs.map → HardBreakPlugin-CC4rntSX.mjs.map} +1 -1
  52. package/dist/chunks/HeadingPlugin-LK8Pg4h0.mjs +2 -0
  53. package/dist/chunks/HeadingPlugin-LK8Pg4h0.mjs.map +1 -0
  54. package/dist/chunks/{HighlightPlugin-DRTAE1N5.mjs → HighlightPlugin-B4WlZawl.mjs} +2 -2
  55. package/dist/chunks/{HighlightPlugin-DRTAE1N5.mjs.map → HighlightPlugin-B4WlZawl.mjs.map} +1 -1
  56. package/dist/chunks/HorizontalRulePlugin-CxmUMM34.mjs +2 -0
  57. package/dist/chunks/{HorizontalRulePlugin-B9OvwrKB.mjs.map → HorizontalRulePlugin-CxmUMM34.mjs.map} +1 -1
  58. package/dist/chunks/ImagePlugin-C5ESNNsA.mjs +2 -0
  59. package/dist/chunks/ImagePlugin-C5ESNNsA.mjs.map +1 -0
  60. package/dist/chunks/InlineCodePlugin-C1SqGfv5.mjs +2 -0
  61. package/dist/chunks/{InlineCodePlugin-uxgMUX_E.mjs.map → InlineCodePlugin-C1SqGfv5.mjs.map} +1 -1
  62. package/dist/chunks/{InlineStyleMarkSpec-CjSRj4f_.mjs → InlineStyleMarkSpec-Cx3goc3W.mjs} +2 -2
  63. package/dist/chunks/{InlineStyleMarkSpec-CjSRj4f_.mjs.map → InlineStyleMarkSpec-Cx3goc3W.mjs.map} +1 -1
  64. package/dist/chunks/{LinkPlugin-CvWHbSkb.mjs → LinkPlugin-BwXDGHPe.mjs} +2 -2
  65. package/dist/chunks/{LinkPlugin-CvWHbSkb.mjs.map → LinkPlugin-BwXDGHPe.mjs.map} +1 -1
  66. package/dist/chunks/ListPlugin-DSFPSWQC.mjs +2 -0
  67. package/dist/chunks/ListPlugin-DSFPSWQC.mjs.map +1 -0
  68. package/dist/chunks/MarkCommands-CJvLGL5G.mjs +2 -0
  69. package/dist/chunks/MarkCommands-CJvLGL5G.mjs.map +1 -0
  70. package/dist/chunks/{MarkInputRule-Bdi8KPus.mjs → MarkInputRule-DNneF2gp.mjs} +2 -2
  71. package/dist/chunks/{MarkInputRule-Bdi8KPus.mjs.map → MarkInputRule-DNneF2gp.mjs.map} +1 -1
  72. package/dist/chunks/MarkdownHTMLRegistry-CISsC0lH.mjs +2 -0
  73. package/dist/chunks/{MarkdownHTMLRegistry-Q7l0d6Ma.mjs.map → MarkdownHTMLRegistry-CISsC0lH.mjs.map} +1 -1
  74. package/dist/chunks/MarkdownParser-D1d9zB0R.mjs +2 -0
  75. package/dist/chunks/{MarkdownParser-Dp62mfUq.mjs.map → MarkdownParser-D1d9zB0R.mjs.map} +1 -1
  76. package/dist/chunks/MarkdownSerializer-Oex2RzNw.mjs +2 -0
  77. package/dist/chunks/{MarkdownSerializer-DBELFAeo.mjs.map → MarkdownSerializer-Oex2RzNw.mjs.map} +1 -1
  78. package/dist/chunks/{NodeResolver-Dleih-8R.mjs → NodeResolver-BtIknXqD.mjs} +2 -2
  79. package/dist/chunks/{NodeResolver-Dleih-8R.mjs.map → NodeResolver-BtIknXqD.mjs.map} +1 -1
  80. package/dist/chunks/NodeSelectionCommands-DK3iEh18.mjs +2 -0
  81. package/dist/chunks/{NodeSelectionCommands-WH5snxr_.mjs.map → NodeSelectionCommands-DK3iEh18.mjs.map} +1 -1
  82. package/dist/chunks/NodeSpecPatching-BrjPAbqe.mjs +2 -0
  83. package/dist/chunks/NodeSpecPatching-BrjPAbqe.mjs.map +1 -0
  84. package/dist/chunks/{PluginHelpers-KDuTlmXm.mjs → PluginHelpers-WG1Lzzh3.mjs} +2 -2
  85. package/dist/chunks/{PluginHelpers-KDuTlmXm.mjs.map → PluginHelpers-WG1Lzzh3.mjs.map} +1 -1
  86. package/dist/chunks/PopupKeyboardPatterns-BcwdDxRq.mjs +2 -0
  87. package/dist/chunks/{PopupKeyboardPatterns-tUrT9TyV.mjs.map → PopupKeyboardPatterns-BcwdDxRq.mjs.map} +1 -1
  88. package/dist/chunks/PopupManager-Jz5JrUdC.mjs +2 -0
  89. package/dist/chunks/{PopupManager-Cj86uDEB.mjs.map → PopupManager-Jz5JrUdC.mjs.map} +1 -1
  90. package/dist/chunks/{PopupPositioning-BFh6Ed1D.mjs → PopupPositioning-CIqgpqlW.mjs} +2 -2
  91. package/dist/chunks/{PopupPositioning-BFh6Ed1D.mjs.map → PopupPositioning-CIqgpqlW.mjs.map} +1 -1
  92. package/dist/chunks/PrintPlugin-BQ7LWbEB.mjs +2 -0
  93. package/dist/chunks/PrintPlugin-BQ7LWbEB.mjs.map +1 -0
  94. package/dist/chunks/{RangeIterator-DP7Ud3Gp.mjs → RangeIterator-DDOxTQIf.mjs} +2 -2
  95. package/dist/chunks/{RangeIterator-DP7Ud3Gp.mjs.map → RangeIterator-DDOxTQIf.mjs.map} +1 -1
  96. package/dist/chunks/SchemaRegistry-acc6q_5x.mjs +2 -0
  97. package/dist/chunks/SchemaRegistry-acc6q_5x.mjs.map +1 -0
  98. package/dist/chunks/Selection-DC6AOGgF.mjs +2 -0
  99. package/dist/chunks/Selection-DC6AOGgF.mjs.map +1 -0
  100. package/dist/chunks/SelectionSync-CwOHMMfI.mjs +2 -0
  101. package/dist/chunks/SelectionSync-CwOHMMfI.mjs.map +1 -0
  102. package/dist/chunks/SelectionTransactions-DNCzsl_b.mjs +2 -0
  103. package/dist/chunks/SelectionTransactions-DNCzsl_b.mjs.map +1 -0
  104. package/dist/chunks/SimpleMark-CTDtEIMV.mjs +2 -0
  105. package/dist/chunks/{SimpleMark-gTQaSJcO.mjs.map → SimpleMark-CTDtEIMV.mjs.map} +1 -1
  106. package/dist/chunks/SmartPastePlugin-CjExbE9Q.mjs +2 -0
  107. package/dist/chunks/{SmartPastePlugin-BvJQ-fOz.mjs.map → SmartPastePlugin-CjExbE9Q.mjs.map} +1 -1
  108. package/dist/chunks/{StrikethroughPlugin-BdrG1TTY.mjs → StrikethroughPlugin-d-EW2YYx.mjs} +2 -2
  109. package/dist/chunks/{StrikethroughPlugin-BdrG1TTY.mjs.map → StrikethroughPlugin-d-EW2YYx.mjs.map} +1 -1
  110. package/dist/chunks/StyleRuntime-C0RSqKzG.mjs +2 -0
  111. package/dist/chunks/{StyleRuntime-DW6omotc.mjs.map → StyleRuntime-C0RSqKzG.mjs.map} +1 -1
  112. package/dist/chunks/SuperSubPlugin-C-kvFQyx.mjs +2 -0
  113. package/dist/chunks/{SuperSubPlugin-DTZB0Y3D.mjs.map → SuperSubPlugin-C-kvFQyx.mjs.map} +1 -1
  114. package/dist/chunks/TableDimensions-BcARMxQB.mjs +2 -0
  115. package/dist/chunks/TableDimensions-BcARMxQB.mjs.map +1 -0
  116. package/dist/chunks/TablePlugin-C4WMYGWN.mjs +2 -0
  117. package/dist/chunks/TablePlugin-C4WMYGWN.mjs.map +1 -0
  118. package/dist/chunks/{TextColorPlugin-Ckg3KWvb.mjs → TextColorPlugin-D_MhNJT6.mjs} +2 -2
  119. package/dist/chunks/{TextColorPlugin-Ckg3KWvb.mjs.map → TextColorPlugin-D_MhNJT6.mjs.map} +1 -1
  120. package/dist/chunks/TextDirectionAutoPlugin-LVDkKdDX.mjs +2 -0
  121. package/dist/chunks/{TextDirectionAutoPlugin-DRGbgTlx.mjs.map → TextDirectionAutoPlugin-LVDkKdDX.mjs.map} +1 -1
  122. package/dist/chunks/TextDirectionPlugin-CtGwof7i.mjs +2 -0
  123. package/dist/chunks/TextDirectionPlugin-CtGwof7i.mjs.map +1 -0
  124. package/dist/chunks/TextFormattingPlugin-DlS0SeW7.mjs +2 -0
  125. package/dist/chunks/{TextFormattingPlugin-BhRxSC8q.mjs.map → TextFormattingPlugin-DlS0SeW7.mjs.map} +1 -1
  126. package/dist/chunks/ThemeEngine-kIXtSRkI.mjs +3 -0
  127. package/dist/chunks/ThemeEngine-kIXtSRkI.mjs.map +1 -0
  128. package/dist/chunks/{ToolbarPlugin-dmTj1jIz.mjs → ToolbarPlugin-DdrLarMD.mjs} +2 -2
  129. package/dist/chunks/ToolbarPlugin-DdrLarMD.mjs.map +1 -0
  130. package/dist/chunks/VideoPlugin-C9z4JfP_.mjs +2 -0
  131. package/dist/chunks/VideoPlugin-C9z4JfP_.mjs.map +1 -0
  132. package/dist/chunks/{XmlSupport-DIXH5on9.mjs → XmlSupport-3Za6SIqF.mjs} +2 -2
  133. package/dist/chunks/{XmlSupport-DIXH5on9.mjs.map → XmlSupport-3Za6SIqF.mjs.map} +1 -1
  134. package/dist/chunks/{color-picker-C9B2rYw-.mjs → color-picker-DJ05ey9o.mjs} +2 -2
  135. package/dist/chunks/{color-picker-C9B2rYw-.mjs.map → color-picker-DJ05ey9o.mjs.map} +1 -1
  136. package/dist/chunks/full-Cshz7aTP.mjs +2 -0
  137. package/dist/chunks/{full-JM0-SwWy.mjs.map → full-Cshz7aTP.mjs.map} +1 -1
  138. package/dist/chunks/minimal-7XqMY9kC.mjs +2 -0
  139. package/dist/chunks/{minimal-DSlR2A27.mjs.map → minimal-7XqMY9kC.mjs.map} +1 -1
  140. package/dist/chunks/register-ArnJV5vu.mjs +3 -0
  141. package/dist/chunks/register-ArnJV5vu.mjs.map +1 -0
  142. package/dist/decorations/Decoration.d.ts +9 -0
  143. package/dist/decorations/Decoration.d.ts.map +1 -1
  144. package/dist/editor/ContentSerializer.d.ts +2 -7
  145. package/dist/editor/ContentSerializer.d.ts.map +1 -1
  146. package/dist/editor/EditorEventEmitter.d.ts +10 -2
  147. package/dist/editor/EditorEventEmitter.d.ts.map +1 -1
  148. package/dist/editor/EditorInitializer.d.ts +2 -4
  149. package/dist/editor/EditorInitializer.d.ts.map +1 -1
  150. package/dist/editor/EditorLifecycleCoordinator.d.ts +16 -1
  151. package/dist/editor/EditorLifecycleCoordinator.d.ts.map +1 -1
  152. package/dist/editor/EditorStyleCoordinator.d.ts +11 -3
  153. package/dist/editor/EditorStyleCoordinator.d.ts.map +1 -1
  154. package/dist/editor/NotectlEditor.d.ts +15 -3
  155. package/dist/editor/NotectlEditor.d.ts.map +1 -1
  156. package/dist/editor/styles/base.d.ts +1 -1
  157. package/dist/editor/styles/base.d.ts.map +1 -1
  158. package/dist/editor/styles/color-picker.d.ts +1 -1
  159. package/dist/editor/styles/color-picker.d.ts.map +1 -1
  160. package/dist/editor/styles/font-select.d.ts +1 -1
  161. package/dist/editor/styles/font-select.d.ts.map +1 -1
  162. package/dist/editor/styles/font-size-select.d.ts +1 -1
  163. package/dist/editor/styles/font-size-select.d.ts.map +1 -1
  164. package/dist/editor/styles/heading-select.d.ts +1 -1
  165. package/dist/editor/styles/heading-select.d.ts.map +1 -1
  166. package/dist/editor/styles/image.d.ts +1 -1
  167. package/dist/editor/styles/image.d.ts.map +1 -1
  168. package/dist/editor/styles/table.d.ts +1 -1
  169. package/dist/editor/styles/table.d.ts.map +1 -1
  170. package/dist/editor/styles/toolbar.d.ts +1 -1
  171. package/dist/editor/styles/toolbar.d.ts.map +1 -1
  172. package/dist/editor/theme/ThemeEngine.d.ts.map +1 -1
  173. package/dist/editor/theme/ThemeTokens.d.ts +7 -0
  174. package/dist/editor/theme/ThemeTokens.d.ts.map +1 -1
  175. package/dist/full.mjs +1 -1
  176. package/dist/html.mjs +1 -1
  177. package/dist/index.d.ts +3 -2
  178. package/dist/index.d.ts.map +1 -1
  179. package/dist/input/InputHandler.d.ts +12 -0
  180. package/dist/input/InputHandler.d.ts.map +1 -1
  181. package/dist/input/InputManager.d.ts +11 -0
  182. package/dist/input/InputManager.d.ts.map +1 -1
  183. package/dist/input/KeyboardHandler.d.ts +4 -0
  184. package/dist/input/KeyboardHandler.d.ts.map +1 -1
  185. package/dist/input/PasteHTMLHandler.d.ts +18 -7
  186. package/dist/input/PasteHTMLHandler.d.ts.map +1 -1
  187. package/dist/input/PasteHandler.d.ts +41 -6
  188. package/dist/input/PasteHandler.d.ts.map +1 -1
  189. package/dist/input/PasteRichBlockHandler.d.ts +4 -3
  190. package/dist/input/PasteRichBlockHandler.d.ts.map +1 -1
  191. package/dist/markdown.mjs +1 -1
  192. package/dist/model/ContentSlice.d.ts +10 -0
  193. package/dist/model/ContentSlice.d.ts.map +1 -1
  194. package/dist/model/Document.d.ts +42 -0
  195. package/dist/model/Document.d.ts.map +1 -1
  196. package/dist/model/DocumentNormalization.d.ts +10 -0
  197. package/dist/model/DocumentNormalization.d.ts.map +1 -0
  198. package/dist/model/FileHandlerDispatcher.d.ts +27 -0
  199. package/dist/model/FileHandlerDispatcher.d.ts.map +1 -0
  200. package/dist/model/FileHandlerRegistry.d.ts +6 -1
  201. package/dist/model/FileHandlerRegistry.d.ts.map +1 -1
  202. package/dist/model/InputRuleRegistry.d.ts +9 -1
  203. package/dist/model/InputRuleRegistry.d.ts.map +1 -1
  204. package/dist/model/KeymapRegistry.d.ts +14 -1
  205. package/dist/model/KeymapRegistry.d.ts.map +1 -1
  206. package/dist/model/MarkdownSyntaxRegistry.d.ts +2 -0
  207. package/dist/model/MarkdownSyntaxRegistry.d.ts.map +1 -1
  208. package/dist/model/PluginCallbackExecutor.d.ts +44 -0
  209. package/dist/model/PluginCallbackExecutor.d.ts.map +1 -0
  210. package/dist/model/SanitizeConfig.d.ts +8 -0
  211. package/dist/model/SanitizeConfig.d.ts.map +1 -1
  212. package/dist/model/SchemaRegistry.d.ts +24 -0
  213. package/dist/model/SchemaRegistry.d.ts.map +1 -1
  214. package/dist/model/Selection.d.ts +4 -0
  215. package/dist/model/Selection.d.ts.map +1 -1
  216. package/dist/notectl-core.mjs +1 -1
  217. package/dist/notectl-core.umd.js +1 -1
  218. package/dist/notectl-core.umd.js.map +1 -1
  219. package/dist/plugins/Plugin.d.ts +3 -1
  220. package/dist/plugins/Plugin.d.ts.map +1 -1
  221. package/dist/plugins/PluginContextFactory.d.ts +9 -2
  222. package/dist/plugins/PluginContextFactory.d.ts.map +1 -1
  223. package/dist/plugins/PluginLifecycle.d.ts +6 -0
  224. package/dist/plugins/PluginLifecycle.d.ts.map +1 -1
  225. package/dist/plugins/PluginManager.d.ts +9 -2
  226. package/dist/plugins/PluginManager.d.ts.map +1 -1
  227. package/dist/plugins/RegistrationTracker.d.ts +2 -0
  228. package/dist/plugins/RegistrationTracker.d.ts.map +1 -1
  229. package/dist/plugins/alignment.mjs +1 -1
  230. package/dist/plugins/bidi-isolation.mjs +1 -1
  231. package/dist/plugins/blockquote.mjs +1 -1
  232. package/dist/plugins/caret-navigation.mjs +1 -1
  233. package/dist/plugins/code-block/CodeBlockSchema.d.ts +6 -2
  234. package/dist/plugins/code-block/CodeBlockSchema.d.ts.map +1 -1
  235. package/dist/plugins/code-block.mjs +1 -1
  236. package/dist/plugins/font-size.mjs +1 -1
  237. package/dist/plugins/font.mjs +1 -1
  238. package/dist/plugins/formula/FormulaPasteInterceptor.d.ts.map +1 -1
  239. package/dist/plugins/formula.mjs +1 -1
  240. package/dist/plugins/gap-cursor.mjs +1 -1
  241. package/dist/plugins/hard-break.mjs +1 -1
  242. package/dist/plugins/heading.mjs +1 -1
  243. package/dist/plugins/highlight.mjs +1 -1
  244. package/dist/plugins/horizontal-rule.mjs +1 -1
  245. package/dist/plugins/image.mjs +1 -1
  246. package/dist/plugins/inline-code.mjs +1 -1
  247. package/dist/plugins/language.mjs +1 -1
  248. package/dist/plugins/link.mjs +1 -1
  249. package/dist/plugins/list/ListCommands.d.ts.map +1 -1
  250. package/dist/plugins/list/ListPlugin.d.ts +9 -0
  251. package/dist/plugins/list/ListPlugin.d.ts.map +1 -1
  252. package/dist/plugins/list.mjs +1 -1
  253. package/dist/plugins/print.mjs +1 -1
  254. package/dist/plugins/shared/NodeSpecPatching.d.ts +2 -2
  255. package/dist/plugins/shared/NodeSpecPatching.d.ts.map +1 -1
  256. package/dist/plugins/shared.mjs +1 -1
  257. package/dist/plugins/smart-paste.mjs +1 -1
  258. package/dist/plugins/strikethrough.mjs +1 -1
  259. package/dist/plugins/super-sub.mjs +1 -1
  260. package/dist/plugins/table.mjs +1 -1
  261. package/dist/plugins/text-color.mjs +1 -1
  262. package/dist/plugins/text-direction-auto.mjs +1 -1
  263. package/dist/plugins/text-direction.mjs +1 -1
  264. package/dist/plugins/text-formatting.mjs +1 -1
  265. package/dist/plugins/toolbar.mjs +1 -1
  266. package/dist/plugins/video/VideoNodeSpec.d.ts.map +1 -1
  267. package/dist/plugins/video/VideoPlugin.d.ts.map +1 -1
  268. package/dist/plugins/video/VideoProviders.d.ts +3 -3
  269. package/dist/plugins/video/VideoSanitizeHook.d.ts +4 -20
  270. package/dist/plugins/video/VideoSanitizeHook.d.ts.map +1 -1
  271. package/dist/plugins/video.mjs +1 -1
  272. package/dist/presets/full.mjs +1 -1
  273. package/dist/presets/minimal.mjs +1 -1
  274. package/dist/presets.mjs +1 -1
  275. package/dist/register.mjs +1 -1
  276. package/dist/serialization/DocumentParser.d.ts.map +1 -1
  277. package/dist/serialization/DocumentSerializer.d.ts.map +1 -1
  278. package/dist/serialization/HTMLSanitization.d.ts +12 -0
  279. package/dist/serialization/HTMLSanitization.d.ts.map +1 -1
  280. package/dist/state/EditorState.d.ts +2 -0
  281. package/dist/state/EditorState.d.ts.map +1 -1
  282. package/dist/state/History.d.ts.map +1 -1
  283. package/dist/state/Mapping.d.ts +2 -0
  284. package/dist/state/Mapping.d.ts.map +1 -1
  285. package/dist/state/StepHandlers.d.ts.map +1 -1
  286. package/dist/state/TransactionBuilder.d.ts +2 -0
  287. package/dist/state/TransactionBuilder.d.ts.map +1 -1
  288. package/dist/state/TransactionFinalizer.d.ts +10 -0
  289. package/dist/state/TransactionFinalizer.d.ts.map +1 -0
  290. package/dist/state/TransactionSnapshot.d.ts +32 -0
  291. package/dist/state/TransactionSnapshot.d.ts.map +1 -0
  292. package/dist/test/TestUtils.d.ts.map +1 -1
  293. package/dist/view/BlockRendering.d.ts +13 -2
  294. package/dist/view/BlockRendering.d.ts.map +1 -1
  295. package/dist/view/DecorationRendering.d.ts +19 -8
  296. package/dist/view/DecorationRendering.d.ts.map +1 -1
  297. package/dist/view/EditorView.d.ts +10 -0
  298. package/dist/view/EditorView.d.ts.map +1 -1
  299. package/dist/view/EditorViewEvents.d.ts +27 -2
  300. package/dist/view/EditorViewEvents.d.ts.map +1 -1
  301. package/dist/view/NodeViewCallbackBoundary.d.ts +12 -0
  302. package/dist/view/NodeViewCallbackBoundary.d.ts.map +1 -0
  303. package/dist/view/NodeViewOwnership.d.ts +12 -0
  304. package/dist/view/NodeViewOwnership.d.ts.map +1 -0
  305. package/dist/view/NodeViewRegistry.d.ts +7 -1
  306. package/dist/view/NodeViewRegistry.d.ts.map +1 -1
  307. package/dist/view/Reconciler.d.ts +6 -0
  308. package/dist/view/Reconciler.d.ts.map +1 -1
  309. package/dist/view/SelectionSync.d.ts +6 -0
  310. package/dist/view/SelectionSync.d.ts.map +1 -1
  311. package/package.json +6 -6
  312. package/dist/chunks/AlignmentPlugin-C9Rr_R-g.mjs +0 -2
  313. package/dist/chunks/AlignmentPlugin-C9Rr_R-g.mjs.map +0 -1
  314. package/dist/chunks/AttributedMarkCommands-BCvmqeFZ.mjs +0 -2
  315. package/dist/chunks/AttributedMarkCommands-BCvmqeFZ.mjs.map +0 -1
  316. package/dist/chunks/BlockInsertion-CYH2gRkY.mjs +0 -2
  317. package/dist/chunks/BlockquotePlugin-0bZSbkyo.mjs +0 -2
  318. package/dist/chunks/CaretNavigationPlugin-BPZ9b6XR.mjs +0 -2
  319. package/dist/chunks/CaretNavigationPlugin-BPZ9b6XR.mjs.map +0 -1
  320. package/dist/chunks/CodeBlockPlugin-BCJ3faXx.mjs +0 -2
  321. package/dist/chunks/ColorGrid-DQEkJ-0y.mjs +0 -2
  322. package/dist/chunks/ColorPickerPopup-CyF26zIU.mjs +0 -2
  323. package/dist/chunks/ColorValidation-DAijTjG9.mjs +0 -2
  324. package/dist/chunks/Commands-D5ND50PQ.mjs +0 -2
  325. package/dist/chunks/Commands-D5ND50PQ.mjs.map +0 -1
  326. package/dist/chunks/ContentModel-NpAj7vGW.mjs +0 -2
  327. package/dist/chunks/Decoration-BOP1TAUd.mjs +0 -2
  328. package/dist/chunks/Decoration-BOP1TAUd.mjs.map +0 -1
  329. package/dist/chunks/Document-827l3P80.mjs +0 -2
  330. package/dist/chunks/Document-827l3P80.mjs.map +0 -1
  331. package/dist/chunks/DocumentParser-D2tr3ZKn.mjs +0 -2
  332. package/dist/chunks/DocumentParser-D2tr3ZKn.mjs.map +0 -1
  333. package/dist/chunks/FontPlugin-D041tiLe.mjs +0 -2
  334. package/dist/chunks/FontPlugin-D041tiLe.mjs.map +0 -1
  335. package/dist/chunks/FontSizePlugin-8CAvj1RD.mjs +0 -2
  336. package/dist/chunks/FontSizePlugin-8CAvj1RD.mjs.map +0 -1
  337. package/dist/chunks/FormulaPlugin-DJ39BtqV.mjs +0 -2
  338. package/dist/chunks/GapCursorNavigation-DCWOmopl.mjs +0 -2
  339. package/dist/chunks/GapCursorNavigation-DCWOmopl.mjs.map +0 -1
  340. package/dist/chunks/GapCursorPlugin-2iR6506y.mjs +0 -2
  341. package/dist/chunks/GapCursorPlugin-2iR6506y.mjs.map +0 -1
  342. package/dist/chunks/HTMLUtils-Bhg3_P8B.mjs +0 -2
  343. package/dist/chunks/HardBreakPlugin-vniSvTgq.mjs +0 -2
  344. package/dist/chunks/HeadingPlugin-DUKsLuMd.mjs +0 -2
  345. package/dist/chunks/HeadingPlugin-DUKsLuMd.mjs.map +0 -1
  346. package/dist/chunks/HorizontalRulePlugin-B9OvwrKB.mjs +0 -2
  347. package/dist/chunks/ImagePlugin-CwxTRr6d.mjs +0 -2
  348. package/dist/chunks/ImagePlugin-CwxTRr6d.mjs.map +0 -1
  349. package/dist/chunks/InlineCodePlugin-uxgMUX_E.mjs +0 -2
  350. package/dist/chunks/ListPlugin-BchSFWVn.mjs +0 -2
  351. package/dist/chunks/ListPlugin-BchSFWVn.mjs.map +0 -1
  352. package/dist/chunks/MarkdownHTMLRegistry-Q7l0d6Ma.mjs +0 -2
  353. package/dist/chunks/MarkdownParser-Dp62mfUq.mjs +0 -2
  354. package/dist/chunks/MarkdownSerializer-DBELFAeo.mjs +0 -2
  355. package/dist/chunks/NodeSelectionCommands-WH5snxr_.mjs +0 -2
  356. package/dist/chunks/NodeSpecPatching-B_yLknTl.mjs +0 -2
  357. package/dist/chunks/NodeSpecPatching-B_yLknTl.mjs.map +0 -1
  358. package/dist/chunks/PopupKeyboardPatterns-tUrT9TyV.mjs +0 -2
  359. package/dist/chunks/PopupManager-Cj86uDEB.mjs +0 -2
  360. package/dist/chunks/PrintPlugin-D2javl_d.mjs +0 -2
  361. package/dist/chunks/PrintPlugin-D2javl_d.mjs.map +0 -1
  362. package/dist/chunks/SchemaRegistry-CkBN-1yW.mjs +0 -2
  363. package/dist/chunks/SchemaRegistry-CkBN-1yW.mjs.map +0 -1
  364. package/dist/chunks/Selection-HYoVFpAx.mjs +0 -2
  365. package/dist/chunks/Selection-HYoVFpAx.mjs.map +0 -1
  366. package/dist/chunks/SelectionSync-BSHIw1EE.mjs +0 -2
  367. package/dist/chunks/SelectionSync-BSHIw1EE.mjs.map +0 -1
  368. package/dist/chunks/SimpleMark-gTQaSJcO.mjs +0 -2
  369. package/dist/chunks/SmartPastePlugin-BvJQ-fOz.mjs +0 -2
  370. package/dist/chunks/StyleRuntime-DW6omotc.mjs +0 -2
  371. package/dist/chunks/SuperSubPlugin-DTZB0Y3D.mjs +0 -2
  372. package/dist/chunks/TableDimensions-BBhjHNjQ.mjs +0 -2
  373. package/dist/chunks/TableDimensions-BBhjHNjQ.mjs.map +0 -1
  374. package/dist/chunks/TablePlugin-CPvg9YZS.mjs +0 -2
  375. package/dist/chunks/TablePlugin-CPvg9YZS.mjs.map +0 -1
  376. package/dist/chunks/TextDirectionAutoPlugin-DRGbgTlx.mjs +0 -2
  377. package/dist/chunks/TextDirectionPlugin-BCeYyJHo.mjs +0 -2
  378. package/dist/chunks/TextDirectionPlugin-BCeYyJHo.mjs.map +0 -1
  379. package/dist/chunks/TextFormattingPlugin-BhRxSC8q.mjs +0 -2
  380. package/dist/chunks/ThemeEngine-BUVo_zaT.mjs +0 -3
  381. package/dist/chunks/ThemeEngine-BUVo_zaT.mjs.map +0 -1
  382. package/dist/chunks/ToolbarPlugin-dmTj1jIz.mjs.map +0 -1
  383. package/dist/chunks/VideoPlugin-BugkI7-m.mjs +0 -2
  384. package/dist/chunks/VideoPlugin-BugkI7-m.mjs.map +0 -1
  385. package/dist/chunks/WordBoundary-CFpIJDNP.mjs +0 -2
  386. package/dist/chunks/WordBoundary-CFpIJDNP.mjs.map +0 -1
  387. package/dist/chunks/full-JM0-SwWy.mjs +0 -2
  388. package/dist/chunks/minimal-DSlR2A27.mjs +0 -2
  389. package/dist/chunks/register-BjsdJ3Aq.mjs +0 -2
  390. package/dist/chunks/register-BjsdJ3Aq.mjs.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"ImagePlugin-CwxTRr6d.mjs","names":[],"sources":["../../src/editor/styles/image.ts","../../src/plugins/image/ImageCommands.ts","../../src/plugins/image/ImageLocale.ts","../../src/plugins/image/ImageNodeView.ts","../../src/plugins/image/ImagePopup.ts","../../src/plugins/image/ImagePopupStyles.ts","../../src/plugins/image/ImageUpload.ts","../../src/plugins/image/ImagePlugin.ts"],"sourcesContent":["/** Image styles — display, alignment, resize handles, upload overlay. */\nexport const IMAGE_CSS = `\n/* Image */\n.notectl-image {\n\tmargin: 8px 0;\n\tuser-select: none;\n\tline-height: 0;\n}\n\n.notectl-image--center {\n\ttext-align: center;\n}\n\n.notectl-image--start {\n\ttext-align: start;\n}\n\n.notectl-image--end {\n\ttext-align: end;\n}\n\n.notectl-image__container {\n\tdisplay: inline-block;\n\tposition: relative;\n\tline-height: 0;\n}\n\n.notectl-image__img {\n\tdisplay: block;\n\tmax-width: 100%;\n\tborder-radius: 4px;\n}\n\n.notectl-image--selected .notectl-image__container {\n\toutline: 2px solid var(--notectl-primary);\n\toutline-offset: 2px;\n\tborder-radius: 6px;\n}\n\n/* Alignment toolbar (appears on image selection) */\n.notectl-image__align-toolbar {\n\tdisplay: flex;\n\tgap: 2px;\n\tposition: absolute;\n\ttop: -36px;\n\tleft: 50%;\n\ttransform: translateX(-50%);\n\tbackground: var(--notectl-surface-overlay);\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 6px;\n\tpadding: 2px;\n\tbox-shadow: 0 2px 8px var(--notectl-shadow);\n\tz-index: 10;\n}\n\n.notectl-image__align-btn {\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\twidth: 28px;\n\theight: 28px;\n\tborder: none;\n\tbackground: transparent;\n\tborder-radius: 4px;\n\tcursor: pointer;\n\tcolor: var(--notectl-fg);\n}\n\n.notectl-image__align-btn:hover {\n\tbackground: var(--notectl-hover-bg);\n}\n\n.notectl-image__align-btn--active {\n\tbackground: var(--notectl-active-bg);\n\tcolor: var(--notectl-primary-fg);\n}\n\n.notectl-image__align-btn svg {\n\twidth: 16px;\n\theight: 16px;\n\tfill: currentColor;\n}\n\n/* Upload overlay */\n.notectl-image__overlay {\n\tposition: absolute;\n\tinset: 0;\n\tdisplay: none;\n\talign-items: center;\n\tjustify-content: center;\n\tbackground: rgba(255, 255, 255, 0.8);\n\tborder-radius: 4px;\n\tfont-size: 13px;\n\tcolor: var(--notectl-fg-muted);\n}\n\n.notectl-image__overlay--uploading {\n\tdisplay: flex;\n}\n\n.notectl-image__overlay--error {\n\tdisplay: flex;\n\tbackground: var(--notectl-danger-muted);\n\tcolor: var(--notectl-danger);\n}\n\n/* Resize overlay + handles */\n.notectl-image__resize-overlay {\n\tposition: absolute;\n\tinset: 0;\n\tpointer-events: none;\n}\n\n.notectl-image__resize-handle {\n\tposition: absolute;\n\twidth: 10px;\n\theight: 10px;\n\tbackground: var(--notectl-surface-raised);\n\tborder: 2px solid var(--notectl-primary);\n\tborder-radius: 50%;\n\tpointer-events: all;\n\tz-index: 2;\n\ttransition: transform 0.1s, background 0.1s;\n}\n\n.notectl-image__resize-handle:hover {\n\tbackground: var(--notectl-primary);\n\ttransform: scale(1.3);\n}\n\n.notectl-image--resizing .notectl-image__resize-handle {\n\tbackground: var(--notectl-primary);\n}\n\n.notectl-image__resize-handle--nw {\n\ttop: -5px;\n\tinset-inline-start: -5px;\n\tcursor: nwse-resize;\n}\n\n.notectl-image__resize-handle--ne {\n\ttop: -5px;\n\tinset-inline-end: -5px;\n\tcursor: nesw-resize;\n}\n\n.notectl-image__resize-handle--sw {\n\tbottom: -5px;\n\tinset-inline-start: -5px;\n\tcursor: nesw-resize;\n}\n\n.notectl-image__resize-handle--se {\n\tbottom: -5px;\n\tinset-inline-end: -5px;\n\tcursor: nwse-resize;\n}\n\n/* RTL cursor overrides — flip diagonal cursors when in RTL context */\n[dir=\"rtl\"] .notectl-image__resize-handle--nw {\n\tcursor: nesw-resize;\n}\n\n[dir=\"rtl\"] .notectl-image__resize-handle--ne {\n\tcursor: nwse-resize;\n}\n\n[dir=\"rtl\"] .notectl-image__resize-handle--sw {\n\tcursor: nwse-resize;\n}\n\n[dir=\"rtl\"] .notectl-image__resize-handle--se {\n\tcursor: nesw-resize;\n}\n\n/* Size indicator tooltip */\n.notectl-image__size-indicator {\n\tposition: absolute;\n\tbottom: -28px;\n\tleft: 50%;\n\ttransform: translateX(-50%);\n\tpadding: 2px 8px;\n\tbackground: var(--notectl-tooltip-bg);\n\tcolor: var(--notectl-tooltip-fg);\n\tfont-size: 11px;\n\tfont-weight: 500;\n\tborder-radius: 4px;\n\twhite-space: nowrap;\n\tpointer-events: none;\n\topacity: 0;\n\ttransition: opacity 0.15s;\n\tz-index: 3;\n}\n\n.notectl-image__size-indicator--visible {\n\topacity: 1;\n}\n\n/* Keyboard resize hint (shown on selection, hidden during drag) */\n.notectl-image__keyboard-hint {\n\tdisplay: none;\n\tposition: absolute;\n\tbottom: -28px;\n\tleft: 50%;\n\ttransform: translateX(-50%);\n\tpadding: 2px 8px;\n\tfont-size: 11px;\n\tcolor: var(--notectl-fg-muted);\n\twhite-space: nowrap;\n\tpointer-events: none;\n\tz-index: 3;\n}\n\n.notectl-image--selected .notectl-image__keyboard-hint {\n\tdisplay: block;\n}\n\n.notectl-image--resizing .notectl-image__keyboard-hint {\n\tdisplay: none;\n}\n\n/* Resizing feedback */\n.notectl-image--resizing .notectl-image__img {\n\topacity: 0.85;\n}\n`;\n","/**\n * Image plugin commands: insert, remove, and attribute updates.\n * Supports both root-level and nested contexts (e.g. images inside table cells).\n */\n\nimport { insertBlockObjectOnOwnLine } from '../../commands/BlockInsertion.js';\nimport { deleteNodeSelection } from '../../commands/NodeSelectionCommands.js';\nimport type { BlockAttrs, BlockNode } from '../../model/Document.js';\nimport { createBlockNode, getBlockChildren, isBlockNode } from '../../model/Document.js';\nimport { createNodeSelection, isGapCursor, isNodeSelection } from '../../model/Selection.js';\nimport type { BlockId } from '../../model/TypeBrands.js';\nimport { nodeType } from '../../model/TypeBrands.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { PluginContext } from '../Plugin.js';\nimport type { ImageAttrs } from './ImageUpload.js';\n\n/**\n * Inserts an image block. When the cursor is inside a table cell,\n * the image is inserted as a child of the cell. Otherwise it is\n * inserted after the current block at document root.\n */\nexport function insertImage(\n\tcontext: PluginContext,\n\tattrs: Partial<ImageAttrs> & { readonly src: string },\n): boolean {\n\tconst state = context.getState();\n\tconst sel = state.selection;\n\n\tconst imageAttrs: BlockAttrs = {\n\t\tsrc: attrs.src,\n\t\talt: attrs.alt ?? '',\n\t\talign: attrs.align ?? 'center',\n\t\t...(attrs.width !== undefined ? { width: attrs.width } : {}),\n\t\t...(attrs.height !== undefined ? { height: attrs.height } : {}),\n\t};\n\n\tif (isGapCursor(sel)) return false;\n\n\tconst anchorBlockId: BlockId = isNodeSelection(sel) ? sel.nodeId : sel.anchor.blockId;\n\n\t// Check if we're inside a table cell\n\tconst cellId: BlockId | undefined = findTableCellAncestor(state, anchorBlockId);\n\tif (cellId) {\n\t\treturn insertImageIntoCell(state, context, cellId, imageAttrs);\n\t}\n\n\treturn insertImageAtRoot(state, context, anchorBlockId, imageAttrs);\n}\n\n/** Finds a table_cell ancestor for the given block (or the block itself). */\nfunction findTableCellAncestor(state: EditorState, bid: BlockId): BlockId | undefined {\n\tconst block: BlockNode | undefined = state.getBlock(bid);\n\tif (block?.type === 'table_cell') return bid;\n\n\tconst path: BlockId[] | undefined = state.getNodePath(bid);\n\tif (!path) return undefined;\n\n\tfor (const id of path) {\n\t\tconst node: BlockNode | undefined = state.getBlock(id);\n\t\tif (node?.type === 'table_cell') return id;\n\t}\n\treturn undefined;\n}\n\n/** Inserts an image on its own line at document root, after the anchor block. */\nfunction insertImageAtRoot(\n\tstate: EditorState,\n\tcontext: PluginContext,\n\tanchorBlockId: BlockId,\n\timageAttrs: BlockAttrs,\n): boolean {\n\tconst imageBlock: BlockNode = createBlockNode(nodeType('image'), [], undefined, imageAttrs);\n\tconst builder = state.transaction('command');\n\tconst trailing = insertBlockObjectOnOwnLine(state, builder, anchorBlockId, imageBlock);\n\tif (!trailing) return false;\n\n\tbuilder.setSelection(createNodeSelection(imageBlock.id, []));\n\tcontext.dispatch(builder.build());\n\treturn true;\n}\n\n/** Inserts an image as a child of a table cell. */\nfunction insertImageIntoCell(\n\tstate: EditorState,\n\tcontext: PluginContext,\n\tcellId: BlockId,\n\timageAttrs: BlockAttrs,\n): boolean {\n\tconst cellPath: BlockId[] | undefined = state.getNodePath(cellId);\n\tif (!cellPath) return false;\n\n\tconst imageBlock: BlockNode = createBlockNode(nodeType('image'), [], undefined, imageAttrs);\n\n\t// Remove existing block children first (if any)\n\tconst cell: BlockNode | undefined = state.getBlock(cellId);\n\tif (!cell) return false;\n\n\tconst builder = state.transaction('command');\n\tconst blockChildren: readonly BlockNode[] = getBlockChildren(cell);\n\tfor (let i = blockChildren.length - 1; i >= 0; i--) {\n\t\t// Find the raw index in children array\n\t\tconst rawIndex: number = cell.children.findIndex(\n\t\t\t(c) => isBlockNode(c) && c.id === blockChildren[i]?.id,\n\t\t);\n\t\tif (rawIndex !== -1) {\n\t\t\tbuilder.removeNode(cellPath, rawIndex);\n\t\t}\n\t}\n\n\t// Insert image at index 0 (before any text nodes)\n\tbuilder.insertNode(cellPath, 0, imageBlock);\n\tbuilder.setSelection(createNodeSelection(imageBlock.id, [...cellPath, imageBlock.id]));\n\n\tcontext.dispatch(builder.build());\n\treturn true;\n}\n\n/** Removes the currently selected image block (works for nested images too). */\nexport function removeImage(context: PluginContext): boolean {\n\tconst state = context.getState();\n\tconst sel = state.selection;\n\tif (!isNodeSelection(sel)) return false;\n\n\tconst block: BlockNode | undefined = state.getBlock(sel.nodeId);\n\tif (!block || block.type !== 'image') return false;\n\n\tconst nodePath: BlockId[] | undefined = state.getNodePath(sel.nodeId);\n\tif (!nodePath || nodePath.length === 0) return false;\n\n\tconst tr = deleteNodeSelection(state, createNodeSelection(sel.nodeId, nodePath));\n\tif (!tr) return false;\n\tcontext.dispatch(tr);\n\treturn true;\n}\n\n/** Updates attributes on the currently selected image block. */\nexport function setImageAttr(context: PluginContext, attrs: Partial<ImageAttrs>): boolean {\n\tconst state = context.getState();\n\tconst sel = state.selection;\n\tif (!isNodeSelection(sel)) return false;\n\n\tconst block: BlockNode | undefined = state.getBlock(sel.nodeId);\n\tif (!block || block.type !== 'image') return false;\n\n\tconst path: BlockId[] | undefined = state.getNodePath(sel.nodeId);\n\tif (!path) return false;\n\n\tconst merged: BlockAttrs = { ...(block.attrs ?? {}), ...attrs };\n\tconst tr = state.transaction('command').setNodeAttr(path, merged).build();\n\n\tcontext.dispatch(tr);\n\treturn true;\n}\n\n/** Minimum image width in pixels (shared with NodeView). */\nexport const MIN_IMAGE_WIDTH = 50;\n\n/**\n * Resizes the currently selected image by a pixel delta, preserving aspect ratio.\n * Returns false if no image is selected or the image has no width/height attributes.\n */\nexport function resizeImageByDelta(\n\tcontext: PluginContext,\n\tdelta: number,\n\tmaxWidth: number,\n): boolean {\n\tconst state = context.getState();\n\tconst sel = state.selection;\n\tif (!isNodeSelection(sel)) return false;\n\n\tconst block: BlockNode | undefined = state.getBlock(sel.nodeId);\n\tif (!block || block.type !== 'image') return false;\n\n\tconst currentWidth: number | undefined = block.attrs?.width as number | undefined;\n\tconst currentHeight: number | undefined = block.attrs?.height as number | undefined;\n\tif (currentWidth === undefined || currentHeight === undefined) return false;\n\n\tconst aspectRatio: number = currentHeight > 0 ? currentWidth / currentHeight : 1;\n\tconst clampedWidth: number = Math.max(MIN_IMAGE_WIDTH, Math.min(maxWidth, currentWidth + delta));\n\tconst newHeight: number = Math.round(clampedWidth / aspectRatio);\n\n\tif (clampedWidth === currentWidth && newHeight === currentHeight) return false;\n\n\treturn setImageAttr(context, { width: clampedWidth, height: newHeight });\n}\n\n/** Resets the currently selected image to its natural size by removing width/height. */\nexport function resetImageSize(context: PluginContext): boolean {\n\tconst state = context.getState();\n\tconst sel = state.selection;\n\tif (!isNodeSelection(sel)) return false;\n\n\tconst block: BlockNode | undefined = state.getBlock(sel.nodeId);\n\tif (!block || block.type !== 'image') return false;\n\n\tconst path: BlockId[] | undefined = state.getNodePath(sel.nodeId);\n\tif (!path) return false;\n\n\tconst attrs: BlockAttrs = { ...(block.attrs ?? {}) };\n\tconst cleaned: BlockAttrs = Object.fromEntries(\n\t\tObject.entries(attrs).filter(([k]) => k !== 'width' && k !== 'height'),\n\t);\n\n\tconst tr = state.transaction('command').setNodeAttr(path, cleaned).build();\n\tcontext.dispatch(tr);\n\treturn true;\n}\n\n/** Registers all image commands on the plugin context. */\nexport function registerImageCommands(context: PluginContext): void {\n\tcontext.registerCommand('insertImage', () => {\n\t\treturn insertImage(context, { src: '' });\n\t});\n\n\tcontext.registerCommand('removeImage', () => {\n\t\treturn removeImage(context);\n\t});\n}\n","/** Locale interface and default English locale for the ImagePlugin. */\n\nimport { type LocaleModuleMap, loadLocaleModule } from '../shared/LocaleLoader.js';\n\n// --- Locale Interface ---\n\nexport interface ImageLocale {\n\treadonly insertImage: string;\n\treadonly insertImageTooltip: string;\n\treadonly uploadFromComputer: string;\n\treadonly uploadAria: string;\n\treadonly separator: string;\n\treadonly urlPlaceholder: string;\n\treadonly urlAria: string;\n\treadonly insertButton: string;\n\treadonly insertAria: string;\n\treadonly imageAria: (alt: string, width?: number, height?: number) => string;\n\treadonly resetToNaturalSize: string;\n\treadonly uploadFailed: string;\n\treadonly uploading: string;\n\treadonly resizeHandleLabel: (position: string) => string;\n\treadonly imageSelected: string;\n\treadonly altTextPrefix: string;\n\treadonly imageSizeAnnounce: (w: number, h: number) => string;\n\treadonly resizeHint: (shrink: string, grow: string) => string;\n\treadonly imageResized: (w: number, h: number) => string;\n\treadonly keyboardResizeHint: (shrink: string, grow: string) => string;\n}\n\n// --- Default English Locale ---\n\nexport const IMAGE_LOCALE_EN: ImageLocale = {\n\tinsertImage: 'Insert Image',\n\tinsertImageTooltip: 'Insert Image',\n\tuploadFromComputer: 'Upload from computer',\n\tuploadAria: 'Upload image from computer',\n\tseparator: 'or',\n\turlPlaceholder: 'https://...',\n\turlAria: 'Image URL',\n\tinsertButton: 'Insert',\n\tinsertAria: 'Insert image',\n\timageAria: (alt: string, width?: number, height?: number) => {\n\t\tconst parts: string[] = [alt || 'Image'];\n\t\tif (width !== undefined && height !== undefined) {\n\t\t\tparts.push(`${width} by ${height} pixels`);\n\t\t}\n\t\treturn parts.join(', ');\n\t},\n\tresetToNaturalSize: 'Image reset to natural size.',\n\tuploadFailed: 'Upload failed.',\n\tuploading: 'Uploading...',\n\tresizeHandleLabel: (position: string) => `Resize ${position}`,\n\timageSelected: 'Image selected.',\n\taltTextPrefix: 'Alt text: ',\n\timageSizeAnnounce: (w: number, h: number) => `Size: ${w} by ${h} pixels.`,\n\tresizeHint: (shrink: string, grow: string) => `${shrink} / ${grow} to resize.`,\n\timageResized: (w: number, h: number) => `Image resized to ${w} by ${h} pixels.`,\n\tkeyboardResizeHint: (shrink: string, grow: string) => `${shrink} / ${grow} to resize`,\n};\n\n// --- Lazy Locale Loader ---\n\nconst localeModules: LocaleModuleMap<ImageLocale> = import.meta.glob<{\n\tdefault: ImageLocale;\n}>('./locales/*.ts', { eager: false });\n\nexport async function loadImageLocale(lang: string): Promise<ImageLocale> {\n\treturn loadLocaleModule(localeModules, lang, IMAGE_LOCALE_EN);\n}\n","/**\n * NodeView factory for image blocks.\n * Renders <figure> with <img>, handles selection state, upload overlay,\n * resize with 4 corner handles + live size indicator, and a keyboard-hint\n * showing resize shortcuts when the image is selected.\n */\n\nimport type { BlockAttrs, BlockNode } from '../../model/Document.js';\nimport type { BlockId } from '../../model/TypeBrands.js';\nimport { getTextDirection } from '../../platform/Platform.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { Transaction } from '../../state/Transaction.js';\nimport {\n\tgetStyleNonceForNode,\n\tsetStyleProperties,\n\tsetStyleProperty,\n} from '../../style/StyleRuntime.js';\nimport type { NodeView, NodeViewFactory } from '../../view/NodeView.js';\nimport { formatShortcut } from '../shared/ShortcutFormatting.js';\nimport { IMAGE_LOCALE_EN, type ImageLocale } from './ImageLocale.js';\nimport type { ImageKeymap, ImagePluginConfig, UploadState } from './ImageUpload.js';\n\nconst ALIGNMENT_CLASSES: Record<string, string> = {\n\tstart: 'notectl-image--start',\n\tcenter: 'notectl-image--center',\n\tend: 'notectl-image--end',\n};\n\nconst MIN_IMAGE_WIDTH = 50;\n\ntype HandlePosition = 'nw' | 'ne' | 'sw' | 'se';\n\nconst HANDLE_CURSORS: Readonly<Record<HandlePosition, string>> = {\n\tnw: 'nwse-resize',\n\tne: 'nesw-resize',\n\tsw: 'nesw-resize',\n\tse: 'nwse-resize',\n};\n\n/** +1 means dragging right increases width; -1 means dragging left does. */\nconst HANDLE_X_SIGN: Readonly<Record<HandlePosition, 1 | -1>> = {\n\tnw: -1,\n\tne: 1,\n\tsw: -1,\n\tse: 1,\n};\n\nconst HANDLE_POSITIONS_LTR: Readonly<Record<HandlePosition, string>> = {\n\tnw: 'top-left',\n\tne: 'top-right',\n\tsw: 'bottom-left',\n\tse: 'bottom-right',\n};\n\nconst HANDLE_POSITIONS_RTL: Readonly<Record<HandlePosition, string>> = {\n\tnw: 'top-right',\n\tne: 'top-left',\n\tsw: 'bottom-right',\n\tse: 'bottom-left',\n};\n\nconst RTL_CURSOR_MAP: Readonly<Record<HandlePosition, string>> = {\n\tnw: 'nesw-resize',\n\tne: 'nwse-resize',\n\tsw: 'nwse-resize',\n\tse: 'nesw-resize',\n};\n\n/** Returns the direction-aware ARIA label for a resize handle. */\nexport function getHandleLabel(\n\tposition: HandlePosition,\n\tisRtl: boolean,\n\tlocale: ImageLocale = IMAGE_LOCALE_EN,\n): string {\n\tconst positionName: string = (isRtl ? HANDLE_POSITIONS_RTL : HANDLE_POSITIONS_LTR)[position];\n\treturn locale.resizeHandleLabel(positionName);\n}\n\n/** Returns the X-sign for resize drag, flipped in RTL. */\nexport function getResizeXSign(position: HandlePosition, isRtl: boolean): 1 | -1 {\n\tconst sign: 1 | -1 = HANDLE_X_SIGN[position];\n\treturn isRtl ? (-sign as 1 | -1) : sign;\n}\n\n// --- Global cursor override during resize ---\n\nlet activeCursorStyle: HTMLStyleElement | null = null;\n\nfunction setGlobalResizeCursor(cursor: string, referenceNode?: Node): void {\n\tclearGlobalResizeCursor();\n\tactiveCursorStyle = document.createElement('style');\n\tconst nonce = referenceNode ? getStyleNonceForNode(referenceNode) : undefined;\n\tif (nonce) {\n\t\tactiveCursorStyle.setAttribute('nonce', nonce);\n\t}\n\tactiveCursorStyle.textContent = `*{cursor:${cursor}!important;user-select:none!important}`;\n\tdocument.head.appendChild(activeCursorStyle);\n}\n\nfunction clearGlobalResizeCursor(): void {\n\tif (activeCursorStyle) {\n\t\tactiveCursorStyle.remove();\n\t\tactiveCursorStyle = null;\n\t}\n}\n\n/** Builds the keyboard-hint text from the resolved keymap. */\nfunction buildKeyboardHintText(\n\tresolvedKeymap: Readonly<Record<keyof ImageKeymap, string | null>>,\n\tlocale: ImageLocale,\n): string {\n\tconst shrink: string | null = resolvedKeymap.shrinkWidth ?? null;\n\tconst grow: string | null = resolvedKeymap.growWidth ?? null;\n\tif (!shrink || !grow) return '';\n\treturn locale.keyboardResizeHint(formatShortcut(shrink), formatShortcut(grow));\n}\n\n/** Creates a NodeViewFactory for image blocks. */\nexport function createImageNodeViewFactory(\n\tconfig: ImagePluginConfig,\n\tuploadStates: Map<BlockId, UploadState>,\n\tresolvedKeymap?: Readonly<Record<keyof ImageKeymap, string | null>>,\n\tlocale: ImageLocale = IMAGE_LOCALE_EN,\n): NodeViewFactory {\n\treturn (\n\t\tnode: BlockNode,\n\t\tgetState: () => EditorState,\n\t\tdispatch: (tr: Transaction) => void,\n\t): NodeView => {\n\t\t// --- DOM Construction ---\n\t\tconst figure: HTMLElement = document.createElement('figure');\n\t\tfigure.className = 'notectl-image';\n\t\tfigure.setAttribute('data-block-id', node.id);\n\t\tfigure.setAttribute('data-void', 'true');\n\t\tfigure.setAttribute('data-selectable', 'true');\n\n\t\tconst container: HTMLDivElement = document.createElement('div');\n\t\tcontainer.className = 'notectl-image__container';\n\n\t\tconst img: HTMLImageElement = document.createElement('img');\n\t\timg.className = 'notectl-image__img';\n\t\timg.draggable = false;\n\n\t\tconst overlay: HTMLDivElement = document.createElement('div');\n\t\toverlay.className = 'notectl-image__overlay';\n\n\t\tcontainer.appendChild(img);\n\t\tcontainer.appendChild(overlay);\n\t\tfigure.appendChild(container);\n\n\t\tlet currentNodeId: BlockId = node.id;\n\t\tlet resizeOverlay: HTMLDivElement | null = null;\n\n\t\t// --- ARIA Label ---\n\n\t\tfunction updateAriaLabel(n: BlockNode): void {\n\t\t\tconst alt: string = (n.attrs?.alt as string | undefined) ?? '';\n\t\t\tconst width: number | undefined = n.attrs?.width as number | undefined;\n\t\t\tconst height: number | undefined = n.attrs?.height as number | undefined;\n\t\t\tfigure.setAttribute('aria-label', locale.imageAria(alt, width, height));\n\t\t}\n\n\t\t// --- Attribute Application ---\n\n\t\tfunction applyAttrs(n: BlockNode): void {\n\t\t\tconst src: string = (n.attrs?.src as string | undefined) ?? '';\n\t\t\tconst alt: string = (n.attrs?.alt as string | undefined) ?? '';\n\t\t\tconst width: number | undefined = n.attrs?.width as number | undefined;\n\t\t\tconst height: number | undefined = n.attrs?.height as number | undefined;\n\t\t\tconst align: string = (n.attrs?.align as string | undefined) ?? 'center';\n\n\t\t\t// Only update src when it changes to avoid re-triggering load events\n\t\t\tif (img.src !== src) img.src = src;\n\t\t\timg.alt = alt;\n\n\t\t\tif (width !== undefined) {\n\t\t\t\tsetStyleProperty(img, 'width', `${width}px`);\n\t\t\t} else {\n\t\t\t\tsetStyleProperty(img, 'width', '');\n\t\t\t}\n\t\t\tif (height !== undefined) {\n\t\t\t\tsetStyleProperty(img, 'height', `${height}px`);\n\t\t\t} else {\n\t\t\t\tsetStyleProperty(img, 'height', '');\n\t\t\t}\n\n\t\t\tfor (const cls of Object.values(ALIGNMENT_CLASSES)) {\n\t\t\t\tfigure.classList.remove(cls);\n\t\t\t}\n\t\t\tconst alignClass: string | undefined = ALIGNMENT_CLASSES[align];\n\t\t\tif (alignClass) {\n\t\t\t\tfigure.classList.add(alignClass);\n\t\t\t}\n\n\t\t\tconst uploadState: UploadState = uploadStates.get(n.id) ?? 'idle';\n\t\t\tconst isUploading: boolean = uploadState === 'uploading';\n\t\t\toverlay.classList.toggle('notectl-image__overlay--uploading', isUploading);\n\t\t\toverlay.classList.toggle('notectl-image__overlay--error', uploadState === 'error');\n\n\t\t\tif (isUploading) {\n\t\t\t\toverlay.textContent = locale.uploading;\n\t\t\t} else if (uploadState === 'error') {\n\t\t\t\toverlay.textContent = locale.uploadFailed;\n\t\t\t} else {\n\t\t\t\toverlay.textContent = '';\n\t\t\t}\n\n\t\t\tif (isUploading) {\n\t\t\t\tfigure.setAttribute('aria-busy', 'true');\n\t\t\t} else {\n\t\t\t\tfigure.removeAttribute('aria-busy');\n\t\t\t}\n\n\t\t\tupdateAriaLabel(n);\n\t\t}\n\n\t\tapplyAttrs(node);\n\n\t\t// --- Commit natural dimensions on first load ---\n\n\t\tlet dimensionsCommitted = false;\n\n\t\timg.addEventListener('load', () => {\n\t\t\tif (dimensionsCommitted) return;\n\n\t\t\tconst state: EditorState = getState();\n\t\t\tconst block: BlockNode | undefined = state.getBlock(currentNodeId);\n\t\t\tif (!block || block.type !== 'image') return;\n\n\t\t\tconst hasWidth: boolean = block.attrs?.width !== undefined;\n\t\t\tconst hasHeight: boolean = block.attrs?.height !== undefined;\n\t\t\tif (hasWidth && hasHeight) {\n\t\t\t\tdimensionsCommitted = true;\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst naturalW: number = img.naturalWidth;\n\t\t\tconst naturalH: number = img.naturalHeight;\n\t\t\tif (naturalW === 0 || naturalH === 0) return;\n\n\t\t\tconst clampedW: number = Math.min(naturalW, config.maxWidth);\n\t\t\tconst ratio: number = naturalW > 0 ? naturalH / naturalW : 1;\n\t\t\tconst clampedH: number = Math.round(clampedW * ratio);\n\n\t\t\tconst path: BlockId[] | undefined = state.getNodePath(currentNodeId);\n\t\t\tif (!path) return;\n\n\t\t\tconst merged: BlockAttrs = {\n\t\t\t\t...(block.attrs ?? {}),\n\t\t\t\twidth: clampedW,\n\t\t\t\theight: clampedH,\n\t\t\t};\n\n\t\t\tconst tr: Transaction = state.transaction('command').setNodeAttr(path, merged).build();\n\t\t\tdispatch(tr);\n\t\t\tdimensionsCommitted = true;\n\t\t});\n\n\t\t// --- Resize Logic ---\n\n\t\tfunction clampWidth(width: number): number {\n\t\t\treturn Math.max(MIN_IMAGE_WIDTH, Math.min(config.maxWidth, width));\n\t\t}\n\n\t\tfunction commitResize(nodeId: BlockId, width: number, height: number): void {\n\t\t\tconst state: EditorState = getState();\n\t\t\tconst block: BlockNode | undefined = state.getBlock(nodeId);\n\t\t\tif (!block) return;\n\n\t\t\tconst prevWidth: number | undefined = block.attrs?.width as number | undefined;\n\t\t\tconst prevHeight: number | undefined = block.attrs?.height as number | undefined;\n\t\t\tif (prevWidth === width && prevHeight === height) return;\n\n\t\t\tconst path: BlockId[] | undefined = state.getNodePath(nodeId);\n\t\t\tif (!path) return;\n\n\t\t\tconst merged: BlockAttrs = {\n\t\t\t\t...(block.attrs ?? {}),\n\t\t\t\twidth,\n\t\t\t\theight,\n\t\t\t};\n\n\t\t\tconst tr: Transaction = state.transaction('command').setNodeAttr(path, merged).build();\n\t\t\tdispatch(tr);\n\t\t}\n\n\t\tfunction attachHandleListeners(\n\t\t\thandle: HTMLDivElement,\n\t\t\tposition: HandlePosition,\n\t\t\tnodeId: BlockId,\n\t\t\tsizeIndicator: HTMLDivElement,\n\t\t): void {\n\t\t\tlet startX = 0;\n\t\t\tlet startWidth = 0;\n\t\t\tlet aspectRatio = 1;\n\t\t\tlet xSign: 1 | -1 = HANDLE_X_SIGN[position];\n\n\t\t\tconst onPointerMove = (e: PointerEvent): void => {\n\t\t\t\tconst deltaX: number = e.clientX - startX;\n\t\t\t\tconst newWidth: number = clampWidth(startWidth + deltaX * xSign);\n\t\t\t\tconst newHeight: number = Math.round(newWidth / aspectRatio);\n\n\t\t\t\tsetStyleProperties(img, {\n\t\t\t\t\twidth: `${newWidth}px`,\n\t\t\t\t\theight: `${newHeight}px`,\n\t\t\t\t});\n\n\t\t\t\tsizeIndicator.textContent = `${Math.round(newWidth)} \\u00D7 ${newHeight}`;\n\t\t\t};\n\n\t\t\tconst onPointerUp = (e: PointerEvent): void => {\n\t\t\t\tdocument.removeEventListener('pointermove', onPointerMove);\n\t\t\t\tdocument.removeEventListener('pointerup', onPointerUp);\n\n\t\t\t\tfigure.classList.remove('notectl-image--resizing');\n\t\t\t\tsizeIndicator.classList.remove('notectl-image__size-indicator--visible');\n\t\t\t\tclearGlobalResizeCursor();\n\n\t\t\t\tconst finalWidth: number = Math.round(img.getBoundingClientRect().width);\n\t\t\t\tconst finalHeight: number = Math.round(finalWidth / aspectRatio);\n\n\t\t\t\tcommitResize(nodeId, finalWidth, finalHeight);\n\n\t\t\t\t(e.target as HTMLElement | null)?.releasePointerCapture?.(e.pointerId);\n\t\t\t};\n\n\t\t\thandle.addEventListener('pointerdown', (e: PointerEvent) => {\n\t\t\t\te.preventDefault();\n\t\t\t\te.stopPropagation();\n\n\t\t\t\tconst isRtl: boolean = getTextDirection(figure) === 'rtl';\n\t\t\t\txSign = getResizeXSign(position, isRtl);\n\n\t\t\t\tstartX = e.clientX;\n\t\t\t\tstartWidth = img.getBoundingClientRect().width;\n\t\t\t\tconst imgHeight: number = img.getBoundingClientRect().height;\n\t\t\t\taspectRatio = imgHeight > 0 ? startWidth / imgHeight : 1;\n\n\t\t\t\tfigure.classList.add('notectl-image--resizing');\n\t\t\t\tsizeIndicator.textContent = `${Math.round(startWidth)} \\u00D7 ${Math.round(imgHeight)}`;\n\t\t\t\tsizeIndicator.classList.add('notectl-image__size-indicator--visible');\n\t\t\t\tconst cursor: string = isRtl ? RTL_CURSOR_MAP[position] : HANDLE_CURSORS[position];\n\t\t\t\tsetGlobalResizeCursor(cursor, figure);\n\n\t\t\t\t(e.target as HTMLElement).setPointerCapture(e.pointerId);\n\t\t\t\tdocument.addEventListener('pointermove', onPointerMove);\n\t\t\t\tdocument.addEventListener('pointerup', onPointerUp);\n\t\t\t});\n\t\t}\n\n\t\tfunction createResizeOverlay(nodeId: BlockId): void {\n\t\t\tif (!config.resizable || resizeOverlay) return;\n\n\t\t\tresizeOverlay = document.createElement('div');\n\t\t\tresizeOverlay.className = 'notectl-image__resize-overlay';\n\t\t\tresizeOverlay.setAttribute('data-notectl-no-print', '');\n\n\t\t\tconst sizeIndicator: HTMLDivElement = document.createElement('div');\n\t\t\tsizeIndicator.className = 'notectl-image__size-indicator';\n\t\t\tresizeOverlay.appendChild(sizeIndicator);\n\n\t\t\tconst positions: readonly HandlePosition[] = ['nw', 'ne', 'sw', 'se'];\n\t\t\tfor (const pos of positions) {\n\t\t\t\tconst handle: HTMLDivElement = document.createElement('div');\n\t\t\t\thandle.className = `notectl-image__resize-handle notectl-image__resize-handle--${pos}`;\n\t\t\t\t// Pointer-only visual grips. Keyboard resize is provided via shortcuts\n\t\t\t\t// with live-region announcements (see registerResizeKeymaps), so these\n\t\t\t\t// decorative handles are hidden from assistive technology rather than\n\t\t\t\t// exposed with a misleading `separator` role.\n\t\t\t\thandle.setAttribute('aria-hidden', 'true');\n\t\t\t\tattachHandleListeners(handle, pos, nodeId, sizeIndicator);\n\t\t\t\tresizeOverlay.appendChild(handle);\n\t\t\t}\n\n\t\t\t// Keyboard hint (hidden from screenreaders, visual only)\n\t\t\tif (resolvedKeymap) {\n\t\t\t\tconst hintText: string = buildKeyboardHintText(resolvedKeymap, locale);\n\t\t\t\tif (hintText) {\n\t\t\t\t\tconst hint: HTMLDivElement = document.createElement('div');\n\t\t\t\t\thint.className = 'notectl-image__keyboard-hint';\n\t\t\t\t\thint.setAttribute('aria-hidden', 'true');\n\t\t\t\t\thint.textContent = hintText;\n\t\t\t\t\tresizeOverlay.appendChild(hint);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tcontainer.appendChild(resizeOverlay);\n\t\t}\n\n\t\tfunction removeResizeOverlay(): void {\n\t\t\tclearGlobalResizeCursor();\n\t\t\tif (resizeOverlay) {\n\t\t\t\tresizeOverlay.remove();\n\t\t\t\tresizeOverlay = null;\n\t\t\t}\n\t\t}\n\n\t\t// --- NodeView Interface ---\n\n\t\treturn {\n\t\t\tdom: figure,\n\t\t\tcontentDOM: null,\n\n\t\t\tupdate(updatedNode: BlockNode): boolean {\n\t\t\t\tif (updatedNode.type !== 'image') return false;\n\t\t\t\tcurrentNodeId = updatedNode.id;\n\t\t\t\tfigure.setAttribute('data-block-id', updatedNode.id);\n\t\t\t\tapplyAttrs(updatedNode);\n\t\t\t\treturn true;\n\t\t\t},\n\n\t\t\tselectNode(): void {\n\t\t\t\tfigure.classList.add('notectl-image--selected');\n\t\t\t\tcreateResizeOverlay(currentNodeId);\n\t\t\t},\n\n\t\t\tdeselectNode(): void {\n\t\t\t\tfigure.classList.remove('notectl-image--selected');\n\t\t\t\tremoveResizeOverlay();\n\t\t\t},\n\n\t\t\tdestroy(): void {\n\t\t\t\tremoveResizeOverlay();\n\t\t\t\t// Do NOT revoke blob URLs here — the URL may still be referenced\n\t\t\t\t// by the clipboard (cut/paste) or undo history. Blob URLs are\n\t\t\t\t// automatically released when the document is unloaded.\n\t\t\t},\n\t\t};\n\t};\n}\n","/**\n * Renders the image insert popup with file upload and URL input,\n * following the same pattern as FontSizePopup.\n */\n\nimport type { PluginContext } from '../Plugin.js';\nimport { insertImage } from './ImageCommands.js';\nimport type { ImageLocale } from './ImageLocale.js';\n\n// --- Config ---\n\nexport interface ImagePopupConfig {\n\treadonly acceptedTypes: readonly string[];\n\treadonly locale: ImageLocale;\n\treadonly onFileInsert: (context: PluginContext, file: File) => void;\n\treadonly onClose: () => void;\n}\n\n// --- Public Entry Point ---\n\n/** Builds the image insert popup DOM inside the given container. */\nexport function renderImagePopup(\n\tcontainer: HTMLElement,\n\tcontext: PluginContext,\n\tconfig: ImagePopupConfig,\n): void {\n\tcontainer.classList.add('notectl-image-popup');\n\n\tappendFileUploadSection(container, context, config);\n\tappendSeparator(container, config.locale);\n\tappendUrlSection(container, context, config);\n}\n\n// --- File Upload Section ---\n\nfunction appendFileUploadSection(\n\tcontainer: HTMLElement,\n\tcontext: PluginContext,\n\tconfig: ImagePopupConfig,\n): void {\n\tconst fileInput: HTMLInputElement = document.createElement('input');\n\tfileInput.type = 'file';\n\tfileInput.accept = config.acceptedTypes.join(',');\n\tfileInput.className = 'notectl-image-popup__file-input';\n\n\tconst uploadBtn: HTMLButtonElement = document.createElement('button');\n\tuploadBtn.type = 'button';\n\tuploadBtn.textContent = config.locale.uploadFromComputer;\n\tuploadBtn.setAttribute('aria-label', config.locale.uploadAria);\n\tuploadBtn.className = 'notectl-image-popup__upload-btn';\n\n\tuploadBtn.addEventListener('mousedown', (e: MouseEvent) => {\n\t\te.preventDefault();\n\t\te.stopPropagation();\n\t\tfileInput.click();\n\t});\n\n\tfileInput.addEventListener('change', () => {\n\t\tconst file: File | undefined = fileInput.files?.[0];\n\t\tif (file) {\n\t\t\tconfig.onFileInsert(context, file);\n\t\t\tconfig.onClose();\n\t\t\tcontext.getContainer().focus();\n\t\t}\n\t});\n\n\tcontainer.appendChild(fileInput);\n\tcontainer.appendChild(uploadBtn);\n}\n\n// --- Separator ---\n\nfunction appendSeparator(container: HTMLElement, locale: ImageLocale): void {\n\tconst separator: HTMLDivElement = document.createElement('div');\n\tseparator.className = 'notectl-image-popup__separator';\n\n\tconst line1: HTMLSpanElement = document.createElement('span');\n\tline1.className = 'notectl-image-popup__separator-line';\n\n\tconst orText: HTMLSpanElement = document.createElement('span');\n\torText.textContent = locale.separator;\n\torText.className = 'notectl-image-popup__separator-text';\n\n\tconst line2: HTMLSpanElement = document.createElement('span');\n\tline2.className = 'notectl-image-popup__separator-line';\n\n\tseparator.appendChild(line1);\n\tseparator.appendChild(orText);\n\tseparator.appendChild(line2);\n\tcontainer.appendChild(separator);\n}\n\n// --- URL Input Section ---\n\nfunction appendUrlSection(\n\tcontainer: HTMLElement,\n\tcontext: PluginContext,\n\tconfig: ImagePopupConfig,\n): void {\n\tconst urlInput: HTMLInputElement = document.createElement('input');\n\turlInput.type = 'url';\n\turlInput.placeholder = config.locale.urlPlaceholder;\n\turlInput.setAttribute('aria-label', config.locale.urlAria);\n\turlInput.className = 'notectl-image-popup__url-input';\n\n\tconst insertBtn: HTMLButtonElement = document.createElement('button');\n\tinsertBtn.type = 'button';\n\tinsertBtn.textContent = config.locale.insertButton;\n\tinsertBtn.setAttribute('aria-label', config.locale.insertAria);\n\tinsertBtn.className = 'notectl-image-popup__insert-btn';\n\n\tconst applyUrl = (): void => {\n\t\tconst src: string = urlInput.value.trim();\n\t\tif (src) {\n\t\t\tinsertImage(context, { src });\n\t\t\tconfig.onClose();\n\t\t\tcontext.getContainer().focus();\n\t\t}\n\t};\n\n\tinsertBtn.addEventListener('mousedown', (e: MouseEvent) => {\n\t\te.preventDefault();\n\t\te.stopPropagation();\n\t\tapplyUrl();\n\t});\n\n\turlInput.addEventListener('keydown', (e: KeyboardEvent) => {\n\t\tif (e.key === 'Enter') {\n\t\t\te.preventDefault();\n\t\t\tapplyUrl();\n\t\t}\n\t});\n\n\tcontainer.appendChild(urlInput);\n\tcontainer.appendChild(insertBtn);\n\n\trequestAnimationFrame(() => urlInput.focus());\n}\n","/** Image insert popup styles (file upload + URL input). */\nexport const IMAGE_POPUP_CSS = `\n.notectl-image-popup {\n\tpadding: 8px;\n\tmin-width: 240px;\n}\n\n.notectl-image-popup__file-input {\n\tposition: absolute;\n\twidth: 0;\n\theight: 0;\n\toverflow: hidden;\n\topacity: 0;\n}\n\n.notectl-image-popup__upload-btn {\n\tdisplay: block;\n\twidth: 100%;\n\tpadding: 8px 12px;\n\tcursor: pointer;\n\ttext-align: center;\n\tbox-sizing: border-box;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 4px;\n\tbackground: var(--notectl-surface-raised);\n\tcolor: var(--notectl-fg);\n}\n\n.notectl-image-popup__separator {\n\tdisplay: flex;\n\talign-items: center;\n\tmargin: 8px 0;\n\tcolor: var(--notectl-fg-muted);\n\tfont-size: 12px;\n}\n\n.notectl-image-popup__separator-line {\n\tflex: 1;\n\theight: 1px;\n\tbackground: var(--notectl-border);\n}\n\n.notectl-image-popup__separator-text {\n\tpadding: 0 8px;\n}\n\n.notectl-image-popup__url-input {\n\twidth: 100%;\n\tpadding: 6px 8px;\n\tbox-sizing: border-box;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 4px;\n\tbackground: var(--notectl-surface-overlay);\n\tcolor: var(--notectl-fg);\n}\n\n.notectl-image-popup__insert-btn {\n\twidth: 100%;\n\tpadding: 8px 12px;\n\tmargin-top: 4px;\n\tcursor: pointer;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 4px;\n\tbackground: var(--notectl-surface-raised);\n\tcolor: var(--notectl-fg);\n}\n`;\n","/**\n * Image plugin types, configuration, and service key.\n */\n\nimport { ServiceKey } from '../Plugin.js';\nimport type { ImageLocale } from './ImageLocale.js';\n\n// --- Image Attributes ---\n\nexport interface ImageAttrs {\n\treadonly src: string;\n\treadonly alt: string;\n\treadonly width?: number;\n\treadonly height?: number;\n\treadonly align: 'start' | 'center' | 'end';\n}\n\n// --- Upload Types ---\n\nexport interface ImageUploadResult {\n\treadonly url: string;\n\treadonly width?: number;\n\treadonly height?: number;\n}\n\nexport interface ImageUploadService {\n\tupload(file: File): Promise<ImageUploadResult>;\n}\n\nexport const IMAGE_UPLOAD_SERVICE = new ServiceKey<ImageUploadService>('image:upload');\n\nexport type UploadState = 'idle' | 'uploading' | 'complete' | 'error';\n\n// --- Keyboard Bindings ---\n\n/**\n * Configurable keyboard bindings for image resize actions.\n * Omit a slot to use the default; set to `null` to disable the binding.\n *\n * Key descriptor format: `'Mod-Shift-ArrowRight'`, etc.\n * `Mod` resolves to Cmd on macOS, Ctrl on Windows/Linux.\n */\nexport interface ImageKeymap {\n\treadonly growWidth?: string | null;\n\treadonly shrinkWidth?: string | null;\n\treadonly growWidthLarge?: string | null;\n\treadonly shrinkWidthLarge?: string | null;\n\treadonly resetSize?: string | null;\n}\n\nexport const DEFAULT_IMAGE_KEYMAP: Readonly<Record<keyof ImageKeymap, string>> = {\n\tgrowWidth: 'Mod-Shift-ArrowRight',\n\tshrinkWidth: 'Mod-Shift-ArrowLeft',\n\tgrowWidthLarge: 'Mod-Shift-Alt-ArrowRight',\n\tshrinkWidthLarge: 'Mod-Shift-Alt-ArrowLeft',\n\tresetSize: 'Mod-Shift-0',\n};\n\n// --- Configuration ---\n\nexport interface ImagePluginConfig {\n\treadonly maxWidth: number;\n\treadonly maxFileSize: number;\n\treadonly acceptedTypes: readonly string[];\n\treadonly resizable: boolean;\n\t/** Pixels to grow/shrink per small resize step. @default 10 */\n\treadonly resizeStep?: number;\n\t/** Pixels to grow/shrink per large resize step. @default 50 */\n\treadonly resizeStepLarge?: number;\n\t/** Customize keyboard bindings for image resize actions. */\n\treadonly keymap?: ImageKeymap;\n\t/** Locale override for user-facing strings. */\n\treadonly locale?: ImageLocale;\n}\n\nexport const DEFAULT_IMAGE_CONFIG: ImagePluginConfig = {\n\tmaxWidth: 800,\n\tmaxFileSize: 10 * 1024 * 1024,\n\tacceptedTypes: ['image/png', 'image/jpeg', 'image/gif', 'image/webp', 'image/svg+xml'],\n\tresizable: true,\n\tresizeStep: 10,\n\tresizeStepLarge: 50,\n};\n","/**\n * ImagePlugin: registers an image void block type with NodeSpec,\n * NodeView, commands, file handler, toolbar button, and accessible\n * keyboard resize with screenreader announcements.\n */\n\nimport { IMAGE_CSS } from '../../editor/styles/image.js';\nimport type { BlockAttrs, BlockNode } from '../../model/Document.js';\nimport { escapeHTML } from '../../model/HTMLUtils.js';\nimport { isNodeSelection } from '../../model/Selection.js';\nimport type { BlockId } from '../../model/TypeBrands.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { Transaction } from '../../state/Transaction.js';\nimport { setStyleProperty } from '../../style/StyleRuntime.js';\nimport { createBlockElement } from '../../view/DomUtils.js';\nimport type { Plugin, PluginContext } from '../Plugin.js';\nimport { resolveLocale } from '../shared/PluginHelpers.js';\nimport { formatShortcut } from '../shared/ShortcutFormatting.js';\nimport {\n\tinsertImage,\n\tregisterImageCommands,\n\tresetImageSize,\n\tresizeImageByDelta,\n} from './ImageCommands.js';\nimport { IMAGE_LOCALE_EN, type ImageLocale, loadImageLocale } from './ImageLocale.js';\nimport { createImageNodeViewFactory } from './ImageNodeView.js';\nimport { renderImagePopup } from './ImagePopup.js';\nimport { IMAGE_POPUP_CSS } from './ImagePopupStyles.js';\nimport {\n\tDEFAULT_IMAGE_CONFIG,\n\tDEFAULT_IMAGE_KEYMAP,\n\tIMAGE_UPLOAD_SERVICE,\n\ttype ImageKeymap,\n\ttype ImagePluginConfig,\n\ttype UploadState,\n} from './ImageUpload.js';\n\n// --- Attribute Registry Augmentation ---\n\ndeclare module '../../model/AttrRegistry.js' {\n\tinterface NodeAttrRegistry {\n\t\timage: {\n\t\t\tsrc: string;\n\t\t\talt: string;\n\t\t\ttitle?: string;\n\t\t\twidth?: number;\n\t\t\theight?: number;\n\t\t\talign: 'start' | 'center' | 'end';\n\t\t};\n\t}\n\tinterface InlineNodeAttrRegistry {\n\t\timage_inline: { src: string; alt: string; title?: string };\n\t}\n}\n\n// --- Plugin ---\n\nexport class ImagePlugin implements Plugin {\n\treadonly id = 'image';\n\treadonly name = 'Image';\n\treadonly priority = 45;\n\n\tprivate readonly config: ImagePluginConfig;\n\tprivate readonly resolvedKeymap: Readonly<Record<keyof ImageKeymap, string | null>>;\n\tprivate readonly uploadStates = new Map<BlockId, UploadState>();\n\tprivate readonly blobUrls = new Set<string>();\n\tprivate context: PluginContext | null = null;\n\tprivate locale!: ImageLocale;\n\n\tconstructor(config?: Partial<ImagePluginConfig>) {\n\t\tthis.config = { ...DEFAULT_IMAGE_CONFIG, ...config };\n\t\tthis.resolvedKeymap = { ...DEFAULT_IMAGE_KEYMAP, ...config?.keymap };\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\tIMAGE_LOCALE_EN,\n\t\t\tloadImageLocale,\n\t\t);\n\t\tcontext.registerStyleSheet(IMAGE_CSS);\n\t\tcontext.registerStyleSheet(IMAGE_POPUP_CSS);\n\t\tthis.context = context;\n\t\tthis.registerNodeSpec(context);\n\t\tthis.registerInlineImageNodeSpec(context);\n\t\tthis.registerNodeView(context);\n\t\tregisterImageCommands(context);\n\t\tthis.registerResizeCommands(context);\n\t\tthis.registerResizeKeymaps(context);\n\t\tthis.registerFileHandler(context);\n\t\tthis.registerToolbarItem(context);\n\t}\n\n\tdestroy(): void {\n\t\tfor (const url of this.blobUrls) {\n\t\t\tURL.revokeObjectURL(url);\n\t\t}\n\t\tthis.blobUrls.clear();\n\t\tthis.uploadStates.clear();\n\t\tthis.context = null;\n\t}\n\n\tonStateChange(oldState: EditorState, newState: EditorState, _tr: Transaction): void {\n\t\tif (!this.context) return;\n\n\t\t// Clean up upload states for removed blocks (searches full tree)\n\t\tfor (const id of this.uploadStates.keys()) {\n\t\t\tif (!newState.getBlock(id)) {\n\t\t\t\tthis.uploadStates.delete(id);\n\t\t\t}\n\t\t}\n\n\t\t// Announce image selection for screenreaders\n\t\tconst oldIsImage: boolean = this.isImageSelected(oldState);\n\t\tconst nowIsImage: boolean = this.isImageSelected(newState);\n\n\t\tif (!oldIsImage && nowIsImage) {\n\t\t\tthis.announceImageSelection(newState);\n\t\t}\n\t}\n\n\tprivate registerNodeSpec(context: PluginContext): void {\n\t\tconst locale = this.locale;\n\t\tcontext.registerNodeSpec({\n\t\t\ttype: 'image',\n\t\t\tgroup: 'block',\n\t\t\tisVoid: true,\n\t\t\tselectable: true,\n\t\t\tattrs: {\n\t\t\t\tsrc: { default: '' },\n\t\t\t\talt: { default: '' },\n\t\t\t\ttitle: { default: '' },\n\t\t\t\talign: { default: 'center' },\n\t\t\t},\n\t\t\ttoDOM(node) {\n\t\t\t\tconst figure = createBlockElement('figure', node.id);\n\t\t\t\tfigure.className = 'notectl-image';\n\t\t\t\tfigure.setAttribute('data-void', 'true');\n\t\t\t\tfigure.setAttribute('data-selectable', 'true');\n\n\t\t\t\tconst imgContainer: HTMLDivElement = document.createElement('div');\n\t\t\t\timgContainer.className = 'notectl-image__container';\n\n\t\t\t\tconst alt: string = (node.attrs?.alt as string | undefined) ?? '';\n\t\t\t\tconst width: number | undefined = node.attrs?.width as number | undefined;\n\t\t\t\tconst height: number | undefined = node.attrs?.height as number | undefined;\n\n\t\t\t\tconst img: HTMLImageElement = document.createElement('img');\n\t\t\t\timg.className = 'notectl-image__img';\n\t\t\t\timg.src = (node.attrs?.src as string | undefined) ?? '';\n\t\t\t\timg.alt = alt;\n\t\t\t\tconst titleAttr: string = (node.attrs?.title as string | undefined) ?? '';\n\t\t\t\tif (titleAttr) img.title = titleAttr;\n\t\t\t\timg.draggable = false;\n\n\t\t\t\tif (width !== undefined) setStyleProperty(img, 'width', `${width}px`);\n\t\t\t\tif (height !== undefined) setStyleProperty(img, 'height', `${height}px`);\n\n\t\t\t\tconst align: string = (node.attrs?.align as string | undefined) ?? 'center';\n\t\t\t\tconst alignClass: string | undefined = {\n\t\t\t\t\tstart: 'notectl-image--start',\n\t\t\t\t\tcenter: 'notectl-image--center',\n\t\t\t\t\tend: 'notectl-image--end',\n\t\t\t\t}[align];\n\t\t\t\tif (alignClass) figure.classList.add(alignClass);\n\n\t\t\t\tfigure.setAttribute('aria-label', locale.imageAria(alt, width, height));\n\n\t\t\t\timgContainer.appendChild(img);\n\t\t\t\tfigure.appendChild(imgContainer);\n\t\t\t\treturn figure;\n\t\t\t},\n\t\t\ttoHTML(node) {\n\t\t\t\tconst src: string = escapeHTML((node.attrs?.src as string | undefined) ?? '');\n\t\t\t\tconst alt: string = escapeHTML((node.attrs?.alt as string | undefined) ?? '');\n\t\t\t\tconst width: number | undefined = node.attrs?.width as number | undefined;\n\t\t\t\tconst height: number | undefined = node.attrs?.height as number | undefined;\n\n\t\t\t\tconst sizeAttrs: string =\n\t\t\t\t\t(width !== undefined ? ` width=\"${width}\"` : '') +\n\t\t\t\t\t(height !== undefined ? ` height=\"${height}\"` : '');\n\n\t\t\t\t// Alignment is handled by the serializer's alignment injection,\n\t\t\t\t// which works in both inline-style and CSS-class modes.\n\t\t\t\tconst titleValue: string = (node.attrs?.title as string | undefined) ?? '';\n\t\t\t\tconst titleHTML: string = titleValue ? ` title=\"${escapeHTML(titleValue)}\"` : '';\n\t\t\t\treturn `<figure><img src=\"${src}\" alt=\"${alt}\"${titleHTML}${sizeAttrs}></figure>`;\n\t\t\t},\n\t\t\tparseHTML: [\n\t\t\t\t{\n\t\t\t\t\ttag: 'figure',\n\t\t\t\t\tgetAttrs(el) {\n\t\t\t\t\t\tconst img: HTMLImageElement | null = el.querySelector('img');\n\t\t\t\t\t\tif (!img) return false;\n\t\t\t\t\t\tconst attrs: Record<string, string | number | boolean> = {\n\t\t\t\t\t\t\tsrc: img.getAttribute('src') ?? '',\n\t\t\t\t\t\t\talt: img.getAttribute('alt') ?? '',\n\t\t\t\t\t\t\talign: 'center',\n\t\t\t\t\t\t};\n\t\t\t\t\t\tconst width: string | null = img.getAttribute('width');\n\t\t\t\t\t\tconst height: string | null = img.getAttribute('height');\n\t\t\t\t\t\tif (width) attrs.width = Number.parseInt(width, 10);\n\t\t\t\t\t\tif (height) attrs.height = Number.parseInt(height, 10);\n\n\t\t\t\t\t\tconst title: string | null = img.getAttribute('title');\n\t\t\t\t\t\tif (title) attrs.title = title;\n\n\t\t\t\t\t\t// Check inline style first, then class names (new + legacy)\n\t\t\t\t\t\tconst textAlign: string = el.style?.textAlign ?? '';\n\t\t\t\t\t\tif (textAlign === 'start' || textAlign === 'end' || textAlign === 'center') {\n\t\t\t\t\t\t\tattrs.align = textAlign;\n\t\t\t\t\t\t} else if (textAlign === 'left') {\n\t\t\t\t\t\t\tattrs.align = 'start';\n\t\t\t\t\t\t} else if (textAlign === 'right') {\n\t\t\t\t\t\t\tattrs.align = 'end';\n\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\tel.classList.contains('notectl-align-start') ||\n\t\t\t\t\t\t\tel.classList.contains('notectl-align-left') ||\n\t\t\t\t\t\t\tel.classList.contains('notectl-image--start') ||\n\t\t\t\t\t\t\tel.classList.contains('notectl-image--left')\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tattrs.align = 'start';\n\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\tel.classList.contains('notectl-align-end') ||\n\t\t\t\t\t\t\tel.classList.contains('notectl-align-right') ||\n\t\t\t\t\t\t\tel.classList.contains('notectl-image--end') ||\n\t\t\t\t\t\t\tel.classList.contains('notectl-image--right')\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tattrs.align = 'end';\n\t\t\t\t\t\t} else if (el.classList.contains('notectl-align-center')) {\n\t\t\t\t\t\t\tattrs.align = 'center';\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn attrs;\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\ttag: 'img',\n\t\t\t\t\tgetAttrs(el) {\n\t\t\t\t\t\tconst attrs: Record<string, string | number | boolean> = {\n\t\t\t\t\t\t\tsrc: el.getAttribute('src') ?? '',\n\t\t\t\t\t\t\talt: el.getAttribute('alt') ?? '',\n\t\t\t\t\t\t\talign: 'center',\n\t\t\t\t\t\t};\n\t\t\t\t\t\tconst width: string | null = el.getAttribute('width');\n\t\t\t\t\t\tconst height: string | null = el.getAttribute('height');\n\t\t\t\t\t\tif (width) attrs.width = Number.parseInt(width, 10);\n\t\t\t\t\t\tif (height) attrs.height = Number.parseInt(height, 10);\n\t\t\t\t\t\tconst title: string | null = el.getAttribute('title');\n\t\t\t\t\t\tif (title) attrs.title = title;\n\t\t\t\t\t\treturn attrs;\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t\tsanitize: {\n\t\t\t\ttags: ['figure', 'img'],\n\t\t\t\tattrs: ['src', 'alt', 'title', 'width', 'height', 'class', 'style'],\n\t\t\t},\n\t\t});\n\t}\n\n\t/**\n\t * Registers a minimal inline image node (D7) so mid-paragraph images (badge\n\t * rows, inline icons) round-trip faithfully without splitting the paragraph.\n\t * Atomic and `contenteditable=\"false\"`, mirroring other inline nodes.\n\t */\n\tprivate registerInlineImageNodeSpec(context: PluginContext): void {\n\t\tcontext.registerInlineNodeSpec({\n\t\t\ttype: 'image_inline',\n\t\t\tgroup: 'inline',\n\t\t\tattrs: {\n\t\t\t\tsrc: { default: '' },\n\t\t\t\talt: { default: '' },\n\t\t\t\ttitle: { default: '' },\n\t\t\t},\n\t\t\ttoDOM(node) {\n\t\t\t\tconst img: HTMLImageElement = document.createElement('img');\n\t\t\t\timg.className = 'notectl-image-inline';\n\t\t\t\timg.setAttribute('contenteditable', 'false');\n\t\t\t\timg.src = String(node.attrs.src ?? '');\n\t\t\t\timg.alt = String(node.attrs.alt ?? '');\n\t\t\t\tconst title: string = String(node.attrs.title ?? '');\n\t\t\t\tif (title) img.title = title;\n\t\t\t\timg.draggable = false;\n\t\t\t\treturn img;\n\t\t\t},\n\t\t\ttoHTMLString(node) {\n\t\t\t\tconst src: string = escapeHTML(String(node.attrs.src ?? ''));\n\t\t\t\tconst alt: string = escapeHTML(String(node.attrs.alt ?? ''));\n\t\t\t\tconst title: string = String(node.attrs.title ?? '');\n\t\t\t\tconst titleAttr: string = title ? ` title=\"${escapeHTML(title)}\"` : '';\n\t\t\t\treturn `<img src=\"${src}\" alt=\"${alt}\"${titleAttr}>`;\n\t\t\t},\n\t\t\tparseHTML: [\n\t\t\t\t{\n\t\t\t\t\ttag: 'img',\n\t\t\t\t\tgetAttrs: (el: HTMLElement) => {\n\t\t\t\t\t\tconst attrs: Record<string, string> = {\n\t\t\t\t\t\t\tsrc: el.getAttribute('src') ?? '',\n\t\t\t\t\t\t\talt: el.getAttribute('alt') ?? '',\n\t\t\t\t\t\t};\n\t\t\t\t\t\tconst title: string | null = el.getAttribute('title');\n\t\t\t\t\t\tif (title) attrs.title = title;\n\t\t\t\t\t\treturn attrs;\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t\tsanitize: { tags: ['img'], attrs: ['src', 'alt', 'title'] },\n\t\t});\n\t}\n\n\tprivate registerNodeView(context: PluginContext): void {\n\t\tcontext.registerNodeView(\n\t\t\t'image',\n\t\t\tcreateImageNodeViewFactory(this.config, this.uploadStates, this.resolvedKeymap, this.locale),\n\t\t);\n\t}\n\n\tprivate registerResizeCommands(context: PluginContext): void {\n\t\tconst step: number = this.config.resizeStep ?? 10;\n\t\tconst stepLarge: number = this.config.resizeStepLarge ?? 50;\n\t\tconst maxWidth: number = this.config.maxWidth;\n\n\t\tcontext.registerCommand('resizeImageGrow', () => {\n\t\t\tconst result: boolean = resizeImageByDelta(context, step, maxWidth);\n\t\t\tif (result) this.announceCurrentSize(context);\n\t\t\treturn result;\n\t\t});\n\n\t\tcontext.registerCommand('resizeImageShrink', () => {\n\t\t\tconst result: boolean = resizeImageByDelta(context, -step, maxWidth);\n\t\t\tif (result) this.announceCurrentSize(context);\n\t\t\treturn result;\n\t\t});\n\n\t\tcontext.registerCommand('resizeImageGrowLarge', () => {\n\t\t\tconst result: boolean = resizeImageByDelta(context, stepLarge, maxWidth);\n\t\t\tif (result) this.announceCurrentSize(context);\n\t\t\treturn result;\n\t\t});\n\n\t\tcontext.registerCommand('resizeImageShrinkLarge', () => {\n\t\t\tconst result: boolean = resizeImageByDelta(context, -stepLarge, maxWidth);\n\t\t\tif (result) this.announceCurrentSize(context);\n\t\t\treturn result;\n\t\t});\n\n\t\tcontext.registerCommand('resetImageSize', () => {\n\t\t\tconst result: boolean = resetImageSize(context);\n\t\t\tif (result) context.announce(this.locale.resetToNaturalSize);\n\t\t\treturn result;\n\t\t});\n\t}\n\n\tprivate registerResizeKeymaps(context: PluginContext): void {\n\t\tconst bindings: Record<string, () => boolean> = {};\n\t\tconst commands: Record<keyof ImageKeymap, string> = {\n\t\t\tgrowWidth: 'resizeImageGrow',\n\t\t\tshrinkWidth: 'resizeImageShrink',\n\t\t\tgrowWidthLarge: 'resizeImageGrowLarge',\n\t\t\tshrinkWidthLarge: 'resizeImageShrinkLarge',\n\t\t\tresetSize: 'resetImageSize',\n\t\t};\n\n\t\tfor (const [slot, commandName] of Object.entries(commands)) {\n\t\t\tconst binding: string | null = this.resolvedKeymap[slot as keyof ImageKeymap] ?? null;\n\t\t\tif (binding) {\n\t\t\t\tbindings[binding] = () => context.executeCommand(commandName);\n\t\t\t}\n\t\t}\n\n\t\tif (Object.keys(bindings).length > 0) {\n\t\t\tcontext.registerKeymap(bindings);\n\t\t}\n\t}\n\n\tprivate registerFileHandler(context: PluginContext): void {\n\t\tcontext.registerFileHandler('image/*', async (file, _position) => {\n\t\t\tif (!this.isAcceptedType(file.type)) return false;\n\t\t\tthis.handleFileInsert(context, file);\n\t\t\treturn true;\n\t\t});\n\t}\n\n\tprivate handleFileInsert(context: PluginContext, file: File): void {\n\t\tif (file.size > this.config.maxFileSize) return;\n\n\t\tconst blobUrl: string = URL.createObjectURL(file);\n\t\tthis.blobUrls.add(blobUrl);\n\n\t\tconst inserted: boolean = insertImage(context, { src: blobUrl });\n\t\tif (!inserted) {\n\t\t\tURL.revokeObjectURL(blobUrl);\n\t\t\tthis.blobUrls.delete(blobUrl);\n\t\t\treturn;\n\t\t}\n\n\t\t// Find the newly inserted image block\n\t\tconst state: EditorState = context.getState();\n\t\tconst sel = state.selection;\n\t\tif (!isNodeSelection(sel)) return;\n\t\tconst imageBlockId: BlockId = sel.nodeId;\n\n\t\tthis.uploadStates.set(imageBlockId, 'uploading');\n\n\t\t// Upload if service is registered\n\t\tconst uploadService = context.getService(IMAGE_UPLOAD_SERVICE);\n\t\tif (uploadService) {\n\t\t\tthis.uploadFile(context, file, imageBlockId, blobUrl);\n\t\t} else {\n\t\t\tthis.uploadStates.set(imageBlockId, 'complete');\n\t\t}\n\t}\n\n\tprivate async uploadFile(\n\t\tcontext: PluginContext,\n\t\tfile: File,\n\t\timageBlockId: BlockId,\n\t\tblobUrl: string,\n\t): Promise<void> {\n\t\tconst uploadService = context.getService(IMAGE_UPLOAD_SERVICE);\n\t\tif (!uploadService) return;\n\n\t\ttry {\n\t\t\tconst result = await uploadService.upload(file);\n\t\t\tthis.uploadStates.set(imageBlockId, 'complete');\n\n\t\t\t// Replace blob URL with uploaded URL\n\t\t\tconst state: EditorState = context.getState();\n\t\t\tconst block: BlockNode | undefined = state.getBlock(imageBlockId);\n\t\t\tif (!block) return;\n\n\t\t\tconst path: BlockId[] | undefined = state.getNodePath(imageBlockId);\n\t\t\tif (!path) return;\n\n\t\t\tconst merged: BlockAttrs = {\n\t\t\t\t...(block.attrs ?? {}),\n\t\t\t\tsrc: result.url,\n\t\t\t\t...(result.width !== undefined ? { width: result.width } : {}),\n\t\t\t\t...(result.height !== undefined ? { height: result.height } : {}),\n\t\t\t};\n\n\t\t\tconst tr: Transaction = state.transaction('command').setNodeAttr(path, merged).build();\n\t\t\tcontext.dispatch(tr);\n\n\t\t\t// Clean up blob URL\n\t\t\tURL.revokeObjectURL(blobUrl);\n\t\t\tthis.blobUrls.delete(blobUrl);\n\t\t} catch {\n\t\t\tthis.uploadStates.set(imageBlockId, 'error');\n\t\t\tcontext.announce(this.locale.uploadFailed);\n\t\t}\n\t}\n\n\tprivate registerToolbarItem(context: PluginContext): void {\n\t\tconst icon =\n\t\t\t'<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z\"/></svg>';\n\n\t\tcontext.registerToolbarItem({\n\t\t\tid: 'image',\n\t\t\tgroup: 'insert',\n\t\t\ticon,\n\t\t\tlabel: this.locale.insertImage,\n\t\t\ttooltip: this.locale.insertImageTooltip,\n\t\t\tcommand: 'insertImage',\n\t\t\tpopupType: 'custom',\n\t\t\trenderPopup: (container, ctx, onClose) => {\n\t\t\t\trenderImagePopup(container, ctx, {\n\t\t\t\t\tacceptedTypes: this.config.acceptedTypes,\n\t\t\t\t\tlocale: this.locale,\n\t\t\t\t\tonFileInsert: (c, file) => this.handleFileInsert(c, file),\n\t\t\t\t\tonClose,\n\t\t\t\t});\n\t\t\t},\n\t\t});\n\t}\n\n\tprivate isAcceptedType(mimeType: string): boolean {\n\t\treturn this.config.acceptedTypes.some(\n\t\t\t(accepted) =>\n\t\t\t\taccepted === mimeType ||\n\t\t\t\t(accepted.endsWith('/*') && mimeType.startsWith(accepted.slice(0, -1))),\n\t\t);\n\t}\n\n\tprivate isImageSelected(state: EditorState): boolean {\n\t\tconst sel = state.selection;\n\t\tif (!isNodeSelection(sel)) return false;\n\t\tconst block: BlockNode | undefined = state.getBlock(sel.nodeId);\n\t\treturn block?.type === 'image';\n\t}\n\n\tprivate announceImageSelection(state: EditorState): void {\n\t\tif (!this.context) return;\n\t\tconst sel = state.selection;\n\t\tif (!isNodeSelection(sel)) return;\n\n\t\tconst block: BlockNode | undefined = state.getBlock(sel.nodeId);\n\t\tif (!block || block.type !== 'image') return;\n\n\t\tconst alt: string = (block.attrs?.alt as string | undefined) ?? '';\n\t\tconst width: number | undefined = block.attrs?.width as number | undefined;\n\t\tconst height: number | undefined = block.attrs?.height as number | undefined;\n\n\t\tconst parts: string[] = [this.locale.imageSelected];\n\t\tif (alt) parts.push(`${this.locale.altTextPrefix}${alt}.`);\n\t\tif (width !== undefined && height !== undefined) {\n\t\t\tparts.push(this.locale.imageSizeAnnounce(width, height));\n\t\t}\n\n\t\tconst shrinkKey: string | null = this.resolvedKeymap.shrinkWidth ?? null;\n\t\tconst growKey: string | null = this.resolvedKeymap.growWidth ?? null;\n\t\tif (shrinkKey && growKey) {\n\t\t\tparts.push(this.locale.resizeHint(formatShortcut(shrinkKey), formatShortcut(growKey)));\n\t\t}\n\n\t\tthis.context.announce(parts.join(' '));\n\t}\n\n\tprivate announceCurrentSize(context: PluginContext): void {\n\t\tconst state = context.getState();\n\t\tconst sel = state.selection;\n\t\tif (!isNodeSelection(sel)) return;\n\n\t\tconst block: BlockNode | undefined = state.getBlock(sel.nodeId);\n\t\tif (!block || block.type !== 'image') return;\n\n\t\tconst width: number | undefined = block.attrs?.width as number | undefined;\n\t\tconst height: number | undefined = block.attrs?.height as number | undefined;\n\t\tif (width !== undefined && height !== undefined) {\n\t\t\tcontext.announce(this.locale.imageResized(width, height));\n\t\t}\n\t}\n}\n"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C,GAAK,EAAM,KAAK,GAAG,KAAK,OAAO,gBAAgB,WACrC,IAAV,QAAkC,IAAX,GAC1B,EAAM,KAAK,KAAK,OAAO,kBAAkB,EAAO,IAGjD,MAAM,EAA2B,KAAK,eAAe,aAAe,KAC9D,EAAyB,KAAK,eAAe,WAAa,KAC5D,GAAa,GAChB,EAAM,KAAK,KAAK,OAAO,WAAW,EAAe,GAAY,EAAe,KAG7E,KAAK,QAAQ,SAAS,EAAM,KAAK,KAClC,CAEA,mBAAA,CAA4B,GAC3B,MAAM,EAAQ,EAAQ,WAChB,EAAM,EAAM,UAClB,IAAK,EAAgB,GAAM,OAE3B,MAAM,EAA+B,EAAM,SAAS,EAAI,QACxD,IAAK,GAAwB,UAAf,EAAM,KAAkB,OAEtC,MAAM,EAA4B,EAAM,OAAO,MACzC,EAA6B,EAAM,OAAO,YAClC,IAAV,QAAkC,IAAX,GAC1B,EAAQ,SAAS,KAAK,OAAO,aAAa,EAAO,GAEnD"}
@@ -1,2 +0,0 @@
1
- import{m as t}from"./Document-827l3P80.mjs";import{o as e,t as o,u as r}from"./Selection-HYoVFpAx.mjs";import{i as n}from"./TypeBrands-Ch9856Gb.mjs";import{c as s,o as i}from"./PluginHelpers-KDuTlmXm.mjs";import{t as l}from"./ShortcutFormatting-TwiufqeV.mjs";import{t as a}from"./SimpleMark-gTQaSJcO.mjs";var c={label:"Inline Code",tooltip:t=>`Inline Code (${t})`},m=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar-CMXjVzFx.mjs"),"./locales/de.ts":()=>import("./de-e6J6nvAD.mjs"),"./locales/es.ts":()=>import("./es-fTW0TkYV.mjs"),"./locales/fr.ts":()=>import("./fr-CQs0-pNX.mjs"),"./locales/hi.ts":()=>import("./hi-C2jEsf8v.mjs"),"./locales/pt.ts":()=>import("./pt-BDam9cDu.mjs"),"./locales/ru.ts":()=>import("./ru-QcTo2yoL.mjs"),"./locales/zh.ts":()=>import("./zh-DWN1Jqn3.mjs")});async function d(t){return s(m,t,c)}var p={toolbar:!0,keymap:"Mod-E",inputRule:!0},u=new Set(["bold","italic","underline","strikethrough","highlight","font","fontSize","superscript","subscript"]),f=class{id="inline-code";name="Inline Code";priority=22;config;locale;constructor(t){this.config={...p,...t}}async init(t){this.locale=await i(t,this.config.locale,c,d),t.registerStyleSheet("\n.notectl-content code {\n\tfont-family: ui-monospace, 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;\n\tfont-size: 0.9em;\n\tpadding: 0.15em 0.35em;\n\tborder-radius: 4px;\n\tbackground-color: var(--notectl-code-bg);\n\tcolor: var(--notectl-code-color);\n\tword-break: break-word;\n}\n@media (forced-colors: active) {\n\t.notectl-content code {\n\t\tborder: 1px solid LinkText;\n\t}\n}\n"),this.registerMark(t),!1!==this.config.inputRule&&this.registerInputRule(t),this.registerExclusivityMiddleware(t)}registerMark(t){a(t,{markSpec:{type:"code",rank:3,toDOM:()=>document.createElement("code"),toHTMLString:(t,e)=>`<code>${e}</code>`,parseHTML:[{tag:"code",getAttrs:t=>"PRE"!==t.parentElement?.tagName&&{}},{tag:"span",getAttrs:t=>{const e=t.style.fontFamily.replace(/['"]/g,"").trim();return!!/^monospace$/i.test(e)&&{}}}],sanitize:{tags:["code"]}},command:"toggleInlineCode",keyBinding:null!==this.config.keymap?this.config.keymap??"Mod-E":null,toolbar:!1!==this.config.toolbar?{id:"inline_code",group:"format",icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.4 16.6L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0L19.2 12l-4.6-4.6L16 6l6 6-6 6-1.4-1.4z"/></svg>',label:this.locale.label,tooltip:this.locale.tooltip(l(this.config.keymap??"Mod-E"))}:void 0})}registerInputRule(t){t.registerInputRule({pattern:/(?:^|[^`])(`([^`\uFFFC]+)`)$/,handler(t,s,i,l){const a=t.selection;if(!r(a))return null;if(!e(a))return null;const c=t.getBlock(a.anchor.blockId);if(!c||"code_block"===c.type)return null;const m=s[2],d=s[1];if(!m||!d)return null;const p=l-d.length;return t.transaction("input").deleteTextAt(a.anchor.blockId,p,l).insertText(a.anchor.blockId,p,m,[{type:n("code")}]).setSelection(o(a.anchor.blockId,p+m.length)).build()}})}registerExclusivityMiddleware(e){e.registerMiddleware((e,o,r)=>{let s=!1;const i=[];for(const a of e.steps){if("addMark"!==a.type){i.push(a);continue}const e=a.mark.type;if("code"===e){const e=o.getBlock(a.blockId);if(e){const o=t(e,a.from,a.to),r=/* @__PURE__ */new Set;for(const t of o)if("text"===t.kind)for(const e of t.marks)u.has(e.type)&&r.add(e.type);for(const t of r)s=!0,i.push({type:"removeMark",blockId:a.blockId,from:a.from,to:a.to,mark:{type:n(t)},...a.path?{path:a.path}:{}})}i.push(a);continue}if(u.has(e)){const e=o.getBlock(a.blockId);if(e&&t(e,a.from,a.to).some(t=>"text"===t.kind&&t.marks.some(t=>"code"===t.type))){s=!0;continue}}i.push(a)}let l=e.storedMarksAfter;if(l){const t=l.some(t=>"code"===t.type),e=l.some(t=>u.has(t.type));t&&e&&(l=l.filter(t=>!u.has(t.type)),s=!0)}r(s?{...e,steps:i,storedMarksAfter:l}:e)},{name:"inline-code:mark-exclusivity",priority:50})}};export{c as n,d as r,f as t};
2
- //# sourceMappingURL=InlineCodePlugin-uxgMUX_E.mjs.map
@@ -1,2 +0,0 @@
1
- import{E as t,_ as e,f as n,o as i,p as s,u as c}from"./Document-827l3P80.mjs";import{d as r,o,t as l,u as a}from"./Selection-HYoVFpAx.mjs";import{a as d,t as u}from"./TypeBrands-Ch9856Gb.mjs";import{l as h}from"./BlockInsertion-CYH2gRkY.mjs";import{t as m}from"./RangeIterator-DP7Ud3Gp.mjs";import{r as p}from"./AttrRegistry-B3zB02z9.mjs";import{c as k,o as f}from"./PluginHelpers-KDuTlmXm.mjs";import{c as b}from"./StyleRuntime-DW6omotc.mjs";import{n as g}from"./DomUtils-Bf7JLFlx.mjs";function y(t,e,n){return"checklist"===t?{listType:t,indent:e,checked:n??!1}:{listType:t,indent:e}}function v(t,e){const n=t.getBlock(e);if("list_item"===n?.type)return n;const i=t.getNodePath(e);if(i)for(let s=i.length-2;s>=0;s--){const e=i[s],n=e?t.getBlock(e):void 0;if("list_item"===n?.type)return n}}function x(t,e){const n=t.getBlock(e);if(!n||"list_item"!==n.type)return;const i=t.getNodePath(e);if(!i)return;const c=i.slice(0,-1),r=c[c.length-1],o=(r?s(t.getBlock(r)):t.doc.children).findIndex(t=>t.id===e);return o<0?void 0:{item:n,parentPath:c,index:o}}function I(t,e){t.removeNode(e.parentPath,e.index),s(e.item).forEach((n,i)=>{t.insertNode(e.parentPath,e.index+i,n)})}function T(e,n){const i=e.getState(),s=i.selection;return!!a(s)&&(s.anchor.blockId!==s.head.blockId?function(e,n,i){const s=n.selection;if(!a(s))return!1;const c=r(s,n.getBlockOrder()),o=B(n,c,i),l=n.transaction("command"),u=function(t,e){const n=[],i=/* @__PURE__ */new Set;return m(t,e,e=>{const s=t.getBlock(e);if(!s)return;const c=v(t,e)??s;i.has(c.id)||(i.add(c.id),n.push(c))}),n}(n,c);for(let r=u.length-1;r>=0;r--){const e=u[r];if(e)if(o)if(t(e))l.setBlockType(e.id,d("paragraph"));else{const t=x(n,e.id);t&&I(l,t)}else{const t=p(e,"list_item")?e.attrs.indent:0,n=p(e,"list_item")&&"checklist"===e.attrs.listType&&e.attrs.checked;l.setBlockType(e.id,d("list_item"),y(i,t,n))}}return l.setSelection(s),e.dispatch(l.build()),!0}(e,i,n):function(e,n,i){const s=n.selection;if(!a(s))return!1;const c=n.getBlock(s.anchor.blockId);if(!c)return!1;const r=v(n,s.anchor.blockId),o=r??c;if(r&&r.attrs?.listType===i){const i=n.transaction("command");if(t(r))i.setBlockType(r.id,d("paragraph"));else{const t=x(n,r.id);if(!t)return!1;I(i,t)}return i.setSelection(s),e.dispatch(i.build()),!0}const l=y(i,p(o,"list_item")?o.attrs.indent:0),u=n.transaction("command").setBlockType(o.id,d("list_item"),l).setSelection(s).build();return e.dispatch(u),!0}(e,i,n))}function S(t,e,n){const i=t.getState();if(!a(i.selection))return!1;if(i.selection.anchor.blockId!==i.selection.head.blockId)return function(t,e,n,i){const s=e.selection;if(!a(s))return!1;const c=r(s,e.getBlockOrder()),o=e.transaction("command");let l=!1;const u=/* @__PURE__ */new Set;return m(e,c,t=>{const s=v(e,t);if(!s||!p(s,"list_item"))return;if(u.has(s.id))return;u.add(s.id);const c=s.attrs.indent+n;c<0||c>i||(o.setBlockType(s.id,d("list_item"),y(s.attrs.listType,c,s.attrs.checked)),l=!0)}),!!l&&(o.setSelection(s),t.dispatch(o.build()),!0)}(t,i,e,n);const s=i.selection,c=v(i,s.anchor.blockId);if(!c||!p(c,"list_item"))return!1;const o=c.attrs.indent+e;if(o<0||o>n)return!1;const l=y(c.attrs.listType,o,c.attrs.checked),u=i.transaction("command").setBlockType(c.id,d("list_item"),l).setSelection(s).build();return t.dispatch(u),!0}function C(t,e){const{interactiveCheckboxes:n,targetId:i,locale:s}=e;if(t.isReadOnly()&&!n)return!1;const c=t.getState(),r=i??(a(c.selection)?c.selection.anchor.blockId:null);if(!r)return!1;const o=v(c,r);if(!o||!p(o,"list_item")||"checklist"!==o.attrs.listType)return!1;const l=!o.attrs.checked,u=y(o.attrs.listType,o.attrs.indent,l),h=c.transaction("command").setBlockType(o.id,d("list_item"),u).setSelection(c.selection).build();return t.dispatch(h),t.announce(l?s.checkedAnnouncement:s.uncheckedAnnouncement),!0}function B(t,e,n){let i=!0;return m(t,e,e=>{const s=v(t,e);s&&"list_item"===s.type&&s.attrs?.listType===n||(i=!1)}),i}var L=[{type:"bullet",icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 10.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm0-6c-.83 0-1.5.67-1.5 1.5S3.17 7.5 4 7.5 5.5 6.83 5.5 6 4.83 4.5 4 4.5zm0 12c-.83 0-1.5.68-1.5 1.5s.68 1.5 1.5 1.5 1.5-.68 1.5-1.5-.67-1.5-1.5-1.5zM7 19h14v-2H7v2zm0-6h14v-2H7v2zm0-8v2h14V5H7z"/></svg>',inputPattern:/^[-*] $/,inputPrefix:"- "},{type:"ordered",icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M2 17h2v.5H3v1h1v.5H2v1h3v-4H2v1zm1-9h1V4H2v1h1v3zm-1 3h1.8L2 13.1v.9h3v-1H3.2L5 10.9V10H2v1zm5-6v2h14V5H7zm0 14h14v-2H7v2zm0-6h14v-2H7v2z"/></svg>',inputPattern:/^\d+\. $/,inputPrefix:"1. "},{type:"checklist",icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M22 7h-9v2h9V7zm0 8h-9v2h9v-2zM5.54 11L2 7.46l1.41-1.41 2.12 2.12 4.24-4.24 1.41 1.41L5.54 11zm0 8L2 15.46l1.41-1.41 2.12 2.12 4.24-4.24 1.41 1.41L5.54 19z"/></svg>',inputPattern:/^\[[ x]] $/,inputPrefix:"[ ] "}];function w(t,e){const n=t.getState();if(!a(n.selection))return!1;const i=n.selection;if(!o(i))return!1;const c=n.getBlock(i.anchor.blockId);if(!c)return!1;if("list_item"===c.type)return e({state:n,item:c,child:void 0,childIndex:-1,childCount:0,blockId:i.anchor.blockId,offset:i.anchor.offset});const r=n.getParent(i.anchor.blockId);if(!r||"list_item"!==r.type)return!1;const l=s(r),d=l.findIndex(t=>t.id===c.id);return!(d<0)&&e({state:n,item:r,child:c,childIndex:d,childCount:l.length,blockId:i.anchor.blockId,offset:i.anchor.offset})}var _={bulletList:"Bullet List",numberedList:"Numbered List",checklist:"Checklist",checkboxLabel:"To-do item",checkedAnnouncement:"Checked",uncheckedAnnouncement:"Unchecked"},H=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar-Cy_77yRf.mjs"),"./locales/de.ts":()=>import("./de-CaeEIyzV.mjs"),"./locales/es.ts":()=>import("./es-DFokqQst.mjs"),"./locales/fr.ts":()=>import("./fr-5HkMazAf.mjs"),"./locales/hi.ts":()=>import("./hi-BzbMD_cP.mjs"),"./locales/pt.ts":()=>import("./pt-CR4j8gtE.mjs"),"./locales/ru.ts":()=>import("./ru-DiwQV30V.mjs"),"./locales/zh.ts":()=>import("./zh-BQqf3wJZ.mjs")});async function z(t){return k(H,t,_)}var A="notectl-checklist-marker";function j(t,e){return{bullet:e.bulletList,ordered:e.numberedList,checklist:e.checklist}[t]}function P(t,e){if(!a(t.selection))return!1;if(t.selection.anchor.blockId!==t.selection.head.blockId)return B(t,r(t.selection,t.getBlockOrder()),e);const n=v(t,t.selection.anchor.blockId);return"list_item"===n?.type&&n.attrs?.listType===e}var $={types:["bullet","ordered","checklist"],maxIndent:4},N=class{id="list";name="List";priority=35;config;locale;context=null;checkboxClickHandler=null;constructor(t){this.config={...$,...t}}async init(t){this.context=t,this.locale=await f(t,this.config.locale,_,z);const s=this.getEnabledTypes();t.registerStyleSheet("\n/* List Wrappers — suppress native markers, we use ::before pseudo-elements */\n.notectl-list {\n\tlist-style: none;\n\tmargin: 0;\n\tpadding: 0;\n}\n\n/* Ordered List — each <ol> wrapper resets the counter */\n.notectl-list--ordered {\n\tcounter-reset: notectl-ordered;\n}\n\n/* List Items */\n.notectl-list-item {\n\tmargin: 0;\n\tpadding: 2px 0;\n\tpadding-inline-start: 24px;\n\tmin-height: 1.6em;\n\tposition: relative;\n}\n\n.notectl-list-item::before {\n\tposition: absolute;\n\tinset-inline-start: 0;\n\tdisplay: inline-block;\n\twidth: 24px;\n\ttext-align: center;\n\t-webkit-user-select: none;\n\tuser-select: none;\n\tpointer-events: none;\n}\n\n/* Container items (#194): block children inherit the item's start padding.\n Trim the first/last child paragraph padding so the first text line sits on\n the marker's line and the item keeps the leaf item's vertical rhythm. */\n.notectl-list-item > p:first-of-type {\n\tpadding-top: 0;\n}\n\n.notectl-list-item > p:last-of-type {\n\tpadding-bottom: 0;\n}\n\n/* Bullet List */\n.notectl-list-item--bullet::before {\n\tcontent: '\\2022';\n\tcolor: var(--notectl-fg);\n}\n\n/* Ordered List — counter increment per item */\n.notectl-list-item--ordered {\n\tcounter-increment: notectl-ordered;\n}\n\n.notectl-list-item--ordered::before {\n\tcontent: counter(notectl-ordered) '.';\n\tcolor: var(--notectl-fg);\n\tfont-size: 14px;\n}\n\n/* Checklist — the marker is a real role=\"checkbox\" element (see ListMarker.ts)\n positioned over the reserved marker zone. inline-block keeps the parent's\n line-through (on checked items) from striking the glyph. */\n.notectl-checklist-marker {\n\tposition: absolute;\n\tinset-inline-start: 0;\n\tdisplay: inline-block;\n\twidth: 24px;\n\ttext-align: center;\n\tfont-size: 16px;\n\tcolor: var(--notectl-fg-muted);\n\tcursor: pointer;\n\ttext-decoration: none;\n\t-webkit-user-select: none;\n\tuser-select: none;\n}\n\n.notectl-checklist-marker::before {\n\tcontent: '\\2610';\n}\n\n.notectl-list-item--checklist[data-checked=\"true\"] .notectl-checklist-marker {\n\tcolor: var(--notectl-success);\n}\n\n.notectl-list-item--checklist[data-checked=\"true\"] .notectl-checklist-marker::before {\n\tcontent: '\\2611';\n}\n\n.notectl-list-item--checklist[data-checked=\"true\"] {\n\tcolor: var(--notectl-fg-muted);\n\ttext-decoration: line-through;\n}\n"),this.registerNodeSpec(t),function(t,e,n,i){for(const s of n)t.registerCommand(`toggleList:${s.type}`,()=>T(t,s.type));if(t.registerCommand("indentListItem",()=>S(t,1,e.maxIndent)),t.registerCommand("outdentListItem",()=>S(t,-1,e.maxIndent)),e.types.includes("checklist")){const n=()=>C(t,{interactiveCheckboxes:e.interactiveCheckboxes,locale:i});t.registerCommand("toggleChecklistItem",n,{readonlyAllowed:!0}),t.registerKeymap({"Mod-Enter":n},{priority:"navigation"})}t.registerKeymap({Tab:()=>S(t,1,e.maxIndent),"Shift-Tab":()=>S(t,-1,e.maxIndent)})}(t,this.config,s,this.locale),function(t){t.registerKeymap({Enter:()=>function(t){return w(t,s=>{if(s.child)return function(t,e,s){if(!h(s))return!1;if(e.childIndex!==e.childCount-1)return!1;const r=x(e.state,e.item.id);if(!r)return!1;const o=e.state.transaction("input");if(1===e.childCount)return I(o,r),o.setSelection(e.state.selection),t.dispatch(o.build()),!0;const a=p(e.item,"list_item")?e.item.attrs.listType:"bullet",u=p(e.item,"list_item")?e.item.attrs.indent:0,m=n(),k=i(d("list_item"),[c("")],m,y(a,u));return o.removeNode([...r.parentPath,e.item.id],e.childIndex).insertNode(r.parentPath,r.index+1,k).setSelection(l(m,0)),t.dispatch(o.build()),!0}(t,s,s.child);if(""===e(s.item)){const e=s.state.transaction("input").setBlockType(s.blockId,d("paragraph")).setSelection(s.state.selection).build();return t.dispatch(e),!0}const r=n(),o=y(p(s.item,"list_item")?s.item.attrs.listType:"bullet",p(s.item,"list_item")?s.item.attrs.indent:0),a=s.state.transaction("input").splitBlock(s.blockId,s.offset,r).setBlockType(r,d("list_item"),o).setSelection(l(r,0)).build();return t.dispatch(a),!0})}(t),Backspace:()=>function(t){return w(t,e=>{if(0!==e.offset)return!1;if(e.child){if(0!==e.childIndex)return!1;const n=x(e.state,e.item.id);if(!n)return!1;const i=e.state.transaction("input");return I(i,n),i.setSelection(e.state.selection),t.dispatch(i.build()),!0}const n=e.state.transaction("input").setBlockType(e.blockId,d("paragraph")).setSelection(e.state.selection).build();return t.dispatch(n),!0})}(t)})}(t),!1!==this.config.inputRule&&function(t,e){for(const n of e)t.registerInputRule({pattern:n.inputPattern,handler:(t,e,i,s)=>{const c=t.selection;if(!a(c))return null;if(!o(c))return null;const r=t.getBlock(c.anchor.blockId);if(!r||"paragraph"!==r.type)return null;if("list_item"===t.getParent(c.anchor.blockId)?.type)return null;const u=e[0]??"",h=u.length,m=y(n.type,0,u.includes("[x]"));return t.transaction("input").deleteTextAt(c.anchor.blockId,i,i+h).setBlockType(c.anchor.blockId,d("list_item"),m).setSelection(l(c.anchor.blockId,0)).build()}})}(t,s),function(t,e,n){for(const i of e)t.registerToolbarItem({id:`list-${i.type}`,group:"block",icon:i.icon,label:j(i.type,n),command:`toggleList:${i.type}`,isActive:t=>P(t,i.type)})}(t,s,this.locale),this.registerCheckboxClickHandler(t)}destroy(){this.checkboxClickHandler&&this.context&&this.context.getContainer().removeEventListener("mousedown",this.checkboxClickHandler),this.checkboxClickHandler=null,this.context=null}registerNodeSpec(t){const e=this.locale.checkboxLabel;t.registerNodeSpec({type:"list_item",group:"block",content:{allow:["text","paragraph","heading","code_block","blockquote","horizontal_rule"]},attrs:{listType:{default:"bullet"},indent:{default:0},checked:{default:!1}},toDOM(t){const n=t.attrs?.listType??"bullet",i=t.attrs?.indent??0,s=t.attrs?.checked??!1,c=g("li",t.id);return c.setAttribute("role","listitem"),c.setAttribute("data-list-type",n),c.setAttribute("data-indent",String(i)),c.className=`notectl-list-item notectl-list-item--${n}`,i>0&&b(c,"marginLeft",24*i+"px"),"checklist"===n&&(c.setAttribute("data-checked",String(s)),c.appendChild(function(t,e){const n=document.createElement("span");return n.className=A,n.setAttribute("role","checkbox"),n.setAttribute("aria-checked",String(t)),n.setAttribute("aria-label",e),n.setAttribute("contenteditable","false"),n.setAttribute("data-widget","true"),n}(s,e))),c.setAttribute("aria-level",String(i+1)),c},wrapper(t){const e=t.attrs?.listType??"bullet";return{tag:"ordered"===e?"ol":"ul",key:`list-${e}`,className:`notectl-list notectl-list--${e}`,attrs:{role:"list"}}},toHTML(t,e){const n=t.attrs?.listType??"bullet",i=t.attrs?.checked??!1;return"checklist"===n?`<li role="checkbox" aria-checked="${String(i)}"><input type="checkbox" disabled${i?" checked":""}>${e||"<br>"}</li>`:`<li>${e||"<br>"}</li>`},parseHTML:[{tag:"li"}],sanitize:{tags:["ul","ol","li","input"],attrs:["type","disabled","checked","role","aria-checked"]}})}registerCheckboxClickHandler(t){this.config.types.includes("checklist")&&(this.checkboxClickHandler=e=>{if(t.isReadOnly()&&!this.config.interactiveCheckboxes)return;const n=e.target;if(!(n instanceof HTMLElement))return;const i=n.closest(`.${A}`);if(!i)return;const s=i.closest(".notectl-list-item--checklist");if(!s)return;e.preventDefault();const c=s.getAttribute("data-block-id");c&&C(t,{interactiveCheckboxes:this.config.interactiveCheckboxes,targetId:u(c),locale:this.locale})},t.getContainer().addEventListener("mousedown",this.checkboxClickHandler))}getEnabledTypes(){return L.filter(t=>this.config.types.includes(t.type))}};export{_ as n,z as r,N as t};
2
- //# sourceMappingURL=ListPlugin-BchSFWVn.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ListPlugin-BchSFWVn.mjs","names":[],"sources":["../../src/editor/styles/list.ts","../../src/plugins/list/ListAttrsFactory.ts","../../src/plugins/list/ListItemContext.ts","../../src/plugins/list/ListCommands.ts","../../src/plugins/list/ListDefinitions.ts","../../src/plugins/list/ListInputRules.ts","../../src/plugins/list/ListKeyboardHandlers.ts","../../src/plugins/list/ListLocale.ts","../../src/plugins/list/ListMarker.ts","../../src/plugins/list/ListToolbarItems.ts","../../src/plugins/list/ListPlugin.ts"],"sourcesContent":["/** Width of the list marker / checkbox area in pixels. */\nexport const LIST_MARKER_WIDTH = 24;\n\n/** List styles — bullet, ordered, checklist items. */\nexport const LIST_CSS = `\n/* List Wrappers — suppress native markers, we use ::before pseudo-elements */\n.notectl-list {\n\tlist-style: none;\n\tmargin: 0;\n\tpadding: 0;\n}\n\n/* Ordered List — each <ol> wrapper resets the counter */\n.notectl-list--ordered {\n\tcounter-reset: notectl-ordered;\n}\n\n/* List Items */\n.notectl-list-item {\n\tmargin: 0;\n\tpadding: 2px 0;\n\tpadding-inline-start: ${LIST_MARKER_WIDTH}px;\n\tmin-height: 1.6em;\n\tposition: relative;\n}\n\n.notectl-list-item::before {\n\tposition: absolute;\n\tinset-inline-start: 0;\n\tdisplay: inline-block;\n\twidth: ${LIST_MARKER_WIDTH}px;\n\ttext-align: center;\n\t-webkit-user-select: none;\n\tuser-select: none;\n\tpointer-events: none;\n}\n\n/* Container items (#194): block children inherit the item's start padding.\n Trim the first/last child paragraph padding so the first text line sits on\n the marker's line and the item keeps the leaf item's vertical rhythm. */\n.notectl-list-item > p:first-of-type {\n\tpadding-top: 0;\n}\n\n.notectl-list-item > p:last-of-type {\n\tpadding-bottom: 0;\n}\n\n/* Bullet List */\n.notectl-list-item--bullet::before {\n\tcontent: '\\\\2022';\n\tcolor: var(--notectl-fg);\n}\n\n/* Ordered List — counter increment per item */\n.notectl-list-item--ordered {\n\tcounter-increment: notectl-ordered;\n}\n\n.notectl-list-item--ordered::before {\n\tcontent: counter(notectl-ordered) '.';\n\tcolor: var(--notectl-fg);\n\tfont-size: 14px;\n}\n\n/* Checklist — the marker is a real role=\"checkbox\" element (see ListMarker.ts)\n positioned over the reserved marker zone. inline-block keeps the parent's\n line-through (on checked items) from striking the glyph. */\n.notectl-checklist-marker {\n\tposition: absolute;\n\tinset-inline-start: 0;\n\tdisplay: inline-block;\n\twidth: ${LIST_MARKER_WIDTH}px;\n\ttext-align: center;\n\tfont-size: 16px;\n\tcolor: var(--notectl-fg-muted);\n\tcursor: pointer;\n\ttext-decoration: none;\n\t-webkit-user-select: none;\n\tuser-select: none;\n}\n\n.notectl-checklist-marker::before {\n\tcontent: '\\\\2610';\n}\n\n.notectl-list-item--checklist[data-checked=\"true\"] .notectl-checklist-marker {\n\tcolor: var(--notectl-success);\n}\n\n.notectl-list-item--checklist[data-checked=\"true\"] .notectl-checklist-marker::before {\n\tcontent: '\\\\2611';\n}\n\n.notectl-list-item--checklist[data-checked=\"true\"] {\n\tcolor: var(--notectl-fg-muted);\n\ttext-decoration: line-through;\n}\n`;\n","/**\n * Factory for building list item block attributes.\n * Centralizes attribute construction to avoid repetitive inline object literals.\n */\n\nimport type { BlockAttrs } from '../../model/Document.js';\nimport type { ListType } from './ListPlugin.js';\n\n/** Builds a `BlockAttrs` object for a list_item block. */\nexport function buildListItemAttrs(\n\tlistType: ListType,\n\tindent: number,\n\tchecked?: boolean,\n): BlockAttrs {\n\tif (listType === 'checklist') {\n\t\treturn { listType, indent, checked: checked ?? false };\n\t}\n\treturn { listType, indent };\n}\n","/**\n * Shared resolution helpers for container list items (#194).\n *\n * With `list_item` a hybrid leaf/container block, the caret may sit inside a\n * block child of an item. Commands and keyboard handlers resolve the owning\n * item through the ancestor chain and address structural edits through the\n * item's location (parent path + child index), mirroring the blockquote\n * container conventions.\n */\n\nimport type { BlockNode } from '../../model/Document.js';\nimport { getBlockChildren } from '../../model/Document.js';\nimport type { BlockId } from '../../model/TypeBrands.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { TransactionBuilder } from '../../state/TransactionBuilder.js';\n\n/** A list item's structural address: its parent path and child index. */\nexport interface ListItemLocation {\n\treadonly item: BlockNode;\n\t/** Path from the document root to the item's parent ([] = root). */\n\treadonly parentPath: readonly BlockId[];\n\t/** The item's index among its parent's block children. */\n\treadonly index: number;\n}\n\n/**\n * Resolves the list item owning a block: the block itself when it is a\n * `list_item`, otherwise its nearest `list_item` ancestor.\n */\nexport function resolveListItem(state: EditorState, id: BlockId): BlockNode | undefined {\n\tconst block: BlockNode | undefined = state.getBlock(id);\n\tif (block?.type === 'list_item') return block;\n\tconst path: readonly BlockId[] | undefined = state.getNodePath(id);\n\tif (!path) return undefined;\n\tfor (let i = path.length - 2; i >= 0; i--) {\n\t\tconst ancestorId: BlockId | undefined = path[i];\n\t\tconst ancestor: BlockNode | undefined = ancestorId ? state.getBlock(ancestorId) : undefined;\n\t\tif (ancestor?.type === 'list_item') return ancestor;\n\t}\n\treturn undefined;\n}\n\n/** Locates a list item's structural address, or undefined if it is not found. */\nexport function locateListItem(state: EditorState, itemId: BlockId): ListItemLocation | undefined {\n\tconst item: BlockNode | undefined = state.getBlock(itemId);\n\tif (!item || item.type !== 'list_item') return undefined;\n\tconst path: readonly BlockId[] | undefined = state.getNodePath(itemId);\n\tif (!path) return undefined;\n\n\tconst parentPath: readonly BlockId[] = path.slice(0, -1);\n\tconst parentId: BlockId | undefined = parentPath[parentPath.length - 1];\n\tconst siblings: readonly BlockNode[] = parentId\n\t\t? getBlockChildren(state.getBlock(parentId) as BlockNode)\n\t\t: state.doc.children;\n\tconst index: number = siblings.findIndex((sibling) => sibling.id === itemId);\n\tif (index < 0) return undefined;\n\treturn { item, parentPath, index };\n}\n\n/**\n * Replaces a container list item with its block children in place. The\n * children keep their IDs, so a selection inside them survives the lift.\n * Leaf items must not be dissolved (their inline content is not a block);\n * convert those via `setBlockType` instead.\n */\nexport function dissolveListItem(builder: TransactionBuilder, location: ListItemLocation): void {\n\tbuilder.removeNode(location.parentPath, location.index);\n\tconst children: readonly BlockNode[] = getBlockChildren(location.item);\n\tchildren.forEach((child, offset) => {\n\t\tbuilder.insertNode(location.parentPath, location.index + offset, child);\n\t});\n}\n","/**\n * Command registration and implementations for list block types.\n * Handles toggle between list types and paragraph, indent/outdent,\n * and checklist toggle.\n */\n\nimport { forEachBlockIdInRange } from '../../commands/RangeIterator.js';\nimport { isNodeOfType } from '../../model/AttrRegistry.js';\nimport type { BlockNode } from '../../model/Document.js';\nimport { isLeafBlock } from '../../model/Document.js';\nimport { isTextSelection, selectionRange } from '../../model/Selection.js';\nimport { type BlockId, nodeType } from '../../model/TypeBrands.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { PluginContext } from '../Plugin.js';\nimport { buildListItemAttrs } from './ListAttrsFactory.js';\nimport type { ListTypeDefinition } from './ListDefinitions.js';\nimport { dissolveListItem, locateListItem, resolveListItem } from './ListItemContext.js';\nimport type { ListLocale } from './ListLocale.js';\nimport type { ListConfig, ListType } from './ListPlugin.js';\n\n/** Registers all list commands (toggleList:*, indent, outdent, toggleChecklistItem). */\nexport function registerListCommands(\n\tcontext: PluginContext,\n\tconfig: ListConfig,\n\tenabledTypes: readonly ListTypeDefinition[],\n\tlocale: ListLocale,\n): void {\n\tfor (const def of enabledTypes) {\n\t\tcontext.registerCommand(`toggleList:${def.type}`, () => {\n\t\t\treturn toggleList(context, def.type);\n\t\t});\n\t}\n\n\tcontext.registerCommand('indentListItem', () => changeIndent(context, 1, config.maxIndent));\n\n\tcontext.registerCommand('outdentListItem', () => changeIndent(context, -1, config.maxIndent));\n\n\tif (config.types.includes('checklist')) {\n\t\tconst toggleChecklistItem = (): boolean =>\n\t\t\ttoggleChecked(context, { interactiveCheckboxes: config.interactiveCheckboxes, locale });\n\n\t\tcontext.registerCommand('toggleChecklistItem', toggleChecklistItem, {\n\t\t\treadonlyAllowed: true,\n\t\t});\n\n\t\t// Mod-Enter gives keyboard-only users a way to toggle a checklist item\n\t\t// (WCAG 2.1.1). The handler declines on non-checklist blocks, so it falls\n\t\t// through to other Mod-Enter bindings (e.g. code-block insert-after).\n\t\t// Registered at navigation priority so it stays reachable in read-only mode\n\t\t// when interactiveCheckboxes is enabled, matching the mouse handler.\n\t\tcontext.registerKeymap({ 'Mod-Enter': toggleChecklistItem }, { priority: 'navigation' });\n\t}\n\n\tcontext.registerKeymap({\n\t\tTab: () => changeIndent(context, 1, config.maxIndent),\n\t\t'Shift-Tab': () => changeIndent(context, -1, config.maxIndent),\n\t});\n}\n\n// --- Command Implementations ---\n\nfunction toggleList(context: PluginContext, listType: ListType): boolean {\n\tconst state: EditorState = context.getState();\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return false;\n\n\tif (sel.anchor.blockId !== sel.head.blockId) {\n\t\treturn toggleListRange(context, state, listType);\n\t}\n\treturn toggleListSingleBlock(context, state, listType);\n}\n\nfunction toggleListSingleBlock(\n\tcontext: PluginContext,\n\tstate: EditorState,\n\tlistType: ListType,\n): boolean {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return false;\n\tconst block = state.getBlock(sel.anchor.blockId);\n\tif (!block) return false;\n\n\t// The caret may sit inside a block child of a container item (#194):\n\t// toggling always targets the owning item, never the child.\n\tconst item: BlockNode | undefined = resolveListItem(state, sel.anchor.blockId);\n\tconst target: BlockNode = item ?? block;\n\n\tif (item && item.attrs?.listType === listType) {\n\t\tconst builder = state.transaction('command');\n\t\tif (isLeafBlock(item)) {\n\t\t\tbuilder.setBlockType(item.id, nodeType('paragraph'));\n\t\t} else {\n\t\t\t// A container item cannot become a paragraph (its children are\n\t\t\t// blocks) — dissolve it into those children instead.\n\t\t\tconst location = locateListItem(state, item.id);\n\t\t\tif (!location) return false;\n\t\t\tdissolveListItem(builder, location);\n\t\t}\n\t\tbuilder.setSelection(sel);\n\t\tcontext.dispatch(builder.build());\n\t\treturn true;\n\t}\n\n\tconst existingIndent: number = isNodeOfType(target, 'list_item') ? target.attrs.indent : 0;\n\tconst attrs = buildListItemAttrs(listType, existingIndent);\n\n\tconst tr = state\n\t\t.transaction('command')\n\t\t.setBlockType(target.id, nodeType('list_item'), attrs)\n\t\t.setSelection(sel)\n\t\t.build();\n\tcontext.dispatch(tr);\n\treturn true;\n}\n\nfunction toggleListRange(context: PluginContext, state: EditorState, listType: ListType): boolean {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return false;\n\n\tconst range = selectionRange(sel, state.getBlockOrder());\n\tconst toggleOff: boolean = allBlocksMatchListType(state, range, listType);\n\tconst builder = state.transaction('command');\n\n\t// Children of a container item resolve to their owning item (#194), so a\n\t// range over its paragraphs toggles the item once, not each child.\n\tconst targets: BlockNode[] = collectToggleTargets(state, range);\n\n\t// Dissolving replaces one node with several, shifting later sibling\n\t// indices — process targets back-to-front so earlier addresses stay valid.\n\tfor (let i = targets.length - 1; i >= 0; i--) {\n\t\tconst target: BlockNode | undefined = targets[i];\n\t\tif (!target) continue;\n\n\t\tif (toggleOff) {\n\t\t\tif (isLeafBlock(target)) {\n\t\t\t\tbuilder.setBlockType(target.id, nodeType('paragraph'));\n\t\t\t} else {\n\t\t\t\tconst location = locateListItem(state, target.id);\n\t\t\t\tif (location) dissolveListItem(builder, location);\n\t\t\t}\n\t\t} else {\n\t\t\tconst existingIndent: number = isNodeOfType(target, 'list_item') ? target.attrs.indent : 0;\n\t\t\tconst existingChecked: boolean =\n\t\t\t\tisNodeOfType(target, 'list_item') &&\n\t\t\t\ttarget.attrs.listType === 'checklist' &&\n\t\t\t\ttarget.attrs.checked;\n\t\t\tbuilder.setBlockType(\n\t\t\t\ttarget.id,\n\t\t\t\tnodeType('list_item'),\n\t\t\t\tbuildListItemAttrs(listType, existingIndent, existingChecked),\n\t\t\t);\n\t\t}\n\t}\n\n\tbuilder.setSelection(sel);\n\tcontext.dispatch(builder.build());\n\treturn true;\n}\n\n/** Collects unique toggle targets: each leaf block or its owning list item. */\nfunction collectToggleTargets(\n\tstate: EditorState,\n\trange: ReturnType<typeof selectionRange>,\n): BlockNode[] {\n\tconst targets: BlockNode[] = [];\n\tconst seen = new Set<BlockId>();\n\tforEachBlockIdInRange(state, range, (bid: BlockId) => {\n\t\tconst block = state.getBlock(bid);\n\t\tif (!block) return;\n\t\tconst target: BlockNode = resolveListItem(state, bid) ?? block;\n\t\tif (seen.has(target.id)) return;\n\t\tseen.add(target.id);\n\t\ttargets.push(target);\n\t});\n\treturn targets;\n}\n\n// --- Indent / Outdent ---\n\nfunction changeIndent(context: PluginContext, delta: 1 | -1, maxIndent: number): boolean {\n\tconst state: EditorState = context.getState();\n\tif (!isTextSelection(state.selection)) return false;\n\n\tif (state.selection.anchor.blockId !== state.selection.head.blockId) {\n\t\treturn changeIndentRange(context, state, delta, maxIndent);\n\t}\n\n\tconst sel = state.selection;\n\tconst block = resolveListItem(state, sel.anchor.blockId);\n\tif (!block || !isNodeOfType(block, 'list_item')) return false;\n\n\tconst newIndent: number = block.attrs.indent + delta;\n\tif (newIndent < 0 || newIndent > maxIndent) return false;\n\n\tconst attrs = buildListItemAttrs(block.attrs.listType, newIndent, block.attrs.checked);\n\tconst tr = state\n\t\t.transaction('command')\n\t\t.setBlockType(block.id, nodeType('list_item'), attrs)\n\t\t.setSelection(sel)\n\t\t.build();\n\tcontext.dispatch(tr);\n\treturn true;\n}\n\nfunction changeIndentRange(\n\tcontext: PluginContext,\n\tstate: EditorState,\n\tdelta: 1 | -1,\n\tmaxIndent: number,\n): boolean {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return false;\n\n\tconst range = selectionRange(sel, state.getBlockOrder());\n\tconst builder = state.transaction('command');\n\tlet changed = false;\n\tconst seen = new Set<BlockId>();\n\n\tforEachBlockIdInRange(state, range, (bid: BlockId) => {\n\t\tconst block = resolveListItem(state, bid);\n\t\tif (!block || !isNodeOfType(block, 'list_item')) return;\n\t\tif (seen.has(block.id)) return;\n\t\tseen.add(block.id);\n\n\t\tconst newIndent: number = block.attrs.indent + delta;\n\t\tif (newIndent < 0 || newIndent > maxIndent) return;\n\n\t\tbuilder.setBlockType(\n\t\t\tblock.id,\n\t\t\tnodeType('list_item'),\n\t\t\tbuildListItemAttrs(block.attrs.listType, newIndent, block.attrs.checked),\n\t\t);\n\t\tchanged = true;\n\t});\n\n\tif (!changed) return false;\n\n\tbuilder.setSelection(sel);\n\tcontext.dispatch(builder.build());\n\treturn true;\n}\n\n// --- Checklist Toggle ---\n\n/** Options for {@link toggleChecked}. */\nexport interface ToggleCheckedOptions {\n\t/** When true, the toggle is allowed even in read-only mode. */\n\treadonly interactiveCheckboxes?: boolean;\n\t/** Specific checklist item to toggle. Defaults to the selection's block. */\n\treadonly targetId?: BlockId;\n\t/** Locale used for the screen-reader announcement of the new state. */\n\treadonly locale: ListLocale;\n}\n\n/**\n * Toggles the checked state of a checklist item and announces the new state to\n * screen readers. Exported for use in the checkbox click handler.\n */\nexport function toggleChecked(context: PluginContext, options: ToggleCheckedOptions): boolean {\n\tconst { interactiveCheckboxes, targetId, locale } = options;\n\tif (context.isReadOnly() && !interactiveCheckboxes) return false;\n\n\tconst state: EditorState = context.getState();\n\tconst bid: BlockId | null =\n\t\ttargetId ?? (!isTextSelection(state.selection) ? null : state.selection.anchor.blockId);\n\tif (!bid) return false;\n\n\tconst block = resolveListItem(state, bid);\n\tif (!block || !isNodeOfType(block, 'list_item') || block.attrs.listType !== 'checklist') {\n\t\treturn false;\n\t}\n\n\tconst nextChecked: boolean = !block.attrs.checked;\n\tconst attrs = buildListItemAttrs(block.attrs.listType, block.attrs.indent, nextChecked);\n\n\tconst tr = state\n\t\t.transaction('command')\n\t\t.setBlockType(block.id, nodeType('list_item'), attrs)\n\t\t.setSelection(state.selection)\n\t\t.build();\n\tcontext.dispatch(tr);\n\n\t// The marker is not focused while editing, so the aria-checked change alone is\n\t// not spoken — announce the new state explicitly (WCAG 4.1.3).\n\tcontext.announce(nextChecked ? locale.checkedAnnouncement : locale.uncheckedAnnouncement);\n\treturn true;\n}\n\n// --- Helpers ---\n\n/**\n * Checks whether all blocks in a range belong to list items of the given type\n * (children of container items resolve to their owning item, #194). Exported\n * for toolbar active-state detection.\n */\nexport function allBlocksMatchListType(\n\tstate: EditorState,\n\trange: ReturnType<typeof selectionRange>,\n\tlistType: ListType,\n): boolean {\n\tlet allMatch = true;\n\tforEachBlockIdInRange(state, range, (bid: BlockId) => {\n\t\tconst block = resolveListItem(state, bid);\n\t\tif (!block || block.type !== 'list_item' || block.attrs?.listType !== listType) {\n\t\t\tallMatch = false;\n\t\t}\n\t});\n\treturn allMatch;\n}\n","/**\n * List type metadata: icons, patterns, and type definitions.\n * Pure data constants shared across list plugin modules.\n */\n\nimport type { ListType } from './ListPlugin.js';\n\n// --- List Type Metadata ---\n\nexport interface ListTypeDefinition {\n\treadonly type: ListType;\n\treadonly icon: string;\n\treadonly inputPattern: RegExp;\n\treadonly inputPrefix: string;\n}\n\nconst BULLET_LIST_ICON =\n\t'<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M4 10.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm0-6c-.83 0-1.5.67-1.5 1.5S3.17 7.5 4 7.5 5.5 6.83 5.5 6 4.83 4.5 4 4.5zm0 12c-.83 0-1.5.68-1.5 1.5s.68 1.5 1.5 1.5 1.5-.68 1.5-1.5-.67-1.5-1.5-1.5zM7 19h14v-2H7v2zm0-6h14v-2H7v2zm0-8v2h14V5H7z\"/></svg>';\nconst NUMBERED_LIST_ICON =\n\t'<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M2 17h2v.5H3v1h1v.5H2v1h3v-4H2v1zm1-9h1V4H2v1h1v3zm-1 3h1.8L2 13.1v.9h3v-1H3.2L5 10.9V10H2v1zm5-6v2h14V5H7zm0 14h14v-2H7v2zm0-6h14v-2H7v2z\"/></svg>';\nconst CHECKLIST_ICON =\n\t'<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M22 7h-9v2h9V7zm0 8h-9v2h9v-2zM5.54 11L2 7.46l1.41-1.41 2.12 2.12 4.24-4.24 1.41 1.41L5.54 11zm0 8L2 15.46l1.41-1.41 2.12 2.12 4.24-4.24 1.41 1.41L5.54 19z\"/></svg>';\n\nexport const LIST_TYPE_DEFINITIONS: readonly ListTypeDefinition[] = [\n\t{\n\t\ttype: 'bullet',\n\t\ticon: BULLET_LIST_ICON,\n\t\tinputPattern: /^[-*] $/,\n\t\tinputPrefix: '- ',\n\t},\n\t{\n\t\ttype: 'ordered',\n\t\ticon: NUMBERED_LIST_ICON,\n\t\tinputPattern: /^\\d+\\. $/,\n\t\tinputPrefix: '1. ',\n\t},\n\t{\n\t\ttype: 'checklist',\n\t\ticon: CHECKLIST_ICON,\n\t\tinputPattern: /^\\[[ x]] $/,\n\t\tinputPrefix: '[ ] ',\n\t},\n];\n","/**\n * Input rule registration for list block types.\n * Converts `- `, `* `, `1. `, `[ ] `, `[x] ` at the start of a paragraph into list items.\n */\n\nimport { createCollapsedSelection, isCollapsed, isTextSelection } from '../../model/Selection.js';\nimport { nodeType } from '../../model/TypeBrands.js';\nimport type { PluginContext } from '../Plugin.js';\nimport { buildListItemAttrs } from './ListAttrsFactory.js';\nimport type { ListTypeDefinition } from './ListDefinitions.js';\n\n/** Registers markdown-style input rules for configured list types. */\nexport function registerListInputRules(\n\tcontext: PluginContext,\n\tenabledTypes: readonly ListTypeDefinition[],\n): void {\n\tfor (const def of enabledTypes) {\n\t\tcontext.registerInputRule({\n\t\t\tpattern: def.inputPattern,\n\t\t\thandler: (state, match, start, _end) => {\n\t\t\t\tconst sel = state.selection;\n\t\t\t\tif (!isTextSelection(sel)) return null;\n\t\t\t\tif (!isCollapsed(sel)) return null;\n\n\t\t\t\tconst block = state.getBlock(sel.anchor.blockId);\n\t\t\t\tif (!block || block.type !== 'paragraph') return null;\n\n\t\t\t\t// Inside a container list item (#194) the rule must not fire: it\n\t\t\t\t// would nest a list_item into a list_item, which the schema forbids.\n\t\t\t\tconst parent = state.getParent(sel.anchor.blockId);\n\t\t\t\tif (parent?.type === 'list_item') return null;\n\n\t\t\t\tconst matchStr = match[0] ?? '';\n\t\t\t\tconst matchLen = matchStr.length;\n\t\t\t\tconst attrs = buildListItemAttrs(def.type, 0, matchStr.includes('[x]'));\n\n\t\t\t\treturn state\n\t\t\t\t\t.transaction('input')\n\t\t\t\t\t.deleteTextAt(sel.anchor.blockId, start, start + matchLen)\n\t\t\t\t\t.setBlockType(sel.anchor.blockId, nodeType('list_item'), attrs)\n\t\t\t\t\t.setSelection(createCollapsedSelection(sel.anchor.blockId, 0))\n\t\t\t\t\t.build();\n\t\t\t},\n\t\t});\n\t}\n}\n","/**\n * Keyboard handlers for list block types.\n *\n * Leaf items: Enter splits into a new item (or exits an empty item),\n * Backspace at the start converts back to a paragraph.\n *\n * Container items (#194): the caret sits inside a block child. Enter on an\n * empty trailing child exits into a new sibling item (Enter-Enter continues\n * the list); Backspace at the start of the first child dissolves the item\n * into its children — both mirroring the blockquote container conventions.\n * Everything else falls through to the default split/merge behavior.\n */\n\nimport { isEmptyParagraph } from '../../commands/BlockInsertion.js';\nimport { isNodeOfType } from '../../model/AttrRegistry.js';\nimport type { BlockNode } from '../../model/Document.js';\nimport { generateBlockId, getBlockChildren, getBlockText } from '../../model/Document.js';\nimport { createBlockNode, createTextNode } from '../../model/Document.js';\nimport { createCollapsedSelection, isCollapsed, isTextSelection } from '../../model/Selection.js';\nimport type { BlockId } from '../../model/TypeBrands.js';\nimport { nodeType } from '../../model/TypeBrands.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { PluginContext } from '../Plugin.js';\nimport { buildListItemAttrs } from './ListAttrsFactory.js';\nimport { type ListItemLocation, dissolveListItem, locateListItem } from './ListItemContext.js';\n\n// --- Context Guard ---\n\ninterface ListContext {\n\treadonly state: EditorState;\n\t/** The list item owning the caret (the caret block itself for leaf items). */\n\treadonly item: BlockNode;\n\t/** The caret's block child of a container item; undefined for leaf items. */\n\treadonly child: BlockNode | undefined;\n\treadonly childIndex: number;\n\treadonly childCount: number;\n\treadonly blockId: BlockId;\n\treadonly offset: number;\n}\n\n/**\n * Guards against NodeSelection, non-collapsed selections, and carets outside\n * list items. Resolves both leaf items (caret directly inside the item) and\n * container items (caret inside a direct block child of the item).\n */\nfunction withListContext(context: PluginContext, handler: (ctx: ListContext) => boolean): boolean {\n\tconst state: EditorState = context.getState();\n\tif (!isTextSelection(state.selection)) return false;\n\n\tconst sel = state.selection;\n\tif (!isCollapsed(sel)) return false;\n\n\tconst block: BlockNode | undefined = state.getBlock(sel.anchor.blockId);\n\tif (!block) return false;\n\n\tif (block.type === 'list_item') {\n\t\treturn handler({\n\t\t\tstate,\n\t\t\titem: block,\n\t\t\tchild: undefined,\n\t\t\tchildIndex: -1,\n\t\t\tchildCount: 0,\n\t\t\tblockId: sel.anchor.blockId,\n\t\t\toffset: sel.anchor.offset,\n\t\t});\n\t}\n\n\tconst parent: BlockNode | undefined = state.getParent(sel.anchor.blockId);\n\tif (!parent || parent.type !== 'list_item') return false;\n\tconst children: readonly BlockNode[] = getBlockChildren(parent);\n\tconst childIndex: number = children.findIndex((c) => c.id === block.id);\n\tif (childIndex < 0) return false;\n\n\treturn handler({\n\t\tstate,\n\t\titem: parent,\n\t\tchild: block,\n\t\tchildIndex,\n\t\tchildCount: children.length,\n\t\tblockId: sel.anchor.blockId,\n\t\toffset: sel.anchor.offset,\n\t});\n}\n\n/** Registers Enter and Backspace keymaps for list items. */\nexport function registerListKeymaps(context: PluginContext): void {\n\tcontext.registerKeymap({\n\t\tEnter: () => handleEnter(context),\n\t\tBackspace: () => handleBackspace(context),\n\t});\n}\n\n// --- Enter Handler ---\n\n/**\n * Handles Enter inside a list item.\n * Leaf items: empty → exit list (convert to paragraph); non-empty → split\n * into a new item of the same type.\n * Container items: an empty trailing child exits into a new sibling item;\n * a lone empty child dissolves the item. Everything else falls through to\n * the default split (which grows the item's children).\n */\nfunction handleEnter(context: PluginContext): boolean {\n\treturn withListContext(context, (ctx) => {\n\t\tif (ctx.child) return handleEnterInContainerChild(context, ctx, ctx.child);\n\n\t\tconst text: string = getBlockText(ctx.item);\n\n\t\tif (text === '') {\n\t\t\tconst tr = ctx.state\n\t\t\t\t.transaction('input')\n\t\t\t\t.setBlockType(ctx.blockId, nodeType('paragraph'))\n\t\t\t\t.setSelection(ctx.state.selection)\n\t\t\t\t.build();\n\t\t\tcontext.dispatch(tr);\n\t\t\treturn true;\n\t\t}\n\n\t\tconst newBlockId = generateBlockId();\n\t\tconst listType = isNodeOfType(ctx.item, 'list_item') ? ctx.item.attrs.listType : 'bullet';\n\t\tconst indent: number = isNodeOfType(ctx.item, 'list_item') ? ctx.item.attrs.indent : 0;\n\t\tconst attrs = buildListItemAttrs(listType, indent);\n\n\t\tconst tr = ctx.state\n\t\t\t.transaction('input')\n\t\t\t.splitBlock(ctx.blockId, ctx.offset, newBlockId)\n\t\t\t.setBlockType(newBlockId, nodeType('list_item'), attrs)\n\t\t\t.setSelection(createCollapsedSelection(newBlockId, 0))\n\t\t\t.build();\n\t\tcontext.dispatch(tr);\n\t\treturn true;\n\t});\n}\n\n/** Enter inside a container item's child: exit on an empty trailing child. */\nfunction handleEnterInContainerChild(\n\tcontext: PluginContext,\n\tctx: ListContext,\n\tchild: BlockNode,\n): boolean {\n\tif (!isEmptyParagraph(child)) return false;\n\tif (ctx.childIndex !== ctx.childCount - 1) return false;\n\n\tconst location: ListItemLocation | undefined = locateListItem(ctx.state, ctx.item.id);\n\tif (!location) return false;\n\n\tconst builder = ctx.state.transaction('input');\n\n\tif (ctx.childCount === 1) {\n\t\t// A lone empty child: the item has no content left — dissolve it and\n\t\t// keep the paragraph (same ID, so the caret stays put).\n\t\tdissolveListItem(builder, location);\n\t\tbuilder.setSelection(ctx.state.selection);\n\t\tcontext.dispatch(builder.build());\n\t\treturn true;\n\t}\n\n\t// Drop the empty trailing child and continue the list with a fresh item.\n\tconst listType = isNodeOfType(ctx.item, 'list_item') ? ctx.item.attrs.listType : 'bullet';\n\tconst indent: number = isNodeOfType(ctx.item, 'list_item') ? ctx.item.attrs.indent : 0;\n\tconst newItemId = generateBlockId();\n\tconst newItem: BlockNode = createBlockNode(\n\t\tnodeType('list_item'),\n\t\t[createTextNode('')],\n\t\tnewItemId,\n\t\tbuildListItemAttrs(listType, indent),\n\t);\n\n\tbuilder\n\t\t.removeNode([...location.parentPath, ctx.item.id], ctx.childIndex)\n\t\t.insertNode(location.parentPath, location.index + 1, newItem)\n\t\t.setSelection(createCollapsedSelection(newItemId, 0));\n\tcontext.dispatch(builder.build());\n\treturn true;\n}\n\n// --- Backspace Handler ---\n\n/**\n * Handles Backspace at the start of a list item.\n * Leaf items convert back to a paragraph. Container items dissolve into\n * their block children when the caret sits at the very start of the first\n * child (the un-list gesture); later children fall through to the default\n * sibling merge.\n */\nfunction handleBackspace(context: PluginContext): boolean {\n\treturn withListContext(context, (ctx) => {\n\t\tif (ctx.offset !== 0) return false;\n\n\t\tif (ctx.child) {\n\t\t\tif (ctx.childIndex !== 0) return false;\n\t\t\tconst location: ListItemLocation | undefined = locateListItem(ctx.state, ctx.item.id);\n\t\t\tif (!location) return false;\n\t\t\tconst builder = ctx.state.transaction('input');\n\t\t\tdissolveListItem(builder, location);\n\t\t\tbuilder.setSelection(ctx.state.selection);\n\t\t\tcontext.dispatch(builder.build());\n\t\t\treturn true;\n\t\t}\n\n\t\tconst tr = ctx.state\n\t\t\t.transaction('input')\n\t\t\t.setBlockType(ctx.blockId, nodeType('paragraph'))\n\t\t\t.setSelection(ctx.state.selection)\n\t\t\t.build();\n\t\tcontext.dispatch(tr);\n\t\treturn true;\n\t});\n}\n","/**\n * Locale interface and default English locale for the ListPlugin.\n */\n\nimport { type LocaleModuleMap, loadLocaleModule } from '../shared/LocaleLoader.js';\n\n// --- Locale Interface ---\n\nexport interface ListLocale {\n\treadonly bulletList: string;\n\treadonly numberedList: string;\n\treadonly checklist: string;\n\t/** Accessible name for the checklist item's checkbox marker (screen readers). */\n\treadonly checkboxLabel: string;\n\t/** Announced when a checklist item is toggled on. */\n\treadonly checkedAnnouncement: string;\n\t/** Announced when a checklist item is toggled off. */\n\treadonly uncheckedAnnouncement: string;\n}\n\n// --- Default English Locale ---\n\nexport const LIST_LOCALE_EN: ListLocale = {\n\tbulletList: 'Bullet List',\n\tnumberedList: 'Numbered List',\n\tchecklist: 'Checklist',\n\tcheckboxLabel: 'To-do item',\n\tcheckedAnnouncement: 'Checked',\n\tuncheckedAnnouncement: 'Unchecked',\n};\n\n// --- Lazy Locale Loader ---\n\nconst localeModules: LocaleModuleMap<ListLocale> = import.meta.glob<{\n\tdefault: ListLocale;\n}>('./locales/*.ts', { eager: false });\n\nexport async function loadListLocale(lang: string): Promise<ListLocale> {\n\treturn loadLocaleModule(localeModules, lang, LIST_LOCALE_EN);\n}\n","/**\n * Accessible checkbox marker for checklist items.\n *\n * The marker is a real `role=\"checkbox\"` element so assistive technology can\n * announce the item's checked state (WCAG 4.1.2 Name, Role, Value). It is\n * rendered `contenteditable=\"false\"` and flagged `data-widget` so the selection\n * layer treats it as zero-width view chrome, never as document content or a caret\n * position. The visible checkbox glyph is drawn in CSS.\n */\n\n/** CSS class identifying the checklist checkbox marker element. */\nexport const CHECKLIST_MARKER_CLASS = 'notectl-checklist-marker';\n\n/** Creates the accessible checkbox marker for a checklist item. */\nexport function createChecklistMarker(checked: boolean, label: string): HTMLElement {\n\tconst marker: HTMLElement = document.createElement('span');\n\tmarker.className = CHECKLIST_MARKER_CLASS;\n\tmarker.setAttribute('role', 'checkbox');\n\tmarker.setAttribute('aria-checked', String(checked));\n\tmarker.setAttribute('aria-label', label);\n\tmarker.setAttribute('contenteditable', 'false');\n\tmarker.setAttribute('data-widget', 'true');\n\treturn marker;\n}\n","/**\n * Toolbar item registration for list block types.\n * Registers bullet, ordered, and checklist toolbar buttons with active-state detection.\n */\n\nimport { isTextSelection, selectionRange } from '../../model/Selection.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { PluginContext } from '../Plugin.js';\nimport { allBlocksMatchListType } from './ListCommands.js';\nimport type { ListTypeDefinition } from './ListDefinitions.js';\nimport { resolveListItem } from './ListItemContext.js';\nimport type { ListLocale } from './ListLocale.js';\nimport type { ListType } from './ListPlugin.js';\n\n/** Registers toolbar items for each enabled list type. */\nexport function registerListToolbarItems(\n\tcontext: PluginContext,\n\tenabledTypes: readonly ListTypeDefinition[],\n\tlocale: ListLocale,\n): void {\n\tfor (const def of enabledTypes) {\n\t\tcontext.registerToolbarItem({\n\t\t\tid: `list-${def.type}`,\n\t\t\tgroup: 'block',\n\t\t\ticon: def.icon,\n\t\t\tlabel: getListLabel(def.type, locale),\n\t\t\tcommand: `toggleList:${def.type}`,\n\t\t\tisActive: (state) => isListActive(state, def.type),\n\t\t});\n\t}\n}\n\n// --- Helpers ---\n\nfunction getListLabel(type: ListType, locale: ListLocale): string {\n\tconst labels: Record<ListType, string> = {\n\t\tbullet: locale.bulletList,\n\t\tordered: locale.numberedList,\n\t\tchecklist: locale.checklist,\n\t};\n\treturn labels[type];\n}\n\nfunction isListActive(state: EditorState, listType: ListType): boolean {\n\tif (!isTextSelection(state.selection)) return false;\n\n\tif (state.selection.anchor.blockId !== state.selection.head.blockId) {\n\t\tconst range = selectionRange(state.selection, state.getBlockOrder());\n\t\treturn allBlocksMatchListType(state, range, listType);\n\t}\n\n\t// Children of container items resolve to their owning item (#194).\n\tconst block = resolveListItem(state, state.selection.anchor.blockId);\n\treturn block?.type === 'list_item' && block.attrs?.listType === listType;\n}\n","/**\n * ListPlugin: registers ordered, unordered, and checklist block types\n * with NodeSpecs, toggle commands, indent/outdent (Tab/Shift-Tab),\n * input rules, and toolbar buttons.\n *\n * This file is a thin orchestrator — command logic, input rules, keyboard\n * handlers, and toolbar rendering are delegated to dedicated modules.\n *\n * Sibling structure is modeled flat: every item carries a `listType` and an\n * `indent` attribute, so nesting between items needs no deep tree. Item\n * content is hybrid (#194): a single-paragraph item is a leaf with inline\n * children, while a multi-block item (second paragraph, code block, quote,\n * heading) is a container whose children are blocks.\n */\n\nimport { LIST_CSS, LIST_MARKER_WIDTH } from '../../editor/styles/list.js';\nimport { blockId } from '../../model/TypeBrands.js';\nimport { setStyleProperty } from '../../style/StyleRuntime.js';\nimport { createBlockElement } from '../../view/DomUtils.js';\nimport type { Plugin, PluginContext } from '../Plugin.js';\nimport { resolveLocale } from '../shared/PluginHelpers.js';\nimport { registerListCommands, toggleChecked } from './ListCommands.js';\nimport { LIST_TYPE_DEFINITIONS, type ListTypeDefinition } from './ListDefinitions.js';\nimport { registerListInputRules } from './ListInputRules.js';\nimport { registerListKeymaps } from './ListKeyboardHandlers.js';\nimport { LIST_LOCALE_EN, type ListLocale, loadListLocale } from './ListLocale.js';\nimport { CHECKLIST_MARKER_CLASS, createChecklistMarker } from './ListMarker.js';\nimport { registerListToolbarItems } from './ListToolbarItems.js';\n\n// --- Attribute Registry Augmentation ---\n\nexport type ListType = 'bullet' | 'ordered' | 'checklist';\n\ndeclare module '../../model/AttrRegistry.js' {\n\tinterface NodeAttrRegistry {\n\t\tlist_item: { listType: ListType; indent: number; checked: boolean };\n\t}\n}\n\n// --- Configuration ---\n\nexport interface ListConfig {\n\t/** Which list types to enable. Defaults to all. */\n\treadonly types: readonly ListType[];\n\t/** Maximum indent depth. Defaults to 4. */\n\treadonly maxIndent: number;\n\t/** Live Markdown shortcuts: `- `/`* ` (bullet), `1. ` (ordered), `[ ] ` (checklist). Default true. */\n\treadonly inputRule?: boolean;\n\t/**\n\t * When true, checklist checkboxes remain interactive even in read-only mode.\n\t * Defaults to false (checkboxes are fully read-only).\n\t */\n\treadonly interactiveCheckboxes?: boolean;\n\treadonly locale?: ListLocale;\n}\n\nconst DEFAULT_CONFIG: ListConfig = {\n\ttypes: ['bullet', 'ordered', 'checklist'],\n\tmaxIndent: 4,\n};\n\n// --- Plugin ---\n\nexport class ListPlugin implements Plugin {\n\treadonly id = 'list';\n\treadonly name = 'List';\n\treadonly priority = 35;\n\n\tprivate readonly config: ListConfig;\n\tprivate locale!: ListLocale;\n\tprivate context: PluginContext | null = null;\n\tprivate checkboxClickHandler: ((e: MouseEvent) => void) | null = null;\n\n\tconstructor(config?: Partial<ListConfig>) {\n\t\tthis.config = { ...DEFAULT_CONFIG, ...config };\n\t}\n\n\tasync init(context: PluginContext): Promise<void> {\n\t\tthis.context = context;\n\t\tthis.locale = await resolveLocale(context, this.config.locale, LIST_LOCALE_EN, loadListLocale);\n\t\tconst enabledTypes = this.getEnabledTypes();\n\n\t\tcontext.registerStyleSheet(LIST_CSS);\n\t\tthis.registerNodeSpec(context);\n\t\tregisterListCommands(context, this.config, enabledTypes, this.locale);\n\t\tregisterListKeymaps(context);\n\t\tif (this.config.inputRule !== false) registerListInputRules(context, enabledTypes);\n\t\tregisterListToolbarItems(context, enabledTypes, this.locale);\n\t\tthis.registerCheckboxClickHandler(context);\n\t}\n\n\tdestroy(): void {\n\t\tif (this.checkboxClickHandler && this.context) {\n\t\t\tconst container: HTMLElement = this.context.getContainer();\n\t\t\tcontainer.removeEventListener('mousedown', this.checkboxClickHandler);\n\t\t}\n\t\tthis.checkboxClickHandler = null;\n\t\tthis.context = null;\n\t}\n\n\tprivate registerNodeSpec(context: PluginContext): void {\n\t\tconst checkboxLabel: string = this.locale.checkboxLabel;\n\n\t\tcontext.registerNodeSpec({\n\t\t\ttype: 'list_item',\n\t\t\tgroup: 'block',\n\t\t\t// Hybrid content model (#194): the common single-paragraph item is a\n\t\t\t// leaf (inline text children); multi-block items are containers with\n\t\t\t// block children. Sibling nesting stays flat-with-indent, so list_item\n\t\t\t// itself is deliberately not an allowed child.\n\t\t\tcontent: {\n\t\t\t\tallow: ['text', 'paragraph', 'heading', 'code_block', 'blockquote', 'horizontal_rule'],\n\t\t\t},\n\t\t\tattrs: {\n\t\t\t\tlistType: { default: 'bullet' },\n\t\t\t\tindent: { default: 0 },\n\t\t\t\tchecked: { default: false },\n\t\t\t},\n\t\t\ttoDOM(node) {\n\t\t\t\tconst listType = node.attrs?.listType ?? 'bullet';\n\t\t\t\tconst indent = node.attrs?.indent ?? 0;\n\t\t\t\tconst checked = node.attrs?.checked ?? false;\n\n\t\t\t\tconst li = createBlockElement('li', node.id);\n\t\t\t\tli.setAttribute('role', 'listitem');\n\t\t\t\tli.setAttribute('data-list-type', listType);\n\t\t\t\tli.setAttribute('data-indent', String(indent));\n\t\t\t\tli.className = `notectl-list-item notectl-list-item--${listType}`;\n\n\t\t\t\tif (indent > 0) {\n\t\t\t\t\tsetStyleProperty(li, 'marginLeft', `${indent * LIST_MARKER_WIDTH}px`);\n\t\t\t\t}\n\n\t\t\t\tif (listType === 'checklist') {\n\t\t\t\t\t// `data-checked` drives the CSS glyph; the checked state is exposed to\n\t\t\t\t\t// assistive technology via the marker's own role=\"checkbox\", not via an\n\t\t\t\t\t// (invalid) aria-checked on the listitem. The marker is the first child\n\t\t\t\t\t// so reconciled inline content is appended after it.\n\t\t\t\t\tli.setAttribute('data-checked', String(checked));\n\t\t\t\t\tli.appendChild(createChecklistMarker(checked, checkboxLabel));\n\t\t\t\t}\n\t\t\t\tli.setAttribute('aria-level', String(indent + 1));\n\n\t\t\t\treturn li;\n\t\t\t},\n\t\t\twrapper(node) {\n\t\t\t\tconst listType = node.attrs?.listType ?? 'bullet';\n\t\t\t\tconst tag = listType === 'ordered' ? 'ol' : 'ul';\n\t\t\t\treturn {\n\t\t\t\t\ttag,\n\t\t\t\t\tkey: `list-${listType}`,\n\t\t\t\t\tclassName: `notectl-list notectl-list--${listType}`,\n\t\t\t\t\tattrs: { role: 'list' },\n\t\t\t\t};\n\t\t\t},\n\t\t\ttoHTML(node, content) {\n\t\t\t\tconst listType: string = (node.attrs?.listType as string) ?? 'bullet';\n\t\t\t\tconst checked: boolean = (node.attrs?.checked as boolean) ?? false;\n\n\t\t\t\tif (listType === 'checklist') {\n\t\t\t\t\tconst checkedAttr: string = checked ? ' checked' : '';\n\t\t\t\t\tconst ariaChecked: string = String(checked);\n\t\t\t\t\treturn (\n\t\t\t\t\t\t`<li role=\"checkbox\" aria-checked=\"${ariaChecked}\">` +\n\t\t\t\t\t\t`<input type=\"checkbox\" disabled${checkedAttr}>` +\n\t\t\t\t\t\t`${content || '<br>'}</li>`\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\treturn `<li>${content || '<br>'}</li>`;\n\t\t\t},\n\t\t\tparseHTML: [{ tag: 'li' }],\n\t\t\tsanitize: {\n\t\t\t\ttags: ['ul', 'ol', 'li', 'input'],\n\t\t\t\tattrs: ['type', 'disabled', 'checked', 'role', 'aria-checked'],\n\t\t\t},\n\t\t});\n\t}\n\n\tprivate registerCheckboxClickHandler(context: PluginContext): void {\n\t\tif (!this.config.types.includes('checklist')) return;\n\n\t\tthis.checkboxClickHandler = (e: MouseEvent) => {\n\t\t\tif (context.isReadOnly() && !this.config.interactiveCheckboxes) return;\n\n\t\t\tconst target: EventTarget | null = e.target;\n\t\t\tif (!(target instanceof HTMLElement)) return;\n\n\t\t\t// Toggle only when the checkbox marker itself is clicked. The marker is a\n\t\t\t// real element, so this is precise — no geometry/RTL math needed.\n\t\t\tconst marker: Element | null = target.closest(`.${CHECKLIST_MARKER_CLASS}`);\n\t\t\tif (!marker) return;\n\n\t\t\tconst li: Element | null = marker.closest('.notectl-list-item--checklist');\n\t\t\tif (!li) return;\n\n\t\t\te.preventDefault();\n\n\t\t\tconst bid: string | null = li.getAttribute('data-block-id');\n\t\t\tif (!bid) return;\n\n\t\t\ttoggleChecked(context, {\n\t\t\t\tinteractiveCheckboxes: this.config.interactiveCheckboxes,\n\t\t\t\ttargetId: blockId(bid),\n\t\t\t\tlocale: this.locale,\n\t\t\t});\n\t\t};\n\n\t\tconst container: HTMLElement = context.getContainer();\n\t\tcontainer.addEventListener('mousedown', this.checkboxClickHandler);\n\t}\n\n\tprivate getEnabledTypes(): readonly ListTypeDefinition[] {\n\t\treturn LIST_TYPE_DEFINITIONS.filter((def) => this.config.types.includes(def.type));\n\t}\n}\n"],"mappings":"weCSA,SAAgB,EACf,EACA,EACA,GAEA,MAAiB,cAAb,EACI,CAAE,WAAU,SAAQ,QAAS,IAAW,GAEzC,CAAE,WAAU,SACpB,CCWA,SAAgB,EAAgB,EAAoB,GACnD,MAAM,EAA+B,EAAM,SAAS,GACpD,GAAoB,cAAhB,GAAO,KAAsB,OAAO,EACxC,MAAM,EAAuC,EAAM,YAAY,GAC/D,GAAK,EACL,IAAK,IAAI,EAAI,EAAK,OAAS,EAAG,GAAK,EAAG,IAAK,CAC1C,MAAM,EAAkC,EAAK,GACvC,EAAkC,EAAa,EAAM,SAAS,QAAc,EAClF,GAAuB,cAAnB,GAAU,KAAsB,OAAO,CAC5C,CAED,CAGA,SAAgB,EAAe,EAAoB,GAClD,MAAM,EAA8B,EAAM,SAAS,GACnD,IAAK,GAAsB,cAAd,EAAK,KAAsB,OACxC,MAAM,EAAuC,EAAM,YAAY,GAC/D,IAAK,EAAM,OAEX,MAAM,EAAiC,EAAK,MAAM,GAAG,GAC/C,EAAgC,EAAW,EAAW,OAAS,GAI/D,GAHiC,EACpC,EAAiB,EAAM,SAAS,IAChC,EAAM,IAAI,UACkB,UAAW,GAAY,EAAQ,KAAO,GACrE,OAAI,EAAQ,OAAZ,EACO,CAAE,OAAM,aAAY,QAC5B,CAQA,SAAgB,EAAiB,EAA6B,GAC7D,EAAQ,WAAW,EAAS,WAAY,EAAS,OAEjD,EADwD,EAAS,MACxD,QAAA,CAAS,EAAO,KACxB,EAAQ,WAAW,EAAS,WA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uB,KAAK,OAAO,sBACnC,SAAU,EAAQ,GAClB,OAAQ,KAAK,UAKf,EADuC,eAC7B,iBAAiB,YAAa,KAAK,sBAC9C,CAEA,eAAA,GACC,OAAO,EAAsB,OAAQ,GAAQ,KAAK,OAAO,MAAM,SAAS,EAAI,MAC7E"}
@@ -1,2 +0,0 @@
1
- import{n as t,s as e}from"./HTMLUtils-Bhg3_P8B.mjs";import{l as n,n as r,o as i,r as s}from"./TableDimensions-BBhjHNjQ.mjs";import{t as o}from"./SchemaRegistry-CkBN-1yW.mjs";var a=/^\s*\|?\s*:?-+:?\s*(\|\s*:?-+:?\s*)*\|?\s*$/;function c(t){let e=t.trim();e.startsWith("|")&&(e=e.slice(1)),e.endsWith("|")&&!e.endsWith("\\|")&&(e=e.slice(0,-1));const n=[];let r="";for(let i=0;i<e.length;i++){const t=e[i]??"";"\\"!==t||"|"!==e[i+1]?"|"!==t?r+=t:(n.push(r.trim()),r=""):(r+="|",i++)}return n.push(r.trim()),n}function l(t){const e=t.trim(),n=e.startsWith(":"),r=e.endsWith(":");return n&&r?"center":r?"end":n?"start":null}function u(t,e,n){const r=t[e]??"",i=t[e+1]??"";if(!r.includes("|"))return null;if(!a.test(i))return null;const s=c(r),o=c(i).map(l);if(o.length!==s.length)return null;const u=[];let g=e+2;for(;g<t.length;){const e=t[g]??"";if(""===e.trim())break;if(!e.includes("|")&&(!n||n(e)))break;u.push(c(e)),g++}return{aligns:o,header:s,rows:u,linesConsumed:g-e}}var g=/[!-/:-@[-`{-~]/,h=/&(#[xX][0-9a-fA-F]{1,6}|#[0-9]{1,7}|[a-zA-Z][a-zA-Z0-9]{1,31});/y,f={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:" ",copy:"©",reg:"®",hellip:"…",mdash:"—",ndash:"–"};function p(t){if("#"===t[0]){const e="x"===t[1]||"X"===t[1],n=Number.parseInt(t.slice(e?2:1),e?16:10);if(!Number.isFinite(n)||n<0||n>1114111)return`&${t};`;if(0===n)return"�";try{const t=String.fromCodePoint(n);return"\n"===t||"\r"===t?" ":t}catch{return"�"}}return f[t]??function(t){if("undefined"==typeof document)return null;const e=m.get(t);if(void 0!==e)return e;const n=document.createElement("div");n.innerHTML=`&${t};`;const r=n.textContent??"",i=""!==r&&r!==`&${t};`?r:null;return m.set(t,i),i}(t)??`&${t};`}function d(t,e){return h.lastIndex=e,h.exec(t)}var m=/* @__PURE__ */new Map;function b(t){let e="",n=0;for(;n<t.length;){const r=t[n]??"";if("\\"===r&&g.test(t[n+1]??""))e+=t[n+1],n+=2;else{if("&"===r){const r=d(t,n);if(r?.[1]){e+=p(r[1]),n+=r[0].length;continue}}e+=r,n++}}return e}function $(t){let e="",n=0;for(;n<t.length;){const r=t[n]??"";if("&"===r){const r=d(t,n);if(r?.[1]){e+=p(r[1]),n+=r[0].length;continue}}e+=r,n++}return e}var y,k=new Set(["address","article","aside","blockquote","details","div","dl","dd","dt","figure","figcaption","footer","form","h1","h2","h3","h4","h5","h6","header","hr","iframe","main","nav","ol","p","pre","section","table","tbody","td","tfoot","th","thead","tr","ul","video"]),M=/^ {0,3}(#{1,6})(?:[ \t]+(.*?))?(?:[ \t]+#+)?[ \t]*$/,T=/^ {0,3}(`{3,}|~{3,})[ \t]*(.*)$/,S=/^ {0,3}([-*_])[ \t]*(?:\1[ \t]*){2,}$/,x=/^ {0,3}>[ ]?/,L=/^([ \t]*)([-*+])(?:([ \t]+)(.*))?$/,H=/^([ \t]*)(\d{1,9})([.)])(?:([ \t]+)(.*))?$/,w=/^\[([ xX])\][ \t]+(.*)$/,N=/^ {0,3}=+[ \t]*$/,z=/^ {0,3}-+[ \t]*$/,A=/^ {0,3}<(\/?)([a-zA-Z][a-zA-Z0-9-]*)|^ {0,3}<!--/;function v(t){return""===t.trim()}function D(t){const e=t.match(T);return e?"`"===(e[1]??"")[0]&&(e[2]??"").includes("`")?null:e:null}function O(t,e=!0,n=[]){return _(t.replace(/\r\n?/g,"\n").replace(/\n$/,"").split("\n"),e,n)}function _(t,e,n,r=0){const i=[];let s=0;for(;s<t.length;){const o=t[s]??"";if(v(o)){s++;continue}const a=P(n,t,s,i);if(a>0){s+=a;continue}if(e){const e=u(t,s,J);if(e){i.push({type:"table",aligns:e.aligns,header:e.header,rows:e.rows}),s+=e.linesConsumed;continue}}const c=D(o);if(c){s=C(t,s,c,i);continue}const l=o.match(M);if(l){const t=(l[2]??"").trim(),e=/^#+$/.test(t)?"":t;i.push({type:"heading",level:(l[1]??"#").length,text:e}),s++;continue}if(S.test(o)){i.push({type:"hr"}),s++;continue}if(x.test(o)){if(r>=32){s=K(t,s,i);continue}s=R(t,s,i,e,n,r);continue}const g=r<32?X(o):null;s=g?V(t,s,g,i,e,n,r):j(o)?I(t,s,i):U(o)?G(t,s,i):K(t,s,i)}return i}function C(t,e,n,r){const i=n[1]??"```",s=i[0]??"`",o=b((n[2]??"").trim().split(/\s+/)[0]??""),a=new RegExp(`^ {0,3}\\${s}{${i.length},}[ \\t]*$`),c=t[e]??"",l=c.length-c.trimStart().length,u=[];let g=e+1;for(;g<t.length;){const e=t[g]??"";if(a.test(e)){g++;break}u.push(q(e,l)),g++}return r.push({type:"code_block",language:o,code:u.join("\n")}),g}function q(t,e){let n=0;for(;n<e&&" "===t[n];)n++;return t.slice(n)}function j(t){return W(t)>=4}function W(t){let e=0;for(const n of t)if(" "===n)e++;else{if("\t"!==n)break;e+=4-e%4}return e}function E(t,e){let n=0,r=0;for(;r<t.length;){const e=t[r]??"";if(" "===e)n++;else{if("\t"!==e)break;n+=4-n%4}r++}return" ".repeat(Math.max(0,n-e))+t.slice(r)}function F(t,e){let n=0,r=0;for(;r<t.length&&n<e;){const i=t[r]??"";if(" "===i)n++,r++;else{if("\t"!==i)break;{const i=n+4-n%4;if(i>e)return" ".repeat(i-e)+t.slice(r+1);n=i,r++}}}return t.slice(r)}function I(t,e,n){const r=[],i=[];let s=e;for(;s<t.length;){const e=t[s]??"";if(v(e))i.push(F(e,4)),s++;else{if(W(e)<4)break;for(;i.length>0;)r.push(i.shift()??"");r.push(F(e,4)),s++}}return n.push({type:"code_block",language:"",code:r.join("\n")}),s-i.length}function P(t,e,n,r){for(const i of t){const t=i.matchBlock?.(e,n);if(t&&t.linesConsumed>0)return r.push({type:"extension_block",nodeType:t.type,attrs:t.attrs}),t.linesConsumed}return 0}function R(t,e,n,r,i,s){const o=[];let a=e,c=!1;for(;a<t.length;){const e=t[a]??"";if(x.test(e)){const t=e.replace(x,"");o.push(t),c=Z(t),a++;continue}if(!c||v(e)||J(e)||r&&u(t,a,J))break;o.push(e),a++}return n.push({type:"blockquote",children:_(o,r,i,s+1)}),a}function Z(t){let e=t;for(;;){if(x.test(e)){e=e.replace(x,"");continue}const t=X(e);if(!t||""===t.firstText)break;e=t.firstText}return""!==e.trim()&&!J(e)&&W(e)<4}function X(t){const e=t.match(L),n=e?null:t.match(H),r=e??n;if(!r)return null;const i=W(r[1]??"");if(i>3)return null;const s=i+((e?r[2]:`${r[2]}${r[3]}`)??"-").length,o=function(t,e){let n=t;for(const r of e)if(" "===r)n++;else{if("\t"!==r)break;n+=4-n%4}return n-t}(s,(e?r[3]:r[4])??""),a=(e?r[4]:r[5])??"",c=n?Number.parseInt(r[2]??"1",10):1;let l,u;""===a.trim()?(l=s+1,u=""):o>=5?(l=s+1,u=" ".repeat(o-1)+a):(l=s+o,u=a);const g=u.match(w);return g?{listType:"checklist",checked:"x"===(g[1]??" ").toLowerCase(),contentColumn:l,firstText:g[2]??"",startNumber:c}:{listType:n?"ordered":"bullet",checked:!1,contentColumn:l,firstText:u,startNumber:c}}function V(t,e,n,r,i,s,o){const a=[],c=function(){let t=null;return(e,n)=>{if(t)return t.test(e)&&(t=null),!1;const r=D(e);if(r){const e=r[1]??"```",n=e[0]??"`";return t=new RegExp(`^ {0,3}\\${n}{${e.length},}[ \\t]*$`),!1}return!v(e)&&(x.test(e)||X(e)?Z(e):W(e)>=4?n:!J(e))}}();let l=n.firstText,g=""!==l&&c(l,!1),h=0,f=e+1;for(;f<t.length;){const e=t[f]??"";if(v(e)){if(""===l&&0===a.length)break;h++,g=!1,f++;continue}if(W(e)>=n.contentColumn){for(;h>0;)a.push(""),h--;const t=E(e,n.contentColumn);a.push(t),g=c(t,g),f++;continue}if(X(e))break;if(!g)break;if(J(e))break;if(i&&u(t,f,J))break;const r=e.trimStart(),s=a[a.length-1];void 0!==s?a[a.length-1]=`${s}\n${r}`:l=""===l?r:`${l}\n${r}`,g=c(r,g),f++}return function(t,e,n,r,i,s,o){const a=""===e?[...n]:[e,...n],c=0===a.length?[]:_(a,i,s,o+1),l=[],u=[];for(const h of c)"list_item"===h.type?l.push({...h,indent:h.indent+1}):u.push(h);const g=u[0];1===u.length&&"paragraph"===g?.type?r.push(B(t,g.text)):0===u.length?r.push(B(t,"")):r.push(B(t,"",u)),r.push(...l)}(n,l,a,r,i,s,o),f}function B(t,e,n){const r={type:"list_item",listType:t.listType,indent:0,checked:t.checked,text:e};return n?{...r,children:n}:r}function U(t){const e=t.match(A);if(!e)return!1;if(t.trimStart().startsWith("\x3c!--"))return!0;const n=(e[2]??"").toLowerCase();return k.has(n)}function G(t,e,n){const r=[];let i=e;for(;i<t.length;){const e=t[i]??"";if(v(e))break;r.push(e),i++}return n.push({type:"html",html:r.join("\n")}),i}function J(t){return!!(v(t)||M.test(t)||D(t)||S.test(t)||x.test(t)||function(t){const e=X(t);return!!e&&""!==e.firstText.trim()&&("ordered"!==e.listType||1===e.startNumber)}(t)||U(t))}function K(t,e,n){const r=[t[e]??""];let i=e+1;for(;i<t.length;){const e=t[i]??"";if(N.test(e))return n.push({type:"heading",level:1,text:Y(r)}),i+1;if(z.test(e))return n.push({type:"heading",level:2,text:Y(r)}),i+1;if(J(e))break;r.push(e),i++}return n.push({type:"paragraph",text:Q(r)}),i}function Q(t){return t.map((e,n)=>n===t.length-1?e.trim():e.trimStart()).join("\n")}function Y(t){return t.map(t=>t.trim()).join(" ").trim()}function tt(a){return a||(y??=function(){const a=new o;return function(e){e.registerNodeSpec({type:"paragraph",toDOM:et,toHTML:(t,e)=>`<p>${e||"<br>"}</p>`,parseHTML:[{tag:"p"},{tag:"div",priority:10}],sanitize:{tags:["p"]}}),e.registerNodeSpec({type:"heading",toDOM:et,toHTML(t,e){const n=t.attrs?.level,r="number"==typeof n&&Number.isFinite(n)?Math.max(1,Math.min(6,Math.floor(n))):1;return`<h${r}>${e||"<br>"}</h${r}>`},parseHTML:[1,2,3,4,5,6].map(t=>({tag:`h${t}`,getAttrs:()=>({level:t})})),sanitize:{tags:["h1","h2","h3","h4","h5","h6"]}}),e.registerNodeSpec({type:"list_item",toDOM:et,toHTML(t,e){if("checklist"!==t.attrs?.listType)return`<li>${e||"<br>"}</li>`;const n=!0===t.attrs.checked;return`<li role="checkbox" aria-checked="${String(n)}"><input type="checkbox" disabled${n?" checked":""}>${e||"<br>"}</li>`},parseHTML:[{tag:"li"}],sanitize:{tags:["ul","ol","li","input"],attrs:["type","disabled","checked","role","aria-checked"]}}),e.registerNodeSpec({type:"blockquote",toDOM:et,toHTML:(t,e)=>`<blockquote>${e||"<br>"}</blockquote>`,parseHTML:[{tag:"blockquote"}],sanitize:{tags:["blockquote"]}}),e.registerNodeSpec({type:"code_block",toDOM:et,toHTML(e,n){const r=String(e.attrs?.language??"");return`<pre><code${r?` class="language-${t(r)}"`:""}>${n}</code></pre>`},parseHTML:[{tag:"pre",getAttrs:t=>({language:t.querySelector("code")?.className.match(/(?:^|\s)language-(\S+)/)?.[1]??""})}],sanitize:{tags:["pre","code"],attrs:["class"]}}),e.registerNodeSpec({type:"horizontal_rule",isVoid:!0,toDOM:et,toHTML:()=>"<hr>",parseHTML:[{tag:"hr"}],sanitize:{tags:["hr"]}}),e.registerNodeSpec({type:"image",isVoid:!0,attrs:{src:{default:""},alt:{default:""},title:{default:""},align:{default:"center"}},toDOM:et,toHTML(e){const n=t(String(e.attrs?.src??"")),r=t(String(e.attrs?.alt??"")),i=String(e.attrs?.title??""),s=(t,e)=>"number"==typeof e&&Number.isFinite(e)&&e>0?` ${t}="${String(e)}"`:"";return`<figure><img src="${n}" alt="${r}"${i?` title="${t(i)}"`:""}${s("width",e.attrs?.width)}${s("height",e.attrs?.height)}></figure>`},parseHTML:[{tag:"figure",getAttrs(t){const e=t.querySelector("img");return!!e&&nt(e)}},{tag:"img",getAttrs:t=>nt(t)}],sanitize:{tags:["figure","img"],attrs:["src","alt","title","width","height"]}}),e.registerNodeSpec({type:"table",toDOM:et,toHTML(t,e,s){const o=i(t.attrs?.columnWidthsPx),a=o?`<colgroup>${o.map(t=>`<col${n(r,"width",t,s)}>`).join("")}</colgroup>`:"";return`<table${o?function(t,e){const n=t.reduce((t,e)=>t+(e??60),0),r=t.every(t=>null!==t)?`width: ${String(n)}px; min-width: ${String(n)}px; table-layout: fixed`:`width: 100%; min-width: ${String(n)}px; table-layout: fixed`;return e?.styleAttr(r)??` style="${r}"`}(o,s):""}>${a}<tbody>${e}</tbody></table>`},sanitize:{tags:["table","colgroup","col","thead","tbody","tfoot"],attrs:["span","width",r]}}),e.registerNodeSpec({type:"table_row",toDOM:et,toHTML:(t,e,r)=>`<tr${n(s,"height",t.attrs?.minHeightPx,r)}>${e}</tr>`,sanitize:{tags:["tr"],attrs:["height",s]}}),e.registerNodeSpec({type:"table_cell",toDOM:et,toHTML(t,e){const n=(t,e)=>"number"==typeof e&&Number.isInteger(e)&&e>1?` ${t}="${String(e)}"`:"";return`<td${n("colspan",t.attrs?.colspan)}${n("rowspan",t.attrs?.rowspan)}>${e}</td>`},sanitize:{tags:["td","th"],attrs:["colspan","rowspan"]}})}(a),function(n){for(const t of[{type:"bold",rank:0,tag:"strong",parseTags:["strong","b"]},{type:"italic",rank:1,tag:"em",parseTags:["em","i"]},{type:"underline",rank:2,tag:"u",parseTags:["u"]},{type:"code",rank:3,tag:"code",parseTags:["code"]},{type:"strikethrough",rank:4,tag:"s",parseTags:["s","strike","del"]}])n.registerMarkSpec({type:t.type,rank:t.rank,toDOM:et,toHTMLString:(e,n)=>`<${t.tag}>${n}</${t.tag}>`,parseHTML:t.parseTags.map(t=>({tag:t,getAttrs:"code"===t?t=>"PRE"!==t.parentElement?.tagName&&{}:void 0})),sanitize:{tags:t.parseTags}});n.registerMarkSpec({type:"link",rank:10,toDOM:et,toHTMLString(n,r){const i=t(e(String(n.attrs?.href??""))),s=String(n.attrs?.title??"");return`<a href="${i}"${s?` title="${t(s)}"`:""}>${r}</a>`},parseHTML:[{tag:"a",getAttrs(t){const n=e(t.getAttribute("href")??""),r=t.getAttribute("title");return r?{href:n,title:r}:{href:n}}}],sanitize:{tags:["a"],attrs:["href","title"]}})}(a),function(e){e.registerInlineNodeSpec({type:"hard_break",toDOM:et,toHTMLString:()=>"<br>",parseHTML:[{tag:"br"}],sanitize:{tags:["br"]}}),e.registerInlineNodeSpec({type:"image_inline",toDOM:et,toHTMLString(e){const n=t(String(e.attrs.src??"")),r=t(String(e.attrs.alt??"")),i=String(e.attrs.title??"");return`<img src="${n}" alt="${r}"${i?` title="${t(i)}"`:""}>`},parseHTML:[{tag:"img",getAttrs:t=>rt(t)}],sanitize:{tags:["img"],attrs:["src","alt","title"]}})}(a),a}(),y)}function et(){throw new Error("The Markdown HTML registry cannot render editor DOM.")}function nt(t){const e={...rt(t),align:"center"};for(const n of["width","height"]){const r=Number.parseFloat(t.getAttribute(n)??"");Number.isFinite(r)&&r>0&&(e[n]=r)}return e}function rt(t){const e={src:t.getAttribute("src")??"",alt:t.getAttribute("alt")??""},n=t.getAttribute("title");return n&&(e.title=n),e}export{z as a,O as c,b as d,d as f,N as i,$ as l,M as n,S as o,T as r,D as s,tt as t,p as u};
2
- //# sourceMappingURL=MarkdownHTMLRegistry-Q7l0d6Ma.mjs.map
@@ -1,2 +0,0 @@
1
- import{t}from"./rolldown-runtime-H_PjY6_i.mjs";import{T as e,l as s,o as n,s as i,u as r}from"./Document-827l3P80.mjs";import{a as o,i as l,r as h}from"./TypeBrands-Ch9856Gb.mjs";import{n as c}from"./ContentModel-NpAj7vGW.mjs";import{t as a}from"./DocumentParser-D2tr3ZKn.mjs";import{c as u,d as p,f,l as m,n as d,o as x,s as g,t as k,u as v}from"./MarkdownHTMLRegistry-Q7l0d6Ma.mjs";function y(t,e=""){return{type:t,literal:e,children:[],href:"",title:"",alt:"",inlineType:"",attrs:{},prev:null,next:null}}function b(t,e){e.prev=t,e.next=t.next,t.next&&(t.next.prev=e),t.next=e}function _(t){t.prev&&(t.prev.next=t.next),t.next&&(t.next.prev=t.prev),t.prev=null,t.next=null}var w=/[\s*_~(]/,S=/^[a-zA-Z0-9_-]+$/,A=/[a-zA-Z0-9.+_-]+@[a-zA-Z0-9_-]+(?:\.[a-zA-Z0-9_-]+)+/y,D=/[a-zA-Z0-9.+_-]/,T=/[a-zA-Z0-9_-]/;function W(t,e){const s=t[e]??"";return("h"===s||"w"===s||"m"===s||"x"===s||"f"===s)&&!(e>0&&!w.test(t[e-1]??""))&&(t.startsWith("http://",e)||t.startsWith("https://",e)||t.startsWith("ftp://",e)||t.startsWith("www.",e)||t.startsWith("mailto:",e)||t.startsWith("xmpp:",e))}function z(t,e){let s=e;for(;s<t.length;){const e=t[s]??"";if("<"===e||/\s/.test(e))break;s++}return function(t){let e=0,s=0;for(const i of t)"("===i?e++:")"===i&&s++;let n=t.length;for(;n>0;){const i=t[n-1]??"";if("?!.,:*_~".includes(i))n--;else{if(!(")"===i&&s>e)){if(";"===i){let e=n-2;for(;e>0&&/[a-zA-Z0-9]/.test(t[e]??"");)e--;if("&"===t[e]&&e<n-2){n=e;continue}}break}n--,s--}}return t.slice(0,n)}(t.slice(e,s))}function O(t){const e=t.search(/[/?#:]/);return-1===e?t:t.slice(0,e)}function Z(t){const e=t.split(".");return!(e.length<2||!e.every(t=>S.test(t))||e.slice(-2).some(t=>t.includes("_")))}function $(t){return!t.endsWith("-")&&!t.endsWith("_")}function E(t){!function(t){let e=0;for(const s of t){const n=e>0?t[e-1]:void 0;n&&"text"===n.type&&"text"===s.type?n.literal+=s.literal:(t[e]=s,e++)}t.length=e}(t);for(let e=0;e<t.length;e++){const s=t[e];if(s&&!C(s.type)){if("text"===s.type){const n=I(s.literal);n&&(t.splice(e,1,...n),e+=n.length-1);continue}s.children.length>0&&E(s.children)}}}function C(t){return"link"===t||"image"===t||"code"===t||"html_inline"===t||"inline_node"===t}function I(t){const e=[];let s=0,n=t.indexOf("@");for(;-1!==n;){let i=n;for(;i>s&&D.test(t[i-1]??"");)i--;let r=n+1;for(;r<t.length&&(T.test(t[r]??"")||"."===t[r]);)r++;for(;r>n+1&&"."===t[r-1];)r--;const o=t.slice(i,r);if(i<n&&B(o,r-n-1)){i>s&&e.push(y("text",t.slice(s,i)));const l=y("link");l.href=`mailto:${o}`,l.children=[y("text",o)],e.push(l),s=r,n=t.indexOf("@",r);continue}n=t.indexOf("@",n+1)}return 0===e.length?null:(s<t.length&&e.push(y("text",t.slice(s))),e)}function B(t,e){if(e<=0)return!1;const s=t.slice(t.indexOf("@")+1).split(".");return!(s.length<2)&&!s.some(t=>""===t)&&$(t)}var M=/^ {0,3}\[((?:\\.|[^\\[\]])+)\]:(.*)$/,L=/^( {0,3}(?:> ?)+)(.*)$/,N=/^[ \t]*(?:"((?:\\.|[^"\\])*)"|'((?:\\.|[^'\\])*)'|\(((?:\\.|[^()\\])*)\))[ \t]*$/,j=/^ {0,3}(`{3,}|~{3,})[ \t]*$/;function R(t){return t.trim().replace(/[ \t\n]+/g," ").toLowerCase().toUpperCase().toLowerCase()}function G(t,e,s,n,i){const r=t[e]??"",o=r.match(M);if(!o){if(""===s){const t=r.match(L);if(t?.[1]&&M.test(t[2]??"")&&G([t[2]??""],0,t[1],n,[])>0)return i.push(t[1].trimEnd()),1}return 0}const l=o[1]??"";let h=(o[2]??"").trim(),c=1;if(""===h&&""===s){const s=t[e+c]??"";if(""===s.trim())return 0;h=s.trim(),c++}if(""===h)return 0;const a=function(t){if("<"===t[0]){let e=1;for(;e<t.length;){const s=t[e]??"";if("\\"!==s){if(">"===s)return{href:p(t.slice(1,e)),end:e+1};if("<"===s)return null;e++}else e+=2}return null}let e=0,s=0;for(;s<t.length;){const n=t[s]??"";if(" "===n||"\t"===n)break;if("\\"!==n){if("("===n&&e++,")"===n){if(0===e)break;e--}s++}else s+=2}return 0===s?null:{href:p(t.slice(0,s)),end:s}}(h);if(!a)return 0;const u=h.slice(a.end).trim();let f;if(""!==u){const t=u.match(N);if(!t)return 0;f=H(t)}else if(""===s){const s=(t[e+c]??"").match(N);s&&(f=H(s),c++)}const m=R(l);return""===m||n.has(m)||n.set(m,void 0!==f?{href:a.href,title:f}:{href:a.href}),c}function H(t){return p(t[1]??t[2]??t[3]??"")}var q=8192,F=/[\p{P}\p{S}]/u,K=/[!-/:-@[-`{-~]/,P=/[!-/:-@[-`{-~]/,J=new Set(["u","sup","sub","span","mark","b","i","em","strong","code","s","del","small","abbr","kbd","a"]);function U(t){return""===t||/\s/.test(t)}function Q(t){return""!==t&&(t.charCodeAt(0)<128?K.test(t):F.test(t))}var V=class{pos=0;text;len;ctx;delimiters=null;brackets=null;tail=null;constructor(t,e){this.text=t,this.len=t.length,this.ctx=e}parse(){const t=y("text");for(this.tail=t;this.pos<this.len;){const t=this.parseToken();t&&this.appendNode(t)}return this.processEmphasis(null),function(t){const e=[];let s=t.next;for(;s;)e.push(s),s=s.next;return e}(t)}appendNode(t){this.tail&&b(this.tail,t),this.tail=t}parseToken(){const t=this.text[this.pos]??"";switch(t){case"\n":return this.parseNewline();case"\\":return this.parseBackslash();case"`":return this.parseBackticks();case"*":case"_":case"~":case"=":case"^":return this.parseDelimiterRun(t);case"[":return this.parseOpenBracket(!1);case"!":return"["===this.text[this.pos+1]?this.parseOpenBracket(!0):(this.pos++,y("text","!"));case"]":return this.parseCloseBracket();case"<":return this.parseLessThan();case"&":return this.parseEntity();default:{const t=this.parseGfmAutolink();if(t)return t;return this.parseExtension()||this.parseString()}}}parseString(){const t=this.pos;for(this.pos++;this.pos<this.len;){const t=this.text[this.pos]??"";if("\n\\`*_~=^[]!<&".includes(t))break;if(this.matchesGfmAutolinkStart())break;if(this.matchesExtensionStart())break;this.pos++}return y("text",this.text.slice(t,this.pos))}parseGfmAutolink(){if(!this.ctx.opts.gfm||this.brackets)return null;const t=(e=this.text,s=this.pos,W(e,s)?e.startsWith("http://",s)||e.startsWith("https://",s)||e.startsWith("ftp://",s)?function(t,e){const s=z(t,e),n=t.startsWith("https://",e)?8:t.startsWith("http://",e)?7:6;return Z(O(s.slice(n)))?{href:s,display:s,length:s.length}:null}(e,s):e.startsWith("www.",s)?function(t,e){const s=z(t,e);return Z(O(s))?{href:`http://${s}`,display:s,length:s.length}:null}(e,s):function(t,e){const s=t.startsWith("mailto:",e)?7:5;A.lastIndex=e+s;const n=A.exec(t)?.[0];if(!n||!$(n))return null;const i=t.slice(e,e+s+n.length);return{href:i,display:i,length:i.length}}(e,s):null);var e,s;if(!t)return null;this.pos+=t.length;const n=y("link");return n.href=t.href,n.children=[y("text",t.display)],n}matchesGfmAutolinkStart(){return!(!this.ctx.opts.gfm||this.brackets)&&W(this.text,this.pos)}parseExtension(){for(const t of this.ctx.opts.syntaxExtensions){const e=t.matchInline?.(this.text,this.pos);if(e){this.pos+=e.length;const t=y("inline_node");return t.inlineType=e.type,t.attrs=e.attrs,t}}return null}matchesExtensionStart(){for(const t of this.ctx.opts.syntaxExtensions)if(t.matchInline?.(this.text,this.pos))return!0;return!1}parseNewline(){for(this.pos++;" "===this.text[this.pos];)this.pos++;const t=this.tail;if(t&&"text"===t.type&&t.literal.endsWith(" ")){const e=t.literal.endsWith(" ");return t.literal=t.literal.replace(/[ \t]+$/,""),y(e?"hardbreak":"softbreak")}return y("softbreak")}parseBackslash(){this.pos++;const t=this.text[this.pos]??"";if("\n"===t){for(this.pos++;" "===this.text[this.pos];)this.pos++;return y("hardbreak")}return P.test(t)?(this.pos++,y("text",t)):y("text","\\")}parseBackticks(){const t=this.pos;let e=0;for(;"`"===this.text[this.pos];)e++,this.pos++;const s="`".repeat(e),n=this.pos;let i=n;for(;i<this.len;){const t=this.text.indexOf(s,i);if(-1===t)break;if("`"!==this.text[t-1]&&"`"!==this.text[t+e]){let s=this.text.slice(n,t).replace(/\n/g," ");return s.length>2&&s.startsWith(" ")&&s.endsWith(" ")&&""!==s.trim()&&(s=s.slice(1,-1)),this.pos=t+e,y("code",s)}i=t+1}return this.pos=n,y("text",this.text.slice(t,n))}parseDelimiterRun(t){const{numdelims:e,canOpen:s,canClose:n}=this.scanDelims(t),i=y("text",t.repeat(e)),r={cc:t,numdelims:e,origdelims:e,node:i,canOpen:s,canClose:n,prev:this.delimiters,next:null};return this.delimiters&&(this.delimiters.next=r),this.delimiters=r,i}scanDelims(t){const e=this.pos;for(;this.text[this.pos]===t;)this.pos++;const s=this.pos-e,n=0===e?"":this.text[e-1]??"",i=this.text[this.pos]??"",r=U(n),o=U(i),l=Q(n),h=Q(i),c=!o&&(!h||r||l),a=!r&&(!l||o||h);let u,p;return"_"===t?(u=c&&(!a||l),p=a&&(!c||h)):(u=c,p=a),{numdelims:s,canOpen:u,canClose:p}}parseOpenBracket(t){const e=t?"![":"[";this.pos+=e.length;const s=y("text",e);return this.brackets={node:s,prev:this.brackets,prevDelim:this.delimiters,index:this.pos,image:t,active:!0},s}parseCloseBracket(){this.pos++;const t=this.brackets;if(!t||!t.active)return t&&(this.brackets=t.prev),y("text","]");const e=this.parseLinkTarget(t);if(!e)return this.brackets=t.prev,y("text","]");const s=y(t.image?"image":"link");s.href=e.href,s.title=e.title,this.processEmphasis(t.prevDelim);let n=t.node.next;for(;n;){const t=n.next;_(n),s.children.push(n),n=t}if(t.image&&(s.alt=tt(s.children),s.children=[]),b(t.node,s),_(t.node),this.tail=s,!t.image){let e=t.prev;for(;e;)e.image||(e.active=!1),e=e.prev}return this.brackets=t.prev,null}parseLinkTarget(t){if("("===this.text[this.pos]){const t=this.parseInlineDestination();if(t)return t}let e=this.text.slice(t.index,this.pos-1),s=!1,n=this.pos;if("["===this.text[this.pos]){const t=this.text.indexOf("]",this.pos+1);if(-1!==t){const i=this.text.slice(this.pos+1,t);""!==i.trim()&&(e=i,s=!0),n=t+1}}if(!s&&e.includes("["))return null;const i=this.ctx.linkRefs.get(R(e));return i?(this.pos=n,{href:i.href,title:i.title??""}):null}parseInlineDestination(){let t=this.pos+1;for(;" "===this.text[t]||"\n"===this.text[t];)t++;let e="";if("<"===this.text[t]){let s=t+1;const n=Math.min(this.len,t+1+q);for(;s<n;){const t=this.text[s]??"";if("\\"===t&&P.test(this.text[s+1]??""))s+=2;else{if(">"===t||"<"===t||"\n"===t)break;s++}}if(">"!==this.text[s])return null;e=p(this.text.slice(t+1,s)),t=s+1}else{let s=0;const n=Math.min(this.len,t+q);for(;t<n;){const n=this.text[t]??"";if("\\"===n&&P.test(this.text[t+1]??""))e+=this.text[t+1],t+=2;else{if("("===n)s++;else if(")"===n){if(0===s)break;s--}else if(" "===n||"\t"===n||"\n"===n||"["===n||"]"===n)break;e+=n,t++}}if(t>=n&&")"!==this.text[t])return null;e=m(e)}for(;" "===this.text[t]||"\n"===this.text[t];)t++;let s="";const n=this.text[t]??"";if('"'===n||"'"===n||"("===n){const e=this.parseLinkTitle(t);if(!e)return null;s=e.title,t=e.next}for(;" "===this.text[t]||"\n"===this.text[t];)t++;return")"!==this.text[t]?null:(this.pos=t+1,{href:e,title:s})}parseLinkTitle(t){const e=this.text[t]??"",s="("===e?")":e;let n="",i=t+1;const r=Math.min(this.len,t+1+q);for(;i<r;){const t=this.text[i]??"";if("\\"===t&&P.test(this.text[i+1]??""))n+=this.text[i+1],i+=2;else{if(t===s)return{title:m(n),next:i+1};n+=t,i++}}return null}parseEntity(){const t=f(this.text,this.pos);return t?.[1]?(this.pos+=t[0].length,y("text",v(t[1]))):(this.pos++,y("text","&"))}parseLessThan(){const t=this.parseAutolink();if(t)return t;return this.parseInlineHtml()||(this.pos++,y("text","<"))}parseAutolink(){const t=this.text.slice(this.pos),e=t.match(/^<([a-zA-Z][a-zA-Z0-9+.-]{1,31}:[^<>\s]*)>/);if(e?.[1]){this.pos+=e[0].length;const t=y("link");return t.href=e[1],t.children=[y("text",e[1])],t}const s=t.match(/^<([a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)>/);if(s?.[1]){this.pos+=s[0].length;const t=y("link");return t.href=`mailto:${s[1]}`,t.children=[y("text",s[1])],t}return null}parseInlineHtml(){const t=this.text.slice(this.pos),e=t.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s[^<>]*)?>/);if(!e?.[1]){const e=t.match(/^<!--[\s\S]*?-->/);return e?(this.pos+=e[0].length,y("html_inline",Y(e[0]))):null}const s=e[1].toLowerCase();if(J.has(s)){const t=`</${s}>`,n=this.text.toLowerCase().indexOf(t,this.pos+e[0].length);if(-1!==n){const e=n+t.length,s=this.text.slice(this.pos,e);return this.pos=e,y("html_inline",Y(s))}}return this.pos+=e[0].length,y("html_inline",Y(e[0]))}processEmphasis(t){const e=/* @__PURE__ */new Map,s=s=>{const n=X(s);return e.has(n)?e.get(n)??null:t};let n=t?t.next:this.firstDelimiter();for(;n;){if(!n.canClose){n=n.next;continue}const i=n.cc;let r=n.prev,o=!1;const l=s(n);for(;r&&r!==t&&r!==l;){if(r.cc===i&&r.canOpen&&this.emphMatches(r,n)){o=!0;break}r=r.prev}if(!o){e.set(X(n),n.prev),n.canOpen||this.removeDelimiter(n),n=n.next;continue}const h=r,c=this.wrapCount(i,h,n);if(0!==c){if(this.wrapEmphasis(i,h,n,c),h.numdelims-=c,n.numdelims-=c,h.node.literal=h.node.literal.slice(c),n.node.literal=n.node.literal.slice(c),this.removeDelimitersBetween(h,n),0===h.numdelims&&this.removeDelimiter(h),0===n.numdelims){const t=n.next;this.removeDelimiter(n),n=t}}else n=n.next}for(;this.delimiters&&this.delimiters!==t;)this.removeDelimiter(this.delimiters)}firstDelimiter(){let t=this.delimiters;for(;t?.prev;)t=t.prev;return t}emphMatches(t,e){return"*"!==t.cc&&"_"!==t.cc||!((e.canOpen||t.canClose)&&e.origdelims%3!=0&&(t.origdelims+e.origdelims)%3==0)}wrapCount(t,e,s){const n=e.numdelims>=2&&s.numdelims>=2;return"*"===t||"_"===t?n?2:1:"~"===t?this.ctx.opts.gfm&&n?2:this.ctx.opts.extendedInlineSyntax?1:0:"="===t?this.ctx.opts.extendedInlineSyntax&&n?2:0:"^"===t&&this.ctx.opts.extendedInlineSyntax?1:0}wrapKind(t,e){return"*"===t||"_"===t?2===e?"strong":"emph":"~"===t?2===e?"strike":"sub":"="===t?"highlight":"sup"}wrapEmphasis(t,e,s,n){const i=y(this.wrapKind(t,n));let r=e.node.next;for(;r&&r!==s.node;){const t=r.next;_(r),i.children.push(r),r=t}b(e.node,i)}removeDelimitersBetween(t,e){let s=e.prev;for(;s&&s!==t;){const t=s.prev;this.removeDelimiter(s),s=t}}removeDelimiter(t){t.prev&&(t.prev.next=t.next),t.next&&(t.next.prev=t.prev),t.next||(this.delimiters=t.prev)}};function X(t){return`${t.cc}${t.canOpen?1:0}${t.origdelims%3}`}function Y(t){return t.replace(/\n[ \t]*/g," ")}function tt(t){let e="";for(const s of t)"text"===s.type||"code"===s.type?e+=s.literal:"softbreak"===s.type||"hardbreak"===s.type?e+=" ":s.children.length?e+=tt(s.children):s.alt&&(e+=s.alt);return e}var et={emph:"italic",strong:"bold",strike:"strikethrough",highlight:"highlight",sup:"superscript",sub:"subscript"};function st(t,e,s,n){for(const i of t)nt(i,e,s,n)}function nt(t,e,n,i){switch(t.type){case"text":return void(t.literal&&i.push(r(t.literal,[...e])));case"softbreak":return void i.push(r(" ",[...e]));case"hardbreak":return void i.push(s(h("hard_break"),{}));case"code":return void i.push(r(t.literal,it(e,n,"code")));case"link":{const s={href:t.href};return t.title&&(s.title=t.title),void st(t.children,it(e,n,"link",s),n,i)}case"image":return void function(t,e,n,i){if(!n.registry||void 0!==n.registry.getInlineNodeSpec("image_inline")){const n={src:t.href,alt:t.alt};return t.title&&(n.title=t.title),void i.push(s(h("image_inline"),n,[...e]))}t.alt&&i.push(r(t.alt,[...e]))}(t,e,n,i);case"inline_node":return void i.push(s(h(t.inlineType),t.attrs,[...e]));case"html_inline":return void function(t,e,n,i){if((!n.registry||void 0!==n.registry.getInlineNodeSpec("hard_break"))&&/^<br\s*\/?>$/i.test(t.trim()))return void i.push(s(h("hard_break"),{},[...e]));const o=a(`<p>${t}</p>`,k(n.registry)).children[0];if(!o)return;let l=!1;for(const h of o.children)"text"in h&&""!==h.text?(i.push(r(h.text,rt(e,h.marks))),l=!0):"inlineType"in h&&(i.push(s(h.inlineType,h.attrs,rt(e,h.marks))),l=!0);l||n.registry||i.push(r(t,[...e]))}(t.literal,e,n,i);default:{const s=et[t.type];st(t.children,s?it(e,n,s):e,n,i)}}}function it(t,e,s,n){if(!function(t,e){return!t.registry||void 0!==t.registry.getMarkSpec(e)}(e,s))return[...t];const i=n?{type:l(s),attrs:n}:{type:l(s)};return[...t,i]}function rt(t,e){const s=[...t];for(const n of e)s.some(t=>t.type===n.type)||s.push(n);return s}function ot(t,e){if(t.length!==e.length)return!1;const s=t=>`${t.type}:${JSON.stringify(t.attrs??{})}`,n=new Set(e.map(s));return t.every(t=>n.has(s(t)))}function lt(t,e){const s=new V(t,e).parse();e.opts.gfm&&E(s);const n=[];st(s,[],e,n);const i=function(t){const e=[];for(const s of t){const t=e[e.length-1];"text"in s&&t&&"text"in t&&ot(t.marks,s.marks)?e[e.length-1]={type:"text",text:t.text+s.text,marks:t.marks}:e.push(s)}return e}(n);return i.length>0?i:[r("")]}function ht(t){const e=t?.flavor??"gfm";return{flavor:e,gfm:"gfm"===e,extendedInlineSyntax:t?.extendedInlineSyntax??!1,htmlFallback:!1!==t?.htmlFallback,syntaxExtensions:t?.syntaxExtensions??[]}}var ct=/* @__PURE__ */t({parseMarkdownToDocument:()=>at});function at(t,e,s){const{source:n,linkRefs:r}=function(t){const e=/* @__PURE__ */new Map,s=t.split("\n"),n=[];let i=null,r=!1,o=0;for(;o<s.length;){const t=s[o]??"";if(i){n.push(t);const e=t.match(j)?.[1];e&&e[0]===i.char&&e.length>=i.len&&(i=null),r=!1,o++;continue}const l=g(t);if(l?.[1]){i={char:l[1][0]??"`",len:l[1].length},n.push(t),r=!1,o++;continue}const h=r?0:G(s,o,"",e,n);h>0?o+=h:(n.push(t),r=""!==t.trim()&&!d.test(t)&&!x.test(t),o++)}return{source:n.join("\n"),linkRefs:e}}(t.replace(/\r\n?/g,"\n")),o={registry:e,opts:ht(s),linkRefs:r},l=ut(u(n,o.opts.gfm,o.opts.syntaxExtensions),o);if(0===l.length)return i();const h=i(l);return e?c(h,e):h}function ut(t,e){const s=[];for(const n of t)pt(n,s,e);return s}function pt(t,s,i){switch(t.type){case"heading":return void s.push(ft("heading",lt(t.text,i),i,{level:t.level}));case"paragraph":{const l=lt(t.text,i),h=function(t,s){if(1!==t.length)return null;const i=t[0];if(!i||!e(i)||"image_inline"!==i.inlineType)return null;if(i.marks.length>0)return null;if(s.registry&&!s.registry.getNodeSpec("image"))return null;const l={src:String(i.attrs.src??""),alt:String(i.attrs.alt??""),align:"center"};return i.attrs.title&&(l.title=String(i.attrs.title)),n(o("image"),[r("")],void 0,l)}(l,i);return void s.push(h??ft("paragraph",l,i))}case"table":return void s.push(function(t,e,s,i){if(i.registry&&!i.registry.getNodeSpec("table"))return ft("paragraph",lt([e,...s].map(t=>t.join(" | ")).join("\n"),i),i);const r=e=>{const s=e.map((e,s)=>{const r=t[s]??null,l=n(o("paragraph"),lt(e,i),void 0,r?{align:r}:void 0);return n(o("table_cell"),[l])});return n(o("table_row"),s)},l=e.length,h=[r(e),...s.map(t=>r((t=>{if(t.length===l)return t;const e=t.slice(0,l);for(;e.length<l;)e.push("");return e})(t)))];return n(o("table"),h)}(t.aligns,t.header,t.rows,i));case"extension_block":return void s.push(ft(t.nodeType,[r("")],i,t.attrs));case"code_block":return void s.push(ft("code_block",[r(t.code)],i,{language:t.language}));case"hr":return void s.push(ft("horizontal_rule",[r("")],i));case"list_item":{const e={listType:t.listType,indent:t.indent,checked:t.checked};if(t.children&&t.children.length>0){const r=ut(t.children,i);return i.registry&&!i.registry.getNodeSpec("list_item")?void s.push(...r):void s.push(n(o("list_item"),r,void 0,e))}return void s.push(ft("list_item",lt(t.text,i),i,e))}case"blockquote":{const e=ut(t.children,i);return 0===e.length&&e.push(n(o("paragraph"),[r("")])),void s.push(function(t,e,s){const i=mt(t,s);return i!==o(t)?e[0]??n(o("paragraph"),[r("")]):n(i,e)}("blockquote",e,i))}case"html":if(function(t){let e=t.trim();for(;e.startsWith("\x3c!--");){const t=e.indexOf("--\x3e");if(-1===t)return!1;e=e.slice(t+3).trim()}return""===e}(t.html))return;for(const e of a(t.html,k(i.registry)).children)s.push(e);return}}function ft(t,e,s,i){const l=mt(t,s);return n(l,e.length>0?e:[r("")],void 0,i&&l===o(t)?i:void 0)}function mt(t,e){return e.registry&&!e.registry.getNodeSpec(t)?o("paragraph"):o(t)}export{at as n,ct as t};
2
- //# sourceMappingURL=MarkdownParser-Dp62mfUq.mjs.map
@@ -1,2 +0,0 @@
1
- import{t}from"./rolldown-runtime-H_PjY6_i.mjs";import{o as n}from"./HTMLUtils-Bhg3_P8B.mjs";import{E as e,O as r,T as o,_ as s,b as i,p as l,u as c}from"./Document-827l3P80.mjs";import{r as a}from"./AttrRegistry-B3zB02z9.mjs";import{_ as u,a as f,h as p,i as h,v as m}from"./TableDimensions-BBhjHNjQ.mjs";import{a as g,i as $,o as d,r as k,t as y}from"./MarkdownHTMLRegistry-Q7l0d6Ma.mjs";function b(t){const n=t?.flavor??"gfm";return{flavor:n,gfm:"gfm"===n,htmlFallback:!1!==t?.htmlFallback,headingStyle:t?.headingStyle??"atx",bullet:t?.bullet??"-",emphasis:t?.emphasis??"*",codeFence:t?.codeFence??"```",listIndent:t?.listIndent??2}}function S(t){return{flavor:t.flavor,htmlFallback:t.htmlFallback}}var x=new Set(["\\","`","*","[","]","<",">"]);function v(t,n){const e=t[n-1],r=t[n+1];return void 0!==e&&void 0!==r&&/\w/.test(e)&&/\w/.test(r)}function M(t,n){let e="";for(let r=0;r<t.length;r++){const o=t[r]??"";x.has(o)?e+=`\\${o}`:"_"!==o||v(t,r)?e+="~"===o&&n?"\\~":"&"!==o?o:"&amp;":e+="\\_"}return e}var F=/^(\s*)([#>])/,T=/^(\s*)([-*+])(\s)/,j=/^(\s*)(\d{1,9})([.)])(\s)/;function w(t){return F.test(t)?t.replace(F,(t,n,e)=>`${n}\\${e}`):T.test(t)?t.replace(T,(t,n,e,r)=>`${n}\\${e}${r}`):j.test(t)?t.replace(j,(t,n,e,r,o)=>`${n}${e}\\${r}${o}`):function(t){return d.test(t)||$.test(t)||g.test(t)||k.test(t)}(t)?t.replace(/\S/,t=>`\\${t}`):t}function L(t){return/[\s()]/.test(t)?`<${t.replace(/([<>])/g,"\\$1")}>`:t}function _(t){return t.replace(/(["\\])/g,"\\$1")}var H={styleAttr:t=>t?` style="${t}"`:""};function I(t,n){const e=t.type;return"link"===e||"bold"===e||"italic"===e||!("strikethrough"!==e||!n)}function N(t,n){const e=n.opts.emphasis;switch(t.type){case"bold":return{open:e.repeat(2),close:e.repeat(2)};case"italic":return{open:e,close:e};case"strikethrough":return{open:"~~",close:"~~"};default:{const n=String(t.attrs?.href??""),e=String(t.attrs?.title??"");return{open:"[",close:`](${L(n)}${e?` "${_(e)}"`:""})`}}}}function O(t){return"link"!==t.type}function A(t,n){return t.type===n.type&&JSON.stringify(t.attrs??{})===JSON.stringify(n.attrs??{})}function D(t,n){const e=[],r=[];for(const o of t.marks)I(o,n)&&("link"===o.type?e.push(o):r.push(o));return[...e,...r]}function W(t,n){const e=[],r=[...t];for(let o=r.length-1;o>=0;o--){const t=r[o];t&&!O(t)&&(e.push(t),r.splice(o,1))}for(const o of n){if(!O(o))continue;const t=r.findIndex(t=>A(t,o));if(-1!==t){const n=r[t];n&&e.push(n),r.splice(t,1)}}for(const o of r)e.push(o);return e}function z(t,n){if(""===t.text)return"";if(t.marks.some(t=>"code"===t.type))return function(t){const n=function(t){let n=0,e=0;for(const r of t)"`"===r?(e++,n=Math.max(n,e)):e=0;return"`".repeat(n+1)}(t);return`${n}${t.startsWith("`")||t.endsWith("`")||t.length>0&&0===t.trim().length?` ${t} `:t}${n}`}(t.text);const e=n.opts.gfm,r=t.marks.filter(t=>!I(t,e)&&"code"!==t.type);return r.length>0&&n.opts.htmlFallback?m(t.text,r,y(n.registry),n.markOrder,H):M(t.text,e)}function J(t,n){if("hard_break"===t.inlineType)return"\\\n";if("image_inline"===t.inlineType)return function(t,n){const e=String(t.attrs.src??""),r=String(t.attrs.alt??""),o=String(t.attrs.title??""),s=o?` "${_(o)}"`:"";return`![${M(r,n.opts.gfm)}](${L(e)}${s})`}(t,n);const e=n.registry?.getInlineNodeSpec(t.inlineType),r=e?.toMarkdown?.(t,S(n.opts));return null!=r?r:n.opts.htmlFallback&&e?.toHTMLString?e.toHTMLString(t):""}function P(t){const n=[];for(const e of t){const t=n[n.length-1];!o(e)&&t&&!o(t)&&r(t.marks,e.marks)?n[n.length-1]={type:"text",text:t.text+e.text,marks:t.marks}:n.push(e)}return n}function R(t,n){return!(!t||o(t))&&t.marks.some(t=>A(t,n))}function q(t,n){return 0===n.length?[...t]:t.filter(t=>!n.some(n=>A(n,t)))}function B(t,n,e,r,o){const s=t.marks.filter(t=>function(t,n){return I(t,n)&&"link"!==t.type}(t,r));if(0===s.length)return void o.push(t);const i=t.text,l=function(t){let n=0;for(;n<t.length&&/\s/.test(t[n]);)n++;return n}(i);if(l===i.length){const r=s.filter(t=>!(R(n,t)&&R(e,t)));return void o.push(c(i,q(t.marks,r)))}const a=function(t){let n=t.length;for(;n>0&&/\s/.test(t[n-1]);)n--;return t.length-n}(i),u=i.slice(0,l),f=i.slice(l,i.length-a),p=i.slice(i.length-a);if(u){const e=s.filter(t=>!R(n,t));o.push(c(u,q(t.marks,e)))}if(o.push(c(f,t.marks)),p){const n=s.filter(t=>!R(e,t));o.push(c(p,q(t.marks,n)))}}function E(t,n){const e=n.opts.gfm,r=function(t,n){const e=[];for(let r=0;r<t.length;r++){const s=t[r];s&&(o(s)?e.push(s):B(s,t[r-1],t[r+1],n,e))}return P(e)}(P(t),e);let s="",i=[];const l=t=>{for(let e=i.length-1;e>=t;e--){const t=i[e];t&&(s+=N(t,n).close)}i=i.slice(0,t)};for(const c of r){const t=W(D(c,e),i);let r=0;for(;r<i.length&&r<t.length&&A(i[r],t[r]);)r++;l(r);for(let e=r;e<t.length;e++){const r=t[e];r&&(s+=N(r,n).open,i.push(r))}s+=o(c)?J(c,n):z(c,n)}return l(0),s}function U(t,n){const e=[];let r=0;for(;r<t.length;){const o=t[r];if(o)if(a(o,"list_item")){const o=[];for(;r<t.length;){const n=t[r];if(!n||!a(n,"list_item"))break;o.push(n),r++}e.push(n.opts.htmlFallback&&o.some(G)?K(o,n):V(o,n))}else e.push(C(o,n)),r++;else r++}return e.filter(t=>t.length>0).join("\n\n")}function C(t,n){if(n.opts.htmlFallback&&G(t))return K([t],n);const r=t.type;return"paragraph"===r?function(t,n){const e=E(i(t),n);return""===e.trim()?"":e.split("\n").map(w).join("\n")}(t,n):"heading"===r?function(t,n){const e=function(t){return t<1?1:t>6?6:Math.floor(t)}(t.attrs?.level??1),r=E(i(t),n).replace(/\n/g," ");if("setext"===n.opts.headingStyle&&e<=2&&""!==r)return`${r}\n${(1===e?"=":"-").repeat(Math.max(3,r.length))}`;const o="#".repeat(e);return r?`${o} ${r}`:o}(t,n):"code_block"===r?function(t,n){const e=String(t.attrs?.language??""),r=s(t),o=n.opts.codeFence[0]??"`",i=o.repeat(Math.max(3,function(t,n){let e=0,r=0;for(const o of t)o===n?(r++,e=Math.max(e,r)):r=0;return e}(r,o)+1));return`${i}${e}\n${r}\n${i}`}(t,n):"horizontal_rule"===r?n.inListItem?"***":"---":"image"===r?function(t,n){const e=String(t.attrs?.src??""),r=String(t.attrs?.alt??""),o=String(t.attrs?.title??""),s=t.attrs?.width,i=t.attrs?.height,l=t.attrs?.align;if((void 0!==s||void 0!==i||void 0!==l&&"center"!==l)&&n.opts.htmlFallback){const e=n.registry?.getNodeSpec("image")?.toHTML?.(t,"");if(e)return e}const c=o?` "${_(o)}"`:"";return`![${M(r,n.opts.gfm)}](${L(e)}${c})`}(t,n):"blockquote"===r?function(t,n){return U(l(t),n).split("\n").map(t=>""===t?">":`> ${t}`).join("\n")}(t,n):"table"===r?function(t,n){const e=l(t);if(0===e.length)return"";if(!n.opts.gfm&&n.opts.htmlFallback)return K([t],n);if(n.opts.htmlFallback&&(function(t){for(const n of t)for(const t of l(n)){const n=t.attrs?.colspan,e=t.attrs?.rowspan;if((n??1)>1||(e??1)>1)return!0}return!1}(e)||function(t,n){return!!h(t.attrs?.columnWidthsPx)||n.some(t=>void 0!==f(t.attrs?.minHeightPx))}(t,e)))return K([t],n);const r=e.map(t=>l(t).map(t=>function(t,n){return l(t).map(t=>E(i(t),n)).join(" ").replace(/\n/g," ").replace(/\|/g,"\\|").trim()}(t,n))),o=r.reduce((t,n)=>Math.max(t,n.length),0);if(0===o)return"";const s=t=>{const n=[...t];for(;n.length<o;)n.push("");return`| ${n.join(" | ")} |`},c=e[0],a=Array.from({length:o},(t,n)=>{return e=function(t,n){if(!t)return;const e=l(t)[n];return e?l(e)[0]?.attrs?.align:void 0}(c,n),"start"===e?":---":"center"===e?":---:":"end"===e?"---:":"---";var e}),u=[];u.push(s(r[0]??[])),u.push(`| ${a.join(" | ")} |`);for(let i=1;i<r.length;i++)u.push(s(r[i]??[]));return u.join("\n")}(t,n):"title"===r?Q(t,n,1):"subtitle"===r?Q(t,n,2):function(t,n){const r=n.registry?.getNodeSpec(t.type),o=e(t)?E(i(t),n):U(l(t),n),s=r?.toMarkdown?.(t,o,S(n.opts));return null!=s?s:n.opts.htmlFallback&&r?.toHTML?r.toHTML(t,o):o}(t,n)}function G(t){return!!n(t.htmlId)||l(t).some(G)}function K(t,n){return p({children:t},y(n.registry),{includeBlockIds:!1})}function Q(t,n,e){if(n.opts.htmlFallback){const e=E(i(t),n),r=n.registry?.getNodeSpec(t.type)?.toHTML?.(t,e);if(r)return r}const r=E(i(t),n).replace(/\n/g," "),o="#".repeat(e);return r?`${o} ${r}`:o}function V(t,n){const r=[],o=[],s=[];let c=-1;for(const a of t){const t=String(a.attrs?.listType??"bullet"),u=Math.max(0,a.attrs?.indent??0),f=Math.min(u,c+1);c=f;const p=0===f?0:s[f-1]??0,h=" ".repeat(p);let m;if(o.length=f+1,s.length=f+1,"ordered"===t)o[f]=(o[f]??0)+1,m=`${o[f]}.`;else if("checklist"===t){const t=!0===a.attrs?.checked;m=`${n.opts.bullet} [${t?"x":" "}]`}else m=n.opts.bullet;const g="checklist"===t?n.opts.bullet.length+1:m.length+1;if(s[f]=p+g,e(a)){const t=w(E(i(a),n).replace(/\n/g," "));r.push(t?`${h}${m} ${t}`:`${h}${m}`);continue}const $=U(l(a),{...n,inListItem:!0});if(""===$){r.push(`${h}${m}`);continue}const d=" ".repeat(s[f]??p+g),k=$.split("\n");r.push(`${h}${m} ${k[0]??""}`);for(let n=1;n<k.length;n++){const t=k[n]??"";r.push(""===t?"":`${d}${t}`)}}return r.join("\n")}var X=/* @__PURE__ */t({serializeDocumentToMarkdown:()=>Y});function Y(t,n,e){const r={registry:n,opts:b(e),markOrder:n?u(n):void 0};return function(t){const n=t.trim();return n.length>0?`${n}\n`:""}(U(t.children,r))}export{Y as n,X as t};
2
- //# sourceMappingURL=MarkdownSerializer-DBELFAeo.mjs.map
@@ -1,2 +0,0 @@
1
- import{c as t,f as n,h as e,w as i}from"./Document-827l3P80.mjs";import{r as o}from"./NodeResolver-Dleih-8R.mjs";import{c as r,l as s,n as c,o as l,r as u,t as a}from"./Selection-HYoVFpAx.mjs";import{i as d}from"./NavigationQueries-Bt4zZ17v.mjs";import{T as f,_ as b,l as p}from"./BlockInsertion-CYH2gRkY.mjs";function m(e,o){const{parentPath:r,siblings:s,index:c}=f(e,o.nodeId);if(c<0)return null;const l=e.transaction("input");if(1===s.length){const e=n();return l.insertNode(r,0,t(e)),l.removeNode(r,1),l.setSelection(a(e,0)),l.build()}l.removeNode(r,c);const u=s[c-1];if(u&&i(u)){const t=b(e,u.id,"end");if(t)return l.setSelection(t),l.build()}const d=s[c+1];if(d&&i(d)){const t=b(e,d.id,"start");if(t)return l.setSelection(t),l.build()}return null}function h(t,n){if(n<0)return;const e=t[n+1];return e&&i(e)&&p(e)?e:void 0}function g(e,i){const{parentPath:o,siblings:r,index:s}=f(e,i.nodeId);if(s<0)return null;const c=h(r,s);if(c)return e.transaction("input").setSelection(a(c.id,0)).build();const l=n(),u=e.transaction("input");return u.insertNode(o,s+1,t(l)),u.setSelection(a(l,0)),u.build()}function S(e,i,o,r){const{parentPath:s,siblings:c,index:l}=f(e,i.nodeId),u=e.transaction(r),d=h(c,l);if(d)return u.insertText(d.id,0,o,[]),u.setSelection(a(d.id,o.length)),u.build();const b=n(),p=l>=0?l+1:c.length;return u.insertNode(s,p,t(b)),u.insertText(b,0,o,[]),u.setSelection(a(b,o.length)),u.build()}function I(t,n,i){const f=t.selection,b=t.getBlockOrder(),p=!i||"left"!==n&&"right"!==n?n:"left"===n?"right":"left";return s(f)?function(t,n,i,r){const s=r.indexOf(n.nodeId),l=o(t.doc,n.nodeId)??[];if("left"===i||"up"===i){if(s>0){const i=r[s-1];if(!i)return null;if(d(t,i))return t.transaction("input").setSelection(c(n.nodeId,"before",l)).build();const o=t.getBlock(i),u=o?e(o):0;return t.transaction("input").setSelection(a(i,u)).build()}return t.transaction("input").setSelection(c(n.nodeId,"before",l)).build()}if(s<r.length-1){const e=r[s+1];return e?d(t,e)?t.transaction("input").setSelection(c(n.nodeId,"after",l)).build():t.transaction("input").setSelection(a(e,0)).build():null}return t.transaction("input").setSelection(c(n.nodeId,"after",l)).build()}(t,f,p,b):r(f)?null:l(f)?function(t,n,i,r){const s=r.indexOf(n.anchor.blockId),c=t.getBlock(n.anchor.blockId);if(!c)return null;const l=e(c);if(("right"===i||"down"===i)&&n.anchor.offset===l&&s<r.length-1){const n=r[s+1];if(n&&d(t,n)){const e=o(t.doc,n)??[];return t.transaction("input").setSelection(u(n,e)).build()}}if(("left"===i||"up"===i)&&0===n.anchor.offset&&s>0){const n=r[s-1];if(n&&d(t,n)){const e=o(t.doc,n)??[];return t.transaction("input").setSelection(u(n,e)).build()}}return null}(t,f,p,b):null}export{I as i,g as n,S as r,m as t};
2
- //# sourceMappingURL=NodeSelectionCommands-WH5snxr_.mjs.map
@@ -1,2 +0,0 @@
1
- function t(t,e,o){for(const a of e){const e=t.getNodeSpec(a);if(!e)continue;if(e.attrs?.[o.attrName])continue;const r=e.toDOM;t.removeNodeSpec(a),t.registerNodeSpec({...e,attrs:{...e.attrs,[o.attrName]:{default:o.getDefault(a)}},toDOM(t){const a=r.call(e,t);return o.applyToDOM(a,t),a}})}}export{t};
2
- //# sourceMappingURL=NodeSpecPatching-B_yLknTl.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"NodeSpecPatching-B_yLknTl.mjs","names":[],"sources":["../../src/plugins/shared/NodeSpecPatching.ts"],"sourcesContent":["/**\n * Helper for plugins that augment existing block NodeSpecs with an extra\n * attribute rendered as a DOM effect (e.g. alignment's `align`, text\n * direction's `dir`). Re-registers each target spec with the added attribute\n * and a `toDOM` wrapper that applies the effect after the original render.\n */\n\nimport type { BlockNode } from '../../model/Document.js';\nimport type { SchemaRegistry } from '../../model/SchemaRegistry.js';\n\nexport interface NodeSpecAttrPatch {\n\t/** Attribute name to add (skipped for specs that already declare it). */\n\treadonly attrName: string;\n\t/** Default value for the attribute, possibly per block type. */\n\treadonly getDefault: (type: string) => string;\n\t/** Applies the attribute-derived effect to the rendered element. */\n\treadonly applyToDOM: (el: HTMLElement, node: BlockNode) => void;\n}\n\n/**\n * Adds `patch.attrName` to each of `types` whose NodeSpec does not already\n * declare it, wrapping `toDOM` so `patch.applyToDOM` runs after the original.\n */\nexport function patchNodeSpecAttr(\n\tregistry: SchemaRegistry,\n\ttypes: Iterable<string>,\n\tpatch: NodeSpecAttrPatch,\n): void {\n\tfor (const type of types) {\n\t\tconst spec = registry.getNodeSpec(type);\n\t\tif (!spec) continue;\n\t\tif (spec.attrs?.[patch.attrName]) continue;\n\n\t\tconst originalToDOM = spec.toDOM;\n\n\t\tregistry.removeNodeSpec(type);\n\t\tregistry.registerNodeSpec({\n\t\t\t...spec,\n\t\t\tattrs: {\n\t\t\t\t...spec.attrs,\n\t\t\t\t[patch.attrName]: { default: patch.getDefault(type) },\n\t\t\t},\n\t\t\ttoDOM(node) {\n\t\t\t\tconst el = originalToDOM.call(spec, node);\n\t\t\t\tpatch.applyToDOM(el, node);\n\t\t\t\treturn el;\n\t\t\t},\n\t\t});\n\t}\n}\n"],"mappings":"AAuBA,SAAgB,EACf,EACA,EACA,GAEA,IAAK,MAAM,KAAQ,EAAO,CACzB,MAAM,EAAO,EAAS,YAAY,GAClC,IAAK,EAAM,SACX,GAAI,EAAK,QAAQ,EAAM,UAAW,SAElC,MAAM,EAAgB,EAAK,MAE3B,EAAS,eAAe,GACxB,EAAS,iBAAiB,IACtB,EACH,MAAO,IACH,EAAK,OACP,EAAM,UAAW,CAAE,QAAS,EAAM,WAAW,KAE/C,KAAA,CAAM,GACL,MAAM,EAAK,EAAc,KAAK,EAAM,GAEpC,OADA,EAAM,WAAW,EAAI,GACd,CACR,GAEF,CACD"}
@@ -1,2 +0,0 @@
1
- import{n as e,r as t,t as r}from"./KeyboardNav-D0my3wuy.mjs";var n=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"]);function o(t){let n=0;const o=o=>{o.stopPropagation();const a=Array.from(t.container.querySelectorAll(t.itemSelector));if(0!==a.length)switch(o.key){case"Escape":return o.preventDefault(),void t.onClose();case"ArrowDown":return o.preventDefault(),n=e(a,n,1),r(a,n),void a[n]?.focus();case"ArrowUp":return o.preventDefault(),n=e(a,n,-1),r(a,n),void a[n]?.focus();case"Enter":case" ":{o.preventDefault();const e=a[n];return void(e&&t.onActivate(e))}case"Home":return o.preventDefault(),n=0,r(a,n),void a[n]?.focus();case"End":return o.preventDefault(),n=a.length-1,r(a,n),void a[n]?.focus()}};return t.container.addEventListener("keydown",o),()=>t.container.removeEventListener("keydown",o)}function a(t){let n=0;const o=o=>{const a=Array.from(t.container.querySelectorAll(t.itemSelector));if(0!==a.length)switch(o.key){case"Escape":return o.preventDefault(),void t.onClose();case"ArrowDown":return o.preventDefault(),n=e(a,n,1),r(a,n),void a[n]?.focus();case"ArrowUp":return o.preventDefault(),n=e(a,n,-1),r(a,n),void a[n]?.focus();case"Enter":case" ":{o.preventDefault();const e=a[n];return void(e&&t.onSelect(e))}}};return t.container.addEventListener("keydown",o),()=>t.container.removeEventListener("keydown",o)}function c(e){let o=0;const a=e.columns,c=e.totalCells,s=Math.ceil(c/a),i=i=>{const l=Array.from(e.container.querySelectorAll(e.cellSelector));if(0!==l.length){if("Escape"===i.key)return i.preventDefault(),void e.onClose();if("Enter"===i.key||" "===i.key){i.preventDefault();const t=l[o];return void(t&&e.onSelect(t))}if(n.has(i.key)){i.preventDefault();const[n,u]=t(Math.floor(o/a)+1,o%a+1,s,a,i.key);let v=(n-1)*a+(u-1);return v>=c&&(v=c-1),o=v,r(l,o),l[o]?.focus(),void e.onNavigate?.(o)}if("Home"===i.key||"End"===i.key){i.preventDefault();const t=Math.floor(o/a)*a,n=Math.min(t+a-1,c-1);o="Home"===i.key?t:n,r(l,o),l[o]?.focus(),e.onNavigate?.(o)}}};return e.container.addEventListener("keydown",i),()=>e.container.removeEventListener("keydown",i)}export{a as n,o as r,c as t};
2
- //# sourceMappingURL=PopupKeyboardPatterns-tUrT9TyV.mjs.map
@@ -1,2 +0,0 @@
1
- import{n as e}from"./TypedKeys-CA4bfw9O.mjs";import{i as t}from"./Platform-ByobkiCc.mjs";import{a as s,i as n,t as o}from"./PopupPositioning-BFh6Ed1D.mjs";var r=new e("popup"),i=class{stack=[];referenceNode;constructor(e){this.referenceNode=e}open(e){const t=document.createElement("div");t.className=e.className?`notectl-popup ${e.className}`:"notectl-popup",e.ariaRole&&t.setAttribute("role",e.ariaRole),e.ariaLabel&&t.setAttribute("aria-label",e.ariaLabel);const r=e.parent?this.findEntryByHandle(e.parent):null;let i;const c={close:e=>this.closeEntry(i,e),getElement:()=>t},l=s=>{const n=s.composedPath();if(!n.includes(t)){for(const e of this.stack)if(n.includes(e.element))return;e.anchor instanceof HTMLElement&&n.includes(e.anchor)||this.closeEntry(i)}};i={element:t,config:e,clickOutsideHandler:l,parent:r,listenerRegistrationTimer:null,documentListenerAttached:!1},this.stack.push(i);try{e.content(t,e=>this.closeEntry(i,e))}catch(a){throw this.removeEntry(i),a}return this.stack.includes(i)?(o(t,e.referenceNode??this.referenceNode),s(t),n(t,e.anchor instanceof HTMLElement?e.anchor.getBoundingClientRect():e.anchor,{position:e.position??"below-start",isRtl:this.isRtlContext()}),i.listenerRegistrationTimer=setTimeout(()=>{i.listenerRegistrationTimer=null,this.stack.includes(i)&&(document.addEventListener("mousedown",l),i.documentListenerAttached=!0)},0),this.focusFirstItem(t),c):c}close(){const e=this.stack[this.stack.length-1];e&&this.closeEntry(e)}closeAll(){for(;this.stack.length>0;){const e=this.stack[this.stack.length-1];e&&this.closeEntry(e)}}isOpen(){return this.stack.length>0}destroy(){this.closeAll()}closeEntry(e,t){const s=this.stack.indexOf(e);if(-1!==s){for(;this.stack.length>s+1;){const e=this.stack[this.stack.length-1];e&&this.removeEntry(e)}this.removeEntry(e),void 0!==t&&"restoreFocusTo"in t?t.restoreFocusTo?.focus():e.config.restoreFocusTo&&e.config.restoreFocusTo.focus(),e.config.onClose?.()}}removeEntry(e){const t=this.stack.indexOf(e);-1!==t&&(this.stack.splice(t,1),null!==e.listenerRegistrationTimer&&(clearTimeout(e.listenerRegistrationTimer),e.listenerRegistrationTimer=null),e.element.remove(),e.documentListenerAttached&&(document.removeEventListener("mousedown",e.clickOutsideHandler),e.documentListenerAttached=!1))}findEntryByHandle(e){const t=e.getElement();return this.stack.find(e=>e.element===t)??null}isRtlContext(){return this.referenceNode instanceof HTMLElement&&t(this.referenceNode)}focusFirstItem(e){requestAnimationFrame(()=>{(e.querySelector('[role="menuitem"]')??e.querySelector('[role="option"]')??e.querySelector('[role="gridcell"]')??e.querySelector("input, textarea")??e.querySelector("button"))?.focus()})}};export{r as n,i as t};
2
- //# sourceMappingURL=PopupManager-Cj86uDEB.mjs.map