@kopexa/tiptap 17.6.17 → 17.7.0

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 +1081 -668
  4. package/dist/index.mjs +7686 -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,673 +0,0 @@
1
- "use client";
2
- "use strict";
3
- "use client";
4
- var __create = Object.create;
5
- var __defProp = Object.defineProperty;
6
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
- var __getOwnPropNames = Object.getOwnPropertyNames;
8
- var __getProtoOf = Object.getPrototypeOf;
9
- var __hasOwnProp = Object.prototype.hasOwnProperty;
10
- var __export = (target, all) => {
11
- for (var name in all)
12
- __defProp(target, name, { get: all[name], enumerable: true });
13
- };
14
- var __copyProps = (to, from, except, desc) => {
15
- if (from && typeof from === "object" || typeof from === "function") {
16
- for (let key of __getOwnPropNames(from))
17
- if (!__hasOwnProp.call(to, key) && key !== except)
18
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
19
- }
20
- return to;
21
- };
22
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
- // If the importer is in node compatibility mode or this is not an ESM
24
- // file that has been converted to a CommonJS file using a Babel-
25
- // compatible transform (i.e. "__esModule" has not been set), then set
26
- // "default" to the CommonJS "module.exports" for node compatibility.
27
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
28
- mod
29
- ));
30
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
31
-
32
- // src/ui/bubble-menu/index.tsx
33
- var bubble_menu_exports = {};
34
- __export(bubble_menu_exports, {
35
- BubbleMenu: () => BubbleMenu,
36
- default: () => bubble_menu_default
37
- });
38
- module.exports = __toCommonJS(bubble_menu_exports);
39
- var import_toolbar3 = require("@kopexa/toolbar");
40
- var import_menus = require("@tiptap/react/menus");
41
-
42
- // src/ui/link-popover/link-popover.tsx
43
- var import_button = require("@kopexa/button");
44
- var import_icons2 = require("@kopexa/icons");
45
- var import_input = require("@kopexa/input");
46
- var import_popover = require("@kopexa/popover");
47
- var import_toolbar = require("@kopexa/toolbar");
48
- var import_react3 = require("react");
49
-
50
- // src/hooks/use-tiptap-editor.ts
51
- var import_react = require("@tiptap/react");
52
- var import_react2 = require("react");
53
- function useTiptapEditor(providedEditor) {
54
- const { editor: coreEditor } = (0, import_react.useCurrentEditor)();
55
- const mainEditor = (0, import_react2.useMemo)(
56
- () => providedEditor || coreEditor,
57
- [providedEditor, coreEditor]
58
- );
59
- const editorState = (0, import_react.useEditorState)({
60
- editor: mainEditor,
61
- selector(context) {
62
- if (!context.editor) {
63
- return {
64
- editor: null,
65
- editorState: void 0,
66
- canCommand: void 0
67
- };
68
- }
69
- return {
70
- editor: context.editor,
71
- editorState: context.editor.state,
72
- canCommand: context.editor.can
73
- };
74
- }
75
- });
76
- return editorState || { editor: null };
77
- }
78
-
79
- // src/ui/link-popover/use-link-popover.ts
80
- var import_editor_utils = require("@kopexa/editor-utils");
81
- var import_icons = require("@kopexa/icons");
82
- var React = __toESM(require("react"));
83
-
84
- // src/utils/index.ts
85
- var MAX_FILE_SIZE = 5 * 1024 * 1024;
86
- var ATTR_WHITESPACE = (
87
- // eslint-disable-next-line no-control-regex
88
- // biome-ignore lint/suspicious/noControlCharactersInRegex: we can do this yay
89
- /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
90
- );
91
- function isAllowedUri(uri, protocols) {
92
- const allowedProtocols = [
93
- "http",
94
- "https",
95
- "ftp",
96
- "ftps",
97
- "mailto",
98
- "tel",
99
- "callto",
100
- "sms",
101
- "cid",
102
- "xmpp"
103
- ];
104
- if (protocols) {
105
- for (const protocol of protocols) {
106
- const nextProtocol = typeof protocol === "string" ? protocol : protocol.scheme;
107
- if (nextProtocol) {
108
- allowedProtocols.push(nextProtocol);
109
- }
110
- }
111
- }
112
- return !uri || uri.replace(ATTR_WHITESPACE, "").match(
113
- new RegExp(
114
- // eslint-disable-next-line no-useless-escape
115
- `^(?:(?:${allowedProtocols.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,
116
- "i"
117
- )
118
- );
119
- }
120
- function sanitizeUrl(inputUrl, baseUrl, protocols) {
121
- try {
122
- const url = new URL(inputUrl, baseUrl);
123
- if (isAllowedUri(url.href, protocols)) {
124
- return url.href;
125
- }
126
- } catch {
127
- }
128
- return "#";
129
- }
130
-
131
- // src/ui/link-popover/use-link-popover.ts
132
- function canSetLink(editor) {
133
- if (!editor || !editor.isEditable) return false;
134
- return editor.can().setMark("link");
135
- }
136
- function isLinkActive(editor) {
137
- if (!editor || !editor.isEditable) return false;
138
- return editor.isActive("link");
139
- }
140
- function shouldShowLinkButton(props) {
141
- const { editor, hideWhenUnavailable } = props;
142
- const linkInSchema = (0, import_editor_utils.isMarkInSchema)("link", editor);
143
- if (!linkInSchema || !editor) {
144
- return false;
145
- }
146
- if (hideWhenUnavailable && !editor.isActive("code")) {
147
- return canSetLink(editor);
148
- }
149
- return true;
150
- }
151
- function useLinkHandler(props) {
152
- const { editor, onSetLink } = props;
153
- const [url, setUrl] = React.useState(null);
154
- React.useEffect(() => {
155
- if (!editor) return;
156
- const { href } = editor.getAttributes("link");
157
- if (isLinkActive(editor) && url === null) {
158
- setUrl(href || "");
159
- }
160
- }, [editor, url]);
161
- React.useEffect(() => {
162
- if (!editor) return;
163
- const updateLinkState = () => {
164
- const { href } = editor.getAttributes("link");
165
- setUrl(href || "");
166
- };
167
- editor.on("selectionUpdate", updateLinkState);
168
- return () => {
169
- editor.off("selectionUpdate", updateLinkState);
170
- };
171
- }, [editor]);
172
- const setLink = React.useCallback(() => {
173
- if (!url || !editor) return;
174
- const { selection } = editor.state;
175
- const isEmpty = selection.empty;
176
- let chain = editor.chain().focus();
177
- chain = chain.extendMarkRange("link").setLink({ href: url });
178
- if (isEmpty) {
179
- chain = chain.insertContent({ type: "text", text: url });
180
- }
181
- chain.run();
182
- setUrl(null);
183
- onSetLink == null ? void 0 : onSetLink();
184
- }, [editor, onSetLink, url]);
185
- const removeLink = React.useCallback(() => {
186
- if (!editor) return;
187
- editor.chain().focus().extendMarkRange("link").unsetLink().setMeta("preventAutolink", true).run();
188
- setUrl("");
189
- }, [editor]);
190
- const openLink = React.useCallback(
191
- (target = "_blank", features = "noopener,noreferrer") => {
192
- if (!url) return;
193
- const safeUrl = sanitizeUrl(url, window.location.href);
194
- if (safeUrl !== "#") {
195
- window.open(safeUrl, target, features);
196
- }
197
- },
198
- [url]
199
- );
200
- return {
201
- url: url || "",
202
- setUrl,
203
- setLink,
204
- removeLink,
205
- openLink
206
- };
207
- }
208
- function useLinkState(props) {
209
- const { editor, hideWhenUnavailable = false } = props;
210
- const canSet = canSetLink(editor);
211
- const isActive = isLinkActive(editor);
212
- const [isVisible, setIsVisible] = React.useState(false);
213
- React.useEffect(() => {
214
- if (!editor) return;
215
- const handleSelectionUpdate = () => {
216
- setIsVisible(
217
- shouldShowLinkButton({
218
- editor,
219
- hideWhenUnavailable
220
- })
221
- );
222
- };
223
- handleSelectionUpdate();
224
- editor.on("selectionUpdate", handleSelectionUpdate);
225
- return () => {
226
- editor.off("selectionUpdate", handleSelectionUpdate);
227
- };
228
- }, [editor, hideWhenUnavailable]);
229
- return {
230
- isVisible,
231
- canSet,
232
- isActive
233
- };
234
- }
235
- function useLinkPopover(config) {
236
- const {
237
- editor: providedEditor,
238
- hideWhenUnavailable = false,
239
- onSetLink
240
- } = config || {};
241
- const { editor } = useTiptapEditor(providedEditor);
242
- const { isVisible, canSet, isActive } = useLinkState({
243
- editor,
244
- hideWhenUnavailable
245
- });
246
- const linkHandler = useLinkHandler({
247
- editor,
248
- onSetLink
249
- });
250
- return {
251
- isVisible,
252
- canSet,
253
- isActive,
254
- label: "Link",
255
- Icon: import_icons.LinkIcon,
256
- ...linkHandler
257
- };
258
- }
259
-
260
- // src/ui/link-popover/link-popover.tsx
261
- var import_jsx_runtime = require("react/jsx-runtime");
262
- var LinkButton = ({ className, children, ...props }) => {
263
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
264
- import_toolbar.ToolbarButton,
265
- {
266
- type: "button",
267
- className,
268
- variant: "ghost",
269
- color: "default",
270
- tabIndex: -1,
271
- "aria-label": "Link",
272
- title: "Link",
273
- isIconOnly: !children,
274
- ...props,
275
- children: children || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons2.LinkIcon, {})
276
- }
277
- );
278
- };
279
- var LinkMain = ({
280
- url,
281
- setUrl,
282
- setLink,
283
- removeLink,
284
- openLink,
285
- isActive,
286
- onSave
287
- }) => {
288
- const [isEditing, setIsEditing] = (0, import_react3.useState)(!isActive || !url);
289
- (0, import_react3.useEffect)(() => {
290
- setIsEditing(!isActive || !url);
291
- }, [isActive, url]);
292
- const handleKeyDown = (event) => {
293
- if (event.key === "Enter") {
294
- event.preventDefault();
295
- setLink();
296
- setIsEditing(false);
297
- onSave == null ? void 0 : onSave();
298
- } else if (event.key === "Escape") {
299
- event.preventDefault();
300
- setIsEditing(false);
301
- }
302
- };
303
- const handleSave = () => {
304
- setLink();
305
- setIsEditing(false);
306
- onSave == null ? void 0 : onSave();
307
- };
308
- const handleEdit = () => {
309
- setIsEditing(true);
310
- };
311
- if (isEditing) {
312
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center gap-1 min-w-[280px]", children: [
313
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
314
- import_input.Input,
315
- {
316
- type: "url",
317
- placeholder: "Enter URL...",
318
- value: url,
319
- onChange: (e) => setUrl(e.target.value),
320
- onKeyDown: handleKeyDown,
321
- autoComplete: "off",
322
- autoCorrect: "off",
323
- autoCapitalize: "off",
324
- className: "flex-1 h-8 text-sm",
325
- autoFocus: true
326
- }
327
- ),
328
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
329
- import_button.IconButton,
330
- {
331
- type: "button",
332
- size: "sm",
333
- variant: "ghost",
334
- onClick: handleSave,
335
- "aria-label": "Save link",
336
- disabled: !url,
337
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons2.CheckIcon, { className: "size-4" })
338
- }
339
- )
340
- ] });
341
- }
342
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center gap-1 min-w-[280px]", children: [
343
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
344
- "a",
345
- {
346
- href: url,
347
- target: "_blank",
348
- rel: "noopener noreferrer",
349
- className: "flex-1 text-sm text-primary truncate max-w-[200px] hover:underline px-2",
350
- onClick: (e) => {
351
- e.preventDefault();
352
- openLink();
353
- },
354
- children: url
355
- }
356
- ),
357
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center gap-0.5 border-l pl-1 ml-1", children: [
358
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
359
- import_button.IconButton,
360
- {
361
- type: "button",
362
- size: "sm",
363
- variant: "ghost",
364
- onClick: openLink,
365
- "aria-label": "Open link in new tab",
366
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons2.ExternalLinkIcon, { className: "size-4" })
367
- }
368
- ),
369
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
370
- import_button.IconButton,
371
- {
372
- type: "button",
373
- size: "sm",
374
- variant: "ghost",
375
- onClick: handleEdit,
376
- "aria-label": "Edit link",
377
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons2.EditIcon, { className: "size-4" })
378
- }
379
- ),
380
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
381
- import_button.IconButton,
382
- {
383
- type: "button",
384
- size: "sm",
385
- variant: "ghost",
386
- onClick: removeLink,
387
- "aria-label": "Remove link",
388
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons2.TrashIcon, { className: "size-4" })
389
- }
390
- )
391
- ] })
392
- ] });
393
- };
394
- function LinkPopover({
395
- editor: providedEditor,
396
- hideWhenUnavailable = false,
397
- onSetLink,
398
- onOpenChange,
399
- autoOpenOnLinkActive = true,
400
- onClick,
401
- children,
402
- ...buttonProps
403
- }) {
404
- const { editor } = useTiptapEditor(providedEditor);
405
- const [isOpen, setIsOpen] = (0, import_react3.useState)(false);
406
- const {
407
- isVisible,
408
- canSet,
409
- isActive,
410
- url,
411
- setUrl,
412
- setLink,
413
- removeLink,
414
- openLink,
415
- label
416
- } = useLinkPopover({
417
- editor,
418
- hideWhenUnavailable,
419
- onSetLink
420
- });
421
- const handleOnOpenChange = (0, import_react3.useCallback)(
422
- (nextIsOpen) => {
423
- setIsOpen(nextIsOpen);
424
- onOpenChange == null ? void 0 : onOpenChange(nextIsOpen);
425
- },
426
- [onOpenChange]
427
- );
428
- const handleSetLink = (0, import_react3.useCallback)(() => {
429
- setLink();
430
- setIsOpen(false);
431
- }, [setLink]);
432
- const handleClick = (0, import_react3.useCallback)(
433
- (event) => {
434
- onClick == null ? void 0 : onClick(event);
435
- if (event.defaultPrevented) return;
436
- setIsOpen(!isOpen);
437
- },
438
- [onClick, isOpen]
439
- );
440
- (0, import_react3.useEffect)(() => {
441
- if (autoOpenOnLinkActive && isActive) {
442
- setIsOpen(true);
443
- }
444
- }, [autoOpenOnLinkActive, isActive]);
445
- if (!isVisible) {
446
- return null;
447
- }
448
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
449
- import_popover.Popover.Root,
450
- {
451
- open: isOpen,
452
- onOpenChange: handleOnOpenChange,
453
- spacing: "dense",
454
- children: [
455
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
456
- import_popover.Popover.Trigger,
457
- {
458
- render: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
459
- LinkButton,
460
- {
461
- "data-disabled": !canSet,
462
- disabled: !canSet,
463
- "data-active-state": isActive ? "on" : "off",
464
- "aria-label": label,
465
- "aria-pressed": isActive,
466
- onClick: handleClick,
467
- ...buttonProps
468
- }
469
- )
470
- }
471
- ),
472
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_popover.Popover.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
473
- LinkMain,
474
- {
475
- url,
476
- setUrl,
477
- setLink: handleSetLink,
478
- removeLink,
479
- openLink,
480
- isActive,
481
- onSave: () => setIsOpen(false)
482
- }
483
- ) })
484
- ]
485
- }
486
- );
487
- }
488
- LinkButton.displayName = "LinkButton";
489
-
490
- // src/ui/mark-button/index.tsx
491
- var import_editor_utils2 = require("@kopexa/editor-utils");
492
- var import_icons3 = require("@kopexa/icons");
493
- var import_toolbar2 = require("@kopexa/toolbar");
494
- var import_react4 = require("@tiptap/react");
495
- var import_react5 = require("react");
496
- var import_jsx_runtime2 = require("react/jsx-runtime");
497
- var markIcons = {
498
- bold: import_icons3.BoldIcon,
499
- italic: import_icons3.ItalicIcon,
500
- underline: import_icons3.UnderlineIcon,
501
- strike: import_icons3.StrikeIcon,
502
- code: import_icons3.CodeIcon,
503
- superscript: import_icons3.SuperscriptIcon,
504
- subscript: import_icons3.SubscriptIcon
505
- };
506
- var markShortcutKeys = {
507
- bold: "mod+b",
508
- italic: "mod+i",
509
- underline: "mod+u",
510
- strike: "mod+shift+s",
511
- code: "mod+e",
512
- superscript: "mod+.",
513
- subscript: "mod+,"
514
- };
515
- function canToggleMark(editor, type) {
516
- if (!editor || !editor.isEditable) return false;
517
- if (!(0, import_editor_utils2.isMarkInSchema)(type, editor) || (0, import_editor_utils2.isNodeTypeSelected)(editor, ["image"]))
518
- return false;
519
- return editor.can().toggleMark(type);
520
- }
521
- function isMarkActive(editor, type) {
522
- if (!editor) return false;
523
- return editor.isActive(type);
524
- }
525
- function toggleMark(editor, type) {
526
- if (!editor) return;
527
- editor.chain().focus().toggleMark(type).run();
528
- }
529
- function isMarkButtonDisabled(editor, type, userDisabled = false) {
530
- if (!editor) return true;
531
- if (userDisabled) return true;
532
- if (editor.isActive("codeBlock")) return true;
533
- if (!canToggleMark(editor, type)) return true;
534
- return false;
535
- }
536
- function shouldShowMarkButton(params) {
537
- const { editor, type, hideWhenUnavailable, markInSchema } = params;
538
- if (!markInSchema || !editor) {
539
- return false;
540
- }
541
- if (hideWhenUnavailable) {
542
- if ((0, import_react4.isNodeSelection)(editor.state.selection) || !canToggleMark(editor, type)) {
543
- return false;
544
- }
545
- }
546
- return true;
547
- }
548
- function getFormattedMarkName(type) {
549
- return type.charAt(0).toUpperCase() + type.slice(1);
550
- }
551
- function useMarkState(editor, type, disabled = false) {
552
- const markInSchema = (0, import_editor_utils2.isMarkInSchema)(type, editor);
553
- const isDisabled = isMarkButtonDisabled(editor, type, disabled);
554
- const isActive = isMarkActive(editor, type);
555
- const Icon = markIcons[type];
556
- const shortcutKey = markShortcutKeys[type];
557
- const formattedName = getFormattedMarkName(type);
558
- return {
559
- markInSchema,
560
- isDisabled,
561
- isActive,
562
- Icon,
563
- shortcutKey,
564
- formattedName
565
- };
566
- }
567
- var MarkButton = ({
568
- editor: providedEditor,
569
- type,
570
- text,
571
- hideWhenUnavailable = false,
572
- className = "",
573
- disabled,
574
- onClick,
575
- children,
576
- ...buttonProps
577
- }) => {
578
- const { editor } = useTiptapEditor(providedEditor);
579
- const {
580
- markInSchema,
581
- isDisabled,
582
- isActive,
583
- Icon,
584
- shortcutKey,
585
- formattedName
586
- } = useMarkState(editor, type, disabled);
587
- const handleClick = (0, import_react5.useCallback)(
588
- (e) => {
589
- onClick == null ? void 0 : onClick(e);
590
- if (!e.defaultPrevented && !isDisabled && editor) {
591
- toggleMark(editor, type);
592
- }
593
- },
594
- [onClick, isDisabled, editor, type]
595
- );
596
- const show = (0, import_react5.useMemo)(() => {
597
- return shouldShowMarkButton({
598
- editor,
599
- type,
600
- hideWhenUnavailable,
601
- markInSchema
602
- });
603
- }, [editor, type, hideWhenUnavailable, markInSchema]);
604
- if (!show || !editor || !editor.isEditable) {
605
- return null;
606
- }
607
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
608
- import_toolbar2.ToolbarButton,
609
- {
610
- type: "button",
611
- className: className.trim(),
612
- disabled: isDisabled,
613
- variant: "ghost",
614
- color: "default",
615
- "data-active-state": isActive ? "on" : "off",
616
- "data-disabled": isDisabled,
617
- tabIndex: -1,
618
- "aria-label": type,
619
- "aria-pressed": isActive,
620
- title: formattedName,
621
- shortcutKeys: shortcutKey,
622
- onClick: handleClick,
623
- isIconOnly: true,
624
- ...buttonProps,
625
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon, {})
626
- }
627
- );
628
- };
629
-
630
- // src/ui/bubble-menu/index.tsx
631
- var import_jsx_runtime3 = require("react/jsx-runtime");
632
- function BubbleMenu({ editor }) {
633
- if (!editor) {
634
- return null;
635
- }
636
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
637
- import_menus.BubbleMenu,
638
- {
639
- editor,
640
- shouldShow: ({ editor: e, state, view }) => {
641
- const { selection } = state;
642
- const { empty } = selection;
643
- if (!view.hasFocus()) return false;
644
- if (empty) return false;
645
- if (e.isActive("codeBlock")) return false;
646
- if (e.isActive("link")) return false;
647
- if (e.isActive("variable")) return false;
648
- if (!e.isEditable) return false;
649
- return true;
650
- },
651
- options: {
652
- placement: "top",
653
- offset: 8
654
- },
655
- className: "rounded-lg border bg-background shadow-md",
656
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_toolbar3.Toolbar, { radius: "md", border: "none", className: "p-1", children: [
657
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_toolbar3.ToolbarGroup, { children: [
658
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(MarkButton, { type: "bold" }),
659
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(MarkButton, { type: "italic" }),
660
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(MarkButton, { type: "strike" }),
661
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(MarkButton, { type: "code" })
662
- ] }),
663
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_toolbar3.ToolbarSeparator, {}),
664
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_toolbar3.ToolbarGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(LinkPopover, { autoOpenOnLinkActive: false }) })
665
- ] })
666
- }
667
- );
668
- }
669
- var bubble_menu_default = BubbleMenu;
670
- // Annotate the CommonJS export names for ESM import in node:
671
- 0 && (module.exports = {
672
- BubbleMenu
673
- });
@@ -1,16 +0,0 @@
1
- "use client";
2
- "use client";
3
- import {
4
- BubbleMenu,
5
- bubble_menu_default
6
- } from "../../chunk-2UDCL55K.mjs";
7
- import "../../chunk-LNVWG34E.mjs";
8
- import "../../chunk-LVNUU67N.mjs";
9
- import "../../chunk-7VGROP26.mjs";
10
- import "../../chunk-VTKJPVNM.mjs";
11
- import "../../chunk-P55PLOHR.mjs";
12
- import "../../chunk-TZQQ6C2Q.mjs";
13
- export {
14
- BubbleMenu,
15
- bubble_menu_default as default
16
- };
@@ -1,20 +0,0 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { ButtonProps } from '@kopexa/button';
3
- import { UseCodeBlockConfig } from './use-code-block.mjs';
4
- import '@kopexa/icons';
5
- import '@tiptap/react';
6
-
7
- interface CodeBlockButtonProps extends Omit<ButtonProps, "type">, UseCodeBlockConfig {
8
- /**
9
- * Optional text to display alongside the icon.
10
- */
11
- text?: string;
12
- /**
13
- * Optional show shortcut keys in the button.
14
- * @default false
15
- */
16
- showShortcut?: boolean;
17
- }
18
- declare const CodeBlockButton: ({ editor: providedEditor, text, hideWhenUnavailable, onToggled, showShortcut, onClick, children, ...buttonProps }: CodeBlockButtonProps) => react_jsx_runtime.JSX.Element | null;
19
-
20
- export { CodeBlockButton, type CodeBlockButtonProps };