@notectl/core 1.0.3 → 1.0.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 (312) hide show
  1. package/README.md +51 -148
  2. package/dist/chunks/AttrRegistry-DTsHyDVA.mjs +16 -0
  3. package/dist/chunks/AttrRegistry-DTsHyDVA.mjs.map +1 -0
  4. package/dist/chunks/Commands-DLP85Mp5.mjs +461 -0
  5. package/dist/chunks/Commands-DLP85Mp5.mjs.map +1 -0
  6. package/dist/chunks/Document-CI3iCwEP.mjs +177 -0
  7. package/dist/chunks/Document-CI3iCwEP.mjs.map +1 -0
  8. package/dist/chunks/HTMLUtils-0wvCRvJc.mjs +7 -0
  9. package/dist/chunks/HTMLUtils-0wvCRvJc.mjs.map +1 -0
  10. package/dist/chunks/NodeResolver-D68ZLXti.mjs +81 -0
  11. package/dist/chunks/NodeResolver-D68ZLXti.mjs.map +1 -0
  12. package/dist/chunks/NodeSpec-NZVvcCuH.mjs +8 -0
  13. package/dist/chunks/NodeSpec-NZVvcCuH.mjs.map +1 -0
  14. package/dist/chunks/Plugin-B9OZ6Y4c.mjs +15 -0
  15. package/dist/chunks/Plugin-B9OZ6Y4c.mjs.map +1 -0
  16. package/dist/chunks/Selection-D5ZjXoB7.mjs +44 -0
  17. package/dist/chunks/Selection-D5ZjXoB7.mjs.map +1 -0
  18. package/dist/chunks/ToolbarItem-ugDymuXi.mjs +7 -0
  19. package/dist/chunks/ToolbarItem-ugDymuXi.mjs.map +1 -0
  20. package/dist/chunks/ToolbarPlugin-D5VqeBPT.mjs +398 -0
  21. package/dist/chunks/ToolbarPlugin-D5VqeBPT.mjs.map +1 -0
  22. package/dist/chunks/TypeBrands-C09nE2qO.mjs +27 -0
  23. package/dist/chunks/TypeBrands-C09nE2qO.mjs.map +1 -0
  24. package/dist/chunks/color-picker-Csf0wx5a.mjs +5 -0
  25. package/dist/chunks/color-picker-Csf0wx5a.mjs.map +1 -0
  26. package/dist/chunks/index-CPPb-Jah.mjs +569 -0
  27. package/dist/chunks/index-CPPb-Jah.mjs.map +1 -0
  28. package/dist/commands/Commands.d.ts +71 -0
  29. package/dist/commands/Commands.d.ts.map +1 -0
  30. package/dist/commands/PasteCommand.d.ts +9 -0
  31. package/dist/commands/PasteCommand.d.ts.map +1 -0
  32. package/dist/decorations/Decoration.d.ts +76 -0
  33. package/dist/decorations/Decoration.d.ts.map +1 -0
  34. package/dist/decorations/PositionMapping.d.ts +9 -0
  35. package/dist/decorations/PositionMapping.d.ts.map +1 -0
  36. package/dist/editor/Announcer.d.ts +12 -0
  37. package/dist/editor/Announcer.d.ts.map +1 -0
  38. package/dist/editor/DocumentParser.d.ts +5 -0
  39. package/dist/editor/DocumentParser.d.ts.map +1 -0
  40. package/dist/editor/DocumentSerializer.d.ts +5 -0
  41. package/dist/editor/DocumentSerializer.d.ts.map +1 -0
  42. package/dist/editor/EditorDOM.d.ts +18 -0
  43. package/dist/editor/EditorDOM.d.ts.map +1 -0
  44. package/dist/editor/EditorThemeController.d.ts +21 -0
  45. package/dist/editor/EditorThemeController.d.ts.map +1 -0
  46. package/dist/editor/NotectlEditor.d.ts +131 -0
  47. package/dist/editor/NotectlEditor.d.ts.map +1 -0
  48. package/dist/editor/styles/base.d.ts +3 -0
  49. package/dist/editor/styles/base.d.ts.map +1 -0
  50. package/dist/editor/styles/code-block.d.ts +3 -0
  51. package/dist/editor/styles/code-block.d.ts.map +1 -0
  52. package/dist/editor/styles/color-picker.d.ts +3 -0
  53. package/dist/editor/styles/color-picker.d.ts.map +1 -0
  54. package/dist/editor/styles/font-select.d.ts +3 -0
  55. package/dist/editor/styles/font-select.d.ts.map +1 -0
  56. package/dist/editor/styles/font-size-select.d.ts +3 -0
  57. package/dist/editor/styles/font-size-select.d.ts.map +1 -0
  58. package/dist/editor/styles/heading-select.d.ts +3 -0
  59. package/dist/editor/styles/heading-select.d.ts.map +1 -0
  60. package/dist/editor/styles/image.d.ts +3 -0
  61. package/dist/editor/styles/image.d.ts.map +1 -0
  62. package/dist/editor/styles/list.d.ts +3 -0
  63. package/dist/editor/styles/list.d.ts.map +1 -0
  64. package/dist/editor/styles/reduced-motion.d.ts +3 -0
  65. package/dist/editor/styles/reduced-motion.d.ts.map +1 -0
  66. package/dist/editor/styles/table.d.ts +3 -0
  67. package/dist/editor/styles/table.d.ts.map +1 -0
  68. package/dist/editor/styles/toolbar.d.ts +3 -0
  69. package/dist/editor/styles/toolbar.d.ts.map +1 -0
  70. package/dist/editor/styles.d.ts +12 -0
  71. package/dist/editor/styles.d.ts.map +1 -0
  72. package/dist/editor/theme/ThemeEngine.d.ts +6 -0
  73. package/dist/editor/theme/ThemeEngine.d.ts.map +1 -0
  74. package/dist/editor/theme/ThemeTokens.d.ts +73 -0
  75. package/dist/editor/theme/ThemeTokens.d.ts.map +1 -0
  76. package/dist/fonts.d.ts +17 -0
  77. package/dist/fonts.d.ts.map +1 -0
  78. package/dist/fonts.mjs +7 -0
  79. package/dist/fonts.mjs.map +1 -0
  80. package/dist/index.d.ts +81 -2360
  81. package/dist/index.d.ts.map +1 -0
  82. package/dist/input/ClipboardHandler.d.ts +29 -0
  83. package/dist/input/ClipboardHandler.d.ts.map +1 -0
  84. package/dist/input/InputHandler.d.ts +32 -0
  85. package/dist/input/InputHandler.d.ts.map +1 -0
  86. package/dist/input/InputRule.d.ts +9 -0
  87. package/dist/input/InputRule.d.ts.map +1 -0
  88. package/dist/input/InternalClipboard.d.ts +23 -0
  89. package/dist/input/InternalClipboard.d.ts.map +1 -0
  90. package/dist/input/KeyboardHandler.d.ts +42 -0
  91. package/dist/input/KeyboardHandler.d.ts.map +1 -0
  92. package/dist/input/Keymap.d.ts +11 -0
  93. package/dist/input/Keymap.d.ts.map +1 -0
  94. package/dist/input/PasteHandler.d.ts +38 -0
  95. package/dist/input/PasteHandler.d.ts.map +1 -0
  96. package/dist/input/SourceNormalizer.d.ts +7 -0
  97. package/dist/input/SourceNormalizer.d.ts.map +1 -0
  98. package/dist/model/AttrRegistry.d.ts +39 -0
  99. package/dist/model/AttrRegistry.d.ts.map +1 -0
  100. package/dist/model/BuiltinSpecs.d.ts +4 -0
  101. package/dist/model/BuiltinSpecs.d.ts.map +1 -0
  102. package/dist/model/ContentModel.d.ts +12 -0
  103. package/dist/model/ContentModel.d.ts.map +1 -0
  104. package/dist/model/ContentSlice.d.ts +17 -0
  105. package/dist/model/ContentSlice.d.ts.map +1 -0
  106. package/dist/model/Document.d.ts +127 -0
  107. package/dist/model/Document.d.ts.map +1 -0
  108. package/dist/model/HTMLParser.d.ts +36 -0
  109. package/dist/model/HTMLParser.d.ts.map +1 -0
  110. package/dist/model/HTMLUtils.d.ts +6 -0
  111. package/dist/model/HTMLUtils.d.ts.map +1 -0
  112. package/dist/model/InlineNodeSpec.d.ts +20 -0
  113. package/dist/model/InlineNodeSpec.d.ts.map +1 -0
  114. package/dist/model/MarkSpec.d.ts +22 -0
  115. package/dist/model/MarkSpec.d.ts.map +1 -0
  116. package/dist/model/NodeResolver.d.ts +36 -0
  117. package/dist/model/NodeResolver.d.ts.map +1 -0
  118. package/dist/model/NodeSpec.d.ts +67 -0
  119. package/dist/model/NodeSpec.d.ts.map +1 -0
  120. package/dist/model/ParseRule.d.ts +11 -0
  121. package/dist/model/ParseRule.d.ts.map +1 -0
  122. package/dist/model/SanitizeConfig.d.ts +9 -0
  123. package/dist/model/SanitizeConfig.d.ts.map +1 -0
  124. package/dist/model/Schema.d.ts +17 -0
  125. package/dist/model/Schema.d.ts.map +1 -0
  126. package/dist/model/SchemaRegistry.d.ts +81 -0
  127. package/dist/model/SchemaRegistry.d.ts.map +1 -0
  128. package/dist/model/Selection.d.ts +52 -0
  129. package/dist/model/Selection.d.ts.map +1 -0
  130. package/dist/model/TypeBrands.d.ts +28 -0
  131. package/dist/model/TypeBrands.d.ts.map +1 -0
  132. package/dist/notectl-core.mjs +2576 -11104
  133. package/dist/notectl-core.mjs.map +1 -1
  134. package/dist/notectl-core.umd.js +6810 -0
  135. package/dist/notectl-core.umd.js.map +1 -0
  136. package/dist/plugins/EventBus.d.ts +13 -0
  137. package/dist/plugins/EventBus.d.ts.map +1 -0
  138. package/dist/plugins/Plugin.d.ts +85 -0
  139. package/dist/plugins/Plugin.d.ts.map +1 -0
  140. package/dist/plugins/PluginManager.d.ts +66 -0
  141. package/dist/plugins/PluginManager.d.ts.map +1 -0
  142. package/dist/plugins/alignment/AlignmentPlugin.d.ts +48 -0
  143. package/dist/plugins/alignment/AlignmentPlugin.d.ts.map +1 -0
  144. package/dist/plugins/alignment/index.d.ts +2 -0
  145. package/dist/plugins/alignment/index.d.ts.map +1 -0
  146. package/dist/plugins/alignment.mjs +92 -0
  147. package/dist/plugins/alignment.mjs.map +1 -0
  148. package/dist/plugins/blockquote/BlockquotePlugin.d.ts +30 -0
  149. package/dist/plugins/blockquote/BlockquotePlugin.d.ts.map +1 -0
  150. package/dist/plugins/blockquote/index.d.ts +2 -0
  151. package/dist/plugins/blockquote/index.d.ts.map +1 -0
  152. package/dist/plugins/blockquote.mjs +58 -0
  153. package/dist/plugins/blockquote.mjs.map +1 -0
  154. package/dist/plugins/code-block/CodeBlockNodeView.d.ts +5 -0
  155. package/dist/plugins/code-block/CodeBlockNodeView.d.ts.map +1 -0
  156. package/dist/plugins/code-block/CodeBlockPlugin.d.ts +135 -0
  157. package/dist/plugins/code-block/CodeBlockPlugin.d.ts.map +1 -0
  158. package/dist/plugins/code-block/index.d.ts +2 -0
  159. package/dist/plugins/code-block/index.d.ts.map +1 -0
  160. package/dist/plugins/code-block.mjs +6 -0
  161. package/dist/plugins/code-block.mjs.map +1 -0
  162. package/dist/plugins/font/FontPlugin.d.ts +85 -0
  163. package/dist/plugins/font/FontPlugin.d.ts.map +1 -0
  164. package/dist/plugins/font/StarterFonts.d.ts +10 -0
  165. package/dist/plugins/font/StarterFonts.d.ts.map +1 -0
  166. package/dist/plugins/font/index.d.ts +2 -0
  167. package/dist/plugins/font/index.d.ts.map +1 -0
  168. package/dist/plugins/font-size/FontSizePlugin.d.ts +65 -0
  169. package/dist/plugins/font-size/FontSizePlugin.d.ts.map +1 -0
  170. package/dist/plugins/font-size/index.d.ts +2 -0
  171. package/dist/plugins/font-size/index.d.ts.map +1 -0
  172. package/dist/plugins/font-size.mjs +220 -0
  173. package/dist/plugins/font-size.mjs.map +1 -0
  174. package/dist/plugins/font.mjs +186 -0
  175. package/dist/plugins/font.mjs.map +1 -0
  176. package/dist/plugins/hard-break/HardBreakPlugin.d.ts +16 -0
  177. package/dist/plugins/hard-break/HardBreakPlugin.d.ts.map +1 -0
  178. package/dist/plugins/hard-break/index.d.ts +2 -0
  179. package/dist/plugins/hard-break/index.d.ts.map +1 -0
  180. package/dist/plugins/hard-break.mjs +28 -0
  181. package/dist/plugins/hard-break.mjs.map +1 -0
  182. package/dist/plugins/heading/BlockTypePickerEntry.d.ts +20 -0
  183. package/dist/plugins/heading/BlockTypePickerEntry.d.ts.map +1 -0
  184. package/dist/plugins/heading/HeadingPlugin.d.ts +78 -0
  185. package/dist/plugins/heading/HeadingPlugin.d.ts.map +1 -0
  186. package/dist/plugins/heading/index.d.ts +3 -0
  187. package/dist/plugins/heading/index.d.ts.map +1 -0
  188. package/dist/plugins/heading.mjs +188 -0
  189. package/dist/plugins/heading.mjs.map +1 -0
  190. package/dist/plugins/highlight/HighlightPlugin.d.ts +37 -0
  191. package/dist/plugins/highlight/HighlightPlugin.d.ts.map +1 -0
  192. package/dist/plugins/highlight/index.d.ts +2 -0
  193. package/dist/plugins/highlight/index.d.ts.map +1 -0
  194. package/dist/plugins/highlight.mjs +126 -0
  195. package/dist/plugins/highlight.mjs.map +1 -0
  196. package/dist/plugins/horizontal-rule/HorizontalRulePlugin.d.ts +29 -0
  197. package/dist/plugins/horizontal-rule/HorizontalRulePlugin.d.ts.map +1 -0
  198. package/dist/plugins/horizontal-rule/index.d.ts +2 -0
  199. package/dist/plugins/horizontal-rule/index.d.ts.map +1 -0
  200. package/dist/plugins/horizontal-rule.mjs +59 -0
  201. package/dist/plugins/horizontal-rule.mjs.map +1 -0
  202. package/dist/plugins/image/ImageCommands.d.ts +26 -0
  203. package/dist/plugins/image/ImageCommands.d.ts.map +1 -0
  204. package/dist/plugins/image/ImageNodeView.d.ts +6 -0
  205. package/dist/plugins/image/ImageNodeView.d.ts.map +1 -0
  206. package/dist/plugins/image/ImagePlugin.d.ts +43 -0
  207. package/dist/plugins/image/ImagePlugin.d.ts.map +1 -0
  208. package/dist/plugins/image/ImageUpload.d.ts +48 -0
  209. package/dist/plugins/image/ImageUpload.d.ts.map +1 -0
  210. package/dist/plugins/image/index.d.ts +3 -0
  211. package/dist/plugins/image/index.d.ts.map +1 -0
  212. package/dist/plugins/image.mjs +381 -0
  213. package/dist/plugins/image.mjs.map +1 -0
  214. package/dist/plugins/link/LinkPlugin.d.ts +32 -0
  215. package/dist/plugins/link/LinkPlugin.d.ts.map +1 -0
  216. package/dist/plugins/link/index.d.ts +2 -0
  217. package/dist/plugins/link/index.d.ts.map +1 -0
  218. package/dist/plugins/link.mjs +127 -0
  219. package/dist/plugins/link.mjs.map +1 -0
  220. package/dist/plugins/list/ListPlugin.d.ts +51 -0
  221. package/dist/plugins/list/ListPlugin.d.ts.map +1 -0
  222. package/dist/plugins/list/index.d.ts +2 -0
  223. package/dist/plugins/list/index.d.ts.map +1 -0
  224. package/dist/plugins/list.mjs +193 -0
  225. package/dist/plugins/list.mjs.map +1 -0
  226. package/dist/plugins/strikethrough/StrikethroughPlugin.d.ts +23 -0
  227. package/dist/plugins/strikethrough/StrikethroughPlugin.d.ts.map +1 -0
  228. package/dist/plugins/strikethrough/index.d.ts +2 -0
  229. package/dist/plugins/strikethrough/index.d.ts.map +1 -0
  230. package/dist/plugins/strikethrough.mjs +35 -0
  231. package/dist/plugins/strikethrough.mjs.map +1 -0
  232. package/dist/plugins/super-sub/SuperSubPlugin.d.ts +44 -0
  233. package/dist/plugins/super-sub/SuperSubPlugin.d.ts.map +1 -0
  234. package/dist/plugins/super-sub/index.d.ts +2 -0
  235. package/dist/plugins/super-sub/index.d.ts.map +1 -0
  236. package/dist/plugins/super-sub.mjs +81 -0
  237. package/dist/plugins/super-sub.mjs.map +1 -0
  238. package/dist/plugins/table/TableCommands.d.ts +50 -0
  239. package/dist/plugins/table/TableCommands.d.ts.map +1 -0
  240. package/dist/plugins/table/TableControls.d.ts +10 -0
  241. package/dist/plugins/table/TableControls.d.ts.map +1 -0
  242. package/dist/plugins/table/TableControlsDOM.d.ts +18 -0
  243. package/dist/plugins/table/TableControlsDOM.d.ts.map +1 -0
  244. package/dist/plugins/table/TableControlsLayout.d.ts +34 -0
  245. package/dist/plugins/table/TableControlsLayout.d.ts.map +1 -0
  246. package/dist/plugins/table/TableHelpers.d.ts +39 -0
  247. package/dist/plugins/table/TableHelpers.d.ts.map +1 -0
  248. package/dist/plugins/table/TableNavigation.d.ts +4 -0
  249. package/dist/plugins/table/TableNavigation.d.ts.map +1 -0
  250. package/dist/plugins/table/TableNodeViews.d.ts +18 -0
  251. package/dist/plugins/table/TableNodeViews.d.ts.map +1 -0
  252. package/dist/plugins/table/TablePlugin.d.ts +39 -0
  253. package/dist/plugins/table/TablePlugin.d.ts.map +1 -0
  254. package/dist/plugins/table/TableSelection.d.ts +26 -0
  255. package/dist/plugins/table/TableSelection.d.ts.map +1 -0
  256. package/dist/plugins/table/TableTestUtils.d.ts +45 -0
  257. package/dist/plugins/table/TableTestUtils.d.ts.map +1 -0
  258. package/dist/plugins/table/index.d.ts +4 -0
  259. package/dist/plugins/table/index.d.ts.map +1 -0
  260. package/dist/plugins/table.mjs +663 -0
  261. package/dist/plugins/table.mjs.map +1 -0
  262. package/dist/plugins/text-color/TextColorPlugin.d.ts +37 -0
  263. package/dist/plugins/text-color/TextColorPlugin.d.ts.map +1 -0
  264. package/dist/plugins/text-color/index.d.ts +2 -0
  265. package/dist/plugins/text-color/index.d.ts.map +1 -0
  266. package/dist/plugins/text-color.mjs +126 -0
  267. package/dist/plugins/text-color.mjs.map +1 -0
  268. package/dist/plugins/text-formatting/TextFormattingPlugin.d.ts +34 -0
  269. package/dist/plugins/text-formatting/TextFormattingPlugin.d.ts.map +1 -0
  270. package/dist/plugins/text-formatting/index.d.ts +2 -0
  271. package/dist/plugins/text-formatting/index.d.ts.map +1 -0
  272. package/dist/plugins/text-formatting.mjs +52 -0
  273. package/dist/plugins/text-formatting.mjs.map +1 -0
  274. package/dist/plugins/toolbar/ToolbarItem.d.ts +66 -0
  275. package/dist/plugins/toolbar/ToolbarItem.d.ts.map +1 -0
  276. package/dist/plugins/toolbar/ToolbarKeyboardNav.d.ts +25 -0
  277. package/dist/plugins/toolbar/ToolbarKeyboardNav.d.ts.map +1 -0
  278. package/dist/plugins/toolbar/ToolbarPlugin.d.ts +47 -0
  279. package/dist/plugins/toolbar/ToolbarPlugin.d.ts.map +1 -0
  280. package/dist/plugins/toolbar/ToolbarPopupController.d.ts +25 -0
  281. package/dist/plugins/toolbar/ToolbarPopupController.d.ts.map +1 -0
  282. package/dist/plugins/toolbar/ToolbarRenderers.d.ts +19 -0
  283. package/dist/plugins/toolbar/ToolbarRenderers.d.ts.map +1 -0
  284. package/dist/plugins/toolbar/ToolbarTooltip.d.ts +17 -0
  285. package/dist/plugins/toolbar/ToolbarTooltip.d.ts.map +1 -0
  286. package/dist/plugins/toolbar/index.d.ts +4 -0
  287. package/dist/plugins/toolbar/index.d.ts.map +1 -0
  288. package/dist/plugins/toolbar.mjs +8 -0
  289. package/dist/plugins/toolbar.mjs.map +1 -0
  290. package/dist/state/EditorState.d.ts +40 -0
  291. package/dist/state/EditorState.d.ts.map +1 -0
  292. package/dist/state/History.d.ts +38 -0
  293. package/dist/state/History.d.ts.map +1 -0
  294. package/dist/state/StepApplication.d.ts +5 -0
  295. package/dist/state/StepApplication.d.ts.map +1 -0
  296. package/dist/state/Transaction.d.ts +185 -0
  297. package/dist/state/Transaction.d.ts.map +1 -0
  298. package/dist/test/PluginTestUtils.d.ts +127 -0
  299. package/dist/test/PluginTestUtils.d.ts.map +1 -0
  300. package/dist/test/TestUtils.d.ts +153 -0
  301. package/dist/test/TestUtils.d.ts.map +1 -0
  302. package/dist/view/EditorView.d.ts +74 -0
  303. package/dist/view/EditorView.d.ts.map +1 -0
  304. package/dist/view/NodeView.d.ts +18 -0
  305. package/dist/view/NodeView.d.ts.map +1 -0
  306. package/dist/view/Reconciler.d.ts +23 -0
  307. package/dist/view/Reconciler.d.ts.map +1 -0
  308. package/dist/view/SelectionSync.d.ts +8 -0
  309. package/dist/view/SelectionSync.d.ts.map +1 -0
  310. package/package.json +112 -11
  311. package/dist/notectl-core.js +0 -1463
  312. package/dist/notectl-core.js.map +0 -1
@@ -0,0 +1,193 @@
1
+ import { i as t } from "../chunks/AttrRegistry-DTsHyDVA.mjs";
2
+ import { p as e, b as n } from "../chunks/Document-CI3iCwEP.mjs";
3
+ import { c as i } from "../chunks/NodeSpec-NZVvcCuH.mjs";
4
+ import { i as s, a as r, c as o } from "../chunks/Selection-D5ZjXoB7.mjs";
5
+ import { n as c } from "../chunks/TypeBrands-C09nE2qO.mjs";
6
+ const l = { types: ["bullet", "ordered", "checklist"], maxIndent: 4 }, a = [{ type: "bullet", label: "Bullet List", 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", label: "Numbered List", 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", label: "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: "[ ] " }];
7
+ class d {
8
+ id = "list";
9
+ name = "List";
10
+ priority = 35;
11
+ config;
12
+ constructor(t2) {
13
+ this.config = { ...l, ...t2 };
14
+ }
15
+ init(t2) {
16
+ t2.registerStyleSheet(`
17
+ /* List Wrappers — suppress native markers, we use ::before pseudo-elements */
18
+ .notectl-list {
19
+ list-style: none;
20
+ margin: 0;
21
+ padding: 0;
22
+ }
23
+
24
+ /* Ordered List — each <ol> wrapper resets the counter */
25
+ .notectl-list--ordered {
26
+ counter-reset: notectl-ordered;
27
+ }
28
+
29
+ /* List Items */
30
+ .notectl-list-item {
31
+ margin: 0;
32
+ padding: 2px 0 2px 24px;
33
+ min-height: 1.6em;
34
+ position: relative;
35
+ }
36
+
37
+ .notectl-list-item::before {
38
+ position: absolute;
39
+ left: 0;
40
+ display: inline-block;
41
+ width: 24px;
42
+ text-align: center;
43
+ }
44
+
45
+ /* Bullet List */
46
+ .notectl-list-item--bullet::before {
47
+ content: '\\2022';
48
+ color: var(--notectl-fg);
49
+ }
50
+
51
+ /* Ordered List — counter increment per item */
52
+ .notectl-list-item--ordered {
53
+ counter-increment: notectl-ordered;
54
+ }
55
+
56
+ .notectl-list-item--ordered::before {
57
+ content: counter(notectl-ordered) '.';
58
+ color: var(--notectl-fg);
59
+ font-size: 14px;
60
+ }
61
+
62
+ /* Checklist */
63
+ .notectl-list-item--checklist::before {
64
+ content: '\\2610';
65
+ font-size: 16px;
66
+ color: var(--notectl-fg-muted);
67
+ cursor: pointer;
68
+ }
69
+
70
+ .notectl-list-item--checklist[data-checked="true"]::before {
71
+ content: '\\2611';
72
+ color: var(--notectl-success);
73
+ }
74
+
75
+ .notectl-list-item--checklist[data-checked="true"] {
76
+ color: var(--notectl-fg-muted);
77
+ text-decoration: line-through;
78
+ }
79
+ `), this.registerNodeSpec(t2), this.registerCommands(t2), this.registerKeymaps(t2), this.registerInputRules(t2), this.registerToolbarItems(t2);
80
+ }
81
+ registerNodeSpec(t2) {
82
+ t2.registerNodeSpec({ type: "list_item", group: "block", content: { allow: ["text"] }, attrs: { listType: { default: "bullet" }, indent: { default: 0 }, checked: { default: false } }, toDOM(t3) {
83
+ const e2 = t3.attrs?.listType ?? "bullet", n2 = t3.attrs?.indent ?? 0, s2 = t3.attrs?.checked ?? false, r2 = i("li", t3.id);
84
+ return r2.setAttribute("role", "listitem"), r2.setAttribute("data-list-type", e2), r2.setAttribute("data-indent", String(n2)), r2.className = `notectl-list-item notectl-list-item--${e2}`, n2 > 0 && (r2.style.marginLeft = 24 * n2 + "px"), "checklist" === e2 && (r2.setAttribute("data-checked", String(s2)), r2.setAttribute("aria-checked", String(s2))), r2.setAttribute("aria-level", String(n2 + 1)), r2;
85
+ }, wrapper(t3) {
86
+ const e2 = t3.attrs?.listType ?? "bullet";
87
+ return { tag: "ordered" === e2 ? "ol" : "ul", key: `list-${e2}`, className: `notectl-list notectl-list--${e2}`, attrs: { role: "list" } };
88
+ }, toHTML: (t3, e2) => `<li>${e2 || "<br>"}</li>`, parseHTML: [{ tag: "li" }], sanitize: { tags: ["ul", "ol", "li"] } });
89
+ }
90
+ registerCommands(t2) {
91
+ const e2 = this.getEnabledTypes();
92
+ for (const n2 of e2) t2.registerCommand(`toggleList:${n2.type}`, () => this.toggleList(t2, n2.type));
93
+ t2.registerCommand("indentListItem", () => this.indent(t2)), t2.registerCommand("outdentListItem", () => this.outdent(t2)), this.config.types.includes("checklist") && t2.registerCommand("toggleChecklistItem", () => this.toggleChecked(t2));
94
+ }
95
+ registerKeymaps(t2) {
96
+ t2.registerKeymap({ Enter: () => this.handleEnter(t2), Backspace: () => this.handleBackspace(t2), Tab: () => this.indent(t2), "Shift-Tab": () => this.outdent(t2) });
97
+ }
98
+ registerInputRules(t2) {
99
+ const e2 = this.getEnabledTypes();
100
+ for (const n2 of e2) t2.registerInputRule({ pattern: n2.inputPattern, handler: (t3, e3, i2, l2) => {
101
+ const a2 = t3.selection;
102
+ if (s(a2)) return null;
103
+ if (!r(a2)) return null;
104
+ const d2 = t3.getBlock(a2.anchor.blockId);
105
+ if (!d2 || "paragraph" !== d2.type) return null;
106
+ const p = e3[0] ?? "", h = p.length, u = { listType: n2.type, indent: 0 };
107
+ return "checklist" === n2.type && (u.checked = p.includes("[x]")), t3.transaction("input").deleteTextAt(a2.anchor.blockId, i2, i2 + h).setBlockType(a2.anchor.blockId, c("list_item"), u).setSelection(o(a2.anchor.blockId, 0)).build();
108
+ } });
109
+ }
110
+ registerToolbarItems(t2) {
111
+ const e2 = this.getEnabledTypes(), n2 = e2.at(-1);
112
+ for (const i2 of e2) t2.registerToolbarItem({ id: `list-${i2.type}`, group: "block", icon: i2.icon, label: i2.label, command: `toggleList:${i2.type}`, priority: "bullet" === i2.type ? 70 : "ordered" === i2.type ? 71 : 72, separatorAfter: this.config.separatorAfter && i2 === n2, isActive: (t3) => this.isListActive(t3, i2.type) });
113
+ }
114
+ toggleList(e2, n2) {
115
+ const i2 = e2.getState(), r2 = i2.selection;
116
+ if (s(r2)) return false;
117
+ const o2 = i2.getBlock(r2.anchor.blockId);
118
+ if (!o2) return false;
119
+ if ("list_item" === o2.type && o2.attrs?.listType === n2) {
120
+ const t2 = i2.transaction("command").setBlockType(r2.anchor.blockId, c("paragraph")).setSelection(r2).build();
121
+ return e2.dispatch(t2), true;
122
+ }
123
+ const l2 = { listType: n2, indent: t(o2, "list_item") ? o2.attrs.indent : 0 };
124
+ "checklist" === n2 && (l2.checked = false);
125
+ const a2 = i2.transaction("command").setBlockType(r2.anchor.blockId, c("list_item"), l2).setSelection(r2).build();
126
+ return e2.dispatch(a2), true;
127
+ }
128
+ indent(e2) {
129
+ const n2 = e2.getState();
130
+ if (s(n2.selection)) return false;
131
+ const i2 = n2.getBlock(n2.selection.anchor.blockId);
132
+ return !(!i2 || !t(i2, "list_item")) && !(i2.attrs.indent >= this.config.maxIndent) && this.setIndent(e2, n2, i2.attrs.indent + 1);
133
+ }
134
+ outdent(e2) {
135
+ const n2 = e2.getState();
136
+ if (s(n2.selection)) return false;
137
+ const i2 = n2.getBlock(n2.selection.anchor.blockId);
138
+ return !(!i2 || !t(i2, "list_item")) && !(i2.attrs.indent <= 0) && this.setIndent(e2, n2, i2.attrs.indent - 1);
139
+ }
140
+ setIndent(t2, e2, n2) {
141
+ const i2 = e2.selection;
142
+ if (s(i2)) return false;
143
+ const r2 = e2.getBlock(i2.anchor.blockId);
144
+ if (!r2) return false;
145
+ const o2 = { ...r2.attrs, indent: n2 }, l2 = e2.transaction("command").setBlockType(i2.anchor.blockId, c("list_item"), o2).setSelection(i2).build();
146
+ return t2.dispatch(l2), true;
147
+ }
148
+ toggleChecked(t2) {
149
+ const e2 = t2.getState();
150
+ if (s(e2.selection)) return false;
151
+ const n2 = e2.getBlock(e2.selection.anchor.blockId);
152
+ if (!n2 || "list_item" !== n2.type || "checklist" !== n2.attrs?.listType) return false;
153
+ const i2 = !n2.attrs?.checked, r2 = { ...n2.attrs, checked: i2 }, o2 = e2.transaction("command").setBlockType(e2.selection.anchor.blockId, c("list_item"), r2).setSelection(e2.selection).build();
154
+ return t2.dispatch(o2), true;
155
+ }
156
+ handleBackspace(t2) {
157
+ const e2 = t2.getState(), n2 = e2.selection;
158
+ if (s(n2)) return false;
159
+ if (!r(n2)) return false;
160
+ const i2 = e2.getBlock(n2.anchor.blockId);
161
+ if (!i2 || "list_item" !== i2.type) return false;
162
+ if (0 !== n2.anchor.offset) return false;
163
+ const o2 = e2.transaction("input").setBlockType(n2.anchor.blockId, c("paragraph")).setSelection(n2).build();
164
+ return t2.dispatch(o2), true;
165
+ }
166
+ handleEnter(i2) {
167
+ const l2 = i2.getState(), a2 = l2.selection;
168
+ if (s(a2)) return false;
169
+ if (!r(a2)) return false;
170
+ const d2 = l2.getBlock(a2.anchor.blockId);
171
+ if (!d2 || "list_item" !== d2.type) return false;
172
+ if ("" === e(d2)) {
173
+ const t2 = l2.transaction("input").setBlockType(a2.anchor.blockId, c("paragraph")).setSelection(a2).build();
174
+ return i2.dispatch(t2), true;
175
+ }
176
+ const p = n(), h = { listType: t(d2, "list_item") ? d2.attrs.listType : "bullet", indent: t(d2, "list_item") ? d2.attrs.indent : 0 };
177
+ "checklist" === h.listType && (h.checked = false);
178
+ const u = l2.transaction("input").splitBlock(a2.anchor.blockId, a2.anchor.offset, p).setBlockType(p, c("list_item"), h).setSelection(o(p, 0)).build();
179
+ return i2.dispatch(u), true;
180
+ }
181
+ isListActive(t2, e2) {
182
+ if (s(t2.selection)) return false;
183
+ const n2 = t2.getBlock(t2.selection.anchor.blockId);
184
+ return "list_item" === n2?.type && n2.attrs?.listType === e2;
185
+ }
186
+ getEnabledTypes() {
187
+ return a.filter((t2) => this.config.types.includes(t2.type));
188
+ }
189
+ }
190
+ export {
191
+ d as ListPlugin
192
+ };
193
+ //# sourceMappingURL=list.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.mjs","sources":["../../src/editor/styles/list.ts","../../src/plugins/list/ListPlugin.ts"],"sourcesContent":["/** 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 2px 24px;\n\tmin-height: 1.6em;\n\tposition: relative;\n}\n\n.notectl-list-item::before {\n\tposition: absolute;\n\tleft: 0;\n\tdisplay: inline-block;\n\twidth: 24px;\n\ttext-align: center;\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 */\n.notectl-list-item--checklist::before {\n\tcontent: '\\\\2610';\n\tfont-size: 16px;\n\tcolor: var(--notectl-fg-muted);\n\tcursor: pointer;\n}\n\n.notectl-list-item--checklist[data-checked=\"true\"]::before {\n\tcontent: '\\\\2611';\n\tcolor: var(--notectl-success);\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 * 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 * List items are modeled as flat blocks with a `listType` and `indent` attribute,\n * allowing simple nesting representation without deep tree structures.\n */\n\nimport { LIST_CSS } from '../../editor/styles/list.js';\nimport { isNodeOfType } from '../../model/AttrRegistry.js';\nimport { generateBlockId, getBlockText } from '../../model/Document.js';\nimport { createBlockElement } from '../../model/NodeSpec.js';\nimport { createCollapsedSelection, isCollapsed, isNodeSelection } from '../../model/Selection.js';\nimport { nodeType } from '../../model/TypeBrands.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { Plugin, PluginContext } from '../Plugin.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/** When true, a separator is rendered after the last list toolbar item. */\n\treadonly separatorAfter?: boolean;\n}\n\nconst DEFAULT_CONFIG: ListConfig = {\n\ttypes: ['bullet', 'ordered', 'checklist'],\n\tmaxIndent: 4,\n};\n\n// --- List Type Metadata ---\n\ninterface ListTypeDefinition {\n\treadonly type: ListType;\n\treadonly label: string;\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\nconst LIST_TYPE_DEFINITIONS: readonly ListTypeDefinition[] = [\n\t{\n\t\ttype: 'bullet',\n\t\tlabel: 'Bullet List',\n\t\ticon: BULLET_LIST_ICON,\n\t\tinputPattern: /^[-*] $/,\n\t\tinputPrefix: '- ',\n\t},\n\t{\n\t\ttype: 'ordered',\n\t\tlabel: 'Numbered List',\n\t\ticon: NUMBERED_LIST_ICON,\n\t\tinputPattern: /^\\d+\\. $/,\n\t\tinputPrefix: '1. ',\n\t},\n\t{\n\t\ttype: 'checklist',\n\t\tlabel: 'Checklist',\n\t\ticon: CHECKLIST_ICON,\n\t\tinputPattern: /^\\[[ x]] $/,\n\t\tinputPrefix: '[ ] ',\n\t},\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\n\tconstructor(config?: Partial<ListConfig>) {\n\t\tthis.config = { ...DEFAULT_CONFIG, ...config };\n\t}\n\n\tinit(context: PluginContext): void {\n\t\tcontext.registerStyleSheet(LIST_CSS);\n\t\tthis.registerNodeSpec(context);\n\t\tthis.registerCommands(context);\n\t\tthis.registerKeymaps(context);\n\t\tthis.registerInputRules(context);\n\t\tthis.registerToolbarItems(context);\n\t}\n\n\tprivate registerNodeSpec(context: PluginContext): void {\n\t\tcontext.registerNodeSpec({\n\t\t\ttype: 'list_item',\n\t\t\tgroup: 'block',\n\t\t\tcontent: { allow: ['text'] },\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\tli.style.marginLeft = `${indent * 24}px`;\n\t\t\t\t}\n\n\t\t\t\tif (listType === 'checklist') {\n\t\t\t\t\tli.setAttribute('data-checked', String(checked));\n\t\t\t\t\tli.setAttribute('aria-checked', String(checked));\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\treturn `<li>${content || '<br>'}</li>`;\n\t\t\t},\n\t\t\tparseHTML: [{ tag: 'li' }],\n\t\t\tsanitize: { tags: ['ul', 'ol', 'li'] },\n\t\t});\n\t}\n\n\tprivate registerCommands(context: PluginContext): void {\n\t\tconst enabledTypes = this.getEnabledTypes();\n\n\t\tfor (const def of enabledTypes) {\n\t\t\tcontext.registerCommand(`toggleList:${def.type}`, () => {\n\t\t\t\treturn this.toggleList(context, def.type);\n\t\t\t});\n\t\t}\n\n\t\tcontext.registerCommand('indentListItem', () => {\n\t\t\treturn this.indent(context);\n\t\t});\n\n\t\tcontext.registerCommand('outdentListItem', () => {\n\t\t\treturn this.outdent(context);\n\t\t});\n\n\t\tif (this.config.types.includes('checklist')) {\n\t\t\tcontext.registerCommand('toggleChecklistItem', () => {\n\t\t\t\treturn this.toggleChecked(context);\n\t\t\t});\n\t\t}\n\t}\n\n\tprivate registerKeymaps(context: PluginContext): void {\n\t\tcontext.registerKeymap({\n\t\t\tEnter: () => this.handleEnter(context),\n\t\t\tBackspace: () => this.handleBackspace(context),\n\t\t\tTab: () => this.indent(context),\n\t\t\t'Shift-Tab': () => this.outdent(context),\n\t\t});\n\t}\n\n\tprivate registerInputRules(context: PluginContext): void {\n\t\tconst enabledTypes = this.getEnabledTypes();\n\n\t\tfor (const def of enabledTypes) {\n\t\t\tcontext.registerInputRule({\n\t\t\t\tpattern: def.inputPattern,\n\t\t\t\thandler: (state, match, start, _end) => {\n\t\t\t\t\tconst sel = state.selection;\n\t\t\t\t\tif (isNodeSelection(sel)) return null;\n\t\t\t\t\tif (!isCollapsed(sel)) return null;\n\n\t\t\t\t\tconst block = state.getBlock(sel.anchor.blockId);\n\t\t\t\t\tif (!block || block.type !== 'paragraph') return null;\n\n\t\t\t\t\tconst matchStr = match[0] ?? '';\n\t\t\t\t\tconst matchLen = matchStr.length;\n\t\t\t\t\tconst attrs: Record<string, string | number | boolean> = {\n\t\t\t\t\t\tlistType: def.type,\n\t\t\t\t\t\tindent: 0,\n\t\t\t\t\t};\n\t\t\t\t\tif (def.type === 'checklist') {\n\t\t\t\t\t\tattrs.checked = matchStr.includes('[x]');\n\t\t\t\t\t}\n\n\t\t\t\t\treturn state\n\t\t\t\t\t\t.transaction('input')\n\t\t\t\t\t\t.deleteTextAt(sel.anchor.blockId, start, start + matchLen)\n\t\t\t\t\t\t.setBlockType(sel.anchor.blockId, nodeType('list_item'), attrs)\n\t\t\t\t\t\t.setSelection(createCollapsedSelection(sel.anchor.blockId, 0))\n\t\t\t\t\t\t.build();\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\t}\n\n\tprivate registerToolbarItems(context: PluginContext): void {\n\t\tconst enabledTypes = this.getEnabledTypes();\n\t\tconst lastType = enabledTypes.at(-1);\n\n\t\tfor (const def of enabledTypes) {\n\t\t\tcontext.registerToolbarItem({\n\t\t\t\tid: `list-${def.type}`,\n\t\t\t\tgroup: 'block',\n\t\t\t\ticon: def.icon,\n\t\t\t\tlabel: def.label,\n\t\t\t\tcommand: `toggleList:${def.type}`,\n\t\t\t\tpriority: def.type === 'bullet' ? 70 : def.type === 'ordered' ? 71 : 72,\n\t\t\t\tseparatorAfter: this.config.separatorAfter && def === lastType,\n\t\t\t\tisActive: (state) => this.isListActive(state, def.type),\n\t\t\t});\n\t\t}\n\t}\n\n\t// --- Command Implementations ---\n\n\tprivate toggleList(context: PluginContext, listType: ListType): boolean {\n\t\tconst state = context.getState();\n\t\tconst sel = state.selection;\n\t\tif (isNodeSelection(sel)) return false;\n\t\tconst block = state.getBlock(sel.anchor.blockId);\n\t\tif (!block) return false;\n\n\t\t// If already this list type, convert back to paragraph\n\t\tif (block.type === 'list_item' && block.attrs?.listType === listType) {\n\t\t\tconst tr = state\n\t\t\t\t.transaction('command')\n\t\t\t\t.setBlockType(sel.anchor.blockId, nodeType('paragraph'))\n\t\t\t\t.setSelection(sel)\n\t\t\t\t.build();\n\t\t\tcontext.dispatch(tr);\n\t\t\treturn true;\n\t\t}\n\n\t\t// Convert to list item\n\t\tconst attrs: Record<string, string | number | boolean> = {\n\t\t\tlistType,\n\t\t\tindent: isNodeOfType(block, 'list_item') ? block.attrs.indent : 0,\n\t\t};\n\t\tif (listType === 'checklist') {\n\t\t\tattrs.checked = false;\n\t\t}\n\n\t\tconst tr = state\n\t\t\t.transaction('command')\n\t\t\t.setBlockType(sel.anchor.blockId, nodeType('list_item'), attrs)\n\t\t\t.setSelection(sel)\n\t\t\t.build();\n\t\tcontext.dispatch(tr);\n\t\treturn true;\n\t}\n\n\tprivate indent(context: PluginContext): boolean {\n\t\tconst state = context.getState();\n\t\tif (isNodeSelection(state.selection)) return false;\n\t\tconst block = state.getBlock(state.selection.anchor.blockId);\n\t\tif (!block || !isNodeOfType(block, 'list_item')) return false;\n\n\t\tif (block.attrs.indent >= this.config.maxIndent) return false;\n\n\t\treturn this.setIndent(context, state, block.attrs.indent + 1);\n\t}\n\n\tprivate outdent(context: PluginContext): boolean {\n\t\tconst state = context.getState();\n\t\tif (isNodeSelection(state.selection)) return false;\n\t\tconst block = state.getBlock(state.selection.anchor.blockId);\n\t\tif (!block || !isNodeOfType(block, 'list_item')) return false;\n\n\t\tif (block.attrs.indent <= 0) return false;\n\n\t\treturn this.setIndent(context, state, block.attrs.indent - 1);\n\t}\n\n\tprivate setIndent(context: PluginContext, state: EditorState, indent: number): boolean {\n\t\tconst sel = state.selection;\n\t\tif (isNodeSelection(sel)) return false;\n\t\tconst block = state.getBlock(sel.anchor.blockId);\n\t\tif (!block) return false;\n\n\t\tconst attrs = { ...block.attrs, indent } as Record<string, string | number | boolean>;\n\n\t\tconst tr = state\n\t\t\t.transaction('command')\n\t\t\t.setBlockType(sel.anchor.blockId, nodeType('list_item'), attrs)\n\t\t\t.setSelection(sel)\n\t\t\t.build();\n\t\tcontext.dispatch(tr);\n\t\treturn true;\n\t}\n\n\tprivate toggleChecked(context: PluginContext): boolean {\n\t\tconst state = context.getState();\n\t\tif (isNodeSelection(state.selection)) return false;\n\t\tconst block = state.getBlock(state.selection.anchor.blockId);\n\t\tif (!block || block.type !== 'list_item' || block.attrs?.listType !== 'checklist') {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst checked = !block.attrs?.checked;\n\t\tconst attrs = { ...block.attrs, checked } as Record<string, string | number | boolean>;\n\n\t\tconst tr = state\n\t\t\t.transaction('command')\n\t\t\t.setBlockType(state.selection.anchor.blockId, nodeType('list_item'), attrs)\n\t\t\t.setSelection(state.selection)\n\t\t\t.build();\n\t\tcontext.dispatch(tr);\n\t\treturn true;\n\t}\n\n\t/**\n\t * Handles Backspace at the start of a list item.\n\t * Converts the list item back to a paragraph, preserving text.\n\t */\n\tprivate handleBackspace(context: PluginContext): boolean {\n\t\tconst state = context.getState();\n\t\tconst sel = state.selection;\n\t\tif (isNodeSelection(sel)) return false;\n\t\tif (!isCollapsed(sel)) return false;\n\n\t\tconst block = state.getBlock(sel.anchor.blockId);\n\t\tif (!block || block.type !== 'list_item') return false;\n\t\tif (sel.anchor.offset !== 0) return false;\n\n\t\tconst tr = state\n\t\t\t.transaction('input')\n\t\t\t.setBlockType(sel.anchor.blockId, nodeType('paragraph'))\n\t\t\t.setSelection(sel)\n\t\t\t.build();\n\t\tcontext.dispatch(tr);\n\t\treturn true;\n\t}\n\n\t/**\n\t * Handles Enter inside a list item.\n\t * Empty item → exit list (convert to paragraph).\n\t * Non-empty item → split and create a new list item with the same type.\n\t */\n\tprivate handleEnter(context: PluginContext): boolean {\n\t\tconst state = context.getState();\n\t\tconst sel = state.selection;\n\t\tif (isNodeSelection(sel)) return false;\n\t\tif (!isCollapsed(sel)) return false;\n\n\t\tconst block = state.getBlock(sel.anchor.blockId);\n\t\tif (!block || block.type !== 'list_item') return false;\n\n\t\tconst text = getBlockText(block);\n\n\t\tif (text === '') {\n\t\t\t// Empty list item → convert to paragraph (exit list)\n\t\t\tconst tr = state\n\t\t\t\t.transaction('input')\n\t\t\t\t.setBlockType(sel.anchor.blockId, nodeType('paragraph'))\n\t\t\t\t.setSelection(sel)\n\t\t\t\t.build();\n\t\t\tcontext.dispatch(tr);\n\t\t\treturn true;\n\t\t}\n\n\t\t// Non-empty → split block and set new block to same list type\n\t\tconst newBlockId = generateBlockId();\n\t\tconst attrs: Record<string, string | number | boolean> = {\n\t\t\tlistType: isNodeOfType(block, 'list_item') ? block.attrs.listType : 'bullet',\n\t\t\tindent: isNodeOfType(block, 'list_item') ? block.attrs.indent : 0,\n\t\t};\n\t\tif (attrs.listType === 'checklist') {\n\t\t\tattrs.checked = false;\n\t\t}\n\n\t\tconst tr = state\n\t\t\t.transaction('input')\n\t\t\t.splitBlock(sel.anchor.blockId, sel.anchor.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\t// --- Helpers ---\n\n\tprivate isListActive(state: EditorState, listType: ListType): boolean {\n\t\tif (isNodeSelection(state.selection)) return false;\n\t\tconst block = state.getBlock(state.selection.anchor.blockId);\n\t\treturn block?.type === 'list_item' && block.attrs?.listType === listType;\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"],"names":["DEFAULT_CONFIG","types","maxIndent","LIST_TYPE_DEFINITIONS","type","label","icon","inputPattern","inputPrefix","ListPlugin","id","name","priority","config","this","context","registerStyleSheet","registerNodeSpec","registerCommands","registerKeymaps","registerInputRules","registerToolbarItems","group","content","allow","attrs","listType","default","indent","checked","node","li","createBlockElement","setAttribute","String","className","style","marginLeft","tag","key","role","toHTML","_node","parseHTML","sanitize","tags","enabledTypes","getEnabledTypes","def","registerCommand","toggleList","outdent","includes","toggleChecked","registerKeymap","Enter","handleEnter","Backspace","handleBackspace","Tab","registerInputRule","pattern","handler","state","match","start","_end","sel","selection","isNodeSelection","isCollapsed","block","getBlock","anchor","blockId","matchStr","matchLen","length","transaction","deleteTextAt","setBlockType","nodeType","setSelection","createCollapsedSelection","build","lastType","at","registerToolbarItem","command","separatorAfter","isActive","isListActive","getState","tr","dispatch","isNodeOfType","setIndent","offset","getBlockText","newBlockId","generateBlockId","splitBlock","filter"],"mappings":";;;;;AACO,MCsCDA,IAA6B,EAClCC,OAAO,CAAC,UAAU,WAAW,WAAA,GAC7BC,WAAW,EAAA,GAoBNC,IAAuD,CAC5D,EACCC,MAAM,UACNC,OAAO,eACPC,MAVD,iWAWCC,cAAc,WACdC,aAAa,KAAA,GAEd,EACCJ,MAAM,WACNC,OAAO,iBACPC,MAfD,4NAgBCC,cAAc,YACdC,aAAa,MAAA,GAEd,EACCJ,MAAM,aACNC,OAAO,aACPC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A,OAAQlC,KAAKD,OAAOZ,MAAMmD,SAASJ,GAAI5C,IAAAA,CAAAA;AAAAA,EAC7E;AAAA;"}
@@ -0,0 +1,23 @@
1
+ import { Plugin, PluginContext } from '../Plugin.js';
2
+ declare module '../../model/AttrRegistry.js' {
3
+ interface MarkAttrRegistry {
4
+ strikethrough: Record<string, never>;
5
+ }
6
+ }
7
+ export interface StrikethroughConfig {
8
+ /** When true, a separator is rendered after the strikethrough toolbar item. */
9
+ readonly separatorAfter?: boolean;
10
+ }
11
+ export declare class StrikethroughPlugin implements Plugin {
12
+ readonly id = "strikethrough";
13
+ readonly name = "Strikethrough";
14
+ readonly priority = 22;
15
+ private readonly config;
16
+ constructor(config?: Partial<StrikethroughConfig>);
17
+ init(context: PluginContext): void;
18
+ private registerMarkSpec;
19
+ private registerCommand;
20
+ private registerKeymap;
21
+ private registerToolbarItem;
22
+ }
23
+ //# sourceMappingURL=StrikethroughPlugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StrikethroughPlugin.d.ts","sourceRoot":"","sources":["../../../src/plugins/strikethrough/StrikethroughPlugin.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAK1D,OAAO,QAAQ,6BAA6B,CAAC;IAC5C,UAAU,gBAAgB;QACzB,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;KACrC;CACD;AAID,MAAM,WAAW,mBAAmB;IACnC,+EAA+E;IAC/E,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;CAClC;AAMD,qBAAa,mBAAoB,YAAW,MAAM;IACjD,QAAQ,CAAC,EAAE,mBAAmB;IAC9B,QAAQ,CAAC,IAAI,mBAAmB;IAChC,QAAQ,CAAC,QAAQ,MAAM;IAEvB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAsB;gBAEjC,MAAM,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC;IAIjD,IAAI,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI;IAOlC,OAAO,CAAC,gBAAgB;IAaxB,OAAO,CAAC,eAAe;IAWvB,OAAO,CAAC,cAAc;IAMtB,OAAO,CAAC,mBAAmB;CAgB3B"}
@@ -0,0 +1,2 @@
1
+ export { StrikethroughPlugin, type StrikethroughConfig, } from './StrikethroughPlugin.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/strikethrough/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,mBAAmB,EACnB,KAAK,mBAAmB,GACxB,MAAM,0BAA0B,CAAC"}
@@ -0,0 +1,35 @@
1
+ import { A as t, r } from "../chunks/Commands-DLP85Mp5.mjs";
2
+ import { m as e } from "../chunks/TypeBrands-C09nE2qO.mjs";
3
+ import { f as o } from "../chunks/ToolbarItem-ugDymuXi.mjs";
4
+ const s = {};
5
+ class i {
6
+ id = "strikethrough";
7
+ name = "Strikethrough";
8
+ priority = 22;
9
+ config;
10
+ constructor(t2) {
11
+ this.config = { ...s, ...t2 };
12
+ }
13
+ init(t2) {
14
+ this.registerMarkSpec(t2), this.registerCommand(t2), this.registerKeymap(t2), this.registerToolbarItem(t2);
15
+ }
16
+ registerMarkSpec(t2) {
17
+ t2.registerMarkSpec({ type: "strikethrough", rank: 3, toDOM: () => document.createElement("s"), toHTMLString: (t3, r2) => `<s>${r2}</s>`, parseHTML: [{ tag: "s" }, { tag: "strike" }, { tag: "del" }], sanitize: { tags: ["s"] } });
18
+ }
19
+ registerCommand(r2) {
20
+ r2.registerCommand("toggleStrikethrough", () => {
21
+ const o2 = t(r2.getState(), e("strikethrough"));
22
+ return !!o2 && (r2.dispatch(o2), true);
23
+ });
24
+ }
25
+ registerKeymap(t2) {
26
+ t2.registerKeymap({ "Mod-Shift-X": () => t2.executeCommand("toggleStrikethrough") });
27
+ }
28
+ registerToolbarItem(t2) {
29
+ t2.registerToolbarItem({ id: "strikethrough", group: "format", icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M10 19h4v-3h-4v3zM5 4v3h5v3h4V7h5V4H5zM3 14h18v-2H3v2z"/></svg>', label: "Strikethrough", tooltip: `Strikethrough (${o("Mod-Shift-X")})`, command: "toggleStrikethrough", priority: 40, separatorAfter: this.config.separatorAfter, isActive: (t3) => r(t3, e("strikethrough")) });
30
+ }
31
+ }
32
+ export {
33
+ i as StrikethroughPlugin
34
+ };
35
+ //# sourceMappingURL=strikethrough.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"strikethrough.mjs","sources":["../../src/plugins/strikethrough/StrikethroughPlugin.ts"],"sourcesContent":["/**\n * StrikethroughPlugin: registers a strikethrough inline mark with MarkSpec,\n * toggle command, keyboard shortcut (Mod-Shift-X), and a toolbar button.\n */\n\nimport { isMarkActive, toggleMark } from '../../commands/Commands.js';\nimport { markType } from '../../model/TypeBrands.js';\nimport type { Plugin, PluginContext } from '../Plugin.js';\nimport { formatShortcut } from '../toolbar/ToolbarItem.js';\n\n// --- Attribute Registry Augmentation ---\n\ndeclare module '../../model/AttrRegistry.js' {\n\tinterface MarkAttrRegistry {\n\t\tstrikethrough: Record<string, never>;\n\t}\n}\n\n// --- Configuration ---\n\nexport interface StrikethroughConfig {\n\t/** When true, a separator is rendered after the strikethrough toolbar item. */\n\treadonly separatorAfter?: boolean;\n}\n\nconst DEFAULT_CONFIG: StrikethroughConfig = {};\n\n// --- Plugin ---\n\nexport class StrikethroughPlugin implements Plugin {\n\treadonly id = 'strikethrough';\n\treadonly name = 'Strikethrough';\n\treadonly priority = 22;\n\n\tprivate readonly config: StrikethroughConfig;\n\n\tconstructor(config?: Partial<StrikethroughConfig>) {\n\t\tthis.config = { ...DEFAULT_CONFIG, ...config };\n\t}\n\n\tinit(context: PluginContext): void {\n\t\tthis.registerMarkSpec(context);\n\t\tthis.registerCommand(context);\n\t\tthis.registerKeymap(context);\n\t\tthis.registerToolbarItem(context);\n\t}\n\n\tprivate registerMarkSpec(context: PluginContext): void {\n\t\tcontext.registerMarkSpec({\n\t\t\ttype: 'strikethrough',\n\t\t\trank: 3,\n\t\t\ttoDOM() {\n\t\t\t\treturn document.createElement('s');\n\t\t\t},\n\t\t\ttoHTMLString: (_mark, content) => `<s>${content}</s>`,\n\t\t\tparseHTML: [{ tag: 's' }, { tag: 'strike' }, { tag: 'del' }],\n\t\t\tsanitize: { tags: ['s'] },\n\t\t});\n\t}\n\n\tprivate registerCommand(context: PluginContext): void {\n\t\tcontext.registerCommand('toggleStrikethrough', () => {\n\t\t\tconst tr = toggleMark(context.getState(), markType('strikethrough'));\n\t\t\tif (tr) {\n\t\t\t\tcontext.dispatch(tr);\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn false;\n\t\t});\n\t}\n\n\tprivate registerKeymap(context: PluginContext): void {\n\t\tcontext.registerKeymap({\n\t\t\t'Mod-Shift-X': () => context.executeCommand('toggleStrikethrough'),\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=\"M10 19h4v-3h-4v3zM5 4v3h5v3h4V7h5V4H5zM3 14h18v-2H3v2z\"/></svg>';\n\n\t\tcontext.registerToolbarItem({\n\t\t\tid: 'strikethrough',\n\t\t\tgroup: 'format',\n\t\t\ticon,\n\t\t\tlabel: 'Strikethrough',\n\t\t\ttooltip: `Strikethrough (${formatShortcut('Mod-Shift-X')})`,\n\t\t\tcommand: 'toggleStrikethrough',\n\t\t\tpriority: 40,\n\t\t\tseparatorAfter: this.config.separatorAfter,\n\t\t\tisActive: (state) => isMarkActive(state, markType('strikethrough')),\n\t\t});\n\t}\n}\n"],"names":["DEFAULT_CONFIG","StrikethroughPlugin","id","name","priority","config","this","context","registerMarkSpec","registerCommand","registerKeymap","registerToolbarItem","type","rank","toDOM","document","createElement","toHTMLString","_mark","content","parseHTML","tag","sanitize","tags","tr","toggleMark","getState","markType","dispatch","executeCommand","group","icon","label","tooltip","formatShortcut","command","separatorAfter","isActive","state","isMarkActive"],"mappings":";;;AAyBA,MAAMA,IAAsC,CAAA;AAIrC,MAAMC,EAAAA;AAAAA,EACHC,KAAK;AAAA,EACLC,OAAO;AAAA,EACPC,WAAW;AAAA,EAEHC;AAAAA,EAEjB,YAAYA,IAAAA;AACXC,SAAKD,SAAS,EAAA,GAAKL,GAAAA,GAAmBK,GAAAA;AAAAA,EACvC;AAAA,EAEA,KAAKE,IAAAA;AACJD,SAAKE,iBAAiBD,EAAAA,GACtBD,KAAKG,gBAAgBF,EAAAA,GACrBD,KAAKI,eAAeH,EAAAA,GACpBD,KAAKK,oBAAoBJ,EAAAA;AAAAA,EAC1B;AAAA,EAEQ,iBAAiBA;AACxBA,IAAAA,GAAQC,iBAAiB,EACxBI,MAAM,iBACNC,MAAM,GACNC,OAAA,MACQC,SAASC,cAAc,GAAA,GAE/BC,cAAc,CAACC,IAAOC,OAAY,MAAMA,EAAAA,QACxCC,WAAW,CAAC,EAAEC,KAAK,IAAA,GAAO,EAAEA,KAAK,SAAA,GAAY,EAAEA,KAAK,MAAA,CAAA,GACpDC,UAAU,EAAEC,MAAM,CAAC,GAAA,EAAA,EAAA,CAAA;AAAA,EAErB;AAAA,EAEQ,gBAAgBhB;AACvBA,IAAAA,GAAQE,gBAAgB,uBAAuB,MAAA;AAC9C,YAAMe,KAAKC,EAAWlB,GAAQmB,SAAAA,GAAYC,EAAS,eAAA,CAAA;AACnD,aAAA,CAAA,CAAIH,OACHjB,GAAQqB,SAASJ,EAAAA,GAAAA;AAAAA,IACV,CAAA;AAAA,EAIV;AAAA,EAEQ,eAAejB,IAAAA;AACtBA,IAAAA,GAAQG,eAAe,EACtB,eAAe,MAAMH,GAAQsB,eAAe,qBAAA,EAAA,CAAA;AAAA,EAE9C;AAAA,EAEQ,oBAAoBtB;AAI3BA,IAAAA,GAAQI,oBAAoB,EAC3BT,IAAI,iBACJ4B,OAAO,UACPC,MALA,wIAMAC,OAAO,iBACPC,SAAS,kBAAkBC,EAAe,aAAA,CAAA,KAC1CC,SAAS,uBACT/B,UAAU,IACVgC,gBAAgB9B,KAAKD,OAAO+B,gBAC5BC,UAAWC,CAAAA,OAAUC,EAAaD,IAAOX,EAAS;EAEpD;AAAA;"}
@@ -0,0 +1,44 @@
1
+ import { Plugin, PluginContext } from '../Plugin.js';
2
+ declare module '../../model/AttrRegistry.js' {
3
+ interface MarkAttrRegistry {
4
+ superscript: Record<string, never>;
5
+ subscript: Record<string, never>;
6
+ }
7
+ }
8
+ /** Controls toolbar button visibility per mark. */
9
+ export interface SuperSubToolbarConfig {
10
+ readonly superscript?: boolean;
11
+ readonly subscript?: boolean;
12
+ }
13
+ /** Controls which marks are enabled and which toolbar buttons are shown. */
14
+ export interface SuperSubConfig {
15
+ readonly superscript: boolean;
16
+ readonly subscript: boolean;
17
+ readonly toolbar?: SuperSubToolbarConfig;
18
+ /** When true, a separator is rendered after the last toolbar item. */
19
+ readonly separatorAfter?: boolean;
20
+ }
21
+ export declare class SuperSubPlugin implements Plugin {
22
+ readonly id = "super-sub";
23
+ readonly name = "Superscript & Subscript";
24
+ readonly priority = 23;
25
+ private readonly config;
26
+ constructor(config?: Partial<SuperSubConfig>);
27
+ init(context: PluginContext): void;
28
+ private registerMark;
29
+ private registerKeymaps;
30
+ /**
31
+ * Ensures superscript and subscript are mutually exclusive.
32
+ * When an addMark step for one type is found, a removeMark step
33
+ * for the opposite type is injected. For stored marks, the opposite
34
+ * mark is filtered out.
35
+ */
36
+ private registerExclusivityMiddleware;
37
+ /**
38
+ * Registers disabled toolbar buttons for marks whose feature is disabled
39
+ * but whose toolbar button is explicitly requested.
40
+ */
41
+ private registerDisabledToolbarItems;
42
+ private isToolbarVisible;
43
+ }
44
+ //# sourceMappingURL=SuperSubPlugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"S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SuperSubPlugin, type SuperSubConfig, type SuperSubToolbarConfig, } from './SuperSubPlugin.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/super-sub/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,cAAc,EACd,KAAK,cAAc,EACnB,KAAK,qBAAqB,GAC1B,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,81 @@
1
+ import { A as t, r as s } from "../chunks/Commands-DLP85Mp5.mjs";
2
+ import { m as e } from "../chunks/TypeBrands-C09nE2qO.mjs";
3
+ import { f as i } from "../chunks/ToolbarItem-ugDymuXi.mjs";
4
+ const r = { superscript: true, subscript: true }, o = [{ type: "superscript", opposite: "subscript", configKey: "superscript", rank: 4, tag: "sup", label: "Superscript", icon: ['<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">', '<path d="M16 7.41L11.41 12 16 16.59 14.59 18l-6-6 6-6z"', ' fill="none"/>', '<path d="M9.64 7.64c.23-.5.36-1.05.36-1.64', " 0-2.21-1.79-4-4-4H2v14h4.36c2.34 0 4.24-1.9", " 4.24-4.24 0-1.6-.89-2.99-2.2-3.71zM4.5 4.5H6c.83", " 0 1.5.67 1.5 1.5S6.83 7.5 6 7.5H4.5v-3zm2 9H4.5v-3H6.5c.83", ' 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5z" fill="none"/>', '<path d="M15.97 3.84c0-.47.19-.91.53-1.21.34-.31.8-.49', " 1.3-.49.5 0 .95.18 1.28.48.32.3.5.7.51 1.15h1.59c-.02", "-.96-.43-1.83-1.13-2.42C19.36.77 18.45.44 17.5.44c-.88", " 0-1.74.28-2.39.8-.67.53-1.06 1.28-1.06 2.1 0 .76.34", " 1.47.93 1.97.59.49 1.41.84 2.32 1.15.7.24 1.26.5 1.62.8.35.3.53.64.53", " 1.02 0 .48-.2.93-.55 1.24-.36.3-.84.48-1.37.48-.55 0-1.04-.2-1.39-.54", "-.34-.33-.53-.8-.53-1.32h-1.58c.01 1.02.43 1.95 1.16 2.57.72.62 1.67.96", " 2.67.96.92 0 1.81-.3 2.46-.84.67-.56 1.04-1.33 1.04-2.18 0-.81-.36-1.56", "-.99-2.08-.62-.51-1.48-.88-2.43-1.2-.67-.23-1.2-.47-1.52-.75-.32-.27-.46", '-.59-.46-.94z"/>', '<path d="M5.88 20h2.66l3.4-5.42L15.3 20h2.67l-4.73-7.38', ' 4.37-6.62h-2.6l-3.07 4.98L8.92 6h-2.6l4.26 6.58z"/>', "</svg>"].join(""), keyBinding: "Mod-.", toolbarPriority: 50, toHTMLString: (t2) => `<sup>${t2}</sup>`, parseHTML: [{ tag: "sup" }], sanitize: { tags: ["sup"] } }, { type: "subscript", opposite: "superscript", configKey: "subscript", rank: 4, tag: "sub", label: "Subscript", icon: ['<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">', '<path d="M15.97 16.84c0-.47.19-.91.53-1.21.34-.31.8-.49', " 1.3-.49.5 0 .95.18 1.28.48.32.3.5.7.51 1.15h1.59c-.02", "-.96-.43-1.83-1.13-2.42-.7-.58-1.61-.91-2.56-.91-.88", " 0-1.74.28-2.39.8-.67.53-1.06 1.28-1.06 2.1 0 .76.34", " 1.47.93 1.97.59.49 1.41.84 2.32 1.15.7.24 1.26.5 1.62.8.35.3.53.64.53", " 1.02 0 .48-.2.93-.55 1.24-.36.3-.84.48-1.37.48-.55 0-1.04-.2-1.39-.54", "-.34-.33-.53-.8-.53-1.32h-1.58c.01 1.02.43 1.95 1.16 2.57.72.62 1.67.96", " 2.67.96.92 0 1.81-.3 2.46-.84.67-.56 1.04-1.33 1.04-2.18 0-.81-.36-1.56", "-.99-2.08-.62-.51-1.48-.88-2.43-1.2-.67-.23-1.2-.47-1.52-.75-.32-.27-.46", '-.59-.46-.94z"/>', '<path d="M5.88 18h2.66l3.4-5.42L15.3 18h2.67l-4.73-7.38', ' 4.37-6.62h-2.6l-3.07 4.98L8.92 4h-2.6l4.26 6.58z"/>', "</svg>"].join(""), keyBinding: "Mod-,", toolbarPriority: 51, toHTMLString: (t2) => `<sub>${t2}</sub>`, parseHTML: [{ tag: "sub" }], sanitize: { tags: ["sub"] } }];
5
+ class p {
6
+ id = "super-sub";
7
+ name = "Superscript & Subscript";
8
+ priority = 23;
9
+ config;
10
+ constructor(t2) {
11
+ this.config = { ...r, ...t2 };
12
+ }
13
+ init(t2) {
14
+ const s2 = o.filter((t3) => this.config[t3.configKey]), e2 = s2.filter((t3) => this.isToolbarVisible(t3.configKey)).at(-1);
15
+ for (const i2 of s2) {
16
+ const s3 = !!this.config.separatorAfter && i2 === e2;
17
+ this.registerMark(t2, i2, s3);
18
+ }
19
+ this.registerKeymaps(t2, s2), this.registerExclusivityMiddleware(t2, s2), this.registerDisabledToolbarItems(t2);
20
+ }
21
+ registerMark(r2, o2, p2) {
22
+ const a = n(o2.type), c = this.isToolbarVisible(o2.configKey);
23
+ r2.registerMarkSpec({ type: o2.type, rank: o2.rank, toDOM: () => document.createElement(o2.tag), toHTMLString: (t2, s2) => o2.toHTMLString(s2), parseHTML: o2.parseHTML, sanitize: o2.sanitize }), r2.registerCommand(a, () => {
24
+ const s2 = t(r2.getState(), e(o2.type));
25
+ return !!s2 && (r2.dispatch(s2), true);
26
+ }), c && r2.registerToolbarItem({ id: o2.type, group: "format", icon: o2.icon, label: o2.label, tooltip: `${o2.label} (${i(o2.keyBinding)})`, command: a, priority: o2.toolbarPriority, separatorAfter: p2, isActive: (t2) => s(t2, e(o2.type)) });
27
+ }
28
+ registerKeymaps(t2, s2) {
29
+ const e2 = {};
30
+ for (const i2 of s2) {
31
+ const s3 = n(i2.type);
32
+ e2[i2.keyBinding] = () => t2.executeCommand(s3);
33
+ }
34
+ Object.keys(e2).length > 0 && t2.registerKeymap(e2);
35
+ }
36
+ registerExclusivityMiddleware(t2, s2) {
37
+ s2.some((t3) => "superscript" === t3.type) && s2.some((t3) => "subscript" === t3.type) && t2.registerMiddleware((t3, s3, i2) => {
38
+ let r2 = false;
39
+ const p2 = [];
40
+ for (const s4 of t3.steps) {
41
+ if ("addMark" !== s4.type) {
42
+ p2.push(s4);
43
+ continue;
44
+ }
45
+ const t4 = s4.mark.type, i3 = o.find((s5) => s5.type === t4);
46
+ if (!i3) {
47
+ p2.push(s4);
48
+ continue;
49
+ }
50
+ r2 = true;
51
+ const n3 = { type: "removeMark", blockId: s4.blockId, from: s4.from, to: s4.to, mark: { type: e(i3.opposite) }, ...s4.path ? { path: s4.path } : {} };
52
+ p2.push(n3, s4);
53
+ }
54
+ let n2 = t3.storedMarksAfter;
55
+ if (n2) {
56
+ const t4 = n2.some((t5) => "superscript" === t5.type), s4 = n2.some((t5) => "subscript" === t5.type);
57
+ if (t4 && s4) {
58
+ const t5 = n2.findLastIndex((t6) => "superscript" === t6.type) > n2.findLastIndex((t6) => "subscript" === t6.type) ? "subscript" : "superscript";
59
+ n2 = n2.filter((s5) => s5.type !== t5), r2 = true;
60
+ }
61
+ }
62
+ i2(r2 ? { ...t3, steps: p2, storedMarksAfter: n2 } : t3);
63
+ });
64
+ }
65
+ registerDisabledToolbarItems(t2) {
66
+ if (this.config.toolbar) for (const s2 of o) {
67
+ const e2 = this.config[s2.configKey], i2 = this.config.toolbar[s2.configKey] ?? true;
68
+ !e2 && i2 && t2.registerToolbarItem({ id: s2.type, group: "format", icon: s2.icon, label: s2.label, command: n(s2.type), priority: s2.toolbarPriority, isEnabled: () => false });
69
+ }
70
+ }
71
+ isToolbarVisible(t2) {
72
+ return !this.config.toolbar || (this.config.toolbar[t2] ?? true);
73
+ }
74
+ }
75
+ function n(t2) {
76
+ return `toggle${t2.charAt(0).toUpperCase()}${t2.slice(1)}`;
77
+ }
78
+ export {
79
+ p as SuperSubPlugin
80
+ };
81
+ //# sourceMappingURL=super-sub.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"super-sub.mjs","sources":["../../src/plugins/super-sub/SuperSubPlugin.ts"],"sourcesContent":["/**\n * SuperSubPlugin: registers superscript and subscript inline marks with\n * MarkSpecs, toggle commands, keyboard shortcuts, toolbar buttons, and\n * a middleware that enforces mutual exclusivity between the two marks.\n *\n * Data-driven — each mark type is defined declaratively and all\n * registrations are derived from the same definition table.\n */\n\nimport { isMarkActive, toggleMark } from '../../commands/Commands.js';\nimport type { Mark } from '../../model/Document.js';\nimport type { ParseRule } from '../../model/ParseRule.js';\nimport type { SanitizeConfig } from '../../model/SanitizeConfig.js';\nimport { markType as mkType } from '../../model/TypeBrands.js';\nimport type { RemoveMarkStep, Step } from '../../state/Transaction.js';\nimport type { Plugin, PluginContext } from '../Plugin.js';\nimport { formatShortcut } from '../toolbar/ToolbarItem.js';\n\n// --- Attribute Registry Augmentation ---\n\ndeclare module '../../model/AttrRegistry.js' {\n\tinterface MarkAttrRegistry {\n\t\tsuperscript: Record<string, never>;\n\t\tsubscript: Record<string, never>;\n\t}\n}\n\n// --- Configuration ---\n\n/** Controls toolbar button visibility per mark. */\nexport interface SuperSubToolbarConfig {\n\treadonly superscript?: boolean;\n\treadonly subscript?: boolean;\n}\n\n/** Controls which marks are enabled and which toolbar buttons are shown. */\nexport interface SuperSubConfig {\n\treadonly superscript: boolean;\n\treadonly subscript: boolean;\n\treadonly toolbar?: SuperSubToolbarConfig;\n\t/** When true, a separator is rendered after the last toolbar item. */\n\treadonly separatorAfter?: boolean;\n}\n\nconst DEFAULT_CONFIG: SuperSubConfig = {\n\tsuperscript: true,\n\tsubscript: true,\n};\n\n// --- Mark Definitions ---\n\ninterface MarkDefinition {\n\treadonly type: 'superscript' | 'subscript';\n\treadonly opposite: 'superscript' | 'subscript';\n\treadonly configKey: keyof Omit<SuperSubConfig, 'toolbar' | 'separatorAfter'>;\n\treadonly rank: number;\n\treadonly tag: string;\n\treadonly label: string;\n\treadonly icon: string;\n\treadonly keyBinding: string;\n\treadonly toolbarPriority: number;\n\treadonly toHTMLString: (content: string) => string;\n\treadonly parseHTML: readonly ParseRule[];\n\treadonly sanitize: SanitizeConfig;\n}\n\nconst SUPERSCRIPT_ICON: string = [\n\t'<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\">',\n\t'<path d=\"M16 7.41L11.41 12 16 16.59 14.59 18l-6-6 6-6z\"',\n\t' fill=\"none\"/>',\n\t'<path d=\"M9.64 7.64c.23-.5.36-1.05.36-1.64',\n\t' 0-2.21-1.79-4-4-4H2v14h4.36c2.34 0 4.24-1.9',\n\t' 4.24-4.24 0-1.6-.89-2.99-2.2-3.71zM4.5 4.5H6c.83',\n\t' 0 1.5.67 1.5 1.5S6.83 7.5 6 7.5H4.5v-3zm2 9H4.5v-3H6.5c.83',\n\t' 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5z\" fill=\"none\"/>',\n\t'<path d=\"M15.97 3.84c0-.47.19-.91.53-1.21.34-.31.8-.49',\n\t' 1.3-.49.5 0 .95.18 1.28.48.32.3.5.7.51 1.15h1.59c-.02',\n\t'-.96-.43-1.83-1.13-2.42C19.36.77 18.45.44 17.5.44c-.88',\n\t' 0-1.74.28-2.39.8-.67.53-1.06 1.28-1.06 2.1 0 .76.34',\n\t' 1.47.93 1.97.59.49 1.41.84 2.32 1.15.7.24 1.26.5 1.62.8.35.3.53.64.53',\n\t' 1.02 0 .48-.2.93-.55 1.24-.36.3-.84.48-1.37.48-.55 0-1.04-.2-1.39-.54',\n\t'-.34-.33-.53-.8-.53-1.32h-1.58c.01 1.02.43 1.95 1.16 2.57.72.62 1.67.96',\n\t' 2.67.96.92 0 1.81-.3 2.46-.84.67-.56 1.04-1.33 1.04-2.18 0-.81-.36-1.56',\n\t'-.99-2.08-.62-.51-1.48-.88-2.43-1.2-.67-.23-1.2-.47-1.52-.75-.32-.27-.46',\n\t'-.59-.46-.94z\"/>',\n\t'<path d=\"M5.88 20h2.66l3.4-5.42L15.3 20h2.67l-4.73-7.38',\n\t' 4.37-6.62h-2.6l-3.07 4.98L8.92 6h-2.6l4.26 6.58z\"/>',\n\t'</svg>',\n].join('');\n\nconst SUBSCRIPT_ICON: string = [\n\t'<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\">',\n\t'<path d=\"M15.97 16.84c0-.47.19-.91.53-1.21.34-.31.8-.49',\n\t' 1.3-.49.5 0 .95.18 1.28.48.32.3.5.7.51 1.15h1.59c-.02',\n\t'-.96-.43-1.83-1.13-2.42-.7-.58-1.61-.91-2.56-.91-.88',\n\t' 0-1.74.28-2.39.8-.67.53-1.06 1.28-1.06 2.1 0 .76.34',\n\t' 1.47.93 1.97.59.49 1.41.84 2.32 1.15.7.24 1.26.5 1.62.8.35.3.53.64.53',\n\t' 1.02 0 .48-.2.93-.55 1.24-.36.3-.84.48-1.37.48-.55 0-1.04-.2-1.39-.54',\n\t'-.34-.33-.53-.8-.53-1.32h-1.58c.01 1.02.43 1.95 1.16 2.57.72.62 1.67.96',\n\t' 2.67.96.92 0 1.81-.3 2.46-.84.67-.56 1.04-1.33 1.04-2.18 0-.81-.36-1.56',\n\t'-.99-2.08-.62-.51-1.48-.88-2.43-1.2-.67-.23-1.2-.47-1.52-.75-.32-.27-.46',\n\t'-.59-.46-.94z\"/>',\n\t'<path d=\"M5.88 18h2.66l3.4-5.42L15.3 18h2.67l-4.73-7.38',\n\t' 4.37-6.62h-2.6l-3.07 4.98L8.92 4h-2.6l4.26 6.58z\"/>',\n\t'</svg>',\n].join('');\n\nconst MARK_DEFINITIONS: readonly MarkDefinition[] = [\n\t{\n\t\ttype: 'superscript',\n\t\topposite: 'subscript',\n\t\tconfigKey: 'superscript',\n\t\trank: 4,\n\t\ttag: 'sup',\n\t\tlabel: 'Superscript',\n\t\ticon: SUPERSCRIPT_ICON,\n\t\tkeyBinding: 'Mod-.',\n\t\ttoolbarPriority: 50,\n\t\ttoHTMLString: (content) => `<sup>${content}</sup>`,\n\t\tparseHTML: [{ tag: 'sup' }],\n\t\tsanitize: { tags: ['sup'] },\n\t},\n\t{\n\t\ttype: 'subscript',\n\t\topposite: 'superscript',\n\t\tconfigKey: 'subscript',\n\t\trank: 4,\n\t\ttag: 'sub',\n\t\tlabel: 'Subscript',\n\t\ticon: SUBSCRIPT_ICON,\n\t\tkeyBinding: 'Mod-,',\n\t\ttoolbarPriority: 51,\n\t\ttoHTMLString: (content) => `<sub>${content}</sub>`,\n\t\tparseHTML: [{ tag: 'sub' }],\n\t\tsanitize: { tags: ['sub'] },\n\t},\n];\n\n// --- Plugin ---\n\nexport class SuperSubPlugin implements Plugin {\n\treadonly id = 'super-sub';\n\treadonly name = 'Superscript & Subscript';\n\treadonly priority = 23;\n\n\tprivate readonly config: SuperSubConfig;\n\n\tconstructor(config?: Partial<SuperSubConfig>) {\n\t\tthis.config = { ...DEFAULT_CONFIG, ...config };\n\t}\n\n\tinit(context: PluginContext): void {\n\t\tconst enabledMarks: MarkDefinition[] = MARK_DEFINITIONS.filter(\n\t\t\t(def) => this.config[def.configKey],\n\t\t);\n\n\t\tconst visibleToolbarMarks: MarkDefinition[] = enabledMarks.filter((def) =>\n\t\t\tthis.isToolbarVisible(def.configKey),\n\t\t);\n\t\tconst lastVisibleMark: MarkDefinition | undefined = visibleToolbarMarks.at(-1);\n\n\t\tfor (const def of enabledMarks) {\n\t\t\tconst isSeparatorTarget: boolean = !!this.config.separatorAfter && def === lastVisibleMark;\n\t\t\tthis.registerMark(context, def, isSeparatorTarget);\n\t\t}\n\n\t\tthis.registerKeymaps(context, enabledMarks);\n\t\tthis.registerExclusivityMiddleware(context, enabledMarks);\n\t\tthis.registerDisabledToolbarItems(context);\n\t}\n\n\tprivate registerMark(context: PluginContext, def: MarkDefinition, separatorAfter: boolean): void {\n\t\tconst commandName: string = toCommandName(def.type);\n\t\tconst toolbarVisible: boolean = this.isToolbarVisible(def.configKey);\n\n\t\tcontext.registerMarkSpec({\n\t\t\ttype: def.type,\n\t\t\trank: def.rank,\n\t\t\ttoDOM() {\n\t\t\t\treturn document.createElement(def.tag);\n\t\t\t},\n\t\t\ttoHTMLString: (_mark, content) => def.toHTMLString(content),\n\t\t\tparseHTML: def.parseHTML,\n\t\t\tsanitize: def.sanitize,\n\t\t});\n\n\t\tcontext.registerCommand(commandName, () => {\n\t\t\tconst tr = toggleMark(context.getState(), mkType(def.type));\n\t\t\tif (tr) {\n\t\t\t\tcontext.dispatch(tr);\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn false;\n\t\t});\n\n\t\tif (toolbarVisible) {\n\t\t\tcontext.registerToolbarItem({\n\t\t\t\tid: def.type,\n\t\t\t\tgroup: 'format',\n\t\t\t\ticon: def.icon,\n\t\t\t\tlabel: def.label,\n\t\t\t\ttooltip: `${def.label} (${formatShortcut(def.keyBinding)})`,\n\t\t\t\tcommand: commandName,\n\t\t\t\tpriority: def.toolbarPriority,\n\t\t\t\tseparatorAfter,\n\t\t\t\tisActive: (state) => isMarkActive(state, mkType(def.type)),\n\t\t\t});\n\t\t}\n\t}\n\n\tprivate registerKeymaps(context: PluginContext, marks: readonly MarkDefinition[]): void {\n\t\tconst keymap: Record<string, () => boolean> = {};\n\t\tfor (const def of marks) {\n\t\t\tconst commandName: string = toCommandName(def.type);\n\t\t\tkeymap[def.keyBinding] = () => context.executeCommand(commandName);\n\t\t}\n\t\tif (Object.keys(keymap).length > 0) {\n\t\t\tcontext.registerKeymap(keymap);\n\t\t}\n\t}\n\n\t/**\n\t * Ensures superscript and subscript are mutually exclusive.\n\t * When an addMark step for one type is found, a removeMark step\n\t * for the opposite type is injected. For stored marks, the opposite\n\t * mark is filtered out.\n\t */\n\tprivate registerExclusivityMiddleware(\n\t\tcontext: PluginContext,\n\t\tenabledMarks: readonly MarkDefinition[],\n\t): void {\n\t\tconst bothEnabled: boolean =\n\t\t\tenabledMarks.some((d) => d.type === 'superscript') &&\n\t\t\tenabledMarks.some((d) => d.type === 'subscript');\n\n\t\tif (!bothEnabled) return;\n\n\t\tcontext.registerMiddleware((tr, _state, next) => {\n\t\t\tlet patched = false;\n\n\t\t\t// Handle addMark steps: inject removeMark for the opposite type\n\t\t\tconst patchedSteps: Step[] = [];\n\t\t\tfor (const step of tr.steps) {\n\t\t\t\tif (step.type !== 'addMark') {\n\t\t\t\t\tpatchedSteps.push(step);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tconst markName: string = step.mark.type;\n\t\t\t\tconst def: MarkDefinition | undefined = MARK_DEFINITIONS.find((d) => d.type === markName);\n\t\t\t\tif (!def) {\n\t\t\t\t\tpatchedSteps.push(step);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tpatched = true;\n\t\t\t\tconst removeStep: RemoveMarkStep = {\n\t\t\t\t\ttype: 'removeMark',\n\t\t\t\t\tblockId: step.blockId,\n\t\t\t\t\tfrom: step.from,\n\t\t\t\t\tto: step.to,\n\t\t\t\t\tmark: { type: mkType(def.opposite) },\n\t\t\t\t\t...(step.path ? { path: step.path } : {}),\n\t\t\t\t};\n\t\t\t\tpatchedSteps.push(removeStep, step);\n\t\t\t}\n\n\t\t\t// Handle stored marks: remove the opposite mark\n\t\t\tlet storedMarksAfter: readonly Mark[] | null = tr.storedMarksAfter;\n\t\t\tif (storedMarksAfter) {\n\t\t\t\tconst hasSup: boolean = storedMarksAfter.some((m) => m.type === 'superscript');\n\t\t\t\tconst hasSub: boolean = storedMarksAfter.some((m) => m.type === 'subscript');\n\n\t\t\t\tif (hasSup && hasSub) {\n\t\t\t\t\t// Keep the one that was most recently added (last in array)\n\t\t\t\t\tconst lastSupIdx: number = storedMarksAfter.findLastIndex(\n\t\t\t\t\t\t(m) => m.type === 'superscript',\n\t\t\t\t\t);\n\t\t\t\t\tconst lastSubIdx: number = storedMarksAfter.findLastIndex((m) => m.type === 'subscript');\n\t\t\t\t\tconst removeType: string = lastSupIdx > lastSubIdx ? 'subscript' : 'superscript';\n\n\t\t\t\t\tstoredMarksAfter = storedMarksAfter.filter((m) => m.type !== removeType);\n\t\t\t\t\tpatched = true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tnext(patched ? { ...tr, steps: patchedSteps, storedMarksAfter } : tr);\n\t\t});\n\t}\n\n\t/**\n\t * Registers disabled toolbar buttons for marks whose feature is disabled\n\t * but whose toolbar button is explicitly requested.\n\t */\n\tprivate registerDisabledToolbarItems(context: PluginContext): void {\n\t\tif (!this.config.toolbar) return;\n\n\t\tfor (const def of MARK_DEFINITIONS) {\n\t\t\tconst featureEnabled: boolean = this.config[def.configKey];\n\t\t\tconst toolbarVisible: boolean = this.config.toolbar[def.configKey] ?? true;\n\n\t\t\tif (!featureEnabled && toolbarVisible) {\n\t\t\t\tcontext.registerToolbarItem({\n\t\t\t\t\tid: def.type,\n\t\t\t\t\tgroup: 'format',\n\t\t\t\t\ticon: def.icon,\n\t\t\t\t\tlabel: def.label,\n\t\t\t\t\tcommand: toCommandName(def.type),\n\t\t\t\t\tpriority: def.toolbarPriority,\n\t\t\t\t\tisEnabled: () => false,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate isToolbarVisible(\n\t\tconfigKey: keyof Omit<SuperSubConfig, 'toolbar' | 'separatorAfter'>,\n\t): boolean {\n\t\tif (!this.config.toolbar) return true;\n\t\treturn this.config.toolbar[configKey] ?? true;\n\t}\n}\n\n/** Converts a mark type to its toggle command name (e.g. 'superscript' → 'toggleSuperscript'). */\nfunction toCommandName(markType: string): string {\n\treturn `toggle${markType.charAt(0).toUpperCase()}${markType.slice(1)}`;\n}\n"],"names":["DEFAULT_CONFIG","superscript","subscript","MARK_DEFINITIONS","type","opposite","configKey","rank","tag","label","icon","join","keyBinding","toolbarPriority","toHTMLString","content","parseHTML","sanitize","tags","SuperSubPlugin","id","name","priority","config","this","context","enabledMarks","filter","def","lastVisibleMark","isToolbarVisible","at","isSeparatorTarget","separatorAfter","registerMark","registerKeymaps","registerExclusivityMiddleware","registerDisabledToolbarItems","commandName","toCommandName","toolbarVisible","registerMarkSpec","toDOM","document","createElement","_mark","registerCommand","tr","toggleMark","getState","mkType","dispatch","registerToolbarItem","group","tooltip","formatShortcut","command","isActive","state","isMarkActive","marks","keymap","executeCommand","Object","keys","length","registerKeymap","some","d","registerMiddleware","_state","next","patched","patchedSteps","step","steps","push","markName","mark","find","removeStep","blockId","from","to","path","storedMarksAfter","hasSup","m","hasSub","removeType","findLastIndex","toolbar","featureEnabled","isEnabled","markType","charAt","toUpperCase","slice"],"mappings":";;;AA4CA,MAAMA,IAAiC,EACtCC,aAAAA,MACAC,WAAAA,QA6DKC,IAA8C,CACnD,EACCC,MAAM,eACNC,UAAU,aACVC,WAAW,eACXC,MAAM,GACNC,KAAK,OACLC,OAAO,eACPC,MAjD+B,CAChC,gEACA,2DACA,kBACA,8CACA,gDACA,qDACA,+DACA,sDACA,0DACA,0DACA,0DACA,wDACA,0EACA,0EACA,2EACA,4EACA,4EACA,oBACA,2DACA,wDACA,QAAA,EACCC,KAAK,EAAA,GA4BLC,YAAY,SACZC,iBAAiB,IACjBC,cAAeC,CAAAA,OAAY,QAAQA,EAAAA,UACnCC,WAAW,CAAC,EAAER,KAAK,UACnBS,UAAU,EAAEC,MAAM,CAAC,KAAA,EAAA,EAAA,GAEpB,EACCd,MAAM,aACNC,UAAU,eACVC,WAAW,aACXC,MAAM,GACNC,KAAK,OACLC,OAAO,aACPC,MAvC6B,CAC9B,gEACA,2DACA,0DACA,wDACA,wDACA,0EACA,0EACA,2EACA,4EACA,4EACA,oBACA,2DACA,wDACA,QAAA,EACCC,KAAK,EAAA,GAyBLC,YAAY,SACZC,iBAAiB,IACjBC,cAAeC,CAAAA,OAAY,QAAQA,YACnCC,WAAW,CAAC,EAAER,KAAK,MAAA,CAAA,GACnBS,UAAU,EAAEC,MAAM,CAAC,KAAA,EAAA,EAAA,CAAA;AAMd,MAAMC,EAAAA;AAAAA,EACHC,KAAK;AAAA,EACLC,OAAO;AAAA,EACPC,WAAW;AAAA,EAEHC;AAAAA,EAEjB,YAAYA,IAAAA;AACXC,SAAKD,SAAS,EAAA,GAAKvB,GAAAA,GAAmBuB;EACvC;AAAA,EAEA,KAAKE,IAAAA;AACJ,UAAMC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YACVnE,KAAKD,OAAOoE,QAAQrF,EAAAA,KAAAA;AAAAA,EAC5B;AAAA;AAID,SAASiC,EAAcuD;AACtB,SAAO,SAASA,GAASC,OAAO,CAAA,EAAGC,YAAAA,CAAAA,GAAgBF,GAASG,MAAM;AACnE;"}
@@ -0,0 +1,50 @@
1
+ import { BlockId } from '../../model/TypeBrands.js';
2
+ import { EditorState } from '../../state/EditorState.js';
3
+ import { Transaction } from '../../state/Transaction.js';
4
+ import { PluginContext } from '../Plugin.js';
5
+ /** Builds a transaction that inserts a new row at the given index. */
6
+ export declare function buildInsertRowTransaction(state: EditorState, tableId: BlockId, rowIndex: number): Transaction | null;
7
+ /** Builds a transaction that inserts a new column at the given index. */
8
+ export declare function buildInsertColumnTransaction(state: EditorState, tableId: BlockId, colIndex: number): Transaction | null;
9
+ /**
10
+ * Builds a transaction that deletes the row at the given index.
11
+ * If it's the last row, delegates to `createDeleteTableTransaction`.
12
+ * @param preferredCol Column index to place the cursor in after deletion (default 0).
13
+ */
14
+ export declare function buildDeleteRowTransaction(state: EditorState, tableId: BlockId, rowIndex: number, preferredCol?: number): Transaction | null;
15
+ /**
16
+ * Builds a transaction that deletes the column at the given index.
17
+ * If it's the last column, delegates to `createDeleteTableTransaction`.
18
+ * @param preferredRow Row index to place the cursor in after deletion (default 0).
19
+ */
20
+ export declare function buildDeleteColumnTransaction(state: EditorState, tableId: BlockId, colIndex: number, preferredRow?: number): Transaction | null;
21
+ /**
22
+ * Creates a transaction that removes the given root-level table node.
23
+ * Cursor placement prefers the next root block, then previous.
24
+ */
25
+ export declare function createDeleteTableTransaction(state: EditorState, tableId: BlockId): Transaction | null;
26
+ /**
27
+ * Inserts a table with the given dimensions at the current cursor position.
28
+ * Adds a paragraph after the table for cursor escape.
29
+ * Moves cursor into the first cell.
30
+ */
31
+ export declare function insertTable(context: PluginContext, rows: number, cols: number): boolean;
32
+ /** Adds a row above the current row. */
33
+ export declare function addRowAbove(context: PluginContext): boolean;
34
+ /** Adds a row below the current row. */
35
+ export declare function addRowBelow(context: PluginContext): boolean;
36
+ /** Adds a column to the left of the current column. */
37
+ export declare function addColumnLeft(context: PluginContext): boolean;
38
+ /** Adds a column to the right of the current column. */
39
+ export declare function addColumnRight(context: PluginContext): boolean;
40
+ /** Deletes the current row. If it's the last row, deletes the entire table. */
41
+ export declare function deleteRow(context: PluginContext): boolean;
42
+ /** Deletes the current column. If it's the last column, deletes the entire table. */
43
+ export declare function deleteColumn(context: PluginContext): boolean;
44
+ /** Deletes the entire table and moves cursor to surrounding block. */
45
+ export declare function deleteTable(context: PluginContext): boolean;
46
+ /** Selects the surrounding table as a node object. */
47
+ export declare function selectTable(context: PluginContext): boolean;
48
+ /** Registers all table commands on the given plugin context. */
49
+ export declare function registerTableCommands(context: PluginContext): void;
50
+ //# sourceMappingURL=TableCommands.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TableCommands.d.ts","sourceRoot":"","sources":["../../../src/plugins/table/TableCommands.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAQH,OAAO,KAAK,EAAE,OAAO,EAAgB,MAAM,2BAA2B,CAAC;AAEvE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAalD,sEAAsE;AACtE,wBAAgB,yBAAyB,CACxC,KAAK,EAAE,WAAW,EAClB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,MAAM,GACd,WAAW,GAAG,IAAI,CAoBpB;AAED,yEAAyE;AACzE,wBAAgB,4BAA4B,CAC3C,KAAK,EAAE,WAAW,EAClB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,MAAM,GACd,WAAW,GAAG,IAAI,CAcpB;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CACxC,KAAK,EAAE,WAAW,EAClB,OAAO,EAAE,OA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';
2
+ import { EditorState } from '../../state/EditorState.js';
3
+ import { Transaction } from '../../state/Transaction.js';
4
+ export interface TableControlsHandle {
5
+ update(node: BlockNode): void;
6
+ destroy(): void;
7
+ }
8
+ /** Creates table controls for the given table element. */
9
+ export declare function createTableControls(container: HTMLElement, tableEl: HTMLTableElement, initialNode: BlockNode, getState: () => EditorState, dispatch: (tr: Transaction) => void): TableControlsHandle;
10
+ //# sourceMappingURL=TableControls.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TableControls.d.ts","sourceRoot":"","sources":["../../../src/plugins/table/TableControls.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAGzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AA8B9D,MAAM,WAAW,mBAAmB;IACnC,MAAM,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI,CAAC;IAC9B,OAAO,IAAI,IAAI,CAAC;CAChB;AAiQD,0DAA0D;AAC1D,wBAAgB,mBAAmB,CAClC,SAAS,EAAE,WAAW,EACtB,OAAO,EAAE,gBAAgB,EACzB,WAAW,EAAE,SAAS,EACtB,QAAQ,EAAE,MAAM,WAAW,EAC3B,QAAQ,EAAE,CAAC,EAAE,EAAE,WAAW,KAAK,IAAI,GACjC,mBAAmB,CAErB"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Pure DOM factory functions for table controls.
3
+ * No state logic — only element creation and CSS class assignment.
4
+ */
5
+ export declare const PLUS_SVG: string;
6
+ export declare const DELETE_SVG: string;
7
+ export declare const TABLE_DELETE_SVG: string;
8
+ /** Creates a button with standard table-control setup (mousedown prevention, ARIA). */
9
+ export declare function createButton(className: string, innerHTML: string, title: string): HTMLButtonElement;
10
+ /** Builds the insert-line element (horizontal or vertical) with a plus-icon button. */
11
+ export declare function buildInsertLine(orientation: 'horizontal' | 'vertical'): HTMLDivElement;
12
+ /** Builds a zone-button for adding rows or columns at the table edge. */
13
+ export declare function buildAddButton(className: string, title: string): HTMLButtonElement;
14
+ /** Builds a handle-bar container (for column or row handles). */
15
+ export declare function buildHandleBar(className: string): HTMLDivElement;
16
+ /** Builds a single column or row handle with a delete button. */
17
+ export declare function buildHandle(className: string, index: number, deleteLabel: string, onDelete: (idx: number) => void): HTMLDivElement;
18
+ //# sourceMappingURL=TableControlsDOM.d.ts.map