@prosekit/extensions 0.11.4 → 0.11.6

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 (384) hide show
  1. package/dist/commit/style.css +2 -0
  2. package/dist/commit/style.css.map +1 -0
  3. package/dist/commit/style.js +1 -0
  4. package/dist/drop-indicator-E7nCfdnR.js +58 -0
  5. package/dist/drop-indicator-E7nCfdnR.js.map +1 -0
  6. package/dist/enter-rule-RdhEA900.js +2 -1
  7. package/dist/enter-rule-RdhEA900.js.map +1 -0
  8. package/dist/file-DVUhe5KJ.js +134 -0
  9. package/dist/file-DVUhe5KJ.js.map +1 -0
  10. package/dist/gap-cursor/style.css +2 -0
  11. package/dist/gap-cursor/style.css.map +1 -0
  12. package/dist/gap-cursor/style.js +1 -0
  13. package/dist/index-DY6lIIYV.d.ts +134 -0
  14. package/dist/index-DY6lIIYV.d.ts.map +1 -0
  15. package/dist/{input-rule-Gji4N7Oe.js → input-rule-B17tpW4m.js} +3 -3
  16. package/dist/input-rule-B17tpW4m.js.map +1 -0
  17. package/dist/list/style.css +2 -0
  18. package/dist/list/style.css.map +1 -0
  19. package/dist/list/style.js +1 -0
  20. package/dist/loro/style.css +2 -0
  21. package/dist/loro/style.css.map +1 -0
  22. package/dist/loro/style.js +1 -0
  23. package/dist/{mark-rule-D7zaa32n.js → mark-rule-CGmswjQ_.js} +3 -3
  24. package/dist/mark-rule-CGmswjQ_.js.map +1 -0
  25. package/dist/{paste-rule-Cca3n5TA.js → paste-rule-BIztzELg.js} +5 -15
  26. package/dist/paste-rule-BIztzELg.js.map +1 -0
  27. package/dist/placeholder/style.css +2 -0
  28. package/dist/placeholder/style.css.map +1 -0
  29. package/dist/placeholder/style.js +1 -0
  30. package/dist/prosekit-extensions-autocomplete.d.ts +2 -1
  31. package/dist/prosekit-extensions-autocomplete.d.ts.map +1 -0
  32. package/dist/prosekit-extensions-autocomplete.js +2 -9
  33. package/dist/prosekit-extensions-autocomplete.js.map +1 -0
  34. package/dist/prosekit-extensions-blockquote.d.ts +2 -1
  35. package/dist/prosekit-extensions-blockquote.d.ts.map +1 -0
  36. package/dist/prosekit-extensions-blockquote.js +4 -4
  37. package/dist/prosekit-extensions-blockquote.js.map +1 -0
  38. package/dist/prosekit-extensions-bold.d.ts +2 -1
  39. package/dist/prosekit-extensions-bold.d.ts.map +1 -0
  40. package/dist/prosekit-extensions-bold.js +3 -2
  41. package/dist/prosekit-extensions-bold.js.map +1 -0
  42. package/dist/prosekit-extensions-code-block.d.ts +3 -2
  43. package/dist/prosekit-extensions-code-block.d.ts.map +1 -0
  44. package/dist/prosekit-extensions-code-block.js +5 -6
  45. package/dist/prosekit-extensions-code-block.js.map +1 -0
  46. package/dist/prosekit-extensions-code.d.ts +2 -1
  47. package/dist/prosekit-extensions-code.d.ts.map +1 -0
  48. package/dist/prosekit-extensions-code.js +3 -2
  49. package/dist/prosekit-extensions-code.js.map +1 -0
  50. package/dist/prosekit-extensions-commit.d.ts +2 -1
  51. package/dist/prosekit-extensions-commit.d.ts.map +1 -0
  52. package/dist/prosekit-extensions-commit.js +11 -13
  53. package/dist/prosekit-extensions-commit.js.map +1 -0
  54. package/dist/prosekit-extensions-doc.d.ts +2 -1
  55. package/dist/prosekit-extensions-doc.d.ts.map +1 -0
  56. package/dist/prosekit-extensions-doc.js +2 -1
  57. package/dist/prosekit-extensions-doc.js.map +1 -0
  58. package/dist/prosekit-extensions-drop-cursor.d.ts +2 -1
  59. package/dist/prosekit-extensions-drop-cursor.d.ts.map +1 -0
  60. package/dist/prosekit-extensions-drop-cursor.js +2 -1
  61. package/dist/prosekit-extensions-drop-cursor.js.map +1 -0
  62. package/dist/prosekit-extensions-drop-indicator.d.ts +5 -107
  63. package/dist/prosekit-extensions-drop-indicator.d.ts.map +1 -0
  64. package/dist/prosekit-extensions-drop-indicator.js +1 -1
  65. package/dist/prosekit-extensions-enter-rule.d.ts +2 -1
  66. package/dist/prosekit-extensions-enter-rule.d.ts.map +1 -0
  67. package/dist/prosekit-extensions-file.d.ts +2 -125
  68. package/dist/prosekit-extensions-file.js +1 -139
  69. package/dist/prosekit-extensions-gap-cursor.d.ts +2 -2
  70. package/dist/prosekit-extensions-gap-cursor.d.ts.map +1 -0
  71. package/dist/prosekit-extensions-gap-cursor.js +2 -1
  72. package/dist/prosekit-extensions-gap-cursor.js.map +1 -0
  73. package/dist/prosekit-extensions-hard-break.d.ts +2 -5
  74. package/dist/prosekit-extensions-hard-break.d.ts.map +1 -0
  75. package/dist/prosekit-extensions-hard-break.js +2 -1
  76. package/dist/prosekit-extensions-hard-break.js.map +1 -0
  77. package/dist/prosekit-extensions-heading.d.ts +2 -1
  78. package/dist/prosekit-extensions-heading.d.ts.map +1 -0
  79. package/dist/prosekit-extensions-heading.js +5 -6
  80. package/dist/prosekit-extensions-heading.js.map +1 -0
  81. package/dist/prosekit-extensions-horizontal-rule.d.ts +2 -1
  82. package/dist/prosekit-extensions-horizontal-rule.d.ts.map +1 -0
  83. package/dist/prosekit-extensions-horizontal-rule.js +5 -6
  84. package/dist/prosekit-extensions-horizontal-rule.js.map +1 -0
  85. package/dist/prosekit-extensions-image.d.ts +80 -3
  86. package/dist/prosekit-extensions-image.d.ts.map +1 -0
  87. package/dist/prosekit-extensions-image.js +90 -10
  88. package/dist/prosekit-extensions-image.js.map +1 -0
  89. package/dist/prosekit-extensions-input-rule.d.ts +2 -1
  90. package/dist/prosekit-extensions-input-rule.d.ts.map +1 -0
  91. package/dist/prosekit-extensions-input-rule.js +1 -1
  92. package/dist/prosekit-extensions-italic.d.ts +2 -1
  93. package/dist/prosekit-extensions-italic.d.ts.map +1 -0
  94. package/dist/prosekit-extensions-italic.js +3 -2
  95. package/dist/prosekit-extensions-italic.js.map +1 -0
  96. package/dist/prosekit-extensions-link.d.ts +2 -1
  97. package/dist/prosekit-extensions-link.d.ts.map +1 -0
  98. package/dist/prosekit-extensions-link.js +6 -5
  99. package/dist/prosekit-extensions-link.js.map +1 -0
  100. package/dist/prosekit-extensions-list.d.ts +22 -21
  101. package/dist/prosekit-extensions-list.d.ts.map +1 -0
  102. package/dist/prosekit-extensions-list.js +7 -8
  103. package/dist/prosekit-extensions-list.js.map +1 -0
  104. package/dist/prosekit-extensions-loro.d.ts +14 -13
  105. package/dist/prosekit-extensions-loro.d.ts.map +1 -0
  106. package/dist/prosekit-extensions-loro.js +2 -1
  107. package/dist/prosekit-extensions-loro.js.map +1 -0
  108. package/dist/prosekit-extensions-mark-rule.d.ts +2 -1
  109. package/dist/prosekit-extensions-mark-rule.d.ts.map +1 -0
  110. package/dist/prosekit-extensions-mark-rule.js +1 -1
  111. package/dist/prosekit-extensions-mention.d.ts +2 -1
  112. package/dist/prosekit-extensions-mention.d.ts.map +1 -0
  113. package/dist/prosekit-extensions-mention.js +2 -1
  114. package/dist/prosekit-extensions-mention.js.map +1 -0
  115. package/dist/prosekit-extensions-mod-click-prevention.d.ts +2 -1
  116. package/dist/prosekit-extensions-mod-click-prevention.d.ts.map +1 -0
  117. package/dist/prosekit-extensions-mod-click-prevention.js +2 -1
  118. package/dist/prosekit-extensions-mod-click-prevention.js.map +1 -0
  119. package/dist/prosekit-extensions-paragraph.d.ts +2 -5
  120. package/dist/prosekit-extensions-paragraph.d.ts.map +1 -0
  121. package/dist/prosekit-extensions-paragraph.js +2 -1
  122. package/dist/prosekit-extensions-paragraph.js.map +1 -0
  123. package/dist/prosekit-extensions-paste-rule.d.ts +2 -1
  124. package/dist/prosekit-extensions-paste-rule.d.ts.map +1 -0
  125. package/dist/prosekit-extensions-paste-rule.js +1 -1
  126. package/dist/prosekit-extensions-placeholder.d.ts +2 -1
  127. package/dist/prosekit-extensions-placeholder.d.ts.map +1 -0
  128. package/dist/prosekit-extensions-placeholder.js +5 -5
  129. package/dist/prosekit-extensions-placeholder.js.map +1 -0
  130. package/dist/prosekit-extensions-readonly.d.ts +2 -1
  131. package/dist/prosekit-extensions-readonly.d.ts.map +1 -0
  132. package/dist/prosekit-extensions-readonly.js +2 -1
  133. package/dist/prosekit-extensions-readonly.js.map +1 -0
  134. package/dist/prosekit-extensions-search.d.ts +2 -1
  135. package/dist/prosekit-extensions-search.d.ts.map +1 -0
  136. package/dist/prosekit-extensions-search.js +3 -3
  137. package/dist/prosekit-extensions-search.js.map +1 -0
  138. package/dist/prosekit-extensions-strike.d.ts +2 -1
  139. package/dist/prosekit-extensions-strike.d.ts.map +1 -0
  140. package/dist/prosekit-extensions-strike.js +3 -2
  141. package/dist/prosekit-extensions-strike.js.map +1 -0
  142. package/dist/prosekit-extensions-table.d.ts +47 -114
  143. package/dist/prosekit-extensions-table.d.ts.map +1 -0
  144. package/dist/prosekit-extensions-table.js +2 -2
  145. package/dist/prosekit-extensions-text-align.d.ts +2 -1
  146. package/dist/prosekit-extensions-text-align.d.ts.map +1 -0
  147. package/dist/prosekit-extensions-text-align.js +2 -1
  148. package/dist/prosekit-extensions-text-align.js.map +1 -0
  149. package/dist/prosekit-extensions-text.d.ts +2 -1
  150. package/dist/prosekit-extensions-text.d.ts.map +1 -0
  151. package/dist/prosekit-extensions-text.js +2 -1
  152. package/dist/prosekit-extensions-text.js.map +1 -0
  153. package/dist/prosekit-extensions-underline.d.ts +2 -1
  154. package/dist/prosekit-extensions-underline.d.ts.map +1 -0
  155. package/dist/prosekit-extensions-underline.js +2 -1
  156. package/dist/prosekit-extensions-underline.js.map +1 -0
  157. package/dist/prosekit-extensions-virtual-selection.d.ts +2 -1
  158. package/dist/prosekit-extensions-virtual-selection.d.ts.map +1 -0
  159. package/dist/prosekit-extensions-virtual-selection.js +3 -3
  160. package/dist/prosekit-extensions-virtual-selection.js.map +1 -0
  161. package/dist/prosekit-extensions-yjs.d.ts +2 -1
  162. package/dist/prosekit-extensions-yjs.d.ts.map +1 -0
  163. package/dist/prosekit-extensions-yjs.js +2 -1
  164. package/dist/prosekit-extensions-yjs.js.map +1 -0
  165. package/dist/prosekit-extensions.js +1 -0
  166. package/dist/search/style.css +2 -0
  167. package/dist/search/style.css.map +1 -0
  168. package/dist/search/style.js +1 -0
  169. package/dist/{shiki-highlighter-chunk-DSPM0T27.d.ts → shiki-highlighter-chunk-Cwu1Jr9o.d.ts} +2 -1
  170. package/dist/shiki-highlighter-chunk-Cwu1Jr9o.d.ts.map +1 -0
  171. package/dist/shiki-highlighter-chunk.d.ts +1 -1
  172. package/dist/shiki-highlighter-chunk.js +3 -5
  173. package/dist/shiki-highlighter-chunk.js.map +1 -0
  174. package/dist/table/style.css +2 -0
  175. package/dist/table/style.css.map +1 -0
  176. package/dist/table/style.js +1 -0
  177. package/dist/table-BNwuK7xg.js +297 -0
  178. package/dist/table-BNwuK7xg.js.map +1 -0
  179. package/dist/virtual-selection/style.css +2 -0
  180. package/dist/virtual-selection/style.css.map +1 -0
  181. package/dist/virtual-selection/style.js +1 -0
  182. package/dist/yjs/style.css +2 -0
  183. package/dist/yjs/style.css.map +1 -0
  184. package/dist/yjs/style.js +1 -0
  185. package/package.json +12 -10
  186. package/src/autocomplete/autocomplete-helpers.ts +74 -0
  187. package/src/autocomplete/autocomplete-plugin.ts +186 -0
  188. package/src/autocomplete/autocomplete-rule.ts +117 -0
  189. package/src/autocomplete/autocomplete.spec.ts +132 -0
  190. package/src/autocomplete/autocomplete.ts +29 -0
  191. package/src/autocomplete/index.ts +9 -0
  192. package/src/blockquote/blockquote-commands.ts +32 -0
  193. package/src/blockquote/blockquote-input-rule.ts +14 -0
  194. package/src/blockquote/blockquote-keymap.spec.ts +45 -0
  195. package/src/blockquote/blockquote-keymap.ts +31 -0
  196. package/src/blockquote/blockquote-spec.ts +24 -0
  197. package/src/blockquote/blockquote.ts +34 -0
  198. package/src/blockquote/index.ts +14 -0
  199. package/src/bold/bold-commands.ts +23 -0
  200. package/src/bold/bold-input-rule.spec.ts +51 -0
  201. package/src/bold/bold-input-rule.ts +18 -0
  202. package/src/bold/bold-keymap.ts +14 -0
  203. package/src/bold/bold-spec.ts +53 -0
  204. package/src/bold/bold.ts +32 -0
  205. package/src/bold/index.ts +14 -0
  206. package/src/code/code-commands.ts +23 -0
  207. package/src/code/code-input-rule.ts +18 -0
  208. package/src/code/code-keymap.ts +14 -0
  209. package/src/code/code-spec.ts +28 -0
  210. package/src/code/code.ts +32 -0
  211. package/src/code/index.ts +14 -0
  212. package/src/code-block/code-block-commands.ts +44 -0
  213. package/src/code-block/code-block-highlight.ts +40 -0
  214. package/src/code-block/code-block-input-rule.ts +36 -0
  215. package/src/code-block/code-block-keymap.ts +61 -0
  216. package/src/code-block/code-block-shiki.ts +58 -0
  217. package/src/code-block/code-block-spec.spec.ts +164 -0
  218. package/src/code-block/code-block-spec.ts +71 -0
  219. package/src/code-block/code-block-types.ts +8 -0
  220. package/src/code-block/code-block.ts +46 -0
  221. package/src/code-block/index.ts +32 -0
  222. package/src/code-block/shiki-bundle.ts +8 -0
  223. package/src/code-block/shiki-highlighter-chunk.ts +84 -0
  224. package/src/code-block/shiki-highlighter.ts +22 -0
  225. package/src/code-block/shiki-parser.ts +36 -0
  226. package/src/commit/index.ts +330 -0
  227. package/src/commit/style.css +7 -0
  228. package/src/doc/index.ts +21 -0
  229. package/src/drop-cursor/drop-cursor.ts +46 -0
  230. package/src/drop-cursor/index.ts +5 -0
  231. package/src/drop-indicator/drop-indicator-facet.ts +62 -0
  232. package/src/drop-indicator/drop-indicator.ts +35 -0
  233. package/src/drop-indicator/index.ts +14 -0
  234. package/src/enter-rule/index.ts +241 -0
  235. package/src/file/file-drop-handler.ts +75 -0
  236. package/src/file/file-paste-handler.spec.ts +95 -0
  237. package/src/file/file-paste-handler.ts +59 -0
  238. package/src/file/file-upload.ts +140 -0
  239. package/src/file/helpers.ts +39 -0
  240. package/src/file/index.ts +16 -0
  241. package/src/gap-cursor/gap-cursor.ts +28 -0
  242. package/src/gap-cursor/index.ts +4 -0
  243. package/src/gap-cursor/style.css +25 -0
  244. package/src/hard-break/hard-break-commands.ts +31 -0
  245. package/src/hard-break/hard-break-keymap.spec.ts +45 -0
  246. package/src/hard-break/hard-break-keymap.ts +16 -0
  247. package/src/hard-break/hard-break-spec.ts +31 -0
  248. package/src/hard-break/hard-break.ts +32 -0
  249. package/src/hard-break/index.ts +13 -0
  250. package/src/heading/heading-commands.ts +37 -0
  251. package/src/heading/heading-input-rule.ts +22 -0
  252. package/src/heading/heading-keymap.spec.ts +53 -0
  253. package/src/heading/heading-keymap.ts +40 -0
  254. package/src/heading/heading-spec.ts +39 -0
  255. package/src/heading/heading-types.ts +3 -0
  256. package/src/heading/heading.ts +34 -0
  257. package/src/heading/index.ts +15 -0
  258. package/src/horizontal-rule/horizontal-rule-commands.spec.ts +61 -0
  259. package/src/horizontal-rule/horizontal-rule-commands.ts +37 -0
  260. package/src/horizontal-rule/horizontal-rule-input-rule.spec.ts +61 -0
  261. package/src/horizontal-rule/horizontal-rule-input-rule.ts +26 -0
  262. package/src/horizontal-rule/horizontal-rule-spec.ts +21 -0
  263. package/src/horizontal-rule/horizontal-rule.ts +29 -0
  264. package/src/horizontal-rule/index.ts +14 -0
  265. package/src/image/image-commands.ts +36 -0
  266. package/src/image/image-spec.ts +72 -0
  267. package/src/image/image-upload-handler.ts +156 -0
  268. package/src/image/image.ts +25 -0
  269. package/src/image/index.ts +22 -0
  270. package/src/index.ts +1 -0
  271. package/src/input-rule/index.ts +237 -0
  272. package/src/italic/index.ts +14 -0
  273. package/src/italic/italic-commands.spec.ts +75 -0
  274. package/src/italic/italic-commands.ts +23 -0
  275. package/src/italic/italic-input-rule.spec.ts +25 -0
  276. package/src/italic/italic-input-rule.ts +18 -0
  277. package/src/italic/italic-keymap.ts +14 -0
  278. package/src/italic/italic-spec.ts +35 -0
  279. package/src/italic/italic.ts +34 -0
  280. package/src/link/index.spec.ts +88 -0
  281. package/src/link/index.ts +156 -0
  282. package/src/link/link-paste-rule.spec.ts +194 -0
  283. package/src/link/link-paste-rule.ts +22 -0
  284. package/src/link/link-regex.spec.ts +82 -0
  285. package/src/link/link-regex.ts +79 -0
  286. package/src/link/link-types.ts +8 -0
  287. package/src/list/index.ts +25 -0
  288. package/src/list/list-commands.ts +61 -0
  289. package/src/list/list-drop-indicator.ts +37 -0
  290. package/src/list/list-input-rules.ts +14 -0
  291. package/src/list/list-keymap.spec.ts +39 -0
  292. package/src/list/list-keymap.ts +48 -0
  293. package/src/list/list-plugins.ts +35 -0
  294. package/src/list/list-serializer.ts +38 -0
  295. package/src/list/list-spec.ts +60 -0
  296. package/src/list/list-types.spec.ts +10 -0
  297. package/src/list/list-types.ts +23 -0
  298. package/src/list/list.spec.ts +134 -0
  299. package/src/list/list.ts +38 -0
  300. package/src/list/style.css +128 -0
  301. package/src/loro/index.ts +17 -0
  302. package/src/loro/loro-commands.ts +27 -0
  303. package/src/loro/loro-cursor-plugin.ts +28 -0
  304. package/src/loro/loro-keymap.ts +23 -0
  305. package/src/loro/loro-sync-plugin.ts +14 -0
  306. package/src/loro/loro-undo-plugin.ts +12 -0
  307. package/src/loro/loro.ts +75 -0
  308. package/src/loro/style.css +33 -0
  309. package/src/mark-rule/apply.ts +129 -0
  310. package/src/mark-rule/index.ts +2 -0
  311. package/src/mark-rule/mark-rule.spec.ts +123 -0
  312. package/src/mark-rule/mark-rule.ts +48 -0
  313. package/src/mark-rule/range.ts +107 -0
  314. package/src/mark-rule/types.ts +30 -0
  315. package/src/mention/index.ts +90 -0
  316. package/src/mod-click-prevention/index.ts +35 -0
  317. package/src/paragraph/index.ts +7 -0
  318. package/src/paragraph/paragraph-commands.ts +29 -0
  319. package/src/paragraph/paragraph-keymap.ts +15 -0
  320. package/src/paragraph/paragraph-spec.ts +31 -0
  321. package/src/paragraph/paragraph.ts +37 -0
  322. package/src/paste-rule/index.ts +10 -0
  323. package/src/paste-rule/mark-paste-rule.spec.ts +112 -0
  324. package/src/paste-rule/mark-paste-rule.ts +194 -0
  325. package/src/paste-rule/paste-rule-plugin.ts +53 -0
  326. package/src/paste-rule/paste-rule.spec.ts +96 -0
  327. package/src/paste-rule/paste-rule.ts +60 -0
  328. package/src/paste-rule/split-text-by-regex.spec.ts +97 -0
  329. package/src/paste-rule/split-text-by-regex.ts +44 -0
  330. package/src/placeholder/index.ts +113 -0
  331. package/src/placeholder/style.css +7 -0
  332. package/src/readonly/index.ts +22 -0
  333. package/src/search/index.ts +140 -0
  334. package/src/search/style.css +13 -0
  335. package/src/strike/index.ts +101 -0
  336. package/src/table/index.ts +53 -0
  337. package/src/table/style.css +42 -0
  338. package/src/table/table-commands/delete-cell-selection.spec.ts +41 -0
  339. package/src/table/table-commands/delete-cell-selection.ts +1 -0
  340. package/src/table/table-commands/exit-table.spec.ts +45 -0
  341. package/src/table/table-commands/exit-table.ts +49 -0
  342. package/src/table/table-commands/insert-table.spec.ts +39 -0
  343. package/src/table/table-commands/insert-table.ts +80 -0
  344. package/src/table/table-commands/move-table-column.spec.ts +618 -0
  345. package/src/table/table-commands/move-table-column.ts +4 -0
  346. package/src/table/table-commands/move-table-row.spec.ts +380 -0
  347. package/src/table/table-commands/move-table-row.ts +4 -0
  348. package/src/table/table-commands/select-table-cell.spec.ts +34 -0
  349. package/src/table/table-commands/select-table-cell.ts +35 -0
  350. package/src/table/table-commands/select-table-column.spec.ts +33 -0
  351. package/src/table/table-commands/select-table-column.ts +39 -0
  352. package/src/table/table-commands/select-table-row.spec.ts +32 -0
  353. package/src/table/table-commands/select-table-row.ts +39 -0
  354. package/src/table/table-commands/select-table.spec.ts +36 -0
  355. package/src/table/table-commands/select-table.ts +50 -0
  356. package/src/table/table-commands.ts +110 -0
  357. package/src/table/table-drop-indicator.ts +40 -0
  358. package/src/table/table-plugins.ts +15 -0
  359. package/src/table/table-spec.spec.ts +113 -0
  360. package/src/table/table-spec.ts +109 -0
  361. package/src/table/table-utils.ts +16 -0
  362. package/src/table/table.ts +49 -0
  363. package/src/table/test-utils.ts +28 -0
  364. package/src/testing/clipboard.ts +58 -0
  365. package/src/testing/format-html.ts +5 -0
  366. package/src/testing/index.ts +161 -0
  367. package/src/testing/keyboard.ts +36 -0
  368. package/src/testing/markdown.ts +23 -0
  369. package/src/text/index.ts +24 -0
  370. package/src/text-align/index.ts +133 -0
  371. package/src/types/assert-type-equal.ts +8 -0
  372. package/src/underline/index.ts +83 -0
  373. package/src/virtual-selection/index.ts +100 -0
  374. package/src/virtual-selection/style.css +5 -0
  375. package/src/yjs/index.ts +22 -0
  376. package/src/yjs/style.css +31 -0
  377. package/src/yjs/yjs-commands.ts +27 -0
  378. package/src/yjs/yjs-cursor-plugin.ts +25 -0
  379. package/src/yjs/yjs-keymap.ts +23 -0
  380. package/src/yjs/yjs-sync-plugin.ts +23 -0
  381. package/src/yjs/yjs-undo-plugin.ts +87 -0
  382. package/src/yjs/yjs.ts +84 -0
  383. package/dist/drop-indicator-dB9rZn8e.js +0 -267
  384. package/dist/table-CPI9ZxbK.js +0 -760
@@ -57,4 +57,5 @@ function defineParagraph() {
57
57
  }
58
58
 
59
59
  //#endregion
60
- export { defineParagraph, defineParagraphCommands, defineParagraphKeymap, defineParagraphSpec };
60
+ export { defineParagraph, defineParagraphCommands, defineParagraphKeymap, defineParagraphSpec };
61
+ //# sourceMappingURL=prosekit-extensions-paragraph.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prosekit-extensions-paragraph.js","names":[],"sources":["../src/paragraph/paragraph-commands.ts","../src/paragraph/paragraph-keymap.ts","../src/paragraph/paragraph-spec.ts","../src/paragraph/paragraph.ts"],"sourcesContent":["import {\n defineCommands,\n setBlockType,\n type Extension,\n} from '@prosekit/core'\nimport type { Command } from '@prosekit/pm/state'\n\n/**\n * @internal\n */\nexport type ParagraphCommandsExtension = Extension<{\n Commands: {\n setParagraph: []\n }\n}>\n\n/**\n * @internal\n */\nexport function setParagraph(): Command {\n return setBlockType({ type: 'paragraph' })\n}\n\n/**\n * @internal\n */\nexport function defineParagraphCommands(): ParagraphCommandsExtension {\n return defineCommands({ setParagraph })\n}\n","import {\n defineKeymap,\n type PlainExtension,\n} from '@prosekit/core'\n\nimport { setParagraph } from './paragraph-commands'\n\n/**\n * @internal\n */\nexport function defineParagraphKeymap(): PlainExtension {\n return defineKeymap({\n 'mod-alt-0': setParagraph(),\n })\n}\n","import {\n defineNodeSpec,\n type Extension,\n} from '@prosekit/core'\nimport type { Attrs } from '@prosekit/pm/model'\n\n/**\n * @internal\n */\nexport type ParagraphSpecExtension = Extension<{\n Nodes: {\n paragraph: Attrs\n }\n}>\n\n/**\n * @internal\n *\n * Defines a paragraph node spec.\n */\nexport function defineParagraphSpec(): ParagraphSpecExtension {\n return defineNodeSpec({\n name: 'paragraph',\n content: 'inline*',\n group: 'block',\n parseDOM: [{ tag: 'p' }],\n toDOM() {\n return ['p', 0]\n },\n })\n}\n","import {\n Priority,\n union,\n withPriority,\n type Union,\n} from '@prosekit/core'\n\nimport {\n defineParagraphCommands,\n type ParagraphCommandsExtension,\n} from './paragraph-commands'\nimport { defineParagraphKeymap } from './paragraph-keymap'\nimport {\n defineParagraphSpec,\n type ParagraphSpecExtension,\n} from './paragraph-spec'\n\n/**\n * @internal\n */\nexport type ParagraphExtension = Union<[ParagraphSpecExtension, ParagraphCommandsExtension]>\n\n/**\n * @public\n *\n * Defines a paragraph node.\n *\n * The paragraph node spec has the highest priority, because it should be the\n * default block node for most cases.\n */\nexport function defineParagraph(): ParagraphExtension {\n return union(\n withPriority(defineParagraphSpec(), Priority.highest),\n defineParagraphCommands(),\n defineParagraphKeymap(),\n )\n}\n"],"mappings":";;;;;;AAmBA,SAAgB,eAAwB;AACtC,QAAO,aAAa,EAAE,MAAM,aAAa,CAAC;;;;;AAM5C,SAAgB,0BAAsD;AACpE,QAAO,eAAe,EAAE,cAAc,CAAC;;;;;;;;ACjBzC,SAAgB,wBAAwC;AACtD,QAAO,aAAa,EAClB,aAAa,cAAc,EAC5B,CAAC;;;;;;;;;;ACOJ,SAAgB,sBAA8C;AAC5D,QAAO,eAAe;EACpB,MAAM;EACN,SAAS;EACT,OAAO;EACP,UAAU,CAAC,EAAE,KAAK,KAAK,CAAC;EACxB,QAAQ;AACN,UAAO,CAAC,KAAK,EAAE;;EAElB,CAAC;;;;;;;;;;;;;ACCJ,SAAgB,kBAAsC;AACpD,QAAO,MACL,aAAa,qBAAqB,EAAE,SAAS,QAAQ,EACrD,yBAAyB,EACzB,uBAAuB,CACxB"}
@@ -90,4 +90,5 @@ declare function definePasteRule({
90
90
  handler
91
91
  }: PasteRuleOptions): PlainExtension;
92
92
  //#endregion
93
- export { type MarkPasteRuleOptions, type PasteRuleHandler, type PasteRuleHandlerOptions, type PasteRuleOptions, defineMarkPasteRule, definePasteRule };
93
+ export { type MarkPasteRuleOptions, type PasteRuleHandler, type PasteRuleHandlerOptions, type PasteRuleOptions, defineMarkPasteRule, definePasteRule };
94
+ //# sourceMappingURL=prosekit-extensions-paste-rule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prosekit-extensions-paste-rule.d.ts","names":[],"sources":["../src/paste-rule/mark-paste-rule.ts","../src/paste-rule/paste-rule.ts"],"sourcesContent":[],"mappings":";;;;;;;;;AAsBA;;AAKS,UALQ,oBAAA,CAKR;;;;;EAmB4B,KAAA,EAnB5B,MAmB4B;EAQrB;;;MAAoD,EAAA,MAAA,GAtBnD,QAsBmD;EAAc;;;;AC3ClF;;UAIS,CAAA,EAAA,CAAA,KAAA,EDyBY,eCzBZ,EAAA,GDyBgC,KCzBhC,GAAA,IAAA,GAAA,SAAA,GAAA,KAAA;;;AAoBT;;YAAyC,CAAA,EAAA,CAAA,IAAA,EDWnB,eCXmB,EAAA,GAAA,OAAA;;;AAOzC;AAeA;;;AAA6C,iBDH7B,mBAAA,CCG6B,OAAA,EDHA,oBCGA,CAAA,EDHuB,cCGvB;;;;;ADnC7C;;;AAUiB,UCrBA,uBAAA,CDqBA;;;;EAcoB,KAAA,EC/B5B,KD+B4B;EAQrB;;;MAAoD,EClC5D,UDkC4D;EAAc;;;;EC3CjE,KAAA,EAAA,OAAA;;;;;AAwBjB;;;AAAqE,KAAzD,gBAAA,GAAyD,CAAA,OAAA,EAA5B,uBAA4B,EAAA,GAAA,KAAA;;AAOrE;AAeA;;;AAA6C,UAf5B,gBAAA,CAe4B;;;;WAXlC;;;;;;;;;;iBAWK,eAAA;;GAA6B,mBAAmB"}
@@ -1,3 +1,3 @@
1
- import { defineMarkPasteRule, definePasteRule } from "./paste-rule-Cca3n5TA.js";
1
+ import { defineMarkPasteRule, definePasteRule } from "./paste-rule-BIztzELg.js";
2
2
 
3
3
  export { defineMarkPasteRule, definePasteRule };
@@ -30,4 +30,5 @@ interface PlaceholderOptions {
30
30
  */
31
31
  declare function definePlaceholder(options: PlaceholderOptions): PlainExtension;
32
32
  //#endregion
33
- export { PlaceholderOptions, definePlaceholder };
33
+ export { PlaceholderOptions, definePlaceholder };
34
+ //# sourceMappingURL=prosekit-extensions-placeholder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prosekit-extensions-placeholder.d.ts","names":[],"sources":["../src/placeholder/index.ts"],"sourcesContent":[],"mappings":";;;;UAmBiB,kBAAA;;AAAjB;;;aAqBwC,EAAA,MAAA,GAAA,CAAA,CAAA,KAAA,EAhBP,WAgBO,EAAA,GAAA,MAAA,CAAA;EAAW;AAOnD;;;;;;;;;;;;;wCAPwC;;;;;;iBAOxB,iBAAA,UAA2B,qBAAqB"}
@@ -1,5 +1,5 @@
1
- import "./drop-indicator-dB9rZn8e.js";
2
- import { findTable } from "./table-CPI9ZxbK.js";
1
+ import "./drop-indicator-E7nCfdnR.js";
2
+ import { findTable } from "./table-BNwuK7xg.js";
3
3
  import { definePlugin, isInCodeBlock, maybeRun } from "@prosekit/core";
4
4
  import { Plugin, PluginKey } from "@prosekit/pm/state";
5
5
  import { Decoration, DecorationSet } from "@prosekit/pm/view";
@@ -16,8 +16,7 @@ function createPlaceholderPlugin({ placeholder, strategy = "block" }) {
16
16
  return new Plugin({
17
17
  key: new PluginKey("prosekit-placeholder"),
18
18
  props: { decorations: (state) => {
19
- const strategyFn = typeof strategy === "function" ? strategy : strategy === "doc" ? docStrategy : defaultStrategy;
20
- if (!strategyFn(state)) return null;
19
+ if (!(typeof strategy === "function" ? strategy : strategy === "doc" ? docStrategy : defaultStrategy)(state)) return null;
21
20
  const placeholderText = maybeRun(placeholder, state);
22
21
  const deco = createPlaceholderDecoration(state, placeholderText);
23
22
  if (!deco) return null;
@@ -49,4 +48,5 @@ function createPlaceholderDecoration(state, placeholderText) {
49
48
  }
50
49
 
51
50
  //#endregion
52
- export { definePlaceholder };
51
+ export { definePlaceholder };
52
+ //# sourceMappingURL=prosekit-extensions-placeholder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prosekit-extensions-placeholder.js","names":["placeholderText: string"],"sources":["../src/placeholder/index.ts"],"sourcesContent":["import {\n definePlugin,\n isInCodeBlock,\n maybeRun,\n type PlainExtension,\n} from '@prosekit/core'\nimport type { ProseMirrorNode } from '@prosekit/pm/model'\nimport {\n Plugin,\n PluginKey,\n type EditorState,\n} from '@prosekit/pm/state'\nimport {\n Decoration,\n DecorationSet,\n} from '@prosekit/pm/view'\n\nimport { findTable } from '../table'\n\nexport interface PlaceholderOptions {\n /**\n * The placeholder to use. It can be a static string or a function that\n * receives the current editor state and returns a string.\n */\n placeholder: string | ((state: EditorState) => string)\n\n /**\n * By default, the placeholder text will be shown whenever the current text\n * cursor is in an empty text node and it's not inside a code block or a\n * table node.\n *\n * If you only want to show the placeholder when the whole doc is empty, you\n * can set this option to 'doc'.\n *\n * You can also pass a function that receives the current editor state and\n * returns a boolean value to determine whether the placeholder should be\n * shown.\n *\n * @default 'block'\n */\n strategy?: 'doc' | 'block' | ((state: EditorState) => boolean)\n}\n\n/**\n * Add a placeholder text to the editor when the current block or document is\n * empty.\n */\nexport function definePlaceholder(options: PlaceholderOptions): PlainExtension {\n return definePlugin(createPlaceholderPlugin(options))\n}\n\nfunction createPlaceholderPlugin({\n placeholder,\n strategy = 'block',\n}: PlaceholderOptions): Plugin {\n return new Plugin({\n key: new PluginKey('prosekit-placeholder'),\n props: {\n decorations: (state) => {\n const strategyFn = typeof strategy === 'function'\n ? strategy\n : strategy === 'doc'\n ? docStrategy\n : defaultStrategy\n\n if (!strategyFn(state)) {\n return null\n }\n\n const placeholderText: string = maybeRun(placeholder, state)\n const deco = createPlaceholderDecoration(state, placeholderText)\n if (!deco) {\n return null\n }\n\n return DecorationSet.create(state.doc, [deco])\n },\n },\n })\n}\n\nfunction defaultStrategy(state: EditorState): boolean {\n return !isInCodeBlock(state.selection) && !findTable(state.selection.$from)\n}\n\nfunction docStrategy(state: EditorState): boolean {\n return isDocEmpty(state.doc) && defaultStrategy(state)\n}\n\nfunction isDocEmpty(doc: ProseMirrorNode) {\n return doc.childCount <= 1 && !doc.firstChild?.content.size\n}\n\nfunction createPlaceholderDecoration(\n state: EditorState,\n placeholderText: string,\n): Decoration | null {\n if (!placeholderText) return null\n\n const { selection } = state\n if (!selection.empty) return null\n\n const $pos = selection.$anchor\n const node = $pos.parent\n if (node.content.size > 0) return null\n\n const before = $pos.before()\n\n return Decoration.node(before, before + node.nodeSize, {\n 'class': 'prosekit-placeholder',\n 'data-placeholder': placeholderText,\n })\n}\n"],"mappings":";;;;;;;;;;;AA+CA,SAAgB,kBAAkB,SAA6C;AAC7E,QAAO,aAAa,wBAAwB,QAAQ,CAAC;;AAGvD,SAAS,wBAAwB,EAC/B,aACA,WAAW,WACkB;AAC7B,QAAO,IAAI,OAAO;EAChB,KAAK,IAAI,UAAU,uBAAuB;EAC1C,OAAO,EACL,cAAc,UAAU;AAOtB,OAAI,EANe,OAAO,aAAa,aACnC,WACA,aAAa,QACb,cACA,iBAEY,MAAM,CACpB,QAAO;GAGT,MAAMA,kBAA0B,SAAS,aAAa,MAAM;GAC5D,MAAM,OAAO,4BAA4B,OAAO,gBAAgB;AAChE,OAAI,CAAC,KACH,QAAO;AAGT,UAAO,cAAc,OAAO,MAAM,KAAK,CAAC,KAAK,CAAC;KAEjD;EACF,CAAC;;AAGJ,SAAS,gBAAgB,OAA6B;AACpD,QAAO,CAAC,cAAc,MAAM,UAAU,IAAI,CAAC,UAAU,MAAM,UAAU,MAAM;;AAG7E,SAAS,YAAY,OAA6B;AAChD,QAAO,WAAW,MAAM,IAAI,IAAI,gBAAgB,MAAM;;AAGxD,SAAS,WAAW,KAAsB;AACxC,QAAO,IAAI,cAAc,KAAK,CAAC,IAAI,YAAY,QAAQ;;AAGzD,SAAS,4BACP,OACA,iBACmB;AACnB,KAAI,CAAC,gBAAiB,QAAO;CAE7B,MAAM,EAAE,cAAc;AACtB,KAAI,CAAC,UAAU,MAAO,QAAO;CAE7B,MAAM,OAAO,UAAU;CACvB,MAAM,OAAO,KAAK;AAClB,KAAI,KAAK,QAAQ,OAAO,EAAG,QAAO;CAElC,MAAM,SAAS,KAAK,QAAQ;AAE5B,QAAO,WAAW,KAAK,QAAQ,SAAS,KAAK,UAAU;EACrD,SAAS;EACT,oBAAoB;EACrB,CAAC"}
@@ -7,4 +7,5 @@ import { PlainExtension } from "@prosekit/core";
7
7
  */
8
8
  declare function defineReadonly(): PlainExtension;
9
9
  //#endregion
10
- export { defineReadonly };
10
+ export { defineReadonly };
11
+ //# sourceMappingURL=prosekit-extensions-readonly.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prosekit-extensions-readonly.d.ts","names":[],"sources":["../src/readonly/index.ts"],"sourcesContent":[],"mappings":";;;;;;AAYA;iBAAgB,cAAA,CAAA,GAAkB"}
@@ -14,4 +14,5 @@ const plugin = new ProseMirrorPlugin({
14
14
  });
15
15
 
16
16
  //#endregion
17
- export { defineReadonly };
17
+ export { defineReadonly };
18
+ //# sourceMappingURL=prosekit-extensions-readonly.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prosekit-extensions-readonly.js","names":[],"sources":["../src/readonly/index.ts"],"sourcesContent":["import {\n definePlugin,\n type PlainExtension,\n} from '@prosekit/core'\nimport {\n PluginKey,\n ProseMirrorPlugin,\n} from '@prosekit/pm/state'\n\n/**\n * Make the editor read-only.\n */\nexport function defineReadonly(): PlainExtension {\n return definePlugin(plugin)\n}\n\nconst plugin = new ProseMirrorPlugin({\n key: new PluginKey('prosekey-readonly'),\n props: {\n editable: () => false,\n },\n})\n"],"mappings":";;;;;;;AAYA,SAAgB,iBAAiC;AAC/C,QAAO,aAAa,OAAO;;AAG7B,MAAM,SAAS,IAAI,kBAAkB;CACnC,KAAK,IAAI,UAAU,oBAAoB;CACvC,OAAO,EACL,gBAAgB,OACjB;CACF,CAAC"}
@@ -71,4 +71,5 @@ type SearchCommandsExtension = Extension<{
71
71
  */
72
72
  declare function defineSearchCommands(): SearchCommandsExtension;
73
73
  //#endregion
74
- export { SearchCommandsExtension, SearchQueryOptions, defineSearchCommands, defineSearchQuery };
74
+ export { SearchCommandsExtension, SearchQueryOptions, defineSearchCommands, defineSearchQuery };
75
+ //# sourceMappingURL=prosekit-extensions-search.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prosekit-extensions-search.d.ts","names":[],"sources":["../src/search/index.ts"],"sourcesContent":[],"mappings":";;;;;;AA0BA;AA+CA;;AAA2C,UA/C1B,kBAAA,CA+C0B;;;AAqC3C;EAkBgB,MAAA,EAAA,MAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAvDA,iBAAA,UAA2B,qBAAqB;;;;KAqCpD,uBAAA,GAA0B;;;;;;;;;;;;;;;;;iBAkBtB,oBAAA,CAAA,GAAwB"}
@@ -16,8 +16,7 @@ function defineSearchQuery(options) {
16
16
  */
17
17
  function scrollActiveIntoView(view) {
18
18
  if (view.isDestroyed) return;
19
- const active = view.dom.querySelector(".ProseMirror-active-search-match");
20
- active?.scrollIntoView({
19
+ view.dom.querySelector(".ProseMirror-active-search-match")?.scrollIntoView({
21
20
  block: "nearest",
22
21
  inline: "nearest",
23
22
  behavior: "smooth"
@@ -53,4 +52,5 @@ function defineSearchCommands() {
53
52
  }
54
53
 
55
54
  //#endregion
56
- export { defineSearchCommands, defineSearchQuery };
55
+ export { defineSearchCommands, defineSearchQuery };
56
+ //# sourceMappingURL=prosekit-extensions-search.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prosekit-extensions-search.js","names":[],"sources":["../src/search/index.ts"],"sourcesContent":["import {\n defineCommands,\n definePlugin,\n type Extension,\n type PlainExtension,\n} from '@prosekit/core'\nimport type { Command } from '@prosekit/pm/state'\nimport type { EditorView } from '@prosekit/pm/view'\nimport {\n findNext,\n findNextNoWrap,\n findPrev,\n findPrevNoWrap,\n replaceAll,\n replaceCurrent,\n replaceNext,\n replaceNextNoWrap,\n search,\n SearchQuery,\n} from 'prosemirror-search'\n\n/**\n * Options for {@link defineSearchQuery}\n *\n * @public\n */\nexport interface SearchQueryOptions {\n /**\n * The search string (or regular expression).\n */\n search: string\n\n /**\n * The replace text.\n */\n replace?: string\n\n /**\n * Indicates whether the search is case-sensitive\n *\n * @default false\n */\n caseSensitive?: boolean\n\n /**\n * By default, string search will replace `\\n`, `\\r`, and `\\t` in the query\n * with newline, return, and tab characters. When this is set to true, that\n * behavior is disabled.\n *\n * @default false\n */\n literal?: boolean\n\n /**\n * When true, the search string is interpreted as a regular expression.\n *\n * @default false\n */\n regexp?: boolean\n\n /**\n * Enable whole-word matching.\n *\n * @default false\n */\n wholeWord?: boolean\n}\n\n/**\n * Defines an extension that stores a current search query and replace string.\n *\n * @public\n */\nexport function defineSearchQuery(options: SearchQueryOptions): PlainExtension {\n const query = new SearchQuery(options)\n return definePlugin(search({ initialQuery: query }))\n}\n\n/**\n * Scrolls the active search match into view.\n */\nfunction scrollActiveIntoView(view: EditorView) {\n if (view.isDestroyed) return\n const active = view.dom.querySelector('.ProseMirror-active-search-match')\n active?.scrollIntoView({\n block: 'nearest',\n inline: 'nearest',\n behavior: 'smooth',\n })\n}\n\n/**\n * Wraps a command and scrolls the active search match into view when the command\n * is applied.\n */\nfunction withScrollActiveIntoView(command: Command): Command {\n return (state, dispatch, view) => {\n const result = command(state, dispatch, view)\n if (result && dispatch && view) {\n // Add a small delay because the command itself will handle scrolling if\n // the view is focused.\n setTimeout(() => scrollActiveIntoView(view), 50)\n }\n return result\n }\n}\n\n/**\n * @internal\n */\nexport type SearchCommandsExtension = Extension<{\n Commands: {\n findNext: []\n findPrev: []\n findNextNoWrap: []\n findPrevNoWrap: []\n replaceNext: []\n replaceNextNoWrap: []\n replaceCurrent: []\n replaceAll: []\n }\n}>\n\n/**\n * Defines commands for search and replace.\n *\n * @public\n */\nexport function defineSearchCommands(): SearchCommandsExtension {\n return defineCommands({\n findNext: () => withScrollActiveIntoView(findNext),\n findPrev: () => withScrollActiveIntoView(findPrev),\n findNextNoWrap: () => withScrollActiveIntoView(findNextNoWrap),\n findPrevNoWrap: () => withScrollActiveIntoView(findPrevNoWrap),\n replaceNext: () => withScrollActiveIntoView(replaceNext),\n replaceNextNoWrap: () => withScrollActiveIntoView(replaceNextNoWrap),\n replaceCurrent: () => withScrollActiveIntoView(replaceCurrent),\n replaceAll: () => withScrollActiveIntoView(replaceAll),\n })\n}\n"],"mappings":";;;;;;;;;AAyEA,SAAgB,kBAAkB,SAA6C;CAC7E,MAAM,QAAQ,IAAI,YAAY,QAAQ;AACtC,QAAO,aAAa,OAAO,EAAE,cAAc,OAAO,CAAC,CAAC;;;;;AAMtD,SAAS,qBAAqB,MAAkB;AAC9C,KAAI,KAAK,YAAa;AAEtB,CADe,KAAK,IAAI,cAAc,mCAAmC,EACjE,eAAe;EACrB,OAAO;EACP,QAAQ;EACR,UAAU;EACX,CAAC;;;;;;AAOJ,SAAS,yBAAyB,SAA2B;AAC3D,SAAQ,OAAO,UAAU,SAAS;EAChC,MAAM,SAAS,QAAQ,OAAO,UAAU,KAAK;AAC7C,MAAI,UAAU,YAAY,KAGxB,kBAAiB,qBAAqB,KAAK,EAAE,GAAG;AAElD,SAAO;;;;;;;;AAyBX,SAAgB,uBAAgD;AAC9D,QAAO,eAAe;EACpB,gBAAgB,yBAAyB,SAAS;EAClD,gBAAgB,yBAAyB,SAAS;EAClD,sBAAsB,yBAAyB,eAAe;EAC9D,sBAAsB,yBAAyB,eAAe;EAC9D,mBAAmB,yBAAyB,YAAY;EACxD,yBAAyB,yBAAyB,kBAAkB;EACpE,sBAAsB,yBAAyB,eAAe;EAC9D,kBAAkB,yBAAyB,WAAW;EACvD,CAAC"}
@@ -44,4 +44,5 @@ type StrikeExtension = Union<[StrikeSpecExtension, StrikeCommandsExtension]>;
44
44
  */
45
45
  declare function defineStrike(): StrikeExtension;
46
46
  //#endregion
47
- export { StrikeCommandsExtension, StrikeExtension, StrikeSpecExtension, defineStrike, defineStrikeCommands, defineStrikeInputRule, defineStrikeKeymap, defineStrikeSpec };
47
+ export { StrikeCommandsExtension, StrikeExtension, StrikeSpecExtension, defineStrike, defineStrikeCommands, defineStrikeInputRule, defineStrikeKeymap, defineStrikeSpec };
48
+ //# sourceMappingURL=prosekit-extensions-strike.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prosekit-extensions-strike.d.ts","names":[],"sources":["../src/strike/index.ts"],"sourcesContent":[],"mappings":";;;;;;;AAkBA;AAA+B,KAAnB,mBAAA,GAAsB,SAAH,CAAA;OAEnB,EAAA;IAFsB,MAAA,EAEtB,KAFsB;EAAS,CAAA;AAS3C,CAAA,CAAA;AAmBA;AASA;AASA;AAUgB,iBA/CA,gBAAA,CAAA,CA+CyB,EA/CL,mBA+CmB;AAYvD;;;AACwB,KAzCZ,uBAAA,GAA0B,SAyCd,CAAA;UADM,EAAA;IAAK,YAAA,EAAA,EAAA;EAOnB,CAAA;;;;;iBAtCA,oBAAA,CAAA,GAAwB;;;;iBASxB,kBAAA,CAAA,GAAsB;;;;iBAUtB,qBAAA,CAAA,GAAyB;;;;KAY7B,eAAA,GAAkB,OAC3B,qBAAqB;;;;iBAMR,YAAA,CAAA,GAAgB"}
@@ -1,4 +1,4 @@
1
- import { defineMarkInputRule } from "./input-rule-Gji4N7Oe.js";
1
+ import { defineMarkInputRule } from "./input-rule-B17tpW4m.js";
2
2
  import { canUseRegexLookbehind, defineCommands, defineKeymap, defineMarkSpec, toggleMark, union } from "@prosekit/core";
3
3
 
4
4
  //#region src/strike/index.ts
@@ -52,4 +52,5 @@ function defineStrike() {
52
52
  }
53
53
 
54
54
  //#endregion
55
- export { defineStrike, defineStrikeCommands, defineStrikeInputRule, defineStrikeKeymap, defineStrikeSpec };
55
+ export { defineStrike, defineStrikeCommands, defineStrikeInputRule, defineStrikeKeymap, defineStrikeSpec };
56
+ //# sourceMappingURL=prosekit-extensions-strike.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prosekit-extensions-strike.js","names":[],"sources":["../src/strike/index.ts"],"sourcesContent":["import {\n canUseRegexLookbehind,\n defineCommands,\n defineKeymap,\n defineMarkSpec,\n toggleMark,\n union,\n type Extension,\n type PlainExtension,\n type Union,\n} from '@prosekit/core'\nimport type { Attrs } from '@prosekit/pm/model'\n\nimport { defineMarkInputRule } from '../input-rule'\n\n/**\n * @internal\n */\nexport type StrikeSpecExtension = Extension<{\n Marks: {\n strike: Attrs\n }\n}>\n\n/**\n * @internal\n */\nexport function defineStrikeSpec(): StrikeSpecExtension {\n return defineMarkSpec({\n name: 'strike',\n parseDOM: [\n { tag: 's' },\n { tag: 'strike' },\n { tag: 'del' },\n { style: 'text-decoration=line-through' },\n { style: 'text-decoration-line=line-through' },\n ],\n toDOM() {\n return ['s', 0]\n },\n })\n}\n\n/**\n * @internal\n */\nexport type StrikeCommandsExtension = Extension<{\n Commands: {\n toggleStrike: []\n }\n}>\n\n/**\n * @internal\n */\nexport function defineStrikeCommands(): StrikeCommandsExtension {\n return defineCommands({\n toggleStrike: () => toggleMark({ type: 'strike' }),\n })\n}\n\n/**\n * @internal\n */\nexport function defineStrikeKeymap(): PlainExtension {\n return defineKeymap({\n 'Mod-shift-s': toggleMark({ type: 'strike' }),\n 'Mod-shift-x': toggleMark({ type: 'strike' }),\n })\n}\n\n/**\n * @internal\n */\nexport function defineStrikeInputRule(): PlainExtension {\n return defineMarkInputRule({\n regex: canUseRegexLookbehind()\n ? /(?<=\\s|^)~~([^\\s~]|[^\\s~][^~]*[^\\s~])~~$/\n : /~~([^\\s~]|[^\\s~][^~]*[^\\s~])~~$/,\n type: 'strike',\n })\n}\n\n/**\n * @internal\n */\nexport type StrikeExtension = Union<\n [StrikeSpecExtension, StrikeCommandsExtension]\n>\n\n/**\n * @public\n */\nexport function defineStrike(): StrikeExtension {\n return union(\n defineStrikeSpec(),\n defineStrikeCommands(),\n defineStrikeKeymap(),\n defineStrikeInputRule(),\n )\n}\n"],"mappings":";;;;;;;AA2BA,SAAgB,mBAAwC;AACtD,QAAO,eAAe;EACpB,MAAM;EACN,UAAU;GACR,EAAE,KAAK,KAAK;GACZ,EAAE,KAAK,UAAU;GACjB,EAAE,KAAK,OAAO;GACd,EAAE,OAAO,gCAAgC;GACzC,EAAE,OAAO,qCAAqC;GAC/C;EACD,QAAQ;AACN,UAAO,CAAC,KAAK,EAAE;;EAElB,CAAC;;;;;AAeJ,SAAgB,uBAAgD;AAC9D,QAAO,eAAe,EACpB,oBAAoB,WAAW,EAAE,MAAM,UAAU,CAAC,EACnD,CAAC;;;;;AAMJ,SAAgB,qBAAqC;AACnD,QAAO,aAAa;EAClB,eAAe,WAAW,EAAE,MAAM,UAAU,CAAC;EAC7C,eAAe,WAAW,EAAE,MAAM,UAAU,CAAC;EAC9C,CAAC;;;;;AAMJ,SAAgB,wBAAwC;AACtD,QAAO,oBAAoB;EACzB,OAAO,uBAAuB,GAC1B,6CACA;EACJ,MAAM;EACP,CAAC;;;;;AAaJ,SAAgB,eAAgC;AAC9C,QAAO,MACL,kBAAkB,EAClB,sBAAsB,EACtB,oBAAoB,EACpB,uBAAuB,CACxB"}
@@ -1,110 +1,71 @@
1
- import { Extension, FindParentNodeResult, PlainExtension, Union } from "@prosekit/core";
2
- import { Command, Selection } from "@prosekit/pm/state";
3
- import { Attrs, ProseMirrorNode, ResolvedPos } from "@prosekit/pm/model";
4
- import { CellSelection } from "prosemirror-tables";
1
+ import { Extension, PlainExtension, Union } from "@prosekit/core";
2
+ import { Command } from "@prosekit/pm/state";
3
+ import { Attrs } from "@prosekit/pm/model";
4
+ import { CellSelection, MoveTableColumnOptions, MoveTableRowOptions, findTable, moveTableColumn, moveTableRow } from "prosemirror-tables";
5
5
 
6
- //#region src/table/table-commands/move-table-column.d.ts
6
+ //#region src/table/table-commands/insert-table.d.ts
7
7
  /**
8
- * Options for {@link moveTableColumn}
9
- *
10
8
  * @public
11
9
  */
12
- interface MoveTableColumnOptions {
10
+ interface InsertTableOptions {
13
11
  /**
14
- * The source column index to move from.
12
+ * The number of rows in the table.
15
13
  */
16
- from: number;
14
+ row: number;
17
15
  /**
18
- * The destination column index to move to.
16
+ * The number of columns in the table.
19
17
  */
20
- to: number;
18
+ col: number;
21
19
  /**
22
- * Whether to select the moved column after the operation.
20
+ * Whether the table has a header row.
23
21
  *
24
- * @default true
25
- */
26
- select?: boolean;
27
- /**
28
- * Optional position to resolve table from. If not provided, uses the current selection.
22
+ * @default false
29
23
  */
30
- pos?: number;
24
+ header?: boolean;
31
25
  }
32
26
  /**
33
- * Move a table column from index `origin` to index `target`.
27
+ * Insert a table node with the given number of rows and columns, and optionally
28
+ * a header row.
29
+ *
30
+ * @param options
34
31
  *
35
32
  * @public
36
33
  */
37
- declare function moveTableColumn(options: MoveTableColumnOptions): Command;
34
+ declare function insertTable(options: InsertTableOptions): Command;
38
35
  //#endregion
39
- //#region src/table/table-commands/move-table-row.d.ts
36
+ //#region src/table/table-commands/select-table.d.ts
40
37
  /**
41
- * Options for {@link moveTableRow}
42
- *
43
38
  * @public
44
39
  */
45
- interface MoveTableRowOptions {
46
- /**
47
- * The source row index to move from.
48
- */
49
- from: number;
50
- /**
51
- * The destination row index to move to.
52
- */
53
- to: number;
54
- /**
55
- * Whether to select the moved row after the operation.
56
- *
57
- * @default true
58
- */
59
- select?: boolean;
40
+ interface SelectTableOptions {
60
41
  /**
61
- * Optional position to resolve table from. If not provided, uses the current selection.
42
+ * A hit position of the table to select from. By default, the selection
43
+ * anchor will be used.
62
44
  */
63
45
  pos?: number;
64
46
  }
65
47
  /**
66
- * Move a table row from index `origin` to index `target`.
67
- *
68
48
  * @public
69
49
  */
70
- declare function moveTableRow(options: MoveTableRowOptions): Command;
50
+ declare function selectTable(options?: SelectTableOptions): Command;
71
51
  //#endregion
72
- //#region src/table/table-commands.d.ts
52
+ //#region src/table/table-commands/select-table-cell.d.ts
73
53
  /**
74
54
  * @public
75
55
  */
76
- interface InsertTableOptions {
77
- /**
78
- * The number of rows in the table.
79
- */
80
- row: number;
81
- /**
82
- * The number of columns in the table.
83
- */
84
- col: number;
56
+ interface SelectTableCellOptions {
85
57
  /**
86
- * Whether the table has a header row.
87
- *
88
- * @default false
58
+ * A hit position of the table cell to select from. By default, the selection
59
+ * anchor will be used.
89
60
  */
90
- header?: boolean;
61
+ pos?: number;
91
62
  }
92
63
  /**
93
- * Insert a table node with the given number of rows and columns, and optionally
94
- * a header row.
95
- *
96
- * @param options
97
- *
98
64
  * @public
99
65
  */
100
- declare function insertTable(options: InsertTableOptions): Command;
101
- /**
102
- * When the selection is in a table node, create a default block after the table
103
- * table, and move the cursor there.
104
- *
105
- * @public
106
- */
107
- declare const exitTable: Command;
66
+ declare function selectTableCell(options?: SelectTableCellOptions): Command;
67
+ //#endregion
68
+ //#region src/table/table-commands/select-table-column.d.ts
108
69
  /**
109
70
  * @public
110
71
  */
@@ -124,6 +85,8 @@ interface SelectTableColumnOptions {
124
85
  * @public
125
86
  */
126
87
  declare function selectTableColumn(options?: SelectTableColumnOptions): Command;
88
+ //#endregion
89
+ //#region src/table/table-commands/select-table-row.d.ts
127
90
  /**
128
91
  * @public
129
92
  */
@@ -143,34 +106,8 @@ interface SelectTableRowOptions {
143
106
  * @public
144
107
  */
145
108
  declare function selectTableRow(options?: SelectTableRowOptions): Command;
146
- /**
147
- * @public
148
- */
149
- interface SelectTableCellOptions {
150
- /**
151
- * A hit position of the table cell to select from. By default, the selection
152
- * anchor will be used.
153
- */
154
- pos?: number;
155
- }
156
- /**
157
- * @public
158
- */
159
- declare function selectTableCell(options?: SelectTableCellOptions): Command;
160
- /**
161
- * @public
162
- */
163
- interface SelectTableOptions {
164
- /**
165
- * A hit position of the table to select from. By default, the selection
166
- * anchor will be used.
167
- */
168
- pos?: number;
169
- }
170
- /**
171
- * @public
172
- */
173
- declare function selectTable(options?: SelectTableOptions): Command;
109
+ //#endregion
110
+ //#region src/table/table-commands.d.ts
174
111
  /**
175
112
  * @internal
176
113
  */
@@ -268,6 +205,15 @@ type TableExtension = Union<[TableSpecExtension, TableRowSpecExtension, TableCel
268
205
  */
269
206
  declare function defineTable(): TableExtension;
270
207
  //#endregion
208
+ //#region src/table/table-commands/exit-table.d.ts
209
+ /**
210
+ * When the selection is in a table node, create a default block after the table
211
+ * table, and move the cursor there.
212
+ *
213
+ * @public
214
+ */
215
+ declare const exitTable: Command;
216
+ //#endregion
271
217
  //#region src/table/table-drop-indicator.d.ts
272
218
  /**
273
219
  * Hides the drop indicator when dragging a table column or row by using the
@@ -283,26 +229,13 @@ declare function defineTableDropIndicator(): PlainExtension;
283
229
  */
284
230
  declare function defineTablePlugins(): PlainExtension;
285
231
  //#endregion
286
- //#region src/table/table-utils/query.d.ts
232
+ //#region src/table/table-utils.d.ts
287
233
  /**
288
234
  * Checks if the given object is a `CellSelection` instance.
289
235
  *
290
236
  * @public
291
237
  */
292
238
  declare function isCellSelection(value: unknown): value is CellSelection;
293
- /**
294
- * Find the closest table node.
295
- *
296
- * @internal
297
- */
298
- declare function findTable($pos: ResolvedPos): FindParentNodeResult | undefined;
299
- /**
300
- * Try to find the anchor and head cell in the same table by using the given
301
- * anchor and head as hit points, or fallback to the selection's anchor and
302
- * head.
303
- *
304
- * @internal
305
- */
306
-
307
239
  //#endregion
308
- export { type InsertTableOptions, type MoveTableColumnOptions, type MoveTableRowOptions, type SelectTableCellOptions, type SelectTableColumnOptions, type SelectTableOptions, type SelectTableRowOptions, type TableCellSpecExtension, type TableCommandsExtension, type TableExtension, type TableHeaderCellSpecExtension, type TableRowSpecExtension, type TableSpecExtension, defineTable, defineTableCellSpec, defineTableCommands, defineTableDropIndicator, defineTableHeaderCellSpec, defineTablePlugins, defineTableRowSpec, defineTableSpec, exitTable, findTable, insertTable, isCellSelection, moveTableColumn, moveTableRow, selectTable, selectTableCell, selectTableColumn, selectTableRow };
240
+ export { type InsertTableOptions, type MoveTableColumnOptions, type MoveTableRowOptions, type SelectTableCellOptions, type SelectTableColumnOptions, type SelectTableOptions, type SelectTableRowOptions, type TableCellSpecExtension, type TableCommandsExtension, type TableExtension, type TableHeaderCellSpecExtension, type TableRowSpecExtension, type TableSpecExtension, defineTable, defineTableCellSpec, defineTableCommands, defineTableDropIndicator, defineTableHeaderCellSpec, defineTablePlugins, defineTableRowSpec, defineTableSpec, exitTable, findTable, insertTable, isCellSelection, moveTableColumn, moveTableRow, selectTable, selectTableCell, selectTableColumn, selectTableRow };
241
+ //# sourceMappingURL=prosekit-extensions-table.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prosekit-extensions-table.d.ts","names":[],"sources":["../src/table/table-commands/insert-table.ts","../src/table/table-commands/select-table.ts","../src/table/table-commands/select-table-cell.ts","../src/table/table-commands/select-table-column.ts","../src/table/table-commands/select-table-row.ts","../src/table/table-commands.ts","../src/table/table-spec.ts","../src/table/table.ts","../src/table/table-commands/exit-table.ts","../src/table/table-drop-indicator.ts","../src/table/table-plugins.ts","../src/table/table-utils.ts"],"sourcesContent":[],"mappings":";;;;;;;;;UA8CiB,kBAAA;;AAAjB;AA2BA;EAA2B,GAAA,EAAA,MAAA;;;;;;;AC9D3B;AAWA;;QAAsC,CAAA,EAAA,OAAA;;;;;;ACdtC;AAWA;;;AAAmE,iBFsDnD,WAAA,CEtDmD,OAAA,EFsD9B,kBEtD8B,CAAA,EFsDT,OEtDS;;;;;;UDRlD,kBAAA;;ADmCjB;AA2BA;;KAAqC,CAAA,EAAA,MAAA;;;;;iBCnDrB,WAAA,WAAsB,qBAAqB;;;;;;UCd1C,sBAAA;;AFsCjB;AA2BA;;KAAqC,CAAA,EAAA,MAAA;;;;;iBEtDrB,eAAA,WAA0B,yBAAyB;;;;;;UCXlD,wBAAA;;AHsCjB;AA2BA;;QAAqC,CAAA,EAAA,MAAA;;;;;;AC9DrC;AAWA;;;AAA2D,iBEG3C,iBAAA,CFH2C,OAAA,CAAA,EEGf,wBFHe,CAAA,EEGY,OFHZ;;;;;;UGd1C,qBAAA;;AJsCjB;AA2BA;;QAAqC,CAAA,EAAA,MAAA;;;;;;AC9DrC;AAWA;;;AAA2D,iBGG3C,cAAA,CHH2C,OAAA,CAAA,EGGlB,qBHHkB,CAAA,EGGM,OHHN;;;;;;ADmDM,KKvBrD,sBAAA,GAAyB,SLuB4B,CAAA;;2BKrBtC;;IJzCV,WAAA,EAAA,CAAA,OAAkB,GI4CP,kBJ5CO,CAAA;IAWnB,eAAW,EAAA,CAAA,OAAA,GIkCK,sBJlCL,CAAA;IAAA,iBAAA,EAAA,CAAA,OAAA,GImCO,wBJnCP,CAAA;IAAW,cAAA,EAAA,CAAA,OAAA,GIoCP,qBJpCO,CAAA;IAAqB,oBAAA,EAAA,EAAA;IAAO,mBAAA,EAAA,EAAA;;;;ICdjD,iBAAA,EAAA,EAAsB;IAWvB,cAAe,EAAA,EAAA;IAAA,mBAAA,EAAA,EAAA;IAAW,eAAA,EAAA,EAAA;IAAyB,cAAA,EAAA,EAAA;IAAO,YAAA,EAAA,CAAA,OAAA,EGsD9C,mBHtD8C,CAAA;+BGuD3C;;;AFlE/B;AAiBA;;;;AAA8E,iBE0D9D,mBAAA,CAAA,CF1D8D,EE0DvC,sBF1DuC;;;;;;UGV7D,SAAA;EN+BA,OAAA,CAAA,EAAA,MAAA;EA2BD,OAAA,CAAA,EAAA,MAAW;EAAA,QAAA,CAAA,EAAA,MAAA,EAAA,GAAA,IAAA;;;;;KM3Cf,kBAAA,GAAqB;;ILnBhB,KAAA,EKqBN,KLrBM;EAWD,CAAA;CAAW,CAAA;;;;iBKuBX,eAAA,CAAA,GAAmB;;;AJrCnC;AAWgB,KIqCJ,qBAAA,GAAwB,SJrCL,CAAA;EAAA,KAAA,EAAA;IAAW,QAAA,EIuC5B,KJvC4B;;CAAgC,CAAA;;;;ACXzD,iBGyDD,kBAAA,CAAA,CHzDyB,EGyDH,qBHzDG;AAiBzC;;;AAAuE,KGmD3D,sBAAA,GAAyB,SHnDkC,CAAA;EAAO,KAAA,EAAA;eGqD/D;;;AFtEf;AAiBA;;AAAyC,iBE4DzB,mBAAA,CAAA,CF5DyB,EE4DF,sBF5DE;;;;KEuE7B,4BAAA,GAA+B;;ID9C/B,eAAA,ECgDS,SDhDa;EAAA,CAAA;;AAKN,iBC+CZ,yBAAA,CAAA,CD/CY,EC+CiB,4BD/CjB;;;;;;ALTX,KOrBL,cAAA,GAAiB,KPqBM,CAAA,COnB/B,kBP8CuB,EO7CvB,qBP6CuB,EO5CvB,sBP4CiC,EO3CjC,4BP2CsD,EO1CtD,sBP0C6D;;;AC9DjE;AAWgB,iBMgBA,WAAA,CAAA,CNhBW,EMgBI,cNhBJ;;;;;;;;ADwB3B;AA2BgB,cQ9DH,SR8Dc,EQ9DH,OR8DG;;;;;;;;AA3B3B;AA2BgB,iBS9DA,wBAAA,CAAA,CT8DW,ES9DiB,cT8DjB;;;;;;iBU7DX,kBAAA,CAAA,GAAsB;;;;;;;AVkCtC;AA2BgB,iBW5DA,eAAA,CX4DW,KAAA,EAAA,OAAA,CAAA,EAAA,KAAA,IW5D+B,aX4D/B"}
@@ -1,4 +1,4 @@
1
- import "./drop-indicator-dB9rZn8e.js";
2
- import { defineTable, defineTableCellSpec, defineTableCommands, defineTableDropIndicator, defineTableHeaderCellSpec, defineTablePlugins, defineTableRowSpec, defineTableSpec, exitTable, findTable, insertTable, isCellSelection, moveTableColumn, moveTableRow, selectTable, selectTableCell, selectTableColumn, selectTableRow } from "./table-CPI9ZxbK.js";
1
+ import "./drop-indicator-E7nCfdnR.js";
2
+ import { defineTable, defineTableCellSpec, defineTableCommands, defineTableDropIndicator, defineTableHeaderCellSpec, defineTablePlugins, defineTableRowSpec, defineTableSpec, exitTable, findTable, insertTable, isCellSelection, moveTableColumn, moveTableRow, selectTable, selectTableCell, selectTableColumn, selectTableRow } from "./table-BNwuK7xg.js";
3
3
 
4
4
  export { defineTable, defineTableCellSpec, defineTableCommands, defineTableDropIndicator, defineTableHeaderCellSpec, defineTablePlugins, defineTableRowSpec, defineTableSpec, exitTable, findTable, insertTable, isCellSelection, moveTableColumn, moveTableRow, selectTable, selectTableCell, selectTableColumn, selectTableRow };
@@ -68,4 +68,5 @@ type TextAlignExtension<NodeName extends string> = Union<[TextAlignAttrsExtensio
68
68
  */
69
69
  declare function defineTextAlign<NodeName extends string = string>(options: TextAlignOptions<NodeName>): TextAlignExtension<NodeName>;
70
70
  //#endregion
71
- export { TextAlignAttrsExtension, TextAlignCommandsExtension, TextAlignExtension, TextAlignOptions, defineTextAlign, defineTextAlignCommands, defineTextAlignKeymap, setTextAlign };
71
+ export { TextAlignAttrsExtension, TextAlignCommandsExtension, TextAlignExtension, TextAlignOptions, defineTextAlign, defineTextAlignCommands, defineTextAlignKeymap, setTextAlign };
72
+ //# sourceMappingURL=prosekit-extensions-text-align.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prosekit-extensions-text-align.d.ts","names":[],"sources":["../src/text-align/index.ts"],"sourcesContent":[],"mappings":";;;;;;;AAeA;AAqCY,UArCK,gBAqCkB,CAAA,iBAAA,MAAA,GAAA,MAAA,CAAA,CAAA;EAAA;;;;AAiBnC;;;OAEE,EAhDO,QAgDP,EAAA;;;AAWF;AASA;AAWA;EAYY,OAAA,CAAA,EAAA,MAAA;;;;;AAA8C,KA9D9C,uBA8D8C,CAAA,iBAAA,MAAA,CAAA,GA9DK,SA8DL,CAAA;EAAK,KAAA,EAAA,QA7D9C,QAuEc,GAAA;IAAA,SAAA,EAAA,MAAA,GAAA,IAAA;EACH,CAAA;;;;;iBAxDZ,YAAA;;;;;;IAMZ;;;;KAOQ,0BAAA,GAA6B;;;;;;;;iBASzB,uBAAA,mBAEb;;;;iBASa,qBAAA,mBAAwC;;;;KAY5C,8CAA8C,OACvD,wBAAwB,WAAW;;;;;;;iBAStB,2DACL,iBAAiB,YACzB,mBAAmB"}
@@ -71,4 +71,5 @@ function defineTextAlign(options) {
71
71
  }
72
72
 
73
73
  //#endregion
74
- export { defineTextAlign, defineTextAlignCommands, defineTextAlignKeymap, setTextAlign };
74
+ export { defineTextAlign, defineTextAlignCommands, defineTextAlignKeymap, setTextAlign };
75
+ //# sourceMappingURL=prosekit-extensions-text-align.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prosekit-extensions-text-align.js","names":[],"sources":["../src/text-align/index.ts"],"sourcesContent":["import {\n defineCommands,\n defineKeymap,\n defineNodeAttr,\n setNodeAttrs,\n union,\n type Extension,\n type PlainExtension,\n type Union,\n} from '@prosekit/core'\nimport type { Command } from '@prosekit/pm/state'\n\n/**\n * @public\n */\nexport interface TextAlignOptions<NodeName extends string = string> {\n /**\n * The names of node to add the attribute to.\n *\n * @example\n *\n * [\"paragraph\", \"heading\"]\n */\n types: NodeName[]\n\n /**\n * The default value for the attribute.\n *\n * @default \"left\"\n */\n default?: string\n}\n\nfunction defineTextAlignAttr<NodeName extends string>(\n type: NodeName,\n defaultValue: string | null,\n) {\n return defineNodeAttr<NodeName, 'textAlign', string | null>({\n type,\n attr: 'textAlign',\n default: defaultValue,\n splittable: true,\n toDOM: (value: any) => (value ? ['style', `text-align:${value};`] : null),\n parseDOM: (node: HTMLElement) => {\n return node.style.getPropertyValue('text-align') || null\n },\n })\n}\n\n/**\n * @internal\n */\nexport type TextAlignAttrsExtension<NodeName extends string> = Extension<{\n Nodes: { [K in NodeName]: { textAlign: string | null } }\n}>\n\n/**\n * @internal\n */\nfunction defineTextAlignAttrs<NodeName extends string>(\n types: NodeName[],\n defaultValue: string | null,\n): TextAlignAttrsExtension<NodeName> {\n return union(types.map((type) => defineTextAlignAttr(type, defaultValue)))\n}\n\n/**\n * @internal\n */\nexport function setTextAlign({\n types,\n value,\n}: {\n types: string[]\n value: string | null\n}): Command {\n return setNodeAttrs({ type: types, attrs: { textAlign: value } })\n}\n\n/**\n * @internal\n */\nexport type TextAlignCommandsExtension = Extension<{\n Commands: {\n setTextAlign: [value: string | null]\n }\n}>\n\n/**\n * @internal\n */\nexport function defineTextAlignCommands(\n types: string[],\n): TextAlignCommandsExtension {\n return defineCommands({\n setTextAlign: (value: string | null) => setTextAlign({ types, value }),\n })\n}\n\n/**\n * @internal\n */\nexport function defineTextAlignKeymap(types: string[]): PlainExtension {\n return defineKeymap({\n 'mod-shift-l': setTextAlign({ types, value: 'left' }),\n 'mod-shift-e': setTextAlign({ types, value: 'center' }),\n 'mod-shift-r': setTextAlign({ types, value: 'right' }),\n 'mod-shift-j': setTextAlign({ types, value: 'justify' }),\n })\n}\n\n/**\n * @internal\n */\nexport type TextAlignExtension<NodeName extends string> = Union<\n [TextAlignAttrsExtension<NodeName>, TextAlignCommandsExtension]\n>\n\n/**\n * Adds a `textAlign` attribute to the specified nodes. This will be rendered as\n * a CSS `text-align` style.\n *\n * @public\n */\nexport function defineTextAlign<NodeName extends string = string>(\n options: TextAlignOptions<NodeName>,\n): TextAlignExtension<NodeName> {\n return union(\n defineTextAlignAttrs<NodeName>(options.types, options.default || 'left'),\n defineTextAlignKeymap(options.types),\n defineTextAlignCommands(options.types),\n )\n}\n"],"mappings":";;;AAiCA,SAAS,oBACP,MACA,cACA;AACA,QAAO,eAAqD;EAC1D;EACA,MAAM;EACN,SAAS;EACT,YAAY;EACZ,QAAQ,UAAgB,QAAQ,CAAC,SAAS,cAAc,MAAM,GAAG,GAAG;EACpE,WAAW,SAAsB;AAC/B,UAAO,KAAK,MAAM,iBAAiB,aAAa,IAAI;;EAEvD,CAAC;;;;;AAaJ,SAAS,qBACP,OACA,cACmC;AACnC,QAAO,MAAM,MAAM,KAAK,SAAS,oBAAoB,MAAM,aAAa,CAAC,CAAC;;;;;AAM5E,SAAgB,aAAa,EAC3B,OACA,SAIU;AACV,QAAO,aAAa;EAAE,MAAM;EAAO,OAAO,EAAE,WAAW,OAAO;EAAE,CAAC;;;;;AAenE,SAAgB,wBACd,OAC4B;AAC5B,QAAO,eAAe,EACpB,eAAe,UAAyB,aAAa;EAAE;EAAO;EAAO,CAAC,EACvE,CAAC;;;;;AAMJ,SAAgB,sBAAsB,OAAiC;AACrE,QAAO,aAAa;EAClB,eAAe,aAAa;GAAE;GAAO,OAAO;GAAQ,CAAC;EACrD,eAAe,aAAa;GAAE;GAAO,OAAO;GAAU,CAAC;EACvD,eAAe,aAAa;GAAE;GAAO,OAAO;GAAS,CAAC;EACtD,eAAe,aAAa;GAAE;GAAO,OAAO;GAAW,CAAC;EACzD,CAAC;;;;;;;;AAgBJ,SAAgB,gBACd,SAC8B;AAC9B,QAAO,MACL,qBAA+B,QAAQ,OAAO,QAAQ,WAAW,OAAO,EACxE,sBAAsB,QAAQ,MAAM,EACpC,wBAAwB,QAAQ,MAAM,CACvC"}
@@ -16,4 +16,5 @@ type TextExtension = Extension<{
16
16
  */
17
17
  declare function defineText(): TextExtension;
18
18
  //#endregion
19
- export { TextExtension, defineText };
19
+ export { TextExtension, defineText };
20
+ //# sourceMappingURL=prosekit-extensions-text.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prosekit-extensions-text.d.ts","names":[],"sources":["../src/text/index.ts"],"sourcesContent":[],"mappings":";;;;;;;AASA;AAAyB,KAAb,aAAA,GAAgB,SAAH,CAAA;OAEf,EAAA;IAFkB,IAAA,EAElB,KAFkB;EAAS,CAAA;AASrC,CAAA,CAAA;;;;iBAAgB,UAAA,CAAA,GAAc"}
@@ -12,4 +12,5 @@ function defineText() {
12
12
  }
13
13
 
14
14
  //#endregion
15
- export { defineText };
15
+ export { defineText };
16
+ //# sourceMappingURL=prosekit-extensions-text.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prosekit-extensions-text.js","names":[],"sources":["../src/text/index.ts"],"sourcesContent":["import {\n defineNodeSpec,\n type Extension,\n} from '@prosekit/core'\nimport type { Attrs } from '@prosekit/pm/model'\n\n/**\n * @internal\n */\nexport type TextExtension = Extension<{\n Nodes: {\n text: Attrs\n }\n}>\n\n/**\n * @public\n */\nexport function defineText(): TextExtension {\n return defineNodeSpec({\n name: 'text',\n group: 'inline',\n })\n}\n"],"mappings":";;;;;;AAkBA,SAAgB,aAA4B;AAC1C,QAAO,eAAe;EACpB,MAAM;EACN,OAAO;EACR,CAAC"}
@@ -40,4 +40,5 @@ type UnderlineExtension = Union<[UnderlineSpecExtension, UnderlineCommandsExtens
40
40
  */
41
41
  declare function defineUnderline(): UnderlineExtension;
42
42
  //#endregion
43
- export { UnderlineCommandsExtension, UnderlineExtension, UnderlineSpecExtension, defineUnderline, defineUnderlineCommands, defineUnderlineKeymap, defineUnderlineSpec };
43
+ export { UnderlineCommandsExtension, UnderlineExtension, UnderlineSpecExtension, defineUnderline, defineUnderlineCommands, defineUnderlineKeymap, defineUnderlineSpec };
44
+ //# sourceMappingURL=prosekit-extensions-underline.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prosekit-extensions-underline.d.ts","names":[],"sources":["../src/underline/index.ts"],"sourcesContent":[],"mappings":";;;;;;;AAeA;AAAkC,KAAtB,sBAAA,GAAyB,SAAH,CAAA;OAEnB,EAAA;IAFsB,SAAA,EAEtB,KAFsB;EAAS,CAAA;AAS9C,CAAA,CAAA;AAkBA;AASA;AASA;AASY,iBA7CI,mBAAA,CAAA,CA6Cc,EA7CS,sBA6CT;;;;AAAG,KA3BrB,0BAAA,GAA6B,SA2BR,CAAA;EAAK,QAAA,EAAA;IAOtB,eAAe,EAAA,EAAA;;;;;;iBAzBf,uBAAA,CAAA,GAA2B;;;;iBAS3B,qBAAA,CAAA,GAAyB;;;;KAS7B,kBAAA,GAAqB,OAC9B,wBAAwB;;;;iBAMX,eAAA,CAAA,GAAmB"}
@@ -38,4 +38,5 @@ function defineUnderline() {
38
38
  }
39
39
 
40
40
  //#endregion
41
- export { defineUnderline, defineUnderlineCommands, defineUnderlineKeymap, defineUnderlineSpec };
41
+ export { defineUnderline, defineUnderlineCommands, defineUnderlineKeymap, defineUnderlineSpec };
42
+ //# sourceMappingURL=prosekit-extensions-underline.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prosekit-extensions-underline.js","names":[],"sources":["../src/underline/index.ts"],"sourcesContent":["import {\n defineCommands,\n defineKeymap,\n defineMarkSpec,\n toggleMark,\n union,\n type Extension,\n type PlainExtension,\n type Union,\n} from '@prosekit/core'\nimport type { Attrs } from '@prosekit/pm/model'\n\n/**\n * @internal\n */\nexport type UnderlineSpecExtension = Extension<{\n Marks: {\n underline: Attrs\n }\n}>\n\n/**\n * @internal\n */\nexport function defineUnderlineSpec(): UnderlineSpecExtension {\n return defineMarkSpec({\n name: 'underline',\n parseDOM: [\n { tag: 'u' },\n { tag: 'underline' },\n { style: 'text-decoration=underline' },\n { style: 'text-decoration-line=underline' },\n ],\n toDOM() {\n return ['u', 0]\n },\n })\n}\n\n/**\n * @internal\n */\nexport type UnderlineCommandsExtension = Extension<{\n Commands: {\n toggleUnderline: []\n }\n}>\n\n/**\n * @internal\n */\nexport function defineUnderlineCommands(): UnderlineCommandsExtension {\n return defineCommands({\n toggleUnderline: () => toggleMark({ type: 'underline' }),\n })\n}\n\n/**\n * @internal\n */\nexport function defineUnderlineKeymap(): PlainExtension {\n return defineKeymap({\n 'Mod-u': toggleMark({ type: 'underline' }),\n })\n}\n\n/**\n * @internal\n */\nexport type UnderlineExtension = Union<\n [UnderlineSpecExtension, UnderlineCommandsExtension]\n>\n\n/**\n * @public\n */\nexport function defineUnderline(): UnderlineExtension {\n return union(\n defineUnderlineSpec(),\n defineUnderlineCommands(),\n defineUnderlineKeymap(),\n )\n}\n"],"mappings":";;;;;;AAwBA,SAAgB,sBAA8C;AAC5D,QAAO,eAAe;EACpB,MAAM;EACN,UAAU;GACR,EAAE,KAAK,KAAK;GACZ,EAAE,KAAK,aAAa;GACpB,EAAE,OAAO,6BAA6B;GACtC,EAAE,OAAO,kCAAkC;GAC5C;EACD,QAAQ;AACN,UAAO,CAAC,KAAK,EAAE;;EAElB,CAAC;;;;;AAeJ,SAAgB,0BAAsD;AACpE,QAAO,eAAe,EACpB,uBAAuB,WAAW,EAAE,MAAM,aAAa,CAAC,EACzD,CAAC;;;;;AAMJ,SAAgB,wBAAwC;AACtD,QAAO,aAAa,EAClB,SAAS,WAAW,EAAE,MAAM,aAAa,CAAC,EAC3C,CAAC;;;;;AAaJ,SAAgB,kBAAsC;AACpD,QAAO,MACL,qBAAqB,EACrB,yBAAyB,EACzB,uBAAuB,CACxB"}
@@ -18,4 +18,5 @@ type VirtualSelectionExtension = PlainExtension;
18
18
  */
19
19
  declare function defineVirtualSelection(): VirtualSelectionExtension;
20
20
  //#endregion
21
- export { VirtualSelectionExtension, defineVirtualSelection };
21
+ export { VirtualSelectionExtension, defineVirtualSelection };
22
+ //# sourceMappingURL=prosekit-extensions-virtual-selection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prosekit-extensions-virtual-selection.d.ts","names":[],"sources":["../src/virtual-selection/index.ts"],"sourcesContent":[],"mappings":";;;;;;AAkBA;AAYgB,KAZJ,yBAAA,GAA4B,cAYE;;;;;;;;;;;iBAA1B,sBAAA,CAAA,GAA0B"}
@@ -41,8 +41,7 @@ const virtualSelectionPlugin = new ProseMirrorPlugin({
41
41
  },
42
42
  blur: (view) => {
43
43
  const { dom, root } = view;
44
- const activeElement = root.activeElement;
45
- if (activeElement === dom) return;
44
+ if (root.activeElement === dom) return;
46
45
  view.dispatch(setFocusMeta(view.state.tr, true));
47
46
  }
48
47
  },
@@ -55,4 +54,5 @@ const virtualSelectionPlugin = new ProseMirrorPlugin({
55
54
  });
56
55
 
57
56
  //#endregion
58
- export { defineVirtualSelection };
57
+ export { defineVirtualSelection };
58
+ //# sourceMappingURL=prosekit-extensions-virtual-selection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prosekit-extensions-virtual-selection.js","names":[],"sources":["../src/virtual-selection/index.ts"],"sourcesContent":["import {\n definePlugin,\n type PlainExtension,\n} from '@prosekit/core'\nimport {\n PluginKey,\n ProseMirrorPlugin,\n type EditorState,\n type Transaction,\n} from '@prosekit/pm/state'\nimport {\n Decoration,\n DecorationSet,\n} from '@prosekit/pm/view'\n\n/**\n * @internal\n */\nexport type VirtualSelectionExtension = PlainExtension\n\n/**\n * Shows a virtual selection when the editor is not focused. When the editor is\n * not focused, the selected inline content will be wrapped in a `<span>`\n * element with the class `prosekit-virtual-selection`.\n *\n * This is useful when you want to move the focus to an element outside the\n * editor, but still want to show the selection.\n *\n * @public\n */\nexport function defineVirtualSelection(): VirtualSelectionExtension {\n return definePlugin(virtualSelectionPlugin)\n}\n\n// Show the decoration when this is true.\ntype PluginState = boolean\n\nconst key = new PluginKey<PluginState>('prosekit-virtual-selection')\n\nfunction getFocusMeta(tr: Transaction): PluginState | undefined {\n return tr.getMeta(key) as PluginState | undefined\n}\n\nfunction setFocusMeta(tr: Transaction, value: PluginState) {\n return tr.setMeta(key, value)\n}\n\nfunction getFocusState(state: EditorState): PluginState | undefined {\n return key.getState(state)\n}\n\nconst virtualSelectionPlugin = new ProseMirrorPlugin<PluginState>({\n key,\n state: {\n init: () => false,\n apply: (tr, value) => {\n return getFocusMeta(tr) ?? value\n },\n },\n props: {\n handleDOMEvents: {\n focus: (view) => {\n view.dispatch(setFocusMeta(view.state.tr, false))\n },\n\n blur: (view) => {\n const { dom, root } = view\n const activeElement = root.activeElement\n\n // Don't show the decoration if the dom is blurred because the focus\n // moved outside the browser window.\n if (activeElement === dom) return\n\n view.dispatch(setFocusMeta(view.state.tr, true))\n },\n },\n decorations: (state) => {\n const { selection, doc } = state\n\n if (\n selection.empty\n || !getFocusState(state)\n // When `selection.visible` is false, it indicates that the selection is\n // rendered by the editor and it's not a native browser selection. An\n // example of this is `NodeSelection`. In this situation, since the\n // editor already shows the selection, we don't need to display a\n // virtual selection.\n || !selection.visible\n ) {\n return null\n }\n\n return DecorationSet.create(doc, [\n Decoration.inline(selection.from, selection.to, {\n class: 'prosekit-virtual-selection',\n }),\n ])\n },\n },\n})\n"],"mappings":";;;;;;;;;;;;;;;AA8BA,SAAgB,yBAAoD;AAClE,QAAO,aAAa,uBAAuB;;AAM7C,MAAM,MAAM,IAAI,UAAuB,6BAA6B;AAEpE,SAAS,aAAa,IAA0C;AAC9D,QAAO,GAAG,QAAQ,IAAI;;AAGxB,SAAS,aAAa,IAAiB,OAAoB;AACzD,QAAO,GAAG,QAAQ,KAAK,MAAM;;AAG/B,SAAS,cAAc,OAA6C;AAClE,QAAO,IAAI,SAAS,MAAM;;AAG5B,MAAM,yBAAyB,IAAI,kBAA+B;CAChE;CACA,OAAO;EACL,YAAY;EACZ,QAAQ,IAAI,UAAU;AACpB,UAAO,aAAa,GAAG,IAAI;;EAE9B;CACD,OAAO;EACL,iBAAiB;GACf,QAAQ,SAAS;AACf,SAAK,SAAS,aAAa,KAAK,MAAM,IAAI,MAAM,CAAC;;GAGnD,OAAO,SAAS;IACd,MAAM,EAAE,KAAK,SAAS;AAKtB,QAJsB,KAAK,kBAIL,IAAK;AAE3B,SAAK,SAAS,aAAa,KAAK,MAAM,IAAI,KAAK,CAAC;;GAEnD;EACD,cAAc,UAAU;GACtB,MAAM,EAAE,WAAW,QAAQ;AAE3B,OACE,UAAU,SACP,CAAC,cAAc,MAAM,IAMrB,CAAC,UAAU,QAEd,QAAO;AAGT,UAAO,cAAc,OAAO,KAAK,CAC/B,WAAW,OAAO,UAAU,MAAM,UAAU,IAAI,EAC9C,OAAO,8BACR,CAAC,CACH,CAAC;;EAEL;CACF,CAAC"}
@@ -86,4 +86,5 @@ declare function defineYjs(options: YjsOptions): YjsExtension;
86
86
  //#region src/yjs/yjs-keymap.d.ts
87
87
  declare function defineYjsKeymap(): PlainExtension;
88
88
  //#endregion
89
- export { type YjsCursorOptions, type YjsCursorPluginOptions, type YjsExtension, type YjsOptions, type YjsSyncOptions, type YjsSyncPluginOptions, type YjsUndoOptions, type YjsUndoPluginOptions, defineYjs, defineYjsCommands, defineYjsCursorPlugin, defineYjsKeymap, defineYjsSyncPlugin, defineYjsUndoPlugin };
89
+ export { type YjsCursorOptions, type YjsCursorPluginOptions, type YjsExtension, type YjsOptions, type YjsSyncOptions, type YjsSyncPluginOptions, type YjsUndoOptions, type YjsUndoPluginOptions, defineYjs, defineYjsCommands, defineYjsCursorPlugin, defineYjsKeymap, defineYjsSyncPlugin, defineYjsUndoPlugin };
90
+ //# sourceMappingURL=prosekit-extensions-yjs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prosekit-extensions-yjs.d.ts","names":[],"sources":["../src/yjs/yjs-commands.ts","../src/yjs/yjs-cursor-plugin.ts","../src/yjs/yjs-sync-plugin.ts","../src/yjs/yjs-undo-plugin.ts","../src/yjs/yjs.ts","../src/yjs/yjs-keymap.ts"],"sourcesContent":[],"mappings":";;;;;;;;;KAiBY,oBAAA,GAAuB;;IAAvB,IAAA,EAAA,EAAA;IAOI,IAAA,EAAA,EAAA;;;iBAAA,iBAAA,CAAA,GAAqB;;;;;;AAPzB,KCNA,sBAAA,GAAyB,WDMF,CCLjC,UDK0C,CAAA,OCLxB,aDKwB,CAAA,CAAA,CAAA,CAAA,CAAA;AAO5B,UCTC,gBAAA,SAAyB,sBDSe,CAAA;aCR5C;;iBAGG,qBAAA,UACL,mBACR;;;;;;ADJS,KENA,oBAAA,GAAuB,WFMA,CELjC,UFK0C,CAAA,OELxB,WFKwB,CAAA,CAAA,CAAA,CAAA,CAAA;AAO5B,UETC,cAAA,SAAuB,oBFSiB,CAAA;YER7C,CAAA,CAAE;;iBAGE,mBAAA,UAA6B,iBAAiB;;;;;;KC+ClD,oBAAA,GAAuB,YACjC,kBAAkB;AHlDR,UGqDK,cAAA,SAAuB,oBHrDI,CAAA,CAO5C;;;;ACbY,iBEyEI,mBAAA,CFzEkB,OAAA,EEyEW,cFzEX,CAAA,EEyE4B,cFzE5B;;;ADalB,UIIC,UAAA,CJJgB;;;;ECbrB,GAAA,EGqBL,CAAA,CAAE,GHrBG;EAAsB;;;WAAG,EG0BxB,SH1BwB;EAAW;AAIhD;;;UAA0C,CAAA,EG4B7B,CAAA,CAAE,WH5B2B;EAAsB;AAIhE;;MACW,CAAA,EG4BF,oBH5BE;;;;SGiCF;;AF1CT;;QACoB,CAAA,EE8CT,sBF9CS;;;;AAGpB;AAAgC,KEiDpB,YAAA,GAAe,KFjDK,CAAA,CEiDE,oBFjDF,EEiDwB,cFjDxB,CAAA,CAAA;;;;AAIhB,iBEkDA,SAAA,CFlDmB,OAAA,EEkDA,UFlDA,CAAA,EEkDa,YFlDb;;;iBGCnB,eAAA,CAAA,GAAmB"}
@@ -102,4 +102,5 @@ function defineYjs(options) {
102
102
  }
103
103
 
104
104
  //#endregion
105
- export { defineYjs, defineYjsCommands, defineYjsCursorPlugin, defineYjsKeymap, defineYjsSyncPlugin, defineYjsUndoPlugin };
105
+ export { defineYjs, defineYjsCommands, defineYjsCursorPlugin, defineYjsKeymap, defineYjsSyncPlugin, defineYjsUndoPlugin };
106
+ //# sourceMappingURL=prosekit-extensions-yjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prosekit-extensions-yjs.js","names":["keymap: Keymap","yUndoPlugin","originalYUndoPlugin"],"sources":["../src/yjs/yjs-commands.ts","../src/yjs/yjs-cursor-plugin.ts","../src/yjs/yjs-keymap.ts","../src/yjs/yjs-sync-plugin.ts","../src/yjs/yjs-undo-plugin.ts","../src/yjs/yjs.ts"],"sourcesContent":["import {\n defineCommands,\n type Extension,\n} from '@prosekit/core'\nimport {\n redoCommand,\n undoCommand,\n} from 'y-prosemirror'\n\nconst commands = {\n undo: () => undoCommand,\n redo: () => redoCommand,\n} as const\n\n/**\n * @internal\n */\nexport type YjsCommandsExtension = Extension<{\n Commands: {\n undo: []\n redo: []\n }\n}>\n\nexport function defineYjsCommands(): YjsCommandsExtension {\n return defineCommands(commands)\n}\n","import {\n definePlugin,\n type PlainExtension,\n} from '@prosekit/core'\nimport type { Plugin } from '@prosekit/pm/state'\nimport { yCursorPlugin } from 'y-prosemirror'\nimport type { Awareness } from 'y-protocols/awareness'\n\n/**\n * Options for `y-prosemirror`'s `yCursorPlugin`.\n */\nexport type YjsCursorPluginOptions = NonNullable<\n Parameters<typeof yCursorPlugin>[1]\n>\n\nexport interface YjsCursorOptions extends YjsCursorPluginOptions {\n awareness: Awareness\n}\n\nexport function defineYjsCursorPlugin(\n options: YjsCursorOptions,\n): PlainExtension {\n const { awareness, ...rest } = options\n return definePlugin(yCursorPlugin(awareness, rest) as Plugin)\n}\n","import {\n defineKeymap,\n isApple,\n type Keymap,\n type PlainExtension,\n} from '@prosekit/core'\nimport {\n redoCommand,\n undoCommand,\n} from 'y-prosemirror'\n\nconst keymap: Keymap = {\n 'Mod-z': undoCommand,\n 'Shift-Mod-z': redoCommand,\n}\n\nif (!isApple) {\n keymap['Mod-y'] = redoCommand\n}\n\nexport function defineYjsKeymap(): PlainExtension {\n return defineKeymap(keymap)\n}\n","import {\n definePlugin,\n type PlainExtension,\n} from '@prosekit/core'\nimport type { Plugin } from '@prosekit/pm/state'\nimport { ySyncPlugin } from 'y-prosemirror'\nimport type * as Y from 'yjs'\n\n/**\n * Options for `y-prosemirror`'s `ySyncPlugin`.\n */\nexport type YjsSyncPluginOptions = NonNullable<\n Parameters<typeof ySyncPlugin>[1]\n>\n\nexport interface YjsSyncOptions extends YjsSyncPluginOptions {\n fragment: Y.XmlFragment\n}\n\nexport function defineYjsSyncPlugin(options: YjsSyncOptions): PlainExtension {\n const { fragment, ...rest } = options\n return definePlugin(ySyncPlugin(fragment, rest) as Plugin)\n}\n","import {\n definePlugin,\n type PlainExtension,\n} from '@prosekit/core'\nimport type { ProseMirrorPlugin } from '@prosekit/pm/state'\nimport type { EditorView } from '@prosekit/pm/view'\nimport {\n yUndoPlugin as originalYUndoPlugin,\n yUndoPluginKey,\n} from 'y-prosemirror'\nimport type { UndoManager as YjsUndoManager } from 'yjs'\n\ntype UndoManager = YjsUndoManager & { restore: () => void }\n\n/**\n * @see https://github.com/yjs/y-prosemirror/issues/114 and https://github.com/yjs/y-prosemirror/issues/102\n */\nfunction fixYUndoPlugin(yUndoPluginInstance: ProseMirrorPlugin) {\n const originalUndoPluginView = yUndoPluginInstance.spec.view\n yUndoPluginInstance.spec.view = (view: EditorView) => {\n const pluginState = yUndoPluginKey.getState(view.state)\n if (!pluginState) {\n return {}\n }\n\n const undoManager = pluginState.undoManager as UndoManager\n\n if (undoManager.restore) {\n undoManager.restore()\n undoManager.restore = () => {}\n }\n\n const viewRet = originalUndoPluginView\n ? originalUndoPluginView(view)\n : undefined\n\n return {\n destroy: () => {\n const hasUndoManSelf = undoManager.trackedOrigins.has(undoManager)\n\n const observers = undoManager._observers\n\n undoManager.restore = () => {\n if (hasUndoManSelf) {\n undoManager.trackedOrigins.add(undoManager)\n }\n\n undoManager.doc.on(\n 'afterTransaction',\n undoManager.afterTransactionHandler,\n )\n\n undoManager._observers = observers\n }\n\n if (viewRet?.destroy) {\n viewRet.destroy()\n }\n },\n }\n }\n}\n\n/**\n * Options for the `y-prosemirror`'s `yUndoPlugin`.\n */\nexport type YjsUndoPluginOptions = NonNullable<\n Parameters<typeof originalYUndoPlugin>[0]\n>\n\nexport interface YjsUndoOptions extends YjsUndoPluginOptions {}\n\n/**\n * @internal\n */\nfunction yUndoPlugin(options?: YjsUndoOptions) {\n const yUndoPluginInstance = originalYUndoPlugin(options)\n fixYUndoPlugin(yUndoPluginInstance)\n return yUndoPluginInstance\n}\n\n/**\n * @internal\n */\nexport function defineYjsUndoPlugin(options: YjsUndoOptions): PlainExtension {\n return definePlugin(yUndoPlugin(options))\n}\n","import {\n Priority,\n union,\n withPriority,\n type PlainExtension,\n type Union,\n} from '@prosekit/core'\nimport type { Awareness } from 'y-protocols/awareness'\nimport type * as Y from 'yjs'\n\nimport {\n defineYjsCommands,\n type YjsCommandsExtension,\n} from './yjs-commands'\nimport {\n defineYjsCursorPlugin,\n type YjsCursorPluginOptions,\n} from './yjs-cursor-plugin'\nimport { defineYjsKeymap } from './yjs-keymap'\nimport {\n defineYjsSyncPlugin,\n type YjsSyncPluginOptions,\n} from './yjs-sync-plugin'\nimport {\n defineYjsUndoPlugin,\n type YjsUndoPluginOptions,\n} from './yjs-undo-plugin'\n\nexport interface YjsOptions {\n /**\n * The Yjs instance handles the state of shared data.\n */\n doc: Y.Doc\n\n /**\n * The Awareness instance.\n */\n awareness: Awareness\n\n /**\n * The Yjs XmlFragment to use. If not provided,\n * `doc.getXmlFragment('prosemirror')` will be used.\n */\n fragment?: Y.XmlFragment\n\n /**\n * Options for `y-prosemirror`'s `ySyncPlugin`.\n */\n sync?: YjsSyncPluginOptions\n\n /**\n * Options for the `y-prosemirror`'s `yUndoPlugin`.\n */\n undo?: YjsUndoPluginOptions\n\n /**\n * Options for `y-prosemirror`'s `yCursorPlugin`.\n */\n cursor?: YjsCursorPluginOptions\n}\n\n/**\n * @internal\n */\nexport type YjsExtension = Union<[YjsCommandsExtension, PlainExtension]>\n\n/**\n * @public\n */\nexport function defineYjs(options: YjsOptions): YjsExtension {\n const { doc, awareness, sync, undo, cursor } = options\n const fragment = options.fragment ?? doc.getXmlFragment('prosemirror')\n\n return withPriority(\n union([\n defineYjsKeymap(),\n defineYjsCommands(),\n defineYjsCursorPlugin({ ...cursor, awareness }),\n defineYjsUndoPlugin({ ...undo }),\n defineYjsSyncPlugin({ ...sync, fragment }),\n ]),\n Priority.high,\n )\n}\n"],"mappings":";;;;AASA,MAAM,WAAW;CACf,YAAY;CACZ,YAAY;CACb;AAYD,SAAgB,oBAA0C;AACxD,QAAO,eAAe,SAAS;;;;;ACNjC,SAAgB,sBACd,SACgB;CAChB,MAAM,EAAE,UAAW,GAAG,SAAS;AAC/B,QAAO,aAAa,cAAc,WAAW,KAAK,CAAW;;;;;ACZ/D,MAAMA,SAAiB;CACrB,SAAS;CACT,eAAe;CAChB;AAED,IAAI,CAAC,QACH,QAAO,WAAW;AAGpB,SAAgB,kBAAkC;AAChD,QAAO,aAAa,OAAO;;;;;ACF7B,SAAgB,oBAAoB,SAAyC;CAC3E,MAAM,EAAE,SAAU,GAAG,SAAS;AAC9B,QAAO,aAAa,YAAY,UAAU,KAAK,CAAW;;;;;;;;ACJ5D,SAAS,eAAe,qBAAwC;CAC9D,MAAM,yBAAyB,oBAAoB,KAAK;AACxD,qBAAoB,KAAK,QAAQ,SAAqB;EACpD,MAAM,cAAc,eAAe,SAAS,KAAK,MAAM;AACvD,MAAI,CAAC,YACH,QAAO,EAAE;EAGX,MAAM,cAAc,YAAY;AAEhC,MAAI,YAAY,SAAS;AACvB,eAAY,SAAS;AACrB,eAAY,gBAAgB;;EAG9B,MAAM,UAAU,yBACZ,uBAAuB,KAAK,GAC5B;AAEJ,SAAO,EACL,eAAe;GACb,MAAM,iBAAiB,YAAY,eAAe,IAAI,YAAY;GAElE,MAAM,YAAY,YAAY;AAE9B,eAAY,gBAAgB;AAC1B,QAAI,eACF,aAAY,eAAe,IAAI,YAAY;AAG7C,gBAAY,IAAI,GACd,oBACA,YAAY,wBACb;AAED,gBAAY,aAAa;;AAG3B,OAAI,SAAS,QACX,SAAQ,SAAS;KAGtB;;;;;;AAgBL,SAASC,cAAY,SAA0B;CAC7C,MAAM,sBAAsBC,YAAoB,QAAQ;AACxD,gBAAe,oBAAoB;AACnC,QAAO;;;;;AAMT,SAAgB,oBAAoB,SAAyC;AAC3E,QAAO,aAAaD,cAAY,QAAQ,CAAC;;;;;;;;AChB3C,SAAgB,UAAU,SAAmC;CAC3D,MAAM,EAAE,KAAK,WAAW,MAAM,MAAM,WAAW;CAC/C,MAAM,WAAW,QAAQ,YAAY,IAAI,eAAe,cAAc;AAEtE,QAAO,aACL,MAAM;EACJ,iBAAiB;EACjB,mBAAmB;EACnB,sBAAsB;GAAE,GAAG;GAAQ;GAAW,CAAC;EAC/C,oBAAoB,EAAE,GAAG,MAAM,CAAC;EAChC,oBAAoB;GAAE,GAAG;GAAM;GAAU,CAAC;EAC3C,CAAC,EACF,SAAS,KACV"}