@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 +1 @@
1
- {"version":3,"file":"validators.d.mts","names":[],"sources":["../../../../src/modules/storage/lib/validators.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;KAYY,IAAA,UAAc,KAAA,CAAM;AAApB,KACA,QAAA,GADI,OACc,KAAA,CAAM,YADQ,GAAA;EAChC,IAAA,EAAA,MAAQ;AACpB,CAAA;AAKa,KALD,UAAA,GAKiD,OAL7B,KAAA,CAAM,YAKX,GAAA;EACf,IAAA,EAAA,QAAQ;AAKpB,CAAA;;;;cANa,gBAAc,GAAA,CAAA;;;;KACf,QAAA,GAAW,GAAA,CAAE,aAAa;;;;cAKzB,+BAAgB;QAE3B,uBAAA,CAAA;;;;;;;WAF2B,EAAA,IAAA;IAAA,UAAA,E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AE,aAAa;KAChC,eAAA,GAAkB,GAAA,CAAE,aAAa;;;;cAKhC,iBAAe,GAAA,CAAA;;;;;;;;;;;KAShB,cAAA,GAAiB,GAAA,CAAE,aAAa;SACnC;;KAGG,eAAA,GAAkB,GAAA,CAAE,aAAa"}
@@ -33,7 +33,8 @@ const nodesTableFiltersSchema = resolveFiltersSchema(nodesTableFilters).partial(
33
33
  }).transform((input) => ({
34
34
  ...input,
35
35
  hidden: input?.hidden ?? false,
36
- isDeleted: input?.isDeleted ?? false
36
+ isDeleted: input?.isDeleted ?? false,
37
+ orphanedAt: input?.isOrphaned ?? false
37
38
  }));
38
39
  /**
39
40
  * Create folder node
@@ -1 +1 @@
1
- {"version":3,"file":"validators.mjs","names":["z"],"sources":["../../../../src/modules/storage/lib/validators.ts"],"sourcesContent":["import { tableQuerySchema } from \"@/modules/data-tables/entry\";\nimport { resolveFiltersSchema } from \"@/modules/data-tables/lib/filters/resolvers\";\nimport { PutObjectCommandInput } from \"@aws-sdk/client-s3\";\nimport { createInsertSchema, createSelectSchema, createUpdateSchema } from \"drizzle-zod\";\nimport { z } from \"zod\";\nimport { nodesTableFilters } from \"../config/filters\";\nimport { imageDispositions, imageVariants } from \"./constants\";\nimport { nodeModeEnum, nodes } from \"./schema\";\n\n/**\n * Nodes\n */\nexport type Node = typeof nodes.$inferSelect;\nexport type FileNode = typeof nodes.$inferSelect & { type: \"file\" };\nexport type FolderNode = typeof nodes.$inferSelect & { type: \"folder\" };\n\n/**\n * Node mode\n */\nexport const nodeModeSchema = z.enum(nodeModeEnum.enumValues);\nexport type NodeMode = z.infer<typeof nodeModeSchema>;\n\n/**\n * Create node\n */\nexport const createNodeSchema = createInsertSchema(nodes, {\n namespace: z.string(),\n});\n\nexport type CreateNodeInput = z.input<typeof createNodeSchema>;\nexport type CreateNodeSchema = z.infer<typeof createNodeSchema>;\n\n/**\n * Update node\n */\nexport const updateNodeSchema = createUpdateSchema(nodes);\n\nexport type UpdateNodeInput = z.input<typeof updateNodeSchema>;\nexport type UpdateNodeSchema = z.infer<typeof updateNodeSchema>;\n\n/**\n * Select node\n */\nexport const selectNodeSchema = createSelectSchema(nodes);\nexport const selectNodeWithChildrenSchema = selectNodeSchema.extend({\n children: z.array(selectNodeSchema),\n});\n\nexport type SelectNodeSchema = z.infer<typeof selectNodeSchema>;\nexport type SelectNodeWithChildrenSchema = z.infer<typeof selectNodeWithChildrenSchema>;\n\n/**\n * Where input\n */\nexport const nodesTableFiltersSchema = resolveFiltersSchema(nodesTableFilters)\n .partial()\n .extend({\n namespace: z.string(),\n parentId: z.string().nullable(),\n })\n .transform((input) => ({\n ...input,\n hidden: input?.hidden ?? false,\n isDeleted: input?.isDeleted ?? false,\n }));\n\nexport type NodesTableFilters = z.input<typeof nodesTableFiltersSchema>;\n\n/**\n * Create folder node\n */\nexport const createFolderNodeSchema = createNodeSchema.omit({\n type: true,\n contentType: true,\n size: true,\n subtype: true,\n});\n\nexport type CreateFolderNodeSchema = z.infer<typeof createFolderNodeSchema>;\n\n/**\n * Upload file schema\n */\nexport const uploadFileSchema = createNodeSchema.omit({ type: true });\n\nexport type UploadFileSchema = z.infer<typeof uploadFileSchema>;\n\n/**\n * Presign file schema\n */\nexport const presignFileSchema = uploadFileSchema.extend({ id: z.uuid() });\n\nexport type PresignFileSchema = z.infer<typeof presignFileSchema>;\n\n/**\n * Get file url schema\n */\nexport const getFileURLSchemaDefaults = { variant: \"main\", disposition: \"inline\" } as const;\n\nexport const getFileURLSchema = z.object({\n variant: z.enum(imageVariants).optional().default(getFileURLSchemaDefaults.variant),\n disposition: z.enum(imageDispositions).optional().default(getFileURLSchemaDefaults.disposition),\n});\n\nexport type GetFileUrlInput = z.input<typeof getFileURLSchema>;\nexport type GetFileURLSchema = z.infer<typeof getFileURLSchema>;\n\n/**\n * Get by parent id input\n */\nexport const getNodesByParentIdSchema = tableQuerySchema\n .pick({ order: true, sort: true, search: true })\n .extend({ filters: nodesTableFiltersSchema });\n\nexport type GetNodesByParentIdInput = z.input<typeof getNodesByParentIdSchema>;\n\n/**\n * Get object input\n */\nexport const getObjectSchema = z.object({\n id: z.string(),\n variant: z.enum(imageVariants).optional().default(getFileURLSchemaDefaults.variant),\n disposition: z.string().optional().default(getFileURLSchemaDefaults.disposition),\n});\n\nexport type GetObjectInput = z.input<typeof getObjectSchema>;\nexport type GetObjectSchema = z.infer<typeof getObjectSchema>;\n\n/**\n * Put object input\n */\nexport const putObjectSchema = z.object({\n id: z.string(),\n name: z.string().optional().default(\"\"),\n variant: z.enum(imageVariants).optional().default(\"main\"),\n body: z.any().optional(),\n contentType: z.string().nullable().optional(),\n size: z.number().nullable().optional(),\n});\n\nexport type PutObjectInput = z.input<typeof putObjectSchema> & {\n body?: PutObjectCommandInput[\"Body\"];\n};\n\nexport type PutObjectSchema = z.infer<typeof putObjectSchema>;\n"],"mappings":";;;;;;;;;;;;AAmBA,MAAa,iBAAiBA,IAAE,KAAK,aAAa,WAAW;;;;AAM7D,MAAa,mBAAmB,mBAAmB,OAAO,EACxD,WAAWA,IAAE,QAAQ,EACtB,CAAC;;;;AAQF,MAAa,mBAAmB,mBAAmB,MAAM;;;;AAQzD,MAAa,mBAAmB,mBAAmB,MAAM;AACzD,MAAa,+BAA+B,iBAAiB,OAAO,EAClE,UAAUA,IAAE,MAAM,iBAAiB,EACpC,CAAC;;;;AAQF,MAAa,0BAA0B,qBAAqB,kBAAkB,CAC3E,SAAS,CACT,OAAO;CACN,WAAWA,IAAE,QAAQ;CACrB,UAAUA,IAAE,QAAQ,CAAC,UAAU;CAChC,CAAC,CACD,WAAW,WAAW;CACrB,GAAG;CACH,QAAQ,OAAO,UAAU;CACzB,WAAW,OAAO,aAAa;CAChC,EAAE;;;;AAOL,MAAa,yBAAyB,iBAAiB,KAAK;CAC1D,MAAM;CACN,aAAa;CACb,MAAM;CACN,SAAS;CACV,CAAC;;;;AAOF,MAAa,mBAAmB,iBAAiB,KAAK,EAAE,MAAM,MAAM,CAAC;;;;AAOrE,MAAa,oBAAoB,iBAAiB,OAAO,EAAE,IAAIA,IAAE,MAAM,EAAE,CAAC;;;;AAO1E,MAAa,2BAA2B;CAAE,SAAS;CAAQ,aAAa;CAAU;AAElF,MAAa,mBAAmBA,IAAE,OAAO;CACvC,SAASA,IAAE,KAAK,cAAc,CAAC,UAAU,CAAC,QAAQ,yBAAyB,QAAQ;CACnF,aAAaA,IAAE,KAAK,kBAAkB,CAAC,UAAU,CAAC,QAAQ,yBAAyB,YAAY;CAChG,CAAC;;;;AAQF,MAAa,2BAA2B,iBACrC,KAAK;CAAE,OAAO;CAAM,MAAM;CAAM,QAAQ;CAAM,CAAC,CAC/C,OAAO,EAAE,SAAS,yBAAyB,CAAC;;;;AAO/C,MAAa,kBAAkBA,IAAE,OAAO;CACtC,IAAIA,IAAE,QAAQ;CACd,SAASA,IAAE,KAAK,cAAc,CAAC,UAAU,CAAC,QAAQ,yBAAyB,QAAQ;CACnF,aAAaA,IAAE,QAAQ,CAAC,UAAU,CAAC,QAAQ,yBAAyB,YAAY;CACjF,CAAC;;;;AAQF,MAAa,kBAAkBA,IAAE,OAAO;CACtC,IAAIA,IAAE,QAAQ;CACd,MAAMA,IAAE,QAAQ,CAAC,UAAU,CAAC,QAAQ,GAAG;CACvC,SAASA,IAAE,KAAK,cAAc,CAAC,UAAU,CAAC,QAAQ,OAAO;CACzD,MAAMA,IAAE,KAAK,CAAC,UAAU;CACxB,aAAaA,IAAE,QAAQ,CAAC,UAAU,CAAC,UAAU;CAC7C,MAAMA,IAAE,QAAQ,CAAC,UAAU,CAAC,UAAU;CACvC,CAAC"}
1
+ {"version":3,"file":"validators.mjs","names":["z"],"sources":["../../../../src/modules/storage/lib/validators.ts"],"sourcesContent":["import { tableQuerySchema } from \"@/modules/data-tables/entry\";\nimport { resolveFiltersSchema } from \"@/modules/data-tables/lib/filters/resolvers\";\nimport { PutObjectCommandInput } from \"@aws-sdk/client-s3\";\nimport { createInsertSchema, createSelectSchema, createUpdateSchema } from \"drizzle-zod\";\nimport { z } from \"zod\";\nimport { nodesTableFilters } from \"../config/filters\";\nimport { imageDispositions, imageVariants } from \"./constants\";\nimport { nodeModeEnum, nodes } from \"./schema\";\n\n/**\n * Nodes\n */\nexport type Node = typeof nodes.$inferSelect;\nexport type FileNode = typeof nodes.$inferSelect & { type: \"file\" };\nexport type FolderNode = typeof nodes.$inferSelect & { type: \"folder\" };\n\n/**\n * Node mode\n */\nexport const nodeModeSchema = z.enum(nodeModeEnum.enumValues);\nexport type NodeMode = z.infer<typeof nodeModeSchema>;\n\n/**\n * Create node\n */\nexport const createNodeSchema = createInsertSchema(nodes, {\n namespace: z.string(),\n});\n\nexport type CreateNodeInput = z.input<typeof createNodeSchema>;\nexport type CreateNodeSchema = z.infer<typeof createNodeSchema>;\n\n/**\n * Update node\n */\nexport const updateNodeSchema = createUpdateSchema(nodes);\n\nexport type UpdateNodeInput = z.input<typeof updateNodeSchema>;\nexport type UpdateNodeSchema = z.infer<typeof updateNodeSchema>;\n\n/**\n * Select node\n */\nexport const selectNodeSchema = createSelectSchema(nodes);\nexport const selectNodeWithChildrenSchema = selectNodeSchema.extend({\n children: z.array(selectNodeSchema),\n});\n\nexport type SelectNodeSchema = z.infer<typeof selectNodeSchema>;\nexport type SelectNodeWithChildrenSchema = z.infer<typeof selectNodeWithChildrenSchema>;\n\n/**\n * Where input\n */\nexport const nodesTableFiltersSchema = resolveFiltersSchema(nodesTableFilters)\n .partial()\n .extend({\n namespace: z.string(),\n parentId: z.string().nullable(),\n })\n .transform((input) => ({\n ...input,\n hidden: input?.hidden ?? false,\n isDeleted: input?.isDeleted ?? false,\n orphanedAt: input?.isOrphaned ?? false,\n }));\n\nexport type NodesTableFilters = z.input<typeof nodesTableFiltersSchema>;\n\n/**\n * Create folder node\n */\nexport const createFolderNodeSchema = createNodeSchema.omit({\n type: true,\n contentType: true,\n size: true,\n subtype: true,\n});\n\nexport type CreateFolderNodeSchema = z.infer<typeof createFolderNodeSchema>;\n\n/**\n * Upload file schema\n */\nexport const uploadFileSchema = createNodeSchema.omit({ type: true });\n\nexport type UploadFileSchema = z.infer<typeof uploadFileSchema>;\n\n/**\n * Presign file schema\n */\nexport const presignFileSchema = uploadFileSchema.extend({ id: z.uuid() });\n\nexport type PresignFileSchema = z.infer<typeof presignFileSchema>;\n\n/**\n * Get file url schema\n */\nexport const getFileURLSchemaDefaults = { variant: \"main\", disposition: \"inline\" } as const;\n\nexport const getFileURLSchema = z.object({\n variant: z.enum(imageVariants).optional().default(getFileURLSchemaDefaults.variant),\n disposition: z.enum(imageDispositions).optional().default(getFileURLSchemaDefaults.disposition),\n});\n\nexport type GetFileUrlInput = z.input<typeof getFileURLSchema>;\nexport type GetFileURLSchema = z.infer<typeof getFileURLSchema>;\n\n/**\n * Get by parent id input\n */\nexport const getNodesByParentIdSchema = tableQuerySchema\n .pick({ order: true, sort: true, search: true })\n .extend({ filters: nodesTableFiltersSchema });\n\nexport type GetNodesByParentIdInput = z.input<typeof getNodesByParentIdSchema>;\n\n/**\n * Get object input\n */\nexport const getObjectSchema = z.object({\n id: z.string(),\n variant: z.enum(imageVariants).optional().default(getFileURLSchemaDefaults.variant),\n disposition: z.string().optional().default(getFileURLSchemaDefaults.disposition),\n});\n\nexport type GetObjectInput = z.input<typeof getObjectSchema>;\nexport type GetObjectSchema = z.infer<typeof getObjectSchema>;\n\n/**\n * Put object input\n */\nexport const putObjectSchema = z.object({\n id: z.string(),\n name: z.string().optional().default(\"\"),\n variant: z.enum(imageVariants).optional().default(\"main\"),\n body: z.any().optional(),\n contentType: z.string().nullable().optional(),\n size: z.number().nullable().optional(),\n});\n\nexport type PutObjectInput = z.input<typeof putObjectSchema> & {\n body?: PutObjectCommandInput[\"Body\"];\n};\n\nexport type PutObjectSchema = z.infer<typeof putObjectSchema>;\n"],"mappings":";;;;;;;;;;;;AAmBA,MAAa,iBAAiBA,IAAE,KAAK,aAAa,WAAW;;;;AAM7D,MAAa,mBAAmB,mBAAmB,OAAO,EACxD,WAAWA,IAAE,QAAQ,EACtB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jF,CAAC;;;;AAQF,MAAa,kBAAkBA,IAAE,OAAO;CACtC,IAAIA,IAAE,QAAQ;CACd,MAAMA,IAAE,QAAQ,CAAC,UAAU,CAAC,QAAQ,GAAG;CACvC,SAASA,IAAE,KAAK,cAAc,CAAC,UAAU,CAAC,QAAQ,OAAO;CACzD,MAAMA,IAAE,KAAK,CAAC,UAAU;CACxB,aAAaA,IAAE,QAAQ,CAAC,UAAU,CAAC,UAAU;CAC7C,MAAMA,IAAE,QAAQ,CAAC,UAAU,CAAC,UAAU;CACvC,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import { DropzoneContext, useDropzoneContext } from "../modules/storage/components/dropzone-context.client.mjs";
2
2
  import { Dropzone, DropzoneContent, DropzoneContentProps, DropzoneEmptyState, DropzoneEmptyStateProps, DropzoneProps } from "../modules/storage/components/dropzone.client.mjs";
3
3
  import { ImageGrid, ImageGridSkeleton } from "../modules/storage/components/image-grid.client.mjs";
4
+ import { PrepareUploadInput, UploadClient, UploadFileRequest, UploadHooks, createUploadClient } from "../modules/storage/lib/create-upload.client.mjs";
4
5
  import { UploadZoneContext, UploadZoneContextValue, useUploadZone } from "../modules/storage/components/upload-zone-context.client.mjs";
5
6
  import { UploadZone, UploadZoneProps } from "../modules/storage/components/upload-zone.client.mjs";
6
- export { Dropzone, DropzoneContent, DropzoneContentProps, DropzoneContext, DropzoneEmptyState, DropzoneEmptyStateProps, DropzoneProps, ImageGrid, ImageGridSkeleton, UploadZone, UploadZoneContext, UploadZoneContextValue, UploadZoneProps, useDropzoneContext, useUploadZone };
7
+ export { Dropzone, DropzoneContent, DropzoneContentProps, DropzoneContext, DropzoneEmptyState, DropzoneEmptyStateProps, DropzoneProps, ImageGrid, ImageGridSkeleton, PrepareUploadInput, UploadClient, UploadFileRequest, UploadHooks, UploadZone, UploadZoneContext, UploadZoneContextValue, UploadZoneProps, createUploadClient, useDropzoneContext, useUploadZone };
@@ -3,12 +3,6 @@ import { Dropzone, DropzoneContent, DropzoneEmptyState } from "../modules/storag
3
3
  import { UploadZoneContext, useUploadZone } from "../modules/storage/components/upload-zone-context.client.mjs";
4
4
  import { ImageGrid, ImageGridSkeleton } from "../modules/storage/components/image-grid.client.mjs";
5
5
  import { UploadZone } from "../modules/storage/components/upload-zone.client.mjs";
6
+ import { createUploadClient } from "../modules/storage/lib/create-upload.client.mjs";
6
7
 
7
- //#region src/modules/storage/entry.client.ts
8
- /**
9
- * Hooks
10
- */
11
-
12
- //#endregion
13
- export { Dropzone, DropzoneContent, DropzoneContext, DropzoneEmptyState, ImageGrid, ImageGridSkeleton, UploadZone, UploadZoneContext, useDropzoneContext, useUploadZone };
14
- //# sourceMappingURL=client.mjs.map
8
+ export { Dropzone, DropzoneContent, DropzoneContext, DropzoneEmptyState, ImageGrid, ImageGridSkeleton, UploadZone, UploadZoneContext, createUploadClient, useDropzoneContext, useUploadZone };
@@ -1,6 +1,6 @@
1
- import { DriveSchema, nodeModeEnum, nodePresignedUrls, nodePresignedUrlsRelations, nodeTypeEnum, nodeVariants, nodeVariantsRelations, nodes, nodesRelations } from "./modules/storage/lib/schema.mjs";
2
- import { CreateFolderNodeSchema, CreateNodeInput, CreateNodeSchema, FileNode, FolderNode, GetFileURLSchema, GetFileUrlInput, GetNodesByParentIdInput, GetObjectInput, GetObjectSchema, Node, NodeMode, NodesTableFilters, PresignFileSchema, PutObjectInput, PutObjectSchema, SelectNodeSchema, SelectNodeWithChildrenSchema, UpdateNodeInput, UpdateNodeSchema, UploadFileSchema, createFolderNodeSchema, createNodeSchema, getFileURLSchema, getFileURLSchemaDefaults, getNodesByParentIdSchema, getObjectSchema, nodeModeSchema, nodesTableFiltersSchema, presignFileSchema, putObjectSchema, selectNodeSchema, selectNodeWithChildrenSchema, updateNodeSchema, uploadFileSchema } from "./modules/storage/lib/validators.mjs";
3
1
  import { nodesTableFilters } from "./modules/storage/config/filters.mjs";
4
2
  import { ImageDisposition, ImageVariant, deviceSizes, imageDispositions, imageSizes, imageVariants } from "./modules/storage/lib/constants.mjs";
3
+ import { DriveSchema, nodeModeEnum, nodePresignedUrls, nodePresignedUrlsRelations, nodeTypeEnum, nodeVariants, nodeVariantsRelations, nodes, nodesRelations } from "./modules/storage/lib/schema.mjs";
4
+ import { CreateFolderNodeSchema, CreateNodeInput, CreateNodeSchema, FileNode, FolderNode, GetFileURLSchema, GetFileUrlInput, GetNodesByParentIdInput, GetObjectInput, GetObjectSchema, Node, NodeMode, NodesTableFilters, PresignFileSchema, PutObjectInput, PutObjectSchema, SelectNodeSchema, SelectNodeWithChildrenSchema, UpdateNodeInput, UpdateNodeSchema, UploadFileSchema, createFolderNodeSchema, createNodeSchema, getFileURLSchema, getFileURLSchemaDefaults, getNodesByParentIdSchema, getObjectSchema, nodeModeSchema, nodesTableFiltersSchema, presignFileSchema, putObjectSchema, selectNodeSchema, selectNodeWithChildrenSchema, updateNodeSchema, uploadFileSchema } from "./modules/storage/lib/validators.mjs";
5
5
  import { NodeSubtype, getDriveBucketKey, getFileUrl, imageLoader, inferNodeSubtype, isFile, isFolder, nodeSubtypes, renderBytes } from "./modules/storage/lib/helpers.mjs";
6
6
  export { CreateFolderNodeSchema, CreateNodeInput, CreateNodeSchema, DriveSchema, FileNode, FolderNode, GetFileURLSchema, GetFileUrlInput, GetNodesByParentIdInput, GetObjectInput, GetObjectSchema, ImageDisposition, ImageVariant, Node, NodeMode, NodeSubtype, NodesTableFilters, PresignFileSchema, PutObjectInput, PutObjectSchema, SelectNodeSchema, SelectNodeWithChildrenSchema, UpdateNodeInput, UpdateNodeSchema, UploadFileSchema, createFolderNodeSchema, createNodeSchema, deviceSizes, getDriveBucketKey, getFileURLSchema, getFileURLSchemaDefaults, getFileUrl, getNodesByParentIdSchema, getObjectSchema, imageDispositions, imageLoader, imageSizes, imageVariants, inferNodeSubtype, isFile, isFolder, nodeModeEnum, nodeModeSchema, nodePresignedUrls, nodePresignedUrlsRelations, nodeSubtypes, nodeTypeEnum, nodeVariants, nodeVariantsRelations, nodes, nodesRelations, nodesTableFilters, nodesTableFiltersSchema, presignFileSchema, putObjectSchema, renderBytes, selectNodeSchema, selectNodeWithChildrenSchema, updateNodeSchema, uploadFileSchema };
package/dist/storage.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { deviceSizes, imageDispositions, imageSizes, imageVariants } from "./modules/storage/lib/constants.mjs";
2
1
  import { getDriveBucketKey, getFileUrl, imageLoader, inferNodeSubtype, isFile, isFolder, nodeSubtypes, renderBytes } from "./modules/storage/lib/helpers.mjs";
2
+ import { deviceSizes, imageDispositions, imageSizes, imageVariants } from "./modules/storage/lib/constants.mjs";
3
3
  import { nodeModeEnum, nodePresignedUrls, nodePresignedUrlsRelations, nodeTypeEnum, nodeVariants, nodeVariantsRelations, nodes, nodesRelations } from "./modules/storage/lib/schema.mjs";
4
4
  import { nodesTableFilters } from "./modules/storage/config/filters.mjs";
5
5
  import { createFolderNodeSchema, createNodeSchema, getFileURLSchema, getFileURLSchemaDefaults, getNodesByParentIdSchema, getObjectSchema, nodeModeSchema, nodesTableFiltersSchema, presignFileSchema, putObjectSchema, selectNodeSchema, selectNodeWithChildrenSchema, updateNodeSchema, uploadFileSchema } from "./modules/storage/lib/validators.mjs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tulip-systems/core",
3
- "version": "0.5.2",
3
+ "version": "0.5.3",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "license": "MIT",
@@ -13,8 +13,8 @@
13
13
  "tw-animate-css": "^1.4.0",
14
14
  "typescript": "5.9.3",
15
15
  "vite": "^7.2.7",
16
- "@tulip-systems/typescript-config": "0.0.0",
17
- "@tulip-systems/eslint-config": "0.0.0"
16
+ "@tulip-systems/eslint-config": "0.0.0",
17
+ "@tulip-systems/typescript-config": "0.0.0"
18
18
  },
19
19
  "dependencies": {
20
20
  "@aws-sdk/client-s3": "^3.946.0",
@@ -67,6 +67,7 @@
67
67
  "@tiptap/extension-bold": "^3.14.0",
68
68
  "@tiptap/extension-color": "^3.14.0",
69
69
  "@tiptap/extension-document": "^3.14.0",
70
+ "@tiptap/extension-file-handler": "^3.15.3",
70
71
  "@tiptap/extension-hard-break": "^3.14.0",
71
72
  "@tiptap/extension-heading": "^3.14.0",
72
73
  "@tiptap/extension-highlight": "^3.14.0",
@@ -11,7 +11,7 @@ import {
11
11
  flattenEditorExtensionsConfig,
12
12
  } from "../lib/extensions";
13
13
  import { EditorJSONContent } from "../lib/types";
14
- import { editorProseVariants } from "../lib/variants";
14
+ import { editorImageVariants, editorProseVariants } from "../lib/variants";
15
15
 
16
16
  /**
17
17
  * Editor context
@@ -75,7 +75,12 @@ export function Editor({
75
75
  editorProps: {
76
76
  transformPastedHTML: (html) => html.replace(/<img.*?>/g, ""),
77
77
  attributes: {
78
- class: cn("editor-content text-sm max-w-full focus:outline-none", editorProseVariants(), className),
78
+ class: cn(
79
+ "editor-content text-sm max-w-full focus:outline-none",
80
+ editorProseVariants(),
81
+ editorImageVariants(),
82
+ className,
83
+ ),
79
84
  },
80
85
  },
81
86
  });
@@ -212,3 +212,29 @@ function EditorMenuColor() {
212
212
  </div>
213
213
  );
214
214
  }
215
+
216
+ /**
217
+ * Editor menu image
218
+ */
219
+ // function EditorMenuImage() {
220
+ // const { editor, extensions } = useContext(EditorContext);
221
+
222
+ // if (!extensions.image) return null;
223
+
224
+ // return (
225
+ // <div className="flex items-center gap-1">
226
+ // {extensions.image && (
227
+ // <Button
228
+ // type="button"
229
+ // size="icon"
230
+ // variant="outline"
231
+ // onClick={() => editor.chain().focus().downloadImage().run()}
232
+ // disabled={!editor?.can().downloadImage()}
233
+ // className="border"
234
+ // >
235
+ // <DownloadIcon className="size-3.5" />
236
+ // </Button>
237
+ // )}
238
+ // </div>
239
+ // );
240
+ // }
@@ -0,0 +1,69 @@
1
+ "use client";
2
+
3
+ import {
4
+ FileHandler as TiptapFileHandler,
5
+ FileHandlerOptions as TiptapFileHandlerOptions,
6
+ } from "@tiptap/extension-file-handler";
7
+ import { Plugin, PluginKey } from "@tiptap/pm/state";
8
+ import { collectImageIds, diffIds } from "./utils";
9
+
10
+ export interface FileHandlerOptions extends TiptapFileHandlerOptions {
11
+ /**
12
+ * Callback function invoked when a image reference is removed from the editor. Receives the node ID of the removed node.
13
+ * @type {(nodeId: string) => void}
14
+ * @default undefined
15
+ **/
16
+ onReferenceRemoved?: (nodeId: string) => void;
17
+
18
+ /**
19
+ * Callback function invoked when a image reference is added to the editor. Receives the node ID of the added node.
20
+ * @type {(nodeId: string) => void}
21
+ * @default undefined
22
+ **/
23
+ onReferenceAdded?: (nodeId: string) => void;
24
+ }
25
+
26
+ /**
27
+ * File Handler extension for Tiptap Editor
28
+ */
29
+ export const FileHandler = TiptapFileHandler.extend<FileHandlerOptions>({
30
+ addOptions() {
31
+ return {
32
+ ...this.parent?.(),
33
+ onReferenceRemoved: undefined,
34
+ onReferenceAdded: undefined,
35
+ };
36
+ },
37
+ addProseMirrorPlugins() {
38
+ const parent = this.parent?.() ?? [];
39
+ const key = new PluginKey("fileHandlerItemTracker");
40
+
41
+ return [
42
+ ...parent,
43
+ new Plugin({
44
+ key,
45
+ appendTransaction: (trs, oldState, newState) => {
46
+ if (!trs.some((tr) => tr.docChanged)) return null;
47
+
48
+ const onReferenceRemoved = this.options.onReferenceRemoved;
49
+ const onReferenceAdded = this.options.onReferenceAdded;
50
+ if (!onReferenceRemoved && !onReferenceAdded) return null;
51
+
52
+ const before = collectImageIds(oldState.doc);
53
+ const after = collectImageIds(newState.doc);
54
+ const { removed, added } = diffIds(before, after);
55
+
56
+ for (const id of removed) {
57
+ onReferenceRemoved?.(id);
58
+ }
59
+
60
+ for (const id of added) {
61
+ onReferenceAdded?.(id);
62
+ }
63
+
64
+ return null;
65
+ },
66
+ }),
67
+ ];
68
+ },
69
+ });
@@ -0,0 +1,167 @@
1
+ import { SelectNodeSchema, UploadFileSchema } from "@/modules/storage/entry";
2
+ import { UploadClient, UploadHooks } from "@/modules/storage/entry.client";
3
+ import { Editor } from "@tiptap/core";
4
+ import { TextSelection } from "@tiptap/pm/state";
5
+ import { FileHandlerOptions } from "./extension";
6
+
7
+ /**
8
+ * Handle File Handler props
9
+ */
10
+ type CreateFileHandlerUploadStrategyProps = {
11
+ variables: Pick<UploadFileSchema, "namespace" | "parentId" | "mode" | "hidden" | "readonly">;
12
+ uploadClient: UploadClient;
13
+ uploadHooks?: UploadHooks;
14
+ allowedMimeTypes?: string[];
15
+ onUploadCompleted?: (node: SelectNodeSchema) => Promise<void> | void;
16
+ onUploadFailed?: (error: unknown) => Promise<void> | void;
17
+ };
18
+
19
+ export function createFileHandlerUploadStrategy({
20
+ variables,
21
+ uploadClient,
22
+ uploadHooks,
23
+ onUploadCompleted,
24
+ onUploadFailed,
25
+ allowedMimeTypes,
26
+ }: CreateFileHandlerUploadStrategyProps): FileHandlerOptions {
27
+ const handleUpload = async (editor: Editor, files: File[], startPos: number) => {
28
+ const insertPos = startPos;
29
+
30
+ for (const file of files) {
31
+ /**
32
+ * Prepare upload
33
+ */
34
+ const input = uploadClient.prepareUpload({ file, ...variables });
35
+
36
+ const imageType = editor.schema.nodes.image;
37
+ if (!imageType) {
38
+ console.error("Image type not found");
39
+ return;
40
+ }
41
+
42
+ try {
43
+ /**
44
+ * Create skeleton node
45
+ */
46
+ const skeletonNode = editor.schema.nodes.skeleton?.create({
47
+ imageNodeId: input.id,
48
+ width: 500,
49
+ height: 500,
50
+ });
51
+
52
+ /**
53
+ * Insert skeleton node into the document
54
+ */
55
+ if (skeletonNode) {
56
+ // editor.chain().insertContentAt(insertPos, skeletonNode).focus().run();
57
+ const tr = editor.state.tr.insert(insertPos, skeletonNode);
58
+ tr.setSelection(TextSelection.create(tr.doc, insertPos + skeletonNode.nodeSize));
59
+ tr.setMeta("addToHistory", false);
60
+ editor.view.dispatch(tr);
61
+ }
62
+
63
+ /**
64
+ * Upload the file
65
+ */
66
+ const fileNode = await uploadClient.upload(input, uploadHooks);
67
+
68
+ /**
69
+ * Replace skeleton with image node
70
+ */
71
+ const replacedTr = editor.state.tr;
72
+ let replaced = false;
73
+
74
+ replacedTr.doc.descendants((node, pos) => {
75
+ if (node.type.name === "skeleton" && node.attrs?.imageNodeId === input.id) {
76
+ const imageNode = imageType.create({
77
+ nodeId: fileNode.id,
78
+ alt: file.name,
79
+ fileName: file.name,
80
+ width: node.attrs.width ?? 500,
81
+ });
82
+
83
+ replacedTr.replaceWith(pos, pos + node.nodeSize, imageNode);
84
+ replaced = true;
85
+ return false;
86
+ }
87
+ });
88
+
89
+ if (replaced) {
90
+ editor.view.dispatch(replacedTr);
91
+ } else {
92
+ // In case skeleton is not found, insert the image node at the original position
93
+ const tr = editor.state.tr;
94
+ const imageNode = imageType.create({
95
+ nodeId: fileNode.id,
96
+ alt: file.name,
97
+ fileName: file.name,
98
+ width: 500,
99
+ });
100
+ tr.insert(insertPos, imageNode);
101
+ editor.view.dispatch(tr);
102
+ }
103
+
104
+ // /**
105
+ // * Remove skeleton node from the document
106
+ // */
107
+ // const tr = editor.state.tr;
108
+ // tr.doc.descendants((node, pos) => {
109
+ // if (node.type.name === "skeleton" && node.attrs?.imageNodeId === input.id) {
110
+ // tr.delete(pos, pos + node.nodeSize);
111
+ // return false;
112
+ // }
113
+ // });
114
+ // editor.view.dispatch(tr);
115
+
116
+ // /**
117
+ // * Add image node to the document
118
+ // */
119
+ // const imageNode = imageType.create({
120
+ // nodeId: fileNode.id,
121
+ // alt: file.name,
122
+ // fileName: file.name,
123
+ // width: 500,
124
+ // });
125
+ // editor.commands.insertContentAt(insertPos, imageNode);
126
+ // // insertPos += imageNode.nodeSize - skeletonNode.nodeSize;
127
+
128
+ await onUploadCompleted?.(fileNode);
129
+ } catch (err) {
130
+ console.error("Upload error:", err);
131
+
132
+ /**
133
+ * Remove the pending image node from the document
134
+ */
135
+ const tr = editor.state.tr;
136
+ tr.doc.descendants((node, pos) => {
137
+ if (node.type.name === "image" && node.attrs?.nodeId === input.id) {
138
+ tr.delete(pos, pos + node.nodeSize);
139
+ return false;
140
+ }
141
+ });
142
+ editor.view.dispatch(tr);
143
+
144
+ await onUploadFailed?.(err);
145
+ }
146
+ }
147
+ };
148
+
149
+ return {
150
+ allowedMimeTypes,
151
+ onDrop: async (editor, files, pos) => {
152
+ await handleUpload(editor, files, pos);
153
+ },
154
+ onPaste: async (editor, files, htmlContent) => {
155
+ if (htmlContent?.length) return;
156
+
157
+ const startPos = editor.state.selection.anchor;
158
+ await handleUpload(editor, files, startPos);
159
+ },
160
+ onReferenceRemoved: async (nodeId) => {
161
+ await uploadClient.updateNode(nodeId, { orphanedAt: new Date() });
162
+ },
163
+ onReferenceAdded: async (nodeId) => {
164
+ await uploadClient.updateNode(nodeId, { orphanedAt: null });
165
+ },
166
+ };
167
+ }
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Collects and counts all image node IDs from a document.
3
+ *
4
+ * @param doc - The document node to traverse and analyze
5
+ * @returns A Map where keys are image node IDs and values are their occurrence counts
6
+ *
7
+ * @example
8
+ * const imageCounts = collectImageIds(editorDoc);
9
+ * imageCounts.forEach((count, imageId) => {
10
+ * console.log(`Image ${imageId} appears ${count} times`);
11
+ * });
12
+ */
13
+ export function collectImageIds(doc: any): Map<string, number> {
14
+ const counts = new Map<string, number>();
15
+
16
+ doc.descendants((node: any) => {
17
+ if (node.type.name !== "image") return;
18
+
19
+ const id = node.attrs?.nodeId;
20
+ if (!id) return;
21
+
22
+ counts.set(id, (counts.get(id) ?? 0) + 1);
23
+ });
24
+
25
+ return counts;
26
+ }
27
+
28
+ /**
29
+ * Compares two maps of string keys to numeric values and identifies which keys have been removed or restored.
30
+ * @param before - A Map containing the previous state of string keys with their associated numeric values
31
+ * @param after - A Map containing the current state of string keys with their associated numeric values
32
+ * @returns An object containing two arrays:
33
+ * - `removed`: Array of keys where the numeric value decreased (or was deleted)
34
+ * - `restored`: Array of keys where the numeric value increased
35
+ */
36
+ export function diffIds(before: Map<string, number>, after: Map<string, number>) {
37
+ const removed: string[] = [];
38
+ const added: string[] = [];
39
+
40
+ const keys = new Set([...before.keys(), ...after.keys()]);
41
+
42
+ for (const key of keys) {
43
+ const b = before.get(key) ?? 0;
44
+ const a = after.get(key) ?? 0;
45
+
46
+ if (a < b) removed.push(key);
47
+ if (a > b) added.push(key);
48
+ }
49
+
50
+ return { removed, added };
51
+ }
@@ -0,0 +1,57 @@
1
+ "use client";
2
+
3
+ import { getFileUrl } from "@/modules/storage/lib/helpers";
4
+ import { Image as TiptapImage, ImageOptions as TiptapImageOptions } from "@tiptap/extension-image";
5
+
6
+ export interface ImageOptions extends TiptapImageOptions {}
7
+
8
+ export const Image = TiptapImage.extend<ImageOptions>({
9
+ atom: true,
10
+ addAttributes() {
11
+ return {
12
+ ...this.parent?.(),
13
+ // node id
14
+ nodeId: {
15
+ default: null,
16
+ parseHTML: (el) => el.getAttribute("data-node-id"),
17
+ renderHTML: (attrs) => {
18
+ if (!attrs.nodeId) return {};
19
+ return {
20
+ "data-node-id": attrs.nodeId,
21
+ ...(attrs.nodeId && !attrs.isPending ? { src: getFileUrl(attrs.nodeId) } : {}),
22
+ };
23
+ },
24
+ },
25
+
26
+ // semantics
27
+ alt: { default: null },
28
+ title: { default: null },
29
+
30
+ // layout stability
31
+ width: { default: null },
32
+ height: { default: null },
33
+
34
+ // upload UX
35
+ isPending: {
36
+ default: false,
37
+ renderHTML: (attrs) => (attrs.isPending ? { "data-pending": "true" } : {}),
38
+ },
39
+ fileName: { default: null },
40
+ };
41
+ },
42
+ parseHTML() {
43
+ return [{ tag: "img[data-node-id]" }];
44
+ },
45
+ renderHTML({ HTMLAttributes }) {
46
+ const { src: _, ...attrs } = HTMLAttributes;
47
+
48
+ console.log("attrs", attrs);
49
+
50
+ const nodeId = attrs.nodeId as string | null;
51
+ const isPending = Boolean(attrs.isPending);
52
+
53
+ const src = nodeId && !isPending ? getFileUrl(nodeId) : null;
54
+
55
+ return ["img", { ...attrs, ...(src ? { src } : {}) }];
56
+ },
57
+ });
@@ -0,0 +1,35 @@
1
+ "use client";
2
+
3
+ import { Node } from "@tiptap/core";
4
+ import { ReactNodeViewRenderer } from "@tiptap/react";
5
+ import { SkeletonNodeRenderer } from "./renderer";
6
+
7
+ export const Skeleton = Node.create({
8
+ name: "skeleton",
9
+ atom: true,
10
+ inline: true,
11
+ group: "inline",
12
+ selectable: false,
13
+ draggable: false,
14
+ addAttributes() {
15
+ return {
16
+ imageNodeId: { default: null },
17
+ width: { default: null },
18
+ height: { default: null },
19
+ };
20
+ },
21
+ addOptions() {
22
+ return {
23
+ addToHistory: false,
24
+ };
25
+ },
26
+ parseHTML() {
27
+ return [{ tag: "span[data-skeleton]" }];
28
+ },
29
+ renderHTML({ HTMLAttributes }) {
30
+ return ["span", { ...HTMLAttributes, "data-skeleton": "true" }];
31
+ },
32
+ addNodeView() {
33
+ return ReactNodeViewRenderer(SkeletonNodeRenderer);
34
+ },
35
+ });
@@ -0,0 +1,14 @@
1
+ "use client";
2
+
3
+ import { Skeleton } from "@/components/ui/skeleton";
4
+ import { NodeViewWrapper } from "@tiptap/react";
5
+
6
+ export function SkeletonNodeRenderer(props: { node: any }) {
7
+ const { width, height } = props.node.attrs;
8
+
9
+ return (
10
+ <NodeViewWrapper as="span" data-skeleton="true">
11
+ <Skeleton className="min-h-[500px] w-full" style={{ width, height }} />
12
+ </NodeViewWrapper>
13
+ );
14
+ }
@@ -5,7 +5,6 @@ import HardBreak from "@tiptap/extension-hard-break";
5
5
  import Heading from "@tiptap/extension-heading";
6
6
  import Highlight from "@tiptap/extension-highlight";
7
7
  import HorizontalRule from "@tiptap/extension-horizontal-rule";
8
- import Image from "@tiptap/extension-image";
9
8
  import Italic from "@tiptap/extension-italic";
10
9
  import Link from "@tiptap/extension-link";
11
10
  import { BulletList, ListItem, ListKeymap, OrderedList } from "@tiptap/extension-list";
@@ -15,6 +14,9 @@ import Text from "@tiptap/extension-text";
15
14
  import { Color, TextStyle } from "@tiptap/extension-text-style";
16
15
  import Underline from "@tiptap/extension-underline";
17
16
  import { Dropcursor, Gapcursor, TrailingNode, UndoRedo } from "@tiptap/extensions";
17
+ import { FileHandler } from "../extensions/file-handler/extension";
18
+ import { Image } from "../extensions/image/extension";
19
+ import { Skeleton } from "../extensions/skeleton/extension";
18
20
  import { createExtensionConfig } from "./extensions";
19
21
 
20
22
  /**
@@ -35,6 +37,8 @@ export const EDITOR_EXTENSIONS = {
35
37
  paragraph: Paragraph,
36
38
  text: Text,
37
39
  image: Image,
40
+ fileHandler: FileHandler,
41
+ skeleton: Skeleton,
38
42
  /**
39
43
  * Marks
40
44
  */
@@ -86,7 +90,17 @@ export const EDITOR_EXTENSIONS_CONFIG = [
86
90
  createExtensionConfig("bulletList"),
87
91
  createExtensionConfig("paragraph"),
88
92
  createExtensionConfig("text"),
89
- createExtensionConfig("image", { allowBase64: false }),
93
+ createExtensionConfig("image", {
94
+ resize: {
95
+ enabled: true,
96
+ directions: ["left", "right"],
97
+ minHeight: 50,
98
+ minWidth: 50,
99
+ alwaysPreserveAspectRatio: true,
100
+ },
101
+ }),
102
+ createExtensionConfig("fileHandler"),
103
+ createExtensionConfig("skeleton"),
90
104
  /**
91
105
  * Marks
92
106
  */