@youcan/celeste 0.21.2 → 0.22.1

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 (542) hide show
  1. package/ai/README.md +1 -1
  2. package/ai/component-registry.json +2 -2
  3. package/ai/icons.json +2 -2
  4. package/ai/tokens.json +2 -2
  5. package/dist/celeste.css +3069 -3065
  6. package/dist/cjs/chunks/alert.cjs +4 -2
  7. package/dist/cjs/chunks/badge.cjs +4 -2
  8. package/dist/cjs/chunks/bar-chart.cjs +17 -10016
  9. package/dist/cjs/chunks/button.cjs +7 -5
  10. package/dist/cjs/chunks/calendar.cjs +20 -796
  11. package/dist/cjs/chunks/chart-card.cjs +4 -2
  12. package/dist/cjs/chunks/chart-legend.cjs +4 -2
  13. package/dist/cjs/chunks/chart-plot.cjs +4 -2
  14. package/dist/cjs/chunks/checkbox-card.cjs +11 -10
  15. package/dist/cjs/chunks/checkbox-label.cjs +12 -11
  16. package/dist/cjs/chunks/checkbox.cjs +7 -227
  17. package/dist/cjs/chunks/collapsible-content.cjs +5 -105
  18. package/dist/cjs/chunks/collapsible-trigger.cjs +2 -50
  19. package/dist/cjs/chunks/collapsible.cjs +3 -4
  20. package/dist/cjs/chunks/color-picker.cjs +21 -19
  21. package/dist/cjs/chunks/color-swatch.cjs +5 -3
  22. package/dist/cjs/chunks/combobox-anchor.cjs +6 -44
  23. package/dist/cjs/chunks/combobox-empty.cjs +5 -30
  24. package/dist/cjs/chunks/combobox-group.cjs +6 -5
  25. package/dist/cjs/chunks/combobox-input.cjs +6 -4
  26. package/dist/cjs/chunks/combobox-item.cjs +10 -66
  27. package/dist/cjs/chunks/combobox-list.cjs +8 -95
  28. package/dist/cjs/chunks/combobox-root.cjs +4 -6
  29. package/dist/cjs/chunks/combobox-separator.cjs +5 -3
  30. package/dist/cjs/chunks/combobox-trigger.cjs +7 -64
  31. package/dist/cjs/chunks/combobox.cjs +5 -5
  32. package/dist/cjs/chunks/compact-button.cjs +6 -4
  33. package/dist/cjs/chunks/components.cjs +55 -54
  34. package/dist/cjs/chunks/content-divider.cjs +6 -88
  35. package/dist/cjs/chunks/counter-input.cjs +10 -939
  36. package/dist/cjs/chunks/date-picker.cjs +5 -3
  37. package/dist/cjs/chunks/dialog-body.cjs +4 -2
  38. package/dist/cjs/chunks/dialog-content.cjs +1 -1
  39. package/dist/cjs/chunks/dialog-description.cjs +5 -4
  40. package/dist/cjs/chunks/dialog-footer.cjs +4 -2
  41. package/dist/cjs/chunks/dialog-title.cjs +5 -4
  42. package/dist/cjs/chunks/dialog-trigger.cjs +1 -1
  43. package/dist/cjs/chunks/dialog.cjs +3 -3
  44. package/dist/cjs/chunks/digit-input-group.cjs +8 -7
  45. package/dist/cjs/chunks/digit-input-slot.cjs +8 -265
  46. package/dist/cjs/chunks/digit-input.cjs +9 -8
  47. package/dist/cjs/chunks/drawer-body.cjs +7 -38
  48. package/dist/cjs/chunks/drawer-close.cjs +2 -2
  49. package/dist/cjs/chunks/drawer-content.cjs +9 -1148
  50. package/dist/cjs/chunks/drawer-description.cjs +7 -5
  51. package/dist/cjs/chunks/drawer-footer.cjs +4 -2
  52. package/dist/cjs/chunks/drawer-header.cjs +6 -4
  53. package/dist/cjs/chunks/drawer-title.cjs +7 -5
  54. package/dist/cjs/chunks/drawer-trigger.cjs +2 -50
  55. package/dist/cjs/chunks/drawer.cjs +4 -5
  56. package/dist/cjs/chunks/dropdown-menu-content.cjs +8 -535
  57. package/dist/cjs/chunks/dropdown-menu-group.cjs +2 -28
  58. package/dist/cjs/chunks/dropdown-menu-item.cjs +6 -124
  59. package/dist/cjs/chunks/dropdown-menu-label.cjs +6 -58
  60. package/dist/cjs/chunks/dropdown-menu-separator.cjs +5 -56
  61. package/dist/cjs/chunks/dropdown-menu-sub-content.cjs +7 -287
  62. package/dist/cjs/chunks/dropdown-menu-sub-trigger.cjs +6 -191
  63. package/dist/cjs/chunks/dropdown-menu-sub.cjs +3 -39
  64. package/dist/cjs/chunks/dropdown-menu-trigger.cjs +3 -89
  65. package/dist/cjs/chunks/dropdown-menu.cjs +8 -8
  66. package/dist/cjs/chunks/extra-settings.cjs +3 -3
  67. package/dist/cjs/chunks/fancy-button.cjs +7 -5
  68. package/dist/cjs/chunks/file-upload-area.cjs +6 -4
  69. package/dist/cjs/chunks/gradient-picker.cjs +8 -6
  70. package/dist/cjs/chunks/hint-text.cjs +4 -2
  71. package/dist/cjs/chunks/{label2.cjs → label.cjs} +7 -6
  72. package/dist/cjs/chunks/link-bubble.cjs +3 -3
  73. package/dist/cjs/chunks/link-button.cjs +7 -5
  74. package/dist/cjs/chunks/mochi.cjs +4 -2
  75. package/dist/cjs/chunks/modal-body.cjs +4 -2
  76. package/dist/cjs/chunks/modal-close.cjs +2 -2
  77. package/dist/cjs/chunks/modal-content.cjs +9 -9
  78. package/dist/cjs/chunks/modal-footer.cjs +4 -2
  79. package/dist/cjs/chunks/modal-header.cjs +8 -8
  80. package/dist/cjs/chunks/modal-trigger.cjs +2 -2
  81. package/dist/cjs/chunks/modal.cjs +3 -4
  82. package/dist/cjs/chunks/pagination-content.cjs +5 -87
  83. package/dist/cjs/chunks/pagination-ellipsis.cjs +6 -32
  84. package/dist/cjs/chunks/pagination-first.cjs +7 -42
  85. package/dist/cjs/chunks/pagination-item.cjs +6 -54
  86. package/dist/cjs/chunks/pagination-last.cjs +7 -42
  87. package/dist/cjs/chunks/pagination-next.cjs +7 -42
  88. package/dist/cjs/chunks/pagination-previous.cjs +7 -42
  89. package/dist/cjs/chunks/pagination.cjs +7 -8
  90. package/dist/cjs/chunks/popover-content.cjs +10 -705
  91. package/dist/cjs/chunks/popover-trigger.cjs +2 -61
  92. package/dist/cjs/chunks/popover.cjs +3 -4
  93. package/dist/cjs/chunks/progress-bar.cjs +6 -4
  94. package/dist/cjs/chunks/progress-circle.cjs +7 -5
  95. package/dist/cjs/chunks/radio-group-card.cjs +11 -10
  96. package/dist/cjs/chunks/radio-group-item.cjs +7 -302
  97. package/dist/cjs/chunks/radio-group-label.cjs +12 -11
  98. package/dist/cjs/chunks/radio-group.cjs +6 -5
  99. package/dist/cjs/chunks/range-calendar.cjs +21 -1031
  100. package/dist/cjs/chunks/range-picker.cjs +9 -7
  101. package/dist/cjs/chunks/rich-editor.cjs +21 -5863
  102. package/dist/cjs/chunks/rolldown-runtime.cjs +0 -14
  103. package/dist/cjs/chunks/scroll-area.cjs +9 -142
  104. package/dist/cjs/chunks/scroll-bar.cjs +6 -901
  105. package/dist/cjs/chunks/segmented-control-item.cjs +6 -163
  106. package/dist/cjs/chunks/segmented-control.cjs +7 -6
  107. package/dist/cjs/chunks/select-content.cjs +9 -311
  108. package/dist/cjs/chunks/select-group.cjs +2 -2
  109. package/dist/cjs/chunks/select-icon.cjs +4 -2
  110. package/dist/cjs/chunks/select-item.cjs +7 -227
  111. package/dist/cjs/chunks/select-label.cjs +5 -34
  112. package/dist/cjs/chunks/select-separator.cjs +5 -27
  113. package/dist/cjs/chunks/select-trigger.cjs +6 -163
  114. package/dist/cjs/chunks/select-value.cjs +5 -64
  115. package/dist/cjs/chunks/select.cjs +8 -8
  116. package/dist/cjs/chunks/sheet-close.cjs +5 -3
  117. package/dist/cjs/chunks/sheet-content.cjs +10 -10
  118. package/dist/cjs/chunks/sheet-description.cjs +7 -5
  119. package/dist/cjs/chunks/sheet-footer.cjs +4 -2
  120. package/dist/cjs/chunks/sheet-header.cjs +4 -2
  121. package/dist/cjs/chunks/sheet-title.cjs +7 -5
  122. package/dist/cjs/chunks/sheet-trigger.cjs +2 -2
  123. package/dist/cjs/chunks/sheet.cjs +3 -4
  124. package/dist/cjs/chunks/sidebar-content.cjs +4 -2
  125. package/dist/cjs/chunks/sidebar-element.cjs +6 -4
  126. package/dist/cjs/chunks/sidebar-footer.cjs +4 -2
  127. package/dist/cjs/chunks/sidebar-group-content.cjs +4 -2
  128. package/dist/cjs/chunks/sidebar-group-label.cjs +6 -4
  129. package/dist/cjs/chunks/sidebar-group.cjs +4 -2
  130. package/dist/cjs/chunks/sidebar-header.cjs +4 -2
  131. package/dist/cjs/chunks/sidebar-menu-action.cjs +6 -4
  132. package/dist/cjs/chunks/sidebar-menu-badge.cjs +4 -2
  133. package/dist/cjs/chunks/sidebar-menu-button.cjs +8 -6
  134. package/dist/cjs/chunks/sidebar-menu-item.cjs +4 -2
  135. package/dist/cjs/chunks/sidebar-menu-sub-button.cjs +6 -4
  136. package/dist/cjs/chunks/sidebar-menu-sub-item.cjs +4 -2
  137. package/dist/cjs/chunks/sidebar-menu-sub.cjs +4 -2
  138. package/dist/cjs/chunks/sidebar-menu.cjs +4 -2
  139. package/dist/cjs/chunks/sidebar-provider.cjs +9 -7
  140. package/dist/cjs/chunks/sidebar-trigger.cjs +4 -2
  141. package/dist/cjs/chunks/sidebar.cjs +4 -2
  142. package/dist/cjs/chunks/slider.cjs +10 -757
  143. package/dist/cjs/chunks/social-button.cjs +7 -5
  144. package/dist/cjs/chunks/status-badge.cjs +4 -2
  145. package/dist/cjs/chunks/switch.cjs +7 -185
  146. package/dist/cjs/chunks/tab-menu-content.cjs +5 -81
  147. package/dist/cjs/chunks/tab-menu-item.cjs +6 -88
  148. package/dist/cjs/chunks/tab-menu-list.cjs +6 -61
  149. package/dist/cjs/chunks/tab-menu.cjs +3 -4
  150. package/dist/cjs/chunks/table-body.cjs +4 -2
  151. package/dist/cjs/chunks/table-caption.cjs +4 -2
  152. package/dist/cjs/chunks/table-cell.cjs +4 -2
  153. package/dist/cjs/chunks/table-footer.cjs +4 -2
  154. package/dist/cjs/chunks/table-head.cjs +4 -2
  155. package/dist/cjs/chunks/table-header.cjs +4 -2
  156. package/dist/cjs/chunks/table-row.cjs +4 -2
  157. package/dist/cjs/chunks/table.cjs +4 -2
  158. package/dist/cjs/chunks/table2.cjs +4 -2
  159. package/dist/cjs/chunks/tag.cjs +6 -4
  160. package/dist/cjs/chunks/text-input-affix.cjs +4 -2
  161. package/dist/cjs/chunks/text-input-button.cjs +4 -2
  162. package/dist/cjs/chunks/text-input.cjs +11 -9
  163. package/dist/cjs/chunks/textarea.cjs +4 -2
  164. package/dist/cjs/chunks/tooltip-content.cjs +9 -599
  165. package/dist/cjs/chunks/tooltip-provider.cjs +2 -2
  166. package/dist/cjs/chunks/tooltip-root.cjs +3 -4
  167. package/dist/cjs/chunks/tooltip-trigger.cjs +3 -107
  168. package/dist/cjs/chunks/tooltip.cjs +4 -4
  169. package/dist/cjs/command-group.cjs +3 -4
  170. package/dist/cjs/command-input.cjs +7 -6
  171. package/dist/cjs/command-item.cjs +3 -4
  172. package/dist/cjs/command-list.cjs +3 -4
  173. package/dist/cjs/command-root.cjs +4 -6
  174. package/dist/cjs/command-separator.cjs +5 -3
  175. package/dist/cjs/context.cjs +1 -1
  176. package/dist/cjs/index.cjs +53 -53
  177. package/dist/cjs/label.cjs +1 -1
  178. package/dist/cjs/use-chart-motion.cjs +2 -2
  179. package/dist/cjs/use-color-model.cjs +6 -4
  180. package/dist/cjs/use-sidebar.cjs +2 -2
  181. package/dist/cjs/use-tab-observer.cjs +4 -4
  182. package/dist/es/chunks/alert.js +2 -2
  183. package/dist/es/chunks/badge.js +2 -2
  184. package/dist/es/chunks/bar-chart.js +11 -10007
  185. package/dist/es/chunks/button.js +4 -4
  186. package/dist/es/chunks/calendar.js +20 -798
  187. package/dist/es/chunks/chart-card.js +2 -2
  188. package/dist/es/chunks/chart-legend.js +2 -2
  189. package/dist/es/chunks/chart-plot.js +2 -2
  190. package/dist/es/chunks/checkbox-card.js +4 -5
  191. package/dist/es/chunks/checkbox-label.js +4 -5
  192. package/dist/es/chunks/checkbox.js +5 -227
  193. package/dist/es/chunks/collapsible-content.js +4 -106
  194. package/dist/es/chunks/collapsible-trigger.js +2 -50
  195. package/dist/es/chunks/collapsible.js +2 -3
  196. package/dist/es/chunks/color-picker.js +10 -10
  197. package/dist/es/chunks/color-swatch.js +1 -1
  198. package/dist/es/chunks/combobox-anchor.js +4 -44
  199. package/dist/es/chunks/combobox-empty.js +4 -30
  200. package/dist/es/chunks/combobox-group.js +4 -5
  201. package/dist/es/chunks/combobox-input.js +4 -4
  202. package/dist/es/chunks/combobox-item.js +8 -66
  203. package/dist/es/chunks/combobox-list.js +6 -94
  204. package/dist/es/chunks/combobox-root.js +3 -5
  205. package/dist/es/chunks/combobox-separator.js +3 -3
  206. package/dist/es/chunks/combobox-trigger.js +5 -63
  207. package/dist/es/chunks/combobox.js +4 -4
  208. package/dist/es/chunks/compact-button.js +3 -3
  209. package/dist/es/chunks/components.js +65 -55
  210. package/dist/es/chunks/content-divider.js +5 -89
  211. package/dist/es/chunks/counter-input.js +8 -939
  212. package/dist/es/chunks/date-picker.js +3 -3
  213. package/dist/es/chunks/dialog-body.js +2 -2
  214. package/dist/es/chunks/dialog-content.js +1 -1
  215. package/dist/es/chunks/dialog-description.js +3 -4
  216. package/dist/es/chunks/dialog-footer.js +2 -2
  217. package/dist/es/chunks/dialog-title.js +3 -4
  218. package/dist/es/chunks/dialog-trigger.js +1 -1
  219. package/dist/es/chunks/dialog.js +1 -1
  220. package/dist/es/chunks/digit-input-group.js +4 -5
  221. package/dist/es/chunks/digit-input-slot.js +5 -263
  222. package/dist/es/chunks/digit-input.js +5 -6
  223. package/dist/es/chunks/drawer-body.js +4 -36
  224. package/dist/es/chunks/drawer-close.js +2 -2
  225. package/dist/es/chunks/drawer-content.js +7 -1147
  226. package/dist/es/chunks/drawer-description.js +4 -4
  227. package/dist/es/chunks/drawer-footer.js +2 -2
  228. package/dist/es/chunks/drawer-header.js +4 -4
  229. package/dist/es/chunks/drawer-title.js +4 -4
  230. package/dist/es/chunks/drawer-trigger.js +3 -51
  231. package/dist/es/chunks/drawer.js +3 -4
  232. package/dist/es/chunks/dropdown-menu-content.js +6 -534
  233. package/dist/es/chunks/dropdown-menu-group.js +3 -28
  234. package/dist/es/chunks/dropdown-menu-item.js +4 -124
  235. package/dist/es/chunks/dropdown-menu-label.js +4 -57
  236. package/dist/es/chunks/dropdown-menu-separator.js +4 -56
  237. package/dist/es/chunks/dropdown-menu-sub-content.js +5 -286
  238. package/dist/es/chunks/dropdown-menu-sub-trigger.js +4 -191
  239. package/dist/es/chunks/dropdown-menu-sub.js +3 -39
  240. package/dist/es/chunks/dropdown-menu-trigger.js +3 -88
  241. package/dist/es/chunks/dropdown-menu.js +5 -7
  242. package/dist/es/chunks/extra-settings.js +3 -3
  243. package/dist/es/chunks/fancy-button.js +4 -4
  244. package/dist/es/chunks/file-upload-area.js +3 -3
  245. package/dist/es/chunks/gradient-picker.js +3 -3
  246. package/dist/es/chunks/hint-text.js +2 -2
  247. package/dist/es/chunks/{label2.js → label.js} +4 -5
  248. package/dist/es/chunks/link-bubble.js +3 -3
  249. package/dist/es/chunks/link-button.js +4 -4
  250. package/dist/es/chunks/mochi.js +2 -2
  251. package/dist/es/chunks/modal-body.js +2 -2
  252. package/dist/es/chunks/modal-close.js +2 -2
  253. package/dist/es/chunks/modal-content.js +5 -7
  254. package/dist/es/chunks/modal-footer.js +2 -2
  255. package/dist/es/chunks/modal-header.js +6 -8
  256. package/dist/es/chunks/modal-trigger.js +2 -2
  257. package/dist/es/chunks/modal.js +2 -3
  258. package/dist/es/chunks/pagination-content.js +5 -86
  259. package/dist/es/chunks/pagination-ellipsis.js +5 -30
  260. package/dist/es/chunks/pagination-first.js +5 -40
  261. package/dist/es/chunks/pagination-item.js +5 -53
  262. package/dist/es/chunks/pagination-last.js +5 -40
  263. package/dist/es/chunks/pagination-next.js +5 -40
  264. package/dist/es/chunks/pagination-previous.js +5 -40
  265. package/dist/es/chunks/pagination.js +4 -5
  266. package/dist/es/chunks/popover-content.js +8 -705
  267. package/dist/es/chunks/popover-trigger.js +3 -61
  268. package/dist/es/chunks/popover.js +2 -3
  269. package/dist/es/chunks/progress-bar.js +4 -4
  270. package/dist/es/chunks/progress-circle.js +5 -5
  271. package/dist/es/chunks/radio-group-card.js +4 -5
  272. package/dist/es/chunks/radio-group-item.js +5 -302
  273. package/dist/es/chunks/radio-group-label.js +4 -5
  274. package/dist/es/chunks/radio-group.js +3 -4
  275. package/dist/es/chunks/range-calendar.js +21 -1033
  276. package/dist/es/chunks/range-picker.js +7 -7
  277. package/dist/es/chunks/rich-editor.js +13 -5859
  278. package/dist/es/chunks/scroll-area.js +8 -142
  279. package/dist/es/chunks/scroll-bar.js +6 -890
  280. package/dist/es/chunks/segmented-control-item.js +5 -163
  281. package/dist/es/chunks/segmented-control.js +4 -5
  282. package/dist/es/chunks/select-content.js +7 -310
  283. package/dist/es/chunks/select-group.js +2 -2
  284. package/dist/es/chunks/select-icon.js +2 -2
  285. package/dist/es/chunks/select-item.js +6 -227
  286. package/dist/es/chunks/select-label.js +3 -33
  287. package/dist/es/chunks/select-separator.js +4 -27
  288. package/dist/es/chunks/select-trigger.js +5 -163
  289. package/dist/es/chunks/select-value.js +4 -64
  290. package/dist/es/chunks/select.js +5 -7
  291. package/dist/es/chunks/sheet-close.js +3 -3
  292. package/dist/es/chunks/sheet-content.js +6 -8
  293. package/dist/es/chunks/sheet-description.js +4 -4
  294. package/dist/es/chunks/sheet-footer.js +2 -2
  295. package/dist/es/chunks/sheet-header.js +2 -2
  296. package/dist/es/chunks/sheet-title.js +4 -4
  297. package/dist/es/chunks/sheet-trigger.js +2 -2
  298. package/dist/es/chunks/sheet.js +2 -3
  299. package/dist/es/chunks/sidebar-content.js +2 -2
  300. package/dist/es/chunks/sidebar-element.js +3 -3
  301. package/dist/es/chunks/sidebar-footer.js +2 -2
  302. package/dist/es/chunks/sidebar-group-content.js +2 -2
  303. package/dist/es/chunks/sidebar-group-label.js +3 -3
  304. package/dist/es/chunks/sidebar-group.js +2 -2
  305. package/dist/es/chunks/sidebar-header.js +2 -2
  306. package/dist/es/chunks/sidebar-menu-action.js +3 -3
  307. package/dist/es/chunks/sidebar-menu-badge.js +2 -2
  308. package/dist/es/chunks/sidebar-menu-button.js +4 -4
  309. package/dist/es/chunks/sidebar-menu-item.js +2 -2
  310. package/dist/es/chunks/sidebar-menu-sub-button.js +3 -3
  311. package/dist/es/chunks/sidebar-menu-sub-item.js +2 -2
  312. package/dist/es/chunks/sidebar-menu-sub.js +2 -2
  313. package/dist/es/chunks/sidebar-menu.js +2 -2
  314. package/dist/es/chunks/sidebar-provider.js +3 -3
  315. package/dist/es/chunks/sidebar-trigger.js +2 -2
  316. package/dist/es/chunks/sidebar.js +2 -2
  317. package/dist/es/chunks/slider.js +10 -759
  318. package/dist/es/chunks/social-button.js +4 -4
  319. package/dist/es/chunks/status-badge.js +2 -2
  320. package/dist/es/chunks/switch.js +5 -185
  321. package/dist/es/chunks/tab-menu-content.js +4 -81
  322. package/dist/es/chunks/tab-menu-item.js +4 -88
  323. package/dist/es/chunks/tab-menu-list.js +5 -62
  324. package/dist/es/chunks/tab-menu.js +2 -3
  325. package/dist/es/chunks/table-body.js +2 -2
  326. package/dist/es/chunks/table-caption.js +2 -2
  327. package/dist/es/chunks/table-cell.js +2 -2
  328. package/dist/es/chunks/table-footer.js +2 -2
  329. package/dist/es/chunks/table-head.js +2 -2
  330. package/dist/es/chunks/table-header.js +2 -2
  331. package/dist/es/chunks/table-row.js +2 -2
  332. package/dist/es/chunks/table.js +2 -2
  333. package/dist/es/chunks/table2.js +2 -2
  334. package/dist/es/chunks/tag.js +3 -3
  335. package/dist/es/chunks/text-input-affix.js +2 -2
  336. package/dist/es/chunks/text-input-button.js +2 -2
  337. package/dist/es/chunks/text-input.js +3 -3
  338. package/dist/es/chunks/textarea.js +2 -2
  339. package/dist/es/chunks/tooltip-content.js +7 -599
  340. package/dist/es/chunks/tooltip-provider.js +2 -2
  341. package/dist/es/chunks/tooltip-root.js +2 -3
  342. package/dist/es/chunks/tooltip-trigger.js +3 -107
  343. package/dist/es/chunks/tooltip.js +3 -3
  344. package/dist/es/command-group.js +3 -4
  345. package/dist/es/command-input.js +4 -5
  346. package/dist/es/command-item.js +2 -3
  347. package/dist/es/command-list.js +2 -3
  348. package/dist/es/command-root.js +3 -5
  349. package/dist/es/command-separator.js +3 -3
  350. package/dist/es/context.js +1 -1
  351. package/dist/es/index.js +54 -54
  352. package/dist/es/label.js +1 -1
  353. package/dist/es/use-chart-motion.js +1 -1
  354. package/dist/es/use-color-model.js +1 -1
  355. package/dist/es/use-sidebar.js +1 -1
  356. package/dist/es/use-tab-observer.js +1 -1
  357. package/package.json +3 -3
  358. package/src/components/button/button.vue +1 -0
  359. package/src/components/button/fancy-button.vue +1 -0
  360. package/src/components/button/link-button.vue +1 -0
  361. package/src/components/button/social-button.vue +1 -0
  362. package/dist/cjs/chunks/BubbleSelect.cjs +0 -331
  363. package/dist/cjs/chunks/CollapsibleRoot.cjs +0 -89
  364. package/dist/cjs/chunks/Collection.cjs +0 -84
  365. package/dist/cjs/chunks/ComboboxContent.cjs +0 -446
  366. package/dist/cjs/chunks/ComboboxGroup.cjs +0 -89
  367. package/dist/cjs/chunks/ComboboxInput.cjs +0 -269
  368. package/dist/cjs/chunks/ComboboxItem.cjs +0 -202
  369. package/dist/cjs/chunks/ComboboxLabel.cjs +0 -46
  370. package/dist/cjs/chunks/ComboboxRoot.cjs +0 -753
  371. package/dist/cjs/chunks/ComboboxSeparator.cjs +0 -34
  372. package/dist/cjs/chunks/ConfigProvider.cjs +0 -68
  373. package/dist/cjs/chunks/DialogClose.cjs +0 -40
  374. package/dist/cjs/chunks/DialogDescription.cjs +0 -37
  375. package/dist/cjs/chunks/DialogPortal.cjs +0 -524
  376. package/dist/cjs/chunks/DialogRoot.cjs +0 -80
  377. package/dist/cjs/chunks/DialogTitle.cjs +0 -37
  378. package/dist/cjs/chunks/DialogTrigger.cjs +0 -56
  379. package/dist/cjs/chunks/DismissableLayer.cjs +0 -268
  380. package/dist/cjs/chunks/DrawerClose.cjs +0 -40
  381. package/dist/cjs/chunks/DrawerDescription.cjs +0 -37
  382. package/dist/cjs/chunks/DrawerRoot.cjs +0 -366
  383. package/dist/cjs/chunks/DrawerTitle.cjs +0 -37
  384. package/dist/cjs/chunks/DropdownMenuPortal.cjs +0 -72
  385. package/dist/cjs/chunks/DropdownMenuRoot.cjs +0 -86
  386. package/dist/cjs/chunks/FocusScope.cjs +0 -377
  387. package/dist/cjs/chunks/Label.cjs +0 -41
  388. package/dist/cjs/chunks/MenuAnchor.cjs +0 -36
  389. package/dist/cjs/chunks/MenuContentImpl.cjs +0 -371
  390. package/dist/cjs/chunks/MenuGroup.cjs +0 -43
  391. package/dist/cjs/chunks/MenuItemImpl.cjs +0 -100
  392. package/dist/cjs/chunks/MenuRoot.cjs +0 -108
  393. package/dist/cjs/chunks/MenuSub.cjs +0 -67
  394. package/dist/cjs/chunks/PaginationRoot.cjs +0 -100
  395. package/dist/cjs/chunks/PinInputRoot.cjs +0 -152
  396. package/dist/cjs/chunks/PopoverRoot.cjs +0 -72
  397. package/dist/cjs/chunks/PopperAnchor.cjs +0 -47
  398. package/dist/cjs/chunks/PopperArrow.cjs +0 -151
  399. package/dist/cjs/chunks/PopperContent.cjs +0 -2099
  400. package/dist/cjs/chunks/PopperRoot.cjs +0 -31
  401. package/dist/cjs/chunks/Presence.cjs +0 -195
  402. package/dist/cjs/chunks/Primitive.cjs +0 -79
  403. package/dist/cjs/chunks/ProgressIndicator.cjs +0 -160
  404. package/dist/cjs/chunks/RadioGroupRoot.cjs +0 -142
  405. package/dist/cjs/chunks/RovingFocusGroup.cjs +0 -146
  406. package/dist/cjs/chunks/RovingFocusItem.cjs +0 -113
  407. package/dist/cjs/chunks/SelectGroup.cjs +0 -43
  408. package/dist/cjs/chunks/SelectItemAlignedPosition.cjs +0 -597
  409. package/dist/cjs/chunks/TabsRoot.cjs +0 -113
  410. package/dist/cjs/chunks/Teleport.cjs +0 -50
  411. package/dist/cjs/chunks/ToggleGroupRoot.cjs +0 -187
  412. package/dist/cjs/chunks/TooltipProvider.cjs +0 -86
  413. package/dist/cjs/chunks/TooltipRoot.cjs +0 -145
  414. package/dist/cjs/chunks/VisuallyHidden.cjs +0 -64
  415. package/dist/cjs/chunks/VisuallyHiddenInput.cjs +0 -146
  416. package/dist/cjs/chunks/clamp.cjs +0 -75
  417. package/dist/cjs/chunks/clsx.cjs +0 -21
  418. package/dist/cjs/chunks/createContext.cjs +0 -37
  419. package/dist/cjs/chunks/defu.cjs +0 -34
  420. package/dist/cjs/chunks/dist.cjs +0 -543
  421. package/dist/cjs/chunks/dist2.cjs +0 -538
  422. package/dist/cjs/chunks/dist3.cjs +0 -16177
  423. package/dist/cjs/chunks/getActiveElement.cjs +0 -14
  424. package/dist/cjs/chunks/handleAndDispatchCustomEvent.cjs +0 -18
  425. package/dist/cjs/chunks/isValueEqualOrExist.cjs +0 -24
  426. package/dist/cjs/chunks/menus.cjs +0 -1368
  427. package/dist/cjs/chunks/nullish.cjs +0 -11
  428. package/dist/cjs/chunks/ohash.D__AXeF1.cjs +0 -114
  429. package/dist/cjs/chunks/tinycolor.cjs +0 -904
  430. package/dist/cjs/chunks/useArrowNavigation.cjs +0 -65
  431. package/dist/cjs/chunks/useCalendar.cjs +0 -2533
  432. package/dist/cjs/chunks/useComposing.cjs +0 -45
  433. package/dist/cjs/chunks/useDirection.cjs +0 -19
  434. package/dist/cjs/chunks/useEmitAsProps.cjs +0 -33
  435. package/dist/cjs/chunks/useFocusGuards.cjs +0 -39
  436. package/dist/cjs/chunks/useFormControl.cjs +0 -13
  437. package/dist/cjs/chunks/useForwardExpose.cjs +0 -63
  438. package/dist/cjs/chunks/useForwardProps.cjs +0 -39
  439. package/dist/cjs/chunks/useForwardPropsEmits.cjs +0 -19
  440. package/dist/cjs/chunks/useForwardScopeId.cjs +0 -30
  441. package/dist/cjs/chunks/useHideOthers.cjs +0 -137
  442. package/dist/cjs/chunks/useId.cjs +0 -30
  443. package/dist/cjs/chunks/useKbd.cjs +0 -46
  444. package/dist/cjs/chunks/useLocale.cjs +0 -19
  445. package/dist/cjs/chunks/useNonce.cjs +0 -14
  446. package/dist/cjs/chunks/usePrimitiveElement.cjs +0 -17
  447. package/dist/cjs/chunks/useSize.cjs +0 -54
  448. package/dist/cjs/chunks/useTypeahead.cjs +0 -69
  449. package/dist/cjs/chunks/utils.cjs +0 -117
  450. package/dist/cjs/chunks/utils2.cjs +0 -73
  451. package/dist/cjs/chunks/utils3.cjs +0 -20
  452. package/dist/es/chunks/BubbleSelect.js +0 -290
  453. package/dist/es/chunks/CollapsibleRoot.js +0 -78
  454. package/dist/es/chunks/Collection.js +0 -79
  455. package/dist/es/chunks/ComboboxContent.js +0 -441
  456. package/dist/es/chunks/ComboboxGroup.js +0 -78
  457. package/dist/es/chunks/ComboboxInput.js +0 -264
  458. package/dist/es/chunks/ComboboxItem.js +0 -191
  459. package/dist/es/chunks/ComboboxLabel.js +0 -41
  460. package/dist/es/chunks/ComboboxRoot.js +0 -730
  461. package/dist/es/chunks/ComboboxSeparator.js +0 -29
  462. package/dist/es/chunks/ConfigProvider.js +0 -57
  463. package/dist/es/chunks/DialogClose.js +0 -35
  464. package/dist/es/chunks/DialogDescription.js +0 -32
  465. package/dist/es/chunks/DialogPortal.js +0 -507
  466. package/dist/es/chunks/DialogRoot.js +0 -69
  467. package/dist/es/chunks/DialogTitle.js +0 -32
  468. package/dist/es/chunks/DialogTrigger.js +0 -51
  469. package/dist/es/chunks/DismissableLayer.js +0 -257
  470. package/dist/es/chunks/DrawerClose.js +0 -35
  471. package/dist/es/chunks/DrawerDescription.js +0 -32
  472. package/dist/es/chunks/DrawerRoot.js +0 -325
  473. package/dist/es/chunks/DrawerTitle.js +0 -32
  474. package/dist/es/chunks/DropdownMenuPortal.js +0 -67
  475. package/dist/es/chunks/DropdownMenuRoot.js +0 -75
  476. package/dist/es/chunks/FocusScope.js +0 -360
  477. package/dist/es/chunks/Label.js +0 -36
  478. package/dist/es/chunks/MenuAnchor.js +0 -31
  479. package/dist/es/chunks/MenuContentImpl.js +0 -360
  480. package/dist/es/chunks/MenuGroup.js +0 -32
  481. package/dist/es/chunks/MenuItemImpl.js +0 -95
  482. package/dist/es/chunks/MenuRoot.js +0 -85
  483. package/dist/es/chunks/MenuSub.js +0 -56
  484. package/dist/es/chunks/PaginationRoot.js +0 -89
  485. package/dist/es/chunks/PinInputRoot.js +0 -141
  486. package/dist/es/chunks/PopoverRoot.js +0 -61
  487. package/dist/es/chunks/PopperAnchor.js +0 -42
  488. package/dist/es/chunks/PopperArrow.js +0 -146
  489. package/dist/es/chunks/PopperContent.js +0 -2029
  490. package/dist/es/chunks/PopperRoot.js +0 -20
  491. package/dist/es/chunks/Presence.js +0 -184
  492. package/dist/es/chunks/Primitive.js +0 -62
  493. package/dist/es/chunks/ProgressIndicator.js +0 -149
  494. package/dist/es/chunks/RadioGroupRoot.js +0 -131
  495. package/dist/es/chunks/RovingFocusGroup.js +0 -135
  496. package/dist/es/chunks/RovingFocusItem.js +0 -108
  497. package/dist/es/chunks/SelectGroup.js +0 -32
  498. package/dist/es/chunks/SelectItemAlignedPosition.js +0 -568
  499. package/dist/es/chunks/TabsRoot.js +0 -102
  500. package/dist/es/chunks/Teleport.js +0 -45
  501. package/dist/es/chunks/ToggleGroupRoot.js +0 -176
  502. package/dist/es/chunks/TooltipProvider.js +0 -75
  503. package/dist/es/chunks/TooltipRoot.js +0 -128
  504. package/dist/es/chunks/VisuallyHidden.js +0 -59
  505. package/dist/es/chunks/VisuallyHiddenInput.js +0 -141
  506. package/dist/es/chunks/clamp.js +0 -64
  507. package/dist/es/chunks/clsx.js +0 -16
  508. package/dist/es/chunks/createContext.js +0 -32
  509. package/dist/es/chunks/defu.js +0 -29
  510. package/dist/es/chunks/dist.js +0 -418
  511. package/dist/es/chunks/dist2.js +0 -461
  512. package/dist/es/chunks/dist3.js +0 -15890
  513. package/dist/es/chunks/getActiveElement.js +0 -9
  514. package/dist/es/chunks/handleAndDispatchCustomEvent.js +0 -13
  515. package/dist/es/chunks/isValueEqualOrExist.js +0 -19
  516. package/dist/es/chunks/menus.js +0 -1368
  517. package/dist/es/chunks/nullish.js +0 -6
  518. package/dist/es/chunks/ohash.D__AXeF1.js +0 -109
  519. package/dist/es/chunks/rolldown-runtime.js +0 -34
  520. package/dist/es/chunks/tinycolor.js +0 -899
  521. package/dist/es/chunks/useArrowNavigation.js +0 -60
  522. package/dist/es/chunks/useCalendar.js +0 -2426
  523. package/dist/es/chunks/useComposing.js +0 -40
  524. package/dist/es/chunks/useDirection.js +0 -14
  525. package/dist/es/chunks/useEmitAsProps.js +0 -28
  526. package/dist/es/chunks/useFocusGuards.js +0 -34
  527. package/dist/es/chunks/useFormControl.js +0 -8
  528. package/dist/es/chunks/useForwardExpose.js +0 -58
  529. package/dist/es/chunks/useForwardProps.js +0 -34
  530. package/dist/es/chunks/useForwardPropsEmits.js +0 -14
  531. package/dist/es/chunks/useForwardScopeId.js +0 -25
  532. package/dist/es/chunks/useHideOthers.js +0 -132
  533. package/dist/es/chunks/useId.js +0 -23
  534. package/dist/es/chunks/useKbd.js +0 -41
  535. package/dist/es/chunks/useLocale.js +0 -14
  536. package/dist/es/chunks/useNonce.js +0 -9
  537. package/dist/es/chunks/usePrimitiveElement.js +0 -12
  538. package/dist/es/chunks/useSize.js +0 -49
  539. package/dist/es/chunks/useTypeahead.js +0 -64
  540. package/dist/es/chunks/utils.js +0 -58
  541. package/dist/es/chunks/utils2.js +0 -44
  542. package/dist/es/chunks/utils3.js +0 -9
@@ -1,1368 +0,0 @@
1
- const require_PopperContent = require("./PopperContent.cjs");
2
- const require_dist = require("./dist3.cjs");
3
- let vue = require("vue");
4
- //#region ../../node_modules/.pnpm/prosemirror-tables@1.8.5/node_modules/prosemirror-tables/dist/index.js
5
- var readFromCache;
6
- var addToCache;
7
- if (typeof WeakMap != "undefined") {
8
- let cache = /* @__PURE__ */ new WeakMap();
9
- readFromCache = (key) => cache.get(key);
10
- addToCache = (key, value) => {
11
- cache.set(key, value);
12
- return value;
13
- };
14
- } else {
15
- const cache = [];
16
- const cacheSize = 10;
17
- let cachePos = 0;
18
- readFromCache = (key) => {
19
- for (let i = 0; i < cache.length; i += 2) if (cache[i] == key) return cache[i + 1];
20
- };
21
- addToCache = (key, value) => {
22
- if (cachePos == cacheSize) cachePos = 0;
23
- cache[cachePos++] = key;
24
- return cache[cachePos++] = value;
25
- };
26
- }
27
- /**
28
- * A table map describes the structure of a given table. To avoid
29
- * recomputing them all the time, they are cached per table node. To
30
- * be able to do that, positions saved in the map are relative to the
31
- * start of the table, rather than the start of the document.
32
- *
33
- * @public
34
- */
35
- var TableMap = class {
36
- constructor(width, height, map, problems) {
37
- this.width = width;
38
- this.height = height;
39
- this.map = map;
40
- this.problems = problems;
41
- }
42
- findCell(pos) {
43
- for (let i = 0; i < this.map.length; i++) {
44
- const curPos = this.map[i];
45
- if (curPos != pos) continue;
46
- const left = i % this.width;
47
- const top = i / this.width | 0;
48
- let right = left + 1;
49
- let bottom = top + 1;
50
- for (let j = 1; right < this.width && this.map[i + j] == curPos; j++) right++;
51
- for (let j = 1; bottom < this.height && this.map[i + this.width * j] == curPos; j++) bottom++;
52
- return {
53
- left,
54
- top,
55
- right,
56
- bottom
57
- };
58
- }
59
- throw new RangeError(`No cell with offset ${pos} found`);
60
- }
61
- colCount(pos) {
62
- for (let i = 0; i < this.map.length; i++) if (this.map[i] == pos) return i % this.width;
63
- throw new RangeError(`No cell with offset ${pos} found`);
64
- }
65
- nextCell(pos, axis, dir) {
66
- const { left, right, top, bottom } = this.findCell(pos);
67
- if (axis == "horiz") {
68
- if (dir < 0 ? left == 0 : right == this.width) return null;
69
- return this.map[top * this.width + (dir < 0 ? left - 1 : right)];
70
- } else {
71
- if (dir < 0 ? top == 0 : bottom == this.height) return null;
72
- return this.map[left + this.width * (dir < 0 ? top - 1 : bottom)];
73
- }
74
- }
75
- rectBetween(a, b) {
76
- const { left: leftA, right: rightA, top: topA, bottom: bottomA } = this.findCell(a);
77
- const { left: leftB, right: rightB, top: topB, bottom: bottomB } = this.findCell(b);
78
- return {
79
- left: Math.min(leftA, leftB),
80
- top: Math.min(topA, topB),
81
- right: Math.max(rightA, rightB),
82
- bottom: Math.max(bottomA, bottomB)
83
- };
84
- }
85
- cellsInRect(rect) {
86
- const result = [];
87
- const seen = {};
88
- for (let row = rect.top; row < rect.bottom; row++) for (let col = rect.left; col < rect.right; col++) {
89
- const index = row * this.width + col;
90
- const pos = this.map[index];
91
- if (seen[pos]) continue;
92
- seen[pos] = true;
93
- if (col == rect.left && col && this.map[index - 1] == pos || row == rect.top && row && this.map[index - this.width] == pos) continue;
94
- result.push(pos);
95
- }
96
- return result;
97
- }
98
- positionAt(row, col, table) {
99
- for (let i = 0, rowStart = 0;; i++) {
100
- const rowEnd = rowStart + table.child(i).nodeSize;
101
- if (i == row) {
102
- let index = col + row * this.width;
103
- const rowEndIndex = (row + 1) * this.width;
104
- while (index < rowEndIndex && this.map[index] < rowStart) index++;
105
- return index == rowEndIndex ? rowEnd - 1 : this.map[index];
106
- }
107
- rowStart = rowEnd;
108
- }
109
- }
110
- static get(table) {
111
- return readFromCache(table) || addToCache(table, computeMap(table));
112
- }
113
- };
114
- function computeMap(table) {
115
- if (table.type.spec.tableRole != "table") throw new RangeError("Not a table node: " + table.type.name);
116
- const width = findWidth(table), height = table.childCount;
117
- const map = [];
118
- let mapPos = 0;
119
- let problems = null;
120
- const colWidths = [];
121
- for (let i = 0, e = width * height; i < e; i++) map[i] = 0;
122
- for (let row = 0, pos = 0; row < height; row++) {
123
- const rowNode = table.child(row);
124
- pos++;
125
- for (let i = 0;; i++) {
126
- while (mapPos < map.length && map[mapPos] != 0) mapPos++;
127
- if (i == rowNode.childCount) break;
128
- const cellNode = rowNode.child(i);
129
- const { colspan, rowspan, colwidth } = cellNode.attrs;
130
- for (let h = 0; h < rowspan; h++) {
131
- if (h + row >= height) {
132
- (problems || (problems = [])).push({
133
- type: "overlong_rowspan",
134
- pos,
135
- n: rowspan - h
136
- });
137
- break;
138
- }
139
- const start = mapPos + h * width;
140
- for (let w = 0; w < colspan; w++) {
141
- if (map[start + w] == 0) map[start + w] = pos;
142
- else (problems || (problems = [])).push({
143
- type: "collision",
144
- row,
145
- pos,
146
- n: colspan - w
147
- });
148
- const colW = colwidth && colwidth[w];
149
- if (colW) {
150
- const widthIndex = (start + w) % width * 2, prev = colWidths[widthIndex];
151
- if (prev == null || prev != colW && colWidths[widthIndex + 1] == 1) {
152
- colWidths[widthIndex] = colW;
153
- colWidths[widthIndex + 1] = 1;
154
- } else if (prev == colW) colWidths[widthIndex + 1]++;
155
- }
156
- }
157
- }
158
- mapPos += colspan;
159
- pos += cellNode.nodeSize;
160
- }
161
- const expectedPos = (row + 1) * width;
162
- let missing = 0;
163
- while (mapPos < expectedPos) if (map[mapPos++] == 0) missing++;
164
- if (missing) (problems || (problems = [])).push({
165
- type: "missing",
166
- row,
167
- n: missing
168
- });
169
- pos++;
170
- }
171
- if (width === 0 || height === 0) (problems || (problems = [])).push({ type: "zero_sized" });
172
- const tableMap = new TableMap(width, height, map, problems);
173
- let badWidths = false;
174
- for (let i = 0; !badWidths && i < colWidths.length; i += 2) if (colWidths[i] != null && colWidths[i + 1] < height) badWidths = true;
175
- if (badWidths) findBadColWidths(tableMap, colWidths, table);
176
- return tableMap;
177
- }
178
- function findWidth(table) {
179
- let width = -1;
180
- let hasRowSpan = false;
181
- for (let row = 0; row < table.childCount; row++) {
182
- const rowNode = table.child(row);
183
- let rowWidth = 0;
184
- if (hasRowSpan) for (let j = 0; j < row; j++) {
185
- const prevRow = table.child(j);
186
- for (let i = 0; i < prevRow.childCount; i++) {
187
- const cell = prevRow.child(i);
188
- if (j + cell.attrs.rowspan > row) rowWidth += cell.attrs.colspan;
189
- }
190
- }
191
- for (let i = 0; i < rowNode.childCount; i++) {
192
- const cell = rowNode.child(i);
193
- rowWidth += cell.attrs.colspan;
194
- if (cell.attrs.rowspan > 1) hasRowSpan = true;
195
- }
196
- if (width == -1) width = rowWidth;
197
- else if (width != rowWidth) width = Math.max(width, rowWidth);
198
- }
199
- return width;
200
- }
201
- function findBadColWidths(map, colWidths, table) {
202
- if (!map.problems) map.problems = [];
203
- const seen = {};
204
- for (let i = 0; i < map.map.length; i++) {
205
- const pos = map.map[i];
206
- if (seen[pos]) continue;
207
- seen[pos] = true;
208
- const node = table.nodeAt(pos);
209
- if (!node) throw new RangeError(`No cell with offset ${pos} found`);
210
- let updated = null;
211
- const attrs = node.attrs;
212
- for (let j = 0; j < attrs.colspan; j++) {
213
- const colWidth = colWidths[(i + j) % map.width * 2];
214
- if (colWidth != null && (!attrs.colwidth || attrs.colwidth[j] != colWidth)) (updated || (updated = freshColWidth(attrs)))[j] = colWidth;
215
- }
216
- if (updated) map.problems.unshift({
217
- type: "colwidth mismatch",
218
- pos,
219
- colwidth: updated
220
- });
221
- }
222
- }
223
- function freshColWidth(attrs) {
224
- if (attrs.colwidth) return attrs.colwidth.slice();
225
- const result = [];
226
- for (let i = 0; i < attrs.colspan; i++) result.push(0);
227
- return result;
228
- }
229
- /**
230
- * @public
231
- */
232
- function tableNodeTypes(schema) {
233
- let result = schema.cached.tableNodeTypes;
234
- if (!result) {
235
- result = schema.cached.tableNodeTypes = {};
236
- for (const name in schema.nodes) {
237
- const type = schema.nodes[name], role = type.spec.tableRole;
238
- if (role) result[role] = type;
239
- }
240
- }
241
- return result;
242
- }
243
- new require_dist.PluginKey("selectingCells");
244
- /**
245
- * @public
246
- */
247
- function cellAround($pos) {
248
- for (let d = $pos.depth - 1; d > 0; d--) if ($pos.node(d).type.spec.tableRole == "row") return $pos.node(0).resolve($pos.before(d + 1));
249
- return null;
250
- }
251
- /**
252
- * @public
253
- */
254
- function isInTable(state) {
255
- const $head = state.selection.$head;
256
- for (let d = $head.depth; d > 0; d--) if ($head.node(d).type.spec.tableRole == "row") return true;
257
- return false;
258
- }
259
- /**
260
- * @internal
261
- */
262
- function selectionCell(state) {
263
- const sel = state.selection;
264
- if ("$anchorCell" in sel && sel.$anchorCell) return sel.$anchorCell.pos > sel.$headCell.pos ? sel.$anchorCell : sel.$headCell;
265
- else if ("node" in sel && sel.node && sel.node.type.spec.tableRole == "cell") return sel.$anchor;
266
- const $cell = cellAround(sel.$head) || cellNear(sel.$head);
267
- if ($cell) return $cell;
268
- throw new RangeError(`No cell found around position ${sel.head}`);
269
- }
270
- /**
271
- * @public
272
- */
273
- function cellNear($pos) {
274
- for (let after = $pos.nodeAfter, pos = $pos.pos; after; after = after.firstChild, pos++) {
275
- const role = after.type.spec.tableRole;
276
- if (role == "cell" || role == "header_cell") return $pos.doc.resolve(pos);
277
- }
278
- for (let before = $pos.nodeBefore, pos = $pos.pos; before; before = before.lastChild, pos--) {
279
- const role = before.type.spec.tableRole;
280
- if (role == "cell" || role == "header_cell") return $pos.doc.resolve(pos - before.nodeSize);
281
- }
282
- }
283
- /**
284
- * @public
285
- */
286
- function pointsAtCell($pos) {
287
- return $pos.parent.type.spec.tableRole == "row" && !!$pos.nodeAfter;
288
- }
289
- /**
290
- * @internal
291
- */
292
- function inSameTable($cellA, $cellB) {
293
- return $cellA.depth == $cellB.depth && $cellA.pos >= $cellB.start(-1) && $cellA.pos <= $cellB.end(-1);
294
- }
295
- /**
296
- * @public
297
- */
298
- function nextCell($pos, axis, dir) {
299
- const table = $pos.node(-1);
300
- const map = TableMap.get(table);
301
- const tableStart = $pos.start(-1);
302
- const moved = map.nextCell($pos.pos - tableStart, axis, dir);
303
- return moved == null ? null : $pos.node(0).resolve(tableStart + moved);
304
- }
305
- /**
306
- * @public
307
- */
308
- function removeColSpan(attrs, pos, n = 1) {
309
- const result = {
310
- ...attrs,
311
- colspan: attrs.colspan - n
312
- };
313
- if (result.colwidth) {
314
- result.colwidth = result.colwidth.slice();
315
- result.colwidth.splice(pos, n);
316
- if (!result.colwidth.some((w) => w > 0)) result.colwidth = null;
317
- }
318
- return result;
319
- }
320
- /**
321
- * A [`Selection`](http://prosemirror.net/docs/ref/#state.Selection)
322
- * subclass that represents a cell selection spanning part of a table.
323
- * With the plugin enabled, these will be created when the user
324
- * selects across cells, and will be drawn by giving selected cells a
325
- * `selectedCell` CSS class.
326
- *
327
- * @public
328
- */
329
- var CellSelection = class CellSelection extends require_dist.Selection {
330
- constructor($anchorCell, $headCell = $anchorCell) {
331
- const table = $anchorCell.node(-1);
332
- const map = TableMap.get(table);
333
- const tableStart = $anchorCell.start(-1);
334
- const rect = map.rectBetween($anchorCell.pos - tableStart, $headCell.pos - tableStart);
335
- const doc = $anchorCell.node(0);
336
- const cells = map.cellsInRect(rect).filter((p) => p != $headCell.pos - tableStart);
337
- cells.unshift($headCell.pos - tableStart);
338
- const ranges = cells.map((pos) => {
339
- const cell = table.nodeAt(pos);
340
- if (!cell) throw new RangeError(`No cell with offset ${pos} found`);
341
- const from = tableStart + pos + 1;
342
- return new require_dist.SelectionRange(doc.resolve(from), doc.resolve(from + cell.content.size));
343
- });
344
- super(ranges[0].$from, ranges[0].$to, ranges);
345
- this.$anchorCell = $anchorCell;
346
- this.$headCell = $headCell;
347
- }
348
- map(doc, mapping) {
349
- const $anchorCell = doc.resolve(mapping.map(this.$anchorCell.pos));
350
- const $headCell = doc.resolve(mapping.map(this.$headCell.pos));
351
- if (pointsAtCell($anchorCell) && pointsAtCell($headCell) && inSameTable($anchorCell, $headCell)) {
352
- const tableChanged = this.$anchorCell.node(-1) != $anchorCell.node(-1);
353
- if (tableChanged && this.isRowSelection()) return CellSelection.rowSelection($anchorCell, $headCell);
354
- else if (tableChanged && this.isColSelection()) return CellSelection.colSelection($anchorCell, $headCell);
355
- else return new CellSelection($anchorCell, $headCell);
356
- }
357
- return require_dist.TextSelection.between($anchorCell, $headCell);
358
- }
359
- content() {
360
- const table = this.$anchorCell.node(-1);
361
- const map = TableMap.get(table);
362
- const tableStart = this.$anchorCell.start(-1);
363
- const rect = map.rectBetween(this.$anchorCell.pos - tableStart, this.$headCell.pos - tableStart);
364
- const seen = {};
365
- const rows = [];
366
- for (let row = rect.top; row < rect.bottom; row++) {
367
- const rowContent = [];
368
- for (let index = row * map.width + rect.left, col = rect.left; col < rect.right; col++, index++) {
369
- const pos = map.map[index];
370
- if (seen[pos]) continue;
371
- seen[pos] = true;
372
- const cellRect = map.findCell(pos);
373
- let cell = table.nodeAt(pos);
374
- if (!cell) throw new RangeError(`No cell with offset ${pos} found`);
375
- const extraLeft = rect.left - cellRect.left;
376
- const extraRight = cellRect.right - rect.right;
377
- if (extraLeft > 0 || extraRight > 0) {
378
- let attrs = cell.attrs;
379
- if (extraLeft > 0) attrs = removeColSpan(attrs, 0, extraLeft);
380
- if (extraRight > 0) attrs = removeColSpan(attrs, attrs.colspan - extraRight, extraRight);
381
- if (cellRect.left < rect.left) {
382
- cell = cell.type.createAndFill(attrs);
383
- if (!cell) throw new RangeError(`Could not create cell with attrs ${JSON.stringify(attrs)}`);
384
- } else cell = cell.type.create(attrs, cell.content);
385
- }
386
- if (cellRect.top < rect.top || cellRect.bottom > rect.bottom) {
387
- const attrs = {
388
- ...cell.attrs,
389
- rowspan: Math.min(cellRect.bottom, rect.bottom) - Math.max(cellRect.top, rect.top)
390
- };
391
- if (cellRect.top < rect.top) cell = cell.type.createAndFill(attrs);
392
- else cell = cell.type.create(attrs, cell.content);
393
- }
394
- rowContent.push(cell);
395
- }
396
- rows.push(table.child(row).copy(require_dist.Fragment.from(rowContent)));
397
- }
398
- const fragment = this.isColSelection() && this.isRowSelection() ? table : rows;
399
- return new require_dist.Slice(require_dist.Fragment.from(fragment), 1, 1);
400
- }
401
- replace(tr, content = require_dist.Slice.empty) {
402
- const mapFrom = tr.steps.length, ranges = this.ranges;
403
- for (let i = 0; i < ranges.length; i++) {
404
- const { $from, $to } = ranges[i], mapping = tr.mapping.slice(mapFrom);
405
- tr.replace(mapping.map($from.pos), mapping.map($to.pos), i ? require_dist.Slice.empty : content);
406
- }
407
- const sel = require_dist.Selection.findFrom(tr.doc.resolve(tr.mapping.slice(mapFrom).map(this.to)), -1);
408
- if (sel) tr.setSelection(sel);
409
- }
410
- replaceWith(tr, node) {
411
- this.replace(tr, new require_dist.Slice(require_dist.Fragment.from(node), 0, 0));
412
- }
413
- forEachCell(f) {
414
- const table = this.$anchorCell.node(-1);
415
- const map = TableMap.get(table);
416
- const tableStart = this.$anchorCell.start(-1);
417
- const cells = map.cellsInRect(map.rectBetween(this.$anchorCell.pos - tableStart, this.$headCell.pos - tableStart));
418
- for (let i = 0; i < cells.length; i++) f(table.nodeAt(cells[i]), tableStart + cells[i]);
419
- }
420
- isColSelection() {
421
- const anchorTop = this.$anchorCell.index(-1);
422
- const headTop = this.$headCell.index(-1);
423
- if (Math.min(anchorTop, headTop) > 0) return false;
424
- const anchorBottom = anchorTop + this.$anchorCell.nodeAfter.attrs.rowspan;
425
- const headBottom = headTop + this.$headCell.nodeAfter.attrs.rowspan;
426
- return Math.max(anchorBottom, headBottom) == this.$headCell.node(-1).childCount;
427
- }
428
- static colSelection($anchorCell, $headCell = $anchorCell) {
429
- const table = $anchorCell.node(-1);
430
- const map = TableMap.get(table);
431
- const tableStart = $anchorCell.start(-1);
432
- const anchorRect = map.findCell($anchorCell.pos - tableStart);
433
- const headRect = map.findCell($headCell.pos - tableStart);
434
- const doc = $anchorCell.node(0);
435
- if (anchorRect.top <= headRect.top) {
436
- if (anchorRect.top > 0) $anchorCell = doc.resolve(tableStart + map.map[anchorRect.left]);
437
- if (headRect.bottom < map.height) $headCell = doc.resolve(tableStart + map.map[map.width * (map.height - 1) + headRect.right - 1]);
438
- } else {
439
- if (headRect.top > 0) $headCell = doc.resolve(tableStart + map.map[headRect.left]);
440
- if (anchorRect.bottom < map.height) $anchorCell = doc.resolve(tableStart + map.map[map.width * (map.height - 1) + anchorRect.right - 1]);
441
- }
442
- return new CellSelection($anchorCell, $headCell);
443
- }
444
- isRowSelection() {
445
- const table = this.$anchorCell.node(-1);
446
- const map = TableMap.get(table);
447
- const tableStart = this.$anchorCell.start(-1);
448
- const anchorLeft = map.colCount(this.$anchorCell.pos - tableStart);
449
- const headLeft = map.colCount(this.$headCell.pos - tableStart);
450
- if (Math.min(anchorLeft, headLeft) > 0) return false;
451
- const anchorRight = anchorLeft + this.$anchorCell.nodeAfter.attrs.colspan;
452
- const headRight = headLeft + this.$headCell.nodeAfter.attrs.colspan;
453
- return Math.max(anchorRight, headRight) == map.width;
454
- }
455
- eq(other) {
456
- return other instanceof CellSelection && other.$anchorCell.pos == this.$anchorCell.pos && other.$headCell.pos == this.$headCell.pos;
457
- }
458
- static rowSelection($anchorCell, $headCell = $anchorCell) {
459
- const table = $anchorCell.node(-1);
460
- const map = TableMap.get(table);
461
- const tableStart = $anchorCell.start(-1);
462
- const anchorRect = map.findCell($anchorCell.pos - tableStart);
463
- const headRect = map.findCell($headCell.pos - tableStart);
464
- const doc = $anchorCell.node(0);
465
- if (anchorRect.left <= headRect.left) {
466
- if (anchorRect.left > 0) $anchorCell = doc.resolve(tableStart + map.map[anchorRect.top * map.width]);
467
- if (headRect.right < map.width) $headCell = doc.resolve(tableStart + map.map[map.width * (headRect.top + 1) - 1]);
468
- } else {
469
- if (headRect.left > 0) $headCell = doc.resolve(tableStart + map.map[headRect.top * map.width]);
470
- if (anchorRect.right < map.width) $anchorCell = doc.resolve(tableStart + map.map[map.width * (anchorRect.top + 1) - 1]);
471
- }
472
- return new CellSelection($anchorCell, $headCell);
473
- }
474
- toJSON() {
475
- return {
476
- type: "cell",
477
- anchor: this.$anchorCell.pos,
478
- head: this.$headCell.pos
479
- };
480
- }
481
- static fromJSON(doc, json) {
482
- return new CellSelection(doc.resolve(json.anchor), doc.resolve(json.head));
483
- }
484
- static create(doc, anchorCell, headCell = anchorCell) {
485
- return new CellSelection(doc.resolve(anchorCell), doc.resolve(headCell));
486
- }
487
- getBookmark() {
488
- return new CellBookmark(this.$anchorCell.pos, this.$headCell.pos);
489
- }
490
- };
491
- CellSelection.prototype.visible = false;
492
- require_dist.Selection.jsonID("cell", CellSelection);
493
- /**
494
- * @public
495
- */
496
- var CellBookmark = class CellBookmark {
497
- constructor(anchor, head) {
498
- this.anchor = anchor;
499
- this.head = head;
500
- }
501
- map(mapping) {
502
- return new CellBookmark(mapping.map(this.anchor), mapping.map(this.head));
503
- }
504
- resolve(doc) {
505
- const $anchorCell = doc.resolve(this.anchor), $headCell = doc.resolve(this.head);
506
- if ($anchorCell.parent.type.spec.tableRole == "row" && $headCell.parent.type.spec.tableRole == "row" && $anchorCell.index() < $anchorCell.parent.childCount && $headCell.index() < $headCell.parent.childCount && inSameTable($anchorCell, $headCell)) return new CellSelection($anchorCell, $headCell);
507
- else return require_dist.Selection.near($headCell, 1);
508
- }
509
- };
510
- new require_dist.PluginKey("fix-tables");
511
- /**
512
- * Helper to get the selected rectangle in a table, if any. Adds table
513
- * map, table node, and table start offset to the object for
514
- * convenience.
515
- *
516
- * @public
517
- */
518
- function selectedRect(state) {
519
- const sel = state.selection;
520
- const $pos = selectionCell(state);
521
- const table = $pos.node(-1);
522
- const tableStart = $pos.start(-1);
523
- const map = TableMap.get(table);
524
- return {
525
- ...sel instanceof CellSelection ? map.rectBetween(sel.$anchorCell.pos - tableStart, sel.$headCell.pos - tableStart) : map.findCell($pos.pos - tableStart),
526
- tableStart,
527
- map,
528
- table
529
- };
530
- }
531
- function deprecated_toggleHeader(type) {
532
- return function(state, dispatch) {
533
- if (!isInTable(state)) return false;
534
- if (dispatch) {
535
- const types = tableNodeTypes(state.schema);
536
- const rect = selectedRect(state), tr = state.tr;
537
- const cells = rect.map.cellsInRect(type == "column" ? {
538
- left: rect.left,
539
- top: 0,
540
- right: rect.right,
541
- bottom: rect.map.height
542
- } : type == "row" ? {
543
- left: 0,
544
- top: rect.top,
545
- right: rect.map.width,
546
- bottom: rect.bottom
547
- } : rect);
548
- const nodes = cells.map((pos) => rect.table.nodeAt(pos));
549
- for (let i = 0; i < cells.length; i++) if (nodes[i].type == types.header_cell) tr.setNodeMarkup(rect.tableStart + cells[i], types.cell, nodes[i].attrs);
550
- if (tr.steps.length === 0) for (let i = 0; i < cells.length; i++) tr.setNodeMarkup(rect.tableStart + cells[i], types.header_cell, nodes[i].attrs);
551
- dispatch(tr);
552
- }
553
- return true;
554
- };
555
- }
556
- function isHeaderEnabledByType(type, rect, types) {
557
- const cellPositions = rect.map.cellsInRect({
558
- left: 0,
559
- top: 0,
560
- right: type == "row" ? rect.map.width : 1,
561
- bottom: type == "column" ? rect.map.height : 1
562
- });
563
- for (let i = 0; i < cellPositions.length; i++) {
564
- const cell = rect.table.nodeAt(cellPositions[i]);
565
- if (cell && cell.type !== types.header_cell) return false;
566
- }
567
- return true;
568
- }
569
- /**
570
- * Toggles between row/column header and normal cells (Only applies to first row/column).
571
- * For deprecated behavior pass `useDeprecatedLogic` in options with true.
572
- *
573
- * @public
574
- */
575
- function toggleHeader(type, options) {
576
- options = options || { useDeprecatedLogic: false };
577
- if (options.useDeprecatedLogic) return deprecated_toggleHeader(type);
578
- return function(state, dispatch) {
579
- if (!isInTable(state)) return false;
580
- if (dispatch) {
581
- const types = tableNodeTypes(state.schema);
582
- const rect = selectedRect(state), tr = state.tr;
583
- const isHeaderRowEnabled = isHeaderEnabledByType("row", rect, types);
584
- const isHeaderColumnEnabled = isHeaderEnabledByType("column", rect, types);
585
- const selectionStartsAt = (type === "column" ? isHeaderRowEnabled : type === "row" ? isHeaderColumnEnabled : false) ? 1 : 0;
586
- const cellsRect = type == "column" ? {
587
- left: 0,
588
- top: selectionStartsAt,
589
- right: 1,
590
- bottom: rect.map.height
591
- } : type == "row" ? {
592
- left: selectionStartsAt,
593
- top: 0,
594
- right: rect.map.width,
595
- bottom: 1
596
- } : rect;
597
- const newType = type == "column" ? isHeaderColumnEnabled ? types.cell : types.header_cell : type == "row" ? isHeaderRowEnabled ? types.cell : types.header_cell : types.cell;
598
- rect.map.cellsInRect(cellsRect).forEach((relativeCellPos) => {
599
- const cellPos = relativeCellPos + rect.tableStart;
600
- const cell = tr.doc.nodeAt(cellPos);
601
- if (cell) tr.setNodeMarkup(cellPos, newType, cell.attrs);
602
- });
603
- dispatch(tr);
604
- }
605
- return true;
606
- };
607
- }
608
- toggleHeader("row", { useDeprecatedLogic: true });
609
- toggleHeader("column", { useDeprecatedLogic: true });
610
- toggleHeader("cell", { useDeprecatedLogic: true });
611
- /**
612
- * Deletes the content of the selected cells, if they are not empty.
613
- *
614
- * @public
615
- */
616
- function deleteCellSelection(state, dispatch) {
617
- const sel = state.selection;
618
- if (!(sel instanceof CellSelection)) return false;
619
- if (dispatch) {
620
- const tr = state.tr;
621
- const baseContent = tableNodeTypes(state.schema).cell.createAndFill().content;
622
- sel.forEachCell((cell, pos) => {
623
- if (!cell.content.eq(baseContent)) tr.replace(tr.mapping.map(pos + 1), tr.mapping.map(pos + cell.nodeSize - 1), new require_dist.Slice(baseContent, 0, 0));
624
- });
625
- if (tr.docChanged) dispatch(tr);
626
- }
627
- return true;
628
- }
629
- require_dist.keydownHandler({
630
- ArrowLeft: arrow("horiz", -1),
631
- ArrowRight: arrow("horiz", 1),
632
- ArrowUp: arrow("vert", -1),
633
- ArrowDown: arrow("vert", 1),
634
- "Shift-ArrowLeft": shiftArrow("horiz", -1),
635
- "Shift-ArrowRight": shiftArrow("horiz", 1),
636
- "Shift-ArrowUp": shiftArrow("vert", -1),
637
- "Shift-ArrowDown": shiftArrow("vert", 1),
638
- Backspace: deleteCellSelection,
639
- "Mod-Backspace": deleteCellSelection,
640
- Delete: deleteCellSelection,
641
- "Mod-Delete": deleteCellSelection
642
- });
643
- function maybeSetSelection(state, dispatch, selection) {
644
- if (selection.eq(state.selection)) return false;
645
- if (dispatch) dispatch(state.tr.setSelection(selection).scrollIntoView());
646
- return true;
647
- }
648
- /**
649
- * @internal
650
- */
651
- function arrow(axis, dir) {
652
- return (state, dispatch, view) => {
653
- if (!view) return false;
654
- const sel = state.selection;
655
- if (sel instanceof CellSelection) return maybeSetSelection(state, dispatch, require_dist.Selection.near(sel.$headCell, dir));
656
- if (axis != "horiz" && !sel.empty) return false;
657
- const end = atEndOfCell(view, axis, dir);
658
- if (end == null) return false;
659
- if (axis == "horiz") return maybeSetSelection(state, dispatch, require_dist.Selection.near(state.doc.resolve(sel.head + dir), dir));
660
- else {
661
- const $cell = state.doc.resolve(end);
662
- const $next = nextCell($cell, axis, dir);
663
- let newSel;
664
- if ($next) newSel = require_dist.Selection.near($next, 1);
665
- else if (dir < 0) newSel = require_dist.Selection.near(state.doc.resolve($cell.before(-1)), -1);
666
- else newSel = require_dist.Selection.near(state.doc.resolve($cell.after(-1)), 1);
667
- return maybeSetSelection(state, dispatch, newSel);
668
- }
669
- };
670
- }
671
- function shiftArrow(axis, dir) {
672
- return (state, dispatch, view) => {
673
- if (!view) return false;
674
- const sel = state.selection;
675
- let cellSel;
676
- if (sel instanceof CellSelection) cellSel = sel;
677
- else {
678
- const end = atEndOfCell(view, axis, dir);
679
- if (end == null) return false;
680
- cellSel = new CellSelection(state.doc.resolve(end));
681
- }
682
- const $head = nextCell(cellSel.$headCell, axis, dir);
683
- if (!$head) return false;
684
- return maybeSetSelection(state, dispatch, new CellSelection(cellSel.$anchorCell, $head));
685
- };
686
- }
687
- function atEndOfCell(view, axis, dir) {
688
- if (!(view.state.selection instanceof require_dist.TextSelection)) return null;
689
- const { $head } = view.state.selection;
690
- for (let d = $head.depth - 1; d >= 0; d--) {
691
- const parent = $head.node(d);
692
- if ((dir < 0 ? $head.index(d) : $head.indexAfter(d)) != (dir < 0 ? 0 : parent.childCount)) return null;
693
- if (parent.type.spec.tableRole == "cell" || parent.type.spec.tableRole == "header_cell") {
694
- const cellPos = $head.before(d);
695
- const dirStr = axis == "vert" ? dir > 0 ? "down" : "up" : dir > 0 ? "right" : "left";
696
- return view.endOfTextblock(dirStr) ? cellPos : null;
697
- }
698
- }
699
- return null;
700
- }
701
- new require_dist.PluginKey("tableColumnResizing");
702
- //#endregion
703
- //#region ../../node_modules/.pnpm/@tiptap+vue-3@3.29.2_@floating-ui+dom@1.8.0_@tiptap+core@3.29.2_@tiptap+pm@3.29.2__@tip_82ae703f9716de2fe82106636b634245/node_modules/@tiptap/vue-3/dist/menus/index.js
704
- function combineDOMRects(rect1, rect2) {
705
- const top = Math.min(rect1.top, rect2.top);
706
- const bottom = Math.max(rect1.bottom, rect2.bottom);
707
- const left = Math.min(rect1.left, rect2.left);
708
- const width = Math.max(rect1.right, rect2.right) - left;
709
- const height = bottom - top;
710
- return new DOMRect(left, top, width, height);
711
- }
712
- var BubbleMenuView = class {
713
- constructor({ editor, element, view, pluginKey = "bubbleMenu", updateDelay = 250, resizeDelay = 60, shouldShow, appendTo, getReferencedVirtualElement, options }) {
714
- this.preventHide = false;
715
- this.isVisible = false;
716
- this.scrollTarget = window;
717
- this.floatingUIOptions = {
718
- strategy: "absolute",
719
- placement: "top",
720
- offset: 8,
721
- flip: {},
722
- shift: {},
723
- arrow: false,
724
- size: false,
725
- autoPlacement: false,
726
- hide: false,
727
- inline: false,
728
- onShow: void 0,
729
- onHide: void 0,
730
- onUpdate: void 0,
731
- onDestroy: void 0
732
- };
733
- this.shouldShow = ({ view, state, from, to }) => {
734
- const { doc, selection } = state;
735
- const { empty } = selection;
736
- const isEmptyTextBlock = !doc.textBetween(from, to).length && require_dist.isTextSelection(state.selection);
737
- const isChildOfMenu = this.element.contains(document.activeElement);
738
- if (!(view.hasFocus() || isChildOfMenu) || empty || isEmptyTextBlock || !this.editor.isEditable) return false;
739
- return true;
740
- };
741
- this.mousedownHandler = () => {
742
- this.preventHide = true;
743
- };
744
- this.dragstartHandler = () => {
745
- this.hide();
746
- };
747
- /**
748
- * Handles the window resize event to update the position of the bubble menu.
749
- * It uses a debounce mechanism to prevent excessive updates.
750
- * The delay is defined by the `resizeDelay` property.
751
- */
752
- this.resizeHandler = () => {
753
- if (this.resizeDebounceTimer) clearTimeout(this.resizeDebounceTimer);
754
- this.resizeDebounceTimer = window.setTimeout(() => {
755
- this.updatePosition();
756
- }, this.resizeDelay);
757
- };
758
- this.focusHandler = () => {
759
- setTimeout(() => this.update(this.editor.view));
760
- };
761
- this.blurHandler = ({ event }) => {
762
- var _a;
763
- if (this.editor.isDestroyed) {
764
- this.destroy();
765
- return;
766
- }
767
- if (this.preventHide) {
768
- this.preventHide = false;
769
- return;
770
- }
771
- if ((event == null ? void 0 : event.relatedTarget) && ((_a = this.element.parentNode) == null ? void 0 : _a.contains(event.relatedTarget))) return;
772
- if ((event == null ? void 0 : event.relatedTarget) === this.editor.view.dom) return;
773
- this.hide();
774
- };
775
- this.handleDebouncedUpdate = (view, oldState) => {
776
- const selectionChanged = !(oldState == null ? void 0 : oldState.selection.eq(view.state.selection));
777
- const docChanged = !(oldState == null ? void 0 : oldState.doc.eq(view.state.doc));
778
- if (!selectionChanged && !docChanged) return;
779
- if (this.updateDebounceTimer) clearTimeout(this.updateDebounceTimer);
780
- this.updateDebounceTimer = window.setTimeout(() => {
781
- this.updateHandler(view, selectionChanged, docChanged, oldState);
782
- }, this.updateDelay);
783
- };
784
- this.updateHandler = (view, selectionChanged, docChanged, oldState) => {
785
- const { composing } = view;
786
- if (composing || !selectionChanged && !docChanged) return;
787
- if (!this.getShouldShow(oldState)) {
788
- this.hide();
789
- return;
790
- }
791
- this.show();
792
- this.updatePosition();
793
- };
794
- /**
795
- * Handles the transaction event to update the position of the bubble menu.
796
- * This allows external code to trigger a position update via:
797
- * `editor.view.dispatch(editor.state.tr.setMeta(pluginKey, 'updatePosition'))`
798
- * The `pluginKey` defaults to `bubbleMenu`
799
- */
800
- this.transactionHandler = ({ transaction: tr }) => {
801
- const meta = tr.getMeta(this.pluginKey);
802
- if (meta === "updatePosition") this.updatePosition();
803
- else if (meta && typeof meta === "object" && meta.type === "updateOptions") this.updateOptions(meta.options);
804
- else if (meta === "hide") this.hide();
805
- else if (meta === "show") {
806
- this.updatePosition();
807
- this.show();
808
- }
809
- };
810
- var _a;
811
- this.editor = editor;
812
- this.element = element;
813
- this.view = view;
814
- this.pluginKey = pluginKey;
815
- this.updateDelay = updateDelay;
816
- this.resizeDelay = resizeDelay;
817
- this.appendTo = appendTo;
818
- this.scrollTarget = (_a = options == null ? void 0 : options.scrollTarget) != null ? _a : window;
819
- this.getReferencedVirtualElement = getReferencedVirtualElement;
820
- this.floatingUIOptions = {
821
- ...this.floatingUIOptions,
822
- ...options
823
- };
824
- this.element.tabIndex = 0;
825
- if (shouldShow) this.shouldShow = shouldShow;
826
- this.element.addEventListener("mousedown", this.mousedownHandler, { capture: true });
827
- this.view.dom.addEventListener("dragstart", this.dragstartHandler);
828
- this.editor.on("focus", this.focusHandler);
829
- this.editor.on("blur", this.blurHandler);
830
- this.editor.on("transaction", this.transactionHandler);
831
- window.addEventListener("resize", this.resizeHandler);
832
- this.scrollTarget.addEventListener("scroll", this.resizeHandler);
833
- this.update(view, view.state);
834
- if (this.getShouldShow()) {
835
- this.show();
836
- this.updatePosition();
837
- }
838
- }
839
- get middlewares() {
840
- const middlewares = [];
841
- if (this.floatingUIOptions.flip) middlewares.push(require_PopperContent.flip(typeof this.floatingUIOptions.flip !== "boolean" ? this.floatingUIOptions.flip : void 0));
842
- if (this.floatingUIOptions.shift) middlewares.push(require_PopperContent.shift(typeof this.floatingUIOptions.shift !== "boolean" ? this.floatingUIOptions.shift : void 0));
843
- if (this.floatingUIOptions.offset) middlewares.push(require_PopperContent.offset(typeof this.floatingUIOptions.offset !== "boolean" ? this.floatingUIOptions.offset : void 0));
844
- if (this.floatingUIOptions.arrow) middlewares.push(require_PopperContent.arrow(this.floatingUIOptions.arrow));
845
- if (this.floatingUIOptions.size) middlewares.push(require_PopperContent.size(typeof this.floatingUIOptions.size !== "boolean" ? this.floatingUIOptions.size : void 0));
846
- if (this.floatingUIOptions.autoPlacement) middlewares.push(require_PopperContent.autoPlacement(typeof this.floatingUIOptions.autoPlacement !== "boolean" ? this.floatingUIOptions.autoPlacement : void 0));
847
- if (this.floatingUIOptions.hide) middlewares.push(require_PopperContent.hide(typeof this.floatingUIOptions.hide !== "boolean" ? this.floatingUIOptions.hide : void 0));
848
- if (this.floatingUIOptions.inline) middlewares.push(require_PopperContent.inline(typeof this.floatingUIOptions.inline !== "boolean" ? this.floatingUIOptions.inline : void 0));
849
- return middlewares;
850
- }
851
- get virtualElement() {
852
- var _a, _b, _c;
853
- const { selection } = this.editor.state;
854
- const referencedVirtualElement = (_a = this.getReferencedVirtualElement) == null ? void 0 : _a.call(this);
855
- if (referencedVirtualElement) return referencedVirtualElement;
856
- if (!((_c = (_b = this.view) == null ? void 0 : _b.dom) == null ? void 0 : _c.parentNode)) return;
857
- const domRect = require_dist.posToDOMRect(this.view, selection.from, selection.to);
858
- let virtualElement = {
859
- getBoundingClientRect: () => domRect,
860
- getClientRects: () => [domRect]
861
- };
862
- if (selection instanceof require_dist.NodeSelection) {
863
- let node = this.view.nodeDOM(selection.from);
864
- const nodeViewWrapper = node.dataset.nodeViewWrapper ? node : node.querySelector("[data-node-view-wrapper]");
865
- if (nodeViewWrapper) node = nodeViewWrapper;
866
- if (node) virtualElement = {
867
- getBoundingClientRect: () => node.getBoundingClientRect(),
868
- getClientRects: () => [node.getBoundingClientRect()]
869
- };
870
- }
871
- if (selection instanceof CellSelection) {
872
- const { $anchorCell, $headCell } = selection;
873
- const from = $anchorCell ? $anchorCell.pos : $headCell.pos;
874
- const to = $headCell ? $headCell.pos : $anchorCell.pos;
875
- const fromDOM = this.view.nodeDOM(from);
876
- const toDOM = this.view.nodeDOM(to);
877
- if (!fromDOM || !toDOM) return;
878
- const clientRect = fromDOM === toDOM ? fromDOM.getBoundingClientRect() : combineDOMRects(fromDOM.getBoundingClientRect(), toDOM.getBoundingClientRect());
879
- virtualElement = {
880
- getBoundingClientRect: () => clientRect,
881
- getClientRects: () => [clientRect]
882
- };
883
- }
884
- return virtualElement;
885
- }
886
- updatePosition() {
887
- if (!this.isVisible) return;
888
- const virtualElement = this.virtualElement;
889
- if (!virtualElement) return;
890
- require_PopperContent.computePosition(virtualElement, this.element, {
891
- placement: this.floatingUIOptions.placement,
892
- strategy: this.floatingUIOptions.strategy,
893
- middleware: this.middlewares
894
- }).then(({ x, y, strategy, middlewareData }) => {
895
- var _a, _b;
896
- if (!this.isVisible || this.editor.isDestroyed || !this.element.isConnected) return;
897
- if (((_a = middlewareData.hide) == null ? void 0 : _a.referenceHidden) || ((_b = middlewareData.hide) == null ? void 0 : _b.escaped)) {
898
- this.element.style.visibility = "hidden";
899
- return;
900
- }
901
- this.element.style.visibility = "visible";
902
- this.element.style.width = "max-content";
903
- this.element.style.position = strategy;
904
- this.element.style.left = `${x}px`;
905
- this.element.style.top = `${y}px`;
906
- if (this.isVisible && this.floatingUIOptions.onUpdate) this.floatingUIOptions.onUpdate();
907
- });
908
- }
909
- update(view, oldState) {
910
- const { state } = view;
911
- const hasValidSelection = state.selection.from !== state.selection.to;
912
- if (this.updateDelay > 0 && hasValidSelection) {
913
- this.handleDebouncedUpdate(view, oldState);
914
- return;
915
- }
916
- const selectionChanged = !(oldState == null ? void 0 : oldState.selection.eq(view.state.selection));
917
- const docChanged = !(oldState == null ? void 0 : oldState.doc.eq(view.state.doc));
918
- this.updateHandler(view, selectionChanged, docChanged, oldState);
919
- }
920
- getShouldShow(oldState) {
921
- var _a;
922
- const { state } = this.view;
923
- const { selection } = state;
924
- const { ranges } = selection;
925
- const from = Math.min(...ranges.map((range) => range.$from.pos));
926
- const to = Math.max(...ranges.map((range) => range.$to.pos));
927
- return ((_a = this.shouldShow) == null ? void 0 : _a.call(this, {
928
- editor: this.editor,
929
- element: this.element,
930
- view: this.view,
931
- state,
932
- oldState,
933
- from,
934
- to
935
- })) || false;
936
- }
937
- show() {
938
- var _a;
939
- if (this.isVisible) return;
940
- this.element.style.visibility = "visible";
941
- this.element.style.opacity = "1";
942
- const appendToElement = typeof this.appendTo === "function" ? this.appendTo() : this.appendTo;
943
- (_a = appendToElement != null ? appendToElement : this.view.dom.parentElement) == null || _a.appendChild(this.element);
944
- if (this.floatingUIOptions.onShow) this.floatingUIOptions.onShow();
945
- this.isVisible = true;
946
- }
947
- hide() {
948
- if (!this.isVisible) return;
949
- this.element.style.visibility = "hidden";
950
- this.element.style.opacity = "0";
951
- this.element.remove();
952
- if (this.floatingUIOptions.onHide) this.floatingUIOptions.onHide();
953
- this.isVisible = false;
954
- }
955
- updateOptions(newProps) {
956
- var _a;
957
- if (newProps.updateDelay !== void 0) this.updateDelay = newProps.updateDelay;
958
- if (newProps.resizeDelay !== void 0) this.resizeDelay = newProps.resizeDelay;
959
- if (newProps.appendTo !== void 0) this.appendTo = newProps.appendTo;
960
- if (newProps.getReferencedVirtualElement !== void 0) this.getReferencedVirtualElement = newProps.getReferencedVirtualElement;
961
- if (newProps.shouldShow !== void 0) {
962
- if (newProps.shouldShow) this.shouldShow = newProps.shouldShow;
963
- }
964
- if (newProps.options !== void 0) {
965
- const newScrollTarget = (_a = newProps.options.scrollTarget) != null ? _a : window;
966
- if (newScrollTarget !== this.scrollTarget) {
967
- this.scrollTarget.removeEventListener("scroll", this.resizeHandler);
968
- this.scrollTarget = newScrollTarget;
969
- this.scrollTarget.addEventListener("scroll", this.resizeHandler);
970
- }
971
- this.floatingUIOptions = {
972
- ...this.floatingUIOptions,
973
- ...newProps.options
974
- };
975
- }
976
- }
977
- destroy() {
978
- this.hide();
979
- this.element.removeEventListener("mousedown", this.mousedownHandler, { capture: true });
980
- this.view.dom.removeEventListener("dragstart", this.dragstartHandler);
981
- window.removeEventListener("resize", this.resizeHandler);
982
- this.scrollTarget.removeEventListener("scroll", this.resizeHandler);
983
- this.editor.off("focus", this.focusHandler);
984
- this.editor.off("blur", this.blurHandler);
985
- this.editor.off("transaction", this.transactionHandler);
986
- if (this.floatingUIOptions.onDestroy) this.floatingUIOptions.onDestroy();
987
- }
988
- };
989
- var BubbleMenuPlugin = (options) => {
990
- return new require_dist.Plugin({
991
- key: typeof options.pluginKey === "string" ? new require_dist.PluginKey(options.pluginKey) : options.pluginKey,
992
- view: (view) => new BubbleMenuView({
993
- view,
994
- ...options
995
- })
996
- });
997
- };
998
- var BubbleMenu = (0, vue.defineComponent)({
999
- name: "BubbleMenu",
1000
- inheritAttrs: false,
1001
- props: {
1002
- pluginKey: {
1003
- type: [String, Object],
1004
- default: void 0
1005
- },
1006
- editor: {
1007
- type: Object,
1008
- required: true
1009
- },
1010
- updateDelay: {
1011
- type: Number,
1012
- default: void 0
1013
- },
1014
- resizeDelay: {
1015
- type: Number,
1016
- default: void 0
1017
- },
1018
- options: {
1019
- type: Object,
1020
- default: () => ({})
1021
- },
1022
- appendTo: {
1023
- type: [Object, Function],
1024
- default: void 0
1025
- },
1026
- shouldShow: {
1027
- type: Function,
1028
- default: null
1029
- },
1030
- getReferencedVirtualElement: {
1031
- type: Function,
1032
- default: void 0
1033
- }
1034
- },
1035
- setup(props, { slots, attrs }) {
1036
- var _a;
1037
- const root = (0, vue.ref)(null);
1038
- const resolvedPluginKey = (_a = props.pluginKey) != null ? _a : new require_dist.PluginKey("bubbleMenu");
1039
- (0, vue.onMounted)(() => {
1040
- const { editor, options, resizeDelay, appendTo, shouldShow, getReferencedVirtualElement, updateDelay } = props;
1041
- const el = root.value;
1042
- if (!el) return;
1043
- el.style.visibility = "hidden";
1044
- el.style.position = "absolute";
1045
- el.remove();
1046
- (0, vue.nextTick)(() => {
1047
- editor.registerPlugin(BubbleMenuPlugin({
1048
- editor,
1049
- element: el,
1050
- options,
1051
- pluginKey: resolvedPluginKey,
1052
- resizeDelay,
1053
- appendTo,
1054
- shouldShow,
1055
- getReferencedVirtualElement,
1056
- updateDelay
1057
- }));
1058
- });
1059
- });
1060
- (0, vue.onBeforeUnmount)(() => {
1061
- const { editor } = props;
1062
- editor.unregisterPlugin(resolvedPluginKey);
1063
- });
1064
- return () => {
1065
- var _a2;
1066
- return (0, vue.h)("div", {
1067
- ref: root,
1068
- ...attrs
1069
- }, (_a2 = slots.default) == null ? void 0 : _a2.call(slots));
1070
- };
1071
- }
1072
- });
1073
- var FloatingMenuView = class {
1074
- constructor({ editor, element, view, pluginKey = "floatingMenu", updateDelay = 250, resizeDelay = 60, options, appendTo, shouldShow }) {
1075
- this.preventHide = false;
1076
- this.isVisible = false;
1077
- this.scrollTarget = window;
1078
- this.shouldShow = ({ view, state }) => {
1079
- const { selection } = state;
1080
- const { $anchor, empty } = selection;
1081
- const isRootDepth = $anchor.depth === 1;
1082
- const isEmptyTextBlock = $anchor.parent.isTextblock && !$anchor.parent.type.spec.code && !$anchor.parent.textContent && $anchor.parent.childCount === 0 && !this.getTextContent($anchor.parent);
1083
- if (!view.hasFocus() || !empty || !isRootDepth || !isEmptyTextBlock || !this.editor.isEditable) return false;
1084
- return true;
1085
- };
1086
- this.floatingUIOptions = {
1087
- strategy: "absolute",
1088
- placement: "right",
1089
- offset: 8,
1090
- flip: {},
1091
- shift: {},
1092
- arrow: false,
1093
- size: false,
1094
- autoPlacement: false,
1095
- hide: false,
1096
- inline: false
1097
- };
1098
- this.updateHandler = (view, selectionChanged, docChanged, oldState) => {
1099
- const { composing } = view;
1100
- if (composing || !selectionChanged && !docChanged) return;
1101
- if (!this.getShouldShow(oldState)) {
1102
- this.hide();
1103
- return;
1104
- }
1105
- this.updatePosition();
1106
- this.show();
1107
- };
1108
- this.mousedownHandler = () => {
1109
- this.preventHide = true;
1110
- };
1111
- this.focusHandler = () => {
1112
- setTimeout(() => this.update(this.editor.view));
1113
- };
1114
- this.blurHandler = ({ event }) => {
1115
- var _a;
1116
- if (this.preventHide) {
1117
- this.preventHide = false;
1118
- return;
1119
- }
1120
- if ((event == null ? void 0 : event.relatedTarget) && ((_a = this.element.parentNode) == null ? void 0 : _a.contains(event.relatedTarget))) return;
1121
- if ((event == null ? void 0 : event.relatedTarget) === this.editor.view.dom) return;
1122
- this.hide();
1123
- };
1124
- /**
1125
- * Handles the transaction event to update the position of the floating menu.
1126
- * This allows external code to trigger a position update via:
1127
- * `editor.view.dispatch(editor.state.tr.setMeta(pluginKey, 'updatePosition'))`
1128
- * The `pluginKey` defaults to `floatingMenu`
1129
- */
1130
- this.transactionHandler = ({ transaction: tr }) => {
1131
- const meta = tr.getMeta(this.pluginKey);
1132
- if (meta === "updatePosition") this.updatePosition();
1133
- else if (meta && typeof meta === "object" && meta.type === "updateOptions") this.updateOptions(meta.options);
1134
- else if (meta === "hide") this.hide();
1135
- else if (meta === "show") {
1136
- this.updatePosition();
1137
- this.show();
1138
- }
1139
- };
1140
- /**
1141
- * Handles the window resize event to update the position of the floating menu.
1142
- * It uses a debounce mechanism to prevent excessive updates.
1143
- * The delay is defined by the `resizeDelay` property.
1144
- */
1145
- this.resizeHandler = () => {
1146
- if (this.resizeDebounceTimer) clearTimeout(this.resizeDebounceTimer);
1147
- this.resizeDebounceTimer = window.setTimeout(() => {
1148
- this.updatePosition();
1149
- }, this.resizeDelay);
1150
- };
1151
- var _a;
1152
- this.editor = editor;
1153
- this.element = element;
1154
- this.view = view;
1155
- this.pluginKey = pluginKey;
1156
- this.updateDelay = updateDelay;
1157
- this.resizeDelay = resizeDelay;
1158
- this.appendTo = appendTo;
1159
- this.scrollTarget = (_a = options == null ? void 0 : options.scrollTarget) != null ? _a : window;
1160
- this.floatingUIOptions = {
1161
- ...this.floatingUIOptions,
1162
- ...options
1163
- };
1164
- this.element.tabIndex = 0;
1165
- if (shouldShow) this.shouldShow = shouldShow;
1166
- this.element.addEventListener("mousedown", this.mousedownHandler, { capture: true });
1167
- this.editor.on("focus", this.focusHandler);
1168
- this.editor.on("blur", this.blurHandler);
1169
- this.editor.on("transaction", this.transactionHandler);
1170
- window.addEventListener("resize", this.resizeHandler);
1171
- this.scrollTarget.addEventListener("scroll", this.resizeHandler);
1172
- this.update(view, view.state);
1173
- if (this.getShouldShow()) {
1174
- this.show();
1175
- this.updatePosition();
1176
- }
1177
- }
1178
- getTextContent(node) {
1179
- return require_dist.getText(node, { textSerializers: require_dist.getTextSerializersFromSchema(this.editor.schema) });
1180
- }
1181
- get middlewares() {
1182
- const middlewares = [];
1183
- if (this.floatingUIOptions.flip) middlewares.push(require_PopperContent.flip(typeof this.floatingUIOptions.flip !== "boolean" ? this.floatingUIOptions.flip : void 0));
1184
- if (this.floatingUIOptions.shift) middlewares.push(require_PopperContent.shift(typeof this.floatingUIOptions.shift !== "boolean" ? this.floatingUIOptions.shift : void 0));
1185
- if (this.floatingUIOptions.offset) middlewares.push(require_PopperContent.offset(typeof this.floatingUIOptions.offset !== "boolean" ? this.floatingUIOptions.offset : void 0));
1186
- if (this.floatingUIOptions.arrow) middlewares.push(require_PopperContent.arrow(this.floatingUIOptions.arrow));
1187
- if (this.floatingUIOptions.size) middlewares.push(require_PopperContent.size(typeof this.floatingUIOptions.size !== "boolean" ? this.floatingUIOptions.size : void 0));
1188
- if (this.floatingUIOptions.autoPlacement) middlewares.push(require_PopperContent.autoPlacement(typeof this.floatingUIOptions.autoPlacement !== "boolean" ? this.floatingUIOptions.autoPlacement : void 0));
1189
- if (this.floatingUIOptions.hide) middlewares.push(require_PopperContent.hide(typeof this.floatingUIOptions.hide !== "boolean" ? this.floatingUIOptions.hide : void 0));
1190
- if (this.floatingUIOptions.inline) middlewares.push(require_PopperContent.inline(typeof this.floatingUIOptions.inline !== "boolean" ? this.floatingUIOptions.inline : void 0));
1191
- return middlewares;
1192
- }
1193
- getShouldShow(oldState) {
1194
- var _a;
1195
- const { state } = this.view;
1196
- const { selection } = state;
1197
- const { ranges } = selection;
1198
- const from = Math.min(...ranges.map((range) => range.$from.pos));
1199
- const to = Math.max(...ranges.map((range) => range.$to.pos));
1200
- return (_a = this.shouldShow) == null ? void 0 : _a.call(this, {
1201
- editor: this.editor,
1202
- view: this.view,
1203
- state,
1204
- oldState,
1205
- from,
1206
- to
1207
- });
1208
- }
1209
- updateOptions(newProps) {
1210
- var _a;
1211
- if (newProps.updateDelay !== void 0) this.updateDelay = newProps.updateDelay;
1212
- if (newProps.resizeDelay !== void 0) this.resizeDelay = newProps.resizeDelay;
1213
- if (newProps.appendTo !== void 0) this.appendTo = newProps.appendTo;
1214
- if (newProps.shouldShow !== void 0) {
1215
- if (newProps.shouldShow) this.shouldShow = newProps.shouldShow;
1216
- }
1217
- if (newProps.options !== void 0) {
1218
- const newScrollTarget = (_a = newProps.options.scrollTarget) != null ? _a : window;
1219
- if (newScrollTarget !== this.scrollTarget) {
1220
- this.scrollTarget.removeEventListener("scroll", this.resizeHandler);
1221
- this.scrollTarget = newScrollTarget;
1222
- this.scrollTarget.addEventListener("scroll", this.resizeHandler);
1223
- }
1224
- this.floatingUIOptions = {
1225
- ...this.floatingUIOptions,
1226
- ...newProps.options
1227
- };
1228
- }
1229
- }
1230
- updatePosition() {
1231
- var _a, _b;
1232
- if (!((_b = (_a = this.view) == null ? void 0 : _a.dom) == null ? void 0 : _b.parentNode)) return;
1233
- const { selection } = this.editor.state;
1234
- const domRect = require_dist.posToDOMRect(this.view, selection.from, selection.to);
1235
- require_PopperContent.computePosition({
1236
- getBoundingClientRect: () => domRect,
1237
- getClientRects: () => [domRect]
1238
- }, this.element, {
1239
- placement: this.floatingUIOptions.placement,
1240
- strategy: this.floatingUIOptions.strategy,
1241
- middleware: this.middlewares
1242
- }).then(({ x, y, strategy, middlewareData }) => {
1243
- var _a2, _b2;
1244
- if (((_a2 = middlewareData.hide) == null ? void 0 : _a2.referenceHidden) || ((_b2 = middlewareData.hide) == null ? void 0 : _b2.escaped)) {
1245
- this.element.style.visibility = "hidden";
1246
- return;
1247
- }
1248
- this.element.style.visibility = "visible";
1249
- this.element.style.width = "max-content";
1250
- this.element.style.position = strategy;
1251
- this.element.style.left = `${x}px`;
1252
- this.element.style.top = `${y}px`;
1253
- if (this.isVisible && this.floatingUIOptions.onUpdate) this.floatingUIOptions.onUpdate();
1254
- });
1255
- }
1256
- update(view, oldState) {
1257
- const selectionChanged = !(oldState == null ? void 0 : oldState.selection.eq(view.state.selection));
1258
- const docChanged = !(oldState == null ? void 0 : oldState.doc.eq(view.state.doc));
1259
- this.updateHandler(view, selectionChanged, docChanged, oldState);
1260
- }
1261
- show() {
1262
- var _a;
1263
- if (this.isVisible) return;
1264
- this.element.style.visibility = "visible";
1265
- this.element.style.opacity = "1";
1266
- const appendToElement = typeof this.appendTo === "function" ? this.appendTo() : this.appendTo;
1267
- (_a = appendToElement != null ? appendToElement : this.view.dom.parentElement) == null || _a.appendChild(this.element);
1268
- if (this.floatingUIOptions.onShow) this.floatingUIOptions.onShow();
1269
- this.isVisible = true;
1270
- }
1271
- hide() {
1272
- if (!this.isVisible) return;
1273
- this.element.style.visibility = "hidden";
1274
- this.element.style.opacity = "0";
1275
- this.element.remove();
1276
- if (this.floatingUIOptions.onHide) this.floatingUIOptions.onHide();
1277
- this.isVisible = false;
1278
- }
1279
- destroy() {
1280
- this.hide();
1281
- this.element.removeEventListener("mousedown", this.mousedownHandler, { capture: true });
1282
- window.removeEventListener("resize", this.resizeHandler);
1283
- this.scrollTarget.removeEventListener("scroll", this.resizeHandler);
1284
- this.editor.off("focus", this.focusHandler);
1285
- this.editor.off("blur", this.blurHandler);
1286
- this.editor.off("transaction", this.transactionHandler);
1287
- if (this.floatingUIOptions.onDestroy) this.floatingUIOptions.onDestroy();
1288
- }
1289
- };
1290
- var FloatingMenuPlugin = (options) => {
1291
- return new require_dist.Plugin({
1292
- key: typeof options.pluginKey === "string" ? new require_dist.PluginKey(options.pluginKey) : options.pluginKey,
1293
- view: (view) => new FloatingMenuView({
1294
- view,
1295
- ...options
1296
- })
1297
- });
1298
- };
1299
- (0, vue.defineComponent)({
1300
- name: "FloatingMenu",
1301
- inheritAttrs: false,
1302
- props: {
1303
- pluginKey: {
1304
- type: null,
1305
- default: void 0
1306
- },
1307
- editor: {
1308
- type: Object,
1309
- required: true
1310
- },
1311
- updateDelay: {
1312
- type: Number,
1313
- default: void 0
1314
- },
1315
- resizeDelay: {
1316
- type: Number,
1317
- default: void 0
1318
- },
1319
- options: {
1320
- type: Object,
1321
- default: () => ({})
1322
- },
1323
- appendTo: {
1324
- type: [Object, Function],
1325
- default: void 0
1326
- },
1327
- shouldShow: {
1328
- type: Function,
1329
- default: null
1330
- }
1331
- },
1332
- setup(props, { slots, attrs }) {
1333
- var _a;
1334
- const root = (0, vue.ref)(null);
1335
- const resolvedPluginKey = (_a = props.pluginKey) != null ? _a : new require_dist.PluginKey("floatingMenu");
1336
- (0, vue.onMounted)(() => {
1337
- const { editor, updateDelay, resizeDelay, options, appendTo, shouldShow } = props;
1338
- const el = root.value;
1339
- if (!el) return;
1340
- el.style.visibility = "hidden";
1341
- el.style.position = "absolute";
1342
- el.remove();
1343
- editor.registerPlugin(FloatingMenuPlugin({
1344
- pluginKey: resolvedPluginKey,
1345
- editor,
1346
- element: el,
1347
- updateDelay,
1348
- resizeDelay,
1349
- options,
1350
- appendTo,
1351
- shouldShow
1352
- }));
1353
- });
1354
- (0, vue.onBeforeUnmount)(() => {
1355
- const { editor } = props;
1356
- editor.unregisterPlugin(resolvedPluginKey);
1357
- });
1358
- return () => {
1359
- var _a2;
1360
- return (0, vue.h)("div", {
1361
- ref: root,
1362
- ...attrs
1363
- }, (_a2 = slots.default) == null ? void 0 : _a2.call(slots));
1364
- };
1365
- }
1366
- });
1367
- //#endregion
1368
- exports.BubbleMenu = BubbleMenu;