@tulip-systems/core 0.5.2 → 0.5.3

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 (366) hide show
  1. package/dist/components/common/icons.d.mts +2 -2
  2. package/dist/components/common/status.d.mts +3 -3
  3. package/dist/components/editor/components/content.client.d.mts +2 -2
  4. package/dist/components/editor/components/editor.client.d.mts +2 -2
  5. package/dist/components/editor/components/editor.client.mjs +2 -2
  6. package/dist/components/editor/components/editor.client.mjs.map +1 -1
  7. package/dist/components/editor/components/menu.client.d.mts +3 -3
  8. package/dist/components/editor/components/menu.client.mjs +3 -0
  9. package/dist/components/editor/components/menu.client.mjs.map +1 -1
  10. package/dist/components/editor/extensions/file-handler/extension.d.mts +21 -0
  11. package/dist/components/editor/extensions/file-handler/extension.d.mts.map +1 -0
  12. package/dist/components/editor/extensions/file-handler/extension.mjs +40 -0
  13. package/dist/components/editor/extensions/file-handler/extension.mjs.map +1 -0
  14. package/dist/components/editor/extensions/file-handler/strategy.d.mts +29 -0
  15. package/dist/components/editor/extensions/file-handler/strategy.d.mts.map +1 -0
  16. package/dist/components/editor/extensions/file-handler/strategy.mjs +111 -0
  17. package/dist/components/editor/extensions/file-handler/strategy.mjs.map +1 -0
  18. package/dist/components/editor/extensions/file-handler/utils.mjs +50 -0
  19. package/dist/components/editor/extensions/file-handler/utils.mjs.map +1 -0
  20. package/dist/components/editor/extensions/image/extension.d.mts +8 -0
  21. package/dist/components/editor/extensions/image/extension.d.mts.map +1 -0
  22. package/dist/components/editor/extensions/image/extension.mjs +52 -0
  23. package/dist/components/editor/extensions/image/extension.mjs.map +1 -0
  24. package/dist/components/editor/extensions/skeleton/extension.mjs +41 -0
  25. package/dist/components/editor/extensions/skeleton/extension.mjs.map +1 -0
  26. package/dist/components/editor/extensions/skeleton/renderer.mjs +25 -0
  27. package/dist/components/editor/extensions/skeleton/renderer.mjs.map +1 -0
  28. package/dist/components/editor/lib/constants.d.mts +29 -26
  29. package/dist/components/editor/lib/constants.d.mts.map +1 -1
  30. package/dist/components/editor/lib/constants.mjs +14 -2
  31. package/dist/components/editor/lib/constants.mjs.map +1 -1
  32. package/dist/components/editor/lib/extensions.d.mts +5 -1
  33. package/dist/components/editor/lib/extensions.d.mts.map +1 -1
  34. package/dist/components/editor/lib/extensions.mjs.map +1 -1
  35. package/dist/components/editor/lib/variants.mjs +10 -2
  36. package/dist/components/editor/lib/variants.mjs.map +1 -1
  37. package/dist/components/header/back-button.client.d.mts +2 -2
  38. package/dist/components/header/bottom-bar.client.d.mts +3 -3
  39. package/dist/components/header/breadcrumbs.client.d.mts +7 -7
  40. package/dist/components/header/header.client.d.mts +2 -2
  41. package/dist/components/header/mobile-nav-switcher.client.d.mts +2 -2
  42. package/dist/components/header/top-bar.client.d.mts +4 -4
  43. package/dist/components/layouts/admin-content.client.d.mts +2 -2
  44. package/dist/components/layouts/admin-layout.d.mts +2 -2
  45. package/dist/components/layouts/admin-layout.d.mts.map +1 -1
  46. package/dist/components/layouts/admin-loading.d.mts +2 -2
  47. package/dist/components/layouts/empty-page.d.mts +4 -4
  48. package/dist/components/layouts/list-layout.d.mts +2 -2
  49. package/dist/components/layouts/not-found-page.d.mts +3 -3
  50. package/dist/components/layouts/providers.client.d.mts +2 -2
  51. package/dist/components/layouts/root-layout.server.d.mts +2 -2
  52. package/dist/components/layouts/root-loading.d.mts +2 -2
  53. package/dist/components/layouts/tab-layout.d.mts +2 -2
  54. package/dist/components/lists/data-list.d.mts +5 -5
  55. package/dist/components/lists/data-stack.d.mts +8 -8
  56. package/dist/components/lists/data-stack.d.mts.map +1 -1
  57. package/dist/components/navigation/admin-sidebar-paths.client.d.mts +10 -10
  58. package/dist/components/ui/accordion.d.mts +5 -5
  59. package/dist/components/ui/accordion.d.mts.map +1 -1
  60. package/dist/components/ui/alert-dialog.d.mts +12 -12
  61. package/dist/components/ui/alert-dialog.d.mts.map +1 -1
  62. package/dist/components/ui/alert.d.mts +4 -4
  63. package/dist/components/ui/alert.d.mts.map +1 -1
  64. package/dist/components/ui/aspect-ratio.d.mts +2 -2
  65. package/dist/components/ui/aspect-ratio.d.mts.map +1 -1
  66. package/dist/components/ui/avatar.client.d.mts +4 -4
  67. package/dist/components/ui/badge.d.mts +2 -2
  68. package/dist/components/ui/badge.d.mts.map +1 -1
  69. package/dist/components/ui/breadcrumb.d.mts +8 -8
  70. package/dist/components/ui/breadcrumb.d.mts.map +1 -1
  71. package/dist/components/ui/button.d.mts +2 -2
  72. package/dist/components/ui/button.d.mts.map +1 -1
  73. package/dist/components/ui/calendar.d.mts +3 -3
  74. package/dist/components/ui/calendar.d.mts.map +1 -1
  75. package/dist/components/ui/card.d.mts +7 -7
  76. package/dist/components/ui/card.d.mts.map +1 -1
  77. package/dist/components/ui/carousel.d.mts +6 -6
  78. package/dist/components/ui/carousel.d.mts.map +1 -1
  79. package/dist/components/ui/chart.client.d.mts +5 -5
  80. package/dist/components/ui/checkbox.d.mts +2 -2
  81. package/dist/components/ui/checkbox.d.mts.map +1 -1
  82. package/dist/components/ui/collapsible.client.d.mts +4 -4
  83. package/dist/components/ui/color-picker.client.d.mts +2 -2
  84. package/dist/components/ui/combobox-dropdown.client.d.mts +2 -2
  85. package/dist/components/ui/combobox.client.d.mts +2 -2
  86. package/dist/components/ui/command.d.mts +10 -10
  87. package/dist/components/ui/command.d.mts.map +1 -1
  88. package/dist/components/ui/context-menu.d.mts +16 -16
  89. package/dist/components/ui/context-menu.d.mts.map +1 -1
  90. package/dist/components/ui/date-picker.client.d.mts +2 -2
  91. package/dist/components/ui/dialog.client.d.mts +11 -11
  92. package/dist/components/ui/drawer.client.d.mts +11 -11
  93. package/dist/components/ui/dropdown-menu.d.mts +16 -16
  94. package/dist/components/ui/form.client.d.mts +7 -7
  95. package/dist/components/ui/hover-card.client.d.mts +4 -4
  96. package/dist/components/ui/input-recipient.d.mts +2 -2
  97. package/dist/components/ui/input.d.mts +2 -2
  98. package/dist/components/ui/label.d.mts +2 -2
  99. package/dist/components/ui/navigation-menu.d.mts +9 -9
  100. package/dist/components/ui/pagination.d.mts +8 -8
  101. package/dist/components/ui/popover.d.mts +5 -5
  102. package/dist/components/ui/popover.d.mts.map +1 -1
  103. package/dist/components/ui/progress.client.d.mts +2 -2
  104. package/dist/components/ui/radio-group.d.mts +3 -3
  105. package/dist/components/ui/resizable.client.d.mts +4 -4
  106. package/dist/components/ui/scroll-area.d.mts +3 -3
  107. package/dist/components/ui/select.client.d.mts +11 -11
  108. package/dist/components/ui/separator.d.mts +2 -2
  109. package/dist/components/ui/sheet.client.d.mts +9 -9
  110. package/dist/components/ui/sidebar.client.d.mts +24 -24
  111. package/dist/components/ui/skeleton.d.mts +2 -2
  112. package/dist/components/ui/slider.d.mts +2 -2
  113. package/dist/components/ui/sonner.client.d.mts +2 -2
  114. package/dist/components/ui/switch.d.mts +2 -2
  115. package/dist/components/ui/tabs.d.mts +5 -5
  116. package/dist/components/ui/textarea.d.mts +2 -2
  117. package/dist/components/ui/time-input.client.d.mts +2 -2
  118. package/dist/components/ui/toggle-group.client.d.mts +3 -3
  119. package/dist/components/ui/toggle.d.mts +2 -2
  120. package/dist/components/ui/tooltip.client.d.mts +5 -5
  121. package/dist/components.d.mts +2 -1
  122. package/dist/components.mjs +3 -2
  123. package/dist/data-tables.d.mts +2 -2
  124. package/dist/data-tables.mjs +2 -2
  125. package/dist/inline-edit/client.d.mts +2 -3
  126. package/dist/inline-edit/client.mjs +1 -2
  127. package/dist/lib/client.d.mts +2 -2
  128. package/dist/lib/client.mjs +2 -2
  129. package/dist/lib/hooks/use-action.d.mts +2 -2
  130. package/dist/lib/hooks/use-indicator.d.mts +11 -3
  131. package/dist/lib/hooks/use-indicator.d.mts.map +1 -1
  132. package/dist/lib/hooks/use-indicator.mjs +19 -8
  133. package/dist/lib/hooks/use-indicator.mjs.map +1 -1
  134. package/dist/modules/auth/components/allowed.client.d.mts +2 -2
  135. package/dist/modules/auth/components/allowed.client.d.mts.map +1 -1
  136. package/dist/modules/auth/components/auth-layout.server.d.mts +2 -2
  137. package/dist/modules/auth/components/auth-layout.server.d.mts.map +1 -1
  138. package/dist/modules/auth/components/auth-loading.d.mts +2 -2
  139. package/dist/modules/auth/components/create-first-user-page.client.d.mts +2 -2
  140. package/dist/modules/auth/components/create-first-user-page.client.d.mts.map +1 -1
  141. package/dist/modules/auth/components/forget-password-page.client.d.mts +2 -2
  142. package/dist/modules/auth/components/forget-password-page.client.d.mts.map +1 -1
  143. package/dist/modules/auth/components/guard-first-user.server.d.mts +2 -2
  144. package/dist/modules/auth/components/guard-first-user.server.d.mts.map +1 -1
  145. package/dist/modules/auth/components/guard.server.d.mts +2 -2
  146. package/dist/modules/auth/components/guard.server.d.mts.map +1 -1
  147. package/dist/modules/auth/components/login-page.client.d.mts +2 -2
  148. package/dist/modules/auth/components/login-page.client.d.mts.map +1 -1
  149. package/dist/modules/auth/components/reset-password-page.client.d.mts +2 -2
  150. package/dist/modules/auth/components/reset-password-page.client.d.mts.map +1 -1
  151. package/dist/modules/auth/components/update-password-command.d.mts +2 -2
  152. package/dist/modules/auth/components/update-password-command.d.mts.map +1 -1
  153. package/dist/modules/auth/db/schema.d.mts +73 -73
  154. package/dist/modules/auth/db/schema.d.mts.map +1 -1
  155. package/dist/modules/auth/handler/client.client.d.mts +6 -6
  156. package/dist/modules/auth/hooks/use-permission.d.mts +2 -2
  157. package/dist/modules/auth/hooks/use-session.d.mts +4 -4
  158. package/dist/modules/auth/lib/validators.d.mts +2 -2
  159. package/dist/modules/auth/lib/validators.d.mts.map +1 -1
  160. package/dist/modules/commands/components/alert-dialog-command.client.d.mts +10 -10
  161. package/dist/modules/commands/components/alert-dialog-command.client.d.mts.map +1 -1
  162. package/dist/modules/commands/components/click-command.client.d.mts +2 -2
  163. package/dist/modules/commands/components/click-command.client.d.mts.map +1 -1
  164. package/dist/modules/commands/components/command-trigger.client.d.mts +6 -6
  165. package/dist/modules/commands/components/command-trigger.client.d.mts.map +1 -1
  166. package/dist/modules/commands/components/dialog-command.client.d.mts +8 -8
  167. package/dist/modules/commands/components/dialog-command.client.d.mts.map +1 -1
  168. package/dist/modules/commands/components/dropdown-command.client.d.mts +5 -5
  169. package/dist/modules/commands/components/dropdown-command.client.d.mts.map +1 -1
  170. package/dist/modules/commands/components/empty-command.client.d.mts +2 -2
  171. package/dist/modules/commands/components/empty-command.client.d.mts.map +1 -1
  172. package/dist/modules/commands/components/form-dialog-command.client.d.mts +11 -11
  173. package/dist/modules/commands/components/form-dialog-command.client.d.mts.map +1 -1
  174. package/dist/modules/commands/hooks/use-command-mutation.client.d.mts +2 -2
  175. package/dist/modules/commands/menus/context-menu.client.d.mts +2 -2
  176. package/dist/modules/commands/menus/context-menu.client.d.mts.map +1 -1
  177. package/dist/modules/commands/menus/dropdown-menu.client.d.mts +3 -3
  178. package/dist/modules/commands/menus/dropdown-menu.client.d.mts.map +1 -1
  179. package/dist/modules/commands/menus/inline-menu.client.d.mts +3 -3
  180. package/dist/modules/commands/menus/inline-menu.client.d.mts.map +1 -1
  181. package/dist/modules/commands/menus/responsive-menu.client.d.mts +3 -3
  182. package/dist/modules/commands/menus/responsive-menu.client.d.mts.map +1 -1
  183. package/dist/modules/commands/utils/archive-command.client.d.mts +3 -3
  184. package/dist/modules/commands/utils/archive-command.client.d.mts.map +1 -1
  185. package/dist/modules/commands/utils/delete-command.client.d.mts +3 -3
  186. package/dist/modules/commands/utils/delete-command.client.d.mts.map +1 -1
  187. package/dist/modules/config/db/helpers.d.mts +5 -5
  188. package/dist/modules/config/db/helpers.d.mts.map +1 -1
  189. package/dist/modules/data-tables/components/cell/common.client.d.mts +5 -5
  190. package/dist/modules/data-tables/components/column-header.d.mts +2 -2
  191. package/dist/modules/data-tables/components/column-header.d.mts.map +1 -1
  192. package/dist/modules/data-tables/components/filters/combobox.client.d.mts +2 -2
  193. package/dist/modules/data-tables/components/filters/slider.client.d.mts +2 -2
  194. package/dist/modules/data-tables/components/header.d.mts +4 -4
  195. package/dist/modules/data-tables/components/header.d.mts.map +1 -1
  196. package/dist/modules/data-tables/components/layout.d.mts +2 -2
  197. package/dist/modules/data-tables/components/layout.d.mts.map +1 -1
  198. package/dist/modules/data-tables/components/search-input.client.d.mts +2 -2
  199. package/dist/modules/data-tables/components/skeleton.d.mts +2 -2
  200. package/dist/modules/data-tables/components/skeleton.d.mts.map +1 -1
  201. package/dist/modules/data-tables/components/table.d.mts +7 -7
  202. package/dist/modules/data-tables/components/table.d.mts.map +1 -1
  203. package/dist/modules/data-tables/components/toolbar.d.mts +3 -3
  204. package/dist/modules/data-tables/components/toolbar.d.mts.map +1 -1
  205. package/dist/modules/data-tables/hooks/use-context.client.d.mts +2 -2
  206. package/dist/modules/data-tables/lib/filters/parsers.d.mts +6 -1
  207. package/dist/modules/data-tables/lib/filters/parsers.d.mts.map +1 -1
  208. package/dist/modules/data-tables/lib/filters/parsers.mjs +6 -1
  209. package/dist/modules/data-tables/lib/filters/parsers.mjs.map +1 -1
  210. package/dist/modules/data-tables/tables/data-table/components/table.d.mts +2 -2
  211. package/dist/modules/data-tables/tables/inline-table/components/cells/common.d.mts +2 -2
  212. package/dist/modules/data-tables/tables/inline-table/components/cells/drag-handle.client.d.mts +2 -2
  213. package/dist/modules/data-tables/tables/inline-table/components/inputs/advanced-select.client.d.mts +2 -2
  214. package/dist/modules/data-tables/tables/inline-table/components/inputs/combobox.client.d.mts +2 -2
  215. package/dist/modules/data-tables/tables/inline-table/components/inputs/input.client.d.mts +3 -3
  216. package/dist/modules/data-tables/tables/inline-table/components/inputs/read-only.d.mts +2 -2
  217. package/dist/modules/data-tables/tables/inline-table/components/inputs/select.client.d.mts +2 -2
  218. package/dist/modules/data-tables/tables/inline-table/components/table.d.mts +2 -2
  219. package/dist/modules/data-tables/tables/inline-table/hooks/context.client.d.mts +2 -2
  220. package/dist/modules/inline-edit/components/combobox-dropdown.client.d.mts +6 -4
  221. package/dist/modules/inline-edit/components/combobox-dropdown.client.d.mts.map +1 -1
  222. package/dist/modules/inline-edit/components/combobox-dropdown.client.mjs +11 -6
  223. package/dist/modules/inline-edit/components/combobox-dropdown.client.mjs.map +1 -1
  224. package/dist/modules/inline-edit/components/combobox.client.d.mts +6 -4
  225. package/dist/modules/inline-edit/components/combobox.client.d.mts.map +1 -1
  226. package/dist/modules/inline-edit/components/combobox.client.mjs +7 -5
  227. package/dist/modules/inline-edit/components/combobox.client.mjs.map +1 -1
  228. package/dist/modules/inline-edit/components/date-input.client.d.mts +5 -3
  229. package/dist/modules/inline-edit/components/date-input.client.d.mts.map +1 -1
  230. package/dist/modules/inline-edit/components/date-input.client.mjs +26 -13
  231. package/dist/modules/inline-edit/components/date-input.client.mjs.map +1 -1
  232. package/dist/modules/inline-edit/components/date-picker.client.d.mts +6 -4
  233. package/dist/modules/inline-edit/components/date-picker.client.d.mts.map +1 -1
  234. package/dist/modules/inline-edit/components/date-picker.client.mjs +12 -7
  235. package/dist/modules/inline-edit/components/date-picker.client.mjs.map +1 -1
  236. package/dist/modules/inline-edit/components/editor.client.d.mts +6 -4
  237. package/dist/modules/inline-edit/components/editor.client.d.mts.map +1 -1
  238. package/dist/modules/inline-edit/components/editor.client.mjs +11 -6
  239. package/dist/modules/inline-edit/components/editor.client.mjs.map +1 -1
  240. package/dist/modules/inline-edit/components/input-recipient.client.d.mts +6 -4
  241. package/dist/modules/inline-edit/components/input-recipient.client.d.mts.map +1 -1
  242. package/dist/modules/inline-edit/components/input-recipient.client.mjs +11 -6
  243. package/dist/modules/inline-edit/components/input-recipient.client.mjs.map +1 -1
  244. package/dist/modules/inline-edit/components/input-toggle.client.d.mts +6 -4
  245. package/dist/modules/inline-edit/components/input-toggle.client.d.mts.map +1 -1
  246. package/dist/modules/inline-edit/components/input-toggle.client.mjs +9 -7
  247. package/dist/modules/inline-edit/components/input-toggle.client.mjs.map +1 -1
  248. package/dist/modules/inline-edit/components/input.client.d.mts +13 -10
  249. package/dist/modules/inline-edit/components/input.client.d.mts.map +1 -1
  250. package/dist/modules/inline-edit/components/input.client.mjs +35 -19
  251. package/dist/modules/inline-edit/components/input.client.mjs.map +1 -1
  252. package/dist/modules/inline-edit/components/select.client.d.mts +10 -9
  253. package/dist/modules/inline-edit/components/select.client.d.mts.map +1 -1
  254. package/dist/modules/inline-edit/components/select.client.mjs +14 -7
  255. package/dist/modules/inline-edit/components/select.client.mjs.map +1 -1
  256. package/dist/modules/inline-edit/components/switch.client.d.mts +5 -3
  257. package/dist/modules/inline-edit/components/switch.client.d.mts.map +1 -1
  258. package/dist/modules/inline-edit/components/switch.client.mjs +8 -6
  259. package/dist/modules/inline-edit/components/switch.client.mjs.map +1 -1
  260. package/dist/modules/inline-edit/components/toggle.client.d.mts +6 -4
  261. package/dist/modules/inline-edit/components/toggle.client.d.mts.map +1 -1
  262. package/dist/modules/inline-edit/components/toggle.client.mjs +9 -7
  263. package/dist/modules/inline-edit/components/toggle.client.mjs.map +1 -1
  264. package/dist/modules/inline-edit/hooks/context.client.d.mts +2 -2
  265. package/dist/modules/inline-edit/hooks/context.client.d.mts.map +1 -1
  266. package/dist/modules/inline-edit/hooks/use-inline.client.d.mts +35 -3
  267. package/dist/modules/inline-edit/hooks/use-inline.client.d.mts.map +1 -1
  268. package/dist/modules/inline-edit/hooks/use-inline.client.mjs +71 -9
  269. package/dist/modules/inline-edit/hooks/use-inline.client.mjs.map +1 -1
  270. package/dist/modules/inline-edit/lib/variants.d.mts +1 -0
  271. package/dist/modules/inline-edit/lib/variants.d.mts.map +1 -1
  272. package/dist/modules/inline-edit/lib/variants.mjs +12 -4
  273. package/dist/modules/inline-edit/lib/variants.mjs.map +1 -1
  274. package/dist/modules/router/handler/init.server.d.mts +6 -6
  275. package/dist/modules/router/handler/init.server.d.mts.map +1 -1
  276. package/dist/modules/router/lib/query-client.server.d.mts +2 -2
  277. package/dist/modules/router/lib/query-client.server.d.mts.map +1 -1
  278. package/dist/modules/storage/components/dropzone-context.client.d.mts +2 -2
  279. package/dist/modules/storage/components/dropzone.client.d.mts +5 -5
  280. package/dist/modules/storage/components/dropzone.client.mjs +1 -1
  281. package/dist/modules/storage/components/image-grid.client.d.mts +3 -3
  282. package/dist/modules/storage/components/image-grid.client.mjs +3 -3
  283. package/dist/modules/storage/components/image-grid.client.mjs.map +1 -1
  284. package/dist/modules/storage/components/upload-zone-context.client.d.mts +3 -11
  285. package/dist/modules/storage/components/upload-zone-context.client.d.mts.map +1 -1
  286. package/dist/modules/storage/components/upload-zone-context.client.mjs.map +1 -1
  287. package/dist/modules/storage/components/upload-zone.client.d.mts +10 -33
  288. package/dist/modules/storage/components/upload-zone.client.d.mts.map +1 -1
  289. package/dist/modules/storage/components/upload-zone.client.mjs +19 -93
  290. package/dist/modules/storage/components/upload-zone.client.mjs.map +1 -1
  291. package/dist/modules/storage/config/filters.d.mts +1 -0
  292. package/dist/modules/storage/config/filters.d.mts.map +1 -1
  293. package/dist/modules/storage/config/filters.mjs +1 -0
  294. package/dist/modules/storage/config/filters.mjs.map +1 -1
  295. package/dist/modules/storage/lib/create-upload.client.d.mts +56 -0
  296. package/dist/modules/storage/lib/create-upload.client.d.mts.map +1 -0
  297. package/dist/modules/storage/lib/create-upload.client.mjs +98 -0
  298. package/dist/modules/storage/lib/create-upload.client.mjs.map +1 -0
  299. package/dist/modules/storage/lib/helpers.d.mts +1 -1
  300. package/dist/modules/storage/lib/router.server.d.mts +3265 -2345
  301. package/dist/modules/storage/lib/router.server.d.mts.map +1 -1
  302. package/dist/modules/storage/lib/router.server.mjs +5 -2
  303. package/dist/modules/storage/lib/router.server.mjs.map +1 -1
  304. package/dist/modules/storage/lib/schema.d.mts +124 -90
  305. package/dist/modules/storage/lib/schema.d.mts.map +1 -1
  306. package/dist/modules/storage/lib/schema.mjs +2 -1
  307. package/dist/modules/storage/lib/schema.mjs.map +1 -1
  308. package/dist/modules/storage/lib/service.server.d.mts +31 -42
  309. package/dist/modules/storage/lib/service.server.d.mts.map +1 -1
  310. package/dist/modules/storage/lib/service.server.mjs +5 -5
  311. package/dist/modules/storage/lib/service.server.mjs.map +1 -1
  312. package/dist/modules/storage/lib/validators.d.mts +170 -90
  313. package/dist/modules/storage/lib/validators.d.mts.map +1 -1
  314. package/dist/modules/storage/lib/validators.mjs +2 -1
  315. package/dist/modules/storage/lib/validators.mjs.map +1 -1
  316. package/dist/storage/client.d.mts +2 -1
  317. package/dist/storage/client.mjs +2 -8
  318. package/dist/storage.d.mts +2 -2
  319. package/dist/storage.mjs +1 -1
  320. package/package.json +4 -3
  321. package/src/components/editor/components/editor.client.tsx +7 -2
  322. package/src/components/editor/components/menu.client.tsx +26 -0
  323. package/src/components/editor/extensions/file-handler/extension.ts +69 -0
  324. package/src/components/editor/extensions/file-handler/strategy.ts +167 -0
  325. package/src/components/editor/extensions/file-handler/utils.ts +51 -0
  326. package/src/components/editor/extensions/image/extension.ts +57 -0
  327. package/src/components/editor/extensions/skeleton/extension.ts +35 -0
  328. package/src/components/editor/extensions/skeleton/renderer.tsx +14 -0
  329. package/src/components/editor/lib/constants.ts +16 -2
  330. package/src/components/editor/lib/extensions.ts +4 -1
  331. package/src/components/editor/lib/utils.ts +32 -0
  332. package/src/components/editor/lib/variants.ts +72 -1
  333. package/src/components/entry.ts +2 -1
  334. package/src/lib/hooks/use-indicator.tsx +27 -18
  335. package/src/modules/data-tables/lib/filters/parsers.ts +14 -0
  336. package/src/modules/inline-edit/components/combobox-dropdown.client.tsx +21 -12
  337. package/src/modules/inline-edit/components/combobox.client.tsx +13 -6
  338. package/src/modules/inline-edit/components/date-input.client.tsx +29 -13
  339. package/src/modules/inline-edit/components/date-picker.client.tsx +13 -9
  340. package/src/modules/inline-edit/components/editor.client.tsx +14 -14
  341. package/src/modules/inline-edit/components/input-recipient.client.tsx +15 -8
  342. package/src/modules/inline-edit/components/input-toggle.client.tsx +16 -9
  343. package/src/modules/inline-edit/components/input.client.tsx +38 -24
  344. package/src/modules/inline-edit/components/select.client.tsx +16 -9
  345. package/src/modules/inline-edit/components/switch.client.tsx +10 -6
  346. package/src/modules/inline-edit/components/toggle.client.tsx +13 -9
  347. package/src/modules/inline-edit/entry.client.ts +0 -1
  348. package/src/modules/inline-edit/hooks/use-inline.client copy.tsx +97 -0
  349. package/src/modules/inline-edit/hooks/use-inline.client.tsx +139 -20
  350. package/src/modules/inline-edit/lib/variants.ts +7 -0
  351. package/src/modules/storage/components/image-grid.client.tsx +2 -2
  352. package/src/modules/storage/components/upload-zone-context.client.tsx +3 -4
  353. package/src/modules/storage/components/upload-zone.client.tsx +17 -116
  354. package/src/modules/storage/config/filters.ts +1 -0
  355. package/src/modules/storage/entry.client.ts +2 -1
  356. package/src/modules/storage/lib/create-upload.client.ts +134 -0
  357. package/src/modules/storage/lib/router.server.ts +1 -0
  358. package/src/modules/storage/lib/schema.ts +1 -0
  359. package/src/modules/storage/lib/service.server.ts +10 -4
  360. package/src/modules/storage/lib/validators.ts +1 -0
  361. package/dist/modules/inline-edit/components/deprecated-editor.client.d.mts +0 -21
  362. package/dist/modules/inline-edit/components/deprecated-editor.client.d.mts.map +0 -1
  363. package/dist/modules/inline-edit/components/deprecated-editor.client.mjs +0 -37
  364. package/dist/modules/inline-edit/components/deprecated-editor.client.mjs.map +0 -1
  365. package/dist/storage/client.mjs.map +0 -1
  366. package/src/modules/inline-edit/components/deprecated-editor.client.tsx +0 -48
@@ -1,5 +1,5 @@
1
1
  import { LucideIcon, LucideProps } from "lucide-react";
2
- import * as react_jsx_runtime13 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime83 from "react/jsx-runtime";
3
3
  import * as react0 from "react";
4
4
 
5
5
  //#region src/components/common/icons.d.ts
@@ -54,7 +54,7 @@ declare const Icons: {
54
54
  home: react0.ForwardRefExoticComponent<Omit<LucideProps, "ref"> & react0.RefAttributes<SVGSVGElement>>;
55
55
  mail: react0.ForwardRefExoticComponent<Omit<LucideProps, "ref"> & react0.RefAttributes<SVGSVGElement>>;
56
56
  building: react0.ForwardRefExoticComponent<Omit<LucideProps, "ref"> & react0.RefAttributes<SVGSVGElement>>;
57
- logo: (props: LucideProps) => react_jsx_runtime13.JSX.Element;
57
+ logo: (props: LucideProps) => react_jsx_runtime83.JSX.Element;
58
58
  };
59
59
  //#endregion
60
60
  export { Icon, Icons };
@@ -1,5 +1,5 @@
1
1
  import { ConfigWithIcon } from "../../lib/types/config.mjs";
2
- import * as react_jsx_runtime14 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime84 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/components/common/status.d.ts
5
5
  /**
@@ -43,11 +43,11 @@ type StatusComponentProps<TStatus extends string> = {
43
43
  /**
44
44
  * Status column
45
45
  */
46
- declare function StatusField<TStatus extends string>(props: StatusComponentProps<TStatus>): react_jsx_runtime14.JSX.Element;
46
+ declare function StatusField<TStatus extends string>(props: StatusComponentProps<TStatus>): react_jsx_runtime84.JSX.Element;
47
47
  /**
48
48
  * Status badge
49
49
  */
50
- declare function StatusBadge<TStatus extends string>(props: StatusComponentProps<TStatus>): react_jsx_runtime14.JSX.Element;
50
+ declare function StatusBadge<TStatus extends string>(props: StatusComponentProps<TStatus>): react_jsx_runtime84.JSX.Element;
51
51
  //#endregion
52
52
  export { CreateStatusComponentProps, StatusBadge, StatusField, createStatusConfig, createStatusVariants, findStatus };
53
53
  //# sourceMappingURL=status.d.mts.map
@@ -1,7 +1,7 @@
1
- import * as react_jsx_runtime260 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime255 from "react/jsx-runtime";
2
2
 
3
3
  //#region src/components/editor/components/content.client.d.ts
4
- declare function EditorContent(): react_jsx_runtime260.JSX.Element;
4
+ declare function EditorContent(): react_jsx_runtime255.JSX.Element;
5
5
  //#endregion
6
6
  export { EditorContent };
7
7
  //# sourceMappingURL=content.client.d.mts.map
@@ -1,6 +1,6 @@
1
1
  import { EditorExtensionsConfig, EditorExtensionsConfigResult } from "../lib/extensions.mjs";
2
2
  import { EditorJSONContent } from "../lib/types.mjs";
3
- import * as react_jsx_runtime261 from "react/jsx-runtime";
3
+ import * as react_jsx_runtime260 from "react/jsx-runtime";
4
4
  import { VariantProps } from "class-variance-authority";
5
5
  import * as react105 from "react";
6
6
  import { PropsWithChildren } from "react";
@@ -42,7 +42,7 @@ declare function Editor$1({
42
42
  variant,
43
43
  className,
44
44
  children
45
- }: EditorProps): react_jsx_runtime261.JSX.Element | null;
45
+ }: EditorProps): react_jsx_runtime260.JSX.Element | null;
46
46
  //#endregion
47
47
  export { Editor$1 as Editor, EditorContext, EditorProps, editorVariants };
48
48
  //# sourceMappingURL=editor.client.d.mts.map
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { cn } from "../../../lib/utils/cn.mjs";
4
4
  import { editorExtensionsConfigToExtensions, flattenEditorExtensionsConfig } from "../lib/extensions.mjs";
5
- import { editorProseVariants } from "../lib/variants.mjs";
5
+ import { editorImageVariants, editorProseVariants } from "../lib/variants.mjs";
6
6
  import { jsx } from "react/jsx-runtime";
7
7
  import { cva } from "class-variance-authority";
8
8
  import { createContext } from "react";
@@ -32,7 +32,7 @@ function Editor$1({ value, extensions, onUpdate, onBlur, disabled, variant, clas
32
32
  immediatelyRender: false,
33
33
  editorProps: {
34
34
  transformPastedHTML: (html) => html.replace(/<img.*?>/g, ""),
35
- attributes: { class: cn("editor-content text-sm max-w-full focus:outline-none", editorProseVariants(), className) }
35
+ attributes: { class: cn("editor-content text-sm max-w-full focus:outline-none", editorProseVariants(), editorImageVariants(), className) }
36
36
  }
37
37
  });
38
38
  if (!editor) return null;
@@ -1 +1 @@
1
- {"version":3,"file":"editor.client.mjs","names":["Editor","editor"],"sources":["../../../../src/components/editor/components/editor.client.tsx"],"sourcesContent":["\"use client\";\n\nimport { cn } from \"@/lib/utils/cn\";\nimport { Content, Editor as TiptapEditor, useEditor } from \"@tiptap/react\";\nimport { cva, VariantProps } from \"class-variance-authority\";\nimport { createContext, PropsWithChildren } from \"react\";\nimport {\n EditorExtensionsConfig,\n EditorExtensionsConfigResult,\n editorExtensionsConfigToExtensions,\n flattenEditorExtensionsConfig,\n} from \"../lib/extensions\";\nimport { EditorJSONContent } from \"../lib/types\";\nimport { editorProseVariants } from \"../lib/variants\";\n\n/**\n * Editor context\n */\ntype EditorContextValue = {\n editor: TiptapEditor;\n extensions: EditorExtensionsConfigResult;\n};\n\nexport const EditorContext = createContext({} as EditorContextValue);\n\n/**\n * Editor variants\n */\nexport const editorVariants = cva(\"\", {\n variants: {\n variant: {\n default:\n \"border-input rounded-lg border [&_.editor-content]:p-3 [&_.editor-content[contenteditable='false']]:pointer-events-none [&_.editor-content[contenteditable='false']]:cursor-not-allowed [&_.editor-content[contenteditable='false']]:opacity-50\",\n table:\n \"[&_.editor-content[contenteditable='false']]:pointer-events-none [&_.editor-content[contenteditable='false']]:cursor-not-allowed [&_.editor-content[contenteditable='false']]:opacity-50\",\n preview: \"bg-transparent [&_.editor-content]:p-0 [&_.editor-content]:min-h-0\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n },\n});\n\n/**\n * Editor context provider\n */\nexport type EditorProps = VariantProps<typeof editorVariants> &\n PropsWithChildren<{\n value?: Content;\n extensions?: Partial<EditorExtensionsConfig>;\n onUpdate?: (value: EditorJSONContent) => void;\n onBlur?: (value: EditorJSONContent) => void;\n disabled?: boolean;\n className?: string;\n }>;\n\nexport function Editor({\n value,\n extensions,\n onUpdate,\n onBlur,\n disabled,\n variant,\n className,\n children,\n}: EditorProps) {\n const editor = useEditor({\n extensions: editorExtensionsConfigToExtensions(extensions),\n content: value,\n onUpdate: ({ editor }) => onUpdate?.(editor.getJSON()),\n onBlur: ({ editor }) => onBlur?.(editor.getJSON()),\n editable: !disabled,\n injectCSS: false,\n immediatelyRender: false,\n editorProps: {\n transformPastedHTML: (html) => html.replace(/<img.*?>/g, \"\"),\n attributes: {\n class: cn(\"editor-content text-sm max-w-full focus:outline-none\", editorProseVariants(), className),\n },\n },\n });\n\n if (!editor) return null;\n\n return (\n <EditorContext.Provider\n value={{\n editor,\n extensions: flattenEditorExtensionsConfig(extensions),\n }}\n >\n <div className={editorVariants({ variant })}>{children}</div>\n </EditorContext.Provider>\n );\n}\n"],"mappings":";;;;;;;;;;;AAuBA,MAAa,gBAAgB,cAAc,EAAE,CAAuB;;;;AAKpE,MAAa,iBAAiB,IAAI,IAAI;CACpC,UAAU,EACR,SAAS;EACP,SACE;EACF,OACE;EACF,SAAS;EACV,EACF;CACD,iBAAiB,EACf,SAAS,WACV;CACF,CAAC;AAeF,SAAgBA,SAAO,EACrB,OACA,YACA,UACA,QACA,UACA,SACA,WACA,YACc;CACd,MAAM,SAAS,UAAU;EACvB,YAAY,mCAAmC,WAAW;EAC1D,SAAS;EACT,WAAW,EAAE,uBAAa,WAAWC,SAAO,SAAS,CAAC;EACtD,SAAS,EAAE,uBAAa,SAASA,SAAO,SAAS,CAAC;EAClD,UAAU,CAAC;EACX,WAAW;EACX,mBAAmB;EACnB,aAAa;GACX,sBAAsB,SAAS,KAAK,QAAQ,aAAa,GAAG;GAC5D,YAAY,EACV,OAAO,GAAG,wDAAwD,qBAAqB,EAAE,UAAU,EACpG;GACF;EACF,CAAC;AAEF,KAAI,CAAC,OAAQ,QAAO;AAEpB,QACE,oBAAC,cAAc;EACb,OAAO;GACL;GACA,YAAY,8BAA8B,WAAW;GACtD;YAED,oBAAC;GAAI,WAAW,eAAe,EAAE,SAAS,CAAC;GAAG;IAAe;GACtC"}
1
+ {"version":3,"file":"editor.client.mjs","names":["Editor","editor"],"sources":["../../../../src/components/editor/components/editor.client.tsx"],"sourcesContent":["\"use client\";\n\nimport { cn } from \"@/lib/utils/cn\";\nimport { Content, Editor as TiptapEditor, useEditor } from \"@tiptap/react\";\nimport { cva, VariantProps } from \"class-variance-authority\";\nimport { createContext, PropsWithChildren } from \"react\";\nimport {\n EditorExtensionsConfig,\n EditorExtensionsConfigResult,\n editorExtensionsConfigToExtensions,\n flattenEditorExtensionsConfig,\n} from \"../lib/extensions\";\nimport { EditorJSONContent } from \"../lib/types\";\nimport { editorImageVariants, editorProseVariants } from \"../lib/variants\";\n\n/**\n * Editor context\n */\ntype EditorContextValue = {\n editor: TiptapEditor;\n extensions: EditorExtensionsConfigResult;\n};\n\nexport const EditorContext = createContext({} as EditorContextValue);\n\n/**\n * Editor variants\n */\nexport const editorVariants = cva(\"\", {\n variants: {\n variant: {\n default:\n \"border-input rounded-lg border [&_.editor-content]:p-3 [&_.editor-content[contenteditable='false']]:pointer-events-none [&_.editor-content[contenteditable='false']]:cursor-not-allowed [&_.editor-content[contenteditable='false']]:opacity-50\",\n table:\n \"[&_.editor-content[contenteditable='false']]:pointer-events-none [&_.editor-content[contenteditable='false']]:cursor-not-allowed [&_.editor-content[contenteditable='false']]:opacity-50\",\n preview: \"bg-transparent [&_.editor-content]:p-0 [&_.editor-content]:min-h-0\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n },\n});\n\n/**\n * Editor context provider\n */\nexport type EditorProps = VariantProps<typeof editorVariants> &\n PropsWithChildren<{\n value?: Content;\n extensions?: Partial<EditorExtensionsConfig>;\n onUpdate?: (value: EditorJSONContent) => void;\n onBlur?: (value: EditorJSONContent) => void;\n disabled?: boolean;\n className?: string;\n }>;\n\nexport function Editor({\n value,\n extensions,\n onUpdate,\n onBlur,\n disabled,\n variant,\n className,\n children,\n}: EditorProps) {\n const editor = useEditor({\n extensions: editorExtensionsConfigToExtensions(extensions),\n content: value,\n onUpdate: ({ editor }) => onUpdate?.(editor.getJSON()),\n onBlur: ({ editor }) => onBlur?.(editor.getJSON()),\n editable: !disabled,\n injectCSS: false,\n immediatelyRender: false,\n editorProps: {\n transformPastedHTML: (html) => html.replace(/<img.*?>/g, \"\"),\n attributes: {\n class: cn(\n \"editor-content text-sm max-w-full focus:outline-none\",\n editorProseVariants(),\n editorImageVariants(),\n className,\n ),\n },\n },\n });\n\n if (!editor) return null;\n\n return (\n <EditorContext.Provider\n value={{\n editor,\n extensions: flattenEditorExtensionsConfig(extensions),\n }}\n >\n <div className={editorVariants({ variant })}>{children}</div>\n </EditorContext.Provider>\n );\n}\n"],"mappings":";;;;;;;;;;;AAuBA,MAAa,gBAAgB,cAAc,EAAE,CAAuB;;;;AAKpE,MAAa,iBAAiB,IAAI,IAAI;CACpC,UAAU,EACR,SAAS;EACP,SACE;EACF,OACE;EACF,SAAS;EACV,EACF;CACD,iBAAiB,EACf,SAAS,WACV;CACF,CAAC;AAeF,SAAgBA,SAAO,EACrB,OACA,YACA,UACA,QACA,UACA,SACA,WACA,YACc;CACd,MAAM,SAAS,UAAU;EACvB,YAAY,mCAAmC,WAAW;EAC1D,SAAS;EACT,WAAW,EAAE,uBAAa,WAAWC,SAAO,SAAS,CAAC;EACtD,SAAS,EAAE,uBAAa,SAASA,SAAO,SAAS,CAAC;EAClD,UAAU,CAAC;EACX,WAAW;EACX,mBAAmB;EACnB,aAAa;GACX,sBAAsB,SAAS,KAAK,QAAQ,aAAa,GAAG;GAC5D,YAAY,EACV,OAAO,GACL,wDACA,qBAAqB,EACrB,qBAAqB,EACrB,UACD,EACF;GACF;EACF,CAAC;AAEF,KAAI,CAAC,OAAQ,QAAO;AAEpB,QACE,oBAAC,cAAc;EACb,OAAO;GACL;GACA,YAAY,8BAA8B,WAAW;GACtD;YAED,oBAAC;GAAI,WAAW,eAAe,EAAE,SAAS,CAAC;GAAG;IAAe;GACtC"}
@@ -1,10 +1,10 @@
1
- import * as react_jsx_runtime262 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime261 from "react/jsx-runtime";
2
2
  import { ComponentProps } from "react";
3
3
  import { BubbleMenu } from "@tiptap/react/menus";
4
4
 
5
5
  //#region src/components/editor/components/menu.client.d.ts
6
- declare function EditorMenuFixed(props: React.ComponentProps<"div">): react_jsx_runtime262.JSX.Element;
7
- declare function EditorMenuBubble(props: ComponentProps<typeof BubbleMenu>): react_jsx_runtime262.JSX.Element;
6
+ declare function EditorMenuFixed(props: React.ComponentProps<"div">): react_jsx_runtime261.JSX.Element;
7
+ declare function EditorMenuBubble(props: ComponentProps<typeof BubbleMenu>): react_jsx_runtime261.JSX.Element;
8
8
  //#endregion
9
9
  export { EditorMenuBubble, EditorMenuFixed };
10
10
  //# sourceMappingURL=menu.client.d.mts.map
@@ -160,6 +160,9 @@ function EditorMenuColor() {
160
160
  ]
161
161
  });
162
162
  }
163
+ /**
164
+ * Editor menu image
165
+ */
163
166
 
164
167
  //#endregion
165
168
  export { EditorMenuBubble, EditorMenuFixed };
@@ -1 +1 @@
1
- {"version":3,"file":"menu.client.mjs","names":[],"sources":["../../../../src/components/editor/components/menu.client.tsx"],"sourcesContent":["import { Button } from \"@/components/ui/button\";\nimport { ColorPicker } from \"@/components/ui/color-picker.client\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"@/components/ui/popover\";\nimport { cn } from \"@/lib/entry\";\nimport { BubbleMenu } from \"@tiptap/react/menus\";\nimport {\n BaselineIcon,\n BoldIcon,\n EraserIcon,\n ItalicIcon,\n PaintBucketIcon,\n RedoIcon,\n StrikethroughIcon,\n UnderlineIcon,\n UndoIcon,\n} from \"lucide-react\";\nimport { ComponentProps, PropsWithChildren, useContext } from \"react\";\nimport { EditorContext } from \"./editor.client\";\nimport { EditorMenuNodes } from \"./menu-nodes.client\";\n\nexport function EditorMenuFixed(props: React.ComponentProps<\"div\">) {\n return (\n <div\n {...props}\n className={cn(\"border-input bg-muted/30 z-10 overflow-auto border-b p-2\", props.className)}\n >\n <EditorMenuContent>\n <EditorMenuUndoRedo />\n <EditorMenuNodes />\n <EditorMenuMarks />\n <EditorMenuColor />\n </EditorMenuContent>\n </div>\n );\n}\n\nexport function EditorMenuBubble(props: ComponentProps<typeof BubbleMenu>) {\n const { editor } = useContext(EditorContext);\n\n return (\n <BubbleMenu\n {...props}\n editor={editor}\n options={{ ...props.options, strategy: \"fixed\" }}\n className={cn(\"border-input bg-muted z-10 rounded-lg border p-2\", props.className)}\n >\n <EditorMenuContent>\n <EditorMenuMarks />\n </EditorMenuContent>\n </BubbleMenu>\n );\n}\n\nfunction EditorMenuContent(props: PropsWithChildren) {\n return <div className=\"flex items-center gap-6\">{props.children}</div>;\n}\n\n/**\n * Editor menu undo/redo\n */\nfunction EditorMenuUndoRedo() {\n const { editor, extensions } = useContext(EditorContext);\n\n if (!extensions.undoRedo) return null;\n\n return (\n <div className=\"flex items-center gap-1\">\n <Button\n onClick={() => editor.commands.undo()}\n disabled={!editor?.can().undo()}\n type=\"button\"\n aria-label=\"Undo\"\n size=\"icon\"\n className=\"p-2\"\n variant=\"outline\"\n >\n <UndoIcon className=\"size-3.5\" />\n </Button>\n\n <Button\n onClick={() => editor.commands.redo()}\n disabled={!editor?.can().redo()}\n type=\"button\"\n aria-label=\"Redo\"\n size=\"icon\"\n className=\"p-2\"\n variant=\"outline\"\n >\n <RedoIcon className=\"size-3.5\" />\n </Button>\n </div>\n );\n}\n\n/**\n * Editor menu marks\n */\nfunction EditorMenuMarks() {\n const { editor, extensions } = useContext(EditorContext);\n\n if (!extensions.bold && !extensions.italic && !extensions.underline && !extensions.strike) {\n return null;\n }\n\n return (\n <div className=\"flex items-center gap-1\">\n {extensions.bold && (\n <Button\n type=\"button\"\n size=\"icon\"\n variant={editor?.isActive(\"bold\") ? \"secondary\" : \"outline\"}\n onClick={() => editor.chain().focus().toggleBold().run()}\n className=\"border\"\n >\n <BoldIcon className=\"h-3.5 w-3.5\" />\n </Button>\n )}\n\n {extensions.italic && (\n <Button\n type=\"button\"\n size=\"icon\"\n variant={editor?.isActive(\"italic\") ? \"secondary\" : \"outline\"}\n onClick={() => editor.chain().focus().toggleItalic().run()}\n className=\"border\"\n >\n <ItalicIcon className=\"size-3.5\" />\n </Button>\n )}\n\n {extensions.underline && (\n <Button\n type=\"button\"\n size=\"icon\"\n variant={editor?.isActive(\"underline\") ? \"secondary\" : \"outline\"}\n onClick={() => editor.chain().focus().toggleUnderline().run()}\n className=\"border\"\n >\n <UnderlineIcon className=\"size-3.5\" />\n </Button>\n )}\n\n {extensions.strike && (\n <Button\n type=\"button\"\n size=\"icon\"\n variant={editor?.isActive(\"strike\") ? \"secondary\" : \"outline\"}\n onClick={() => editor.chain().focus().toggleStrike().run()}\n className=\"border\"\n >\n <StrikethroughIcon className=\"size-3.5\" />\n </Button>\n )}\n </div>\n );\n}\n\n/**\n * Editor menu alignment\n */\nfunction EditorMenuColor() {\n const { editor, extensions } = useContext(EditorContext);\n\n if (!extensions.color && !extensions.highlight) {\n return null;\n }\n\n return (\n <div className=\"flex items-center gap-1\">\n {extensions.color && (\n <Popover>\n <PopoverTrigger asChild>\n <Button size=\"icon\" variant=\"outline\">\n <BaselineIcon className=\"size-3.5\" />\n </Button>\n </PopoverTrigger>\n\n <PopoverContent className=\"w-fit p-0\">\n <ColorPicker onValueChange={(color) => editor.chain().focus().setColor(color).run()} />\n </PopoverContent>\n </Popover>\n )}\n\n {extensions.highlight && (\n <Popover>\n <PopoverTrigger asChild>\n <Button size=\"icon\" variant=\"outline\" disabled={!editor?.can().setHighlight()}>\n <PaintBucketIcon className=\"size-3.5\" />\n </Button>\n </PopoverTrigger>\n\n <PopoverContent className=\"w-fit p-0\">\n <ColorPicker\n onValueChange={(color) => editor.chain().focus().setHighlight({ color }).run()}\n />\n </PopoverContent>\n </Popover>\n )}\n\n <Button\n type=\"button\"\n size=\"icon\"\n variant=\"outline\"\n className=\"border\"\n onClick={() => {\n editor.commands.unsetColor();\n editor.commands.unsetHighlight();\n }}\n >\n <EraserIcon className=\"h-4 w-4\" />\n </Button>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAoBA,SAAgB,gBAAgB,OAAoC;AAClE,QACE,oBAAC;EACC,GAAI;EACJ,WAAW,GAAG,4DAA4D,MAAM,UAAU;YAE1F,qBAAC;GACC,oBAAC,uBAAqB;GACtB,oBAAC,oBAAkB;GACnB,oBAAC,oBAAkB;GACnB,oBAAC,oBAAkB;MACD;GAChB;;AAIV,SAAgB,iBAAiB,OAA0C;CACzE,MAAM,EAAE,WAAW,WAAW,cAAc;AAE5C,QACE,oBAAC;EACC,GAAI;EACI;EACR,SAAS;GAAE,GAAG,MAAM;GAAS,UAAU;GAAS;EAChD,WAAW,GAAG,oDAAoD,MAAM,UAAU;YAElF,oB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;;cAGlC,oBAAC,cAAW,WAAU,YAAY;KAC3B;;GACL"}
1
+ {"version":3,"file":"menu.client.mjs","names":[],"sources":["../../../../src/components/editor/components/menu.client.tsx"],"sourcesContent":["import { Button } from \"@/components/ui/button\";\nimport { ColorPicker } from \"@/components/ui/color-picker.client\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"@/components/ui/popover\";\nimport { cn } from \"@/lib/entry\";\nimport { BubbleMenu } from \"@tiptap/react/menus\";\nimport {\n BaselineIcon,\n BoldIcon,\n EraserIcon,\n ItalicIcon,\n PaintBucketIcon,\n RedoIcon,\n StrikethroughIcon,\n UnderlineIcon,\n UndoIcon,\n} from \"lucide-react\";\nimport { ComponentProps, PropsWithChildren, useContext } from \"react\";\nimport { EditorContext } from \"./editor.client\";\nimport { EditorMenuNodes } from \"./menu-nodes.client\";\n\nexport function EditorMenuFixed(props: React.ComponentProps<\"div\">) {\n return (\n <div\n {...props}\n className={cn(\"border-input bg-muted/30 z-10 overflow-auto border-b p-2\", props.className)}\n >\n <EditorMenuContent>\n <EditorMenuUndoRedo />\n <EditorMenuNodes />\n <EditorMenuMarks />\n <EditorMenuColor />\n </EditorMenuContent>\n </div>\n );\n}\n\nexport function EditorMenuBubble(props: ComponentProps<typeof BubbleMenu>) {\n const { editor } = useContext(EditorContext);\n\n return (\n <BubbleMenu\n {...props}\n editor={editor}\n options={{ ...props.options, strategy: \"fixed\" }}\n className={cn(\"border-input bg-muted z-10 rounded-lg border p-2\", props.className)}\n >\n <EditorMenuContent>\n <EditorMenuMarks />\n </EditorMenuContent>\n </BubbleMenu>\n );\n}\n\nfunction EditorMenuContent(props: PropsWithChildren) {\n return <div className=\"flex items-center gap-6\">{props.children}</div>;\n}\n\n/**\n * Editor menu undo/redo\n */\nfunction EditorMenuUndoRedo() {\n const { editor, extensions } = useContext(EditorContext);\n\n if (!extensions.undoRedo) return null;\n\n return (\n <div className=\"flex items-center gap-1\">\n <Button\n onClick={() => editor.commands.undo()}\n disabled={!editor?.can().undo()}\n type=\"button\"\n aria-label=\"Undo\"\n size=\"icon\"\n className=\"p-2\"\n variant=\"outline\"\n >\n <UndoIcon className=\"size-3.5\" />\n </Button>\n\n <Button\n onClick={() => editor.commands.redo()}\n disabled={!editor?.can().redo()}\n type=\"button\"\n aria-label=\"Redo\"\n size=\"icon\"\n className=\"p-2\"\n variant=\"outline\"\n >\n <RedoIcon className=\"size-3.5\" />\n </Button>\n </div>\n );\n}\n\n/**\n * Editor menu marks\n */\nfunction EditorMenuMarks() {\n const { editor, extensions } = useContext(EditorContext);\n\n if (!extensions.bold && !extensions.italic && !extensions.underline && !extensions.strike) {\n return null;\n }\n\n return (\n <div className=\"flex items-center gap-1\">\n {extensions.bold && (\n <Button\n type=\"button\"\n size=\"icon\"\n variant={editor?.isActive(\"bold\") ? \"secondary\" : \"outline\"}\n onClick={() => editor.chain().focus().toggleBold().run()}\n className=\"border\"\n >\n <BoldIcon className=\"h-3.5 w-3.5\" />\n </Button>\n )}\n\n {extensions.italic && (\n <Button\n type=\"button\"\n size=\"icon\"\n variant={editor?.isActive(\"italic\") ? \"secondary\" : \"outline\"}\n onClick={() => editor.chain().focus().toggleItalic().run()}\n className=\"border\"\n >\n <ItalicIcon className=\"size-3.5\" />\n </Button>\n )}\n\n {extensions.underline && (\n <Button\n type=\"button\"\n size=\"icon\"\n variant={editor?.isActive(\"underline\") ? \"secondary\" : \"outline\"}\n onClick={() => editor.chain().focus().toggleUnderline().run()}\n className=\"border\"\n >\n <UnderlineIcon className=\"size-3.5\" />\n </Button>\n )}\n\n {extensions.strike && (\n <Button\n type=\"button\"\n size=\"icon\"\n variant={editor?.isActive(\"strike\") ? \"secondary\" : \"outline\"}\n onClick={() => editor.chain().focus().toggleStrike().run()}\n className=\"border\"\n >\n <StrikethroughIcon className=\"size-3.5\" />\n </Button>\n )}\n </div>\n );\n}\n\n/**\n * Editor menu alignment\n */\nfunction EditorMenuColor() {\n const { editor, extensions } = useContext(EditorContext);\n\n if (!extensions.color && !extensions.highlight) {\n return null;\n }\n\n return (\n <div className=\"flex items-center gap-1\">\n {extensions.color && (\n <Popover>\n <PopoverTrigger asChild>\n <Button size=\"icon\" variant=\"outline\">\n <BaselineIcon className=\"size-3.5\" />\n </Button>\n </PopoverTrigger>\n\n <PopoverContent className=\"w-fit p-0\">\n <ColorPicker onValueChange={(color) => editor.chain().focus().setColor(color).run()} />\n </PopoverContent>\n </Popover>\n )}\n\n {extensions.highlight && (\n <Popover>\n <PopoverTrigger asChild>\n <Button size=\"icon\" variant=\"outline\" disabled={!editor?.can().setHighlight()}>\n <PaintBucketIcon className=\"size-3.5\" />\n </Button>\n </PopoverTrigger>\n\n <PopoverContent className=\"w-fit p-0\">\n <ColorPicker\n onValueChange={(color) => editor.chain().focus().setHighlight({ color }).run()}\n />\n </PopoverContent>\n </Popover>\n )}\n\n <Button\n type=\"button\"\n size=\"icon\"\n variant=\"outline\"\n className=\"border\"\n onClick={() => {\n editor.commands.unsetColor();\n editor.commands.unsetHighlight();\n }}\n >\n <EraserIcon className=\"h-4 w-4\" />\n </Button>\n </div>\n );\n}\n\n/**\n * Editor menu image\n */\n// function EditorMenuImage() {\n// const { editor, extensions } = useContext(EditorContext);\n\n// if (!extensions.image) return null;\n\n// return (\n// <div className=\"flex items-center gap-1\">\n// {extensions.image && (\n// <Button\n// type=\"button\"\n// size=\"icon\"\n// variant=\"outline\"\n// onClick={() => editor.chain().focus().downloadImage().run()}\n// disabled={!editor?.can().downloadImage()}\n// className=\"border\"\n// >\n// <DownloadIcon className=\"size-3.5\" />\n// </Button>\n// )}\n// </div>\n// );\n// }\n"],"mappings":";;;;;;;;;;;;AAoBA,SAAgB,gBAAgB,OAAoC;AAClE,QACE,oBAAC;EACC,GAAI;EACJ,WAAW,GAAG,4DAA4D,MAAM,UAAU;YAE1F,qBAAC;GACC,oBAAC,uBAAqB;GACtB,oBAAC,oBAAkB;GACnB,oBAAC,oBAAkB;GACnB,oBAAC,oBAAkB;MACD;GAChB;;AAIV,SAAgB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AO,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC,KAAK,GAC9E;KACa,IACT;GAGZ,oBAAC;IACC,MAAK;IACL,MAAK;IACL,SAAQ;IACR,WAAU;IACV,eAAe;AACb,YAAO,SAAS,YAAY;AAC5B,YAAO,SAAS,gBAAgB;;cAGlC,oBAAC,cAAW,WAAU,YAAY;KAC3B;;GACL"}
@@ -0,0 +1,21 @@
1
+ import { FileHandlerOptions } from "@tiptap/extension-file-handler";
2
+ import "@tiptap/core";
3
+
4
+ //#region src/components/editor/extensions/file-handler/extension.d.ts
5
+ interface FileHandlerOptions$1 extends FileHandlerOptions {
6
+ /**
7
+ * Callback function invoked when a image reference is removed from the editor. Receives the node ID of the removed node.
8
+ * @type {(nodeId: string) => void}
9
+ * @default undefined
10
+ **/
11
+ onReferenceRemoved?: (nodeId: string) => void;
12
+ /**
13
+ * Callback function invoked when a image reference is added to the editor. Receives the node ID of the added node.
14
+ * @type {(nodeId: string) => void}
15
+ * @default undefined
16
+ **/
17
+ onReferenceAdded?: (nodeId: string) => void;
18
+ }
19
+ //#endregion
20
+ export { FileHandlerOptions$1 as FileHandlerOptions };
21
+ //# sourceMappingURL=extension.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extension.d.mts","names":[],"sources":["../../../../../src/components/editor/extensions/file-handler/extension.ts"],"sourcesContent":[],"mappings":";;;;UASiB,oBAAA,SAA2B;;;AAA5C"}
@@ -0,0 +1,40 @@
1
+ "use client";
2
+
3
+ import { collectImageIds, diffIds } from "./utils.mjs";
4
+ import { Plugin, PluginKey } from "@tiptap/pm/state";
5
+ import { FileHandler } from "@tiptap/extension-file-handler";
6
+
7
+ //#region src/components/editor/extensions/file-handler/extension.ts
8
+ /**
9
+ * File Handler extension for Tiptap Editor
10
+ */
11
+ const FileHandler$1 = FileHandler.extend({
12
+ addOptions() {
13
+ return {
14
+ ...this.parent?.(),
15
+ onReferenceRemoved: void 0,
16
+ onReferenceAdded: void 0
17
+ };
18
+ },
19
+ addProseMirrorPlugins() {
20
+ const parent = this.parent?.() ?? [];
21
+ const key = new PluginKey("fileHandlerItemTracker");
22
+ return [...parent, new Plugin({
23
+ key,
24
+ appendTransaction: (trs, oldState, newState) => {
25
+ if (!trs.some((tr) => tr.docChanged)) return null;
26
+ const onReferenceRemoved = this.options.onReferenceRemoved;
27
+ const onReferenceAdded = this.options.onReferenceAdded;
28
+ if (!onReferenceRemoved && !onReferenceAdded) return null;
29
+ const { removed, added } = diffIds(collectImageIds(oldState.doc), collectImageIds(newState.doc));
30
+ for (const id of removed) onReferenceRemoved?.(id);
31
+ for (const id of added) onReferenceAdded?.(id);
32
+ return null;
33
+ }
34
+ })];
35
+ }
36
+ });
37
+
38
+ //#endregion
39
+ export { FileHandler$1 as FileHandler };
40
+ //# sourceMappingURL=extension.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extension.mjs","names":["FileHandler","TiptapFileHandler"],"sources":["../../../../../src/components/editor/extensions/file-handler/extension.ts"],"sourcesContent":["\"use client\";\n\nimport {\n FileHandler as TiptapFileHandler,\n FileHandlerOptions as TiptapFileHandlerOptions,\n} from \"@tiptap/extension-file-handler\";\nimport { Plugin, PluginKey } from \"@tiptap/pm/state\";\nimport { collectImageIds, diffIds } from \"./utils\";\n\nexport interface FileHandlerOptions extends TiptapFileHandlerOptions {\n /**\n * Callback function invoked when a image reference is removed from the editor. Receives the node ID of the removed node.\n * @type {(nodeId: string) => void}\n * @default undefined\n **/\n onReferenceRemoved?: (nodeId: string) => void;\n\n /**\n * Callback function invoked when a image reference is added to the editor. Receives the node ID of the added node.\n * @type {(nodeId: string) => void}\n * @default undefined\n **/\n onReferenceAdded?: (nodeId: string) => void;\n}\n\n/**\n * File Handler extension for Tiptap Editor\n */\nexport const FileHandler = TiptapFileHandler.extend<FileHandlerOptions>({\n addOptions() {\n return {\n ...this.parent?.(),\n onReferenceRemoved: undefined,\n onReferenceAdded: undefined,\n };\n },\n addProseMirrorPlugins() {\n const parent = this.parent?.() ?? [];\n const key = new PluginKey(\"fileHandlerItemTracker\");\n\n return [\n ...parent,\n new Plugin({\n key,\n appendTransaction: (trs, oldState, newState) => {\n if (!trs.some((tr) => tr.docChanged)) return null;\n\n const onReferenceRemoved = this.options.onReferenceRemoved;\n const onReferenceAdded = this.options.onReferenceAdded;\n if (!onReferenceRemoved && !onReferenceAdded) return null;\n\n const before = collectImageIds(oldState.doc);\n const after = collectImageIds(newState.doc);\n const { removed, added } = diffIds(before, after);\n\n for (const id of removed) {\n onReferenceRemoved?.(id);\n }\n\n for (const id of added) {\n onReferenceAdded?.(id);\n }\n\n return null;\n },\n }),\n ];\n },\n});\n"],"mappings":";;;;;;;;;;AA4BA,MAAaA,gBAAcC,YAAkB,OAA2B;CACtE,aAAa;AACX,SAAO;GACL,GAAG,KAAK,UAAU;GAClB,oBAAoB;GACpB,kBAAkB;GACnB;;CAEH,wBAAwB;EACtB,MAAM,SAAS,KAAK,UAAU,IAAI,EAAE;EACpC,MAAM,MAAM,IAAI,UAAU,yBAAyB;AAEnD,SAAO,CACL,GAAG,QACH,IAAI,OAAO;GACT;GACA,oBAAoB,KAAK,UAAU,aAAa;AAC9C,QAAI,CAAC,IAAI,MAAM,OAAO,GAAG,WAAW,CAAE,QAAO;IAE7C,MAAM,qBAAqB,KAAK,QAAQ;IACxC,MAAM,mBAAmB,KAAK,QAAQ;AACtC,QAAI,CAAC,sBAAsB,CAAC,iBAAkB,QAAO;IAIrD,MAAM,EAAE,SAAS,UAAU,QAFZ,gBAAgB,SAAS,IAAI,EAC9B,gBAAgB,SAAS,IAAI,CACM;AAEjD,SAAK,MAAM,MAAM,QACf,sBAAqB,GAAG;AAG1B,SAAK,MAAM,MAAM,MACf,oBAAmB,GAAG;AAGxB,WAAO;;GAEV,CAAC,CACH;;CAEJ,CAAC"}
@@ -0,0 +1,29 @@
1
+ import { FileHandlerOptions } from "./extension.mjs";
2
+ import { SelectNodeSchema, UploadFileSchema } from "../../../../modules/storage/lib/validators.mjs";
3
+ import "../../../../storage.mjs";
4
+ import { UploadClient, UploadHooks } from "../../../../modules/storage/lib/create-upload.client.mjs";
5
+ import "../../../../storage/client.mjs";
6
+
7
+ //#region src/components/editor/extensions/file-handler/strategy.d.ts
8
+ /**
9
+ * Handle File Handler props
10
+ */
11
+ type CreateFileHandlerUploadStrategyProps = {
12
+ variables: Pick<UploadFileSchema, "namespace" | "parentId" | "mode" | "hidden" | "readonly">;
13
+ uploadClient: UploadClient;
14
+ uploadHooks?: UploadHooks;
15
+ allowedMimeTypes?: string[];
16
+ onUploadCompleted?: (node: SelectNodeSchema) => Promise<void> | void;
17
+ onUploadFailed?: (error: unknown) => Promise<void> | void;
18
+ };
19
+ declare function createFileHandlerUploadStrategy({
20
+ variables,
21
+ uploadClient,
22
+ uploadHooks,
23
+ onUploadCompleted,
24
+ onUploadFailed,
25
+ allowedMimeTypes
26
+ }: CreateFileHandlerUploadStrategyProps): FileHandlerOptions;
27
+ //#endregion
28
+ export { createFileHandlerUploadStrategy };
29
+ //# sourceMappingURL=strategy.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"strategy.d.mts","names":[],"sources":["../../../../../src/components/editor/extensions/file-handler/strategy.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;KASK,oCAAA;EAAA,SAAA,EACQ,IADR,CACa,gBADb,EAAA,WAAoC,GAAA,UAAA,GAAA,MAAA,GAAA,QAAA,GAAA,UAAA,CAAA;EACvB,YAAA,EACF,YADE;EAAL,WAAA,CAAA,EAEG,WAFH;EACG,gBAAA,CAAA,EAAA,MAAA,EAAA;EACA,iBAAA,CAAA,EAAA,CAAA,IAAA,EAEa,gBAFb,EAAA,GAEkC,OAFlC,CAAA,IAAA,CAAA,GAAA,IAAA;EAEa,cAAA,CAAA,EAAA,CAAA,KAAA,EAAA,OAAA,EAAA,GACU,OADV,CAAA,IAAA,CAAA,GAAA,IAAA;CAAqB;AACX,iBAGvB,+BAAA,CAHuB;EAAA,SAAA;EAAA,YAAA;EAAA,WAAA;EAAA,iBAAA;EAAA,cAAA;EAAA;AAAA,CAAA,EAUpC,oCAVoC,CAAA,EAUG,kBAVH"}
@@ -0,0 +1,111 @@
1
+ import { TextSelection } from "@tiptap/pm/state";
2
+
3
+ //#region src/components/editor/extensions/file-handler/strategy.ts
4
+ function createFileHandlerUploadStrategy({ variables, uploadClient, uploadHooks, onUploadCompleted, onUploadFailed, allowedMimeTypes }) {
5
+ const handleUpload = async (editor, files, startPos) => {
6
+ const insertPos = startPos;
7
+ for (const file of files) {
8
+ /**
9
+ * Prepare upload
10
+ */
11
+ const input = uploadClient.prepareUpload({
12
+ file,
13
+ ...variables
14
+ });
15
+ const imageType = editor.schema.nodes.image;
16
+ if (!imageType) {
17
+ console.error("Image type not found");
18
+ return;
19
+ }
20
+ try {
21
+ /**
22
+ * Create skeleton node
23
+ */
24
+ const skeletonNode = editor.schema.nodes.skeleton?.create({
25
+ imageNodeId: input.id,
26
+ width: 500,
27
+ height: 500
28
+ });
29
+ /**
30
+ * Insert skeleton node into the document
31
+ */
32
+ if (skeletonNode) {
33
+ const tr = editor.state.tr.insert(insertPos, skeletonNode);
34
+ tr.setSelection(TextSelection.create(tr.doc, insertPos + skeletonNode.nodeSize));
35
+ tr.setMeta("addToHistory", false);
36
+ editor.view.dispatch(tr);
37
+ }
38
+ /**
39
+ * Upload the file
40
+ */
41
+ const fileNode = await uploadClient.upload(input, uploadHooks);
42
+ /**
43
+ * Replace skeleton with image node
44
+ */
45
+ const replacedTr = editor.state.tr;
46
+ let replaced = false;
47
+ replacedTr.doc.descendants((node, pos) => {
48
+ if (node.type.name === "skeleton" && node.attrs?.imageNodeId === input.id) {
49
+ const imageNode = imageType.create({
50
+ nodeId: fileNode.id,
51
+ alt: file.name,
52
+ fileName: file.name,
53
+ width: node.attrs.width ?? 500
54
+ });
55
+ replacedTr.replaceWith(pos, pos + node.nodeSize, imageNode);
56
+ replaced = true;
57
+ return false;
58
+ }
59
+ });
60
+ if (replaced) editor.view.dispatch(replacedTr);
61
+ else {
62
+ const tr = editor.state.tr;
63
+ const imageNode = imageType.create({
64
+ nodeId: fileNode.id,
65
+ alt: file.name,
66
+ fileName: file.name,
67
+ width: 500
68
+ });
69
+ tr.insert(insertPos, imageNode);
70
+ editor.view.dispatch(tr);
71
+ }
72
+ await onUploadCompleted?.(fileNode);
73
+ } catch (err) {
74
+ console.error("Upload error:", err);
75
+ /**
76
+ * Remove the pending image node from the document
77
+ */
78
+ const tr = editor.state.tr;
79
+ tr.doc.descendants((node, pos) => {
80
+ if (node.type.name === "image" && node.attrs?.nodeId === input.id) {
81
+ tr.delete(pos, pos + node.nodeSize);
82
+ return false;
83
+ }
84
+ });
85
+ editor.view.dispatch(tr);
86
+ await onUploadFailed?.(err);
87
+ }
88
+ }
89
+ };
90
+ return {
91
+ allowedMimeTypes,
92
+ onDrop: async (editor, files, pos) => {
93
+ await handleUpload(editor, files, pos);
94
+ },
95
+ onPaste: async (editor, files, htmlContent) => {
96
+ if (htmlContent?.length) return;
97
+ const startPos = editor.state.selection.anchor;
98
+ await handleUpload(editor, files, startPos);
99
+ },
100
+ onReferenceRemoved: async (nodeId) => {
101
+ await uploadClient.updateNode(nodeId, { orphanedAt: /* @__PURE__ */ new Date() });
102
+ },
103
+ onReferenceAdded: async (nodeId) => {
104
+ await uploadClient.updateNode(nodeId, { orphanedAt: null });
105
+ }
106
+ };
107
+ }
108
+
109
+ //#endregion
110
+ export { createFileHandlerUploadStrategy };
111
+ //# sourceMappingURL=strategy.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"strategy.mjs","names":[],"sources":["../../../../../src/components/editor/extensions/file-handler/strategy.ts"],"sourcesContent":["import { SelectNodeSchema, UploadFileSchema } from \"@/modules/storage/entry\";\nimport { UploadClient, UploadHooks } from \"@/modules/storage/entry.client\";\nimport { Editor } from \"@tiptap/core\";\nimport { TextSelection } from \"@tiptap/pm/state\";\nimport { FileHandlerOptions } from \"./extension\";\n\n/**\n * Handle File Handler props\n */\ntype CreateFileHandlerUploadStrategyProps = {\n variables: Pick<UploadFileSchema, \"namespace\" | \"parentId\" | \"mode\" | \"hidden\" | \"readonly\">;\n uploadClient: UploadClient;\n uploadHooks?: UploadHooks;\n allowedMimeTypes?: string[];\n onUploadCompleted?: (node: SelectNodeSchema) => Promise<void> | void;\n onUploadFailed?: (error: unknown) => Promise<void> | void;\n};\n\nexport function createFileHandlerUploadStrategy({\n variables,\n uploadClient,\n uploadHooks,\n onUploadCompleted,\n onUploadFailed,\n allowedMimeTypes,\n}: CreateFileHandlerUploadStrategyProps): FileHandlerOptions {\n const handleUpload = async (editor: Editor, files: File[], startPos: number) => {\n const insertPos = startPos;\n\n for (const file of files) {\n /**\n * Prepare upload\n */\n const input = uploadClient.prepareUpload({ file, ...variables });\n\n const imageType = editor.schema.nodes.image;\n if (!imageType) {\n console.error(\"Image type not found\");\n return;\n }\n\n try {\n /**\n * Create skeleton node\n */\n const skeletonNode = editor.schema.nodes.skeleton?.create({\n imageNodeId: input.id,\n width: 500,\n height: 500,\n });\n\n /**\n * Insert skeleton node into the document\n */\n if (skeletonNode) {\n // editor.chain().insertContentAt(insertPos, skeletonNode).focus().run();\n const tr = editor.state.tr.insert(insertPos, skeletonNode);\n tr.setSelection(TextSelection.create(tr.doc, insertPos + skeletonNode.nodeSize));\n tr.setMeta(\"addToHistory\", false);\n editor.view.dispatch(tr);\n }\n\n /**\n * Upload the file\n */\n const fileNode = await uploadClient.upload(input, uploadHooks);\n\n /**\n * Replace skeleton with image node\n */\n const replacedTr = editor.state.tr;\n let replaced = false;\n\n replacedTr.doc.descendants((node, pos) => {\n if (node.type.name === \"skeleton\" && node.attrs?.imageNodeId === input.id) {\n const imageNode = imageType.create({\n nodeId: fileNode.id,\n alt: file.name,\n fileName: file.name,\n width: node.attrs.width ?? 500,\n });\n\n replacedTr.replaceWith(pos, pos + node.nodeSize, imageNode);\n replaced = true;\n return false;\n }\n });\n\n if (replaced) {\n editor.view.dispatch(replacedTr);\n } else {\n // In case skeleton is not found, insert the image node at the original position\n const tr = editor.state.tr;\n const imageNode = imageType.create({\n nodeId: fileNode.id,\n alt: file.name,\n fileName: file.name,\n width: 500,\n });\n tr.insert(insertPos, imageNode);\n editor.view.dispatch(tr);\n }\n\n // /**\n // * Remove skeleton node from the document\n // */\n // const tr = editor.state.tr;\n // tr.doc.descendants((node, pos) => {\n // if (node.type.name === \"skeleton\" && node.attrs?.imageNodeId === input.id) {\n // tr.delete(pos, pos + node.nodeSize);\n // return false;\n // }\n // });\n // editor.view.dispatch(tr);\n\n // /**\n // * Add image node to the document\n // */\n // const imageNode = imageType.create({\n // nodeId: fileNode.id,\n // alt: file.name,\n // fileName: file.name,\n // width: 500,\n // });\n // editor.commands.insertContentAt(insertPos, imageNode);\n // // insertPos += imageNode.nodeSize - skeletonNode.nodeSize;\n\n await onUploadCompleted?.(fileNode);\n } catch (err) {\n console.error(\"Upload error:\", err);\n\n /**\n * Remove the pending image node from the document\n */\n const tr = editor.state.tr;\n tr.doc.descendants((node, pos) => {\n if (node.type.name === \"image\" && node.attrs?.nodeId === input.id) {\n tr.delete(pos, pos + node.nodeSize);\n return false;\n }\n });\n editor.view.dispatch(tr);\n\n await onUploadFailed?.(err);\n }\n }\n };\n\n return {\n allowedMimeTypes,\n onDrop: async (editor, files, pos) => {\n await handleUpload(editor, files, pos);\n },\n onPaste: async (editor, files, htmlContent) => {\n if (htmlContent?.length) return;\n\n const startPos = editor.state.selection.anchor;\n await handleUpload(editor, files, startPos);\n },\n onReferenceRemoved: async (nodeId) => {\n await uploadClient.updateNode(nodeId, { orphanedAt: new Date() });\n },\n onReferenceAdded: async (nodeId) => {\n await uploadClient.updateNode(nodeId, { orphanedAt: null });\n },\n };\n}\n"],"mappings":";;;AAkBA,SAAgB,gCAAgC,EAC9C,WACA,cACA,aACA,mBACA,gBACA,oBAC2D;CAC3D,MAAM,eAAe,OAAO,QAAgB,OAAe,aAAqB;EAC9E,MAAM,YAAY;AAElB,OAAK,MAAM,QAAQ,OAAO;;;;GA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MAAM,KAAK,OAAO,MAAM;AACxB,OAAG,IAAI,aAAa,MAAM,QAAQ;AAChC,SAAI,KAAK,KAAK,SAAS,WAAW,KAAK,OAAO,WAAW,MAAM,IAAI;AACjE,SAAG,OAAO,KAAK,MAAM,KAAK,SAAS;AACnC,aAAO;;MAET;AACF,WAAO,KAAK,SAAS,GAAG;AAExB,UAAM,iBAAiB,IAAI;;;;AAKjC,QAAO;EACL;EACA,QAAQ,OAAO,QAAQ,OAAO,QAAQ;AACpC,SAAM,aAAa,QAAQ,OAAO,IAAI;;EAExC,SAAS,OAAO,QAAQ,OAAO,gBAAgB;AAC7C,OAAI,aAAa,OAAQ;GAEzB,MAAM,WAAW,OAAO,MAAM,UAAU;AACxC,SAAM,aAAa,QAAQ,OAAO,SAAS;;EAE7C,oBAAoB,OAAO,WAAW;AACpC,SAAM,aAAa,WAAW,QAAQ,EAAE,4BAAY,IAAI,MAAM,EAAE,CAAC;;EAEnE,kBAAkB,OAAO,WAAW;AAClC,SAAM,aAAa,WAAW,QAAQ,EAAE,YAAY,MAAM,CAAC;;EAE9D"}
@@ -0,0 +1,50 @@
1
+ //#region src/components/editor/extensions/file-handler/utils.ts
2
+ /**
3
+ * Collects and counts all image node IDs from a document.
4
+ *
5
+ * @param doc - The document node to traverse and analyze
6
+ * @returns A Map where keys are image node IDs and values are their occurrence counts
7
+ *
8
+ * @example
9
+ * const imageCounts = collectImageIds(editorDoc);
10
+ * imageCounts.forEach((count, imageId) => {
11
+ * console.log(`Image ${imageId} appears ${count} times`);
12
+ * });
13
+ */
14
+ function collectImageIds(doc) {
15
+ const counts = /* @__PURE__ */ new Map();
16
+ doc.descendants((node) => {
17
+ if (node.type.name !== "image") return;
18
+ const id = node.attrs?.nodeId;
19
+ if (!id) return;
20
+ counts.set(id, (counts.get(id) ?? 0) + 1);
21
+ });
22
+ return counts;
23
+ }
24
+ /**
25
+ * Compares two maps of string keys to numeric values and identifies which keys have been removed or restored.
26
+ * @param before - A Map containing the previous state of string keys with their associated numeric values
27
+ * @param after - A Map containing the current state of string keys with their associated numeric values
28
+ * @returns An object containing two arrays:
29
+ * - `removed`: Array of keys where the numeric value decreased (or was deleted)
30
+ * - `restored`: Array of keys where the numeric value increased
31
+ */
32
+ function diffIds(before, after) {
33
+ const removed = [];
34
+ const added = [];
35
+ const keys = new Set([...before.keys(), ...after.keys()]);
36
+ for (const key of keys) {
37
+ const b = before.get(key) ?? 0;
38
+ const a = after.get(key) ?? 0;
39
+ if (a < b) removed.push(key);
40
+ if (a > b) added.push(key);
41
+ }
42
+ return {
43
+ removed,
44
+ added
45
+ };
46
+ }
47
+
48
+ //#endregion
49
+ export { collectImageIds, diffIds };
50
+ //# sourceMappingURL=utils.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.mjs","names":["removed: string[]","added: string[]"],"sources":["../../../../../src/components/editor/extensions/file-handler/utils.ts"],"sourcesContent":["/**\n * Collects and counts all image node IDs from a document.\n *\n * @param doc - The document node to traverse and analyze\n * @returns A Map where keys are image node IDs and values are their occurrence counts\n *\n * @example\n * const imageCounts = collectImageIds(editorDoc);\n * imageCounts.forEach((count, imageId) => {\n * console.log(`Image ${imageId} appears ${count} times`);\n * });\n */\nexport function collectImageIds(doc: any): Map<string, number> {\n const counts = new Map<string, number>();\n\n doc.descendants((node: any) => {\n if (node.type.name !== \"image\") return;\n\n const id = node.attrs?.nodeId;\n if (!id) return;\n\n counts.set(id, (counts.get(id) ?? 0) + 1);\n });\n\n return counts;\n}\n\n/**\n * Compares two maps of string keys to numeric values and identifies which keys have been removed or restored.\n * @param before - A Map containing the previous state of string keys with their associated numeric values\n * @param after - A Map containing the current state of string keys with their associated numeric values\n * @returns An object containing two arrays:\n * - `removed`: Array of keys where the numeric value decreased (or was deleted)\n * - `restored`: Array of keys where the numeric value increased\n */\nexport function diffIds(before: Map<string, number>, after: Map<string, number>) {\n const removed: string[] = [];\n const added: string[] = [];\n\n const keys = new Set([...before.keys(), ...after.keys()]);\n\n for (const key of keys) {\n const b = before.get(key) ?? 0;\n const a = after.get(key) ?? 0;\n\n if (a < b) removed.push(key);\n if (a > b) added.push(key);\n }\n\n return { removed, added };\n}\n"],"mappings":";;;;;;;;;;;;;AAYA,SAAgB,gBAAgB,KAA+B;CAC7D,MAAM,yBAAS,IAAI,KAAqB;AAExC,KAAI,aAAa,SAAc;AAC7B,MAAI,KAAK,KAAK,SAAS,QAAS;EAEhC,MAAM,KAAK,KAAK,OAAO;AACvB,MAAI,CAAC,GAAI;AAET,SAAO,IAAI,KAAK,OAAO,IAAI,GAAG,IAAI,KAAK,EAAE;GACzC;AAEF,QAAO;;;;;;;;;;AAWT,SAAgB,QAAQ,QAA6B,OAA4B;CAC/E,MAAMA,UAAoB,EAAE;CAC5B,MAAMC,QAAkB,EAAE;CAE1B,MAAM,OAAO,IAAI,IAAI,CAAC,GAAG,OAAO,MAAM,EAAE,GAAG,MAAM,MAAM,CAAC,CAAC;AAEzD,MAAK,MAAM,OAAO,MAAM;EACtB,MAAM,IAAI,OAAO,IAAI,IAAI,IAAI;EAC7B,MAAM,IAAI,MAAM,IAAI,IAAI,IAAI;AAE5B,MAAI,IAAI,EAAG,SAAQ,KAAK,IAAI;AAC5B,MAAI,IAAI,EAAG,OAAM,KAAK,IAAI;;AAG5B,QAAO;EAAE;EAAS;EAAO"}
@@ -0,0 +1,8 @@
1
+ import { ImageOptions } from "@tiptap/extension-image";
2
+ import "@tiptap/core";
3
+
4
+ //#region src/components/editor/extensions/image/extension.d.ts
5
+ interface ImageOptions$1 extends ImageOptions {}
6
+ //#endregion
7
+ export { ImageOptions$1 as ImageOptions };
8
+ //# sourceMappingURL=extension.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extension.d.mts","names":[],"sources":["../../../../../src/components/editor/extensions/image/extension.ts"],"sourcesContent":[],"mappings":";;;;UAKiB,cAAA,SAAqB"}
@@ -0,0 +1,52 @@
1
+ "use client";
2
+
3
+ import { getFileUrl } from "../../../../modules/storage/lib/helpers.mjs";
4
+ import { Image } from "@tiptap/extension-image";
5
+
6
+ //#region src/components/editor/extensions/image/extension.ts
7
+ const Image$1 = Image.extend({
8
+ atom: true,
9
+ addAttributes() {
10
+ return {
11
+ ...this.parent?.(),
12
+ nodeId: {
13
+ default: null,
14
+ parseHTML: (el) => el.getAttribute("data-node-id"),
15
+ renderHTML: (attrs) => {
16
+ if (!attrs.nodeId) return {};
17
+ return {
18
+ "data-node-id": attrs.nodeId,
19
+ ...attrs.nodeId && !attrs.isPending ? { src: getFileUrl(attrs.nodeId) } : {}
20
+ };
21
+ }
22
+ },
23
+ alt: { default: null },
24
+ title: { default: null },
25
+ width: { default: null },
26
+ height: { default: null },
27
+ isPending: {
28
+ default: false,
29
+ renderHTML: (attrs) => attrs.isPending ? { "data-pending": "true" } : {}
30
+ },
31
+ fileName: { default: null }
32
+ };
33
+ },
34
+ parseHTML() {
35
+ return [{ tag: "img[data-node-id]" }];
36
+ },
37
+ renderHTML({ HTMLAttributes }) {
38
+ const { src: _, ...attrs } = HTMLAttributes;
39
+ console.log("attrs", attrs);
40
+ const nodeId = attrs.nodeId;
41
+ const isPending = Boolean(attrs.isPending);
42
+ const src = nodeId && !isPending ? getFileUrl(nodeId) : null;
43
+ return ["img", {
44
+ ...attrs,
45
+ ...src ? { src } : {}
46
+ }];
47
+ }
48
+ });
49
+
50
+ //#endregion
51
+ export { Image$1 as Image };
52
+ //# sourceMappingURL=extension.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extension.mjs","names":["Image","TiptapImage"],"sources":["../../../../../src/components/editor/extensions/image/extension.ts"],"sourcesContent":["\"use client\";\n\nimport { getFileUrl } from \"@/modules/storage/lib/helpers\";\nimport { Image as TiptapImage, ImageOptions as TiptapImageOptions } from \"@tiptap/extension-image\";\n\nexport interface ImageOptions extends TiptapImageOptions {}\n\nexport const Image = TiptapImage.extend<ImageOptions>({\n atom: true,\n addAttributes() {\n return {\n ...this.parent?.(),\n // node id\n nodeId: {\n default: null,\n parseHTML: (el) => el.getAttribute(\"data-node-id\"),\n renderHTML: (attrs) => {\n if (!attrs.nodeId) return {};\n return {\n \"data-node-id\": attrs.nodeId,\n ...(attrs.nodeId && !attrs.isPending ? { src: getFileUrl(attrs.nodeId) } : {}),\n };\n },\n },\n\n // semantics\n alt: { default: null },\n title: { default: null },\n\n // layout stability\n width: { default: null },\n height: { default: null },\n\n // upload UX\n isPending: {\n default: false,\n renderHTML: (attrs) => (attrs.isPending ? { \"data-pending\": \"true\" } : {}),\n },\n fileName: { default: null },\n };\n },\n parseHTML() {\n return [{ tag: \"img[data-node-id]\" }];\n },\n renderHTML({ HTMLAttributes }) {\n const { src: _, ...attrs } = HTMLAttributes;\n\n console.log(\"attrs\", attrs);\n\n const nodeId = attrs.nodeId as string | null;\n const isPending = Boolean(attrs.isPending);\n\n const src = nodeId && !isPending ? getFileUrl(nodeId) : null;\n\n return [\"img\", { ...attrs, ...(src ? { src } : {}) }];\n },\n});\n"],"mappings":";;;;;;AAOA,MAAaA,UAAQC,MAAY,OAAqB;CACpD,MAAM;CACN,gBAAgB;AACd,SAAO;GACL,GAAG,KAAK,UAAU;GAElB,QAAQ;IACN,SAAS;IACT,YAAY,OAAO,GAAG,aAAa,eAAe;IAClD,aAAa,UAAU;AACrB,SAAI,CAAC,MAAM,OAAQ,QAAO,EAAE;AAC5B,YAAO;MACL,gBAAgB,MAAM;MACtB,GAAI,MAAM,UAAU,CAAC,MAAM,YAAY,EAAE,KAAK,WAAW,MAAM,OAAO,EAAE,GAAG,EAAE;MAC9E;;IAEJ;GAGD,KAAK,EAAE,SAAS,MAAM;GACtB,OAAO,EAAE,SAAS,MAAM;GAGxB,OAAO,EAAE,SAAS,MAAM;GACxB,QAAQ,EAAE,SAAS,MAAM;GAGzB,WAAW;IACT,SAAS;IACT,aAAa,UAAW,MAAM,YAAY,EAAE,gBAAgB,QAAQ,GAAG,EAAE;IAC1E;GACD,UAAU,EAAE,SAAS,MAAM;GAC5B;;CAEH,YAAY;AACV,SAAO,CAAC,EAAE,KAAK,qBAAqB,CAAC;;CAEvC,WAAW,EAAE,kBAAkB;EAC7B,MAAM,EAAE,KAAK,GAAG,GAAG,UAAU;AAE7B,UAAQ,IAAI,SAAS,MAAM;EAE3B,MAAM,SAAS,MAAM;EACrB,MAAM,YAAY,QAAQ,MAAM,UAAU;EAE1C,MAAM,MAAM,UAAU,CAAC,YAAY,WAAW,OAAO,GAAG;AAExD,SAAO,CAAC,OAAO;GAAE,GAAG;GAAO,GAAI,MAAM,EAAE,KAAK,GAAG,EAAE;GAAG,CAAC;;CAExD,CAAC"}
@@ -0,0 +1,41 @@
1
+ "use client";
2
+
3
+ import { SkeletonNodeRenderer } from "./renderer.mjs";
4
+ import { Node } from "@tiptap/core";
5
+ import { ReactNodeViewRenderer } from "@tiptap/react";
6
+
7
+ //#region src/components/editor/extensions/skeleton/extension.ts
8
+ const Skeleton = Node.create({
9
+ name: "skeleton",
10
+ atom: true,
11
+ inline: true,
12
+ group: "inline",
13
+ selectable: false,
14
+ draggable: false,
15
+ addAttributes() {
16
+ return {
17
+ imageNodeId: { default: null },
18
+ width: { default: null },
19
+ height: { default: null }
20
+ };
21
+ },
22
+ addOptions() {
23
+ return { addToHistory: false };
24
+ },
25
+ parseHTML() {
26
+ return [{ tag: "span[data-skeleton]" }];
27
+ },
28
+ renderHTML({ HTMLAttributes }) {
29
+ return ["span", {
30
+ ...HTMLAttributes,
31
+ "data-skeleton": "true"
32
+ }];
33
+ },
34
+ addNodeView() {
35
+ return ReactNodeViewRenderer(SkeletonNodeRenderer);
36
+ }
37
+ });
38
+
39
+ //#endregion
40
+ export { Skeleton };
41
+ //# sourceMappingURL=extension.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extension.mjs","names":[],"sources":["../../../../../src/components/editor/extensions/skeleton/extension.ts"],"sourcesContent":["\"use client\";\n\nimport { Node } from \"@tiptap/core\";\nimport { ReactNodeViewRenderer } from \"@tiptap/react\";\nimport { SkeletonNodeRenderer } from \"./renderer\";\n\nexport const Skeleton = Node.create({\n name: \"skeleton\",\n atom: true,\n inline: true,\n group: \"inline\",\n selectable: false,\n draggable: false,\n addAttributes() {\n return {\n imageNodeId: { default: null },\n width: { default: null },\n height: { default: null },\n };\n },\n addOptions() {\n return {\n addToHistory: false,\n };\n },\n parseHTML() {\n return [{ tag: \"span[data-skeleton]\" }];\n },\n renderHTML({ HTMLAttributes }) {\n return [\"span\", { ...HTMLAttributes, \"data-skeleton\": \"true\" }];\n },\n addNodeView() {\n return ReactNodeViewRenderer(SkeletonNodeRenderer);\n },\n});\n"],"mappings":";;;;;;;AAMA,MAAa,WAAW,KAAK,OAAO;CAClC,MAAM;CACN,MAAM;CACN,QAAQ;CACR,OAAO;CACP,YAAY;CACZ,WAAW;CACX,gBAAgB;AACd,SAAO;GACL,aAAa,EAAE,SAAS,MAAM;GAC9B,OAAO,EAAE,SAAS,MAAM;GACxB,QAAQ,EAAE,SAAS,MAAM;GAC1B;;CAEH,aAAa;AACX,SAAO,EACL,cAAc,OACf;;CAEH,YAAY;AACV,SAAO,CAAC,EAAE,KAAK,uBAAuB,CAAC;;CAEzC,WAAW,EAAE,kBAAkB;AAC7B,SAAO,CAAC,QAAQ;GAAE,GAAG;GAAgB,iBAAiB;GAAQ,CAAC;;CAEjE,cAAc;AACZ,SAAO,sBAAsB,qBAAqB;;CAErD,CAAC"}
@@ -0,0 +1,25 @@
1
+ "use client";
2
+
3
+ import { Skeleton } from "../../../ui/skeleton.mjs";
4
+ import { jsx } from "react/jsx-runtime";
5
+ import { NodeViewWrapper } from "@tiptap/react";
6
+
7
+ //#region src/components/editor/extensions/skeleton/renderer.tsx
8
+ function SkeletonNodeRenderer(props) {
9
+ const { width, height } = props.node.attrs;
10
+ return /* @__PURE__ */ jsx(NodeViewWrapper, {
11
+ as: "span",
12
+ "data-skeleton": "true",
13
+ children: /* @__PURE__ */ jsx(Skeleton, {
14
+ className: "min-h-[500px] w-full",
15
+ style: {
16
+ width,
17
+ height
18
+ }
19
+ })
20
+ });
21
+ }
22
+
23
+ //#endregion
24
+ export { SkeletonNodeRenderer };
25
+ //# sourceMappingURL=renderer.mjs.map