@prosekit/extensions 0.14.0 → 0.14.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (248) hide show
  1. package/dist/{drop-indicator-B_oMfeVP.js → drop-indicator-DJq8pF92.js} +1 -1
  2. package/dist/{drop-indicator-B_oMfeVP.js.map → drop-indicator-DJq8pF92.js.map} +1 -1
  3. package/dist/{file-iLVR0eM0.js → file-upload-I9m1EJAM.js} +1 -1
  4. package/dist/file-upload-I9m1EJAM.js.map +1 -0
  5. package/dist/{index-cp1u4e0e.d.ts → file-upload-dr3IXUty.d.ts} +1 -1
  6. package/dist/file-upload-dr3IXUty.d.ts.map +1 -0
  7. package/dist/{paste-rule-BaDghcaU.js → mark-paste-rule--F1QPUcU.js} +2 -2
  8. package/dist/mark-paste-rule--F1QPUcU.js.map +1 -0
  9. package/dist/{mark-rule-CYe8zk4q.js → mark-rule-Bqdm49Eq.js} +2 -2
  10. package/dist/mark-rule-Bqdm49Eq.js.map +1 -0
  11. package/dist/prosekit-extensions-autocomplete.d.ts +1 -1
  12. package/dist/prosekit-extensions-autocomplete.js +17 -17
  13. package/dist/prosekit-extensions-autocomplete.js.map +1 -1
  14. package/dist/prosekit-extensions-background-color.d.ts +1 -1
  15. package/dist/prosekit-extensions-background-color.js.map +1 -1
  16. package/dist/prosekit-extensions-blockquote.d.ts +13 -13
  17. package/dist/prosekit-extensions-blockquote.d.ts.map +1 -1
  18. package/dist/prosekit-extensions-blockquote.js +6 -5
  19. package/dist/prosekit-extensions-blockquote.js.map +1 -1
  20. package/dist/prosekit-extensions-bold.d.ts +12 -12
  21. package/dist/prosekit-extensions-bold.d.ts.map +1 -1
  22. package/dist/prosekit-extensions-bold.js +1 -1
  23. package/dist/prosekit-extensions-bold.js.map +1 -1
  24. package/dist/prosekit-extensions-code-block.d.ts +53 -36
  25. package/dist/prosekit-extensions-code-block.d.ts.map +1 -1
  26. package/dist/prosekit-extensions-code-block.js +78 -72
  27. package/dist/prosekit-extensions-code-block.js.map +1 -1
  28. package/dist/prosekit-extensions-code.d.ts +12 -12
  29. package/dist/prosekit-extensions-code.d.ts.map +1 -1
  30. package/dist/prosekit-extensions-code.js +1 -1
  31. package/dist/prosekit-extensions-code.js.map +1 -1
  32. package/dist/prosekit-extensions-commit.d.ts +1 -1
  33. package/dist/prosekit-extensions-commit.js +1 -1
  34. package/dist/prosekit-extensions-drop-indicator.js +1 -1
  35. package/dist/prosekit-extensions-enter-rule.d.ts +6 -78
  36. package/dist/prosekit-extensions-enter-rule.d.ts.map +1 -1
  37. package/dist/prosekit-extensions-enter-rule.js +37 -2
  38. package/dist/prosekit-extensions-enter-rule.js.map +1 -0
  39. package/dist/prosekit-extensions-file.d.ts +2 -2
  40. package/dist/prosekit-extensions-file.js +1 -1
  41. package/dist/prosekit-extensions-hard-break.d.ts +7 -7
  42. package/dist/prosekit-extensions-hard-break.d.ts.map +1 -1
  43. package/dist/prosekit-extensions-hard-break.js.map +1 -1
  44. package/dist/prosekit-extensions-heading.d.ts +15 -15
  45. package/dist/prosekit-extensions-heading.d.ts.map +1 -1
  46. package/dist/prosekit-extensions-heading.js +1 -1
  47. package/dist/prosekit-extensions-heading.js.map +1 -1
  48. package/dist/prosekit-extensions-horizontal-rule.d.ts +7 -7
  49. package/dist/prosekit-extensions-horizontal-rule.d.ts.map +1 -1
  50. package/dist/prosekit-extensions-horizontal-rule.js +11 -10
  51. package/dist/prosekit-extensions-horizontal-rule.js.map +1 -1
  52. package/dist/prosekit-extensions-image.d.ts +13 -12
  53. package/dist/prosekit-extensions-image.d.ts.map +1 -1
  54. package/dist/prosekit-extensions-image.js +10 -10
  55. package/dist/prosekit-extensions-image.js.map +1 -1
  56. package/dist/prosekit-extensions-input-rule.js +89 -2
  57. package/dist/prosekit-extensions-input-rule.js.map +1 -0
  58. package/dist/prosekit-extensions-italic.d.ts +12 -12
  59. package/dist/prosekit-extensions-italic.d.ts.map +1 -1
  60. package/dist/prosekit-extensions-italic.js +1 -1
  61. package/dist/prosekit-extensions-italic.js.map +1 -1
  62. package/dist/prosekit-extensions-link.js +4 -4
  63. package/dist/prosekit-extensions-link.js.map +1 -1
  64. package/dist/prosekit-extensions-list.d.ts +26 -26
  65. package/dist/prosekit-extensions-list.d.ts.map +1 -1
  66. package/dist/prosekit-extensions-list.js +27 -27
  67. package/dist/prosekit-extensions-list.js.map +1 -1
  68. package/dist/prosekit-extensions-loro.d.ts +16 -16
  69. package/dist/prosekit-extensions-loro.d.ts.map +1 -1
  70. package/dist/prosekit-extensions-loro.js.map +1 -1
  71. package/dist/prosekit-extensions-mark-rule.js +1 -1
  72. package/dist/prosekit-extensions-math.d.ts +154 -0
  73. package/dist/prosekit-extensions-math.d.ts.map +1 -0
  74. package/dist/prosekit-extensions-math.js +108 -0
  75. package/dist/prosekit-extensions-math.js.map +1 -0
  76. package/dist/prosekit-extensions-mod-click-prevention.js +1 -1
  77. package/dist/prosekit-extensions-paragraph.d.ts +7 -7
  78. package/dist/prosekit-extensions-paragraph.d.ts.map +1 -1
  79. package/dist/prosekit-extensions-paragraph.js.map +1 -1
  80. package/dist/prosekit-extensions-paste-rule.js +1 -1
  81. package/dist/prosekit-extensions-placeholder.d.ts +1 -1
  82. package/dist/prosekit-extensions-placeholder.js +2 -2
  83. package/dist/prosekit-extensions-placeholder.js.map +1 -1
  84. package/dist/prosekit-extensions-readonly.js +1 -1
  85. package/dist/prosekit-extensions-strike.js +1 -1
  86. package/dist/prosekit-extensions-strike.js.map +1 -1
  87. package/dist/prosekit-extensions-table.d.ts +47 -47
  88. package/dist/prosekit-extensions-table.d.ts.map +1 -1
  89. package/dist/prosekit-extensions-table.js +1 -1
  90. package/dist/prosekit-extensions-text-align.d.ts +1 -1
  91. package/dist/prosekit-extensions-text-color.d.ts +1 -1
  92. package/dist/prosekit-extensions-text-color.js.map +1 -1
  93. package/dist/prosekit-extensions-virtual-selection.js +1 -1
  94. package/dist/prosekit-extensions-yjs.d.ts +3 -3
  95. package/dist/prosekit-extensions-yjs.d.ts.map +1 -1
  96. package/dist/prosekit-extensions-yjs.js.map +1 -1
  97. package/dist/shiki-highlighter-chunk.d.ts +19 -2
  98. package/dist/shiki-highlighter-chunk.d.ts.map +1 -0
  99. package/dist/{table-4oHfV-Ql.js → table-B81i9oH9.js} +29 -29
  100. package/dist/table-B81i9oH9.js.map +1 -0
  101. package/package.json +22 -10
  102. package/src/autocomplete/autocomplete-helpers.ts +1 -1
  103. package/src/autocomplete/autocomplete-plugin.ts +2 -2
  104. package/src/autocomplete/autocomplete-rule.ts +1 -1
  105. package/src/autocomplete/autocomplete.spec.ts +4 -4
  106. package/src/autocomplete/autocomplete.ts +2 -2
  107. package/src/autocomplete/index.ts +2 -2
  108. package/src/background-color/background-color-commands.spec.ts +1 -1
  109. package/src/background-color/background-color-commands.ts +1 -1
  110. package/src/background-color/background-color-spec.spec.ts +1 -1
  111. package/src/background-color/background-color.ts +2 -2
  112. package/src/background-color/index.ts +3 -3
  113. package/src/blockquote/blockquote-input-rule.ts +1 -1
  114. package/src/blockquote/blockquote-keymap.spec.ts +1 -1
  115. package/src/blockquote/blockquote-keymap.ts +9 -7
  116. package/src/blockquote/blockquote.ts +4 -4
  117. package/src/blockquote/index.ts +5 -5
  118. package/src/bold/bold-input-rule.spec.ts +2 -2
  119. package/src/bold/bold-input-rule.ts +1 -1
  120. package/src/bold/bold.ts +4 -4
  121. package/src/bold/index.ts +5 -5
  122. package/src/code/code-input-rule.ts +1 -1
  123. package/src/code/code.ts +4 -4
  124. package/src/code/index.ts +5 -5
  125. package/src/code-block/code-block-commands.ts +1 -1
  126. package/src/code-block/code-block-highlight.ts +11 -1
  127. package/src/code-block/code-block-input-rule.ts +3 -3
  128. package/src/code-block/code-block-shiki.ts +13 -5
  129. package/src/code-block/code-block-spec.spec.ts +2 -2
  130. package/src/code-block/code-block-spec.ts +1 -1
  131. package/src/code-block/code-block.ts +4 -4
  132. package/src/code-block/index.ts +9 -9
  133. package/src/code-block/shiki-highlighter.ts +2 -2
  134. package/src/code-block/shiki-parser.ts +2 -2
  135. package/src/drop-cursor/index.ts +1 -1
  136. package/src/drop-indicator/drop-indicator.ts +1 -1
  137. package/src/drop-indicator/index.ts +1 -1
  138. package/src/enter-rule/index.ts +18 -191
  139. package/src/file/file-drop-handler.ts +1 -1
  140. package/src/file/file-paste-handler.spec.ts +3 -3
  141. package/src/file/file-paste-handler.ts +1 -1
  142. package/src/file/index.ts +3 -3
  143. package/src/gap-cursor/index.ts +1 -1
  144. package/src/hard-break/hard-break-keymap.spec.ts +2 -2
  145. package/src/hard-break/hard-break-keymap.ts +1 -1
  146. package/src/hard-break/hard-break.ts +3 -3
  147. package/src/hard-break/index.ts +4 -4
  148. package/src/heading/heading-commands.ts +1 -1
  149. package/src/heading/heading-input-rule.ts +2 -2
  150. package/src/heading/heading-keymap.spec.ts +1 -1
  151. package/src/heading/heading-spec.ts +1 -1
  152. package/src/heading/heading.ts +4 -4
  153. package/src/heading/index.ts +6 -6
  154. package/src/horizontal-rule/horizontal-rule-commands.spec.ts +1 -1
  155. package/src/horizontal-rule/horizontal-rule-commands.ts +13 -11
  156. package/src/horizontal-rule/horizontal-rule-input-rule.spec.ts +2 -2
  157. package/src/horizontal-rule/horizontal-rule-input-rule.ts +1 -1
  158. package/src/horizontal-rule/horizontal-rule.ts +3 -3
  159. package/src/horizontal-rule/index.ts +4 -4
  160. package/src/image/image-commands/insert-image.ts +1 -1
  161. package/src/image/image-commands/upload-image.spec.ts +4 -4
  162. package/src/image/image-commands/upload-image.ts +2 -2
  163. package/src/image/image-commands.ts +3 -3
  164. package/src/image/image-upload-handler.ts +2 -2
  165. package/src/image/image.ts +2 -2
  166. package/src/image/index.ts +6 -6
  167. package/src/italic/index.ts +5 -5
  168. package/src/italic/italic-commands.spec.ts +4 -4
  169. package/src/italic/italic-input-rule.spec.ts +2 -2
  170. package/src/italic/italic-input-rule.ts +1 -1
  171. package/src/italic/italic.ts +4 -4
  172. package/src/link/index.spec.ts +2 -2
  173. package/src/link/index.ts +6 -6
  174. package/src/link/link-paste-rule.spec.ts +2 -2
  175. package/src/link/link-paste-rule.ts +3 -3
  176. package/src/link/link-regex.spec.ts +1 -1
  177. package/src/list/index.ts +8 -8
  178. package/src/list/list-drop-indicator.ts +2 -2
  179. package/src/list/list-input-rules.ts +1 -1
  180. package/src/list/list-keymap.spec.ts +1 -1
  181. package/src/list/list-spec.ts +1 -1
  182. package/src/list/list-types.spec.ts +2 -2
  183. package/src/list/list.spec.ts +6 -6
  184. package/src/list/list.ts +7 -7
  185. package/src/loro/index.ts +6 -6
  186. package/src/loro/loro.ts +5 -5
  187. package/src/mark-rule/apply.ts +2 -2
  188. package/src/mark-rule/index.ts +2 -2
  189. package/src/mark-rule/mark-rule.spec.ts +4 -4
  190. package/src/mark-rule/mark-rule.ts +2 -2
  191. package/src/math/index.ts +22 -0
  192. package/src/math/math-block.ts +96 -0
  193. package/src/math/math-inline.ts +89 -0
  194. package/src/math/math-plugin.ts +8 -0
  195. package/src/math/math.ts +39 -0
  196. package/src/paragraph/index.ts +7 -7
  197. package/src/paragraph/paragraph-keymap.ts +1 -1
  198. package/src/paragraph/paragraph.ts +3 -3
  199. package/src/paste-rule/index.ts +2 -2
  200. package/src/paste-rule/mark-paste-rule.spec.ts +8 -8
  201. package/src/paste-rule/mark-paste-rule.ts +2 -2
  202. package/src/paste-rule/paste-rule.spec.ts +2 -2
  203. package/src/paste-rule/paste-rule.ts +1 -1
  204. package/src/paste-rule/split-text-by-regex.spec.ts +1 -1
  205. package/src/placeholder/index.ts +1 -1
  206. package/src/strike/index.ts +1 -1
  207. package/src/table/index.ts +14 -14
  208. package/src/table/table-commands/delete-cell-selection.spec.ts +3 -3
  209. package/src/table/table-commands/exit-table.spec.ts +2 -2
  210. package/src/table/table-commands/insert-table.spec.ts +1 -1
  211. package/src/table/table-commands/move-table-column.spec.ts +2 -2
  212. package/src/table/table-commands/move-table-row.spec.ts +2 -2
  213. package/src/table/table-commands/select-table-cell.spec.ts +3 -3
  214. package/src/table/table-commands/select-table-cell.ts +1 -1
  215. package/src/table/table-commands/select-table-column.spec.ts +2 -2
  216. package/src/table/table-commands/select-table-column.ts +1 -1
  217. package/src/table/table-commands/select-table-row.spec.ts +2 -2
  218. package/src/table/table-commands/select-table-row.ts +1 -1
  219. package/src/table/table-commands/select-table.spec.ts +2 -2
  220. package/src/table/table-commands/select-table.ts +1 -1
  221. package/src/table/table-commands.ts +9 -9
  222. package/src/table/table-drop-indicator.ts +2 -2
  223. package/src/table/table-spec.spec.ts +4 -4
  224. package/src/table/table.ts +4 -4
  225. package/src/table/test-utils.ts +1 -1
  226. package/src/testing/index.ts +25 -22
  227. package/src/testing/katex.ts +9 -0
  228. package/src/text-color/index.ts +3 -3
  229. package/src/text-color/text-color-commands.spec.ts +1 -1
  230. package/src/text-color/text-color-commands.ts +1 -1
  231. package/src/text-color/text-color-spec.spec.ts +1 -1
  232. package/src/text-color/text-color.ts +2 -2
  233. package/src/yjs/index.ts +7 -7
  234. package/src/yjs/yjs-cursor-plugin.ts +1 -1
  235. package/src/yjs/yjs-types.ts +0 -2
  236. package/src/yjs/yjs-undo-plugin.ts +3 -2
  237. package/src/yjs/yjs.ts +6 -6
  238. package/dist/enter-rule-D-p4ykfv.js +0 -96
  239. package/dist/enter-rule-D-p4ykfv.js.map +0 -1
  240. package/dist/file-iLVR0eM0.js.map +0 -1
  241. package/dist/index-cp1u4e0e.d.ts.map +0 -1
  242. package/dist/input-rule-COGr_GBb.js +0 -90
  243. package/dist/input-rule-COGr_GBb.js.map +0 -1
  244. package/dist/mark-rule-CYe8zk4q.js.map +0 -1
  245. package/dist/paste-rule-BaDghcaU.js.map +0 -1
  246. package/dist/shiki-highlighter-chunk-DNNm2Vow.d.ts +0 -19
  247. package/dist/shiki-highlighter-chunk-DNNm2Vow.d.ts.map +0 -1
  248. package/dist/table-4oHfV-Ql.js.map +0 -1
@@ -1,9 +1,9 @@
1
1
  import { union, type Union } from '@prosekit/core'
2
2
 
3
- import { defineItalicCommands, type ItalicCommandsExtension } from './italic-commands'
4
- import { defineItalicInputRule } from './italic-input-rule'
5
- import { defineItalicKeymap } from './italic-keymap'
6
- import { defineItalicSpec, type ItalicSpecExtension } from './italic-spec'
3
+ import { defineItalicCommands, type ItalicCommandsExtension } from './italic-commands.ts'
4
+ import { defineItalicInputRule } from './italic-input-rule.ts'
5
+ import { defineItalicKeymap } from './italic-keymap.ts'
6
+ import { defineItalicSpec, type ItalicSpecExtension } from './italic-spec.ts'
7
7
 
8
8
  /**
9
9
  * @internal
@@ -1,8 +1,8 @@
1
1
  import { describe, expect, it } from 'vitest'
2
2
  import { keyboard } from 'vitest-browser-commands/playwright'
3
3
 
4
- import { setupTest } from '../testing'
5
- import { inputText } from '../testing/keyboard'
4
+ import { setupTest } from '../testing/index.ts'
5
+ import { inputText } from '../testing/keyboard.ts'
6
6
 
7
7
  describe('defineLinkCommands', () => {
8
8
  const { editor, n, m } = setupTest()
package/src/link/index.ts CHANGED
@@ -12,13 +12,13 @@ import {
12
12
  } from '@prosekit/core'
13
13
  import { InputRule } from '@prosekit/pm/inputrules'
14
14
 
15
- import { defineEnterRule } from '../enter-rule'
16
- import { defineInputRule } from '../input-rule'
17
- import { defineMarkRule } from '../mark-rule'
15
+ import { defineEnterRule } from '../enter-rule/index.ts'
16
+ import { defineInputRule } from '../input-rule/index.ts'
17
+ import { defineMarkRule } from '../mark-rule/index.ts'
18
18
 
19
- import { defineLinkPasteRule } from './link-paste-rule'
20
- import { LINK_ENTER_RE, LINK_INPUT_RE, LINK_MARK_RE } from './link-regex'
21
- import type { LinkAttrs } from './link-types'
19
+ import { defineLinkPasteRule } from './link-paste-rule.ts'
20
+ import { LINK_ENTER_RE, LINK_INPUT_RE, LINK_MARK_RE } from './link-regex.ts'
21
+ import type { LinkAttrs } from './link-types.ts'
22
22
 
23
23
  export { defineLinkPasteRule }
24
24
  export type { LinkAttrs }
@@ -1,7 +1,7 @@
1
1
  import { describe, expect, it } from 'vitest'
2
2
 
3
- import { setupTest } from '../testing'
4
- import { pasteHTML, pasteText } from '../testing/clipboard'
3
+ import { pasteHTML, pasteText } from '../testing/clipboard.ts'
4
+ import { setupTest } from '../testing/index.ts'
5
5
 
6
6
  describe('defineLinkPasteRule', () => {
7
7
  const { editor, n, m } = setupTest()
@@ -1,9 +1,9 @@
1
1
  import type { PlainExtension } from '@prosekit/core'
2
2
 
3
- import { defineMarkPasteRule } from '../paste-rule'
3
+ import { defineMarkPasteRule } from '../paste-rule/index.ts'
4
4
 
5
- import { LINK_MARK_RE } from './link-regex'
6
- import type { LinkAttrs } from './link-types'
5
+ import { LINK_MARK_RE } from './link-regex.ts'
6
+ import type { LinkAttrs } from './link-types.ts'
7
7
 
8
8
  /**
9
9
  * @internal
@@ -1,6 +1,6 @@
1
1
  import { describe, expect, it } from 'vitest'
2
2
 
3
- import { LINK_MARK_RE } from './link-regex'
3
+ import { LINK_MARK_RE } from './link-regex.ts'
4
4
 
5
5
  describe('LINK_MARK_RE', () => {
6
6
  const cases = [
package/src/list/index.ts CHANGED
@@ -6,11 +6,11 @@ export type {
6
6
  UnwrapListOptions,
7
7
  WrapInListGetAttrs,
8
8
  } from 'prosemirror-flat-list'
9
- export { defineList, type ListExtension } from './list'
10
- export { defineListCommands, type ListCommandsExtension } from './list-commands'
11
- export { defineListInputRules } from './list-input-rules'
12
- export { defineListKeymap } from './list-keymap'
13
- export { defineListPlugins } from './list-plugins'
14
- export { defineListSerializer } from './list-serializer'
15
- export { defineListSpec, type ListSpecExtension } from './list-spec'
16
- export type { ListAttrs } from './list-types'
9
+ export { defineListCommands, type ListCommandsExtension } from './list-commands.ts'
10
+ export { defineListInputRules } from './list-input-rules.ts'
11
+ export { defineListKeymap } from './list-keymap.ts'
12
+ export { defineListPlugins } from './list-plugins.ts'
13
+ export { defineListSerializer } from './list-serializer.ts'
14
+ export { defineListSpec, type ListSpecExtension } from './list-spec.ts'
15
+ export type { ListAttrs } from './list-types.ts'
16
+ export { defineList, type ListExtension } from './list.ts'
@@ -1,7 +1,7 @@
1
1
  import type { PlainExtension } from '@prosekit/core'
2
2
 
3
- import type { DragEventHandler } from '../drop-indicator'
4
- import { defineDropIndicator } from '../drop-indicator'
3
+ import type { DragEventHandler } from '../drop-indicator/index.ts'
4
+ import { defineDropIndicator } from '../drop-indicator/index.ts'
5
5
 
6
6
  /**
7
7
  * Configures drop indicator to avoid unexpected drop point.
@@ -1,7 +1,7 @@
1
1
  import { union, type Extension } from '@prosekit/core'
2
2
  import { listInputRules } from 'prosemirror-flat-list'
3
3
 
4
- import { defineInputRule } from '../input-rule'
4
+ import { defineInputRule } from '../input-rule/index.ts'
5
5
 
6
6
  /**
7
7
  * @internal
@@ -1,7 +1,7 @@
1
1
  import { describe, expect, it } from 'vitest'
2
2
  import { keyboard } from 'vitest-browser-commands/playwright'
3
3
 
4
- import { setupTest } from '../testing'
4
+ import { setupTest } from '../testing/index.ts'
5
5
 
6
6
  describe('keymap', () => {
7
7
  const { editor, n } = setupTest()
@@ -2,7 +2,7 @@ import { defineNodeSpec, type Extension } from '@prosekit/core'
2
2
  import type { DOMOutputSpec, ProseMirrorNode } from '@prosekit/pm/model'
3
3
  import { createListSpec, listToDOM, type ListAttributes } from 'prosemirror-flat-list'
4
4
 
5
- import type { ListAttrs } from './list-types'
5
+ import type { ListAttrs } from './list-types.ts'
6
6
 
7
7
  /**
8
8
  * @internal
@@ -1,9 +1,9 @@
1
1
  import type { ListAttributes } from 'prosemirror-flat-list'
2
2
  import { test } from 'vitest'
3
3
 
4
- import { assertTypeEqual } from '../types/assert-type-equal'
4
+ import { assertTypeEqual } from '../types/assert-type-equal.ts'
5
5
 
6
- import type { ListAttrs } from './list-types'
6
+ import type { ListAttrs } from './list-types.ts'
7
7
 
8
8
  test('ListAttrs', () => {
9
9
  assertTypeEqual<keyof ListAttrs, keyof ListAttributes>(true)
@@ -3,13 +3,13 @@ import type { ProseMirrorNode } from '@prosekit/pm/model'
3
3
  import { formatHTML } from 'diffable-html-snapshot'
4
4
  import { describe, expect, it } from 'vitest'
5
5
 
6
- import { defineDoc } from '../doc'
7
- import { defineParagraph } from '../paragraph'
8
- import { setupTest } from '../testing'
9
- import { htmlFromMarkdown, markdownFromHTML } from '../testing/markdown'
10
- import { defineText } from '../text'
6
+ import { defineDoc } from '../doc/index.ts'
7
+ import { defineParagraph } from '../paragraph/index.ts'
8
+ import { setupTest } from '../testing/index.ts'
9
+ import { htmlFromMarkdown, markdownFromHTML } from '../testing/markdown.ts'
10
+ import { defineText } from '../text/index.ts'
11
11
 
12
- import { defineList } from './index'
12
+ import { defineList } from './index.ts'
13
13
 
14
14
  describe('defineList', () => {
15
15
  it('can add list node', () => {
package/src/list/list.ts CHANGED
@@ -1,12 +1,12 @@
1
1
  import { union, type Union } from '@prosekit/core'
2
2
 
3
- import { defineListCommands, type ListCommandsExtension } from './list-commands'
4
- import { defineListDropIndicator } from './list-drop-indicator'
5
- import { defineListInputRules } from './list-input-rules'
6
- import { defineListKeymap } from './list-keymap'
7
- import { defineListPlugins } from './list-plugins'
8
- import { defineListSerializer } from './list-serializer'
9
- import { defineListSpec, type ListSpecExtension } from './list-spec'
3
+ import { defineListCommands, type ListCommandsExtension } from './list-commands.ts'
4
+ import { defineListDropIndicator } from './list-drop-indicator.ts'
5
+ import { defineListInputRules } from './list-input-rules.ts'
6
+ import { defineListKeymap } from './list-keymap.ts'
7
+ import { defineListPlugins } from './list-plugins.ts'
8
+ import { defineListSerializer } from './list-serializer.ts'
9
+ import { defineListSpec, type ListSpecExtension } from './list-spec.ts'
10
10
 
11
11
  /**
12
12
  * @internal
package/src/loro/index.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export type { LoroSyncPluginProps, LoroUndoPluginProps } from 'loro-prosemirror'
2
- export { defineLoro, type LoroExtension, type LoroOptions } from './loro'
3
- export { defineLoroCommands } from './loro-commands'
4
- export { defineLoroCursorPlugin, type LoroCursorOptions } from './loro-cursor-plugin'
5
- export { defineLoroKeymap } from './loro-keymap'
6
- export { defineLoroSyncPlugin } from './loro-sync-plugin'
7
- export { defineLoroUndoPlugin } from './loro-undo-plugin'
2
+ export { defineLoroCommands } from './loro-commands.ts'
3
+ export { defineLoroCursorPlugin, type LoroCursorOptions } from './loro-cursor-plugin.ts'
4
+ export { defineLoroKeymap } from './loro-keymap.ts'
5
+ export { defineLoroSyncPlugin } from './loro-sync-plugin.ts'
6
+ export { defineLoroUndoPlugin } from './loro-undo-plugin.ts'
7
+ export { defineLoro, type LoroExtension, type LoroOptions } from './loro.ts'
package/src/loro/loro.ts CHANGED
@@ -8,11 +8,11 @@ import type {
8
8
  LoroUndoPluginProps,
9
9
  } from 'loro-prosemirror'
10
10
 
11
- import { defineLoroCommands, type LoroCommandsExtension } from './loro-commands'
12
- import { defineLoroCursorPlugin } from './loro-cursor-plugin'
13
- import { defineLoroKeymap } from './loro-keymap'
14
- import { defineLoroSyncPlugin } from './loro-sync-plugin'
15
- import { defineLoroUndoPlugin } from './loro-undo-plugin'
11
+ import { defineLoroCommands, type LoroCommandsExtension } from './loro-commands.ts'
12
+ import { defineLoroCursorPlugin } from './loro-cursor-plugin.ts'
13
+ import { defineLoroKeymap } from './loro-keymap.ts'
14
+ import { defineLoroSyncPlugin } from './loro-sync-plugin.ts'
15
+ import { defineLoroUndoPlugin } from './loro-undo-plugin.ts'
16
16
 
17
17
  export interface LoroOptions {
18
18
  /**
@@ -2,8 +2,8 @@ import { getMarkType, maybeRun, OBJECT_REPLACEMENT_CHARACTER } from '@prosekit/c
2
2
  import type { Mark, ProseMirrorNode } from '@prosekit/pm/model'
3
3
  import type { EditorState, Transaction } from '@prosekit/pm/state'
4
4
 
5
- import { getCheckRanges } from './range'
6
- import type { MarkRuleOptions } from './types'
5
+ import { getCheckRanges } from './range.ts'
6
+ import type { MarkRuleOptions } from './types.ts'
7
7
 
8
8
  type MarkRange = [from: number, to: number, mark: Mark]
9
9
 
@@ -1,2 +1,2 @@
1
- export { defineMarkRule } from './mark-rule'
2
- export type { MarkRuleOptions } from './types'
1
+ export { defineMarkRule } from './mark-rule.ts'
2
+ export type { MarkRuleOptions } from './types.ts'
@@ -2,11 +2,11 @@ import { createEditor, defineBaseCommands, defineMarkSpec, elementFromNode, unio
2
2
  import type { ProseMirrorNode } from '@prosekit/pm/model'
3
3
  import { describe, expect, it } from 'vitest'
4
4
 
5
- import { defineDoc } from '../doc'
6
- import { defineParagraph } from '../paragraph'
7
- import { defineText } from '../text'
5
+ import { defineDoc } from '../doc/index.ts'
6
+ import { defineParagraph } from '../paragraph/index.ts'
7
+ import { defineText } from '../text/index.ts'
8
8
 
9
- import { defineMarkRule } from './index'
9
+ import { defineMarkRule } from './index.ts'
10
10
 
11
11
  describe('defineMarkRule', () => {
12
12
  const editor = createEditor({
@@ -1,8 +1,8 @@
1
1
  import { defineFacet, defineFacetPayload, pluginFacet, type PlainExtension, type PluginPayload } from '@prosekit/core'
2
2
  import { PluginKey, ProseMirrorPlugin, type EditorState, type Transaction } from '@prosekit/pm/state'
3
3
 
4
- import { applyMarkRules } from './apply'
5
- import type { MarkRuleOptions } from './types'
4
+ import { applyMarkRules } from './apply.ts'
5
+ import type { MarkRuleOptions } from './types.ts'
6
6
 
7
7
  /**
8
8
  * A mark rule is something that can automatically apply marks to text if it
@@ -0,0 +1,22 @@
1
+ export {
2
+ defineMathBlock,
3
+ defineMathBlockEnterRule,
4
+ defineMathBlockSpec,
5
+ defineMathBlockView,
6
+ type MathBlockExtension,
7
+ type MathBlockOptions,
8
+ type MathBlockSpecExtension,
9
+ type MathBlockViewOptions,
10
+ } from './math-block.ts'
11
+ export {
12
+ defineMathInline,
13
+ defineMathInlineInputRule,
14
+ defineMathInlineSpec,
15
+ defineMathInlineView,
16
+ type MathInlineExtension,
17
+ type MathInlineOptions,
18
+ type MathInlineSpecExtension,
19
+ type MathInlineViewOptions,
20
+ } from './math-inline.ts'
21
+ export { defineMathPlugin } from './math-plugin.ts'
22
+ export { defineMath, type MathExtension, type MathOptions } from './math.ts'
@@ -0,0 +1,96 @@
1
+ import { defineNodeSpec, defineNodeView, union, type Extension, type PlainExtension, type Union } from '@prosekit/core'
2
+ import type { Attrs } from '@prosekit/pm/model'
3
+ import { createMathBlockView, mathBlockEnterRule, mathBlockSpec, type RenderMathBlock } from 'prosemirror-math'
4
+
5
+ import { defineEnterRule } from '../enter-rule/index.ts'
6
+
7
+ /**
8
+ * @internal
9
+ */
10
+ export type MathBlockSpecExtension = Extension<{
11
+ Nodes: {
12
+ mathBlock: Attrs
13
+ }
14
+ }>
15
+
16
+ /**
17
+ * @internal
18
+ */
19
+ export function defineMathBlockSpec(): MathBlockSpecExtension {
20
+ return defineNodeSpec<'mathBlock', Attrs>({
21
+ ...mathBlockSpec,
22
+ attrs: {
23
+ // The language in the `mathBlock` node, useful for syntax highlighting.
24
+ // This library doesn't focus on using the TeX language in a `mathBlock` node,
25
+ // but this is the most common language used for math blocks in rich text
26
+ // editors, so 'tex' is set as the default value.
27
+ language: { default: 'tex', validate: 'string' },
28
+ },
29
+ name: 'mathBlock',
30
+ })
31
+ }
32
+
33
+ /**
34
+ * Options for {@link defineMathBlockView}.
35
+ *
36
+ * @internal
37
+ */
38
+ export interface MathBlockViewOptions {
39
+ /**
40
+ * The function to render the math block.
41
+ */
42
+ render: RenderMathBlock
43
+ }
44
+
45
+ /**
46
+ * Defines an extension that renders a math block using a custom node view.
47
+ *
48
+ * @param options
49
+ * @internal
50
+ */
51
+ export function defineMathBlockView({ render }: MathBlockViewOptions): Extension {
52
+ return defineNodeView({
53
+ name: 'mathBlock',
54
+ constructor: (node, view, getPos, decorations) => {
55
+ return createMathBlockView(render, node, decorations)
56
+ },
57
+ })
58
+ }
59
+
60
+ /**
61
+ * @internal
62
+ */
63
+ export function defineMathBlockEnterRule(): PlainExtension {
64
+ return defineEnterRule(mathBlockEnterRule)
65
+ }
66
+
67
+ /**
68
+ * Options for {@link defineMathBlock}.
69
+ *
70
+ * @internal
71
+ */
72
+ export interface MathBlockOptions {
73
+ /**
74
+ * The function to render the math block.
75
+ */
76
+ render: RenderMathBlock
77
+ }
78
+
79
+ /**
80
+ * @internal
81
+ */
82
+ export type MathBlockExtension = Union<[MathBlockSpecExtension]>
83
+
84
+ /**
85
+ * Defines node `mathBlock` and related functionalities.
86
+ *
87
+ * @param options
88
+ * @public
89
+ */
90
+ export function defineMathBlock(options: MathBlockOptions): MathBlockExtension {
91
+ return union(
92
+ defineMathBlockSpec(),
93
+ defineMathBlockView(options),
94
+ defineMathBlockEnterRule(),
95
+ )
96
+ }
@@ -0,0 +1,89 @@
1
+ import { defineNodeSpec, defineNodeView, union, type Extension, type PlainExtension, type Union } from '@prosekit/core'
2
+ import type { Attrs } from '@prosekit/pm/model'
3
+ import { createMathInlineInputRule, createMathInlineView, mathInlineSpec, type RenderMathInline } from 'prosemirror-math'
4
+
5
+ import { defineInputRule } from '../input-rule/index.ts'
6
+
7
+ /**
8
+ * @internal
9
+ */
10
+ export type MathInlineSpecExtension = Extension<{
11
+ Nodes: {
12
+ mathInline: Attrs
13
+ }
14
+ }>
15
+
16
+ /**
17
+ * @internal
18
+ */
19
+ export function defineMathInlineSpec(): MathInlineSpecExtension {
20
+ return defineNodeSpec<'mathInline', Attrs>({
21
+ ...mathInlineSpec,
22
+ name: 'mathInline',
23
+ })
24
+ }
25
+
26
+ /**
27
+ * Options for {@link defineMathInlineView}.
28
+ *
29
+ * @internal
30
+ */
31
+ export interface MathInlineViewOptions {
32
+ /**
33
+ * The function to render the math inline.
34
+ */
35
+ render: RenderMathInline
36
+ }
37
+
38
+ /**
39
+ * Defines an extension that renders a math inline using a custom node view.
40
+ *
41
+ * @param options
42
+ * @internal
43
+ */
44
+ export function defineMathInlineView({ render }: MathInlineViewOptions): Extension {
45
+ return defineNodeView({
46
+ name: 'mathInline',
47
+ constructor: (node, view, getPos, decorations) => {
48
+ return createMathInlineView(render, node, decorations)
49
+ },
50
+ })
51
+ }
52
+
53
+ /**
54
+ * @internal
55
+ */
56
+ export function defineMathInlineInputRule(): PlainExtension {
57
+ return defineInputRule(createMathInlineInputRule('mathInline'))
58
+ }
59
+
60
+ /**
61
+ * Options for {@link defineMathInline}.
62
+ *
63
+ * @internal
64
+ */
65
+ export interface MathInlineOptions {
66
+ /**
67
+ * The function to render the math inline.
68
+ */
69
+ render: RenderMathInline
70
+ }
71
+
72
+ /**
73
+ * @internal
74
+ */
75
+ export type MathInlineExtension = Union<[MathInlineSpecExtension]>
76
+
77
+ /**
78
+ * Defines node `mathInline` and related functionalities.
79
+ *
80
+ * @param options
81
+ * @public
82
+ */
83
+ export function defineMathInline(options: MathInlineOptions): MathInlineExtension {
84
+ return union(
85
+ defineMathInlineSpec(),
86
+ defineMathInlineView(options),
87
+ defineMathInlineInputRule(),
88
+ )
89
+ }
@@ -0,0 +1,8 @@
1
+ import { definePlugin, type PlainExtension } from '@prosekit/core'
2
+ import { createCursorInsidePlugin } from 'prosemirror-math'
3
+
4
+ export function defineMathPlugin(): PlainExtension {
5
+ return definePlugin(
6
+ createCursorInsidePlugin(),
7
+ )
8
+ }
@@ -0,0 +1,39 @@
1
+ import { union, type Union } from '@prosekit/core'
2
+ import type { RenderMathBlock, RenderMathInline } from 'prosemirror-math'
3
+
4
+ import { defineMathBlock, type MathBlockExtension } from './math-block.ts'
5
+ import { defineMathInline, type MathInlineExtension } from './math-inline.ts'
6
+ import { defineMathPlugin } from './math-plugin.ts'
7
+
8
+ /**
9
+ * @public
10
+ */
11
+ export type MathExtension = Union<[MathInlineExtension, MathBlockExtension]>
12
+
13
+ /**
14
+ * Options for {@link defineMath}.
15
+ *
16
+ * @public
17
+ */
18
+ export interface MathOptions {
19
+ /**
20
+ * The function to render the math block.
21
+ */
22
+ renderMathBlock: RenderMathBlock
23
+
24
+ /**
25
+ * The function to render the math inline.
26
+ */
27
+ renderMathInline: RenderMathInline
28
+ }
29
+
30
+ /**
31
+ * @public
32
+ */
33
+ export function defineMath(options: MathOptions): MathExtension {
34
+ return union(
35
+ defineMathBlock({ render: options.renderMathBlock }),
36
+ defineMathInline({ render: options.renderMathInline }),
37
+ defineMathPlugin(),
38
+ )
39
+ }
@@ -1,7 +1,7 @@
1
- export { defineParagraph } from './paragraph'
2
- export type { ParagraphExtension } from './paragraph'
3
- export { defineParagraphCommands } from './paragraph-commands'
4
- export type { ParagraphCommandsExtension } from './paragraph-commands'
5
- export { defineParagraphKeymap } from './paragraph-keymap'
6
- export { defineParagraphSpec } from './paragraph-spec'
7
- export type { ParagraphSpecExtension } from './paragraph-spec'
1
+ export { defineParagraphCommands } from './paragraph-commands.ts'
2
+ export type { ParagraphCommandsExtension } from './paragraph-commands.ts'
3
+ export { defineParagraphKeymap } from './paragraph-keymap.ts'
4
+ export { defineParagraphSpec } from './paragraph-spec.ts'
5
+ export type { ParagraphSpecExtension } from './paragraph-spec.ts'
6
+ export { defineParagraph } from './paragraph.ts'
7
+ export type { ParagraphExtension } from './paragraph.ts'
@@ -1,6 +1,6 @@
1
1
  import { defineKeymap, type PlainExtension } from '@prosekit/core'
2
2
 
3
- import { setParagraph } from './paragraph-commands'
3
+ import { setParagraph } from './paragraph-commands.ts'
4
4
 
5
5
  /**
6
6
  * @internal
@@ -1,8 +1,8 @@
1
1
  import { Priority, union, withPriority, type Union } from '@prosekit/core'
2
2
 
3
- import { defineParagraphCommands, type ParagraphCommandsExtension } from './paragraph-commands'
4
- import { defineParagraphKeymap } from './paragraph-keymap'
5
- import { defineParagraphSpec, type ParagraphSpecExtension } from './paragraph-spec'
3
+ import { defineParagraphCommands, type ParagraphCommandsExtension } from './paragraph-commands.ts'
4
+ import { defineParagraphKeymap } from './paragraph-keymap.ts'
5
+ import { defineParagraphSpec, type ParagraphSpecExtension } from './paragraph-spec.ts'
6
6
 
7
7
  /**
8
8
  * @internal
@@ -1,2 +1,2 @@
1
- export { defineMarkPasteRule, type MarkPasteRuleOptions } from './mark-paste-rule'
2
- export { definePasteRule, type PasteRuleHandler, type PasteRuleHandlerOptions, type PasteRuleOptions } from './paste-rule'
1
+ export { defineMarkPasteRule, type MarkPasteRuleOptions } from './mark-paste-rule.ts'
2
+ export { definePasteRule, type PasteRuleHandler, type PasteRuleHandlerOptions, type PasteRuleOptions } from './paste-rule.ts'
@@ -1,15 +1,15 @@
1
1
  import { defineMarkSpec, union } from '@prosekit/core'
2
2
  import { describe, expect, it } from 'vitest'
3
3
 
4
- import { defineBold } from '../bold'
5
- import { defineDoc } from '../doc'
6
- import { defineParagraph } from '../paragraph'
7
- import { setupTestFromExtension } from '../testing'
8
- import { pasteHTML, pasteText } from '../testing/clipboard'
9
- import { defineText } from '../text'
4
+ import { defineBold } from '../bold/index.ts'
5
+ import { defineDoc } from '../doc/index.ts'
6
+ import { defineParagraph } from '../paragraph/index.ts'
7
+ import { pasteHTML, pasteText } from '../testing/clipboard.ts'
8
+ import { setupTestFromExtension } from '../testing/index.ts'
9
+ import { defineText } from '../text/index.ts'
10
10
 
11
- import type { MarkPasteRuleOptions } from './mark-paste-rule'
12
- import { defineMarkPasteRule } from './mark-paste-rule'
11
+ import type { MarkPasteRuleOptions } from './mark-paste-rule.ts'
12
+ import { defineMarkPasteRule } from './mark-paste-rule.ts'
13
13
 
14
14
  function setup(options?: Partial<MarkPasteRuleOptions>) {
15
15
  return setupTestFromExtension(union(
@@ -2,8 +2,8 @@ import { getMarkType, type PlainExtension } from '@prosekit/core'
2
2
  import type { Attrs, MarkType, ProseMirrorNode } from '@prosekit/pm/model'
3
3
  import { Fragment, Slice } from '@prosekit/pm/model'
4
4
 
5
- import { definePasteRule } from './paste-rule'
6
- import { splitTextByRegex } from './split-text-by-regex'
5
+ import { definePasteRule } from './paste-rule.ts'
6
+ import { splitTextByRegex } from './split-text-by-regex.ts'
7
7
 
8
8
  /**
9
9
  * The options for {@link defineMarkPasteRule}.
@@ -3,9 +3,9 @@ import type { ProseMirrorNode } from '@prosekit/pm/model'
3
3
  import { Fragment, Slice } from '@prosekit/pm/model'
4
4
  import { describe, expect, it } from 'vitest'
5
5
 
6
- import { defineTestExtension, setupTestFromExtension } from '../testing'
6
+ import { defineTestExtension, setupTestFromExtension } from '../testing/index.ts'
7
7
 
8
- import { definePasteRule } from './paste-rule'
8
+ import { definePasteRule } from './paste-rule.ts'
9
9
 
10
10
  function replaceTextInSlice(slice: Slice, from: string, to: string): Slice {
11
11
  return new Slice(
@@ -2,7 +2,7 @@ import type { PlainExtension } from '@prosekit/core'
2
2
  import type { Slice } from '@prosekit/pm/model'
3
3
  import type { EditorView } from '@prosekit/pm/view'
4
4
 
5
- import { definePasteRulePlugin } from './paste-rule-plugin'
5
+ import { definePasteRulePlugin } from './paste-rule-plugin.ts'
6
6
 
7
7
  /**
8
8
  * @public