@kopexa/tiptap 17.6.18 → 17.7.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 (428) hide show
  1. package/dist/index.d.mts +691 -24
  2. package/dist/index.d.ts +691 -24
  3. package/dist/index.js +1478 -786
  4. package/dist/index.mjs +7987 -112
  5. package/package.json +57 -52
  6. package/dist/chunk-2SI7MRAE.mjs +0 -64
  7. package/dist/chunk-2U5CQUZH.mjs +0 -91
  8. package/dist/chunk-2UDCL55K.mjs +0 -55
  9. package/dist/chunk-2V6VOAPI.mjs +0 -139
  10. package/dist/chunk-2Z2QVW67.mjs +0 -1
  11. package/dist/chunk-32SUXCAQ.mjs +0 -115
  12. package/dist/chunk-33QD5PYJ.mjs +0 -63
  13. package/dist/chunk-3VRQUYYW.mjs +0 -169
  14. package/dist/chunk-42HKGCOO.mjs +0 -129
  15. package/dist/chunk-4ALV4UA5.mjs +0 -1
  16. package/dist/chunk-4CDZ547I.mjs +0 -185
  17. package/dist/chunk-4HO7BWDC.mjs +0 -89
  18. package/dist/chunk-4JRYQZ4A.mjs +0 -174
  19. package/dist/chunk-552JLRNB.mjs +0 -35
  20. package/dist/chunk-5SMDMQDF.mjs +0 -34
  21. package/dist/chunk-6552DQWB.mjs +0 -416
  22. package/dist/chunk-7FDDRVUE.mjs +0 -143
  23. package/dist/chunk-7VGROP26.mjs +0 -262
  24. package/dist/chunk-7VW67NVL.mjs +0 -80
  25. package/dist/chunk-AAV7ZNBP.mjs +0 -83
  26. package/dist/chunk-ATRHILCH.mjs +0 -1
  27. package/dist/chunk-B7WJOQ3X.mjs +0 -103
  28. package/dist/chunk-BEV5U2DK.mjs +0 -131
  29. package/dist/chunk-BXHPO3T7.mjs +0 -152
  30. package/dist/chunk-BXJYNSWQ.mjs +0 -30
  31. package/dist/chunk-C5RQWJKE.mjs +0 -155
  32. package/dist/chunk-CNVACBGT.mjs +0 -51
  33. package/dist/chunk-DQK6PA4U.mjs +0 -276
  34. package/dist/chunk-DSBJFMHK.mjs +0 -38
  35. package/dist/chunk-DT7ML2P4.mjs +0 -42
  36. package/dist/chunk-DZLGLP7R.mjs +0 -99
  37. package/dist/chunk-EAAQE5ZV.mjs +0 -283
  38. package/dist/chunk-EHY2NAW7.mjs +0 -120
  39. package/dist/chunk-EIIWU5FR.mjs +0 -61
  40. package/dist/chunk-ERPGWXFK.mjs +0 -163
  41. package/dist/chunk-F73FCUD5.mjs +0 -1
  42. package/dist/chunk-FRJX2F4T.mjs +0 -55
  43. package/dist/chunk-GYIYX2JH.mjs +0 -73
  44. package/dist/chunk-H6LC4LDQ.mjs +0 -63
  45. package/dist/chunk-H7MS2UMO.mjs +0 -168
  46. package/dist/chunk-HLLA2HRV.mjs +0 -1
  47. package/dist/chunk-HTJ2RXOG.mjs +0 -32
  48. package/dist/chunk-IFXRPGIJ.mjs +0 -98
  49. package/dist/chunk-IOB3REX6.mjs +0 -173
  50. package/dist/chunk-IQERE7KP.mjs +0 -115
  51. package/dist/chunk-JCV5SEKN.mjs +0 -65
  52. package/dist/chunk-JVSH5T4B.mjs +0 -72
  53. package/dist/chunk-KK4K43WM.mjs +0 -59
  54. package/dist/chunk-KR42JAVB.mjs +0 -60
  55. package/dist/chunk-KYLBKQ2E.mjs +0 -203
  56. package/dist/chunk-L5RDMV3H.mjs +0 -216
  57. package/dist/chunk-LNVWG34E.mjs +0 -165
  58. package/dist/chunk-LVNUU67N.mjs +0 -1
  59. package/dist/chunk-MNTOOEHA.mjs +0 -1
  60. package/dist/chunk-N3JE67CS.mjs +0 -81
  61. package/dist/chunk-N4CT5RNC.mjs +0 -123
  62. package/dist/chunk-OEVR5N7X.mjs +0 -65
  63. package/dist/chunk-P55PLOHR.mjs +0 -34
  64. package/dist/chunk-Q5FK7SFY.mjs +0 -75
  65. package/dist/chunk-Q7DFJ5NI.mjs +0 -153
  66. package/dist/chunk-QIELBKP3.mjs +0 -104
  67. package/dist/chunk-R2GM4A3T.mjs +0 -71
  68. package/dist/chunk-REJEJXOZ.mjs +0 -10
  69. package/dist/chunk-RFWNKE7D.mjs +0 -238
  70. package/dist/chunk-TAM3VMJT.mjs +0 -80
  71. package/dist/chunk-TDFS3DCZ.mjs +0 -79
  72. package/dist/chunk-TLM5ALHZ.mjs +0 -1
  73. package/dist/chunk-TZQQ6C2Q.mjs +0 -101
  74. package/dist/chunk-U5XAL46P.mjs +0 -39
  75. package/dist/chunk-UJ4BNZ63.mjs +0 -178
  76. package/dist/chunk-UVHVCION.mjs +0 -168
  77. package/dist/chunk-V6TAZMQN.mjs +0 -105
  78. package/dist/chunk-VF3G2URZ.mjs +0 -83
  79. package/dist/chunk-VRQ6OSAZ.mjs +0 -76
  80. package/dist/chunk-VTKJPVNM.mjs +0 -148
  81. package/dist/chunk-VX3HSJ76.mjs +0 -73
  82. package/dist/chunk-W2FLOOJ6.mjs +0 -75
  83. package/dist/chunk-XGAABDMW.mjs +0 -159
  84. package/dist/chunk-Y2KSWMG5.mjs +0 -1
  85. package/dist/chunk-YJAHZXLG.mjs +0 -92
  86. package/dist/chunk-Z365KVQY.mjs +0 -34
  87. package/dist/chunk-ZVTJ6XD7.mjs +0 -88
  88. package/dist/chunk-ZZ4OU46C.mjs +0 -131
  89. package/dist/context/editor-context.d.mts +0 -10
  90. package/dist/context/editor-context.d.ts +0 -10
  91. package/dist/context/editor-context.js +0 -34
  92. package/dist/context/editor-context.mjs +0 -9
  93. package/dist/context/editor-file-context.d.mts +0 -70
  94. package/dist/context/editor-file-context.d.ts +0 -70
  95. package/dist/context/editor-file-context.js +0 -96
  96. package/dist/context/editor-file-context.mjs +0 -12
  97. package/dist/extensions/callout/callout-settings.d.mts +0 -13
  98. package/dist/extensions/callout/callout-settings.d.ts +0 -13
  99. package/dist/extensions/callout/callout-settings.js +0 -206
  100. package/dist/extensions/callout/callout-settings.mjs +0 -9
  101. package/dist/extensions/callout/callout-view.d.mts +0 -12
  102. package/dist/extensions/callout/callout-view.d.ts +0 -12
  103. package/dist/extensions/callout/callout-view.js +0 -273
  104. package/dist/extensions/callout/callout-view.mjs +0 -12
  105. package/dist/extensions/callout/index.d.mts +0 -44
  106. package/dist/extensions/callout/index.d.ts +0 -44
  107. package/dist/extensions/callout/index.js +0 -380
  108. package/dist/extensions/callout/index.mjs +0 -13
  109. package/dist/extensions/callout/messages.d.mts +0 -59
  110. package/dist/extensions/callout/messages.d.ts +0 -59
  111. package/dist/extensions/callout/messages.js +0 -88
  112. package/dist/extensions/callout/messages.mjs +0 -7
  113. package/dist/extensions/image/image-view.d.mts +0 -15
  114. package/dist/extensions/image/image-view.d.ts +0 -15
  115. package/dist/extensions/image/image-view.js +0 -255
  116. package/dist/extensions/image/image-view.mjs +0 -12
  117. package/dist/extensions/image/index.d.mts +0 -29
  118. package/dist/extensions/image/index.d.ts +0 -29
  119. package/dist/extensions/image/index.js +0 -282
  120. package/dist/extensions/image/index.mjs +0 -16
  121. package/dist/extensions/image/messages.d.mts +0 -28
  122. package/dist/extensions/image/messages.d.ts +0 -28
  123. package/dist/extensions/image/messages.js +0 -57
  124. package/dist/extensions/image/messages.mjs +0 -7
  125. package/dist/extensions/image-upload/image-upload-view.d.mts +0 -12
  126. package/dist/extensions/image-upload/image-upload-view.d.ts +0 -12
  127. package/dist/extensions/image-upload/image-upload-view.js +0 -338
  128. package/dist/extensions/image-upload/image-upload-view.mjs +0 -12
  129. package/dist/extensions/image-upload/index.d.mts +0 -46
  130. package/dist/extensions/image-upload/index.d.ts +0 -46
  131. package/dist/extensions/image-upload/index.js +0 -414
  132. package/dist/extensions/image-upload/index.mjs +0 -16
  133. package/dist/extensions/image-upload/messages.d.mts +0 -32
  134. package/dist/extensions/image-upload/messages.d.ts +0 -32
  135. package/dist/extensions/image-upload/messages.js +0 -61
  136. package/dist/extensions/image-upload/messages.mjs +0 -7
  137. package/dist/extensions/link/index.d.mts +0 -6
  138. package/dist/extensions/link/index.d.ts +0 -6
  139. package/dist/extensions/link/index.js +0 -94
  140. package/dist/extensions/link/index.mjs +0 -7
  141. package/dist/extensions/math/index.d.mts +0 -38
  142. package/dist/extensions/math/index.d.ts +0 -38
  143. package/dist/extensions/math/index.js +0 -544
  144. package/dist/extensions/math/index.mjs +0 -17
  145. package/dist/extensions/math/inline-math-view.d.mts +0 -12
  146. package/dist/extensions/math/inline-math-view.d.ts +0 -12
  147. package/dist/extensions/math/inline-math-view.js +0 -232
  148. package/dist/extensions/math/inline-math-view.mjs +0 -11
  149. package/dist/extensions/math/inline-math.d.mts +0 -32
  150. package/dist/extensions/math/inline-math.d.ts +0 -32
  151. package/dist/extensions/math/inline-math.js +0 -304
  152. package/dist/extensions/math/inline-math.mjs +0 -12
  153. package/dist/extensions/math/math-block-view.d.mts +0 -11
  154. package/dist/extensions/math/math-block-view.d.ts +0 -11
  155. package/dist/extensions/math/math-block-view.js +0 -248
  156. package/dist/extensions/math/math-block-view.mjs +0 -11
  157. package/dist/extensions/math/messages.d.mts +0 -49
  158. package/dist/extensions/math/messages.d.ts +0 -49
  159. package/dist/extensions/math/messages.js +0 -78
  160. package/dist/extensions/math/messages.mjs +0 -7
  161. package/dist/extensions/selection/index.d.mts +0 -5
  162. package/dist/extensions/selection/index.d.ts +0 -5
  163. package/dist/extensions/selection/index.js +0 -62
  164. package/dist/extensions/selection/index.mjs +0 -7
  165. package/dist/extensions/toc/index.d.mts +0 -53
  166. package/dist/extensions/toc/index.d.ts +0 -53
  167. package/dist/extensions/toc/index.js +0 -501
  168. package/dist/extensions/toc/index.mjs +0 -13
  169. package/dist/extensions/toc/messages.d.mts +0 -74
  170. package/dist/extensions/toc/messages.d.ts +0 -74
  171. package/dist/extensions/toc/messages.js +0 -103
  172. package/dist/extensions/toc/messages.mjs +0 -7
  173. package/dist/extensions/toc/toc-settings.d.mts +0 -13
  174. package/dist/extensions/toc/toc-settings.d.ts +0 -13
  175. package/dist/extensions/toc/toc-settings.js +0 -283
  176. package/dist/extensions/toc/toc-settings.mjs +0 -9
  177. package/dist/extensions/toc/toc-view.d.mts +0 -12
  178. package/dist/extensions/toc/toc-view.d.ts +0 -12
  179. package/dist/extensions/toc/toc-view.js +0 -411
  180. package/dist/extensions/toc/toc-view.mjs +0 -12
  181. package/dist/extensions/trailing-node/index.d.mts +0 -9
  182. package/dist/extensions/trailing-node/index.d.ts +0 -9
  183. package/dist/extensions/trailing-node/index.js +0 -86
  184. package/dist/extensions/trailing-node/index.mjs +0 -7
  185. package/dist/extensions/ui-state/index.d.mts +0 -34
  186. package/dist/extensions/ui-state/index.d.ts +0 -34
  187. package/dist/extensions/ui-state/index.js +0 -84
  188. package/dist/extensions/ui-state/index.mjs +0 -9
  189. package/dist/extensions/variable/extract-variables.d.mts +0 -16
  190. package/dist/extensions/variable/extract-variables.d.ts +0 -16
  191. package/dist/extensions/variable/extract-variables.js +0 -58
  192. package/dist/extensions/variable/extract-variables.mjs +0 -7
  193. package/dist/extensions/variable/index.d.mts +0 -38
  194. package/dist/extensions/variable/index.d.ts +0 -38
  195. package/dist/extensions/variable/index.js +0 -190
  196. package/dist/extensions/variable/index.mjs +0 -11
  197. package/dist/extensions/variable/messages.d.mts +0 -69
  198. package/dist/extensions/variable/messages.d.ts +0 -69
  199. package/dist/extensions/variable/messages.js +0 -98
  200. package/dist/extensions/variable/messages.mjs +0 -7
  201. package/dist/extensions/variable/variable-context.d.mts +0 -56
  202. package/dist/extensions/variable/variable-context.d.ts +0 -56
  203. package/dist/extensions/variable/variable-context.js +0 -70
  204. package/dist/extensions/variable/variable-context.mjs +0 -12
  205. package/dist/extensions/variable/variable-filler-dialog.d.mts +0 -43
  206. package/dist/extensions/variable/variable-filler-dialog.d.ts +0 -43
  207. package/dist/extensions/variable/variable-filler-dialog.js +0 -207
  208. package/dist/extensions/variable/variable-filler-dialog.mjs +0 -9
  209. package/dist/extensions/variable/variable-suggestion.d.mts +0 -31
  210. package/dist/extensions/variable/variable-suggestion.d.ts +0 -31
  211. package/dist/extensions/variable/variable-suggestion.js +0 -615
  212. package/dist/extensions/variable/variable-suggestion.mjs +0 -14
  213. package/dist/extensions/variable/variable-view.d.mts +0 -13
  214. package/dist/extensions/variable/variable-view.d.ts +0 -13
  215. package/dist/extensions/variable/variable-view.js +0 -110
  216. package/dist/extensions/variable/variable-view.mjs +0 -11
  217. package/dist/hooks/use-create-editor.d.mts +0 -46
  218. package/dist/hooks/use-create-editor.d.ts +0 -46
  219. package/dist/hooks/use-create-editor.js +0 -2726
  220. package/dist/hooks/use-create-editor.mjs +0 -37
  221. package/dist/hooks/use-cursor-visibility.d.mts +0 -37
  222. package/dist/hooks/use-cursor-visibility.d.ts +0 -37
  223. package/dist/hooks/use-cursor-visibility.js +0 -140
  224. package/dist/hooks/use-cursor-visibility.mjs +0 -8
  225. package/dist/hooks/use-floating-element.d.mts +0 -43
  226. package/dist/hooks/use-floating-element.d.ts +0 -43
  227. package/dist/hooks/use-floating-element.js +0 -88
  228. package/dist/hooks/use-floating-element.mjs +0 -8
  229. package/dist/hooks/use-floating-toolbar-visibility.d.mts +0 -32
  230. package/dist/hooks/use-floating-toolbar-visibility.d.ts +0 -32
  231. package/dist/hooks/use-floating-toolbar-visibility.js +0 -115
  232. package/dist/hooks/use-floating-toolbar-visibility.mjs +0 -13
  233. package/dist/hooks/use-menu-navigation.d.mts +0 -55
  234. package/dist/hooks/use-menu-navigation.d.ts +0 -55
  235. package/dist/hooks/use-menu-navigation.js +0 -163
  236. package/dist/hooks/use-menu-navigation.mjs +0 -8
  237. package/dist/hooks/use-tiptap-editor.d.mts +0 -20
  238. package/dist/hooks/use-tiptap-editor.d.ts +0 -20
  239. package/dist/hooks/use-tiptap-editor.js +0 -58
  240. package/dist/hooks/use-tiptap-editor.mjs +0 -8
  241. package/dist/hooks/use-ui-editor-state.d.mts +0 -7
  242. package/dist/hooks/use-ui-editor-state.d.ts +0 -7
  243. package/dist/hooks/use-ui-editor-state.js +0 -107
  244. package/dist/hooks/use-ui-editor-state.mjs +0 -11
  245. package/dist/hooks/use-window-size.d.mts +0 -12
  246. package/dist/hooks/use-window-size.d.ts +0 -12
  247. package/dist/hooks/use-window-size.js +0 -75
  248. package/dist/hooks/use-window-size.mjs +0 -7
  249. package/dist/presets/basic/editor-header.d.mts +0 -23
  250. package/dist/presets/basic/editor-header.d.ts +0 -23
  251. package/dist/presets/basic/editor-header.js +0 -2750
  252. package/dist/presets/basic/editor-header.mjs +0 -43
  253. package/dist/presets/basic/index.d.mts +0 -38
  254. package/dist/presets/basic/index.d.ts +0 -38
  255. package/dist/presets/basic/index.js +0 -6891
  256. package/dist/presets/basic/index.mjs +0 -85
  257. package/dist/ui/blockquote-button/blockquote-button.d.mts +0 -20
  258. package/dist/ui/blockquote-button/blockquote-button.d.ts +0 -20
  259. package/dist/ui/blockquote-button/blockquote-button.js +0 -247
  260. package/dist/ui/blockquote-button/blockquote-button.mjs +0 -9
  261. package/dist/ui/blockquote-button/index.d.mts +0 -6
  262. package/dist/ui/blockquote-button/index.d.ts +0 -6
  263. package/dist/ui/blockquote-button/index.js +0 -259
  264. package/dist/ui/blockquote-button/index.mjs +0 -21
  265. package/dist/ui/blockquote-button/use-blockquote.d.mts +0 -85
  266. package/dist/ui/blockquote-button/use-blockquote.d.ts +0 -85
  267. package/dist/ui/blockquote-button/use-blockquote.js +0 -192
  268. package/dist/ui/blockquote-button/use-blockquote.mjs +0 -17
  269. package/dist/ui/bubble-menu/index.d.mts +0 -13
  270. package/dist/ui/bubble-menu/index.d.ts +0 -13
  271. package/dist/ui/bubble-menu/index.js +0 -673
  272. package/dist/ui/bubble-menu/index.mjs +0 -16
  273. package/dist/ui/codeblock-button/code-block-button.d.mts +0 -20
  274. package/dist/ui/codeblock-button/code-block-button.d.ts +0 -20
  275. package/dist/ui/codeblock-button/code-block-button.js +0 -237
  276. package/dist/ui/codeblock-button/code-block-button.mjs +0 -9
  277. package/dist/ui/codeblock-button/index.d.mts +0 -6
  278. package/dist/ui/codeblock-button/index.d.ts +0 -6
  279. package/dist/ui/codeblock-button/index.js +0 -249
  280. package/dist/ui/codeblock-button/index.mjs +0 -21
  281. package/dist/ui/codeblock-button/use-code-block.d.mts +0 -92
  282. package/dist/ui/codeblock-button/use-code-block.d.ts +0 -92
  283. package/dist/ui/codeblock-button/use-code-block.js +0 -192
  284. package/dist/ui/codeblock-button/use-code-block.mjs +0 -17
  285. package/dist/ui/color-highlight-button/color-highlight-button.d.mts +0 -25
  286. package/dist/ui/color-highlight-button/color-highlight-button.d.ts +0 -25
  287. package/dist/ui/color-highlight-button/color-highlight-button.js +0 -266
  288. package/dist/ui/color-highlight-button/color-highlight-button.mjs +0 -9
  289. package/dist/ui/color-highlight-button/index.d.mts +0 -6
  290. package/dist/ui/color-highlight-button/index.d.ts +0 -6
  291. package/dist/ui/color-highlight-button/index.js +0 -342
  292. package/dist/ui/color-highlight-button/index.mjs +0 -27
  293. package/dist/ui/color-highlight-button/use-color-highlight.d.mts +0 -64
  294. package/dist/ui/color-highlight-button/use-color-highlight.d.ts +0 -64
  295. package/dist/ui/color-highlight-button/use-color-highlight.js +0 -247
  296. package/dist/ui/color-highlight-button/use-color-highlight.mjs +0 -23
  297. package/dist/ui/color-highlight-popover/color-highlight-popover.d.mts +0 -29
  298. package/dist/ui/color-highlight-popover/color-highlight-popover.d.ts +0 -29
  299. package/dist/ui/color-highlight-popover/color-highlight-popover.js +0 -590
  300. package/dist/ui/color-highlight-popover/color-highlight-popover.mjs +0 -17
  301. package/dist/ui/color-highlight-popover/index.d.mts +0 -6
  302. package/dist/ui/color-highlight-popover/index.d.ts +0 -6
  303. package/dist/ui/color-highlight-popover/index.js +0 -591
  304. package/dist/ui/color-highlight-popover/index.mjs +0 -17
  305. package/dist/ui/copy-anchor-link-button/use-scroll-to-hash.d.mts +0 -30
  306. package/dist/ui/copy-anchor-link-button/use-scroll-to-hash.d.ts +0 -30
  307. package/dist/ui/copy-anchor-link-button/use-scroll-to-hash.js +0 -171
  308. package/dist/ui/copy-anchor-link-button/use-scroll-to-hash.mjs +0 -10
  309. package/dist/ui/heading-button/index.d.mts +0 -45
  310. package/dist/ui/heading-button/index.d.ts +0 -45
  311. package/dist/ui/heading-button/index.js +0 -222
  312. package/dist/ui/heading-button/index.mjs +0 -16
  313. package/dist/ui/heading-button/utils.d.mts +0 -17
  314. package/dist/ui/heading-button/utils.d.ts +0 -17
  315. package/dist/ui/heading-button/utils.js +0 -92
  316. package/dist/ui/heading-button/utils.mjs +0 -19
  317. package/dist/ui/heading-dropdown-menu/index.d.mts +0 -14
  318. package/dist/ui/heading-dropdown-menu/index.d.ts +0 -14
  319. package/dist/ui/heading-dropdown-menu/index.js +0 -308
  320. package/dist/ui/heading-dropdown-menu/index.mjs +0 -10
  321. package/dist/ui/link-bubble/index.d.mts +0 -13
  322. package/dist/ui/link-bubble/index.d.ts +0 -13
  323. package/dist/ui/link-bubble/index.js +0 -183
  324. package/dist/ui/link-bubble/index.mjs +0 -10
  325. package/dist/ui/link-popover/index.d.mts +0 -7
  326. package/dist/ui/link-popover/index.d.ts +0 -7
  327. package/dist/ui/link-popover/index.js +0 -512
  328. package/dist/ui/link-popover/index.mjs +0 -30
  329. package/dist/ui/link-popover/link-popover.d.mts +0 -85
  330. package/dist/ui/link-popover/link-popover.d.ts +0 -85
  331. package/dist/ui/link-popover/link-popover.js +0 -498
  332. package/dist/ui/link-popover/link-popover.mjs +0 -16
  333. package/dist/ui/link-popover/use-link-popover.d.mts +0 -123
  334. package/dist/ui/link-popover/use-link-popover.d.ts +0 -123
  335. package/dist/ui/link-popover/use-link-popover.js +0 -259
  336. package/dist/ui/link-popover/use-link-popover.mjs +0 -20
  337. package/dist/ui/list-button/index.d.mts +0 -50
  338. package/dist/ui/list-button/index.d.ts +0 -50
  339. package/dist/ui/list-button/index.js +0 -232
  340. package/dist/ui/list-button/index.mjs +0 -24
  341. package/dist/ui/list-dropdown-menu/index.d.mts +0 -45
  342. package/dist/ui/list-dropdown-menu/index.d.ts +0 -45
  343. package/dist/ui/list-dropdown-menu/index.js +0 -361
  344. package/dist/ui/list-dropdown-menu/index.mjs +0 -21
  345. package/dist/ui/mark-button/index.d.mts +0 -59
  346. package/dist/ui/mark-button/index.d.ts +0 -59
  347. package/dist/ui/mark-button/index.js +0 -217
  348. package/dist/ui/mark-button/index.mjs +0 -26
  349. package/dist/ui/reset-all-formatting-button/index.d.mts +0 -7
  350. package/dist/ui/reset-all-formatting-button/index.d.ts +0 -7
  351. package/dist/ui/reset-all-formatting-button/index.js +0 -286
  352. package/dist/ui/reset-all-formatting-button/index.mjs +0 -26
  353. package/dist/ui/reset-all-formatting-button/reset-all-formatting-button.d.mts +0 -30
  354. package/dist/ui/reset-all-formatting-button/reset-all-formatting-button.d.ts +0 -30
  355. package/dist/ui/reset-all-formatting-button/reset-all-formatting-button.js +0 -271
  356. package/dist/ui/reset-all-formatting-button/reset-all-formatting-button.mjs +0 -12
  357. package/dist/ui/reset-all-formatting-button/use-reset-all-formatting.d.mts +0 -103
  358. package/dist/ui/reset-all-formatting-button/use-reset-all-formatting.d.ts +0 -103
  359. package/dist/ui/reset-all-formatting-button/use-reset-all-formatting.js +0 -211
  360. package/dist/ui/reset-all-formatting-button/use-reset-all-formatting.mjs +0 -21
  361. package/dist/ui/slash-dropdown-menu/index.d.mts +0 -10
  362. package/dist/ui/slash-dropdown-menu/index.d.ts +0 -10
  363. package/dist/ui/slash-dropdown-menu/index.js +0 -1056
  364. package/dist/ui/slash-dropdown-menu/index.mjs +0 -19
  365. package/dist/ui/slash-dropdown-menu/slash-dropdown-menu.d.mts +0 -16
  366. package/dist/ui/slash-dropdown-menu/slash-dropdown-menu.d.ts +0 -16
  367. package/dist/ui/slash-dropdown-menu/slash-dropdown-menu.js +0 -1053
  368. package/dist/ui/slash-dropdown-menu/slash-dropdown-menu.mjs +0 -16
  369. package/dist/ui/slash-dropdown-menu/use-slash-dropdown-menu.d.mts +0 -162
  370. package/dist/ui/slash-dropdown-menu/use-slash-dropdown-menu.d.ts +0 -162
  371. package/dist/ui/slash-dropdown-menu/use-slash-dropdown-menu.js +0 -457
  372. package/dist/ui/slash-dropdown-menu/use-slash-dropdown-menu.mjs +0 -10
  373. package/dist/ui/suggestion-menu/index.d.mts +0 -10
  374. package/dist/ui/suggestion-menu/index.d.ts +0 -10
  375. package/dist/ui/suggestion-menu/index.js +0 -489
  376. package/dist/ui/suggestion-menu/index.mjs +0 -17
  377. package/dist/ui/suggestion-menu/suggestion-menu-types.d.mts +0 -89
  378. package/dist/ui/suggestion-menu/suggestion-menu-types.d.ts +0 -89
  379. package/dist/ui/suggestion-menu/suggestion-menu-types.js +0 -19
  380. package/dist/ui/suggestion-menu/suggestion-menu-types.mjs +0 -1
  381. package/dist/ui/suggestion-menu/suggestion-menu-utils.d.mts +0 -27
  382. package/dist/ui/suggestion-menu/suggestion-menu-utils.d.ts +0 -27
  383. package/dist/ui/suggestion-menu/suggestion-menu-utils.js +0 -75
  384. package/dist/ui/suggestion-menu/suggestion-menu-utils.mjs +0 -9
  385. package/dist/ui/suggestion-menu/suggestion-menu.d.mts +0 -15
  386. package/dist/ui/suggestion-menu/suggestion-menu.d.ts +0 -15
  387. package/dist/ui/suggestion-menu/suggestion-menu.js +0 -453
  388. package/dist/ui/suggestion-menu/suggestion-menu.mjs +0 -12
  389. package/dist/ui/table-button/index.d.mts +0 -15
  390. package/dist/ui/table-button/index.d.ts +0 -15
  391. package/dist/ui/table-button/index.js +0 -202
  392. package/dist/ui/table-button/index.mjs +0 -9
  393. package/dist/ui/table-button/use-table.d.mts +0 -51
  394. package/dist/ui/table-button/use-table.d.ts +0 -51
  395. package/dist/ui/table-button/use-table.js +0 -146
  396. package/dist/ui/table-button/use-table.mjs +0 -14
  397. package/dist/ui/text-align-button/index.d.mts +0 -6
  398. package/dist/ui/text-align-button/index.d.ts +0 -6
  399. package/dist/ui/text-align-button/index.js +0 -235
  400. package/dist/ui/text-align-button/index.mjs +0 -29
  401. package/dist/ui/text-align-button/text-align-button.d.mts +0 -20
  402. package/dist/ui/text-align-button/text-align-button.d.ts +0 -20
  403. package/dist/ui/text-align-button/text-align-button.js +0 -215
  404. package/dist/ui/text-align-button/text-align-button.mjs +0 -9
  405. package/dist/ui/text-align-button/use-text-align.d.mts +0 -106
  406. package/dist/ui/text-align-button/use-text-align.d.ts +0 -106
  407. package/dist/ui/text-align-button/use-text-align.js +0 -169
  408. package/dist/ui/text-align-button/use-text-align.mjs +0 -24
  409. package/dist/ui/undo-redo-button/index.d.mts +0 -6
  410. package/dist/ui/undo-redo-button/index.d.ts +0 -6
  411. package/dist/ui/undo-redo-button/index.js +0 -202
  412. package/dist/ui/undo-redo-button/index.mjs +0 -25
  413. package/dist/ui/undo-redo-button/undo-redo-button.d.mts +0 -23
  414. package/dist/ui/undo-redo-button/undo-redo-button.d.ts +0 -23
  415. package/dist/ui/undo-redo-button/undo-redo-button.js +0 -187
  416. package/dist/ui/undo-redo-button/undo-redo-button.mjs +0 -10
  417. package/dist/ui/undo-redo-button/use-undo-redo.d.mts +0 -95
  418. package/dist/ui/undo-redo-button/use-undo-redo.d.ts +0 -95
  419. package/dist/ui/undo-redo-button/use-undo-redo.js +0 -146
  420. package/dist/ui/undo-redo-button/use-undo-redo.mjs +0 -21
  421. package/dist/utils/index.d.mts +0 -38
  422. package/dist/utils/index.d.ts +0 -38
  423. package/dist/utils/index.js +0 -128
  424. package/dist/utils/index.mjs +0 -15
  425. package/dist/utils/safe-parse.d.mts +0 -14
  426. package/dist/utils/safe-parse.d.ts +0 -14
  427. package/dist/utils/safe-parse.js +0 -203
  428. package/dist/utils/safe-parse.mjs +0 -8
@@ -1,1056 +0,0 @@
1
- "use client";
2
- "use strict";
3
- var __create = Object.create;
4
- var __defProp = Object.defineProperty;
5
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
- var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getProtoOf = Object.getPrototypeOf;
8
- var __hasOwnProp = Object.prototype.hasOwnProperty;
9
- var __export = (target, all) => {
10
- for (var name in all)
11
- __defProp(target, name, { get: all[name], enumerable: true });
12
- };
13
- var __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from === "object" || typeof from === "function") {
15
- for (let key of __getOwnPropNames(from))
16
- if (!__hasOwnProp.call(to, key) && key !== except)
17
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
- }
19
- return to;
20
- };
21
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
- // If the importer is in node compatibility mode or this is not an ESM
23
- // file that has been converted to a CommonJS file using a Babel-
24
- // compatible transform (i.e. "__esModule" has not been set), then set
25
- // "default" to the CommonJS "module.exports" for node compatibility.
26
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
- mod
28
- ));
29
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
-
31
- // src/ui/slash-dropdown-menu/index.ts
32
- var slash_dropdown_menu_exports = {};
33
- __export(slash_dropdown_menu_exports, {
34
- SlashDropdownMenu: () => SlashDropdownMenu,
35
- useSlashDropdownMenu: () => useSlashDropdownMenu
36
- });
37
- module.exports = __toCommonJS(slash_dropdown_menu_exports);
38
-
39
- // src/ui/slash-dropdown-menu/slash-dropdown-menu.tsx
40
- var import_button = require("@kopexa/button");
41
- var import_editor_utils3 = require("@kopexa/editor-utils");
42
- var import_separator = require("@kopexa/separator");
43
- var import_theme = require("@kopexa/theme");
44
- var React5 = __toESM(require("react"));
45
-
46
- // src/ui/suggestion-menu/suggestion-menu.tsx
47
- var import_react4 = require("@floating-ui/react");
48
- var import_state = require("@tiptap/pm/state");
49
- var import_suggestion = require("@tiptap/suggestion");
50
- var React3 = __toESM(require("react"));
51
-
52
- // src/hooks/use-floating-element.ts
53
- var import_react = require("@floating-ui/react");
54
- var React = __toESM(require("react"));
55
- function useFloatingElement(show, referencePos, zIndex, options) {
56
- const { dismissOptions, ...floatingOptions } = options || {};
57
- const { refs, update, context, floatingStyles } = (0, import_react.useFloating)({
58
- open: show,
59
- ...floatingOptions
60
- });
61
- const { isMounted, styles } = (0, import_react.useTransitionStyles)(context);
62
- const dismiss = (0, import_react.useDismiss)(context, dismissOptions);
63
- const { getReferenceProps, getFloatingProps } = (0, import_react.useInteractions)([dismiss]);
64
- React.useEffect(() => {
65
- update();
66
- }, [referencePos, update]);
67
- React.useEffect(() => {
68
- if (referencePos === null) {
69
- return;
70
- }
71
- refs.setReference({
72
- getBoundingClientRect: () => referencePos
73
- });
74
- }, [referencePos, refs]);
75
- return React.useMemo(
76
- () => ({
77
- isMounted,
78
- ref: refs.setFloating,
79
- style: {
80
- ...styles,
81
- ...floatingStyles,
82
- zIndex
83
- },
84
- update,
85
- getFloatingProps,
86
- getReferenceProps
87
- }),
88
- [
89
- floatingStyles,
90
- isMounted,
91
- refs.setFloating,
92
- styles,
93
- update,
94
- zIndex,
95
- getFloatingProps,
96
- getReferenceProps
97
- ]
98
- );
99
- }
100
-
101
- // src/hooks/use-menu-navigation.ts
102
- var React2 = __toESM(require("react"));
103
- function useMenuNavigation({
104
- editor,
105
- containerRef,
106
- query,
107
- items,
108
- onSelect,
109
- onClose,
110
- orientation = "vertical",
111
- autoSelectFirstItem = true
112
- }) {
113
- const [selectedIndex, setSelectedIndex] = React2.useState(
114
- autoSelectFirstItem ? 0 : -1
115
- );
116
- React2.useEffect(() => {
117
- const handleKeyboardNavigation = (event) => {
118
- if (!items.length) return false;
119
- const moveNext = () => setSelectedIndex((currentIndex) => {
120
- if (currentIndex === -1) return 0;
121
- return (currentIndex + 1) % items.length;
122
- });
123
- const movePrev = () => setSelectedIndex((currentIndex) => {
124
- if (currentIndex === -1) return items.length - 1;
125
- return (currentIndex - 1 + items.length) % items.length;
126
- });
127
- switch (event.key) {
128
- case "ArrowUp": {
129
- if (orientation === "horizontal") return false;
130
- event.preventDefault();
131
- movePrev();
132
- return true;
133
- }
134
- case "ArrowDown": {
135
- if (orientation === "horizontal") return false;
136
- event.preventDefault();
137
- moveNext();
138
- return true;
139
- }
140
- case "ArrowLeft": {
141
- if (orientation === "vertical") return false;
142
- event.preventDefault();
143
- movePrev();
144
- return true;
145
- }
146
- case "ArrowRight": {
147
- if (orientation === "vertical") return false;
148
- event.preventDefault();
149
- moveNext();
150
- return true;
151
- }
152
- case "Tab": {
153
- event.preventDefault();
154
- if (event.shiftKey) {
155
- movePrev();
156
- } else {
157
- moveNext();
158
- }
159
- return true;
160
- }
161
- case "Home": {
162
- event.preventDefault();
163
- setSelectedIndex(0);
164
- return true;
165
- }
166
- case "End": {
167
- event.preventDefault();
168
- setSelectedIndex(items.length - 1);
169
- return true;
170
- }
171
- case "Enter": {
172
- if (event.isComposing) return false;
173
- event.preventDefault();
174
- if (selectedIndex !== -1 && items[selectedIndex]) {
175
- onSelect == null ? void 0 : onSelect(items[selectedIndex]);
176
- }
177
- return true;
178
- }
179
- case "Escape": {
180
- event.preventDefault();
181
- onClose == null ? void 0 : onClose();
182
- return true;
183
- }
184
- default:
185
- return false;
186
- }
187
- };
188
- let targetElement = null;
189
- if (editor) {
190
- targetElement = editor.view.dom;
191
- } else if (containerRef == null ? void 0 : containerRef.current) {
192
- targetElement = containerRef.current;
193
- }
194
- if (targetElement) {
195
- targetElement.addEventListener("keydown", handleKeyboardNavigation, true);
196
- return () => {
197
- targetElement == null ? void 0 : targetElement.removeEventListener(
198
- "keydown",
199
- handleKeyboardNavigation,
200
- true
201
- );
202
- };
203
- }
204
- return void 0;
205
- }, [
206
- editor,
207
- containerRef,
208
- items,
209
- selectedIndex,
210
- onSelect,
211
- onClose,
212
- orientation
213
- ]);
214
- React2.useEffect(() => {
215
- if (query) {
216
- setSelectedIndex(autoSelectFirstItem ? 0 : -1);
217
- }
218
- }, [query, autoSelectFirstItem]);
219
- return {
220
- selectedIndex: items.length ? selectedIndex : void 0,
221
- setSelectedIndex
222
- };
223
- }
224
-
225
- // src/hooks/use-tiptap-editor.ts
226
- var import_react2 = require("@tiptap/react");
227
- var import_react3 = require("react");
228
- function useTiptapEditor(providedEditor) {
229
- const { editor: coreEditor } = (0, import_react2.useCurrentEditor)();
230
- const mainEditor = (0, import_react3.useMemo)(
231
- () => providedEditor || coreEditor,
232
- [providedEditor, coreEditor]
233
- );
234
- const editorState = (0, import_react2.useEditorState)({
235
- editor: mainEditor,
236
- selector(context) {
237
- if (!context.editor) {
238
- return {
239
- editor: null,
240
- editorState: void 0,
241
- canCommand: void 0
242
- };
243
- }
244
- return {
245
- editor: context.editor,
246
- editorState: context.editor.state,
247
- canCommand: context.editor.can
248
- };
249
- }
250
- });
251
- return editorState || { editor: null };
252
- }
253
-
254
- // src/ui/suggestion-menu/suggestion-menu-utils.ts
255
- function calculateStartPosition(cursorPosition, previousNode, triggerChar) {
256
- if (!(previousNode == null ? void 0 : previousNode.text) || !triggerChar) {
257
- return cursorPosition;
258
- }
259
- const commandText = previousNode.text;
260
- const triggerCharIndex = commandText.lastIndexOf(triggerChar);
261
- if (triggerCharIndex === -1) {
262
- return cursorPosition;
263
- }
264
- const textLength = commandText.substring(triggerCharIndex).length;
265
- return cursorPosition - textLength;
266
- }
267
- function filterSuggestionItems(items, query) {
268
- const normalizedQuery = query.trim().toLowerCase();
269
- if (!normalizedQuery) {
270
- return items;
271
- }
272
- return items.filter((item) => {
273
- var _a, _b;
274
- if (item.title.toLowerCase().includes(normalizedQuery)) {
275
- return true;
276
- }
277
- if ((_a = item.subtext) == null ? void 0 : _a.toLowerCase().includes(normalizedQuery)) {
278
- return true;
279
- }
280
- if ((_b = item.keywords) == null ? void 0 : _b.some(
281
- (keyword) => keyword.toLowerCase().includes(normalizedQuery)
282
- )) {
283
- return true;
284
- }
285
- return false;
286
- }).sort((a, b) => {
287
- const aTitle = a.title.toLowerCase();
288
- const bTitle = b.title.toLowerCase();
289
- if (aTitle === normalizedQuery && bTitle !== normalizedQuery) return -1;
290
- if (bTitle === normalizedQuery && aTitle !== normalizedQuery) return 1;
291
- if (aTitle.startsWith(normalizedQuery) && !bTitle.startsWith(normalizedQuery))
292
- return -1;
293
- if (bTitle.startsWith(normalizedQuery) && !aTitle.startsWith(normalizedQuery))
294
- return 1;
295
- return 0;
296
- });
297
- }
298
-
299
- // src/ui/suggestion-menu/suggestion-menu.tsx
300
- var import_jsx_runtime = require("react/jsx-runtime");
301
- var SuggestionMenu = ({
302
- editor: providedEditor,
303
- floatingOptions,
304
- selector = "tiptap-suggestion-menu",
305
- children,
306
- maxHeight = 384,
307
- pluginKey = import_suggestion.SuggestionPluginKey,
308
- ...internalSuggestionProps
309
- }) => {
310
- const { editor } = useTiptapEditor(providedEditor);
311
- const [show, setShow] = React3.useState(false);
312
- const [internalClientRect, setInternalClientRect] = React3.useState(null);
313
- const [internalCommand, setInternalCommand] = React3.useState(null);
314
- const [internalItems, setInternalItems] = React3.useState(
315
- []
316
- );
317
- const [internalQuery, setInternalQuery] = React3.useState("");
318
- const [, setInternalRange] = React3.useState(null);
319
- const { ref, style, getFloatingProps, isMounted } = useFloatingElement(
320
- show,
321
- internalClientRect,
322
- 1e3,
323
- {
324
- placement: "bottom-start",
325
- middleware: [
326
- (0, import_react4.offset)(10),
327
- (0, import_react4.flip)({
328
- mainAxis: true,
329
- crossAxis: false
330
- }),
331
- (0, import_react4.shift)(),
332
- (0, import_react4.size)({
333
- apply({ availableHeight, elements }) {
334
- if (elements.floating) {
335
- const maxHeightValue = maxHeight ? Math.min(maxHeight, availableHeight) : availableHeight;
336
- elements.floating.style.setProperty(
337
- "--suggestion-menu-max-height",
338
- `${maxHeightValue}px`
339
- );
340
- }
341
- }
342
- })
343
- ],
344
- onOpenChange(open) {
345
- if (!open) {
346
- setShow(false);
347
- }
348
- },
349
- ...floatingOptions
350
- }
351
- );
352
- const internalSuggestionPropsRef = React3.useRef(internalSuggestionProps);
353
- React3.useEffect(() => {
354
- internalSuggestionPropsRef.current = internalSuggestionProps;
355
- }, [internalSuggestionProps]);
356
- const closePopup = React3.useCallback(() => {
357
- setShow(false);
358
- }, []);
359
- React3.useEffect(() => {
360
- if (!editor || editor.isDestroyed) {
361
- return;
362
- }
363
- const existingPlugin = editor.state.plugins.find(
364
- (plugin) => plugin.spec.key === pluginKey
365
- );
366
- if (existingPlugin) {
367
- editor.unregisterPlugin(pluginKey);
368
- }
369
- const suggestion = (0, import_suggestion.Suggestion)({
370
- pluginKey: pluginKey instanceof import_state.PluginKey ? pluginKey : new import_state.PluginKey(pluginKey),
371
- editor,
372
- command({ editor: editor2, range, props }) {
373
- var _a, _b;
374
- if (!range) {
375
- return;
376
- }
377
- const { view, state } = editor2;
378
- const { selection } = state;
379
- const isMention = editor2.extensionManager.extensions.some(
380
- (extension) => {
381
- var _a2, _b2;
382
- const name = extension.name;
383
- return name === "mention" && ((_b2 = (_a2 = extension.options) == null ? void 0 : _a2.suggestion) == null ? void 0 : _b2.char) === internalSuggestionPropsRef.current.char;
384
- }
385
- );
386
- if (!isMention) {
387
- const cursorPosition = selection.$from.pos;
388
- const previousNode = (_a = selection.$head) == null ? void 0 : _a.nodeBefore;
389
- const startPosition = previousNode ? calculateStartPosition(
390
- cursorPosition,
391
- previousNode,
392
- internalSuggestionPropsRef.current.char
393
- ) : selection.$from.start();
394
- const transaction = state.tr.deleteRange(
395
- startPosition,
396
- cursorPosition
397
- );
398
- view.dispatch(transaction);
399
- }
400
- const nodeAfter = view.state.selection.$to.nodeAfter;
401
- const overrideSpace = (_b = nodeAfter == null ? void 0 : nodeAfter.text) == null ? void 0 : _b.startsWith(" ");
402
- const rangeToUse = { ...range };
403
- if (overrideSpace) {
404
- rangeToUse.to += 1;
405
- }
406
- props.onSelect({ editor: editor2, range: rangeToUse, context: props.context });
407
- },
408
- render: () => {
409
- return {
410
- onStart: (props) => {
411
- var _a, _b;
412
- setInternalCommand(() => props.command);
413
- setInternalItems(props.items);
414
- setInternalQuery(props.query);
415
- setInternalRange(props.range);
416
- setInternalClientRect((_b = (_a = props.clientRect) == null ? void 0 : _a.call(props)) != null ? _b : null);
417
- setShow(true);
418
- },
419
- onUpdate: (props) => {
420
- var _a, _b;
421
- setInternalCommand(() => props.command);
422
- setInternalItems(props.items);
423
- setInternalQuery(props.query);
424
- setInternalRange(props.range);
425
- setInternalClientRect((_b = (_a = props.clientRect) == null ? void 0 : _a.call(props)) != null ? _b : null);
426
- },
427
- onKeyDown: (props) => {
428
- if (props.event.key === "Escape") {
429
- closePopup();
430
- return true;
431
- }
432
- return false;
433
- },
434
- onExit: () => {
435
- setInternalCommand(null);
436
- setInternalItems([]);
437
- setInternalQuery("");
438
- setInternalRange(null);
439
- setInternalClientRect(null);
440
- setShow(false);
441
- }
442
- };
443
- },
444
- ...internalSuggestionPropsRef.current
445
- });
446
- editor.registerPlugin(suggestion);
447
- return () => {
448
- if (!editor.isDestroyed) {
449
- editor.unregisterPlugin(pluginKey);
450
- }
451
- };
452
- }, [editor, pluginKey, closePopup]);
453
- const onSelect = React3.useCallback(
454
- (item) => {
455
- closePopup();
456
- if (internalCommand) {
457
- internalCommand(item);
458
- }
459
- },
460
- [closePopup, internalCommand]
461
- );
462
- const { selectedIndex } = useMenuNavigation({
463
- editor,
464
- query: internalQuery,
465
- items: internalItems,
466
- onSelect
467
- });
468
- if (!isMounted || !show || !editor) {
469
- return null;
470
- }
471
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react4.FloatingPortal, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
472
- "div",
473
- {
474
- ref,
475
- style,
476
- ...getFloatingProps(),
477
- "data-selector": selector,
478
- className: "tiptap-suggestion-menu",
479
- role: "listbox",
480
- "aria-label": "Suggestions",
481
- onPointerDown: (e) => e.preventDefault(),
482
- children: children({
483
- items: internalItems,
484
- selectedIndex,
485
- onSelect
486
- })
487
- }
488
- ) });
489
- };
490
-
491
- // src/ui/slash-dropdown-menu/use-slash-dropdown-menu.ts
492
- var import_editor_utils2 = require("@kopexa/editor-utils");
493
- var import_icons2 = require("@kopexa/icons");
494
- var React4 = __toESM(require("react"));
495
-
496
- // src/ui/table-button/use-table.ts
497
- var import_editor_utils = require("@kopexa/editor-utils");
498
- var import_icons = require("@kopexa/icons");
499
- var import_react5 = require("@tiptap/react");
500
- var import_react6 = require("react");
501
- function canToggle(editor) {
502
- if (!editor || !editor.isEditable) return false;
503
- if (!(0, import_editor_utils.isNodeInSchema)("table", editor) || (0, import_editor_utils.isNodeTypeSelected)(editor, ["image"])) {
504
- return false;
505
- }
506
- try {
507
- return editor.can().insertTable({ rows: 3, cols: 3, withHeaderRow: true });
508
- } catch {
509
- return false;
510
- }
511
- }
512
- function toggleTable(editor, config) {
513
- var _a;
514
- if (!editor || !editor.isEditable) return false;
515
- if (!canToggle(editor)) return false;
516
- try {
517
- return editor.chain().focus().insertTable({
518
- rows: (config == null ? void 0 : config.rows) || 3,
519
- cols: (config == null ? void 0 : config.cols) || 3,
520
- withHeaderRow: (_a = config == null ? void 0 : config.withHeaderRow) != null ? _a : true
521
- }).run();
522
- } catch {
523
- return false;
524
- }
525
- }
526
-
527
- // src/ui/slash-dropdown-menu/use-slash-dropdown-menu.ts
528
- var texts = {
529
- // AI
530
- continue_writing: {
531
- title: "Continue Writing",
532
- subtext: "Continue writing from the current position",
533
- keywords: ["continue", "write", "continue writing", "ai"],
534
- badge: import_icons2.AiSparklesIcon,
535
- group: "AI"
536
- },
537
- ai_ask_button: {
538
- title: "Ask AI",
539
- subtext: "Ask AI to generate content",
540
- keywords: ["ai", "ask", "generate"],
541
- badge: import_icons2.AiSparklesIcon,
542
- group: "AI"
543
- },
544
- // Style
545
- text: {
546
- title: "Text",
547
- subtext: "Regular text paragraph",
548
- keywords: ["p", "paragraph", "text"],
549
- badge: import_icons2.TypeIcon,
550
- group: "Style"
551
- },
552
- heading_1: {
553
- title: "Heading 1",
554
- subtext: "Top-level heading",
555
- keywords: ["h", "heading1", "h1"],
556
- badge: import_icons2.HeadingOneIcon,
557
- group: "Style"
558
- },
559
- heading_2: {
560
- title: "Heading 2",
561
- subtext: "Key section heading",
562
- keywords: ["h2", "heading2", "subheading"],
563
- badge: import_icons2.HeadingTwoIcon,
564
- group: "Style"
565
- },
566
- heading_3: {
567
- title: "Heading 3",
568
- subtext: "Subsection and group heading",
569
- keywords: ["h3", "heading3", "subheading"],
570
- badge: import_icons2.HeadingThreeIcon,
571
- group: "Style"
572
- },
573
- bullet_list: {
574
- title: "Bullet List",
575
- subtext: "List with unordered items",
576
- keywords: ["ul", "li", "list", "bulletlist", "bullet list"],
577
- badge: import_icons2.ListIcon,
578
- group: "Style"
579
- },
580
- ordered_list: {
581
- title: "Numbered List",
582
- subtext: "List with ordered items",
583
- keywords: ["ol", "li", "list", "numberedlist", "numbered list"],
584
- badge: import_icons2.ListOrderedIcon,
585
- group: "Style"
586
- },
587
- task_list: {
588
- title: "To-do list",
589
- subtext: "List with tasks",
590
- keywords: ["tasklist", "task list", "todo", "checklist"],
591
- badge: import_icons2.ListTodoIcon,
592
- group: "Style"
593
- },
594
- quote: {
595
- title: "Blockquote",
596
- subtext: "Blockquote block",
597
- keywords: ["quote", "blockquote"],
598
- badge: import_icons2.BlockquoteIcon,
599
- group: "Style"
600
- },
601
- code_block: {
602
- title: "Code Block",
603
- subtext: "Code block with syntax highlighting",
604
- keywords: ["code", "pre"],
605
- badge: import_icons2.CodeBlockIcon,
606
- group: "Style"
607
- },
608
- // Insert
609
- // mention: {
610
- // title: "Mention",
611
- // subtext: "Mention a user or item",
612
- // keywords: ["mention", "user", "item", "tag"],
613
- // badge: AtSignIcon,
614
- // group: "Insert",
615
- // },
616
- // emoji: {
617
- // title: "Emoji",
618
- // subtext: "Insert an emoji",
619
- // keywords: ["emoji", "emoticon", "smiley"],
620
- // badge: SmilePlusIcon,
621
- // group: "Insert",
622
- // },
623
- control: {
624
- title: "Control",
625
- subtext: "Insert a control block",
626
- keywords: ["control"],
627
- badge: import_icons2.ControlsIcon,
628
- group: "Insert"
629
- },
630
- divider: {
631
- title: "Separator",
632
- subtext: "Horizontal line to separate content",
633
- keywords: ["hr", "horizontalRule", "line", "separator"],
634
- badge: import_icons2.MinusIcon,
635
- group: "Insert"
636
- },
637
- table: {
638
- title: "Table",
639
- subtext: "Insert a table",
640
- keywords: ["table", "grid", "spreadsheet"],
641
- badge: import_icons2.TableIcon,
642
- group: "Insert"
643
- },
644
- table_of_contents: {
645
- title: "Table of Contents",
646
- subtext: "Auto-generated list of headings",
647
- keywords: ["toc", "table of contents", "index", "navigation", "headings"],
648
- badge: import_icons2.TableOfContentsIcon,
649
- group: "Insert"
650
- },
651
- callout: {
652
- title: "Callout",
653
- subtext: "Highlighted block for important information",
654
- keywords: ["callout", "info", "warning", "alert", "note", "tip"],
655
- badge: import_icons2.InfoIcon,
656
- group: "Insert"
657
- },
658
- callout_warning: {
659
- title: "Warning",
660
- subtext: "Warning callout block",
661
- keywords: ["warning", "caution", "attention"],
662
- badge: import_icons2.AlertIcon,
663
- group: "Insert"
664
- },
665
- math: {
666
- title: "Formula",
667
- subtext: "LaTeX math formula block",
668
- keywords: ["math", "latex", "formula", "equation", "katex"],
669
- badge: import_icons2.TypeIcon,
670
- group: "Insert"
671
- },
672
- // Upload
673
- image: {
674
- title: "Image",
675
- subtext: "Resizable image with caption",
676
- keywords: [
677
- "image",
678
- "imageUpload",
679
- "upload",
680
- "img",
681
- "picture",
682
- "media",
683
- "url"
684
- ],
685
- badge: import_icons2.ImageIcon,
686
- group: "Upload"
687
- }
688
- };
689
- var getItemImplementations = () => {
690
- return {
691
- // AI
692
- continue_writing: {
693
- check: (editor) => {
694
- const { hasContent } = (0, import_editor_utils2.hasContentAbove)(editor);
695
- const extensionsReady = (0, import_editor_utils2.isExtensionAvailable)(editor, [
696
- "ai",
697
- "aiAdvanced"
698
- ]);
699
- return extensionsReady && hasContent;
700
- },
701
- action: ({ editor }) => {
702
- const editorChain = editor.chain().focus();
703
- const nodeSelectionPosition = (0, import_editor_utils2.findSelectionPosition)({ editor });
704
- if (nodeSelectionPosition !== null) {
705
- editorChain.setNodeSelection(nodeSelectionPosition);
706
- }
707
- editorChain.run();
708
- editor.chain().focus().aiGenerationShow().run();
709
- requestAnimationFrame(() => {
710
- const { hasContent, content } = (0, import_editor_utils2.hasContentAbove)(editor);
711
- const snippet = content.length > 500 ? `...${content.slice(-500)}` : content;
712
- const prompt = hasContent ? `Context: ${snippet}
713
-
714
- Continue writing from where the text above ends. Write ONLY ONE SENTENCE. DONT REPEAT THE TEXT.` : "Start writing a new paragraph. Write ONLY ONE SENTENCE.";
715
- editor.chain().focus().aiTextPrompt({
716
- stream: true,
717
- format: "rich-text",
718
- text: prompt
719
- }).run();
720
- });
721
- }
722
- },
723
- ai_ask_button: {
724
- check: (editor) => (0, import_editor_utils2.isExtensionAvailable)(editor, ["ai", "aiAdvanced"]),
725
- action: ({ editor }) => {
726
- const editorChain = editor.chain().focus();
727
- const nodeSelectionPosition = (0, import_editor_utils2.findSelectionPosition)({ editor });
728
- if (nodeSelectionPosition !== null) {
729
- editorChain.setNodeSelection(nodeSelectionPosition);
730
- }
731
- editorChain.run();
732
- editor.chain().focus().aiGenerationShow().run();
733
- }
734
- },
735
- // Style
736
- text: {
737
- check: (editor) => (0, import_editor_utils2.isNodeInSchema)("paragraph", editor),
738
- action: ({ editor }) => {
739
- editor.chain().focus().setParagraph().run();
740
- }
741
- },
742
- heading_1: {
743
- check: (editor) => (0, import_editor_utils2.isNodeInSchema)("heading", editor),
744
- action: ({ editor }) => {
745
- editor.chain().focus().toggleHeading({ level: 1 }).run();
746
- }
747
- },
748
- heading_2: {
749
- check: (editor) => (0, import_editor_utils2.isNodeInSchema)("heading", editor),
750
- action: ({ editor }) => {
751
- editor.chain().focus().toggleHeading({ level: 2 }).run();
752
- }
753
- },
754
- heading_3: {
755
- check: (editor) => (0, import_editor_utils2.isNodeInSchema)("heading", editor),
756
- action: ({ editor }) => {
757
- editor.chain().focus().toggleHeading({ level: 3 }).run();
758
- }
759
- },
760
- bullet_list: {
761
- check: (editor) => (0, import_editor_utils2.isNodeInSchema)("bulletList", editor),
762
- action: ({ editor }) => {
763
- editor.chain().focus().toggleBulletList().run();
764
- }
765
- },
766
- ordered_list: {
767
- check: (editor) => (0, import_editor_utils2.isNodeInSchema)("orderedList", editor),
768
- action: ({ editor }) => {
769
- editor.chain().focus().toggleOrderedList().run();
770
- }
771
- },
772
- task_list: {
773
- check: (editor) => (0, import_editor_utils2.isNodeInSchema)("taskList", editor),
774
- action: ({ editor }) => {
775
- editor.chain().focus().toggleTaskList().run();
776
- }
777
- },
778
- quote: {
779
- check: (editor) => (0, import_editor_utils2.isNodeInSchema)("blockquote", editor),
780
- action: ({ editor }) => {
781
- editor.chain().focus().toggleBlockquote().run();
782
- }
783
- },
784
- code_block: {
785
- check: (editor) => (0, import_editor_utils2.isNodeInSchema)("codeBlock", editor),
786
- action: ({ editor }) => {
787
- editor.chain().focus().toggleNode("codeBlock", "paragraph").run();
788
- }
789
- },
790
- // Insert
791
- // mention: {
792
- // check: (editor: Editor) =>
793
- // isExtensionAvailable(editor, ["mention", "mentionAdvanced"]),
794
- // action: ({ editor }: { editor: Editor }) => addMentionTrigger(editor),
795
- // },
796
- // emoji: {
797
- // check: (editor: Editor) =>
798
- // isExtensionAvailable(editor, ["emoji", "emojiPicker"]),
799
- // action: ({ editor }: { editor: Editor }) => addEmojiTrigger(editor),
800
- // },
801
- divider: {
802
- check: (editor) => (0, import_editor_utils2.isNodeInSchema)("horizontalRule", editor),
803
- action: ({ editor }) => {
804
- editor.chain().focus().setHorizontalRule().run();
805
- }
806
- },
807
- table: {
808
- check: (editor) => (0, import_editor_utils2.isNodeInSchema)("table", editor),
809
- action: ({ editor }) => toggleTable(editor, { rows: 3, cols: 3, withHeaderRow: true })
810
- },
811
- control: {
812
- check: (editor) => (0, import_editor_utils2.isNodeInSchema)("controlBlock", editor),
813
- action: ({ editor }) => {
814
- try {
815
- return editor.chain().focus().insertControlBlock().run();
816
- } catch (e) {
817
- console.error(e);
818
- }
819
- }
820
- },
821
- table_of_contents: {
822
- check: (editor) => (0, import_editor_utils2.isNodeInSchema)("tableOfContentsNode", editor),
823
- action: ({ editor }) => {
824
- editor.chain().focus().insertTableOfContents().run();
825
- }
826
- },
827
- callout: {
828
- check: (editor) => (0, import_editor_utils2.isNodeInSchema)("calloutNode", editor),
829
- action: ({ editor }) => {
830
- editor.chain().focus().insertCallout("info").run();
831
- }
832
- },
833
- callout_warning: {
834
- check: (editor) => (0, import_editor_utils2.isNodeInSchema)("calloutNode", editor),
835
- action: ({ editor }) => {
836
- editor.chain().focus().insertCallout("warning").run();
837
- }
838
- },
839
- math: {
840
- check: (editor) => (0, import_editor_utils2.isNodeInSchema)("mathBlock", editor),
841
- action: ({ editor }) => {
842
- editor.chain().focus().insertMathBlock().run();
843
- }
844
- },
845
- // Upload
846
- image: {
847
- check: (editor) => (0, import_editor_utils2.isNodeInSchema)("imageUpload", editor),
848
- action: ({ editor }) => {
849
- editor.chain().focus().setImageUpload().run();
850
- }
851
- }
852
- };
853
- };
854
- function organizeItemsByGroups(items, showGroups) {
855
- if (!showGroups) {
856
- return items.map((item) => ({ ...item, group: "" }));
857
- }
858
- const groups = {};
859
- items.forEach((item) => {
860
- const groupLabel = item.group || "";
861
- if (!groups[groupLabel]) {
862
- groups[groupLabel] = [];
863
- }
864
- groups[groupLabel].push(item);
865
- });
866
- const organizedItems = [];
867
- Object.entries(groups).forEach(([, groupItems]) => {
868
- organizedItems.push(...groupItems);
869
- });
870
- return organizedItems;
871
- }
872
- function useSlashDropdownMenu(config) {
873
- const getSlashMenuItems = React4.useCallback(
874
- (editor) => {
875
- const items = [];
876
- const enabledItems = (config == null ? void 0 : config.enabledItems) || Object.keys(texts);
877
- const showGroups = (config == null ? void 0 : config.showGroups) !== false;
878
- const itemImplementations = getItemImplementations();
879
- enabledItems.forEach((itemType) => {
880
- var _a;
881
- const itemImpl = itemImplementations[itemType];
882
- const itemText = texts[itemType];
883
- if (itemImpl && itemText && itemImpl.check(editor)) {
884
- const item = {
885
- onSelect: ({ editor: editor2 }) => itemImpl.action({ editor: editor2 }),
886
- ...itemText
887
- };
888
- if ((_a = config == null ? void 0 : config.itemGroups) == null ? void 0 : _a[itemType]) {
889
- item.group = config.itemGroups[itemType];
890
- } else if (!showGroups) {
891
- item.group = "";
892
- }
893
- items.push(item);
894
- }
895
- });
896
- if (config == null ? void 0 : config.customItems) {
897
- items.push(...config.customItems);
898
- }
899
- return organizeItemsByGroups(items, showGroups);
900
- },
901
- [config]
902
- );
903
- return {
904
- getSlashMenuItems,
905
- config
906
- };
907
- }
908
-
909
- // src/ui/slash-dropdown-menu/slash-dropdown-menu.tsx
910
- var import_jsx_runtime2 = require("react/jsx-runtime");
911
- var SlashDropdownMenu = (props) => {
912
- const { config, ...restProps } = props;
913
- const { getSlashMenuItems } = useSlashDropdownMenu(config);
914
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
915
- SuggestionMenu,
916
- {
917
- char: "/",
918
- pluginKey: "slashDropdownMenu",
919
- decorationClass: "tiptap-slash-decoration",
920
- decorationContent: "Filter...",
921
- selector: "tiptap-slash-dropdown-menu",
922
- items: ({ query, editor }) => filterSuggestionItems(getSlashMenuItems(editor), query),
923
- ...restProps,
924
- children: (props2) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(List, { ...props2, config })
925
- }
926
- );
927
- };
928
- var Item = (props) => {
929
- const { item, isSelected, onSelect } = props;
930
- const itemRef = React5.useRef(null);
931
- React5.useEffect(() => {
932
- const selector = document.querySelector(
933
- '[data-selector="tiptap-slash-dropdown-menu"]'
934
- );
935
- if (!itemRef.current || !isSelected || !selector) return;
936
- const overflow = (0, import_editor_utils3.getElementOverflowPosition)(itemRef.current, selector);
937
- if (overflow === "top") {
938
- itemRef.current.scrollIntoView(true);
939
- } else if (overflow === "bottom") {
940
- itemRef.current.scrollIntoView(false);
941
- }
942
- }, [isSelected]);
943
- const BadgeIcon = item.badge;
944
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
945
- import_button.Button,
946
- {
947
- ref: itemRef,
948
- variant: "ghost",
949
- color: "default",
950
- startContent: BadgeIcon && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(BadgeIcon, {}),
951
- "data-active-state": isSelected ? "on" : "off",
952
- onClick: onSelect,
953
- fullWidth: true,
954
- spacing: "start",
955
- children: item.title
956
- }
957
- );
958
- };
959
- var List = ({
960
- items,
961
- selectedIndex,
962
- onSelect,
963
- config
964
- }) => {
965
- const styles = (0, import_theme.slashDropdownMenu)();
966
- const renderedItems = React5.useMemo(() => {
967
- const rendered = [];
968
- const showGroups = (config == null ? void 0 : config.showGroups) !== false;
969
- if (!showGroups) {
970
- items.forEach((item, index) => {
971
- rendered.push(
972
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
973
- Item,
974
- {
975
- item,
976
- isSelected: index === selectedIndex,
977
- onSelect: () => onSelect(item)
978
- },
979
- `item-${index}-${item.title}`
980
- )
981
- );
982
- });
983
- return rendered;
984
- }
985
- const groups = {};
986
- items.forEach((item, index) => {
987
- const groupLabel = item.group || "";
988
- if (!groups[groupLabel]) {
989
- groups[groupLabel] = { items: [], indices: [] };
990
- }
991
- groups[groupLabel].items.push(item);
992
- groups[groupLabel].indices.push(index);
993
- });
994
- Object.entries(groups).forEach(([groupLabel, groupData], groupIndex) => {
995
- if (groupIndex > 0) {
996
- rendered.push(
997
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
998
- import_separator.Separator,
999
- {
1000
- orientation: "horizontal"
1001
- },
1002
- `separator-${groupIndex.toString()}`
1003
- )
1004
- );
1005
- }
1006
- const groupItems = groupData.items.map((item, itemIndex) => {
1007
- const originalIndex = groupData.indices[itemIndex];
1008
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1009
- Item,
1010
- {
1011
- item,
1012
- isSelected: originalIndex === selectedIndex,
1013
- onSelect: () => onSelect(item)
1014
- },
1015
- `item-${originalIndex}-${item.title}`
1016
- );
1017
- });
1018
- if (groupLabel) {
1019
- rendered.push(
1020
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
1021
- "div",
1022
- {
1023
- className: styles.cardItemGroup(),
1024
- children: [
1025
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: styles.cardGroupLabel(), children: groupLabel }),
1026
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: styles.cardGroup(), children: groupItems })
1027
- ]
1028
- },
1029
- `group-${groupIndex}-${groupLabel}`
1030
- )
1031
- );
1032
- } else {
1033
- rendered.push(...groupItems);
1034
- }
1035
- });
1036
- return rendered;
1037
- }, [items, selectedIndex, onSelect, config == null ? void 0 : config.showGroups, styles]);
1038
- if (!renderedItems.length) {
1039
- return null;
1040
- }
1041
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1042
- "div",
1043
- {
1044
- className: styles.card(),
1045
- style: {
1046
- maxHeight: "var(--suggestion-menu-max-height)"
1047
- },
1048
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: styles.body(), children: renderedItems })
1049
- }
1050
- );
1051
- };
1052
- // Annotate the CommonJS export names for ESM import in node:
1053
- 0 && (module.exports = {
1054
- SlashDropdownMenu,
1055
- useSlashDropdownMenu
1056
- });